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
b859e9670d1bbb78fceda311e5d91d1b3229b6c3
[ "skip_fields = skip_fields or []\ndata = dict(((k, v) for k, v in db_model.as_dict().items() if k not in skip_fields))\nreturn cls(**data)", "attribute_names = [a.name for a in self._wsme_attributes]\nif omit_unset:\n attribute_names = [n for n in attribute_names if getattr(self, n) != wtypes.Unset]\nvalues = ...
<|body_start_0|> skip_fields = skip_fields or [] data = dict(((k, v) for k, v in db_model.as_dict().items() if k not in skip_fields)) return cls(**data) <|end_body_0|> <|body_start_1|> attribute_names = [a.name for a in self._wsme_attributes] if omit_unset: attribute...
APIBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APIBase: def from_db_model(cls, db_model, skip_fields=None): """Returns the object from a given database representation.""" <|body_0|> def as_dict(self, omit_unset=False): """Converts this object into dictionary.""" <|body_1|> def _lookup(self, key): ...
stack_v2_sparse_classes_36k_train_005800
2,111
permissive
[ { "docstring": "Returns the object from a given database representation.", "name": "from_db_model", "signature": "def from_db_model(cls, db_model, skip_fields=None)" }, { "docstring": "Converts this object into dictionary.", "name": "as_dict", "signature": "def as_dict(self, omit_unset=F...
3
stack_v2_sparse_classes_30k_train_011528
Implement the Python class `APIBase` described below. Class description: Implement the APIBase class. Method signatures and docstrings: - def from_db_model(cls, db_model, skip_fields=None): Returns the object from a given database representation. - def as_dict(self, omit_unset=False): Converts this object into dictio...
Implement the Python class `APIBase` described below. Class description: Implement the APIBase class. Method signatures and docstrings: - def from_db_model(cls, db_model, skip_fields=None): Returns the object from a given database representation. - def as_dict(self, omit_unset=False): Converts this object into dictio...
5833f87e20722c524a1e4a0b8e1fb82206fb4e5c
<|skeleton|> class APIBase: def from_db_model(cls, db_model, skip_fields=None): """Returns the object from a given database representation.""" <|body_0|> def as_dict(self, omit_unset=False): """Converts this object into dictionary.""" <|body_1|> def _lookup(self, key): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class APIBase: def from_db_model(cls, db_model, skip_fields=None): """Returns the object from a given database representation.""" skip_fields = skip_fields or [] data = dict(((k, v) for k, v in db_model.as_dict().items() if k not in skip_fields)) return cls(**data) def as_dict(s...
the_stack_v2_python_sparse
storyboard/api/v1/base.py
Sitcode-Zoograf/storyboard
train
0
80905ad5469b06ca5d125ced4bc7dfadac53b528
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the CustomerExtensionSetting service. Service to manage customer extension settings.
CustomerExtensionSettingServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomerExtensionSettingServiceServicer: """Proto file describing the CustomerExtensionSetting service. Service to manage customer extension settings.""" def GetCustomerExtensionSetting(self, request, context): """Returns the requested customer extension setting in full detail.""" ...
stack_v2_sparse_classes_36k_train_005801
3,940
permissive
[ { "docstring": "Returns the requested customer extension setting in full detail.", "name": "GetCustomerExtensionSetting", "signature": "def GetCustomerExtensionSetting(self, request, context)" }, { "docstring": "Creates, updates, or removes customer extension settings. Operation statuses are ret...
2
stack_v2_sparse_classes_30k_train_017272
Implement the Python class `CustomerExtensionSettingServiceServicer` described below. Class description: Proto file describing the CustomerExtensionSetting service. Service to manage customer extension settings. Method signatures and docstrings: - def GetCustomerExtensionSetting(self, request, context): Returns the r...
Implement the Python class `CustomerExtensionSettingServiceServicer` described below. Class description: Proto file describing the CustomerExtensionSetting service. Service to manage customer extension settings. Method signatures and docstrings: - def GetCustomerExtensionSetting(self, request, context): Returns the r...
a5b6cede64f4d9912ae6ad26927a54e40448c9fe
<|skeleton|> class CustomerExtensionSettingServiceServicer: """Proto file describing the CustomerExtensionSetting service. Service to manage customer extension settings.""" def GetCustomerExtensionSetting(self, request, context): """Returns the requested customer extension setting in full detail.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomerExtensionSettingServiceServicer: """Proto file describing the CustomerExtensionSetting service. Service to manage customer extension settings.""" def GetCustomerExtensionSetting(self, request, context): """Returns the requested customer extension setting in full detail.""" context...
the_stack_v2_python_sparse
google/ads/google_ads/v4/proto/services/customer_extension_setting_service_pb2_grpc.py
fiboknacky/google-ads-python
train
0
ed388c0b26a34f37a332b2258e3991723834644a
[ "super().__init__(inputs, outputs, zmq_args)\nself.topic_subscription_map = defaultdict(list)\nself.socket_to_sub = {}\nself.rxs = []\nfor topic, servers in subscriptions.items():\n for server, mode_info in servers.items():\n sub = Subscription(topic, server, **mode_info)\n self.topic_subscription_...
<|body_start_0|> super().__init__(inputs, outputs, zmq_args) self.topic_subscription_map = defaultdict(list) self.socket_to_sub = {} self.rxs = [] for topic, servers in subscriptions.items(): for server, mode_info in servers.items(): sub = Subscription...
Customize the template within the config.yaml plugin block: - plugin: name: ait.dsn.plugins.TCP.TCP_Manager inputs: - PUB_SUB_TOPIC_1 - PUB_SUB_TOPIC_2 subscriptions: PUB_SUB_TOPIC_1: Server_Name1: port: 42401 timeout: 1 mode: TRANSMIT Server_Name2: port: 42401 hostname: someserver.xyz mode: TRANSMIT PUB_SUB_TOPIC_3_RE...
TCP_Manager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TCP_Manager: """Customize the template within the config.yaml plugin block: - plugin: name: ait.dsn.plugins.TCP.TCP_Manager inputs: - PUB_SUB_TOPIC_1 - PUB_SUB_TOPIC_2 subscriptions: PUB_SUB_TOPIC_1: Server_Name1: port: 42401 timeout: 1 mode: TRANSMIT Server_Name2: port: 42401 hostname: someserve...
stack_v2_sparse_classes_36k_train_005802
11,321
permissive
[ { "docstring": "Create Subscriptions based on config.yaml entries. Forks a process to handle receiving subscriptions. Creates auxillary socket maps and lists.", "name": "__init__", "signature": "def __init__(self, inputs=None, outputs=None, zmq_args=None, subscriptions={}, *kwargs)" }, { "docstr...
3
null
Implement the Python class `TCP_Manager` described below. Class description: Customize the template within the config.yaml plugin block: - plugin: name: ait.dsn.plugins.TCP.TCP_Manager inputs: - PUB_SUB_TOPIC_1 - PUB_SUB_TOPIC_2 subscriptions: PUB_SUB_TOPIC_1: Server_Name1: port: 42401 timeout: 1 mode: TRANSMIT Server...
Implement the Python class `TCP_Manager` described below. Class description: Customize the template within the config.yaml plugin block: - plugin: name: ait.dsn.plugins.TCP.TCP_Manager inputs: - PUB_SUB_TOPIC_1 - PUB_SUB_TOPIC_2 subscriptions: PUB_SUB_TOPIC_1: Server_Name1: port: 42401 timeout: 1 mode: TRANSMIT Server...
654bc5575aa2c9792052a220854bea2d30841f8d
<|skeleton|> class TCP_Manager: """Customize the template within the config.yaml plugin block: - plugin: name: ait.dsn.plugins.TCP.TCP_Manager inputs: - PUB_SUB_TOPIC_1 - PUB_SUB_TOPIC_2 subscriptions: PUB_SUB_TOPIC_1: Server_Name1: port: 42401 timeout: 1 mode: TRANSMIT Server_Name2: port: 42401 hostname: someserve...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TCP_Manager: """Customize the template within the config.yaml plugin block: - plugin: name: ait.dsn.plugins.TCP.TCP_Manager inputs: - PUB_SUB_TOPIC_1 - PUB_SUB_TOPIC_2 subscriptions: PUB_SUB_TOPIC_1: Server_Name1: port: 42401 timeout: 1 mode: TRANSMIT Server_Name2: port: 42401 hostname: someserver.xyz mode: T...
the_stack_v2_python_sparse
ait/dsn/plugins/TCP.py
NASA-AMMOS/AIT-DSN
train
22
1fd63650323be9b69abc24f01f34b991ff5f1d5b
[ "def inner(result):\n pbar.update(1)\n self.results.append(result)\nreturn inner", "if not os.path.exists(self.target):\n os.makedirs(self.target)\nself.replicate(self.corpus.root)\nself.results = []\nfileids = self.fileids(fileids, categories)\nwith tqdm(total=len(fileids), unit='Docs') as pbar:\n po...
<|body_start_0|> def inner(result): pbar.update(1) self.results.append(result) return inner <|end_body_0|> <|body_start_1|> if not os.path.exists(self.target): os.makedirs(self.target) self.replicate(self.corpus.root) self.results = [] ...
Preprocessor that implements both multiprocessing and a progress bar. Note: had to jump through a lot of hoops just to get a progress bar, not sure it was worth it or that this performs the most effectively ...
ProgressParallelPreprocessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgressParallelPreprocessor: """Preprocessor that implements both multiprocessing and a progress bar. Note: had to jump through a lot of hoops just to get a progress bar, not sure it was worth it or that this performs the most effectively ...""" def on_result(self, pbar): """Indicat...
stack_v2_sparse_classes_36k_train_005803
13,132
no_license
[ { "docstring": "Indicates progress on result.", "name": "on_result", "signature": "def on_result(self, pbar)" }, { "docstring": "Setup the progress bar before conducting multiprocess transform.", "name": "transform", "signature": "def transform(self, fileids=None, categories=None)" } ]
2
stack_v2_sparse_classes_30k_train_003292
Implement the Python class `ProgressParallelPreprocessor` described below. Class description: Preprocessor that implements both multiprocessing and a progress bar. Note: had to jump through a lot of hoops just to get a progress bar, not sure it was worth it or that this performs the most effectively ... Method signat...
Implement the Python class `ProgressParallelPreprocessor` described below. Class description: Preprocessor that implements both multiprocessing and a progress bar. Note: had to jump through a lot of hoops just to get a progress bar, not sure it was worth it or that this performs the most effectively ... Method signat...
22395f7c83c9b561ec75e7ac8729f92444bd799b
<|skeleton|> class ProgressParallelPreprocessor: """Preprocessor that implements both multiprocessing and a progress bar. Note: had to jump through a lot of hoops just to get a progress bar, not sure it was worth it or that this performs the most effectively ...""" def on_result(self, pbar): """Indicat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProgressParallelPreprocessor: """Preprocessor that implements both multiprocessing and a progress bar. Note: had to jump through a lot of hoops just to get a progress bar, not sure it was worth it or that this performs the most effectively ...""" def on_result(self, pbar): """Indicates progress o...
the_stack_v2_python_sparse
benjamin_bengfort_applied_text_analysis/10_parallell/multi_preprocess.py
olegzinkevich/programming_books_notes_and_codes
train
0
d223e3078bd71735dbae8d125303765bb890b809
[ "team = Team.get(id_=team_id)\nif not team:\n self.error(404, 'Team not found')\nform = forms.Team()\nform.name.data = team.name\nself.render('team.html', title=u'Team: {}'.format(team.name), form=form, edit=True, users=Users.get(), team=team, members=Users_team.get(team_id=team_id))", "team = Team.get(id_=tea...
<|body_start_0|> team = Team.get(id_=team_id) if not team: self.error(404, 'Team not found') form = forms.Team() form.name.data = team.name self.render('team.html', title=u'Team: {}'.format(team.name), form=form, edit=True, users=Users.get(), team=team, members=Users_...
Handles the editing of a team.
Edit_handler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Edit_handler: """Handles the editing of a team.""" def get(self, team_id): """Renders the edit team form. :param team_id: int""" <|body_0|> def post(self, team_id): """Validates and updates the team. Redirects to the new team if successful. :param team_id: int"""...
stack_v2_sparse_classes_36k_train_005804
3,222
no_license
[ { "docstring": "Renders the edit team form. :param team_id: int", "name": "get", "signature": "def get(self, team_id)" }, { "docstring": "Validates and updates the team. Redirects to the new team if successful. :param team_id: int", "name": "post", "signature": "def post(self, team_id)" ...
2
stack_v2_sparse_classes_30k_train_013637
Implement the Python class `Edit_handler` described below. Class description: Handles the editing of a team. Method signatures and docstrings: - def get(self, team_id): Renders the edit team form. :param team_id: int - def post(self, team_id): Validates and updates the team. Redirects to the new team if successful. :...
Implement the Python class `Edit_handler` described below. Class description: Handles the editing of a team. Method signatures and docstrings: - def get(self, team_id): Renders the edit team form. :param team_id: int - def post(self, team_id): Validates and updates the team. Redirects to the new team if successful. :...
3f331c7169c90d1fac0d1922b011b56eebbd086a
<|skeleton|> class Edit_handler: """Handles the editing of a team.""" def get(self, team_id): """Renders the edit team form. :param team_id: int""" <|body_0|> def post(self, team_id): """Validates and updates the team. Redirects to the new team if successful. :param team_id: int"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Edit_handler: """Handles the editing of a team.""" def get(self, team_id): """Renders the edit team form. :param team_id: int""" team = Team.get(id_=team_id) if not team: self.error(404, 'Team not found') form = forms.Team() form.name.data = team.name ...
the_stack_v2_python_sparse
src/tlog/web/handlers/team.py
thomaserlang/TLog
train
2
2540f2153f6c6bb0a6f4398e49bd1954bde0b3fa
[ "self.df_trinary = df_trinary\ndf_valid = self.df_trinary.applymap(lambda v: 1 if v in [-1, 0, 1] else np.nan)\nif np.isnan(df_valid.sum().sum()):\n raise ValueError('Argument is not a trinary dataframe')\nself.columns = df_trinary.columns\nself.num_col = len(self.columns)\nself.indices = self.df_trinary.index\n...
<|body_start_0|> self.df_trinary = df_trinary df_valid = self.df_trinary.applymap(lambda v: 1 if v in [-1, 0, 1] else np.nan) if np.isnan(df_valid.sum().sum()): raise ValueError('Argument is not a trinary dataframe') self.columns = df_trinary.columns self.num_col = le...
TrinaryDistance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrinaryDistance: def __init__(self, df_trinary): """Parameters ---------- df_trinary: DataFrame columns: vector names index: instances values: -1, 0, 1""" <|body_0|> def calcDistance(self): """Calculates the distance between all pairs of column vectors.""" <|...
stack_v2_sparse_classes_36k_train_005805
2,227
permissive
[ { "docstring": "Parameters ---------- df_trinary: DataFrame columns: vector names index: instances values: -1, 0, 1", "name": "__init__", "signature": "def __init__(self, df_trinary)" }, { "docstring": "Calculates the distance between all pairs of column vectors.", "name": "calcDistance", ...
2
stack_v2_sparse_classes_30k_train_007481
Implement the Python class `TrinaryDistance` described below. Class description: Implement the TrinaryDistance class. Method signatures and docstrings: - def __init__(self, df_trinary): Parameters ---------- df_trinary: DataFrame columns: vector names index: instances values: -1, 0, 1 - def calcDistance(self): Calcul...
Implement the Python class `TrinaryDistance` described below. Class description: Implement the TrinaryDistance class. Method signatures and docstrings: - def __init__(self, df_trinary): Parameters ---------- df_trinary: DataFrame columns: vector names index: instances values: -1, 0, 1 - def calcDistance(self): Calcul...
a57542245f117fe6c835cc9d7ad570b9853b7e6c
<|skeleton|> class TrinaryDistance: def __init__(self, df_trinary): """Parameters ---------- df_trinary: DataFrame columns: vector names index: instances values: -1, 0, 1""" <|body_0|> def calcDistance(self): """Calculates the distance between all pairs of column vectors.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrinaryDistance: def __init__(self, df_trinary): """Parameters ---------- df_trinary: DataFrame columns: vector names index: instances values: -1, 0, 1""" self.df_trinary = df_trinary df_valid = self.df_trinary.applymap(lambda v: 1 if v in [-1, 0, 1] else np.nan) if np.isnan(df...
the_stack_v2_python_sparse
common_python/classifier/trinary_distance.py
ScienceStacks/common_python
train
1
9f7b4254b82c1a94563110e2219e74d3feea60fc
[ "with self.OutputCapturer() as output:\n try:\n mps.main(['--help'])\n except exceptions.SystemExit as e:\n self.assertEquals(e.args[0], 0)\nstdout = output.GetStdout()\nself.assertTrue(stdout.startswith('usage: '), msg='Expected output starting with \"usage: \" but got:\\n%s' % stdout)", "wit...
<|body_start_0|> with self.OutputCapturer() as output: try: mps.main(['--help']) except exceptions.SystemExit as e: self.assertEquals(e.args[0], 0) stdout = output.GetStdout() self.assertTrue(stdout.startswith('usage: '), msg='Expected outp...
Test argument handling at the main method level.
MainTest
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainTest: """Test argument handling at the main method level.""" def testHelp(self): """Test that --help is functioning""" <|body_0|> def testMissingOut(self): """Test that running without --out exits with an error.""" <|body_1|> def testMissingPacka...
stack_v2_sparse_classes_36k_train_005806
10,044
permissive
[ { "docstring": "Test that --help is functioning", "name": "testHelp", "signature": "def testHelp(self)" }, { "docstring": "Test that running without --out exits with an error.", "name": "testMissingOut", "signature": "def testMissingOut(self)" }, { "docstring": "Test that running...
4
null
Implement the Python class `MainTest` described below. Class description: Test argument handling at the main method level. Method signatures and docstrings: - def testHelp(self): Test that --help is functioning - def testMissingOut(self): Test that running without --out exits with an error. - def testMissingPackage(s...
Implement the Python class `MainTest` described below. Class description: Test argument handling at the main method level. Method signatures and docstrings: - def testHelp(self): Test that --help is functioning - def testMissingOut(self): Test that running without --out exits with an error. - def testMissingPackage(s...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class MainTest: """Test argument handling at the main method level.""" def testHelp(self): """Test that --help is functioning""" <|body_0|> def testMissingOut(self): """Test that running without --out exits with an error.""" <|body_1|> def testMissingPacka...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MainTest: """Test argument handling at the main method level.""" def testHelp(self): """Test that --help is functioning""" with self.OutputCapturer() as output: try: mps.main(['--help']) except exceptions.SystemExit as e: self.assert...
the_stack_v2_python_sparse
third_party/chromite/scripts/merge_package_status_unittest.py
metux/chromium-suckless
train
5
afbfb10d0dea072ae63016f3cd4d8596639091e5
[ "n = 1\nstart = max(clips, key=lambda x: x[1] if x[0] == 0 else 0)[0]\nend = max(clips, key=lambda x: x[1] if x[0] == 0 else 0)[1]\nif end == 0 or start != 0:\n return -1\nwhile end < T:\n tmp = end\n for clip in clips:\n if clip[0] <= end:\n tmp = max(clip[1], tmp)\n if tmp == end:\n ...
<|body_start_0|> n = 1 start = max(clips, key=lambda x: x[1] if x[0] == 0 else 0)[0] end = max(clips, key=lambda x: x[1] if x[0] == 0 else 0)[1] if end == 0 or start != 0: return -1 while end < T: tmp = end for clip in clips: if...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def videoStitching(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int""" <|body_0|> def videoStitching1(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int 超时了""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_005807
1,953
no_license
[ { "docstring": ":type clips: List[List[int]] :type T: int :rtype: int", "name": "videoStitching", "signature": "def videoStitching(self, clips, T)" }, { "docstring": ":type clips: List[List[int]] :type T: int :rtype: int 超时了", "name": "videoStitching1", "signature": "def videoStitching1(...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def videoStitching(self, clips, T): :type clips: List[List[int]] :type T: int :rtype: int - def videoStitching1(self, clips, T): :type clips: List[List[int]] :type T: int :rtype:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def videoStitching(self, clips, T): :type clips: List[List[int]] :type T: int :rtype: int - def videoStitching1(self, clips, T): :type clips: List[List[int]] :type T: int :rtype:...
2c47abbf020f44c97e7e439735e4b0d49f3b843f
<|skeleton|> class Solution: def videoStitching(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int""" <|body_0|> def videoStitching1(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int 超时了""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def videoStitching(self, clips, T): """:type clips: List[List[int]] :type T: int :rtype: int""" n = 1 start = max(clips, key=lambda x: x[1] if x[0] == 0 else 0)[0] end = max(clips, key=lambda x: x[1] if x[0] == 0 else 0)[1] if end == 0 or start != 0: ...
the_stack_v2_python_sparse
LeetCode/LeetCode1024VideoStitching.py
weiguangjiayou/LeetCode
train
0
994230ab0479ed58e3b84eb43673850649f3c682
[ "data = self.data\ncode = data['code']\nreturn f'{PLATFORM_URL}reset-password/{code}'", "payload = super().transform()\ndata = self.data\nexpires = data.get('expiration_date')\nif expires.endswith('Z'):\n expires = expires[:-1]\nexpires = self._format_datetime(expires)\npayload[0]['data']['CODE'] = data.get('c...
<|body_start_0|> data = self.data code = data['code'] return f'{PLATFORM_URL}reset-password/{code}' <|end_body_0|> <|body_start_1|> payload = super().transform() data = self.data expires = data.get('expiration_date') if expires.endswith('Z'): expires ...
Send an email to the user the details of a password reset request.
PasswordReset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PasswordReset: """Send an email to the user the details of a password reset request.""" def _action_url(self) -> str: """Return the action URL for the object.""" <|body_0|> def transform(self) -> t.List[dict]: """Transform data.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_005808
4,062
no_license
[ { "docstring": "Return the action URL for the object.", "name": "_action_url", "signature": "def _action_url(self) -> str" }, { "docstring": "Transform data.", "name": "transform", "signature": "def transform(self) -> t.List[dict]" } ]
2
null
Implement the Python class `PasswordReset` described below. Class description: Send an email to the user the details of a password reset request. Method signatures and docstrings: - def _action_url(self) -> str: Return the action URL for the object. - def transform(self) -> t.List[dict]: Transform data.
Implement the Python class `PasswordReset` described below. Class description: Send an email to the user the details of a password reset request. Method signatures and docstrings: - def _action_url(self) -> str: Return the action URL for the object. - def transform(self) -> t.List[dict]: Transform data. <|skeleton|>...
cca179f55ebc3c420426eff59b23d7c8963ca9a3
<|skeleton|> class PasswordReset: """Send an email to the user the details of a password reset request.""" def _action_url(self) -> str: """Return the action URL for the object.""" <|body_0|> def transform(self) -> t.List[dict]: """Transform data.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PasswordReset: """Send an email to the user the details of a password reset request.""" def _action_url(self) -> str: """Return the action URL for the object.""" data = self.data code = data['code'] return f'{PLATFORM_URL}reset-password/{code}' def transform(self) -> ...
the_stack_v2_python_sparse
src/briefy/choreographer/actions/mail/user.py
BriefyHQ/briefy.choreographer
train
0
55d16712ad6119f64aae84bbef6b200c4e493e01
[ "import re\nregex = '^(?P<id>\\\\w+)\\\\s+(?P<type>\\\\w+)\\\\s+(?P<cluster_id>\\\\w+)\\\\s+(?P<cluster_count>\\\\w+)$'\nmatched = re.match(regex, comment_str.strip())\nif not matched:\n return None\nreturn matched.groupdict()", "import re\nregex = '^(?P<length>\\\\w+)\\\\s+(?P<id>\\\\w+)\\\\s+(?P<type>\\\\w+)...
<|body_start_0|> import re regex = '^(?P<id>\\w+)\\s+(?P<type>\\w+)\\s+(?P<cluster_id>\\w+)\\s+(?P<cluster_count>\\w+)$' matched = re.match(regex, comment_str.strip()) if not matched: return None return matched.groupdict() <|end_body_0|> <|body_start_1|> impo...
"Comment string" parser. A "comment string" is commonly used in various of NGS file format (like "fasta", "dot-bracket" files, etc.) which helps convey some "basic info". This parser is to help retrieve this info.
CommentParser
[ "MIT", "BSD-3-Clause", "BSD-2-Clause", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentParser: """"Comment string" parser. A "comment string" is commonly used in various of NGS file format (like "fasta", "dot-bracket" files, etc.) which helps convey some "basic info". This parser is to help retrieve this info.""" def parse_rsample_dot_bracket(cls, comment_str): ...
stack_v2_sparse_classes_36k_train_005809
3,306
permissive
[ { "docstring": "Parse the \"comment string\" for a \"RSample dot-bracket\" result file. An example for the \"RSample comment string\": >001 centroid 1 655 Elements: - '001' - RNA ID - 'centroid' - clustering result type, centroid | bpp - '1' - clustering # - '655' - clustering size Parameters ---------- comment...
3
stack_v2_sparse_classes_30k_test_000976
Implement the Python class `CommentParser` described below. Class description: "Comment string" parser. A "comment string" is commonly used in various of NGS file format (like "fasta", "dot-bracket" files, etc.) which helps convey some "basic info". This parser is to help retrieve this info. Method signatures and doc...
Implement the Python class `CommentParser` described below. Class description: "Comment string" parser. A "comment string" is commonly used in various of NGS file format (like "fasta", "dot-bracket" files, etc.) which helps convey some "basic info". This parser is to help retrieve this info. Method signatures and doc...
0cc238745a2679d763b356609d312c3f447a0be7
<|skeleton|> class CommentParser: """"Comment string" parser. A "comment string" is commonly used in various of NGS file format (like "fasta", "dot-bracket" files, etc.) which helps convey some "basic info". This parser is to help retrieve this info.""" def parse_rsample_dot_bracket(cls, comment_str): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommentParser: """"Comment string" parser. A "comment string" is commonly used in various of NGS file format (like "fasta", "dot-bracket" files, etc.) which helps convey some "basic info". This parser is to help retrieve this info.""" def parse_rsample_dot_bracket(cls, comment_str): """Parse the ...
the_stack_v2_python_sparse
feature_generation/neo-rna/neoRNA/util/parser/comment_parser.py
kundajelab/PREUSS
train
2
00daafeb4e8f16d5acde7ff5459533b177935bea
[ "res = []\nstack = []\nwhile root or stack:\n while root:\n stack.append(root)\n root = root.left\n root = stack.pop()\n res.append(root.val)\n root = root.right\nreturn res", "def getSuccessor(root: TreeNode) -> TreeNode:\n succ = root.left\n while succ.right and succ.right != roo...
<|body_start_0|> res = [] stack = [] while root or stack: while root: stack.append(root) root = root.left root = stack.pop() res.append(root.val) root = root.right return res <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def inorderTraversal_MK1(self, root: Optional[TreeNode]) -> List[int]: """Iterating method using Stack Time complexity: O(n) Space complexity: O(n)""" <|body_0|> def inorderTraversal_MK2(self, root: Optional[TreeNode]) -> List[int]: """Morris Traversal Time...
stack_v2_sparse_classes_36k_train_005810
1,513
no_license
[ { "docstring": "Iterating method using Stack Time complexity: O(n) Space complexity: O(n)", "name": "inorderTraversal_MK1", "signature": "def inorderTraversal_MK1(self, root: Optional[TreeNode]) -> List[int]" }, { "docstring": "Morris Traversal Time complexity: O(n) Space complexity: O(1)", ...
2
stack_v2_sparse_classes_30k_train_014424
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal_MK1(self, root: Optional[TreeNode]) -> List[int]: Iterating method using Stack Time complexity: O(n) Space complexity: O(n) - def inorderTraversal_MK2(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal_MK1(self, root: Optional[TreeNode]) -> List[int]: Iterating method using Stack Time complexity: O(n) Space complexity: O(n) - def inorderTraversal_MK2(self, ...
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
<|skeleton|> class Solution: def inorderTraversal_MK1(self, root: Optional[TreeNode]) -> List[int]: """Iterating method using Stack Time complexity: O(n) Space complexity: O(n)""" <|body_0|> def inorderTraversal_MK2(self, root: Optional[TreeNode]) -> List[int]: """Morris Traversal Time...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def inorderTraversal_MK1(self, root: Optional[TreeNode]) -> List[int]: """Iterating method using Stack Time complexity: O(n) Space complexity: O(n)""" res = [] stack = [] while root or stack: while root: stack.append(root) r...
the_stack_v2_python_sparse
0094. Binary Tree Inorder Traversal/Solution.py
faterazer/LeetCode
train
4
fb9938a19457519969586630776fab56b40cbb43
[ "widget_attrs = {'class': theme.form_element_html_class, 'type': 'date'}\nyears = None\nif self.data.year_min and self.data.year_max:\n years = range(self.data.year_min, self.data.year_max)\nfield_kwargs = {'label': self.data.label, 'help_text': self.data.help_text, 'initial': self.data.initial, 'required': self...
<|body_start_0|> widget_attrs = {'class': theme.form_element_html_class, 'type': 'date'} years = None if self.data.year_min and self.data.year_max: years = range(self.data.year_min, self.data.year_max) field_kwargs = {'label': self.data.label, 'help_text': self.data.help_text...
Date drop down field plugin.
DateDropDownInputPlugin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DateDropDownInputPlugin: """Date drop down field plugin.""" def get_form_field_instances(self, request=None, form_entry=None, form_element_entries=None, **kwargs): """Get form field instances.""" <|body_0|> def submit_plugin_form_data(self, form_entry, request, form, for...
stack_v2_sparse_classes_36k_train_005811
2,604
permissive
[ { "docstring": "Get form field instances.", "name": "get_form_field_instances", "signature": "def get_form_field_instances(self, request=None, form_entry=None, form_element_entries=None, **kwargs)" }, { "docstring": "Submit plugin form data/process. :param fobi.models.FormEntry form_entry: Insta...
2
null
Implement the Python class `DateDropDownInputPlugin` described below. Class description: Date drop down field plugin. Method signatures and docstrings: - def get_form_field_instances(self, request=None, form_entry=None, form_element_entries=None, **kwargs): Get form field instances. - def submit_plugin_form_data(self...
Implement the Python class `DateDropDownInputPlugin` described below. Class description: Date drop down field plugin. Method signatures and docstrings: - def get_form_field_instances(self, request=None, form_entry=None, form_element_entries=None, **kwargs): Get form field instances. - def submit_plugin_form_data(self...
4f6ca37bc600dcba3f74400d299826882d53b7d2
<|skeleton|> class DateDropDownInputPlugin: """Date drop down field plugin.""" def get_form_field_instances(self, request=None, form_entry=None, form_element_entries=None, **kwargs): """Get form field instances.""" <|body_0|> def submit_plugin_form_data(self, form_entry, request, form, for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DateDropDownInputPlugin: """Date drop down field plugin.""" def get_form_field_instances(self, request=None, form_entry=None, form_element_entries=None, **kwargs): """Get form field instances.""" widget_attrs = {'class': theme.form_element_html_class, 'type': 'date'} years = None ...
the_stack_v2_python_sparse
events/contrib/plugins/form_elements/fields/date_drop_down/base.py
mansonul/events
train
0
d224de054a109824421b7cd2d6dd1af4e237f212
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('cyyan_liuzirui_yjunchoi_yzhang71', 'cyyan_liuzirui_yjunchoi_yzhang71')\nurl = 'http://datamechanics.io/data/wuhaoyu_yiran123/MBTA_Bus_Stops.geojson'\nresponse = urllib.request.urlopen(url).read().decode(...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('cyyan_liuzirui_yjunchoi_yzhang71', 'cyyan_liuzirui_yjunchoi_yzhang71') url = 'http://datamechanics.io/data/wuhaoyu_yiran123/MBTA_Bus_Stops.geojson' ...
busstopCoordinates
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class busstopCoordinates: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing every...
stack_v2_sparse_classes_36k_train_005812
4,070
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_014954
Implement the Python class `busstopCoordinates` described below. Class description: Implement the busstopCoordinates class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTi...
Implement the Python class `busstopCoordinates` described below. Class description: Implement the busstopCoordinates class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTi...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class busstopCoordinates: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing every...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class busstopCoordinates: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('cyyan_liuzirui_yjunchoi_yzhang71...
the_stack_v2_python_sparse
cyyan_liuzirui_yjunchoi_yzhang71/busstopCoordinates.py
ROODAY/course-2017-fal-proj
train
3
c7a17213a818bf2743d5548d99ac1f3265a2d2b4
[ "if alert_rate > 1 or alert_rate < 0:\n raise ValueError('Alert rate is outside of valid range [0,1]')\nself.alert_rate = alert_rate", "ypred_proba = self._standardize_input_type(ypred_proba)\nif len(ypred_proba.unique()) == 1:\n logger.debug(f'All predicted probabilities have the same value: {ypred_proba.u...
<|body_start_0|> if alert_rate > 1 or alert_rate < 0: raise ValueError('Alert rate is outside of valid range [0,1]') self.alert_rate = alert_rate <|end_body_0|> <|body_start_1|> ypred_proba = self._standardize_input_type(ypred_proba) if len(ypred_proba.unique()) == 1: ...
SensitivityLowAlert
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SensitivityLowAlert: def __init__(self, alert_rate=0.01): """Create instance of SensitivityLowAlert Arguments: alert_rate (float): percentage of top scores to classify as high risk""" <|body_0|> def decision_function(self, ypred_proba, **kwargs): """Determine if an o...
stack_v2_sparse_classes_36k_train_005813
2,359
permissive
[ { "docstring": "Create instance of SensitivityLowAlert Arguments: alert_rate (float): percentage of top scores to classify as high risk", "name": "__init__", "signature": "def __init__(self, alert_rate=0.01)" }, { "docstring": "Determine if an observation is high risk given an alert rate Argumen...
3
stack_v2_sparse_classes_30k_train_018228
Implement the Python class `SensitivityLowAlert` described below. Class description: Implement the SensitivityLowAlert class. Method signatures and docstrings: - def __init__(self, alert_rate=0.01): Create instance of SensitivityLowAlert Arguments: alert_rate (float): percentage of top scores to classify as high risk...
Implement the Python class `SensitivityLowAlert` described below. Class description: Implement the SensitivityLowAlert class. Method signatures and docstrings: - def __init__(self, alert_rate=0.01): Create instance of SensitivityLowAlert Arguments: alert_rate (float): percentage of top scores to classify as high risk...
3b5bf62b08a5a5bc6485ba5387a08c32e1857473
<|skeleton|> class SensitivityLowAlert: def __init__(self, alert_rate=0.01): """Create instance of SensitivityLowAlert Arguments: alert_rate (float): percentage of top scores to classify as high risk""" <|body_0|> def decision_function(self, ypred_proba, **kwargs): """Determine if an o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SensitivityLowAlert: def __init__(self, alert_rate=0.01): """Create instance of SensitivityLowAlert Arguments: alert_rate (float): percentage of top scores to classify as high risk""" if alert_rate > 1 or alert_rate < 0: raise ValueError('Alert rate is outside of valid range [0,1]'...
the_stack_v2_python_sparse
evalml/objectives/sensitivity_low_alert.py
ObinnaObeleagu/evalml
train
1
d2f6fd5dc677294c203cab224898593d5434412e
[ "self = self.sudo()\nMove = self.env['stock.move']\nMoveLine = self.env['stock.move.line']\nPush = self.env['stock.rule']\ndone_moves = self.filtered(lambda m: m.state == 'done')\nmove_lines_by_location = done_moves.move_line_ids.groupby('location_dest_id')\nmove_lines_by_push = {}\nfor location, loc_mls in move_li...
<|body_start_0|> self = self.sudo() Move = self.env['stock.move'] MoveLine = self.env['stock.move.line'] Push = self.env['stock.rule'] done_moves = self.filtered(lambda m: m.state == 'done') move_lines_by_location = done_moves.move_line_ids.groupby('location_dest_id') ...
StockMove
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StockMove: def push_from_drop(self): """Creates new moves for the moves that have just dropped stock in a location. NOTE: Uses sudo to override permissions. This is because the use case for this function is independent of the user permissions.""" <|body_0|> def _get_push_mov...
stack_v2_sparse_classes_36k_train_005814
3,894
no_license
[ { "docstring": "Creates new moves for the moves that have just dropped stock in a location. NOTE: Uses sudo to override permissions. This is because the use case for this function is independent of the user permissions.", "name": "push_from_drop", "signature": "def push_from_drop(self)" }, { "do...
5
null
Implement the Python class `StockMove` described below. Class description: Implement the StockMove class. Method signatures and docstrings: - def push_from_drop(self): Creates new moves for the moves that have just dropped stock in a location. NOTE: Uses sudo to override permissions. This is because the use case for ...
Implement the Python class `StockMove` described below. Class description: Implement the StockMove class. Method signatures and docstrings: - def push_from_drop(self): Creates new moves for the moves that have just dropped stock in a location. NOTE: Uses sudo to override permissions. This is because the use case for ...
0f69491b1538892c1921ae8063d9ea269e15d9ce
<|skeleton|> class StockMove: def push_from_drop(self): """Creates new moves for the moves that have just dropped stock in a location. NOTE: Uses sudo to override permissions. This is because the use case for this function is independent of the user permissions.""" <|body_0|> def _get_push_mov...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StockMove: def push_from_drop(self): """Creates new moves for the moves that have just dropped stock in a location. NOTE: Uses sudo to override permissions. This is because the use case for this function is independent of the user permissions.""" self = self.sudo() Move = self.env['sto...
the_stack_v2_python_sparse
addons/udes_stock_routing/models/stock_move.py
unipartdigital/udes-open
train
7
14e7633d024e895a24315e735a1d7792d235b9c6
[ "super(AdditiveUpsampleLayer, self).__init__(name=name)\nself.new_size = new_size\nself.n_splits = int(n_splits)", "check_divisible_channels(input_tensor, self.n_splits)\nresizing_layer = ResizingLayer(self.new_size)\nsplit = tf.split(resizing_layer(input_tensor), self.n_splits, axis=-1)\nsplit_tensor = tf.stack(...
<|body_start_0|> super(AdditiveUpsampleLayer, self).__init__(name=name) self.new_size = new_size self.n_splits = int(n_splits) <|end_body_0|> <|body_start_1|> check_divisible_channels(input_tensor, self.n_splits) resizing_layer = ResizingLayer(self.new_size) split = tf.s...
Implementation of bilinear (or trilinear) additive upsampling layer, described in paper: Wojna et al., The devil is in the decoder, https://arxiv.org/abs/1707.05847 In the paper 2D images are upsampled by a factor of 2 and ``n_splits = 4``
AdditiveUpsampleLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdditiveUpsampleLayer: """Implementation of bilinear (or trilinear) additive upsampling layer, described in paper: Wojna et al., The devil is in the decoder, https://arxiv.org/abs/1707.05847 In the paper 2D images are upsampled by a factor of 2 and ``n_splits = 4``""" def __init__(self, new_...
stack_v2_sparse_classes_36k_train_005815
4,253
permissive
[ { "docstring": ":param new_size: integer or a list of integers set the output 2D/3D spatial shape. If the parameter is an integer ``d``, it'll be expanded to ``(d, d)`` and ``(d, d, d)`` for 2D and 3D inputs respectively. :param n_splits: integer, the output tensor will have ``C / n_splits`` channels, where ``C...
2
stack_v2_sparse_classes_30k_train_015122
Implement the Python class `AdditiveUpsampleLayer` described below. Class description: Implementation of bilinear (or trilinear) additive upsampling layer, described in paper: Wojna et al., The devil is in the decoder, https://arxiv.org/abs/1707.05847 In the paper 2D images are upsampled by a factor of 2 and ``n_split...
Implement the Python class `AdditiveUpsampleLayer` described below. Class description: Implementation of bilinear (or trilinear) additive upsampling layer, described in paper: Wojna et al., The devil is in the decoder, https://arxiv.org/abs/1707.05847 In the paper 2D images are upsampled by a factor of 2 and ``n_split...
84dd0f85c9a1ab8a72f4c55fcf073379acf5ae1b
<|skeleton|> class AdditiveUpsampleLayer: """Implementation of bilinear (or trilinear) additive upsampling layer, described in paper: Wojna et al., The devil is in the decoder, https://arxiv.org/abs/1707.05847 In the paper 2D images are upsampled by a factor of 2 and ``n_splits = 4``""" def __init__(self, new_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdditiveUpsampleLayer: """Implementation of bilinear (or trilinear) additive upsampling layer, described in paper: Wojna et al., The devil is in the decoder, https://arxiv.org/abs/1707.05847 In the paper 2D images are upsampled by a factor of 2 and ``n_splits = 4``""" def __init__(self, new_size, n_split...
the_stack_v2_python_sparse
niftynet/layer/additive_upsample.py
12SigmaTechnologies/NiftyNet-1
train
2
b980f5e5340e4e7638559b3c2171b4cbaad17444
[ "super(CCSDSPacketHandler, self).__init__(input_type, output_type)\nself.packet_types = kwargs['packet_types']\nself.packet_secondary_header_length = kwargs.get('packet_secondary_header_length', 0)\ntlm_dict = tlm.getDefaultDict()\nfor packet_name in self.packet_types.values():\n if packet_name not in tlm_dict.k...
<|body_start_0|> super(CCSDSPacketHandler, self).__init__(input_type, output_type) self.packet_types = kwargs['packet_types'] self.packet_secondary_header_length = kwargs.get('packet_secondary_header_length', 0) tlm_dict = tlm.getDefaultDict() for packet_name in self.packet_types...
This CCSDS handler provides a way to accept multiple packet types on a single stream and have them be processed. This handler takes a string of raw binary data containing CCSDS packet data. It maps the APID of the packet to a packet name from the config, and then uses the packet name to get the UID from the default tel...
CCSDSPacketHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CCSDSPacketHandler: """This CCSDS handler provides a way to accept multiple packet types on a single stream and have them be processed. This handler takes a string of raw binary data containing CCSDS packet data. It maps the APID of the packet to a packet name from the config, and then uses the p...
stack_v2_sparse_classes_36k_train_005816
4,832
permissive
[ { "docstring": "Params: input_type: (optional) Specifies expected input type, used to validate handler workflow. Defaults to None. output_type: (optional) Specifies expected output type, used to validate handler workflow. Defaults to None packet_types: (required) APID value (string) : packet name (string) pairs...
3
stack_v2_sparse_classes_30k_train_018972
Implement the Python class `CCSDSPacketHandler` described below. Class description: This CCSDS handler provides a way to accept multiple packet types on a single stream and have them be processed. This handler takes a string of raw binary data containing CCSDS packet data. It maps the APID of the packet to a packet na...
Implement the Python class `CCSDSPacketHandler` described below. Class description: This CCSDS handler provides a way to accept multiple packet types on a single stream and have them be processed. This handler takes a string of raw binary data containing CCSDS packet data. It maps the APID of the packet to a packet na...
1badbd80a4cc1e756fe368ad3344dd9f8d13ad3f
<|skeleton|> class CCSDSPacketHandler: """This CCSDS handler provides a way to accept multiple packet types on a single stream and have them be processed. This handler takes a string of raw binary data containing CCSDS packet data. It maps the APID of the packet to a packet name from the config, and then uses the p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CCSDSPacketHandler: """This CCSDS handler provides a way to accept multiple packet types on a single stream and have them be processed. This handler takes a string of raw binary data containing CCSDS packet data. It maps the APID of the packet to a packet name from the config, and then uses the packet name to...
the_stack_v2_python_sparse
ait/core/server/handlers/ccsds_packet_handler.py
NASA-AMMOS/AIT-Core
train
43
67791acdfd7270f749d39143148337731e8cb0cd
[ "j = 0\nfor i in range(1, len(nums)):\n if nums[i] != nums[i - 1]:\n j += 1\n nums[j] = nums[i]\nreturn j + 1 if len(nums) else 0", "\"\"\"\n 解法2:\n \"\"\"\nfor i in range(len(nums) - 1, 1, -1):\n if nums[i] == nums[i - 2]:\n nums.pop(i)\nreturn len(nums)" ]
<|body_start_0|> j = 0 for i in range(1, len(nums)): if nums[i] != nums[i - 1]: j += 1 nums[j] = nums[i] return j + 1 if len(nums) else 0 <|end_body_0|> <|body_start_1|> """ 解法2: """ for i in range(len(n...
删除排序数组中的重复项 II 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。 示例 1: 给定数组 nums = [1,1,2], 函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。 你不需要考虑数组中超出新长度后面的元素。 示例 2: 给定 nums = [0,0,1,1,1,2,2,3,3,4], 函数应该返回新的长度 5, 并且原数组 nums 的前五个元素被修改为 0, 1, 2, 3, 4。 你不需要考虑数组中超出新长度后面的元素。 说明: 为什么返...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """删除排序数组中的重复项 II 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。 示例 1: 给定数组 nums = [1,1,2], 函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。 你不需要考虑数组中超出新长度后面的元素。 示例 2: 给定 nums = [0,0,1,1,1,2,2,3,3,4], 函数应该返回新的长度 5, 并且原数组 nums 的前五个元素被修改为 0, 1, 2,...
stack_v2_sparse_classes_36k_train_005817
4,181
no_license
[ { "docstring": "解法:快慢指针,快指针正常遍历数组,慢指针在遇到不重复的数字时才加1", "name": "removeDuplicates", "signature": "def removeDuplicates(self, nums: list) -> int" }, { "docstring": "解法1:双指针,一次扫描,直接修改数组中的值", "name": "removeDuplicates2", "signature": "def removeDuplicates2(self, nums: list) -> int" } ]
2
stack_v2_sparse_classes_30k_test_001192
Implement the Python class `Solution` described below. Class description: 删除排序数组中的重复项 II 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。 示例 1: 给定数组 nums = [1,1,2], 函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。 你不需要考虑数组中超出新长度后面的元素。 示例 2: 给定 nums = [0,0,1,1,1,2,2,3,3,4], 函数应该返...
Implement the Python class `Solution` described below. Class description: 删除排序数组中的重复项 II 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。 示例 1: 给定数组 nums = [1,1,2], 函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。 你不需要考虑数组中超出新长度后面的元素。 示例 2: 给定 nums = [0,0,1,1,1,2,2,3,3,4], 函数应该返...
ad25281be49dfb9de211ba324b398e946e49025d
<|skeleton|> class Solution: """删除排序数组中的重复项 II 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。 示例 1: 给定数组 nums = [1,1,2], 函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。 你不需要考虑数组中超出新长度后面的元素。 示例 2: 给定 nums = [0,0,1,1,1,2,2,3,3,4], 函数应该返回新的长度 5, 并且原数组 nums 的前五个元素被修改为 0, 1, 2,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """删除排序数组中的重复项 II 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。 示例 1: 给定数组 nums = [1,1,2], 函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。 你不需要考虑数组中超出新长度后面的元素。 示例 2: 给定 nums = [0,0,1,1,1,2,2,3,3,4], 函数应该返回新的长度 5, 并且原数组 nums 的前五个元素被修改为 0, 1, 2, 3, 4。 你不需要考虑...
the_stack_v2_python_sparse
人生苦短/删除排序数组中的重复项(1-2).py
Jsonlmy/leetcode
train
0
8ae14875ee78da7ac0995182b40d52fc42f28300
[ "nums.sort(reverse=True)\nself.list = nums[0:k]\nself.max = k", "l = len(self.list)\nif l == self.max and val <= self.list[l - 1]:\n return self.list[l - 1]\nbinsert = False\nfor i in range(l):\n if val > self.list[i]:\n self.list.insert(i, val)\n binsert = True\n l += 1\n break\...
<|body_start_0|> nums.sort(reverse=True) self.list = nums[0:k] self.max = k <|end_body_0|> <|body_start_1|> l = len(self.list) if l == self.max and val <= self.list[l - 1]: return self.list[l - 1] binsert = False for i in range(l): if val ...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums.sort(reverse=True) self.list = nums[0:k] ...
stack_v2_sparse_classes_36k_train_005818
952
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_004671
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
7eb88f29ee518b599d6237ab5af64df76568d48b
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" nums.sort(reverse=True) self.list = nums[0:k] self.max = k def add(self, val): """:type val: int :rtype: int""" l = len(self.list) if l == self.max and val <= self.lis...
the_stack_v2_python_sparse
703. Kth Largest Element in a Stream.py
zhishu520/leetcode
train
0
6fa0fc6410621ba32ffccb997693cd2b1dc6d9ff
[ "memo = {}\nfor item1 in A:\n for item2 in A:\n item = item1 & item2\n memo[item] = memo.get(item, 0) + 1\nres = 0\nfor item1 in A:\n for item2 in memo.keys():\n if item1 & item2 == 0:\n res += memo[item2]\nreturn res", "tmp = []\nmaxlen = 0\nfor a in A:\n tmp.append(bin(a...
<|body_start_0|> memo = {} for item1 in A: for item2 in A: item = item1 & item2 memo[item] = memo.get(item, 0) + 1 res = 0 for item1 in A: for item2 in memo.keys(): if item1 & item2 == 0: res += m...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countTriplets(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def solve2(self, A): """:type A: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> memo = {} for item1 in A: for item2 in A...
stack_v2_sparse_classes_36k_train_005819
2,444
no_license
[ { "docstring": ":type A: List[int] :rtype: int", "name": "countTriplets", "signature": "def countTriplets(self, A)" }, { "docstring": ":type A: List[int] :rtype: int", "name": "solve2", "signature": "def solve2(self, A)" } ]
2
stack_v2_sparse_classes_30k_train_017836
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countTriplets(self, A): :type A: List[int] :rtype: int - def solve2(self, A): :type A: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countTriplets(self, A): :type A: List[int] :rtype: int - def solve2(self, A): :type A: List[int] :rtype: int <|skeleton|> class Solution: def countTriplets(self, A): ...
a5cb862f0c5a3cfd21468141800568c2dedded0a
<|skeleton|> class Solution: def countTriplets(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def solve2(self, A): """:type A: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countTriplets(self, A): """:type A: List[int] :rtype: int""" memo = {} for item1 in A: for item2 in A: item = item1 & item2 memo[item] = memo.get(item, 0) + 1 res = 0 for item1 in A: for item2 in memo...
the_stack_v2_python_sparse
python/leetcode/982_tripes_bitwise_and.py
Levintsky/topcoder
train
0
74a626bfc88798c76fea7e0b97571392adb97d03
[ "super(DeactivateReactivateBlockStorage, cls).setUpClass()\ncls.server = cls.compute.servers.behaviors.create_active_server().entity\ncls.image = cls.compute.images.behaviors.create_active_image(cls.server.id).entity\ncls.resources.add(cls.server.id, cls.compute.servers.client.delete_server)\ncls.resources.add(cls....
<|body_start_0|> super(DeactivateReactivateBlockStorage, cls).setUpClass() cls.server = cls.compute.servers.behaviors.create_active_server().entity cls.image = cls.compute.images.behaviors.create_active_image(cls.server.id).entity cls.resources.add(cls.server.id, cls.compute.servers.clie...
DeactivateReactivateBlockStorage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeactivateReactivateBlockStorage: def setUpClass(cls): """Perform actions that setup the necessary resources for testing The following resources are created during this setup: - A server with defaults defined in server behaviors - An image from the newly created server The following data...
stack_v2_sparse_classes_36k_train_005820
3,822
permissive
[ { "docstring": "Perform actions that setup the necessary resources for testing The following resources are created during this setup: - A server with defaults defined in server behaviors - An image from the newly created server The following data is generated during this set up: - Get compute integration compos...
3
null
Implement the Python class `DeactivateReactivateBlockStorage` described below. Class description: Implement the DeactivateReactivateBlockStorage class. Method signatures and docstrings: - def setUpClass(cls): Perform actions that setup the necessary resources for testing The following resources are created during thi...
Implement the Python class `DeactivateReactivateBlockStorage` described below. Class description: Implement the DeactivateReactivateBlockStorage class. Method signatures and docstrings: - def setUpClass(cls): Perform actions that setup the necessary resources for testing The following resources are created during thi...
30f0e64672676c3f90b4a582fe90fac6621475b3
<|skeleton|> class DeactivateReactivateBlockStorage: def setUpClass(cls): """Perform actions that setup the necessary resources for testing The following resources are created during this setup: - A server with defaults defined in server behaviors - An image from the newly created server The following data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeactivateReactivateBlockStorage: def setUpClass(cls): """Perform actions that setup the necessary resources for testing The following resources are created during this setup: - A server with defaults defined in server behaviors - An image from the newly created server The following data is generated ...
the_stack_v2_python_sparse
cloudroast/glance/integration/blockstorage/deactivate_reactivate_block_storage_test.py
RULCSoft/cloudroast
train
1
252f69440a1434297f6c5b43b1846803dc558a93
[ "from betse.util.os.brand import macos\nfrom betse.util.path import dirs, pathnames\nfrom betse.util.os.command import cmdrun, cmds\nsuper().finalize_options()\nif macos.is_macos() and cmds.is_cmd('brew'):\n brew_cellar_dir = cmdrun.get_output_interleaved_or_die(command_words=('brew', '--cellar'))\n brew_dir ...
<|body_start_0|> from betse.util.os.brand import macos from betse.util.path import dirs, pathnames from betse.util.os.command import cmdrun, cmds super().finalize_options() if macos.is_macos() and cmds.is_cmd('brew'): brew_cellar_dir = cmdrun.get_output_interleaved_or...
Editably install (e.g., in a symbolically linked manner) this application for the active Python interpreter *without* unnecessary (and occasionally harmful) dependency resolution. Unlike the default ``develop`` command, this command is suitable for system-wide installation.
symlink
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class symlink: """Editably install (e.g., in a symbolically linked manner) this application for the active Python interpreter *without* unnecessary (and occasionally harmful) dependency resolution. Unlike the default ``develop`` command, this command is suitable for system-wide installation.""" de...
stack_v2_sparse_classes_36k_train_005821
13,816
no_license
[ { "docstring": "Default undefined command-specific options to the options passed to the current parent command if any (e.g., ``install``).", "name": "finalize_options", "signature": "def finalize_options(self)" }, { "docstring": "Run the current command and all subcommands thereof.", "name":...
2
null
Implement the Python class `symlink` described below. Class description: Editably install (e.g., in a symbolically linked manner) this application for the active Python interpreter *without* unnecessary (and occasionally harmful) dependency resolution. Unlike the default ``develop`` command, this command is suitable f...
Implement the Python class `symlink` described below. Class description: Editably install (e.g., in a symbolically linked manner) this application for the active Python interpreter *without* unnecessary (and occasionally harmful) dependency resolution. Unlike the default ``develop`` command, this command is suitable f...
dd03ff5e3df3ef48d887a6566a6286fcd168880b
<|skeleton|> class symlink: """Editably install (e.g., in a symbolically linked manner) this application for the active Python interpreter *without* unnecessary (and occasionally harmful) dependency resolution. Unlike the default ``develop`` command, this command is suitable for system-wide installation.""" de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class symlink: """Editably install (e.g., in a symbolically linked manner) this application for the active Python interpreter *without* unnecessary (and occasionally harmful) dependency resolution. Unlike the default ``develop`` command, this command is suitable for system-wide installation.""" def finalize_op...
the_stack_v2_python_sparse
betse/lib/setuptools/command/supcmdsymlink.py
R-Stefano/betse-ml
train
0
4964eb35309f007839db58a757a265390428f46c
[ "if compile:\n regex = re.compile(regex)\nmm = regex.findall(line)\nif mm:\n return mm\nelse:\n return 0", "if compile:\n regex = re.compile(regex)\nmm = regex.match(line)\nif mm != None:\n return mm.groups()\nelse:\n return 0", "if compile:\n regex = re.compile(regex)\nline = regex.sub(s, ...
<|body_start_0|> if compile: regex = re.compile(regex) mm = regex.findall(line) if mm: return mm else: return 0 <|end_body_0|> <|body_start_1|> if compile: regex = re.compile(regex) mm = regex.match(line) if mm != N...
regular expression functions
Lib
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Lib: """regular expression functions""" def FindAll(self, line, regex, compile=0): """find all regex 'regex' in string 'line' compile: must we compile a regex before, or is it compiled?""" <|body_0|> def Match(self, line, regex, compile=0): """find regex 'regex' ...
stack_v2_sparse_classes_36k_train_005822
1,115
no_license
[ { "docstring": "find all regex 'regex' in string 'line' compile: must we compile a regex before, or is it compiled?", "name": "FindAll", "signature": "def FindAll(self, line, regex, compile=0)" }, { "docstring": "find regex 'regex' in string 'line' compile: must we compile a regex before, or is ...
3
stack_v2_sparse_classes_30k_train_011299
Implement the Python class `Lib` described below. Class description: regular expression functions Method signatures and docstrings: - def FindAll(self, line, regex, compile=0): find all regex 'regex' in string 'line' compile: must we compile a regex before, or is it compiled? - def Match(self, line, regex, compile=0)...
Implement the Python class `Lib` described below. Class description: regular expression functions Method signatures and docstrings: - def FindAll(self, line, regex, compile=0): find all regex 'regex' in string 'line' compile: must we compile a regex before, or is it compiled? - def Match(self, line, regex, compile=0)...
3cfcae894c165189cc3ff61e27ca284f09e87871
<|skeleton|> class Lib: """regular expression functions""" def FindAll(self, line, regex, compile=0): """find all regex 'regex' in string 'line' compile: must we compile a regex before, or is it compiled?""" <|body_0|> def Match(self, line, regex, compile=0): """find regex 'regex' ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Lib: """regular expression functions""" def FindAll(self, line, regex, compile=0): """find all regex 'regex' in string 'line' compile: must we compile a regex before, or is it compiled?""" if compile: regex = re.compile(regex) mm = regex.findall(line) if mm: ...
the_stack_v2_python_sparse
dmerce2/Core/RegExp.py
rbe/dmerce
train
0
75cf56eaeb8c1bb37141b8e39a969a20e248b35a
[ "super(FollowupForm, self).__init__(*args, **kwargs)\nself.fields['responsible'].queryset = User.objects.filter(is_staff=True)\nif self.instance and self.instance.pk:\n if not (self.instance.responsible and self.instance.due_date):\n self.fields['content'].widget.attrs['readonly'] = True", "instance = g...
<|body_start_0|> super(FollowupForm, self).__init__(*args, **kwargs) self.fields['responsible'].queryset = User.objects.filter(is_staff=True) if self.instance and self.instance.pk: if not (self.instance.responsible and self.instance.due_date): self.fields['content'].w...
FollowupForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FollowupForm: def __init__(self, *args, **kwargs): """Defining readonly fields for inline followup. Using this form instead of get_readonly_fields which alters data for the whole Client.""" <|body_0|> def clean_content(self): """Prevents hacks when doing a POST.""" ...
stack_v2_sparse_classes_36k_train_005823
7,618
no_license
[ { "docstring": "Defining readonly fields for inline followup. Using this form instead of get_readonly_fields which alters data for the whole Client.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Prevents hacks when doing a POST.", "name": "clean_...
2
stack_v2_sparse_classes_30k_train_018287
Implement the Python class `FollowupForm` described below. Class description: Implement the FollowupForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Defining readonly fields for inline followup. Using this form instead of get_readonly_fields which alters data for the whole Client. ...
Implement the Python class `FollowupForm` described below. Class description: Implement the FollowupForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Defining readonly fields for inline followup. Using this form instead of get_readonly_fields which alters data for the whole Client. ...
e2d24a82462a735fc722f0b228be04a4495185c1
<|skeleton|> class FollowupForm: def __init__(self, *args, **kwargs): """Defining readonly fields for inline followup. Using this form instead of get_readonly_fields which alters data for the whole Client.""" <|body_0|> def clean_content(self): """Prevents hacks when doing a POST.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FollowupForm: def __init__(self, *args, **kwargs): """Defining readonly fields for inline followup. Using this form instead of get_readonly_fields which alters data for the whole Client.""" super(FollowupForm, self).__init__(*args, **kwargs) self.fields['responsible'].queryset = User.o...
the_stack_v2_python_sparse
clients/admin.py
fredericosachweh/amostra2
train
0
e71e4539b3fdbd60c42667f060c3fbb895dbcbc4
[ "self.center = center\nself.size = size\nself.children = []\nN_points = len(positions)\nif N_points == 1:\n leaves.append(self)\n self.COM = positions[0]\n self.velocity = velocities[0]\n self.mass = masses[0]\n self.id = ids[0]\n self.force = np.zeros(2)\n self.energy = 0\n self.der_force =...
<|body_start_0|> self.center = center self.size = size self.children = [] N_points = len(positions) if N_points == 1: leaves.append(self) self.COM = positions[0] self.velocity = velocities[0] self.mass = masses[0] self.i...
Node
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Node: def __init__(self, center, size, masses, positions, velocities, ids, leaves=[]): """take as parameter the list (np.array) of masses, positions and ids of the particules center, size for the box""" <|body_0|> def GenerateChildren(self, positions, masses, velocities, ids...
stack_v2_sparse_classes_36k_train_005824
10,729
no_license
[ { "docstring": "take as parameter the list (np.array) of masses, positions and ids of the particules center, size for the box", "name": "__init__", "signature": "def __init__(self, center, size, masses, positions, velocities, ids, leaves=[])" }, { "docstring": "Generates the node's children", ...
2
stack_v2_sparse_classes_30k_train_014604
Implement the Python class `Node` described below. Class description: Implement the Node class. Method signatures and docstrings: - def __init__(self, center, size, masses, positions, velocities, ids, leaves=[]): take as parameter the list (np.array) of masses, positions and ids of the particules center, size for the...
Implement the Python class `Node` described below. Class description: Implement the Node class. Method signatures and docstrings: - def __init__(self, center, size, masses, positions, velocities, ids, leaves=[]): take as parameter the list (np.array) of masses, positions and ids of the particules center, size for the...
efd7b9fb8c26a329866efaf23a15ed55e4181242
<|skeleton|> class Node: def __init__(self, center, size, masses, positions, velocities, ids, leaves=[]): """take as parameter the list (np.array) of masses, positions and ids of the particules center, size for the box""" <|body_0|> def GenerateChildren(self, positions, masses, velocities, ids...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Node: def __init__(self, center, size, masses, positions, velocities, ids, leaves=[]): """take as parameter the list (np.array) of masses, positions and ids of the particules center, size for the box""" self.center = center self.size = size self.children = [] N_points =...
the_stack_v2_python_sparse
Code/array_node_2nd_order.py
Lenoble-lab/PHY-571
train
0
f4a38c48a18c88951caf257ed339e8a94031e9ab
[ "cur = dummy = ListNode('X')\nwhile A and B:\n if A.val < B.val:\n cur.next, A = (A, A.next)\n else:\n cur.next, B = (B, B.next)\n cur = cur.next\ncur.next = A if A else B\nreturn dummy.next", "if head.next:\n fast, slow, prev = (head, head, None)\n while fast is not None and fast.nex...
<|body_start_0|> cur = dummy = ListNode('X') while A and B: if A.val < B.val: cur.next, A = (A, A.next) else: cur.next, B = (B, B.next) cur = cur.next cur.next = A if A else B return dummy.next <|end_body_0|> <|body_sta...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergesort(self, A, B): """merge two sorted linked list into one linked list""" <|body_0|> def divide(self, head): """divide a linked list into half and break the linkage in between only divide a linked list that has 2 element and more""" <|body_...
stack_v2_sparse_classes_36k_train_005825
2,038
permissive
[ { "docstring": "merge two sorted linked list into one linked list", "name": "mergesort", "signature": "def mergesort(self, A, B)" }, { "docstring": "divide a linked list into half and break the linkage in between only divide a linked list that has 2 element and more", "name": "divide", "...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergesort(self, A, B): merge two sorted linked list into one linked list - def divide(self, head): divide a linked list into half and break the linkage in between only divide...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergesort(self, A, B): merge two sorted linked list into one linked list - def divide(self, head): divide a linked list into half and break the linkage in between only divide...
143422321cbc3715ca08f6c3af8f960a55887ced
<|skeleton|> class Solution: def mergesort(self, A, B): """merge two sorted linked list into one linked list""" <|body_0|> def divide(self, head): """divide a linked list into half and break the linkage in between only divide a linked list that has 2 element and more""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergesort(self, A, B): """merge two sorted linked list into one linked list""" cur = dummy = ListNode('X') while A and B: if A.val < B.val: cur.next, A = (A, A.next) else: cur.next, B = (B, B.next) cur = ...
the_stack_v2_python_sparse
LeetCode/LC148_sort_list.py
jxie0755/Learning_Python
train
0
966eb9b0c9c525193e92b55c3b6f2fd66fb8f947
[ "self.netloc = None\nif not endpoint:\n endpoint = conf.get(f'{service_type}_url', None)\nif not endpoint:\n namespace = conf.get('namespace')\n if namespace:\n ns_conf = load_namespace_conf(namespace, failsafe=True)\n endpoint = ns_conf.get(service_type)\nif endpoint:\n scheme = 'http'\n ...
<|body_start_0|> self.netloc = None if not endpoint: endpoint = conf.get(f'{service_type}_url', None) if not endpoint: namespace = conf.get('namespace') if namespace: ns_conf = load_namespace_conf(namespace, failsafe=True) endpo...
Simple client API for the specified service type.
ServiceClient
[ "AGPL-3.0-only", "LGPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceClient: """Simple client API for the specified service type.""" def __init__(self, service_type, conf, endpoint=None, proxy_endpoint=None, request_prefix=None, refresh_delay=3600.0, logger=None, **kwargs): """Initialize a client for the specified service type. :param service_t...
stack_v2_sparse_classes_36k_train_005826
7,160
permissive
[ { "docstring": "Initialize a client for the specified service type. :param service_type: service type to request :type service_type: `str` :param conf: dictionary with at least the namespace name :type conf: `dict` :param endpoint: URL of an service of specified service type :type endpoint: `str` :param proxy_e...
5
null
Implement the Python class `ServiceClient` described below. Class description: Simple client API for the specified service type. Method signatures and docstrings: - def __init__(self, service_type, conf, endpoint=None, proxy_endpoint=None, request_prefix=None, refresh_delay=3600.0, logger=None, **kwargs): Initialize ...
Implement the Python class `ServiceClient` described below. Class description: Simple client API for the specified service type. Method signatures and docstrings: - def __init__(self, service_type, conf, endpoint=None, proxy_endpoint=None, request_prefix=None, refresh_delay=3600.0, logger=None, **kwargs): Initialize ...
08abd65aac86e47cf324826487ab9b475e014938
<|skeleton|> class ServiceClient: """Simple client API for the specified service type.""" def __init__(self, service_type, conf, endpoint=None, proxy_endpoint=None, request_prefix=None, refresh_delay=3600.0, logger=None, **kwargs): """Initialize a client for the specified service type. :param service_t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServiceClient: """Simple client API for the specified service type.""" def __init__(self, service_type, conf, endpoint=None, proxy_endpoint=None, request_prefix=None, refresh_delay=3600.0, logger=None, **kwargs): """Initialize a client for the specified service type. :param service_type: service ...
the_stack_v2_python_sparse
oio/common/service_client.py
open-io/oio-sds
train
663
245114bbaabffadf744952c4284b4fbbcdd42a72
[ "super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, 'Sprite Fright')\nself.player_list = None\nself.coin_list = None\nself.gem_list = None\nself.player_sprite = None\nself.score = 0\nself.set_mouse_visible(False)\nself.game_over = False\nself.length_of_play = 0\narcade.set_background_color(arcade.color.AMAZON)\nself.bad...
<|body_start_0|> super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, 'Sprite Fright') self.player_list = None self.coin_list = None self.gem_list = None self.player_sprite = None self.score = 0 self.set_mouse_visible(False) self.game_over = False self.le...
Our custom Window Class
MyGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyGame: """Our custom Window Class""" def __init__(self): """Initializer""" <|body_0|> def setup(self): """Set up the game and initialize the variables.""" <|body_1|> def on_draw(self): """Draw everything""" <|body_2|> def on_key...
stack_v2_sparse_classes_36k_train_005827
7,022
no_license
[ { "docstring": "Initializer", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Set up the game and initialize the variables.", "name": "setup", "signature": "def setup(self)" }, { "docstring": "Draw everything", "name": "on_draw", "signature": "def...
6
stack_v2_sparse_classes_30k_train_008860
Implement the Python class `MyGame` described below. Class description: Our custom Window Class Method signatures and docstrings: - def __init__(self): Initializer - def setup(self): Set up the game and initialize the variables. - def on_draw(self): Draw everything - def on_key_press(self, key, modifiers): Called whe...
Implement the Python class `MyGame` described below. Class description: Our custom Window Class Method signatures and docstrings: - def __init__(self): Initializer - def setup(self): Set up the game and initialize the variables. - def on_draw(self): Draw everything - def on_key_press(self, key, modifiers): Called whe...
693f642db301863bedcd77ee98eea405ee794043
<|skeleton|> class MyGame: """Our custom Window Class""" def __init__(self): """Initializer""" <|body_0|> def setup(self): """Set up the game and initialize the variables.""" <|body_1|> def on_draw(self): """Draw everything""" <|body_2|> def on_key...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyGame: """Our custom Window Class""" def __init__(self): """Initializer""" super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, 'Sprite Fright') self.player_list = None self.coin_list = None self.gem_list = None self.player_sprite = None self.score = 0 ...
the_stack_v2_python_sparse
Lab 08 - Sprites/lab_08.py
TylerErdman/learn-arcade-work
train
0
8d83d635ed64e6ce27e7e41e882506fa79177a1b
[ "self.phone = phone\nself.time = time\nself.content = content\nself.msg_id = msg_id", "text = 'Message ['\ntext += 'phone: ' + str(self.phone) + ', '\ntext += 'time: ' + str(self.time) + ', '\ntext += 'content: ' + self.content + ']'\nreturn text" ]
<|body_start_0|> self.phone = phone self.time = time self.content = content self.msg_id = msg_id <|end_body_0|> <|body_start_1|> text = 'Message [' text += 'phone: ' + str(self.phone) + ', ' text += 'time: ' + str(self.time) + ', ' text += 'content: ' + s...
This class represents an abstract SMS message interface.
BaseSMS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseSMS: """This class represents an abstract SMS message interface.""" def __init__(self, phone, time, content, msg_id=None): """General-purpose constructor for SMS message If msg_id is None, message is not persisted yet""" <|body_0|> def __str__(self): """retur...
stack_v2_sparse_classes_36k_train_005828
1,488
no_license
[ { "docstring": "General-purpose constructor for SMS message If msg_id is None, message is not persisted yet", "name": "__init__", "signature": "def __init__(self, phone, time, content, msg_id=None)" }, { "docstring": "returns a textual representation of the message", "name": "__str__", "...
2
stack_v2_sparse_classes_30k_test_000809
Implement the Python class `BaseSMS` described below. Class description: This class represents an abstract SMS message interface. Method signatures and docstrings: - def __init__(self, phone, time, content, msg_id=None): General-purpose constructor for SMS message If msg_id is None, message is not persisted yet - def...
Implement the Python class `BaseSMS` described below. Class description: This class represents an abstract SMS message interface. Method signatures and docstrings: - def __init__(self, phone, time, content, msg_id=None): General-purpose constructor for SMS message If msg_id is None, message is not persisted yet - def...
0bbe17fb57650e8fa63a2b39e99da4b3643c8aa8
<|skeleton|> class BaseSMS: """This class represents an abstract SMS message interface.""" def __init__(self, phone, time, content, msg_id=None): """General-purpose constructor for SMS message If msg_id is None, message is not persisted yet""" <|body_0|> def __str__(self): """retur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseSMS: """This class represents an abstract SMS message interface.""" def __init__(self, phone, time, content, msg_id=None): """General-purpose constructor for SMS message If msg_id is None, message is not persisted yet""" self.phone = phone self.time = time self.content...
the_stack_v2_python_sparse
src/model/entity/message.py
janakaud/shopguru
train
0
b7aa4b53f20ea6aec3e1f95b2ea424e448786d31
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('sbrz_nedg', 'sbrz_nedg')\ncollege_university_url = urllib.request.Request('http://bostonopendata-boston.opendata.arcgis.com/datasets/cbf14bb032ef4bd38e20429f71acb61a_2.geojson')\ncollege_university_respo...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('sbrz_nedg', 'sbrz_nedg') college_university_url = urllib.request.Request('http://bostonopendata-boston.opendata.arcgis.com/datasets/cbf14bb032ef4bd38e2042...
retrieveCollegeUniversityData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class retrieveCollegeUniversityData: def execute(trial=False): """Retrieve Boston college/university data set.""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening in th...
stack_v2_sparse_classes_36k_train_005829
3,376
no_license
[ { "docstring": "Retrieve Boston college/university data set.", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new document describing that invocati...
2
null
Implement the Python class `retrieveCollegeUniversityData` described below. Class description: Implement the retrieveCollegeUniversityData class. Method signatures and docstrings: - def execute(trial=False): Retrieve Boston college/university data set. - def provenance(doc=prov.model.ProvDocument(), startTime=None, e...
Implement the Python class `retrieveCollegeUniversityData` described below. Class description: Implement the retrieveCollegeUniversityData class. Method signatures and docstrings: - def execute(trial=False): Retrieve Boston college/university data set. - def provenance(doc=prov.model.ProvDocument(), startTime=None, e...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class retrieveCollegeUniversityData: def execute(trial=False): """Retrieve Boston college/university data set.""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening in th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class retrieveCollegeUniversityData: def execute(trial=False): """Retrieve Boston college/university data set.""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('sbrz_nedg', 'sbrz_nedg') college_university_u...
the_stack_v2_python_sparse
sbrz_nedg/retrieveCollegeUniversityData.py
ROODAY/course-2017-fal-proj
train
3
5c5df63bcc9aadf2c703bf2ff0213e4f08b150a9
[ "self.cfg_mk = loadcfgcm.load('codegen_maker_module.json', default_config)\nself.tpl_path = tpl_path\nself.out_path = out_path\nself.cfg_tpl = loadcfgcm.load_cfg_file(self.tpl_path, 'tpl_config.json')\nif self.cfg_tpl is None:\n logcm.print_info('Template Config Load Failed!', fg='red')\n sys.exit()", "logc...
<|body_start_0|> self.cfg_mk = loadcfgcm.load('codegen_maker_module.json', default_config) self.tpl_path = tpl_path self.out_path = out_path self.cfg_tpl = loadcfgcm.load_cfg_file(self.tpl_path, 'tpl_config.json') if self.cfg_tpl is None: logcm.print_info('Template Co...
代码生成-代码生成类
CodeGenModuleMaker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CodeGenModuleMaker: """代码生成-代码生成类""" def __init__(self, tpl_path, out_path): """初始化 :param tpl_path: 模版路径 :param out_path: 生成文件路径""" <|body_0|> def make(self, mdl): """根据指定模块信息,和代码模版目录,生成代码 :param mdl: 模块 :return: 无""" <|body_1|> def make_by_path(sel...
stack_v2_sparse_classes_36k_train_005830
4,475
no_license
[ { "docstring": "初始化 :param tpl_path: 模版路径 :param out_path: 生成文件路径", "name": "__init__", "signature": "def __init__(self, tpl_path, out_path)" }, { "docstring": "根据指定模块信息,和代码模版目录,生成代码 :param mdl: 模块 :return: 无", "name": "make", "signature": "def make(self, mdl)" }, { "docstring": ...
4
stack_v2_sparse_classes_30k_train_021251
Implement the Python class `CodeGenModuleMaker` described below. Class description: 代码生成-代码生成类 Method signatures and docstrings: - def __init__(self, tpl_path, out_path): 初始化 :param tpl_path: 模版路径 :param out_path: 生成文件路径 - def make(self, mdl): 根据指定模块信息,和代码模版目录,生成代码 :param mdl: 模块 :return: 无 - def make_by_path(self, p...
Implement the Python class `CodeGenModuleMaker` described below. Class description: 代码生成-代码生成类 Method signatures and docstrings: - def __init__(self, tpl_path, out_path): 初始化 :param tpl_path: 模版路径 :param out_path: 生成文件路径 - def make(self, mdl): 根据指定模块信息,和代码模版目录,生成代码 :param mdl: 模块 :return: 无 - def make_by_path(self, p...
e5887ccf0a241b757dc4f9aa12bcb89456321a24
<|skeleton|> class CodeGenModuleMaker: """代码生成-代码生成类""" def __init__(self, tpl_path, out_path): """初始化 :param tpl_path: 模版路径 :param out_path: 生成文件路径""" <|body_0|> def make(self, mdl): """根据指定模块信息,和代码模版目录,生成代码 :param mdl: 模块 :return: 无""" <|body_1|> def make_by_path(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CodeGenModuleMaker: """代码生成-代码生成类""" def __init__(self, tpl_path, out_path): """初始化 :param tpl_path: 模版路径 :param out_path: 生成文件路径""" self.cfg_mk = loadcfgcm.load('codegen_maker_module.json', default_config) self.tpl_path = tpl_path self.out_path = out_path self.cfg...
the_stack_v2_python_sparse
codegen/codegen_mk.py
elthe/LearnPythonStats
train
3
1659815983518b689ffbbeb70455e7b1f4bf4598
[ "self.history = [homepage]\nself.curr = 0\nself.length = 1", "self.history = self.history[:self.curr + 1]\nself.history.append(url)\nself.length = len(self.history)\nself.curr = self.length - 1", "if self.curr - steps < 0:\n self.curr = 0\nelse:\n self.curr -= steps\nreturn self.history[self.curr]", "if...
<|body_start_0|> self.history = [homepage] self.curr = 0 self.length = 1 <|end_body_0|> <|body_start_1|> self.history = self.history[:self.curr + 1] self.history.append(url) self.length = len(self.history) self.curr = self.length - 1 <|end_body_1|> <|body_start_...
BrowserHistory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrowserHistory: def __init__(self, homepage): """:type homepage: str""" <|body_0|> def visit(self, url): """:type url: str :rtype: None""" <|body_1|> def back(self, steps): """:type steps: int :rtype: str""" <|body_2|> def forward(se...
stack_v2_sparse_classes_36k_train_005831
1,103
no_license
[ { "docstring": ":type homepage: str", "name": "__init__", "signature": "def __init__(self, homepage)" }, { "docstring": ":type url: str :rtype: None", "name": "visit", "signature": "def visit(self, url)" }, { "docstring": ":type steps: int :rtype: str", "name": "back", "s...
4
stack_v2_sparse_classes_30k_train_009165
Implement the Python class `BrowserHistory` described below. Class description: Implement the BrowserHistory class. Method signatures and docstrings: - def __init__(self, homepage): :type homepage: str - def visit(self, url): :type url: str :rtype: None - def back(self, steps): :type steps: int :rtype: str - def forw...
Implement the Python class `BrowserHistory` described below. Class description: Implement the BrowserHistory class. Method signatures and docstrings: - def __init__(self, homepage): :type homepage: str - def visit(self, url): :type url: str :rtype: None - def back(self, steps): :type steps: int :rtype: str - def forw...
0886b4f9ed587507257611f1ad11d3bf03494a91
<|skeleton|> class BrowserHistory: def __init__(self, homepage): """:type homepage: str""" <|body_0|> def visit(self, url): """:type url: str :rtype: None""" <|body_1|> def back(self, steps): """:type steps: int :rtype: str""" <|body_2|> def forward(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BrowserHistory: def __init__(self, homepage): """:type homepage: str""" self.history = [homepage] self.curr = 0 self.length = 1 def visit(self, url): """:type url: str :rtype: None""" self.history = self.history[:self.curr + 1] self.history.append(u...
the_stack_v2_python_sparse
leetcode/Medium/design browser history.py
simhonchourasia/leetcodesolutions
train
0
59d19813226d88508be2d25636c820e7b1c0d2b3
[ "current_role = DBRole.query.get(role_id)\nif not current_role:\n return get_response(RequestCode.OTHER_FAILED, '角色不存在!')\nresults_wrapper = marshal(current_role, role_fields)\nreturn get_response(RequestCode.SUCCESS, '获取成功!', results_wrapper)", "args = dns_role_common_parser.parse_args()\nrole_name = args['na...
<|body_start_0|> current_role = DBRole.query.get(role_id) if not current_role: return get_response(RequestCode.OTHER_FAILED, '角色不存在!') results_wrapper = marshal(current_role, role_fields) return get_response(RequestCode.SUCCESS, '获取成功!', results_wrapper) <|end_body_0|> <|bod...
Role
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Role: def get(self, role_id): """功能: 获取指定ID的角色详情 --- security: - UserSecurity: [] tags: - Role parameters: - name: role_id in: path description: Role id type: integer required: true default: 1 definitions: Role: properties: id: type: integer name: type: string privileges: type: array ite...
stack_v2_sparse_classes_36k_train_005832
15,619
no_license
[ { "docstring": "功能: 获取指定ID的角色详情 --- security: - UserSecurity: [] tags: - Role parameters: - name: role_id in: path description: Role id type: integer required: true default: 1 definitions: Role: properties: id: type: integer name: type: string privileges: type: array items: $ref: \"#/definitions/Privilege\" res...
3
stack_v2_sparse_classes_30k_train_015544
Implement the Python class `Role` described below. Class description: Implement the Role class. Method signatures and docstrings: - def get(self, role_id): 功能: 获取指定ID的角色详情 --- security: - UserSecurity: [] tags: - Role parameters: - name: role_id in: path description: Role id type: integer required: true default: 1 de...
Implement the Python class `Role` described below. Class description: Implement the Role class. Method signatures and docstrings: - def get(self, role_id): 功能: 获取指定ID的角色详情 --- security: - UserSecurity: [] tags: - Role parameters: - name: role_id in: path description: Role id type: integer required: true default: 1 de...
c7e983f17b79a1f0d8e71c789320d0b83dfcb6e9
<|skeleton|> class Role: def get(self, role_id): """功能: 获取指定ID的角色详情 --- security: - UserSecurity: [] tags: - Role parameters: - name: role_id in: path description: Role id type: integer required: true default: 1 definitions: Role: properties: id: type: integer name: type: string privileges: type: array ite...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Role: def get(self, role_id): """功能: 获取指定ID的角色详情 --- security: - UserSecurity: [] tags: - Role parameters: - name: role_id in: path description: Role id type: integer required: true default: 1 definitions: Role: properties: id: type: integer name: type: string privileges: type: array items: $ref: "#/d...
the_stack_v2_python_sparse
peb_dns/resourses/admin/role.py
Sherlock-L/dns-manager
train
0
397ae33d1bcd7556af33aa5407c97adbd89dbb76
[ "if request.status != action_constants.LIVEACTION_STATUS_REQUESTED:\n LOG.info('%s is ignoring %s (id=%s) with \"%s\" status.', self.__class__.__name__, type(request), request.id, request.status)\n return\ntry:\n liveaction_db = action_utils.get_liveaction_by_id(str(request.id))\nexcept StackStormDBObjectN...
<|body_start_0|> if request.status != action_constants.LIVEACTION_STATUS_REQUESTED: LOG.info('%s is ignoring %s (id=%s) with "%s" status.', self.__class__.__name__, type(request), request.id, request.status) return try: liveaction_db = action_utils.get_liveaction_by_i...
SchedulerEntrypoint subscribes to the Action scheduler request queue and places new Live Actions into the scheduling queue collection for scheduling on action runners.
SchedulerEntrypoint
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchedulerEntrypoint: """SchedulerEntrypoint subscribes to the Action scheduler request queue and places new Live Actions into the scheduling queue collection for scheduling on action runners.""" def process(self, request): """Adds execution into execution_scheduling database for sche...
stack_v2_sparse_classes_36k_train_005833
4,440
permissive
[ { "docstring": "Adds execution into execution_scheduling database for scheduling :param request: Action execution request. :type request: ``st2common.models.db.liveaction.LiveActionDB``", "name": "process", "signature": "def process(self, request)" }, { "docstring": "Create ActionExecutionSchedu...
2
null
Implement the Python class `SchedulerEntrypoint` described below. Class description: SchedulerEntrypoint subscribes to the Action scheduler request queue and places new Live Actions into the scheduling queue collection for scheduling on action runners. Method signatures and docstrings: - def process(self, request): A...
Implement the Python class `SchedulerEntrypoint` described below. Class description: SchedulerEntrypoint subscribes to the Action scheduler request queue and places new Live Actions into the scheduling queue collection for scheduling on action runners. Method signatures and docstrings: - def process(self, request): A...
c3fc181981b141da95dcf6939d09c362556ca048
<|skeleton|> class SchedulerEntrypoint: """SchedulerEntrypoint subscribes to the Action scheduler request queue and places new Live Actions into the scheduling queue collection for scheduling on action runners.""" def process(self, request): """Adds execution into execution_scheduling database for sche...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SchedulerEntrypoint: """SchedulerEntrypoint subscribes to the Action scheduler request queue and places new Live Actions into the scheduling queue collection for scheduling on action runners.""" def process(self, request): """Adds execution into execution_scheduling database for scheduling :param...
the_stack_v2_python_sparse
st2actions/st2actions/scheduler/entrypoint.py
Plexxi/st2
train
3
6d7fbf6a7edb2e3e36dc2299c014c7ed7f64a6c0
[ "self.credentials = credentials\nhttp = httplib2.Http()\nhttp = self.credentials.authorize(http)\nself.service = build('drive', 'v2', http=http)", "response = self.service.files().list().execute()\nmimeType = 'application/vnd.google-apps.spreadsheet'\nspreadsheets = []\nfor item in response['items']:\n if item...
<|body_start_0|> self.credentials = credentials http = httplib2.Http() http = self.credentials.authorize(http) self.service = build('drive', 'v2', http=http) <|end_body_0|> <|body_start_1|> response = self.service.files().list().execute() mimeType = 'application/vnd.goog...
SimpleDriveClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleDriveClient: def __init__(self, credentials): """We expect some OAuth2 credentials that allow us to authorize the user, so we assume that the access_token is valid. Is the caller's responsability to refresh the tokens if needed.""" <|body_0|> def get_spreadsheet_list(s...
stack_v2_sparse_classes_36k_train_005834
972
permissive
[ { "docstring": "We expect some OAuth2 credentials that allow us to authorize the user, so we assume that the access_token is valid. Is the caller's responsability to refresh the tokens if needed.", "name": "__init__", "signature": "def __init__(self, credentials)" }, { "docstring": "For now it o...
2
stack_v2_sparse_classes_30k_val_000347
Implement the Python class `SimpleDriveClient` described below. Class description: Implement the SimpleDriveClient class. Method signatures and docstrings: - def __init__(self, credentials): We expect some OAuth2 credentials that allow us to authorize the user, so we assume that the access_token is valid. Is the call...
Implement the Python class `SimpleDriveClient` described below. Class description: Implement the SimpleDriveClient class. Method signatures and docstrings: - def __init__(self, credentials): We expect some OAuth2 credentials that allow us to authorize the user, so we assume that the access_token is valid. Is the call...
0e65331da40cfd3766f1bde17f0a9c7ff6666dea
<|skeleton|> class SimpleDriveClient: def __init__(self, credentials): """We expect some OAuth2 credentials that allow us to authorize the user, so we assume that the access_token is valid. Is the caller's responsability to refresh the tokens if needed.""" <|body_0|> def get_spreadsheet_list(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleDriveClient: def __init__(self, credentials): """We expect some OAuth2 credentials that allow us to authorize the user, so we assume that the access_token is valid. Is the caller's responsability to refresh the tokens if needed.""" self.credentials = credentials http = httplib2.H...
the_stack_v2_python_sparse
networkx-d3-v2/clients/drive.py
suraj-testing2/Solar_YouTube
train
0
40b63c91b082df3233ea7d3be1192db92e0e6fa1
[ "def _preorderTraversal(root, result):\n if not root:\n return result\n result.append(root.val)\n _preorderTraversal(root.left, result)\n _preorderTraversal(root.right, result)\n return result\nresult = []\nreturn _preorderTraversal(root, result)", "result, stack = ([], [root])\nwhile stack:...
<|body_start_0|> def _preorderTraversal(root, result): if not root: return result result.append(root.val) _preorderTraversal(root.left, result) _preorderTraversal(root.right, result) return result result = [] return _pre...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype List[int] (knowledge) 思路: 1. 使用一个列表记录遍历过的值; 2. 每次先将当前节点的值加入结果集,然后递归遍历左右子树;""" <|body_0|> def preorderTraversal2(self, root): """:type root: TreeNode :rtype List[int] (knowledge) 非递归解法 思路: 1. ...
stack_v2_sparse_classes_36k_train_005835
1,962
no_license
[ { "docstring": ":type root: TreeNode :rtype List[int] (knowledge) 思路: 1. 使用一个列表记录遍历过的值; 2. 每次先将当前节点的值加入结果集,然后递归遍历左右子树;", "name": "preorderTraversal", "signature": "def preorderTraversal(self, root)" }, { "docstring": ":type root: TreeNode :rtype List[int] (knowledge) 非递归解法 思路: 1. 使用一个列表记录遍历过的值; ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): :type root: TreeNode :rtype List[int] (knowledge) 思路: 1. 使用一个列表记录遍历过的值; 2. 每次先将当前节点的值加入结果集,然后递归遍历左右子树; - def preorderTraversal2(self, root): :t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): :type root: TreeNode :rtype List[int] (knowledge) 思路: 1. 使用一个列表记录遍历过的值; 2. 每次先将当前节点的值加入结果集,然后递归遍历左右子树; - def preorderTraversal2(self, root): :t...
19ea28c38762c65318275007932786e648a8b415
<|skeleton|> class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype List[int] (knowledge) 思路: 1. 使用一个列表记录遍历过的值; 2. 每次先将当前节点的值加入结果集,然后递归遍历左右子树;""" <|body_0|> def preorderTraversal2(self, root): """:type root: TreeNode :rtype List[int] (knowledge) 非递归解法 思路: 1. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype List[int] (knowledge) 思路: 1. 使用一个列表记录遍历过的值; 2. 每次先将当前节点的值加入结果集,然后递归遍历左右子树;""" def _preorderTraversal(root, result): if not root: return result result.append(root.val) ...
the_stack_v2_python_sparse
chapter9/7_binary-tree-preorder-traversal.py
SunnyQjm/algorithm-review
train
2
785a0d8ace5814fc0b171658892c5f18bd0fd885
[ "super().__init__()\nself._use_condition = use_condition\nself._model = tf.keras.Sequential([tf.keras.layers.Dense(7 * 7 * 256, use_bias=False), tf.keras.layers.BatchNormalization(), tf.keras.layers.ReLU(), tf.keras.layers.Reshape([7, 7, 256]), tf.keras.layers.Conv2DTranspose(128, [5, 5], padding='same', use_bias=F...
<|body_start_0|> super().__init__() self._use_condition = use_condition self._model = tf.keras.Sequential([tf.keras.layers.Dense(7 * 7 * 256, use_bias=False), tf.keras.layers.BatchNormalization(), tf.keras.layers.ReLU(), tf.keras.layers.Reshape([7, 7, 256]), tf.keras.layers.Conv2DTranspose(128, ...
Class conditioned generator. This generator is used by MNIST and FMNIST dataset. Attributes: _use_condition: _model:
ClassConditionedGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassConditionedGenerator: """Class conditioned generator. This generator is used by MNIST and FMNIST dataset. Attributes: _use_condition: _model:""" def __init__(self, use_condition): """Initializes the object. Args: use_condition:""" <|body_0|> def call(self, noise, em...
stack_v2_sparse_classes_36k_train_005836
12,085
no_license
[ { "docstring": "Initializes the object. Args: use_condition:", "name": "__init__", "signature": "def __init__(self, use_condition)" }, { "docstring": "Apples the model to the inputs. Args: noise: embedding: Returns:", "name": "call", "signature": "def call(self, noise, embedding)" } ]
2
stack_v2_sparse_classes_30k_train_003985
Implement the Python class `ClassConditionedGenerator` described below. Class description: Class conditioned generator. This generator is used by MNIST and FMNIST dataset. Attributes: _use_condition: _model: Method signatures and docstrings: - def __init__(self, use_condition): Initializes the object. Args: use_condi...
Implement the Python class `ClassConditionedGenerator` described below. Class description: Class conditioned generator. This generator is used by MNIST and FMNIST dataset. Attributes: _use_condition: _model: Method signatures and docstrings: - def __init__(self, use_condition): Initializes the object. Args: use_condi...
6d04861ef87ba2ba2a4182ad36f3b322fcf47cfa
<|skeleton|> class ClassConditionedGenerator: """Class conditioned generator. This generator is used by MNIST and FMNIST dataset. Attributes: _use_condition: _model:""" def __init__(self, use_condition): """Initializes the object. Args: use_condition:""" <|body_0|> def call(self, noise, em...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassConditionedGenerator: """Class conditioned generator. This generator is used by MNIST and FMNIST dataset. Attributes: _use_condition: _model:""" def __init__(self, use_condition): """Initializes the object. Args: use_condition:""" super().__init__() self._use_condition = use_...
the_stack_v2_python_sparse
gan.py
gaotianxiang/text-to-image-synthesis
train
0
67525e7028ab9ed81e1d0e8fd8da6c43812ff41b
[ "print('NoteChecker.get_notes()')\nif BookDao.contains(book_id):\n list_notes = NoteDao.get_notes(book_id)\n return list_notes\nelse:\n abort(404, 'Resource not found: book_id')", "print('NoteChecker.create_note()')\nif BookDao.contains(book_id):\n if NoteDao.contains(note.get('note_title')):\n ...
<|body_start_0|> print('NoteChecker.get_notes()') if BookDao.contains(book_id): list_notes = NoteDao.get_notes(book_id) return list_notes else: abort(404, 'Resource not found: book_id') <|end_body_0|> <|body_start_1|> print('NoteChecker.create_note()'...
NoteChecker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoteChecker: def get_notes(book_id): """Method to retrieve a list of notes about a book. :param book_id: the unique book identifier. :return: list of notes for a book.""" <|body_0|> def create_note(book_id, note): """Method to create a note about a particular book. :...
stack_v2_sparse_classes_36k_train_005837
3,392
no_license
[ { "docstring": "Method to retrieve a list of notes about a book. :param book_id: the unique book identifier. :return: list of notes for a book.", "name": "get_notes", "signature": "def get_notes(book_id)" }, { "docstring": "Method to create a note about a particular book. :param book_id: the uni...
5
stack_v2_sparse_classes_30k_train_010381
Implement the Python class `NoteChecker` described below. Class description: Implement the NoteChecker class. Method signatures and docstrings: - def get_notes(book_id): Method to retrieve a list of notes about a book. :param book_id: the unique book identifier. :return: list of notes for a book. - def create_note(bo...
Implement the Python class `NoteChecker` described below. Class description: Implement the NoteChecker class. Method signatures and docstrings: - def get_notes(book_id): Method to retrieve a list of notes about a book. :param book_id: the unique book identifier. :return: list of notes for a book. - def create_note(bo...
4c3fdf41a43a56c253faecacac5f9d977d9c99be
<|skeleton|> class NoteChecker: def get_notes(book_id): """Method to retrieve a list of notes about a book. :param book_id: the unique book identifier. :return: list of notes for a book.""" <|body_0|> def create_note(book_id, note): """Method to create a note about a particular book. :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NoteChecker: def get_notes(book_id): """Method to retrieve a list of notes about a book. :param book_id: the unique book identifier. :return: list of notes for a book.""" print('NoteChecker.get_notes()') if BookDao.contains(book_id): list_notes = NoteDao.get_notes(book_id) ...
the_stack_v2_python_sparse
controller/note_checker.py
neu-seattle-cs5500-fall18/book-library-web-service-scrumptious
train
0
79d14afed92df099387a257112e1f9381bffe0ae
[ "param = param or 'dhcp_agents_per_network'\npath = path or '/etc/neutron/neutron.conf'\nparser = configparser.ConfigParser()\nwith remote.open(path) as f:\n parser.readfp(f)\nif parser.getint('DEFAULT', param) == value:\n return\nparser.set('DEFAULT', param, value)\nwith remote.open(path, 'w') as f:\n par...
<|body_start_0|> param = param or 'dhcp_agents_per_network' path = path or '/etc/neutron/neutron.conf' parser = configparser.ConfigParser() with remote.open(path) as f: parser.readfp(f) if parser.getint('DEFAULT', param) == value: return parser.set...
Test with preparation of neutron service.
TestBanDHCPAgentWithSettings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestBanDHCPAgentWithSettings: """Test with preparation of neutron service.""" def _apply_new_neutron_param_value(remote, value, param=None, path=None): """Change some parameter in neutron config to new value and restart the service. Changing dhcp_agents_per_network by default. :param...
stack_v2_sparse_classes_36k_train_005838
34,589
no_license
[ { "docstring": "Change some parameter in neutron config to new value and restart the service. Changing dhcp_agents_per_network by default. :param remote: ssh connection to controller :param value: new value for param :param param: parameter to change in config file :param path: path to config file :returns: res...
3
stack_v2_sparse_classes_30k_train_012486
Implement the Python class `TestBanDHCPAgentWithSettings` described below. Class description: Test with preparation of neutron service. Method signatures and docstrings: - def _apply_new_neutron_param_value(remote, value, param=None, path=None): Change some parameter in neutron config to new value and restart the ser...
Implement the Python class `TestBanDHCPAgentWithSettings` described below. Class description: Test with preparation of neutron service. Method signatures and docstrings: - def _apply_new_neutron_param_value(remote, value, param=None, path=None): Change some parameter in neutron config to new value and restart the ser...
8aced2855b78b5f123195d188c80e27b43888a2e
<|skeleton|> class TestBanDHCPAgentWithSettings: """Test with preparation of neutron service.""" def _apply_new_neutron_param_value(remote, value, param=None, path=None): """Change some parameter in neutron config to new value and restart the service. Changing dhcp_agents_per_network by default. :param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestBanDHCPAgentWithSettings: """Test with preparation of neutron service.""" def _apply_new_neutron_param_value(remote, value, param=None, path=None): """Change some parameter in neutron config to new value and restart the service. Changing dhcp_agents_per_network by default. :param remote: ssh ...
the_stack_v2_python_sparse
mos_tests/neutron/python_tests/test_ban_dhcp_agent.py
Mirantis/mos-integration-tests
train
16
33112e4a63f4035ddb0defd25cda9086d12ef5d7
[ "is_optional, game_name = _is_optional_game(basename)\nif is_optional:\n if game_name not in _AVAILABLE_GAMES:\n logging.info('Skipping %s because %s is not built in.', basename, game_name)\n return\nfile_path = os.path.join(path, basename)\nexpected, actual = generate_playthrough.replay(file_path)...
<|body_start_0|> is_optional, game_name = _is_optional_game(basename) if is_optional: if game_name not in _AVAILABLE_GAMES: logging.info('Skipping %s because %s is not built in.', basename, game_name) return file_path = os.path.join(path, basename) ...
PlaythroughTest
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlaythroughTest: def run_test(self, path, basename): """Instantiated for each test case in main, below.""" <|body_0|> def test_all_games_tested(self): """Verify that every game is present in the playthroughs.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_005839
4,203
permissive
[ { "docstring": "Instantiated for each test case in main, below.", "name": "run_test", "signature": "def run_test(self, path, basename)" }, { "docstring": "Verify that every game is present in the playthroughs.", "name": "test_all_games_tested", "signature": "def test_all_games_tested(sel...
2
stack_v2_sparse_classes_30k_train_005185
Implement the Python class `PlaythroughTest` described below. Class description: Implement the PlaythroughTest class. Method signatures and docstrings: - def run_test(self, path, basename): Instantiated for each test case in main, below. - def test_all_games_tested(self): Verify that every game is present in the play...
Implement the Python class `PlaythroughTest` described below. Class description: Implement the PlaythroughTest class. Method signatures and docstrings: - def run_test(self, path, basename): Instantiated for each test case in main, below. - def test_all_games_tested(self): Verify that every game is present in the play...
6f3551fd990053cf2287b380fb9ad0b2a2607c18
<|skeleton|> class PlaythroughTest: def run_test(self, path, basename): """Instantiated for each test case in main, below.""" <|body_0|> def test_all_games_tested(self): """Verify that every game is present in the playthroughs.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlaythroughTest: def run_test(self, path, basename): """Instantiated for each test case in main, below.""" is_optional, game_name = _is_optional_game(basename) if is_optional: if game_name not in _AVAILABLE_GAMES: logging.info('Skipping %s because %s is not ...
the_stack_v2_python_sparse
open_spiel/integration_tests/playthrough_test.py
sarahperrin/open_spiel
train
3
70edcb73239287b25b55f3bf69d90b40addb98ae
[ "self.field_name = field_name\nself.message = message or 'You are not allowed to edit a pre-reserved DOI. Click the Pre-reserve DOI button to resolve the problem.'\nself.prefix = prefix", "attr_value = getattr(form, self.field_name).data\nif isinstance(attr_value, dict):\n attr_value = attr_value['doi']\nif at...
<|body_start_0|> self.field_name = field_name self.message = message or 'You are not allowed to edit a pre-reserved DOI. Click the Pre-reserve DOI button to resolve the problem.' self.prefix = prefix <|end_body_0|> <|body_start_1|> attr_value = getattr(form, self.field_name).data ...
Validate that user did not edit pre-reserved DOI.
PreReservedDOI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreReservedDOI: """Validate that user did not edit pre-reserved DOI.""" def __init__(self, field_name, message=None, prefix='10.5072'): """Initialize the validator.""" <|body_0|> def __call__(self, form, field): """Validate.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_005840
11,750
no_license
[ { "docstring": "Initialize the validator.", "name": "__init__", "signature": "def __init__(self, field_name, message=None, prefix='10.5072')" }, { "docstring": "Validate.", "name": "__call__", "signature": "def __call__(self, form, field)" } ]
2
stack_v2_sparse_classes_30k_test_000418
Implement the Python class `PreReservedDOI` described below. Class description: Validate that user did not edit pre-reserved DOI. Method signatures and docstrings: - def __init__(self, field_name, message=None, prefix='10.5072'): Initialize the validator. - def __call__(self, form, field): Validate.
Implement the Python class `PreReservedDOI` described below. Class description: Validate that user did not edit pre-reserved DOI. Method signatures and docstrings: - def __init__(self, field_name, message=None, prefix='10.5072'): Initialize the validator. - def __call__(self, form, field): Validate. <|skeleton|> cla...
4de8910fff569fc9028300c70b63200da521ddb9
<|skeleton|> class PreReservedDOI: """Validate that user did not edit pre-reserved DOI.""" def __init__(self, field_name, message=None, prefix='10.5072'): """Initialize the validator.""" <|body_0|> def __call__(self, form, field): """Validate.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PreReservedDOI: """Validate that user did not edit pre-reserved DOI.""" def __init__(self, field_name, message=None, prefix='10.5072'): """Initialize the validator.""" self.field_name = field_name self.message = message or 'You are not allowed to edit a pre-reserved DOI. Click the...
the_stack_v2_python_sparse
inspirehep/modules/forms/validation_utils.py
nikpap/inspire-next
train
1
9ca3adf43bd6d398de39d4cb662a00b5b7c5ed07
[ "super().__init__(model, params)\nself._var_scope = 'encoder_d'\nself._n_classes = 0\nif 'n_classes' in params.keys():\n self._n_classes = params['n_classes']\nself._init_optimizer()", "def layer(input, units, add_b_norm=True):\n output = tf.layers.dense(inputs=input, units=units, activation=tf.nn.leaky_rel...
<|body_start_0|> super().__init__(model, params) self._var_scope = 'encoder_d' self._n_classes = 0 if 'n_classes' in params.keys(): self._n_classes = params['n_classes'] self._init_optimizer() <|end_body_0|> <|body_start_1|> def layer(input, units, add_b_norm...
debug implementation
EncoderD
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderD: """debug implementation""" def __init__(self, model, params): """Args: model: parent model object. params: dict() of parameters.""" <|body_0|> def _network(self, input): """forward network.""" <|body_1|> def _loss(self, _data): """p...
stack_v2_sparse_classes_36k_train_005841
9,168
permissive
[ { "docstring": "Args: model: parent model object. params: dict() of parameters.", "name": "__init__", "signature": "def __init__(self, model, params)" }, { "docstring": "forward network.", "name": "_network", "signature": "def _network(self, input)" }, { "docstring": "prepare the...
3
stack_v2_sparse_classes_30k_train_014272
Implement the Python class `EncoderD` described below. Class description: debug implementation Method signatures and docstrings: - def __init__(self, model, params): Args: model: parent model object. params: dict() of parameters. - def _network(self, input): forward network. - def _loss(self, _data): prepare the loss...
Implement the Python class `EncoderD` described below. Class description: debug implementation Method signatures and docstrings: - def __init__(self, model, params): Args: model: parent model object. params: dict() of parameters. - def _network(self, input): forward network. - def _loss(self, _data): prepare the loss...
9546d7a01c2b3e17131f34aa1e916e514c052ea8
<|skeleton|> class EncoderD: """debug implementation""" def __init__(self, model, params): """Args: model: parent model object. params: dict() of parameters.""" <|body_0|> def _network(self, input): """forward network.""" <|body_1|> def _loss(self, _data): """p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderD: """debug implementation""" def __init__(self, model, params): """Args: model: parent model object. params: dict() of parameters.""" super().__init__(model, params) self._var_scope = 'encoder_d' self._n_classes = 0 if 'n_classes' in params.keys(): ...
the_stack_v2_python_sparse
networks/network_aae_v_lite.py
cosmoplankton-studio/cellular-probabilistic
train
0
60dfebbf7e17ad808dc88026523469f4eca9367f
[ "try:\n\n def generate(vo):\n for exception in list_exceptions(vo=vo):\n yield (dumps(exception, cls=APIEncoder) + '\\n')\n return try_stream(generate(vo=request.environ.get('vo')))\nexcept LifetimeExceptionNotFound as error:\n return generate_http_error_flask(404, error)", "parameters ...
<|body_start_0|> try: def generate(vo): for exception in list_exceptions(vo=vo): yield (dumps(exception, cls=APIEncoder) + '\n') return try_stream(generate(vo=request.environ.get('vo'))) except LifetimeExceptionNotFound as error: r...
REST APIs for Lifetime Model exception.
LifetimeException
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LifetimeException: """REST APIs for Lifetime Model exception.""" def get(self): """--- summary: List Exceptions description: Retrieves all exceptions. tags: - Lifetime Exceptions responses: 200: description: OK content: application/x-json-stream: schema: description: One exception pe...
stack_v2_sparse_classes_36k_train_005842
12,043
permissive
[ { "docstring": "--- summary: List Exceptions description: Retrieves all exceptions. tags: - Lifetime Exceptions responses: 200: description: OK content: application/x-json-stream: schema: description: One exception per line. type: array items: description: A lifetime exception type: object properties: id: descr...
2
stack_v2_sparse_classes_30k_val_000344
Implement the Python class `LifetimeException` described below. Class description: REST APIs for Lifetime Model exception. Method signatures and docstrings: - def get(self): --- summary: List Exceptions description: Retrieves all exceptions. tags: - Lifetime Exceptions responses: 200: description: OK content: applica...
Implement the Python class `LifetimeException` described below. Class description: REST APIs for Lifetime Model exception. Method signatures and docstrings: - def get(self): --- summary: List Exceptions description: Retrieves all exceptions. tags: - Lifetime Exceptions responses: 200: description: OK content: applica...
7f0d229ac0b3bc7dec12c6e158bea2b82d414a3b
<|skeleton|> class LifetimeException: """REST APIs for Lifetime Model exception.""" def get(self): """--- summary: List Exceptions description: Retrieves all exceptions. tags: - Lifetime Exceptions responses: 200: description: OK content: application/x-json-stream: schema: description: One exception pe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LifetimeException: """REST APIs for Lifetime Model exception.""" def get(self): """--- summary: List Exceptions description: Retrieves all exceptions. tags: - Lifetime Exceptions responses: 200: description: OK content: application/x-json-stream: schema: description: One exception per line. type:...
the_stack_v2_python_sparse
lib/rucio/web/rest/flaskapi/v1/lifetime_exceptions.py
rucio/rucio
train
232
8349c92543090b969e112f860861f1d6b93f458e
[ "if cds_start:\n start += cds_start\n if end is not None:\n end += cds_start\nif start and (not end):\n ref_sequence = self.seqrepo_access.get_sequence(ac, start)\nelif start is not None and end is not None:\n ref_sequence = self.seqrepo_access.get_sequence(ac, start, end)\nelse:\n ref_sequenc...
<|body_start_0|> if cds_start: start += cds_start if end is not None: end += cds_start if start and (not end): ref_sequence = self.seqrepo_access.get_sequence(ac, start) elif start is not None and end is not None: ref_sequence = sel...
The Deletion Validator Base class.
DeletionBase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeletionBase: """The Deletion Validator Base class.""" def get_reference_sequence(self, ac, start, end, errors, cds_start=None) -> Optional[str]: """Get deleted reference sequence. :param str ac: Accession :param int start: Start position :param int end: End position :param list erro...
stack_v2_sparse_classes_36k_train_005843
2,684
permissive
[ { "docstring": "Get deleted reference sequence. :param str ac: Accession :param int start: Start position :param int end: End position :param list errors: List of errors :param int cds_start: Coding start site :return: Reference sequence of nucleotides", "name": "get_reference_sequence", "signature": "d...
3
stack_v2_sparse_classes_30k_train_002554
Implement the Python class `DeletionBase` described below. Class description: The Deletion Validator Base class. Method signatures and docstrings: - def get_reference_sequence(self, ac, start, end, errors, cds_start=None) -> Optional[str]: Get deleted reference sequence. :param str ac: Accession :param int start: Sta...
Implement the Python class `DeletionBase` described below. Class description: The Deletion Validator Base class. Method signatures and docstrings: - def get_reference_sequence(self, ac, start, end, errors, cds_start=None) -> Optional[str]: Get deleted reference sequence. :param str ac: Accession :param int start: Sta...
d41e9ee786b14f47d17ea8e458eed08ec00ba339
<|skeleton|> class DeletionBase: """The Deletion Validator Base class.""" def get_reference_sequence(self, ac, start, end, errors, cds_start=None) -> Optional[str]: """Get deleted reference sequence. :param str ac: Accession :param int start: Start position :param int end: End position :param list erro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeletionBase: """The Deletion Validator Base class.""" def get_reference_sequence(self, ac, start, end, errors, cds_start=None) -> Optional[str]: """Get deleted reference sequence. :param str ac: Accession :param int start: Start position :param int end: End position :param list errors: List of e...
the_stack_v2_python_sparse
variation/validators/deletion_base.py
richardhj/vicc-variation-normalization
train
0
77bbc498738c8174c74f106afa9b877bffd16016
[ "self.key = aKey\nself.crc = 0\nfor x in self.key:\n intX = ord(x)\n self.crc = self.crc ^ intX", "kIdx = 0\ncryptStr = ''\nfor x in range(len(aString)):\n cryptStr = cryptStr + chr(ord(aString[x]) ^ ord(self.key[kIdx]))\n kIdx = (kIdx + 1) % len(self.key)\nreturn cryptStr" ]
<|body_start_0|> self.key = aKey self.crc = 0 for x in self.key: intX = ord(x) self.crc = self.crc ^ intX <|end_body_0|> <|body_start_1|> kIdx = 0 cryptStr = '' for x in range(len(aString)): cryptStr = cryptStr + chr(ord(aString[x]) ^ ...
PEcrypt - very, very simple word key encryption system uses cyclic XOR between the keyword character bytes and the string to be encrypted/decrypted. Therefore, the same function and keyword will encrypt the string the first time and decrypt it if called on the encrypted string.
PEcrypt
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PEcrypt: """PEcrypt - very, very simple word key encryption system uses cyclic XOR between the keyword character bytes and the string to be encrypted/decrypted. Therefore, the same function and keyword will encrypt the string the first time and decrypt it if called on the encrypted string.""" ...
stack_v2_sparse_classes_36k_train_005844
3,796
no_license
[ { "docstring": "Initialise the class with the key that is used to encrypt/decrypt strings", "name": "__init__", "signature": "def __init__(self, aKey)" }, { "docstring": "Encrypt/Decrypt the passed string object and return the encrypted string", "name": "Crypt", "signature": "def Crypt(s...
2
stack_v2_sparse_classes_30k_train_004070
Implement the Python class `PEcrypt` described below. Class description: PEcrypt - very, very simple word key encryption system uses cyclic XOR between the keyword character bytes and the string to be encrypted/decrypted. Therefore, the same function and keyword will encrypt the string the first time and decrypt it if...
Implement the Python class `PEcrypt` described below. Class description: PEcrypt - very, very simple word key encryption system uses cyclic XOR between the keyword character bytes and the string to be encrypted/decrypted. Therefore, the same function and keyword will encrypt the string the first time and decrypt it if...
b4c81010a1476721cabc2621b17d92fead9314b4
<|skeleton|> class PEcrypt: """PEcrypt - very, very simple word key encryption system uses cyclic XOR between the keyword character bytes and the string to be encrypted/decrypted. Therefore, the same function and keyword will encrypt the string the first time and decrypt it if called on the encrypted string.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PEcrypt: """PEcrypt - very, very simple word key encryption system uses cyclic XOR between the keyword character bytes and the string to be encrypted/decrypted. Therefore, the same function and keyword will encrypt the string the first time and decrypt it if called on the encrypted string.""" def __init_...
the_stack_v2_python_sparse
BASE SCRIPTS/XOR decryption.py
btrif/Python_dev_repo
train
0
df43ed036ddb9c7e83839db4c5693204ce819d38
[ "super(VariationalAutoEncoder, self).__init__(encoder, decoder, name=name, **kwargs)\nif isinstance(z_sampler, torch.nn.Module):\n self.add_module('z_sampler', z_sampler)\nelse:\n self.z_sampler = z_sampler", "y = self.encoder(x)\nz, mu, sigma = self.z_sampler(y)\nx_hat = self.decoder(z)\nreturn (x_hat, mu,...
<|body_start_0|> super(VariationalAutoEncoder, self).__init__(encoder, decoder, name=name, **kwargs) if isinstance(z_sampler, torch.nn.Module): self.add_module('z_sampler', z_sampler) else: self.z_sampler = z_sampler <|end_body_0|> <|body_start_1|> y = self.encod...
A class representing a variational autoencoder Attributes ---------- z_sampler : callable Methods ------- forward(x) returns the autoencoder output
VariationalAutoEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VariationalAutoEncoder: """A class representing a variational autoencoder Attributes ---------- z_sampler : callable Methods ------- forward(x) returns the autoencoder output""" def __init__(self, encoder, decoder, z_sampler=VariationalSampler(), name='VariationalAutoEncoder', **kwargs): ...
stack_v2_sparse_classes_36k_train_005845
4,636
permissive
[ { "docstring": "Parameters ---------- encoder : torch.nn.Module the encoder architecture decoder : torch.nn.Module the decoder architecture z_sampler : callable (optional) the z tensor sampler (default is VariationalSampler()) name : str (optional) the name of the autoencoder (default is 'VariationalAutoEncoder...
2
null
Implement the Python class `VariationalAutoEncoder` described below. Class description: A class representing a variational autoencoder Attributes ---------- z_sampler : callable Methods ------- forward(x) returns the autoencoder output Method signatures and docstrings: - def __init__(self, encoder, decoder, z_sampler...
Implement the Python class `VariationalAutoEncoder` described below. Class description: A class representing a variational autoencoder Attributes ---------- z_sampler : callable Methods ------- forward(x) returns the autoencoder output Method signatures and docstrings: - def __init__(self, encoder, decoder, z_sampler...
2615b66dd4addfd5c03d9d91a24c7da414294308
<|skeleton|> class VariationalAutoEncoder: """A class representing a variational autoencoder Attributes ---------- z_sampler : callable Methods ------- forward(x) returns the autoencoder output""" def __init__(self, encoder, decoder, z_sampler=VariationalSampler(), name='VariationalAutoEncoder', **kwargs): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VariationalAutoEncoder: """A class representing a variational autoencoder Attributes ---------- z_sampler : callable Methods ------- forward(x) returns the autoencoder output""" def __init__(self, encoder, decoder, z_sampler=VariationalSampler(), name='VariationalAutoEncoder', **kwargs): """Param...
the_stack_v2_python_sparse
ACME/model/variational_autoencoder.py
mauriziokovacic/ACME
train
3
25c0b7377c35772d93c845ed1593c314fb5ffa8a
[ "for backend in orm.Backend.objects.all():\n old_hash = backend.password_hash\n if len(old_hash.split(':')) == 2:\n old_pass = decrypt_db_charfield_old(old_hash)\n new_hash = encrypt_db_charfield(old_pass)\n orm.Backend.objects.filter(id=backend.id).update(password_hash=new_hash)", "try...
<|body_start_0|> for backend in orm.Backend.objects.all(): old_hash = backend.password_hash if len(old_hash.split(':')) == 2: old_pass = decrypt_db_charfield_old(old_hash) new_hash = encrypt_db_charfield(old_pass) orm.Backend.objects.filter...
Migration
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|> <|body_start_0|> for backend in orm.Backend.objects.all(): ...
stack_v2_sparse_classes_36k_train_005846
18,657
permissive
[ { "docstring": "Write your forwards methods here.", "name": "forwards", "signature": "def forwards(self, orm)" }, { "docstring": "Write your backwards methods here.", "name": "backwards", "signature": "def backwards(self, orm)" } ]
2
stack_v2_sparse_classes_30k_train_016367
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here.
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here. <|skeleton|> class Migration: def forwards(self,...
11e79c1c2add88c1e3dbe51e2915fb1bddd1bbf1
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Migration: def forwards(self, orm): """Write your forwards methods here.""" for backend in orm.Backend.objects.all(): old_hash = backend.password_hash if len(old_hash.split(':')) == 2: old_pass = decrypt_db_charfield_old(old_hash) new_has...
the_stack_v2_python_sparse
snf-cyclades-app/synnefo/db/migrations/0066_add_iv.py
dimara/synnefo
train
0
1d9c361850122ec1ccc057e397c8a1e74844fed0
[ "self.n_fft = n_fft\nself.hop_len = n_fft // 2 if hop_len is None else hop_len\nself.stft = ta.transforms.Spectrogram(n_fft=n_fft, hop_length=self.hop_len, win_length=n_fft, power=None)\nself.amplitude_to_db = ta.transforms.AmplitudeToDB()\nself.db_to_amplitude = lambda x: T.pow(T.pow(10.0, 0.1 * x), 1.0)", "stft...
<|body_start_0|> self.n_fft = n_fft self.hop_len = n_fft // 2 if hop_len is None else hop_len self.stft = ta.transforms.Spectrogram(n_fft=n_fft, hop_length=self.hop_len, win_length=n_fft, power=None) self.amplitude_to_db = ta.transforms.AmplitudeToDB() self.db_to_amplitude = lamb...
DSP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DSP: def __init__(self, n_fft=254, hop_len=None): """signal processing utils using torchaudio""" <|body_0|> def sig_to_db_phase(self, sig): """get dB and phase spectrograms of signal example usage: >>> sig, sr = ta.load('sound.wav') >>> db, phase = chvoice.sig_to_db_...
stack_v2_sparse_classes_36k_train_005847
1,916
no_license
[ { "docstring": "signal processing utils using torchaudio", "name": "__init__", "signature": "def __init__(self, n_fft=254, hop_len=None)" }, { "docstring": "get dB and phase spectrograms of signal example usage: >>> sig, sr = ta.load('sound.wav') >>> db, phase = chvoice.sig_to_db_phase(sig)", ...
3
stack_v2_sparse_classes_30k_train_002647
Implement the Python class `DSP` described below. Class description: Implement the DSP class. Method signatures and docstrings: - def __init__(self, n_fft=254, hop_len=None): signal processing utils using torchaudio - def sig_to_db_phase(self, sig): get dB and phase spectrograms of signal example usage: >>> sig, sr =...
Implement the Python class `DSP` described below. Class description: Implement the DSP class. Method signatures and docstrings: - def __init__(self, n_fft=254, hop_len=None): signal processing utils using torchaudio - def sig_to_db_phase(self, sig): get dB and phase spectrograms of signal example usage: >>> sig, sr =...
6b4567c0bc1325a36b0d08fdf0f4fdcf8d803909
<|skeleton|> class DSP: def __init__(self, n_fft=254, hop_len=None): """signal processing utils using torchaudio""" <|body_0|> def sig_to_db_phase(self, sig): """get dB and phase spectrograms of signal example usage: >>> sig, sr = ta.load('sound.wav') >>> db, phase = chvoice.sig_to_db_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DSP: def __init__(self, n_fft=254, hop_len=None): """signal processing utils using torchaudio""" self.n_fft = n_fft self.hop_len = n_fft // 2 if hop_len is None else hop_len self.stft = ta.transforms.Spectrogram(n_fft=n_fft, hop_length=self.hop_len, win_length=n_fft, power=None...
the_stack_v2_python_sparse
chvoice/dsp.py
ashwinahuja/chvoice
train
1
3dd3575ebec635de76b5e99550f7e1160b7cd75e
[ "commit_datetime = git_metadata_utils.get_head_commit_datetime(git_repo=_CHROMIUM_SRC_ROOT)\nself.assertIsNotNone(commit_datetime.tzinfo)\nself.assertIsNotNone(commit_datetime.utcoffset())\nself.assertEqual(timezone.utc, commit_datetime.tzinfo)\nself.assertGreater(commit_datetime, datetime(2021, 10, 5, tzinfo=timez...
<|body_start_0|> commit_datetime = git_metadata_utils.get_head_commit_datetime(git_repo=_CHROMIUM_SRC_ROOT) self.assertIsNotNone(commit_datetime.tzinfo) self.assertIsNotNone(commit_datetime.utcoffset()) self.assertEqual(timezone.utc, commit_datetime.tzinfo) self.assertGreater(com...
Tests for the get_head_commit_datetime function.
TestHeadCommitDatetime
[ "LGPL-2.0-or-later", "GPL-2.0-only", "Apache-2.0", "LGPL-2.0-only", "LicenseRef-scancode-unknown", "LGPL-2.1-only", "MIT", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "APSL-2.0", "MPL-1.1", "Zlib" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestHeadCommitDatetime: """Tests for the get_head_commit_datetime function.""" def test_get_head_commit_datetime_chromium_repo(self): """Tests that get_head_commit_datetime returns a commit datetime. Checks that the datetime is not naive (has a timezone, specifically UTC) and that th...
stack_v2_sparse_classes_36k_train_005848
7,599
permissive
[ { "docstring": "Tests that get_head_commit_datetime returns a commit datetime. Checks that the datetime is not naive (has a timezone, specifically UTC) and that the datetime is sane.", "name": "test_get_head_commit_datetime_chromium_repo", "signature": "def test_get_head_commit_datetime_chromium_repo(se...
6
stack_v2_sparse_classes_30k_train_014632
Implement the Python class `TestHeadCommitDatetime` described below. Class description: Tests for the get_head_commit_datetime function. Method signatures and docstrings: - def test_get_head_commit_datetime_chromium_repo(self): Tests that get_head_commit_datetime returns a commit datetime. Checks that the datetime is...
Implement the Python class `TestHeadCommitDatetime` described below. Class description: Tests for the get_head_commit_datetime function. Method signatures and docstrings: - def test_get_head_commit_datetime_chromium_repo(self): Tests that get_head_commit_datetime returns a commit datetime. Checks that the datetime is...
87244f4ee50062e59667bf8b9ca4d5291b6818d7
<|skeleton|> class TestHeadCommitDatetime: """Tests for the get_head_commit_datetime function.""" def test_get_head_commit_datetime_chromium_repo(self): """Tests that get_head_commit_datetime returns a commit datetime. Checks that the datetime is not naive (has a timezone, specifically UTC) and that th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestHeadCommitDatetime: """Tests for the get_head_commit_datetime function.""" def test_get_head_commit_datetime_chromium_repo(self): """Tests that get_head_commit_datetime returns a commit datetime. Checks that the datetime is not naive (has a timezone, specifically UTC) and that the datetime is...
the_stack_v2_python_sparse
chromium/tools/android/python_utils/git_metadata_utils_unittest.py
ric2b/Vivaldi-browser
train
166
d60f2023b2cac48bf29ceb23acb8fd621716fba2
[ "self.task_name = task_name\nself.pre_task = None\nself.next_task = None\nself.full_var_list = []\nself.avail_var_list = []\nself.status = False", "if self.pre_task:\n if not self.pre_task.refresh_status():\n self.status = False\n return self.status\nif Counter(self.avail_var_list) == Counter(sel...
<|body_start_0|> self.task_name = task_name self.pre_task = None self.next_task = None self.full_var_list = [] self.avail_var_list = [] self.status = False <|end_body_0|> <|body_start_1|> if self.pre_task: if not self.pre_task.refresh_status(): ...
This is a class for managering an individual task in the PLoM running process
Task
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Task: """This is a class for managering an individual task in the PLoM running process""" def __init__(self, task_name=None): """Initialization - task_name: name of the task""" <|body_0|> def refresh_status(self): """Refreshing the current status of the task If a...
stack_v2_sparse_classes_36k_train_005849
11,187
no_license
[ { "docstring": "Initialization - task_name: name of the task", "name": "__init__", "signature": "def __init__(self, task_name=None)" }, { "docstring": "Refreshing the current status of the task If any of the previous tasks is not completed, the current task is also not reliable", "name": "re...
2
null
Implement the Python class `Task` described below. Class description: This is a class for managering an individual task in the PLoM running process Method signatures and docstrings: - def __init__(self, task_name=None): Initialization - task_name: name of the task - def refresh_status(self): Refreshing the current st...
Implement the Python class `Task` described below. Class description: This is a class for managering an individual task in the PLoM running process Method signatures and docstrings: - def __init__(self, task_name=None): Initialization - task_name: name of the task - def refresh_status(self): Refreshing the current st...
9c051b36e3c62b63795ae0ce072f80a02e342c34
<|skeleton|> class Task: """This is a class for managering an individual task in the PLoM running process""" def __init__(self, task_name=None): """Initialization - task_name: name of the task""" <|body_0|> def refresh_status(self): """Refreshing the current status of the task If a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Task: """This is a class for managering an individual task in the PLoM running process""" def __init__(self, task_name=None): """Initialization - task_name: name of the task""" self.task_name = task_name self.pre_task = None self.next_task = None self.full_var_list...
the_stack_v2_python_sparse
modules/performUQ/SimCenterUQ/PLoM/general.py
NHERI-SimCenter/SimCenterBackendApplications
train
5
e9d5f911db466574d83bbbdff41d017b178f8281
[ "if not isinstance(shear, (list, tuple)) or len(shear) != 2:\n raise ValueError('shear argument must be list/tuple with two values!')\nself.shear = shear\nself.lazy = lazy\nself.reference = reference\nself.tx = tio.ANTsTransform(precision='float', dimension=2, transform_type='AffineTransform')\nif self.reference...
<|body_start_0|> if not isinstance(shear, (list, tuple)) or len(shear) != 2: raise ValueError('shear argument must be list/tuple with two values!') self.shear = shear self.lazy = lazy self.reference = reference self.tx = tio.ANTsTransform(precision='float', dimension=...
Create an ANTs Affine Transform with a specified shear.
Shear2D
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Shear2D: """Create an ANTs Affine Transform with a specified shear.""" def __init__(self, shear, reference=None, lazy=False): """Initialize a Shear2D object Arguments --------- shear : list or tuple shear values for each axis, in degrees. Negative values can be used for shear in the ...
stack_v2_sparse_classes_36k_train_005850
21,674
permissive
[ { "docstring": "Initialize a Shear2D object Arguments --------- shear : list or tuple shear values for each axis, in degrees. Negative values can be used for shear in the other direction reference : ANTsImage (optional but recommended) image providing the reference space for the transform. this will also set th...
2
null
Implement the Python class `Shear2D` described below. Class description: Create an ANTs Affine Transform with a specified shear. Method signatures and docstrings: - def __init__(self, shear, reference=None, lazy=False): Initialize a Shear2D object Arguments --------- shear : list or tuple shear values for each axis, ...
Implement the Python class `Shear2D` described below. Class description: Create an ANTs Affine Transform with a specified shear. Method signatures and docstrings: - def __init__(self, shear, reference=None, lazy=False): Initialize a Shear2D object Arguments --------- shear : list or tuple shear values for each axis, ...
41f2dd3fcf72654f284dac1a9448033e963f0afb
<|skeleton|> class Shear2D: """Create an ANTs Affine Transform with a specified shear.""" def __init__(self, shear, reference=None, lazy=False): """Initialize a Shear2D object Arguments --------- shear : list or tuple shear values for each axis, in degrees. Negative values can be used for shear in the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Shear2D: """Create an ANTs Affine Transform with a specified shear.""" def __init__(self, shear, reference=None, lazy=False): """Initialize a Shear2D object Arguments --------- shear : list or tuple shear values for each axis, in degrees. Negative values can be used for shear in the other directi...
the_stack_v2_python_sparse
ants/contrib/sampling/affine2d.py
ANTsX/ANTsPy
train
483
708d26e2ea4e4ff93db62ddf7d60a9b528bdc111
[ "topicTitle = request.args.get('topicTitle', '', type=str)\nreportId = request.args.get('reportId', 0, type=int)\nalgorithm = request.args.get('algorithm', '', type=str)\nthreshold = request.args.get('threshold', 0, type=float)\npage = request.args.get('page', 1, type=int)\nper_page = request.args.get('per_page', 1...
<|body_start_0|> topicTitle = request.args.get('topicTitle', '', type=str) reportId = request.args.get('reportId', 0, type=int) algorithm = request.args.get('algorithm', '', type=str) threshold = request.args.get('threshold', 0, type=float) page = request.args.get('page', 1, type...
EmotionAnalyzerController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmotionAnalyzerController: def get(self): """Returns a page of tweet with emotions""" <|body_0|> def post(self): """Analyses the emotion of tweets generated by a similarity algorithm.""" <|body_1|> <|end_skeleton|> <|body_start_0|> topicTitle = requ...
stack_v2_sparse_classes_36k_train_005851
2,883
no_license
[ { "docstring": "Returns a page of tweet with emotions", "name": "get", "signature": "def get(self)" }, { "docstring": "Analyses the emotion of tweets generated by a similarity algorithm.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_val_000694
Implement the Python class `EmotionAnalyzerController` described below. Class description: Implement the EmotionAnalyzerController class. Method signatures and docstrings: - def get(self): Returns a page of tweet with emotions - def post(self): Analyses the emotion of tweets generated by a similarity algorithm.
Implement the Python class `EmotionAnalyzerController` described below. Class description: Implement the EmotionAnalyzerController class. Method signatures and docstrings: - def get(self): Returns a page of tweet with emotions - def post(self): Analyses the emotion of tweets generated by a similarity algorithm. <|sk...
e8d5fd562724df1ad26b90d0c731e133b052df24
<|skeleton|> class EmotionAnalyzerController: def get(self): """Returns a page of tweet with emotions""" <|body_0|> def post(self): """Analyses the emotion of tweets generated by a similarity algorithm.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmotionAnalyzerController: def get(self): """Returns a page of tweet with emotions""" topicTitle = request.args.get('topicTitle', '', type=str) reportId = request.args.get('reportId', 0, type=int) algorithm = request.args.get('algorithm', '', type=str) threshold = reque...
the_stack_v2_python_sparse
app/main/controllers/emotionAnalyzerController.py
ProyectoFinal2020/TweetAnalyzer-Backend
train
0
4430d37c105bb1addabb420b86692b016d3262d6
[ "def dfs(root, Sum, path, ans):\n if not root.left and (not root.right) and (Sum == root.val):\n path.append(root.val)\n ans.append(path)\n if root.left:\n dfs(root.left, Sum - root.val, path + [root.val], ans)\n if root.right:\n dfs(root.right, Sum - root.val, path + [root.val]...
<|body_start_0|> def dfs(root, Sum, path, ans): if not root.left and (not root.right) and (Sum == root.val): path.append(root.val) ans.append(path) if root.left: dfs(root.left, Sum - root.val, path + [root.val], ans) if root.rig...
5 / 4 8 / / 11 13 4 / \\ / 7 2 5 1 sum = 22 [ [5,4,11,2], [5,8,4,5] ] Summary: 这类题考得就是二叉树的遍历,只不过在遍历的同时需要保存每个节点的和,可以用,因此自然而然的可以想用用dfs来做 需要注意的是: 遍历的时候使用 ``` while root: stack.append(...) root = root.left ``` 这种遍历方法并不太好,因为无法获得上一次压栈的值,也就无法很好的保存已访问过的节点以及目前节点的和
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """5 / 4 8 / / 11 13 4 / \\ / 7 2 5 1 sum = 22 [ [5,4,11,2], [5,8,4,5] ] Summary: 这类题考得就是二叉树的遍历,只不过在遍历的同时需要保存每个节点的和,可以用,因此自然而然的可以想用用dfs来做 需要注意的是: 遍历的时候使用 ``` while root: stack.append(...) root = root.left ``` 这种遍历方法并不太好,因为无法获得上一次压栈的值,也就无法很好的保存已访问过的节点以及目前节点的和""" def pathSum1(self, r...
stack_v2_sparse_classes_36k_train_005852
3,838
no_license
[ { "docstring": "dfs-recursive :param root: :param Sum: :return:", "name": "pathSum1", "signature": "def pathSum1(self, root: TreeNode, Sum: int) -> List[List[int]]" }, { "docstring": "dfs+stack iterative 迭代版本其实就是自己用一个`stack`实现递归中的栈帧 :param root: :param Sum: :return:", "name": "pathSum2", ...
4
stack_v2_sparse_classes_30k_train_006456
Implement the Python class `Solution` described below. Class description: 5 / 4 8 / / 11 13 4 / \\ / 7 2 5 1 sum = 22 [ [5,4,11,2], [5,8,4,5] ] Summary: 这类题考得就是二叉树的遍历,只不过在遍历的同时需要保存每个节点的和,可以用,因此自然而然的可以想用用dfs来做 需要注意的是: 遍历的时候使用 ``` while root: stack.append(...) root = root.left ``` 这种遍历方法并不太好,因为无法获得上一次压栈的值,也就无法很好的保存已访问过的...
Implement the Python class `Solution` described below. Class description: 5 / 4 8 / / 11 13 4 / \\ / 7 2 5 1 sum = 22 [ [5,4,11,2], [5,8,4,5] ] Summary: 这类题考得就是二叉树的遍历,只不过在遍历的同时需要保存每个节点的和,可以用,因此自然而然的可以想用用dfs来做 需要注意的是: 遍历的时候使用 ``` while root: stack.append(...) root = root.left ``` 这种遍历方法并不太好,因为无法获得上一次压栈的值,也就无法很好的保存已访问过的...
25f2795b6e7f9f68833f2fddc6cc4f4d977121a6
<|skeleton|> class Solution: """5 / 4 8 / / 11 13 4 / \\ / 7 2 5 1 sum = 22 [ [5,4,11,2], [5,8,4,5] ] Summary: 这类题考得就是二叉树的遍历,只不过在遍历的同时需要保存每个节点的和,可以用,因此自然而然的可以想用用dfs来做 需要注意的是: 遍历的时候使用 ``` while root: stack.append(...) root = root.left ``` 这种遍历方法并不太好,因为无法获得上一次压栈的值,也就无法很好的保存已访问过的节点以及目前节点的和""" def pathSum1(self, r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """5 / 4 8 / / 11 13 4 / \\ / 7 2 5 1 sum = 22 [ [5,4,11,2], [5,8,4,5] ] Summary: 这类题考得就是二叉树的遍历,只不过在遍历的同时需要保存每个节点的和,可以用,因此自然而然的可以想用用dfs来做 需要注意的是: 遍历的时候使用 ``` while root: stack.append(...) root = root.left ``` 这种遍历方法并不太好,因为无法获得上一次压栈的值,也就无法很好的保存已访问过的节点以及目前节点的和""" def pathSum1(self, root: TreeNode...
the_stack_v2_python_sparse
113.py
Darkxiete/leetcode_python
train
0
74e18c46b02e2e1121b4867ea3509ee260bdade2
[ "logger.info(u'开始执行测试用例:用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置')\nlogger.info(u'开始登录操作...')\nself.assertTrue(self.user_login_success())\nlogger.info(' 正在获得用例期望值...')\nexpected_value = get_expected_value('008')\nlogger.info('正在获得截图标题...')\ntitle = get_image_title('008')\nlogger.info('生成截图中...')\ninsert_img(self.driv...
<|body_start_0|> logger.info(u'开始执行测试用例:用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置') logger.info(u'开始登录操作...') self.assertTrue(self.user_login_success()) logger.info(' 正在获得用例期望值...') expected_value = get_expected_value('008') logger.info('正在获得截图标题...') title = get_ima...
mp 登录首页页面元素数据检查
MainPageCheckTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainPageCheckTest: """mp 登录首页页面元素数据检查""" def test_008_loc(self): """用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置""" <|body_0|> def test_009_service_name(self): """用例编号009:mp登录-用户名密码正确,且绑定了公众号,登录后检查公众号名称""" <|body_1|> def test_010_service_id(self): ...
stack_v2_sparse_classes_36k_train_005853
3,860
no_license
[ { "docstring": "用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置", "name": "test_008_loc", "signature": "def test_008_loc(self)" }, { "docstring": "用例编号009:mp登录-用户名密码正确,且绑定了公众号,登录后检查公众号名称", "name": "test_009_service_name", "signature": "def test_009_service_name(self)" }, { "docstring": "用...
4
stack_v2_sparse_classes_30k_train_021626
Implement the Python class `MainPageCheckTest` described below. Class description: mp 登录首页页面元素数据检查 Method signatures and docstrings: - def test_008_loc(self): 用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置 - def test_009_service_name(self): 用例编号009:mp登录-用户名密码正确,且绑定了公众号,登录后检查公众号名称 - def test_010_service_id(self): 用例编号010:mp登录...
Implement the Python class `MainPageCheckTest` described below. Class description: mp 登录首页页面元素数据检查 Method signatures and docstrings: - def test_008_loc(self): 用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置 - def test_009_service_name(self): 用例编号009:mp登录-用户名密码正确,且绑定了公众号,登录后检查公众号名称 - def test_010_service_id(self): 用例编号010:mp登录...
5db7dc1a10100721180f0cc66e4c96479ec69501
<|skeleton|> class MainPageCheckTest: """mp 登录首页页面元素数据检查""" def test_008_loc(self): """用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置""" <|body_0|> def test_009_service_name(self): """用例编号009:mp登录-用户名密码正确,且绑定了公众号,登录后检查公众号名称""" <|body_1|> def test_010_service_id(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MainPageCheckTest: """mp 登录首页页面元素数据检查""" def test_008_loc(self): """用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置""" logger.info(u'开始执行测试用例:用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置') logger.info(u'开始登录操作...') self.assertTrue(self.user_login_success()) logger.info(' 正在获得用例期望...
the_stack_v2_python_sparse
mp/test_model/test_case/main_page_check_test.py
eatingM/kk_mp
train
0
240cdfff2b352b2e00ce100211ed85bbe16404c0
[ "if connection_mode is None:\n connection_mode = pybullet.DIRECT\nself._client = pybullet.connect(pybullet.SHARED_MEMORY)\nif self._client < 0:\n self._client = pybullet.connect(connection_mode, options=options)\nself._shapes = {}", "try:\n pybullet.disconnect(physicsClientId=self._client)\nexcept pybull...
<|body_start_0|> if connection_mode is None: connection_mode = pybullet.DIRECT self._client = pybullet.connect(pybullet.SHARED_MEMORY) if self._client < 0: self._client = pybullet.connect(connection_mode, options=options) self._shapes = {} <|end_body_0|> <|body_s...
A wrapper for pybullet to manage different clients.
MyBulletClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyBulletClient: """A wrapper for pybullet to manage different clients.""" def __init__(self, connection_mode=None, options=''): """Create a simulation and connect to it.""" <|body_0|> def __del__(self): """Clean up connection if not already done.""" <|bod...
stack_v2_sparse_classes_36k_train_005854
28,029
permissive
[ { "docstring": "Create a simulation and connect to it.", "name": "__init__", "signature": "def __init__(self, connection_mode=None, options='')" }, { "docstring": "Clean up connection if not already done.", "name": "__del__", "signature": "def __del__(self)" }, { "docstring": "In...
3
stack_v2_sparse_classes_30k_train_006620
Implement the Python class `MyBulletClient` described below. Class description: A wrapper for pybullet to manage different clients. Method signatures and docstrings: - def __init__(self, connection_mode=None, options=''): Create a simulation and connect to it. - def __del__(self): Clean up connection if not already d...
Implement the Python class `MyBulletClient` described below. Class description: A wrapper for pybullet to manage different clients. Method signatures and docstrings: - def __init__(self, connection_mode=None, options=''): Create a simulation and connect to it. - def __del__(self): Clean up connection if not already d...
cdd9bbdc2a3a832be24f20105b8c9fe28149cb63
<|skeleton|> class MyBulletClient: """A wrapper for pybullet to manage different clients.""" def __init__(self, connection_mode=None, options=''): """Create a simulation and connect to it.""" <|body_0|> def __del__(self): """Clean up connection if not already done.""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyBulletClient: """A wrapper for pybullet to manage different clients.""" def __init__(self, connection_mode=None, options=''): """Create a simulation and connect to it.""" if connection_mode is None: connection_mode = pybullet.DIRECT self._client = pybullet.connect(py...
the_stack_v2_python_sparse
rlscope/profiler/clib_wrap.py
UofT-EcoSystem/rlscope
train
42
8eb971bd21c4422b956c2abcd56c52d629b2b630
[ "nodelist = set()\ncurrentnode = head\nwhile currentnode is not None:\n if currentnode not in nodelist:\n nodelist.add(currentnode)\n currentnode = currentnode.next\n else:\n return True\nreturn False", "if not head:\n return False\np1, p2 = (head, head)\nwhile p2.next and p2:\n p...
<|body_start_0|> nodelist = set() currentnode = head while currentnode is not None: if currentnode not in nodelist: nodelist.add(currentnode) currentnode = currentnode.next else: return True return False <|end_body_0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasCycle2(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> nodelist = set() currentnode = head ...
stack_v2_sparse_classes_36k_train_005855
890
no_license
[ { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle2", "signature": "def hasCycle2(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle", "signature": "def hasCycle(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_021343
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle2(self, head): :type head: ListNode :rtype: bool - def hasCycle(self, head): :type head: ListNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle2(self, head): :type head: ListNode :rtype: bool - def hasCycle(self, head): :type head: ListNode :rtype: bool <|skeleton|> class Solution: def hasCycle2(self, ...
bd93367081a752aa8cf3689944921f4392df1974
<|skeleton|> class Solution: def hasCycle2(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hasCycle2(self, head): """:type head: ListNode :rtype: bool""" nodelist = set() currentnode = head while currentnode is not None: if currentnode not in nodelist: nodelist.add(currentnode) currentnode = currentnode.next ...
the_stack_v2_python_sparse
141.py
SHUwangwei/leetcode
train
0
e480da90e2589141200075e352377c0efb3f7411
[ "mpmap = {}\nfor manpage in files:\n normalized = _os.path.normpath(manpage)\n _, ext = _os.path.splitext(normalized)\n if ext.startswith(_os.path.extsep):\n ext = ext[len(_os.path.extsep):]\n mpmap.setdefault(ext, []).append(manpage)\nreturn [cls(manpages, prefix=_posixpath.join('share', 'man', ...
<|body_start_0|> mpmap = {} for manpage in files: normalized = _os.path.normpath(manpage) _, ext = _os.path.splitext(normalized) if ext.startswith(_os.path.extsep): ext = ext[len(_os.path.extsep):] mpmap.setdefault(ext, []).append(manpage) ...
Manpages container
Manpages
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Manpages: """Manpages container""" def dispatch(cls, files): """Automatically dispatch manpages to their target directories""" <|body_0|> def flatten(self, installer): """Check if manpages are suitable""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_005856
5,080
permissive
[ { "docstring": "Automatically dispatch manpages to their target directories", "name": "dispatch", "signature": "def dispatch(cls, files)" }, { "docstring": "Check if manpages are suitable", "name": "flatten", "signature": "def flatten(self, installer)" } ]
2
null
Implement the Python class `Manpages` described below. Class description: Manpages container Method signatures and docstrings: - def dispatch(cls, files): Automatically dispatch manpages to their target directories - def flatten(self, installer): Check if manpages are suitable
Implement the Python class `Manpages` described below. Class description: Manpages container Method signatures and docstrings: - def dispatch(cls, files): Automatically dispatch manpages to their target directories - def flatten(self, installer): Check if manpages are suitable <|skeleton|> class Manpages: """Man...
53102de187a48ac2cfc241fef54dcbc29c453a8e
<|skeleton|> class Manpages: """Manpages container""" def dispatch(cls, files): """Automatically dispatch manpages to their target directories""" <|body_0|> def flatten(self, installer): """Check if manpages are suitable""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Manpages: """Manpages container""" def dispatch(cls, files): """Automatically dispatch manpages to their target directories""" mpmap = {} for manpage in files: normalized = _os.path.normpath(manpage) _, ext = _os.path.splitext(normalized) if ext...
the_stack_v2_python_sparse
common/py_vulcanize/third_party/rjsmin/_setup/py2/data.py
catapult-project/catapult
train
2,032
e6d24767d4558091ea1840e522e53448065babce
[ "self.edenHost = UTIL.SYS.s_configuration.EDEN_HOST\nself.connected = False\nself.edenPort = UTIL.SYS.s_configuration.EDEN_SERVER_PORT\nself.connected2 = False\nself.edenPort2 = UTIL.SYS.s_configuration.EDEN_SERVER_PORT2", "LOG_INFO('EGSE interface server configuration', 'EDEN')\nLOG('EDEN host = ' + self.edenHos...
<|body_start_0|> self.edenHost = UTIL.SYS.s_configuration.EDEN_HOST self.connected = False self.edenPort = UTIL.SYS.s_configuration.EDEN_SERVER_PORT self.connected2 = False self.edenPort2 = UTIL.SYS.s_configuration.EDEN_SERVER_PORT2 <|end_body_0|> <|body_start_1|> LOG_IN...
EDEN Client Configuration (on CCS side)
EDENclientConfiguration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EDENclientConfiguration: """EDEN Client Configuration (on CCS side)""" def __init__(self): """Initialise the connection relevant informations""" <|body_0|> def dump(self): """Dumps the status of the server configuration attributes""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k_train_005857
5,792
permissive
[ { "docstring": "Initialise the connection relevant informations", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Dumps the status of the server configuration attributes", "name": "dump", "signature": "def dump(self)" } ]
2
stack_v2_sparse_classes_30k_train_015862
Implement the Python class `EDENclientConfiguration` described below. Class description: EDEN Client Configuration (on CCS side) Method signatures and docstrings: - def __init__(self): Initialise the connection relevant informations - def dump(self): Dumps the status of the server configuration attributes
Implement the Python class `EDENclientConfiguration` described below. Class description: EDEN Client Configuration (on CCS side) Method signatures and docstrings: - def __init__(self): Initialise the connection relevant informations - def dump(self): Dumps the status of the server configuration attributes <|skeleton...
c94415e9d85519f345fc56938198ac2537c0c6d0
<|skeleton|> class EDENclientConfiguration: """EDEN Client Configuration (on CCS side)""" def __init__(self): """Initialise the connection relevant informations""" <|body_0|> def dump(self): """Dumps the status of the server configuration attributes""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EDENclientConfiguration: """EDEN Client Configuration (on CCS side)""" def __init__(self): """Initialise the connection relevant informations""" self.edenHost = UTIL.SYS.s_configuration.EDEN_HOST self.connected = False self.edenPort = UTIL.SYS.s_configuration.EDEN_SERVER_P...
the_stack_v2_python_sparse
EGSE/IF.py
khawatkom/SpacePyLibrary
train
1
568e380989467ef6ed91cf71259df4c8f8570db5
[ "GradientDescent.__init__(self, function)\nself.gamma = gamma\nself.epsilon = epsilon\nself.alpha = alpha\nself.gE = [0 for _ in range(self.dim)]\nself.dxE = [0 for _ in range(self.dim)]", "_x2 = 0\n_check = 0\nself.function.derivative(self.function.x)\nfor i in range(self.dim):\n self.gE[i] = self.gamma * sel...
<|body_start_0|> GradientDescent.__init__(self, function) self.gamma = gamma self.epsilon = epsilon self.alpha = alpha self.gE = [0 for _ in range(self.dim)] self.dxE = [0 for _ in range(self.dim)] <|end_body_0|> <|body_start_1|> _x2 = 0 _check = 0 ...
Implementation of AdaDelta.
AdaDeltaGD
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdaDeltaGD: """Implementation of AdaDelta.""" def __init__(self, function, gamma=0.95, epsilon=1e-06, alpha=1): """function: instance of Function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0)""" <|body_0|> def update(self, abs_tol=1e-05...
stack_v2_sparse_classes_36k_train_005858
1,953
permissive
[ { "docstring": "function: instance of Function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0)", "name": "__init__", "signature": "def __init__(self, function, gamma=0.95, epsilon=1e-06, alpha=1)" }, { "docstring": "update should return a number that when it is s...
2
stack_v2_sparse_classes_30k_test_000646
Implement the Python class `AdaDeltaGD` described below. Class description: Implementation of AdaDelta. Method signatures and docstrings: - def __init__(self, function, gamma=0.95, epsilon=1e-06, alpha=1): function: instance of Function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0) ...
Implement the Python class `AdaDeltaGD` described below. Class description: Implementation of AdaDelta. Method signatures and docstrings: - def __init__(self, function, gamma=0.95, epsilon=1e-06, alpha=1): function: instance of Function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0) ...
e12ea464e7845793c88adfff6da4c8454099c03b
<|skeleton|> class AdaDeltaGD: """Implementation of AdaDelta.""" def __init__(self, function, gamma=0.95, epsilon=1e-06, alpha=1): """function: instance of Function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0)""" <|body_0|> def update(self, abs_tol=1e-05...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdaDeltaGD: """Implementation of AdaDelta.""" def __init__(self, function, gamma=0.95, epsilon=1e-06, alpha=1): """function: instance of Function gamma: the decaying parameter epsilon: safety parameter (to avoid division by 0)""" GradientDescent.__init__(self, function) self.gamma...
the_stack_v2_python_sparse
Optimization/Minimization/Gradient-Descent/python/GD/AdaDeltaGD.py
dkaramit/ASAP
train
2
0b4b6808f0193db6cc2e50b7dca2e22ba1b48ad4
[ "memo = [[0] * (len(B) + 1) for _ in range(len(A) + 1)]\nfor i in range(len(A) - 1, -1, -1):\n for j in range(len(B) - 1, -1, -1):\n if A[i] == B[j]:\n memo[i][j] = memo[i + 1][j + 1] + 1\nreturn max((max(row) for row in memo))", "def check(length):\n seen = {A[i:i + length] for i in range...
<|body_start_0|> memo = [[0] * (len(B) + 1) for _ in range(len(A) + 1)] for i in range(len(A) - 1, -1, -1): for j in range(len(B) - 1, -1, -1): if A[i] == B[j]: memo[i][j] = memo[i + 1][j + 1] + 1 return max((max(row) for row in memo)) <|end_body_0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findLength1(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" <|body_0|> def findLength2(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> memo = [[0] *...
stack_v2_sparse_classes_36k_train_005859
1,451
no_license
[ { "docstring": ":type A: List[int] :type B: List[int] :rtype: int", "name": "findLength1", "signature": "def findLength1(self, A, B)" }, { "docstring": ":type A: List[int] :type B: List[int] :rtype: int", "name": "findLength2", "signature": "def findLength2(self, A, B)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLength1(self, A, B): :type A: List[int] :type B: List[int] :rtype: int - def findLength2(self, A, B): :type A: List[int] :type B: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLength1(self, A, B): :type A: List[int] :type B: List[int] :rtype: int - def findLength2(self, A, B): :type A: List[int] :type B: List[int] :rtype: int <|skeleton|> clas...
c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0
<|skeleton|> class Solution: def findLength1(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" <|body_0|> def findLength2(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findLength1(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" memo = [[0] * (len(B) + 1) for _ in range(len(A) + 1)] for i in range(len(A) - 1, -1, -1): for j in range(len(B) - 1, -1, -1): if A[i] == B[j]: ...
the_stack_v2_python_sparse
code/718#Maximum Length of Repeated Subarray.py
EachenKuang/LeetCode
train
28
2f45a2926a1de10138543b3f92eaa4de5e739534
[ "super().__init__(arg)\ndico_lock = arg['dico_lock']\nself.isSoft = dico_lock['isSoft']\nself.time_out = dico_lock['time_out']\nself.pathFile = arg['pathFile']\nself.pathFile_lock = self.pathFile + '.lock'\nif not self.exists():\n self.creation_file_demandes()\nreturn", "if self.isSoft:\n from filelock impo...
<|body_start_0|> super().__init__(arg) dico_lock = arg['dico_lock'] self.isSoft = dico_lock['isSoft'] self.time_out = dico_lock['time_out'] self.pathFile = arg['pathFile'] self.pathFile_lock = self.pathFile + '.lock' if not self.exists(): self.creation...
Gestion_echanges
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Gestion_echanges: def __init__(self, arg): """gestion des demandes par createur (avec lock) il y a plusieurs createur possibles createur = source de données {'createur' : {'demande_1' : {'parametres' : parametres, 'etat' : etat soit (open, running, close)} }""" <|body_0|> de...
stack_v2_sparse_classes_36k_train_005860
3,040
no_license
[ { "docstring": "gestion des demandes par createur (avec lock) il y a plusieurs createur possibles createur = source de données {'createur' : {'demande_1' : {'parametres' : parametres, 'etat' : etat soit (open, running, close)} }", "name": "__init__", "signature": "def __init__(self, arg)" }, { "...
2
null
Implement the Python class `Gestion_echanges` described below. Class description: Implement the Gestion_echanges class. Method signatures and docstrings: - def __init__(self, arg): gestion des demandes par createur (avec lock) il y a plusieurs createur possibles createur = source de données {'createur' : {'demande_1'...
Implement the Python class `Gestion_echanges` described below. Class description: Implement the Gestion_echanges class. Method signatures and docstrings: - def __init__(self, arg): gestion des demandes par createur (avec lock) il y a plusieurs createur possibles createur = source de données {'createur' : {'demande_1'...
2f48c5375163f3dbf5c547b9d3555922b5026302
<|skeleton|> class Gestion_echanges: def __init__(self, arg): """gestion des demandes par createur (avec lock) il y a plusieurs createur possibles createur = source de données {'createur' : {'demande_1' : {'parametres' : parametres, 'etat' : etat soit (open, running, close)} }""" <|body_0|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Gestion_echanges: def __init__(self, arg): """gestion des demandes par createur (avec lock) il y a plusieurs createur possibles createur = source de données {'createur' : {'demande_1' : {'parametres' : parametres, 'etat' : etat soit (open, running, close)} }""" super().__init__(arg) di...
the_stack_v2_python_sparse
outils/Gestion_echanges.py
Patrick1953/Behavior
train
0
29e147ff4575276c0762180c12ca9ea171c54e5d
[ "repeat = -1\nnums.sort()\nfor i in range(len(nums) - 1):\n if nums[i] == nums[i + 1]:\n return nums[i]\nreturn repeat", "repeat = -1\ntemp_set = set([])\nfor i in range(len(nums)):\n temp_set.add(nums[i])\n if len(temp_set) == i:\n return nums[i]\nreturn repeat" ]
<|body_start_0|> repeat = -1 nums.sort() for i in range(len(nums) - 1): if nums[i] == nums[i + 1]: return nums[i] return repeat <|end_body_0|> <|body_start_1|> repeat = -1 temp_set = set([]) for i in range(len(nums)): temp_...
在一个长度为 n 的数组 nums 里的所有数字都在 0~n-1 的范围内。数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。请找出数组中任意一个重复的数字。 示例 1: 输入: [2, 3, 1, 0, 2, 5, 3] 输出:2 或 3
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """在一个长度为 n 的数组 nums 里的所有数字都在 0~n-1 的范围内。数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。请找出数组中任意一个重复的数字。 示例 1: 输入: [2, 3, 1, 0, 2, 5, 3] 输出:2 或 3""" def findRepeatNumberBySort(self, nums: List[int]): """使用 list 的 sort 方法对数组进行排序,然后找出重复数字 Args: nums (List[int]): [description] Returns...
stack_v2_sparse_classes_36k_train_005861
1,750
no_license
[ { "docstring": "使用 list 的 sort 方法对数组进行排序,然后找出重复数字 Args: nums (List[int]): [description] Returns: repeat (int): 重复的数字 Examples: >>> Solution().findRepeatNumberBySort([2, 3, 1, 0, 2, 5, 3]) 2", "name": "findRepeatNumberBySort", "signature": "def findRepeatNumberBySort(self, nums: List[int])" }, { ...
2
null
Implement the Python class `Solution` described below. Class description: 在一个长度为 n 的数组 nums 里的所有数字都在 0~n-1 的范围内。数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。请找出数组中任意一个重复的数字。 示例 1: 输入: [2, 3, 1, 0, 2, 5, 3] 输出:2 或 3 Method signatures and docstrings: - def findRepeatNumberBySort(self, nums: List[int]): 使用 list 的 sort 方法对数组进行...
Implement the Python class `Solution` described below. Class description: 在一个长度为 n 的数组 nums 里的所有数字都在 0~n-1 的范围内。数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。请找出数组中任意一个重复的数字。 示例 1: 输入: [2, 3, 1, 0, 2, 5, 3] 输出:2 或 3 Method signatures and docstrings: - def findRepeatNumberBySort(self, nums: List[int]): 使用 list 的 sort 方法对数组进行...
8700150bad012c1a8e7a633852142da7f63b6362
<|skeleton|> class Solution: """在一个长度为 n 的数组 nums 里的所有数字都在 0~n-1 的范围内。数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。请找出数组中任意一个重复的数字。 示例 1: 输入: [2, 3, 1, 0, 2, 5, 3] 输出:2 或 3""" def findRepeatNumberBySort(self, nums: List[int]): """使用 list 的 sort 方法对数组进行排序,然后找出重复数字 Args: nums (List[int]): [description] Returns...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """在一个长度为 n 的数组 nums 里的所有数字都在 0~n-1 的范围内。数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。请找出数组中任意一个重复的数字。 示例 1: 输入: [2, 3, 1, 0, 2, 5, 3] 输出:2 或 3""" def findRepeatNumberBySort(self, nums: List[int]): """使用 list 的 sort 方法对数组进行排序,然后找出重复数字 Args: nums (List[int]): [description] Returns: repeat (int...
the_stack_v2_python_sparse
leecode/剑指offer/1_find_repeat_number.py
cogito0823/learningPython
train
1
483974fc72c45d1054c8c9804c31393dc197e523
[ "self.host = host\nself.port = port\nself.server = server\nself.node = node", "log_func.info(u'UniReader <%s>. Communication parameters:' % str(self))\nlog_func.info(u'\\tHost <%s>' % self.host)\nlog_func.info(u'\\tPort <%s>' % self.port)\nlog_func.info(u'\\tNode <%s>' % self.node)\nlog_func.info(u'\\tServer <%s>...
<|body_start_0|> self.host = host self.port = port self.server = server self.node = node <|end_body_0|> <|body_start_1|> log_func.info(u'UniReader <%s>. Communication parameters:' % str(self)) log_func.info(u'\tHost <%s>' % self.host) log_func.info(u'\tPort <%s>'...
Universal Remote Read Controller <UniReader Remote Service>.
iqUniReaderControllerProto
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iqUniReaderControllerProto: """Universal Remote Read Controller <UniReader Remote Service>.""" def __init__(self, host=None, port=DEFAULT_PORT, server=None, node=None, *args, **kwargs): """Constructor. :param host: Server host. :param port: Server port. Default 8080. :param server: S...
stack_v2_sparse_classes_36k_train_005862
5,228
no_license
[ { "docstring": "Constructor. :param host: Server host. :param port: Server port. Default 8080. :param server: Server name. :param node: Node name.", "name": "__init__", "signature": "def __init__(self, host=None, port=DEFAULT_PORT, server=None, node=None, *args, **kwargs)" }, { "docstring": "Dis...
5
stack_v2_sparse_classes_30k_train_007640
Implement the Python class `iqUniReaderControllerProto` described below. Class description: Universal Remote Read Controller <UniReader Remote Service>. Method signatures and docstrings: - def __init__(self, host=None, port=DEFAULT_PORT, server=None, node=None, *args, **kwargs): Constructor. :param host: Server host....
Implement the Python class `iqUniReaderControllerProto` described below. Class description: Universal Remote Read Controller <UniReader Remote Service>. Method signatures and docstrings: - def __init__(self, host=None, port=DEFAULT_PORT, server=None, node=None, *args, **kwargs): Constructor. :param host: Server host....
7550e242746cb2fb1219474463f8db21f8e3e114
<|skeleton|> class iqUniReaderControllerProto: """Universal Remote Read Controller <UniReader Remote Service>.""" def __init__(self, host=None, port=DEFAULT_PORT, server=None, node=None, *args, **kwargs): """Constructor. :param host: Server host. :param port: Server port. Default 8080. :param server: S...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class iqUniReaderControllerProto: """Universal Remote Read Controller <UniReader Remote Service>.""" def __init__(self, host=None, port=DEFAULT_PORT, server=None, node=None, *args, **kwargs): """Constructor. :param host: Server host. :param port: Server port. Default 8080. :param server: Server name. :...
the_stack_v2_python_sparse
iq/components/uni_reader/uni_reader_controller.py
XHermitOne/iq_framework
train
1
0f13ec81b0f7cae6bf16827b4a2ddb067c25fd27
[ "thresholds = thresholds[:]\nassert thresholds[0] > 0\nthresholds.insert(0, -float('inf'))\nthresholds.append(float('inf'))\nassert all((low <= high for low, high in zip(thresholds[:-1], thresholds[1:])))\nassert all((label in [-1, 0, 1] for label in labels))\nassert len(labels) == len(thresholds) - 1\nself.thresho...
<|body_start_0|> thresholds = thresholds[:] assert thresholds[0] > 0 thresholds.insert(0, -float('inf')) thresholds.append(float('inf')) assert all((low <= high for low, high in zip(thresholds[:-1], thresholds[1:]))) assert all((label in [-1, 0, 1] for label in labels)) ...
This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will have exactly zero or one matches; each ground-truth element may be matched to zero or more predicted elements. The matching is determined by the MxN match_quality_matrix, that characterizes how well each (gr...
Matcher
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Matcher: """This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will have exactly zero or one matches; each ground-truth element may be matched to zero or more predicted elements. The matching is determined by the MxN match_quality_matrix, t...
stack_v2_sparse_classes_36k_train_005863
14,720
permissive
[ { "docstring": "Args: thresholds (list): a list of thresholds used to stratify predictions into levels. labels (list): a list of values to label predictions belonging at each level. A label can be one of {-1, 0, 1} signifying {ignore, negative class, positive class}, respectively. allow_low_quality_matches (boo...
3
null
Implement the Python class `Matcher` described below. Class description: This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will have exactly zero or one matches; each ground-truth element may be matched to zero or more predicted elements. The matching is determ...
Implement the Python class `Matcher` described below. Class description: This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will have exactly zero or one matches; each ground-truth element may be matched to zero or more predicted elements. The matching is determ...
2deea5dc659371318c8a570c644201d913a83027
<|skeleton|> class Matcher: """This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will have exactly zero or one matches; each ground-truth element may be matched to zero or more predicted elements. The matching is determined by the MxN match_quality_matrix, t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Matcher: """This class assigns to each predicted "element" (e.g., a box) a ground-truth element. Each predicted element will have exactly zero or one matches; each ground-truth element may be matched to zero or more predicted elements. The matching is determined by the MxN match_quality_matrix, that character...
the_stack_v2_python_sparse
cvpods/modeling/matcher.py
Megvii-BaseDetection/cvpods
train
659
c2113be94bd6ef86abbc7380563b0a18cabd088f
[ "size = len(strs)\ndp = [[[0] * (n + 1) for _ in range(m + 1)] for _ in range(size + 1)]\nfor i in range(1, size + 1):\n zero = strs[i - 1].count('0')\n one = strs[i - 1].count('1')\n for j in range(m + 1):\n for k in range(n + 1):\n dp[i][j][k] = dp[i - 1][j][k]\n if j >= zero...
<|body_start_0|> size = len(strs) dp = [[[0] * (n + 1) for _ in range(m + 1)] for _ in range(size + 1)] for i in range(1, size + 1): zero = strs[i - 1].count('0') one = strs[i - 1].count('1') for j in range(m + 1): for k in range(n + 1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaxForm1(self, strs: List[str], m: int, n: int) -> int: """三维dp @param strs: @param m: @param n: @return:""" <|body_0|> def findMaxForm2(self, strs: List[str], m: int, n: int) -> int: """二维 @param strs: @param m: @param n: @return:""" <|body...
stack_v2_sparse_classes_36k_train_005864
2,788
no_license
[ { "docstring": "三维dp @param strs: @param m: @param n: @return:", "name": "findMaxForm1", "signature": "def findMaxForm1(self, strs: List[str], m: int, n: int) -> int" }, { "docstring": "二维 @param strs: @param m: @param n: @return:", "name": "findMaxForm2", "signature": "def findMaxForm2(...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxForm1(self, strs: List[str], m: int, n: int) -> int: 三维dp @param strs: @param m: @param n: @return: - def findMaxForm2(self, strs: List[str], m: int, n: int) -> int: 二...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxForm1(self, strs: List[str], m: int, n: int) -> int: 三维dp @param strs: @param m: @param n: @return: - def findMaxForm2(self, strs: List[str], m: int, n: int) -> int: 二...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def findMaxForm1(self, strs: List[str], m: int, n: int) -> int: """三维dp @param strs: @param m: @param n: @return:""" <|body_0|> def findMaxForm2(self, strs: List[str], m: int, n: int) -> int: """二维 @param strs: @param m: @param n: @return:""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMaxForm1(self, strs: List[str], m: int, n: int) -> int: """三维dp @param strs: @param m: @param n: @return:""" size = len(strs) dp = [[[0] * (n + 1) for _ in range(m + 1)] for _ in range(size + 1)] for i in range(1, size + 1): zero = strs[i - 1].coun...
the_stack_v2_python_sparse
LeetCode/动态规划法(dp)/背包问题/474. 一和零.py
yiming1012/MyLeetCode
train
2
89d491bc32c6373a9815374a9b2b2617420d07c5
[ "data = json.loads(request.body.decode())\nsku_id = data.get('sku_id')\ntry:\n SKU.objects.get(id=sku_id)\nexcept:\n return JsonResponse({'code': 400, 'errmsg': '没有此商品'})\nredis_cli = get_redis_connection('history')\nredis_cli.lrem(request.user.id, 0, sku_id)\nredis_cli.lpush(request.user.id, sku_id)\nredis_c...
<|body_start_0|> data = json.loads(request.body.decode()) sku_id = data.get('sku_id') try: SKU.objects.get(id=sku_id) except: return JsonResponse({'code': 400, 'errmsg': '没有此商品'}) redis_cli = get_redis_connection('history') redis_cli.lrem(request.u...
UserHistoryView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserHistoryView: def post(self, request): """0. 必须是登录用户 1. 接收请求 2. 提取参数 3. 验证参数 4. 连接redis 5. 去重数据 6. 添加数据 7. 最多保存5条记录 8. 返回响应 :param request: :return:""" <|body_0|> def get(self, request): """1. 必须是登录用户 2. 获取用户信息 3. 连接redis 4. 查询浏览记录 [1,2,3] 5. 遍历列表数据,查询商品详细信息 6. 将对...
stack_v2_sparse_classes_36k_train_005865
12,869
no_license
[ { "docstring": "0. 必须是登录用户 1. 接收请求 2. 提取参数 3. 验证参数 4. 连接redis 5. 去重数据 6. 添加数据 7. 最多保存5条记录 8. 返回响应 :param request: :return:", "name": "post", "signature": "def post(self, request)" }, { "docstring": "1. 必须是登录用户 2. 获取用户信息 3. 连接redis 4. 查询浏览记录 [1,2,3] 5. 遍历列表数据,查询商品详细信息 6. 将对象转换为字典数据 7. 返回响应 :param...
2
stack_v2_sparse_classes_30k_train_016807
Implement the Python class `UserHistoryView` described below. Class description: Implement the UserHistoryView class. Method signatures and docstrings: - def post(self, request): 0. 必须是登录用户 1. 接收请求 2. 提取参数 3. 验证参数 4. 连接redis 5. 去重数据 6. 添加数据 7. 最多保存5条记录 8. 返回响应 :param request: :return: - def get(self, request): 1. 必须是...
Implement the Python class `UserHistoryView` described below. Class description: Implement the UserHistoryView class. Method signatures and docstrings: - def post(self, request): 0. 必须是登录用户 1. 接收请求 2. 提取参数 3. 验证参数 4. 连接redis 5. 去重数据 6. 添加数据 7. 最多保存5条记录 8. 返回响应 :param request: :return: - def get(self, request): 1. 必须是...
18e1e64c6b0cd67f8e71609f8ef58d6d296e2ccc
<|skeleton|> class UserHistoryView: def post(self, request): """0. 必须是登录用户 1. 接收请求 2. 提取参数 3. 验证参数 4. 连接redis 5. 去重数据 6. 添加数据 7. 最多保存5条记录 8. 返回响应 :param request: :return:""" <|body_0|> def get(self, request): """1. 必须是登录用户 2. 获取用户信息 3. 连接redis 4. 查询浏览记录 [1,2,3] 5. 遍历列表数据,查询商品详细信息 6. 将对...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserHistoryView: def post(self, request): """0. 必须是登录用户 1. 接收请求 2. 提取参数 3. 验证参数 4. 连接redis 5. 去重数据 6. 添加数据 7. 最多保存5条记录 8. 返回响应 :param request: :return:""" data = json.loads(request.body.decode()) sku_id = data.get('sku_id') try: SKU.objects.get(id=sku_id) ex...
the_stack_v2_python_sparse
day12/MeiDuo_mall/apps/users/views.py
Harder-Man/work_first
train
0
ebe820e34f06f7e9a9fa125609793756d770b1cb
[ "args = image_all.parse_args()\nsize = args['size']\npage = args['page']\ncategory = args['category']\npath = os.path.join(Config.CONTENT_DIRECTORY, category)\nif not os.path.exists(path):\n content_ids = []\nelse:\n content_ids = [p for p in os.listdir(path) if os.path.isfile(os.path.join(path, p))]\ntotal =...
<|body_start_0|> args = image_all.parse_args() size = args['size'] page = args['page'] category = args['category'] path = os.path.join(Config.CONTENT_DIRECTORY, category) if not os.path.exists(path): content_ids = [] else: content_ids = [p ...
Contents
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Contents: def get(self): """Returns pageable content image""" <|body_0|> def post(self): """Creates an image""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = image_all.parse_args() size = args['size'] page = args['page'] ...
stack_v2_sparse_classes_36k_train_005866
4,604
permissive
[ { "docstring": "Returns pageable content image", "name": "get", "signature": "def get(self)" }, { "docstring": "Creates an image", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_012646
Implement the Python class `Contents` described below. Class description: Implement the Contents class. Method signatures and docstrings: - def get(self): Returns pageable content image - def post(self): Creates an image
Implement the Python class `Contents` described below. Class description: Implement the Contents class. Method signatures and docstrings: - def get(self): Returns pageable content image - def post(self): Creates an image <|skeleton|> class Contents: def get(self): """Returns pageable content image""" ...
f3da89887420b4a3907e15f266442048029d36b4
<|skeleton|> class Contents: def get(self): """Returns pageable content image""" <|body_0|> def post(self): """Creates an image""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Contents: def get(self): """Returns pageable content image""" args = image_all.parse_args() size = args['size'] page = args['page'] category = args['category'] path = os.path.join(Config.CONTENT_DIRECTORY, category) if not os.path.exists(path): ...
the_stack_v2_python_sparse
api/contents.py
LuletterSoul/sast_backend
train
0
9984b8b92f7863e26773f39df7e4fd4f942e2fb7
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn CustomTaskExtensionCallbackData()", "from ..custom_extension_data import CustomExtensionData\nfrom .custom_task_extension_operation_status import CustomTaskExtensionOperationStatus\nfrom ..custom_extension_data import CustomExtensionDa...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return CustomTaskExtensionCallbackData() <|end_body_0|> <|body_start_1|> from ..custom_extension_data import CustomExtensionData from .custom_task_extension_operation_status import CustomTaskEx...
CustomTaskExtensionCallbackData
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomTaskExtensionCallbackData: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CustomTaskExtensionCallbackData: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator...
stack_v2_sparse_classes_36k_train_005867
2,751
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: CustomTaskExtensionCallbackData", "name": "create_from_discriminator_value", "signature": "def create_from_d...
3
null
Implement the Python class `CustomTaskExtensionCallbackData` described below. Class description: Implement the CustomTaskExtensionCallbackData class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CustomTaskExtensionCallbackData: Creates a new instance...
Implement the Python class `CustomTaskExtensionCallbackData` described below. Class description: Implement the CustomTaskExtensionCallbackData class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CustomTaskExtensionCallbackData: Creates a new instance...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class CustomTaskExtensionCallbackData: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CustomTaskExtensionCallbackData: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomTaskExtensionCallbackData: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CustomTaskExtensionCallbackData: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and cre...
the_stack_v2_python_sparse
msgraph/generated/models/identity_governance/custom_task_extension_callback_data.py
microsoftgraph/msgraph-sdk-python
train
135
51568a7b64c68d881b2f996f67197c8c127f8789
[ "self.rank = rank\nself.ls_solve = ls_solve\nself.n_iter_max = n_iter_max\nself.tol = tol\nself.random_state = random_state\nself.verbose = verbose\nself.callback = callback", "tr_decomp = tensor_ring_als(tensor, rank=self.rank, ls_solve=self.ls_solve, n_iter_max=self.n_iter_max, tol=self.tol, random_state=self.r...
<|body_start_0|> self.rank = rank self.ls_solve = ls_solve self.n_iter_max = n_iter_max self.tol = tol self.random_state = random_state self.verbose = verbose self.callback = callback <|end_body_0|> <|body_start_1|> tr_decomp = tensor_ring_als(tensor, ran...
A class wrapper for the tensor_ring_als function Attributes ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th core will be of size rank[i]-by-shape[i]-by-rank[i+1], where shape[i] is the dim...
TensorRingALS
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TensorRingALS: """A class wrapper for the tensor_ring_als function Attributes ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th core will be of size rank[i]-by-shape[i...
stack_v2_sparse_classes_36k_train_005868
16,136
permissive
[ { "docstring": "Parameters ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th core will be of size rank[i]-by-shape[i]-by-rank[i+1], where shape[i] is the dimension of the i-th mode o...
2
stack_v2_sparse_classes_30k_train_020183
Implement the Python class `TensorRingALS` described below. Class description: A class wrapper for the tensor_ring_als function Attributes ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th ...
Implement the Python class `TensorRingALS` described below. Class description: A class wrapper for the tensor_ring_als function Attributes ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th ...
de05e178850eb2abe43ec1a40f80624ca606807d
<|skeleton|> class TensorRingALS: """A class wrapper for the tensor_ring_als function Attributes ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th core will be of size rank[i]-by-shape[i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TensorRingALS: """A class wrapper for the tensor_ring_als function Attributes ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th core will be of size rank[i]-by-shape[i]-by-rank[i+1...
the_stack_v2_python_sparse
tensorly/decomposition/_tr.py
tensorly/tensorly
train
1,533
626a0df7be36587dd3ff4ba78ec3ef0915a117ee
[ "user = self.model(username=username, auth_groups=[], auth_roles=[], email=self.normalize_email(email))\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(username=username, email=self.normalize_email(email))\nuser.is_superuser = True\nuser.auth_groups = []\nuser.auth_...
<|body_start_0|> user = self.model(username=username, auth_groups=[], auth_roles=[], email=self.normalize_email(email)) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user = self.create_user(username=username, email=self.normali...
MyUserManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, username, email, password): """Creates and saves a superuser with the given em...
stack_v2_sparse_classes_36k_train_005869
2,419
permissive
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, username, email, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", "name"...
2
stack_v2_sparse_classes_30k_train_019515
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, username, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, username,...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, username, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, username,...
52831b2de2e0ce734d567289f3b10d720bce8a9e
<|skeleton|> class MyUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, username, email, password): """Creates and saves a superuser with the given em...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" user = self.model(username=username, auth_groups=[], auth_roles=[], email=self.normalize_email(email)) user.set_password(password) ...
the_stack_v2_python_sparse
coordinator/models.py
kids-first/kf-api-release-coordinator
train
2
c4b62a7cf173fcee71f64486d6236b8bd1d14a52
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
UserAppServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserAppServiceServicer: """Missing associated documentation comment in .proto file.""" def user_by_email(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def user_by_id(self, request, context): """Missing associat...
stack_v2_sparse_classes_36k_train_005870
9,918
no_license
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "user_by_email", "signature": "def user_by_email(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "user_by_id", "signature": "def user_by_id(se...
5
null
Implement the Python class `UserAppServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def user_by_email(self, request, context): Missing associated documentation comment in .proto file. - def user_by_id(self, request, conte...
Implement the Python class `UserAppServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def user_by_email(self, request, context): Missing associated documentation comment in .proto file. - def user_by_id(self, request, conte...
55d36c068e26e13ee5bae5c033e2e17784c63feb
<|skeleton|> class UserAppServiceServicer: """Missing associated documentation comment in .proto file.""" def user_by_email(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def user_by_id(self, request, context): """Missing associat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserAppServiceServicer: """Missing associated documentation comment in .proto file.""" def user_by_email(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemen...
the_stack_v2_python_sparse
src/resource/proto/_generated/project/user_app_service_pb2_grpc.py
arkanmgerges/cafm.identity
train
0
ef27b7d49f4c8b5b914221dd043914159b7dbd79
[ "if root is None:\n return ''\noutput = []\n\ndef helper(node):\n if node is None:\n output.append('')\n else:\n output.append(str(node.val))\n helper(node.left)\n helper(node.right)\nhelper(root)\nreturn ','.join(output)", "if data == '':\n return None\nnodes = data.split(...
<|body_start_0|> if root is None: return '' output = [] def helper(node): if node is None: output.append('') else: output.append(str(node.val)) helper(node.left) helper(node.right) helper...
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_005871
4,194
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:...
1abc28919abb55b93d3879860ac9c1297d493d09
<|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 root is None: return '' output = [] def helper(node): if node is None: output.append('') else: out...
the_stack_v2_python_sparse
lc/297.SerializeAndDeserializeBinary.py
akimi-yano/algorithm-practice
train
0
5bfd5ea68a392ea288c50b1a96aa9184602df183
[ "try:\n params = request._serialize()\n headers = request.headers\n body = self.call('BindAutoScalingGroup', params, headers=headers)\n response = json.loads(body)\n model = models.BindAutoScalingGroupResponse()\n model._deserialize(response['Response'])\n return model\nexcept Exception as e:\n...
<|body_start_0|> try: params = request._serialize() headers = request.headers body = self.call('BindAutoScalingGroup', params, headers=headers) response = json.loads(body) model = models.BindAutoScalingGroupResponse() model._deserialize(res...
ThpcClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThpcClient: def BindAutoScalingGroup(self, request): """本接口(BindAutoScalingGroup)用于为集群队列绑定弹性伸缩组 :param request: Request instance for BindAutoScalingGroup. :type request: :class:`tencentcloud.thpc.v20211109.models.BindAutoScalingGroupRequest` :rtype: :class:`tencentcloud.thpc.v20211109.mo...
stack_v2_sparse_classes_36k_train_005872
4,628
permissive
[ { "docstring": "本接口(BindAutoScalingGroup)用于为集群队列绑定弹性伸缩组 :param request: Request instance for BindAutoScalingGroup. :type request: :class:`tencentcloud.thpc.v20211109.models.BindAutoScalingGroupRequest` :rtype: :class:`tencentcloud.thpc.v20211109.models.BindAutoScalingGroupResponse`", "name": "BindAutoScalin...
4
null
Implement the Python class `ThpcClient` described below. Class description: Implement the ThpcClient class. Method signatures and docstrings: - def BindAutoScalingGroup(self, request): 本接口(BindAutoScalingGroup)用于为集群队列绑定弹性伸缩组 :param request: Request instance for BindAutoScalingGroup. :type request: :class:`tencentclou...
Implement the Python class `ThpcClient` described below. Class description: Implement the ThpcClient class. Method signatures and docstrings: - def BindAutoScalingGroup(self, request): 本接口(BindAutoScalingGroup)用于为集群队列绑定弹性伸缩组 :param request: Request instance for BindAutoScalingGroup. :type request: :class:`tencentclou...
6baf00a5a56ba58b6a1123423e0a1422d17a0201
<|skeleton|> class ThpcClient: def BindAutoScalingGroup(self, request): """本接口(BindAutoScalingGroup)用于为集群队列绑定弹性伸缩组 :param request: Request instance for BindAutoScalingGroup. :type request: :class:`tencentcloud.thpc.v20211109.models.BindAutoScalingGroupRequest` :rtype: :class:`tencentcloud.thpc.v20211109.mo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThpcClient: def BindAutoScalingGroup(self, request): """本接口(BindAutoScalingGroup)用于为集群队列绑定弹性伸缩组 :param request: Request instance for BindAutoScalingGroup. :type request: :class:`tencentcloud.thpc.v20211109.models.BindAutoScalingGroupRequest` :rtype: :class:`tencentcloud.thpc.v20211109.models.BindAutoS...
the_stack_v2_python_sparse
tencentcloud/thpc/v20211109/thpc_client.py
TencentCloud/tencentcloud-sdk-python
train
594
f1a89d5c246a0afb97410897c8cd8c574eeb1d02
[ "self.type = sensor_type\nself.serial = serial\nself.mgr = mgr\nself._attr_name = f'{mgr.name(serial)} {SENSOR_TYPES[sensor_type]}'\nself._attr_native_unit_of_measurement = UnitOfTemperature.FAHRENHEIT\nself._attr_unique_id = f'{serial}-{sensor_type}'\nself._attr_device_class = SensorDeviceClass.TEMPERATURE\nself.u...
<|body_start_0|> self.type = sensor_type self.serial = serial self.mgr = mgr self._attr_name = f'{mgr.name(serial)} {SENSOR_TYPES[sensor_type]}' self._attr_native_unit_of_measurement = UnitOfTemperature.FAHRENHEIT self._attr_unique_id = f'{serial}-{sensor_type}' s...
Implementation of a thermoworks smoke sensor.
ThermoworksSmokeSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThermoworksSmokeSensor: """Implementation of a thermoworks smoke sensor.""" def __init__(self, sensor_type, serial, mgr): """Initialize the sensor.""" <|body_0|> def update_unit(self): """Set the units from the data.""" <|body_1|> def update(self) ->...
stack_v2_sparse_classes_36k_train_005873
5,552
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, sensor_type, serial, mgr)" }, { "docstring": "Set the units from the data.", "name": "update_unit", "signature": "def update_unit(self)" }, { "docstring": "Get the monitored data from fi...
3
stack_v2_sparse_classes_30k_train_013827
Implement the Python class `ThermoworksSmokeSensor` described below. Class description: Implementation of a thermoworks smoke sensor. Method signatures and docstrings: - def __init__(self, sensor_type, serial, mgr): Initialize the sensor. - def update_unit(self): Set the units from the data. - def update(self) -> Non...
Implement the Python class `ThermoworksSmokeSensor` described below. Class description: Implementation of a thermoworks smoke sensor. Method signatures and docstrings: - def __init__(self, sensor_type, serial, mgr): Initialize the sensor. - def update_unit(self): Set the units from the data. - def update(self) -> Non...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ThermoworksSmokeSensor: """Implementation of a thermoworks smoke sensor.""" def __init__(self, sensor_type, serial, mgr): """Initialize the sensor.""" <|body_0|> def update_unit(self): """Set the units from the data.""" <|body_1|> def update(self) ->...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThermoworksSmokeSensor: """Implementation of a thermoworks smoke sensor.""" def __init__(self, sensor_type, serial, mgr): """Initialize the sensor.""" self.type = sensor_type self.serial = serial self.mgr = mgr self._attr_name = f'{mgr.name(serial)} {SENSOR_TYPES[s...
the_stack_v2_python_sparse
homeassistant/components/thermoworks_smoke/sensor.py
home-assistant/core
train
35,501
e70daf7dbb037bd71d8f8aa4bb4ab6b239ee09de
[ "self.value_list = w\nfor i in range(1, len(w)):\n self.value_list[i] += self.value_list[i - 1]", "temp_value = 0\nlow = 0\nhigh = len(self.value_list)\ntarget_value = random.randint(1, self.value_list[-1])\nwhile low < high:\n mid = (low + high) // 2\n if self.value_list[mid] < target_value:\n lo...
<|body_start_0|> self.value_list = w for i in range(1, len(w)): self.value_list[i] += self.value_list[i - 1] <|end_body_0|> <|body_start_1|> temp_value = 0 low = 0 high = len(self.value_list) target_value = random.randint(1, self.value_list[-1]) while...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.value_list = w for i in range(1, len(w)): self.value_list[i] += self.va...
stack_v2_sparse_classes_36k_train_005874
880
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
stack_v2_sparse_classes_30k_train_001243
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
dc45210cb2cc50bfefd8c21c865e6ee2163a022a
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" self.value_list = w for i in range(1, len(w)): self.value_list[i] += self.value_list[i - 1] def pickIndex(self): """:rtype: int""" temp_value = 0 low = 0 high = len(self.value_lis...
the_stack_v2_python_sparse
practice/solution/0528_random_pick_with_weight.py
kesarb/leetcode-summary-python
train
0
57d812e400e23c1ec10cd676cb4a83b25eb01b36
[ "cur = 0\nmissing = 0\nfor n in arr:\n missing += n - cur - 1\n cur = n\n if missing >= k:\n return cur - 1 - (missing - k)\nreturn cur + (k - missing)", "l, r = (0, len(arr) - 1)\nwhile l <= r:\n m = l + (r - l) // 2\n if arr[m] - 1 - m < k:\n l = m + 1\n else:\n r = m - 1\...
<|body_start_0|> cur = 0 missing = 0 for n in arr: missing += n - cur - 1 cur = n if missing >= k: return cur - 1 - (missing - k) return cur + (k - missing) <|end_body_0|> <|body_start_1|> l, r = (0, len(arr) - 1) while...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findKthPositive(self, arr: List[int], k: int) -> int: """Apr 04, 2023 23:35""" <|body_0|> def findKthPositive(self, arr: List[int], k: int) -> int: """Apr 04, 2023 23:54""" <|body_1|> <|end_skeleton|> <|body_start_0|> cur = 0 m...
stack_v2_sparse_classes_36k_train_005875
1,856
no_license
[ { "docstring": "Apr 04, 2023 23:35", "name": "findKthPositive", "signature": "def findKthPositive(self, arr: List[int], k: int) -> int" }, { "docstring": "Apr 04, 2023 23:54", "name": "findKthPositive", "signature": "def findKthPositive(self, arr: List[int], k: int) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findKthPositive(self, arr: List[int], k: int) -> int: Apr 04, 2023 23:35 - def findKthPositive(self, arr: List[int], k: int) -> int: Apr 04, 2023 23:54
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findKthPositive(self, arr: List[int], k: int) -> int: Apr 04, 2023 23:35 - def findKthPositive(self, arr: List[int], k: int) -> int: Apr 04, 2023 23:54 <|skeleton|> class So...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def findKthPositive(self, arr: List[int], k: int) -> int: """Apr 04, 2023 23:35""" <|body_0|> def findKthPositive(self, arr: List[int], k: int) -> int: """Apr 04, 2023 23:54""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findKthPositive(self, arr: List[int], k: int) -> int: """Apr 04, 2023 23:35""" cur = 0 missing = 0 for n in arr: missing += n - cur - 1 cur = n if missing >= k: return cur - 1 - (missing - k) return cur +...
the_stack_v2_python_sparse
leetcode/solved/1646_Kth_Missing_Positive_Number/solution.py
sungminoh/algorithms
train
0
b1ea70dfbe6f67fec1ab3b206d3a27382240a39f
[ "if not isinstance(data, np.ndarray) or len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nif data.shape[1] < 2:\n raise ValueError('data must contain multiple data points')\nd = data.shape[0]\nn = data.shape[1]\nself.mean = np.mean(data, axis=1).reshape(d, 1)\ncov = data - self.mean\...
<|body_start_0|> if not isinstance(data, np.ndarray) or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') if data.shape[1] < 2: raise ValueError('data must contain multiple data points') d = data.shape[0] n = data.shape[1] self.mean ...
Multivariate Normal distribution
MultiNormal
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiNormal: """Multivariate Normal distribution""" def __init__(self, data): """Constructor method data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point If data is not a 2D numpy.ndarray, rais...
stack_v2_sparse_classes_36k_train_005876
2,056
permissive
[ { "docstring": "Constructor method data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point If data is not a 2D numpy.ndarray, raise a TypeError with the message data must be a 2D numpy.ndarray If n is less than 2, raise a V...
2
stack_v2_sparse_classes_30k_train_002043
Implement the Python class `MultiNormal` described below. Class description: Multivariate Normal distribution Method signatures and docstrings: - def __init__(self, data): Constructor method data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions i...
Implement the Python class `MultiNormal` described below. Class description: Multivariate Normal distribution Method signatures and docstrings: - def __init__(self, data): Constructor method data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions i...
8e4894c2b036ec7f4750de5bf99b95aee5b94449
<|skeleton|> class MultiNormal: """Multivariate Normal distribution""" def __init__(self, data): """Constructor method data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point If data is not a 2D numpy.ndarray, rais...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiNormal: """Multivariate Normal distribution""" def __init__(self, data): """Constructor method data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point If data is not a 2D numpy.ndarray, raise a TypeError...
the_stack_v2_python_sparse
math/0x06-multivariate_prob/multinormal.py
kyeeh/holbertonschool-machine_learning
train
0
fe6d20577afbeba3494f620e4c3e8891cbf6d522
[ "self.p = deepcopy(profile)\nself.mfcc_stage = AudioFeaturesSeqPipelineStage(profile)\nself.rnn_stage = RnnSeqPipelineStage(profile, core, model, device=device)\nself.ctc_stage = CtcDecoderSeqPipelineStage(profile, lm=lm, beam_width=beam_width, max_candidates=max_candidates, online=online_decoding)", "if audio is...
<|body_start_0|> self.p = deepcopy(profile) self.mfcc_stage = AudioFeaturesSeqPipelineStage(profile) self.rnn_stage = RnnSeqPipelineStage(profile, core, model, device=device) self.ctc_stage = CtcDecoderSeqPipelineStage(profile, lm=lm, beam_width=beam_width, max_candidates=max_candidates,...
DeepSpeechSeqPipeline
[ "Apache-2.0", "MPL-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepSpeechSeqPipeline: def __init__(self, profile, core, model, lm=None, beam_width=500, max_candidates=None, device='CPU', online_decoding=False): """Args: profile (dict), a dict with pre/post-processing parameters, see profiles.py core (Core or None), Core object for model loading/comp...
stack_v2_sparse_classes_36k_train_005877
2,737
permissive
[ { "docstring": "Args: profile (dict), a dict with pre/post-processing parameters, see profiles.py core (Core or None), Core object for model loading/compilation/inference model (str), filename of IR .xml model file lm (str), filename of LM (language model) beam_width (int), the number of prefix candidates to re...
2
null
Implement the Python class `DeepSpeechSeqPipeline` described below. Class description: Implement the DeepSpeechSeqPipeline class. Method signatures and docstrings: - def __init__(self, profile, core, model, lm=None, beam_width=500, max_candidates=None, device='CPU', online_decoding=False): Args: profile (dict), a dic...
Implement the Python class `DeepSpeechSeqPipeline` described below. Class description: Implement the DeepSpeechSeqPipeline class. Method signatures and docstrings: - def __init__(self, profile, core, model, lm=None, beam_width=500, max_candidates=None, device='CPU', online_decoding=False): Args: profile (dict), a dic...
7929adbe91e9cfe8dc5dc1daad5ae7392f9719a0
<|skeleton|> class DeepSpeechSeqPipeline: def __init__(self, profile, core, model, lm=None, beam_width=500, max_candidates=None, device='CPU', online_decoding=False): """Args: profile (dict), a dict with pre/post-processing parameters, see profiles.py core (Core or None), Core object for model loading/comp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeepSpeechSeqPipeline: def __init__(self, profile, core, model, lm=None, beam_width=500, max_candidates=None, device='CPU', online_decoding=False): """Args: profile (dict), a dict with pre/post-processing parameters, see profiles.py core (Core or None), Core object for model loading/compilation/infere...
the_stack_v2_python_sparse
demos/speech_recognition_deepspeech_demo/python/asr_utils/deep_speech_seq_pipeline.py
openvinotoolkit/open_model_zoo
train
1,712
0639d7360af6c05cc10d65b4ccec3193aa26f183
[ "self.bars = bars\nself.symbol_list = self.bars.symbol_list\nself.events = events\nself.portfolio = port", "bought = {}\nfree_cash = self.portfolio.current_holdings['cash']\nfor s in self.symbol_list:\n bought[s] = False\n bars = self.bars.get_latest_bars(s, N=1)\n cost = bars[0][5] * self.portfolio.buy_...
<|body_start_0|> self.bars = bars self.symbol_list = self.bars.symbol_list self.events = events self.portfolio = port <|end_body_0|> <|body_start_1|> bought = {} free_cash = self.portfolio.current_holdings['cash'] for s in self.symbol_list: bought[s] ...
Крайне простая стратегия, которая входит в длинную позициию при полуении бара и никогда из нее не выходит. Используется в качестве механизма тестирования класса Strategy и бенчмарка для сравнения разных стратегий.
BuyAndHoldStrategy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuyAndHoldStrategy: """Крайне простая стратегия, которая входит в длинную позициию при полуении бара и никогда из нее не выходит. Используется в качестве механизма тестирования класса Strategy и бенчмарка для сравнения разных стратегий.""" def __init__(self, bars, events, port): """И...
stack_v2_sparse_classes_36k_train_005878
4,426
no_license
[ { "docstring": "Инициализирует стратегию buy and hold. Параметры: bars - Объект DataHandler, который предоставляет информацию о барах events - Объект очереди событий.", "name": "__init__", "signature": "def __init__(self, bars, events, port)" }, { "docstring": "Функия возвращает словарь, разреща...
3
stack_v2_sparse_classes_30k_train_018716
Implement the Python class `BuyAndHoldStrategy` described below. Class description: Крайне простая стратегия, которая входит в длинную позициию при полуении бара и никогда из нее не выходит. Используется в качестве механизма тестирования класса Strategy и бенчмарка для сравнения разных стратегий. Method signatures an...
Implement the Python class `BuyAndHoldStrategy` described below. Class description: Крайне простая стратегия, которая входит в длинную позициию при полуении бара и никогда из нее не выходит. Используется в качестве механизма тестирования класса Strategy и бенчмарка для сравнения разных стратегий. Method signatures an...
68c2534faf53cca7f3b1b258c72b3e15c23f810e
<|skeleton|> class BuyAndHoldStrategy: """Крайне простая стратегия, которая входит в длинную позициию при полуении бара и никогда из нее не выходит. Используется в качестве механизма тестирования класса Strategy и бенчмарка для сравнения разных стратегий.""" def __init__(self, bars, events, port): """И...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BuyAndHoldStrategy: """Крайне простая стратегия, которая входит в длинную позициию при полуении бара и никогда из нее не выходит. Используется в качестве механизма тестирования класса Strategy и бенчмарка для сравнения разных стратегий.""" def __init__(self, bars, events, port): """Инициализирует...
the_stack_v2_python_sparse
project_file/strategy.py
SchamanGrin/Portfolio_backtest_v_1
train
0
079621294e5bde7acb17340e79709101eba1e7b1
[ "if not s or len(s) == 0:\n return True\nif len(s) % 2 == 1:\n return False\nt = []\nfor c in s:\n if c == '{' or c == '[' or c == '(':\n t.append(c)\n elif c == ']':\n last = t.pop() if t else '#'\n if last != '[':\n return False\n elif c == '}':\n last = t.pop...
<|body_start_0|> if not s or len(s) == 0: return True if len(s) % 2 == 1: return False t = [] for c in s: if c == '{' or c == '[' or c == '(': t.append(c) elif c == ']': last = t.pop() if t else '#' ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def is_valid(self, s): """:type s: str :rtype: bool""" <|body_0|> def isVaild_1(self, s): """使用中间变量""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not s or len(s) == 0: return True if len(s) % 2 == 1: re...
stack_v2_sparse_classes_36k_train_005879
1,363
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "is_valid", "signature": "def is_valid(self, s)" }, { "docstring": "使用中间变量", "name": "isVaild_1", "signature": "def isVaild_1(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_014624
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_valid(self, s): :type s: str :rtype: bool - def isVaild_1(self, s): 使用中间变量
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_valid(self, s): :type s: str :rtype: bool - def isVaild_1(self, s): 使用中间变量 <|skeleton|> class Solution: def is_valid(self, s): """:type s: str :rtype: bool""...
e69d7d892762968fc8442d75ec4535d90f731b52
<|skeleton|> class Solution: def is_valid(self, s): """:type s: str :rtype: bool""" <|body_0|> def isVaild_1(self, s): """使用中间变量""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def is_valid(self, s): """:type s: str :rtype: bool""" if not s or len(s) == 0: return True if len(s) % 2 == 1: return False t = [] for c in s: if c == '{' or c == '[' or c == '(': t.append(c) eli...
the_stack_v2_python_sparse
Stack/20valid_parentheses.py
xujackie1993/TheAlgorithms
train
0
10a2e03965397bb9d9cee9f675f7b95e49ece52e
[ "self.max_frames = max_frames\nself.sink = sink\nself.pipelines = pipelines\nself.name = name\nself.count = 0\nself.payload = b''", "self.count += 1\nself.payload += data\ndebug('BufferedPipe count: {}, max frames: {}'.format(self.count, self.max_frames))\nif self.count == self.max_frames:\n debug('BufferedPip...
<|body_start_0|> self.max_frames = max_frames self.sink = sink self.pipelines = pipelines self.name = name self.count = 0 self.payload = b'' <|end_body_0|> <|body_start_1|> self.count += 1 self.payload += data debug('BufferedPipe count: {}, max fr...
BufferedPipe
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BufferedPipe: def __init__(self, max_frames: int, sink, pipelines: list, name: str=None): """Create a buffer which will call the provided `sink` when full. It will call `sink` with the number of frames and the accumulated bytes when it reaches `max_buffer_size` frames. pass list of `pipe...
stack_v2_sparse_classes_36k_train_005880
1,348
no_license
[ { "docstring": "Create a buffer which will call the provided `sink` when full. It will call `sink` with the number of frames and the accumulated bytes when it reaches `max_buffer_size` frames. pass list of `pipelines` as arg to process this buffer using specified pipelines only (not all pipelines)", "name":...
3
stack_v2_sparse_classes_30k_train_017725
Implement the Python class `BufferedPipe` described below. Class description: Implement the BufferedPipe class. Method signatures and docstrings: - def __init__(self, max_frames: int, sink, pipelines: list, name: str=None): Create a buffer which will call the provided `sink` when full. It will call `sink` with the nu...
Implement the Python class `BufferedPipe` described below. Class description: Implement the BufferedPipe class. Method signatures and docstrings: - def __init__(self, max_frames: int, sink, pipelines: list, name: str=None): Create a buffer which will call the provided `sink` when full. It will call `sink` with the nu...
bc81942cf8fea5e4cb127117f9e76577910c1a3d
<|skeleton|> class BufferedPipe: def __init__(self, max_frames: int, sink, pipelines: list, name: str=None): """Create a buffer which will call the provided `sink` when full. It will call `sink` with the number of frames and the accumulated bytes when it reaches `max_buffer_size` frames. pass list of `pipe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BufferedPipe: def __init__(self, max_frames: int, sink, pipelines: list, name: str=None): """Create a buffer which will call the provided `sink` when full. It will call `sink` with the number of frames and the accumulated bytes when it reaches `max_buffer_size` frames. pass list of `pipelines` as arg ...
the_stack_v2_python_sparse
lib/BufferedPipe.py
wzulfikar/py-phonic
train
0
7cdb3390de64e3db3778ce858c1bdce17cf92b4c
[ "super().__init__()\ninitialize(self, init_type)\nself.in_channels = in_channels\nnoise_upsample = []\nin_chs = in_channels\nfor noise_upsample_scale in noise_upsample_scales:\n noise_upsample.append(nn.Conv1DTranspose(in_chs, channels, noise_upsample_scale * 2, stride=noise_upsample_scale, padding=noise_upsampl...
<|body_start_0|> super().__init__() initialize(self, init_type) self.in_channels = in_channels noise_upsample = [] in_chs = in_channels for noise_upsample_scale in noise_upsample_scales: noise_upsample.append(nn.Conv1DTranspose(in_chs, channels, noise_upsample...
Style MelGAN generator module.
StyleMelGANGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StyleMelGANGenerator: """Style MelGAN generator module.""" def __init__(self, in_channels: int=128, aux_channels: int=80, channels: int=64, out_channels: int=1, kernel_size: int=9, dilation: int=2, bias: bool=True, noise_upsample_scales: List[int]=[11, 2, 2, 2], noise_upsample_activation: st...
stack_v2_sparse_classes_36k_train_005881
14,249
permissive
[ { "docstring": "Initilize Style MelGAN generator. Args: in_channels (int): Number of input noise channels. aux_channels (int): Number of auxiliary input channels. channels (int): Number of channels for conv layer. out_channels (int): Number of output channels. kernel_size (int): Kernel size of conv layers. dila...
6
null
Implement the Python class `StyleMelGANGenerator` described below. Class description: Style MelGAN generator module. Method signatures and docstrings: - def __init__(self, in_channels: int=128, aux_channels: int=80, channels: int=64, out_channels: int=1, kernel_size: int=9, dilation: int=2, bias: bool=True, noise_ups...
Implement the Python class `StyleMelGANGenerator` described below. Class description: Style MelGAN generator module. Method signatures and docstrings: - def __init__(self, in_channels: int=128, aux_channels: int=80, channels: int=64, out_channels: int=1, kernel_size: int=9, dilation: int=2, bias: bool=True, noise_ups...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class StyleMelGANGenerator: """Style MelGAN generator module.""" def __init__(self, in_channels: int=128, aux_channels: int=80, channels: int=64, out_channels: int=1, kernel_size: int=9, dilation: int=2, bias: bool=True, noise_upsample_scales: List[int]=[11, 2, 2, 2], noise_upsample_activation: st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StyleMelGANGenerator: """Style MelGAN generator module.""" def __init__(self, in_channels: int=128, aux_channels: int=80, channels: int=64, out_channels: int=1, kernel_size: int=9, dilation: int=2, bias: bool=True, noise_upsample_scales: List[int]=[11, 2, 2, 2], noise_upsample_activation: str='leakyrelu'...
the_stack_v2_python_sparse
paddlespeech/t2s/models/melgan/style_melgan.py
anniyanvr/DeepSpeech-1
train
0
4a5224aa4828debaa4142235558bf35b9e75e097
[ "sdram = SDRAMResource(128 * 2 ** 20)\nself.assertEqual(sdram.get_value(), 128 * 2 ** 20)\nsdram = SDRAMResource(128 * 2 ** 19)\nself.assertEqual(sdram.get_value(), 128 * 2 ** 19)\nsdram = SDRAMResource(128 * 2 ** 21)\nself.assertEqual(sdram.get_value(), 128 * 2 ** 21)", "dtcm = DTCMResource(128 * 2 ** 20)\nself....
<|body_start_0|> sdram = SDRAMResource(128 * 2 ** 20) self.assertEqual(sdram.get_value(), 128 * 2 ** 20) sdram = SDRAMResource(128 * 2 ** 19) self.assertEqual(sdram.get_value(), 128 * 2 ** 19) sdram = SDRAMResource(128 * 2 ** 21) self.assertEqual(sdram.get_value(), 128 * ...
unit tests on the resources object
TestResourceModels
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestResourceModels: """unit tests on the resources object""" def test_sdram(self): """test that adding a sdram resource to a resoruce container works correctly :return:""" <|body_0|> def test_dtcm(self): """test that adding a dtcm resource to a resoruce container...
stack_v2_sparse_classes_36k_train_005882
3,274
no_license
[ { "docstring": "test that adding a sdram resource to a resoruce container works correctly :return:", "name": "test_sdram", "signature": "def test_sdram(self)" }, { "docstring": "test that adding a dtcm resource to a resoruce container works correctly :return:", "name": "test_dtcm", "sign...
4
stack_v2_sparse_classes_30k_train_019606
Implement the Python class `TestResourceModels` described below. Class description: unit tests on the resources object Method signatures and docstrings: - def test_sdram(self): test that adding a sdram resource to a resoruce container works correctly :return: - def test_dtcm(self): test that adding a dtcm resource to...
Implement the Python class `TestResourceModels` described below. Class description: unit tests on the resources object Method signatures and docstrings: - def test_sdram(self): test that adding a sdram resource to a resoruce container works correctly :return: - def test_dtcm(self): test that adding a dtcm resource to...
5c2faba4d823e9341e5c18f61ea9bf8c6e15b687
<|skeleton|> class TestResourceModels: """unit tests on the resources object""" def test_sdram(self): """test that adding a sdram resource to a resoruce container works correctly :return:""" <|body_0|> def test_dtcm(self): """test that adding a dtcm resource to a resoruce container...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestResourceModels: """unit tests on the resources object""" def test_sdram(self): """test that adding a sdram resource to a resoruce container works correctly :return:""" sdram = SDRAMResource(128 * 2 ** 20) self.assertEqual(sdram.get_value(), 128 * 2 ** 20) sdram = SDRAM...
the_stack_v2_python_sparse
unittests/model_tests/resources_tests/test_resources_model.py
kfriesth/PACMAN
train
0
fae4eaaac8f28203f77b63ed50430bcf88b718c9
[ "self.data = data\nself.keys = self.data[0][1].keys()\nself.p = Parser()", "print('Testing All Paths Equal For Parameter:')\nfor param in self.keys:\n self.test_path_equal(param)", "a = []\nfor i in range(len(self.data)):\n a.append(self.p.get_path(block=self.data[i][0], text=self.data[i][1][param]))\nif ...
<|body_start_0|> self.data = data self.keys = self.data[0][1].keys() self.p = Parser() <|end_body_0|> <|body_start_1|> print('Testing All Paths Equal For Parameter:') for param in self.keys: self.test_path_equal(param) <|end_body_1|> <|body_start_2|> a = [] ...
Class for defining and executing the tests.
Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: """Class for defining and executing the tests.""" def __init__(self, data): """Initializes the testing object. Args: data: the gas station data as a list of tuples where: [0] -> the raw html block level data [1] -> a dictionary of parameters to values""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_005883
2,220
no_license
[ { "docstring": "Initializes the testing object. Args: data: the gas station data as a list of tuples where: [0] -> the raw html block level data [1] -> a dictionary of parameters to values", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "Executes the tests.", ...
3
stack_v2_sparse_classes_30k_train_000910
Implement the Python class `Test` described below. Class description: Class for defining and executing the tests. Method signatures and docstrings: - def __init__(self, data): Initializes the testing object. Args: data: the gas station data as a list of tuples where: [0] -> the raw html block level data [1] -> a dict...
Implement the Python class `Test` described below. Class description: Class for defining and executing the tests. Method signatures and docstrings: - def __init__(self, data): Initializes the testing object. Args: data: the gas station data as a list of tuples where: [0] -> the raw html block level data [1] -> a dict...
32d02a7893f0645a1ba18fa463fc3dd02e1a6e26
<|skeleton|> class Test: """Class for defining and executing the tests.""" def __init__(self, data): """Initializes the testing object. Args: data: the gas station data as a list of tuples where: [0] -> the raw html block level data [1] -> a dictionary of parameters to values""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test: """Class for defining and executing the tests.""" def __init__(self, data): """Initializes the testing object. Args: data: the gas station data as a list of tuples where: [0] -> the raw html block level data [1] -> a dictionary of parameters to values""" self.data = data sel...
the_stack_v2_python_sparse
crawler/parser/parser_tester.py
WSJ-2018SE-CPP/gasme
train
1
a9a0185ab6c07e59d5434aa273cbb2c48d948c50
[ "import tables\nself.h5 = tables.open_file(filename)\nself.min_points = min_points\ntable_names = list(self.h5.root.events._v_children.keys())\nstart_times = [datetime(*getattr(self.h5.root.events, the_table).attrs['start_time']) for the_table in table_names]\nst, tn = zip(*sorted(zip(start_times, table_names)))\ns...
<|body_start_0|> import tables self.h5 = tables.open_file(filename) self.min_points = min_points table_names = list(self.h5.root.events._v_children.keys()) start_times = [datetime(*getattr(self.h5.root.events, the_table).attrs['start_time']) for the_table in table_names] ...
LMAh5File
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LMAh5File: def __init__(self, filename, min_points=1): """Open an HDF5 LMA file so as to read LMA event/flash tables. The events and flashes groups may contain more than one table, and the list of self.table_names corresponds to self.start_times and are sorted in increasing time order. s...
stack_v2_sparse_classes_36k_train_005884
10,049
permissive
[ { "docstring": "Open an HDF5 LMA file so as to read LMA event/flash tables. The events and flashes groups may contain more than one table, and the list of self.table_names corresponds to self.start_times and are sorted in increasing time order. self.base_date provides the base_date against which time in seconds...
3
stack_v2_sparse_classes_30k_train_019314
Implement the Python class `LMAh5File` described below. Class description: Implement the LMAh5File class. Method signatures and docstrings: - def __init__(self, filename, min_points=1): Open an HDF5 LMA file so as to read LMA event/flash tables. The events and flashes groups may contain more than one table, and the l...
Implement the Python class `LMAh5File` described below. Class description: Implement the LMAh5File class. Method signatures and docstrings: - def __init__(self, filename, min_points=1): Open an HDF5 LMA file so as to read LMA event/flash tables. The events and flashes groups may contain more than one table, and the l...
392eff5f15735be7b7f5ccc20d2835a617000117
<|skeleton|> class LMAh5File: def __init__(self, filename, min_points=1): """Open an HDF5 LMA file so as to read LMA event/flash tables. The events and flashes groups may contain more than one table, and the list of self.table_names corresponds to self.start_times and are sorted in increasing time order. s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LMAh5File: def __init__(self, filename, min_points=1): """Open an HDF5 LMA file so as to read LMA event/flash tables. The events and flashes groups may contain more than one table, and the list of self.table_names corresponds to self.start_times and are sorted in increasing time order. self.base_date ...
the_stack_v2_python_sparse
lmatools/io/LMA_h5_file.py
deeplycloudy/lmatools
train
16
6aa499b865a746a5429bf954af963efb1e6ad538
[ "super().set_params(params)\nparams = dict_to_namespace(params)\nself.params.name = getattr(params, 'name', 'GlobalOptGrid')\nself.params.opt_mode = getattr(params, 'opt_mode', 'min')", "if self.params.opt_mode == 'min':\n opt_idx = np.argmin(self.exe_path.y)\nelif self.params.opt_mode == 'max':\n opt_idx =...
<|body_start_0|> super().set_params(params) params = dict_to_namespace(params) self.params.name = getattr(params, 'name', 'GlobalOptGrid') self.params.opt_mode = getattr(params, 'opt_mode', 'min') <|end_body_0|> <|body_start_1|> if self.params.opt_mode == 'min': opt_...
Algorithm that scans over a grid of points, and as output returns the minimum function value over the grid.
GlobalOptValGrid
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlobalOptValGrid: """Algorithm that scans over a grid of points, and as output returns the minimum function value over the grid.""" def set_params(self, params): """Set self.params, the parameters for the algorithm.""" <|body_0|> def get_exe_path_opt_idx(self): "...
stack_v2_sparse_classes_36k_train_005885
19,618
no_license
[ { "docstring": "Set self.params, the parameters for the algorithm.", "name": "set_params", "signature": "def set_params(self, params)" }, { "docstring": "Return the index of the optimal point in execution path.", "name": "get_exe_path_opt_idx", "signature": "def get_exe_path_opt_idx(self...
4
stack_v2_sparse_classes_30k_train_015847
Implement the Python class `GlobalOptValGrid` described below. Class description: Algorithm that scans over a grid of points, and as output returns the minimum function value over the grid. Method signatures and docstrings: - def set_params(self, params): Set self.params, the parameters for the algorithm. - def get_e...
Implement the Python class `GlobalOptValGrid` described below. Class description: Algorithm that scans over a grid of points, and as output returns the minimum function value over the grid. Method signatures and docstrings: - def set_params(self, params): Set self.params, the parameters for the algorithm. - def get_e...
d75d1a89bb566e62662e4d010d91893bfe1ee9f4
<|skeleton|> class GlobalOptValGrid: """Algorithm that scans over a grid of points, and as output returns the minimum function value over the grid.""" def set_params(self, params): """Set self.params, the parameters for the algorithm.""" <|body_0|> def get_exe_path_opt_idx(self): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GlobalOptValGrid: """Algorithm that scans over a grid of points, and as output returns the minimum function value over the grid.""" def set_params(self, params): """Set self.params, the parameters for the algorithm.""" super().set_params(params) params = dict_to_namespace(params) ...
the_stack_v2_python_sparse
bax/alg/algorithms.py
willieneis/bayesian-algorithm-execution
train
45
a862a36bd53f76d46770aab0978dbe76a93d5cda
[ "self.db = db\nself.meg_maps = dict()\nself.bands = dict()\nself.exponent_map = dict({'Exponents': np.array([])})\nself.oscs_loaded = False\nself.exponents_loaded = False", "osc_maps_file = os.path.join(self.db.maps_path, 'Oscs', osc_file + '.p')\ndat_in = pickle.load(open(osc_maps_file, 'rb'))\nself.bands = dat_...
<|body_start_0|> self.db = db self.meg_maps = dict() self.bands = dict() self.exponent_map = dict({'Exponents': np.array([])}) self.oscs_loaded = False self.exponents_loaded = False <|end_body_0|> <|body_start_1|> osc_maps_file = os.path.join(self.db.maps_path, '...
Class for storing and comparing spatial topographies.
MapCompBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MapCompBase: """Class for storing and comparing spatial topographies.""" def __init__(self, db): """Initialize object with omegamappin database. Parameters ---------- db : OMDB() object Database object for omegamappin project.""" <|body_0|> def load_meg_maps(self, osc_fi...
stack_v2_sparse_classes_36k_train_005886
3,451
permissive
[ { "docstring": "Initialize object with omegamappin database. Parameters ---------- db : OMDB() object Database object for omegamappin project.", "name": "__init__", "signature": "def __init__(self, db)" }, { "docstring": "Load the spatial maps of MEG data (oscillation bands). Parameters --------...
3
stack_v2_sparse_classes_30k_train_016723
Implement the Python class `MapCompBase` described below. Class description: Class for storing and comparing spatial topographies. Method signatures and docstrings: - def __init__(self, db): Initialize object with omegamappin database. Parameters ---------- db : OMDB() object Database object for omegamappin project. ...
Implement the Python class `MapCompBase` described below. Class description: Class for storing and comparing spatial topographies. Method signatures and docstrings: - def __init__(self, db): Initialize object with omegamappin database. Parameters ---------- db : OMDB() object Database object for omegamappin project. ...
5e744ccb4b818cf2fa39f09fc4c8625d24c30e98
<|skeleton|> class MapCompBase: """Class for storing and comparing spatial topographies.""" def __init__(self, db): """Initialize object with omegamappin database. Parameters ---------- db : OMDB() object Database object for omegamappin project.""" <|body_0|> def load_meg_maps(self, osc_fi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MapCompBase: """Class for storing and comparing spatial topographies.""" def __init__(self, db): """Initialize object with omegamappin database. Parameters ---------- db : OMDB() object Database object for omegamappin project.""" self.db = db self.meg_maps = dict() self.ba...
the_stack_v2_python_sparse
om/maps/base.py
voytekresearch/omapping
train
0
ff9911259fae366410bbe2942ce012ffb33c8d65
[ "try:\n params = request._serialize()\n headers = request.headers\n body = self.call('AllocateCustomerCredit', params, headers=headers)\n response = json.loads(body)\n model = models.AllocateCustomerCreditResponse()\n model._deserialize(response['Response'])\n return model\nexcept Exception as ...
<|body_start_0|> try: params = request._serialize() headers = request.headers body = self.call('AllocateCustomerCredit', params, headers=headers) response = json.loads(body) model = models.AllocateCustomerCreditResponse() model._deserialize...
IpClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IpClient: def AllocateCustomerCredit(self, request): """This API is used for a partner to set credit for a customer, such as increasing or lowering the credit and setting it to 0. 1. The credit is valid permanently and will not be zeroed regularly. 2. The customer's service will be suspe...
stack_v2_sparse_classes_36k_train_005887
7,749
no_license
[ { "docstring": "This API is used for a partner to set credit for a customer, such as increasing or lowering the credit and setting it to 0. 1. The credit is valid permanently and will not be zeroed regularly. 2. The customer's service will be suspended when its available credit sets to 0, so caution should be e...
6
null
Implement the Python class `IpClient` described below. Class description: Implement the IpClient class. Method signatures and docstrings: - def AllocateCustomerCredit(self, request): This API is used for a partner to set credit for a customer, such as increasing or lowering the credit and setting it to 0. 1. The cred...
Implement the Python class `IpClient` described below. Class description: Implement the IpClient class. Method signatures and docstrings: - def AllocateCustomerCredit(self, request): This API is used for a partner to set credit for a customer, such as increasing or lowering the credit and setting it to 0. 1. The cred...
042b4d7fb609d4d240728197901b46008b35d4b0
<|skeleton|> class IpClient: def AllocateCustomerCredit(self, request): """This API is used for a partner to set credit for a customer, such as increasing or lowering the credit and setting it to 0. 1. The credit is valid permanently and will not be zeroed regularly. 2. The customer's service will be suspe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IpClient: def AllocateCustomerCredit(self, request): """This API is used for a partner to set credit for a customer, such as increasing or lowering the credit and setting it to 0. 1. The credit is valid permanently and will not be zeroed regularly. 2. The customer's service will be suspended when its ...
the_stack_v2_python_sparse
tencentcloud/ip/v20210409/ip_client.py
TencentCloud/tencentcloud-sdk-python-intl-en
train
4
b09ae5239bae200fa6bfa9c44b3e63183a47b9ed
[ "self.create_file = True\nself.logfilename = logfilename\nif not self.logfilename.endswith('.csv'):\n self.logfilename += '.csv'", "if self.create_file:\n dataframe.to_csv(self.logfilename, mode='w')\n self.create_file = False\nelse:\n dataframe.to_csv(self.logfilename, mode='a', header=False)" ]
<|body_start_0|> self.create_file = True self.logfilename = logfilename if not self.logfilename.endswith('.csv'): self.logfilename += '.csv' <|end_body_0|> <|body_start_1|> if self.create_file: dataframe.to_csv(self.logfilename, mode='w') self.create_...
Handles creation and writing of a dataframe to a .csv file, possibly multiple times via appending. Used to log producer-consumer iteration, but could be used to log any dataframe.
IterationLog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IterationLog: """Handles creation and writing of a dataframe to a .csv file, possibly multiple times via appending. Used to log producer-consumer iteration, but could be used to log any dataframe.""" def __init__(self, logfilename): """Create IterationLog object Args: logfilename: na...
stack_v2_sparse_classes_36k_train_005888
5,083
no_license
[ { "docstring": "Create IterationLog object Args: logfilename: name of file to create, '.csv' extension added if not provided.", "name": "__init__", "signature": "def __init__(self, logfilename)" }, { "docstring": "Write dataframe to a .csv file, file is created on first write, subsequent writes ...
2
null
Implement the Python class `IterationLog` described below. Class description: Handles creation and writing of a dataframe to a .csv file, possibly multiple times via appending. Used to log producer-consumer iteration, but could be used to log any dataframe. Method signatures and docstrings: - def __init__(self, logfi...
Implement the Python class `IterationLog` described below. Class description: Handles creation and writing of a dataframe to a .csv file, possibly multiple times via appending. Used to log producer-consumer iteration, but could be used to log any dataframe. Method signatures and docstrings: - def __init__(self, logfi...
afe912c57383b9de90ef30820f7977c3367a30c4
<|skeleton|> class IterationLog: """Handles creation and writing of a dataframe to a .csv file, possibly multiple times via appending. Used to log producer-consumer iteration, but could be used to log any dataframe.""" def __init__(self, logfilename): """Create IterationLog object Args: logfilename: na...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IterationLog: """Handles creation and writing of a dataframe to a .csv file, possibly multiple times via appending. Used to log producer-consumer iteration, but could be used to log any dataframe.""" def __init__(self, logfilename): """Create IterationLog object Args: logfilename: name of file to...
the_stack_v2_python_sparse
omega_model/common/omega_log.py
USEPA/EPA_OMEGA_Model
train
17
07e722aad14f035fc6c4408b2b49093b6fcc10f9
[ "super().__init__(compute_on_call=compute_on_call, prefix=prefix, suffix=suffix, num_classes=num_classes)\nself.compute_per_class_metrics = compute_per_class_metrics\nself.zero_division = zero_division\nself.num_classes = num_classes\nself.reset()", "kv_metrics = {}\nfor aggregation_name, aggregated_metrics in zi...
<|body_start_0|> super().__init__(compute_on_call=compute_on_call, prefix=prefix, suffix=suffix, num_classes=num_classes) self.compute_per_class_metrics = compute_per_class_metrics self.zero_division = zero_division self.num_classes = num_classes self.reset() <|end_body_0|> <|bo...
Metric that can collect statistics and count precision, recall, f1_score and support with it. Args: zero_division: value to set in case of zero division during metrics (precision, recall) computation; should be one of 0 or 1 compute_on_call: if True, allows compute metric's value on call compute_per_class_metrics: bool...
MulticlassPrecisionRecallF1SupportMetric
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MulticlassPrecisionRecallF1SupportMetric: """Metric that can collect statistics and count precision, recall, f1_score and support with it. Args: zero_division: value to set in case of zero division during metrics (precision, recall) computation; should be one of 0 or 1 compute_on_call: if True, a...
stack_v2_sparse_classes_36k_train_005889
34,447
permissive
[ { "docstring": "Init PrecisionRecallF1SupportMetric instance", "name": "__init__", "signature": "def __init__(self, zero_division: int=0, compute_on_call: bool=True, compute_per_class_metrics: bool=SETTINGS.compute_per_class_metrics, prefix: str=None, suffix: str=None, num_classes: Optional[int]=None) -...
6
stack_v2_sparse_classes_30k_train_013806
Implement the Python class `MulticlassPrecisionRecallF1SupportMetric` described below. Class description: Metric that can collect statistics and count precision, recall, f1_score and support with it. Args: zero_division: value to set in case of zero division during metrics (precision, recall) computation; should be on...
Implement the Python class `MulticlassPrecisionRecallF1SupportMetric` described below. Class description: Metric that can collect statistics and count precision, recall, f1_score and support with it. Args: zero_division: value to set in case of zero division during metrics (precision, recall) computation; should be on...
e99f90655d0efcf22559a46e928f0f98c9807ebf
<|skeleton|> class MulticlassPrecisionRecallF1SupportMetric: """Metric that can collect statistics and count precision, recall, f1_score and support with it. Args: zero_division: value to set in case of zero division during metrics (precision, recall) computation; should be one of 0 or 1 compute_on_call: if True, a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MulticlassPrecisionRecallF1SupportMetric: """Metric that can collect statistics and count precision, recall, f1_score and support with it. Args: zero_division: value to set in case of zero division during metrics (precision, recall) computation; should be one of 0 or 1 compute_on_call: if True, allows compute...
the_stack_v2_python_sparse
catalyst/metrics/_classification.py
catalyst-team/catalyst
train
3,038
af4cd34fc29c23b24a42b0aaf191097602d33e00
[ "if len(charset) != len(set(charset)):\n raise ValueError('All values in charset must be unique.')\nself.charset = charset\nself.max_length = max_length\nself.ohe = OneHotFeaturizer(charset=CHARSET, max_length=max_length)", "seq_one_hot = self.ohe.featurize(datapoint)\nseq_one_hot_array = np.transpose(np.array...
<|body_start_0|> if len(charset) != len(set(charset)): raise ValueError('All values in charset must be unique.') self.charset = charset self.max_length = max_length self.ohe = OneHotFeaturizer(charset=CHARSET, max_length=max_length) <|end_body_0|> <|body_start_1|> se...
Encodes a list position frequency matrices for a given list of multiple sequence alignments The default character set is 25 amino acids. If you want to use a different character set, such as nucleotides, simply pass in a list of character strings in the featurizer constructor. The max_length parameter is the maximum le...
PFMFeaturizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PFMFeaturizer: """Encodes a list position frequency matrices for a given list of multiple sequence alignments The default character set is 25 amino acids. If you want to use a different character set, such as nucleotides, simply pass in a list of character strings in the featurizer constructor. T...
stack_v2_sparse_classes_36k_train_005890
3,383
permissive
[ { "docstring": "Initialize featurizer. Parameters ---------- charset: List[str] (default CHARSET) A list of strings, where each string is length 1 and unique. max_length: int, optional (default 25) Maximum length of sequences to be featurized.", "name": "__init__", "signature": "def __init__(self, chars...
2
null
Implement the Python class `PFMFeaturizer` described below. Class description: Encodes a list position frequency matrices for a given list of multiple sequence alignments The default character set is 25 amino acids. If you want to use a different character set, such as nucleotides, simply pass in a list of character s...
Implement the Python class `PFMFeaturizer` described below. Class description: Encodes a list position frequency matrices for a given list of multiple sequence alignments The default character set is 25 amino acids. If you want to use a different character set, such as nucleotides, simply pass in a list of character s...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class PFMFeaturizer: """Encodes a list position frequency matrices for a given list of multiple sequence alignments The default character set is 25 amino acids. If you want to use a different character set, such as nucleotides, simply pass in a list of character strings in the featurizer constructor. T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PFMFeaturizer: """Encodes a list position frequency matrices for a given list of multiple sequence alignments The default character set is 25 amino acids. If you want to use a different character set, such as nucleotides, simply pass in a list of character strings in the featurizer constructor. The max_length...
the_stack_v2_python_sparse
deepchem/feat/sequence_featurizers/position_frequency_matrix_featurizer.py
deepchem/deepchem
train
4,876
48123239c70846bea3c41bd31205006de81784a2
[ "if not nums:\n return 0\ndp = [1] * len(nums)\nfor i in range(1, len(nums)):\n for j in range(i - 1, -1, -1):\n if nums[j] < nums[i]:\n dp[i] = max(dp[i], dp[j] + 1)\n break\nreturn max(dp)", "dp = [0] * len(nums)\nsize = 0\nfor n in nums:\n i, j = (0, size)\n while i < j...
<|body_start_0|> if not nums: return 0 dp = [1] * len(nums) for i in range(1, len(nums)): for j in range(i - 1, -1, -1): if nums[j] < nums[i]: dp[i] = max(dp[i], dp[j] + 1) break return max(dp) <|end_body_0|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 dp ...
stack_v2_sparse_classes_36k_train_005891
1,712
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def lengthOfLIS...
63b7eedc720c1ce14880b80744dcd5ef7107065c
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 dp = [1] * len(nums) for i in range(1, len(nums)): for j in range(i - 1, -1, -1): if nums[j] < nums[i]: dp[i] = max(d...
the_stack_v2_python_sparse
problems/lengthOfLIS.py
joddiy/leetcode
train
1
82474b732e0974212195a08ff9f7f3b76a871d1c
[ "analysis = Analysis.objects.get(id=self._analysis_id)\norganization = analysis.organization\nif not organization.better_analysis_api_key:\n message = f'''Organization \"{organization.name}\" is missing the required BETTER Analysis API Key. Please update your organization's settings or contact your organization ...
<|body_start_0|> analysis = Analysis.objects.get(id=self._analysis_id) organization = analysis.organization if not organization.better_analysis_api_key: message = f'''Organization "{organization.name}" is missing the required BETTER Analysis API Key. Please update your organization's...
BETTERPipeline is a class for preparing, running, and post processing BETTER analysis by implementing the AnalysisPipeline's abstract methods.
BETTERPipeline
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BETTERPipeline: """BETTERPipeline is a class for preparing, running, and post processing BETTER analysis by implementing the AnalysisPipeline's abstract methods.""" def _prepare_analysis(self, property_view_ids, start_analysis=False): """Internal implementation for preparing better a...
stack_v2_sparse_classes_36k_train_005892
23,144
permissive
[ { "docstring": "Internal implementation for preparing better analysis", "name": "_prepare_analysis", "signature": "def _prepare_analysis(self, property_view_ids, start_analysis=False)" }, { "docstring": "Internal implementation for starting the BETTER analysis", "name": "_start_analysis", ...
2
stack_v2_sparse_classes_30k_train_018076
Implement the Python class `BETTERPipeline` described below. Class description: BETTERPipeline is a class for preparing, running, and post processing BETTER analysis by implementing the AnalysisPipeline's abstract methods. Method signatures and docstrings: - def _prepare_analysis(self, property_view_ids, start_analys...
Implement the Python class `BETTERPipeline` described below. Class description: BETTERPipeline is a class for preparing, running, and post processing BETTER analysis by implementing the AnalysisPipeline's abstract methods. Method signatures and docstrings: - def _prepare_analysis(self, property_view_ids, start_analys...
680b6a2b45f3c568d779d8ac86553a0b08c384c8
<|skeleton|> class BETTERPipeline: """BETTERPipeline is a class for preparing, running, and post processing BETTER analysis by implementing the AnalysisPipeline's abstract methods.""" def _prepare_analysis(self, property_view_ids, start_analysis=False): """Internal implementation for preparing better a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BETTERPipeline: """BETTERPipeline is a class for preparing, running, and post processing BETTER analysis by implementing the AnalysisPipeline's abstract methods.""" def _prepare_analysis(self, property_view_ids, start_analysis=False): """Internal implementation for preparing better analysis""" ...
the_stack_v2_python_sparse
seed/analysis_pipelines/better/pipeline.py
SEED-platform/seed
train
108
cd481317e2f86d7606eabad4513187d10cc982ec
[ "super(RepoAPI, self).get()\nproject_id = request.args.get('project_id', '')\nif action in self.actions:\n self_action = getattr(self, action.lower(), None)\n return self_action(project_id=project_id)\nelse:\n abort(404)", "wi = Deployer(project_id=project_id)\ntag_list = wi.list_tag()\ntags = tag_list.s...
<|body_start_0|> super(RepoAPI, self).get() project_id = request.args.get('project_id', '') if action in self.actions: self_action = getattr(self, action.lower(), None) return self_action(project_id=project_id) else: abort(404) <|end_body_0|> <|body_s...
RepoAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RepoAPI: def get(self, action, commit=None): """fetch project list or one item /project/<int:project_id> :return:""" <|body_0|> def tags(self, project_id=None): """fetch project list or one item /tag/ :return:""" <|body_1|> def branches(self, project_id=...
stack_v2_sparse_classes_36k_train_005893
1,793
permissive
[ { "docstring": "fetch project list or one item /project/<int:project_id> :return:", "name": "get", "signature": "def get(self, action, commit=None)" }, { "docstring": "fetch project list or one item /tag/ :return:", "name": "tags", "signature": "def tags(self, project_id=None)" }, { ...
4
stack_v2_sparse_classes_30k_train_004957
Implement the Python class `RepoAPI` described below. Class description: Implement the RepoAPI class. Method signatures and docstrings: - def get(self, action, commit=None): fetch project list or one item /project/<int:project_id> :return: - def tags(self, project_id=None): fetch project list or one item /tag/ :retur...
Implement the Python class `RepoAPI` described below. Class description: Implement the RepoAPI class. Method signatures and docstrings: - def get(self, action, commit=None): fetch project list or one item /project/<int:project_id> :return: - def tags(self, project_id=None): fetch project list or one item /tag/ :retur...
a306f8212a2671411125f61a850b5869d315e283
<|skeleton|> class RepoAPI: def get(self, action, commit=None): """fetch project list or one item /project/<int:project_id> :return:""" <|body_0|> def tags(self, project_id=None): """fetch project list or one item /tag/ :return:""" <|body_1|> def branches(self, project_id=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RepoAPI: def get(self, action, commit=None): """fetch project list or one item /project/<int:project_id> :return:""" super(RepoAPI, self).get() project_id = request.args.get('project_id', '') if action in self.actions: self_action = getattr(self, action.lower(), Non...
the_stack_v2_python_sparse
walle/api/repo.py
fu648126437/walle-web
train
2
4ade24baff66daa44ecfc0010d597d1df486f7c3
[ "response = super().to_representation(instance)\nif hasattr(response, 'user'):\n response['user'] = {'id': instance.user.id}\nif hasattr(response, 'listing'):\n response['listing'] = {'id': instance.listing.id}\nreturn response", "request = self.context.get('request')\ndata['user'] = request.user\nif data['...
<|body_start_0|> response = super().to_representation(instance) if hasattr(response, 'user'): response['user'] = {'id': instance.user.id} if hasattr(response, 'listing'): response['listing'] = {'id': instance.listing.id} return response <|end_body_0|> <|body_star...
Serializer to create galleries
GallerySerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GallerySerializer: """Serializer to create galleries""" def to_representation(self, instance): """Return only the id of the user or listing for the gallery and not the entire object.""" <|body_0|> def validate(self, data): """Validate creation of gallery. - Check...
stack_v2_sparse_classes_36k_train_005894
2,374
no_license
[ { "docstring": "Return only the id of the user or listing for the gallery and not the entire object.", "name": "to_representation", "signature": "def to_representation(self, instance)" }, { "docstring": "Validate creation of gallery. - Check if user exists or has listing to make gallery - Check ...
2
stack_v2_sparse_classes_30k_train_013924
Implement the Python class `GallerySerializer` described below. Class description: Serializer to create galleries Method signatures and docstrings: - def to_representation(self, instance): Return only the id of the user or listing for the gallery and not the entire object. - def validate(self, data): Validate creatio...
Implement the Python class `GallerySerializer` described below. Class description: Serializer to create galleries Method signatures and docstrings: - def to_representation(self, instance): Return only the id of the user or listing for the gallery and not the entire object. - def validate(self, data): Validate creatio...
1f2c8c232372de6a40089c8b867ce1798d2296c7
<|skeleton|> class GallerySerializer: """Serializer to create galleries""" def to_representation(self, instance): """Return only the id of the user or listing for the gallery and not the entire object.""" <|body_0|> def validate(self, data): """Validate creation of gallery. - Check...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GallerySerializer: """Serializer to create galleries""" def to_representation(self, instance): """Return only the id of the user or listing for the gallery and not the entire object.""" response = super().to_representation(instance) if hasattr(response, 'user'): respon...
the_stack_v2_python_sparse
core/roommates_api/serializers/gallery_serializers.py
harmanT23/yournextroommates
train
1
7d0a97bb0737b48fc1690632c4142bff093aa799
[ "def dfs(node):\n if not node:\n return (0, 0)\n count_left = dfs(node.left)\n count_right = dfs(node.right)\n count_inc, count_dec = (1, 1)\n if node.left:\n if node.left.val == node.val + 1:\n count_inc = max(count_inc, count_left[0] + 1)\n elif node.left.val == node...
<|body_start_0|> def dfs(node): if not node: return (0, 0) count_left = dfs(node.left) count_right = dfs(node.right) count_inc, count_dec = (1, 1) if node.left: if node.left.val == node.val + 1: count...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestConsecutive(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def longestConsecutive_TLE(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def dfs(node): if...
stack_v2_sparse_classes_36k_train_005895
4,941
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "longestConsecutive", "signature": "def longestConsecutive(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "longestConsecutive_TLE", "signature": "def longestConsecutive_TLE(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, root): :type root: TreeNode :rtype: int - def longestConsecutive_TLE(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, root): :type root: TreeNode :rtype: int - def longestConsecutive_TLE(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: ...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def longestConsecutive(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def longestConsecutive_TLE(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestConsecutive(self, root): """:type root: TreeNode :rtype: int""" def dfs(node): if not node: return (0, 0) count_left = dfs(node.left) count_right = dfs(node.right) count_inc, count_dec = (1, 1) if ...
the_stack_v2_python_sparse
src/lt_549.py
oxhead/CodingYourWay
train
0
a0ec57881aa7b5d2f98559d2f8d895ba46ecd56f
[ "user_id = session.user_id\nuser_obj = User.query.filter_by(user_id=user_id, is_deleted=False).first()\ncreate_org_parser = reqparse.RequestParser(bundle_errors=True)\ncreate_org_parser.add_argument('org_name', help=APIMessages.PARSER_MESSAGE, required=True, type=str)\ncreate_org_parser.add_argument('org_descriptio...
<|body_start_0|> user_id = session.user_id user_obj = User.query.filter_by(user_id=user_id, is_deleted=False).first() create_org_parser = reqparse.RequestParser(bundle_errors=True) create_org_parser.add_argument('org_name', help=APIMessages.PARSER_MESSAGE, required=True, type=str) ...
Class to handle Organization related GET, POST and PUT API.
OrganizationAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrganizationAPI: """Class to handle Organization related GET, POST and PUT API.""" def post(self, session): """Post call to create Organization with name. Args: session(object): User session Returns: Standard API Response with HTTP status code""" <|body_0|> def put(self,...
stack_v2_sparse_classes_36k_train_005896
13,358
permissive
[ { "docstring": "Post call to create Organization with name. Args: session(object): User session Returns: Standard API Response with HTTP status code", "name": "post", "signature": "def post(self, session)" }, { "docstring": "PUT call to Update Organization name. Args: session(object): User sessi...
4
null
Implement the Python class `OrganizationAPI` described below. Class description: Class to handle Organization related GET, POST and PUT API. Method signatures and docstrings: - def post(self, session): Post call to create Organization with name. Args: session(object): User session Returns: Standard API Response with ...
Implement the Python class `OrganizationAPI` described below. Class description: Class to handle Organization related GET, POST and PUT API. Method signatures and docstrings: - def post(self, session): Post call to create Organization with name. Args: session(object): User session Returns: Standard API Response with ...
10e4d813c897bcf0078ab350d9432117cb708d1a
<|skeleton|> class OrganizationAPI: """Class to handle Organization related GET, POST and PUT API.""" def post(self, session): """Post call to create Organization with name. Args: session(object): User session Returns: Standard API Response with HTTP status code""" <|body_0|> def put(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrganizationAPI: """Class to handle Organization related GET, POST and PUT API.""" def post(self, session): """Post call to create Organization with name. Args: session(object): User session Returns: Standard API Response with HTTP status code""" user_id = session.user_id user_obj...
the_stack_v2_python_sparse
application/api/organization.py
HarshadKavathiya/acciom
train
0
a086a6042c31672ffcb30e966e92cb087dbfa7f2
[ "self.X, self.y = (X, y)\nself.y['Gender'] = GenderWrap().fit_transform(self.y['Gender'])\nself.y['Age'] = AgeRangeWrap().fit_transform(self.y['Age'])\nif data is None:\n self.features = pd.read_csv('data/' + source + '/raw/features_fin.csv', encoding='ISO-8859-1', index_col=0)\nelse:\n self.features = data",...
<|body_start_0|> self.X, self.y = (X, y) self.y['Gender'] = GenderWrap().fit_transform(self.y['Gender']) self.y['Age'] = AgeRangeWrap().fit_transform(self.y['Age']) if data is None: self.features = pd.read_csv('data/' + source + '/raw/features_fin.csv', encoding='ISO-8859-1',...
Applies dimension reduction to data
Feature
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Feature: """Applies dimension reduction to data""" def __init__(self, X, y, source, data=None): """:param X: text data :param y: classes (gender and age) :param source: twitter, facebook, or merged :param data: features of the data""" <|body_0|> def applySelection(self, ...
stack_v2_sparse_classes_36k_train_005897
3,915
no_license
[ { "docstring": ":param X: text data :param y: classes (gender and age) :param source: twitter, facebook, or merged :param data: features of the data", "name": "__init__", "signature": "def __init__(self, X, y, source, data=None)" }, { "docstring": "applies feature selection :param selection: fea...
5
stack_v2_sparse_classes_30k_train_003117
Implement the Python class `Feature` described below. Class description: Applies dimension reduction to data Method signatures and docstrings: - def __init__(self, X, y, source, data=None): :param X: text data :param y: classes (gender and age) :param source: twitter, facebook, or merged :param data: features of the ...
Implement the Python class `Feature` described below. Class description: Applies dimension reduction to data Method signatures and docstrings: - def __init__(self, X, y, source, data=None): :param X: text data :param y: classes (gender and age) :param source: twitter, facebook, or merged :param data: features of the ...
47d66e062f60993f3bf6f59a64d6e19b7d178333
<|skeleton|> class Feature: """Applies dimension reduction to data""" def __init__(self, X, y, source, data=None): """:param X: text data :param y: classes (gender and age) :param source: twitter, facebook, or merged :param data: features of the data""" <|body_0|> def applySelection(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Feature: """Applies dimension reduction to data""" def __init__(self, X, y, source, data=None): """:param X: text data :param y: classes (gender and age) :param source: twitter, facebook, or merged :param data: features of the data""" self.X, self.y = (X, y) self.y['Gender'] = Gen...
the_stack_v2_python_sparse
features/Feature.py
jankristoffercheng/thesis
train
0
549abcbcd6dd86d1b3a14005abf3afc34dabb89e
[ "inSpec = super(ValueDuration, cls).getInputSpecification()\ninSpec.addSub(InputData.parameterInputFactory('target', contentType=InputTypes.StringListType, strictMode=True))\ninSpec.addSub(InputData.parameterInputFactory('bins', contentType=InputTypes.IntegerType))\nreturn inSpec", "super().__init__()\nself.dynam...
<|body_start_0|> inSpec = super(ValueDuration, cls).getInputSpecification() inSpec.addSub(InputData.parameterInputFactory('target', contentType=InputTypes.StringListType, strictMode=True)) inSpec.addSub(InputData.parameterInputFactory('bins', contentType=InputTypes.IntegerType)) return i...
Constructs a load duration curve. x-axis is time spent above a particular variable's value, y-axis is the value of the variable.
ValueDuration
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValueDuration: """Constructs a load duration curve. x-axis is time spent above a particular variable's value, y-axis is the value of the variable.""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the cl...
stack_v2_sparse_classes_36k_train_005898
5,435
permissive
[ { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls.", "name": "getInputSpecification", "signatur...
6
stack_v2_sparse_classes_30k_train_004021
Implement the Python class `ValueDuration` described below. Class description: Constructs a load duration curve. x-axis is time spent above a particular variable's value, y-axis is the value of the variable. Method signatures and docstrings: - def getInputSpecification(cls): Method to get a reference to a class that ...
Implement the Python class `ValueDuration` described below. Class description: Constructs a load duration curve. x-axis is time spent above a particular variable's value, y-axis is the value of the variable. Method signatures and docstrings: - def getInputSpecification(cls): Method to get a reference to a class that ...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class ValueDuration: """Constructs a load duration curve. x-axis is time spent above a particular variable's value, y-axis is the value of the variable.""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the cl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValueDuration: """Constructs a load duration curve. x-axis is time spent above a particular variable's value, y-axis is the value of the variable.""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which...
the_stack_v2_python_sparse
ravenframework/Models/PostProcessors/ValueDuration.py
idaholab/raven
train
201
189b53cc334e02bbb881d5caac88ee00fdd79e2c
[ "super(MovingAverage, self).__init__()\nself.register_buffer('num_batches_tracked', torch.tensor(0))\nself.register_buffer('momentum', momentum)\nself.register_buffer('moving_average', torch.tensor([0.0] * len(momentum)))", "if self.training:\n with torch.no_grad():\n if self.num_batches_tracked.item() ...
<|body_start_0|> super(MovingAverage, self).__init__() self.register_buffer('num_batches_tracked', torch.tensor(0)) self.register_buffer('momentum', momentum) self.register_buffer('moving_average', torch.tensor([0.0] * len(momentum))) <|end_body_0|> <|body_start_1|> if self.trai...
Exponential moving average.
MovingAverage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: """Exponential moving average.""" def __init__(self, momentum: torch.Tensor) -> None: """Construct moving average layer. Args: momentum: A vector indicating the momentum to use for the corresponding row.""" <|body_0|> def forward(self, x: torch.Tensor) -> ...
stack_v2_sparse_classes_36k_train_005899
1,447
no_license
[ { "docstring": "Construct moving average layer. Args: momentum: A vector indicating the momentum to use for the corresponding row.", "name": "__init__", "signature": "def __init__(self, momentum: torch.Tensor) -> None" }, { "docstring": "Return the current moving average, given a vector x.", ...
2
stack_v2_sparse_classes_30k_train_016817
Implement the Python class `MovingAverage` described below. Class description: Exponential moving average. Method signatures and docstrings: - def __init__(self, momentum: torch.Tensor) -> None: Construct moving average layer. Args: momentum: A vector indicating the momentum to use for the corresponding row. - def fo...
Implement the Python class `MovingAverage` described below. Class description: Exponential moving average. Method signatures and docstrings: - def __init__(self, momentum: torch.Tensor) -> None: Construct moving average layer. Args: momentum: A vector indicating the momentum to use for the corresponding row. - def fo...
39197b5f54cd84ff35022c851dd2dcb753ca6b89
<|skeleton|> class MovingAverage: """Exponential moving average.""" def __init__(self, momentum: torch.Tensor) -> None: """Construct moving average layer. Args: momentum: A vector indicating the momentum to use for the corresponding row.""" <|body_0|> def forward(self, x: torch.Tensor) -> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovingAverage: """Exponential moving average.""" def __init__(self, momentum: torch.Tensor) -> None: """Construct moving average layer. Args: momentum: A vector indicating the momentum to use for the corresponding row.""" super(MovingAverage, self).__init__() self.register_buffer(...
the_stack_v2_python_sparse
quant/utils/moving_average.py
mikechen66/ml-quant
train
0