text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>def printconvertedresults(kilometer1, kilometer2, kilometer3, kilometer4, kilometer5, kilometer6, kilometer7,kilometer8,kilometer9,kilometer10) print("kilometers\tMiles") print( str( Kilometer1)+ "\t"+calcMiles( kilometers1), (str(Kilometer2) + "\t" + calcMiles(kilometers2), (str(Kilometer3 + "...
code_fim
hard
{ "lang": "python", "repo": "cblac105/Miles-convertor-", "path": "/miles-convertor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> n_samples, n_features = X.shape is_sparse = issparse(X) if is_sparse: L = slinalg.norm(X, axis=0) ** 2 / n_samples else: L = norm(X, axis=0) ** 2 / n_samples v_ = v.copy() list_beta = np.asarray(list_beta) jac_t_v = model._init_g_backward(None) for k in (np....
code_fim
hard
{ "lang": "python", "repo": "mathurinm/sparse-ho", "path": "/sparse_ho/backward.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mathurinm/sparse-ho path: /sparse_ho/backward.py import numpy as np from numpy.linalg import norm from scipy.sparse import issparse import scipy.sparse.linalg as slinalg from sparse_ho.forward import get_beta_jac_iterdiff class Backward(): """Algorithm that will compute the (hyper)gradient,...
code_fim
medium
{ "lang": "python", "repo": "mathurinm/sparse-ho", "path": "/sparse_ho/backward.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def get_only_jac_backward(X, alpha, list_beta, v, model, jac_v0=None): n_samples, n_features = X.shape is_sparse = issparse(X) if is_sparse: L = slinalg.norm(X, axis=0) ** 2 / n_samples else: L = norm(X, axis=0) ** 2 / n_samples v_ = v.copy() list_beta = np.asarray(...
code_fim
hard
{ "lang": "python", "repo": "mathurinm/sparse-ho", "path": "/sparse_ho/backward.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sanskruti01/Social-Book path: /Social Book App/dm.py import csv from getpass import getpass def main(): with open("users.txt","r") as file: fileReader=csv.reader(file) user_find(fileReader) file.close() <|fim_suffix|> user=input("Username:") for row in file: ...
code_fim
medium
{ "lang": "python", "repo": "sanskruti01/Social-Book", "path": "/Social Book App/dm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> else: print("Password does not match") main()<|fim_prefix|># repo: sanskruti01/Social-Book path: /Social Book App/dm.py import csv from getpass import getpass def main(): with open("users.txt","r") as file: fileReader=csv.reader(file) user_find(fileReader) f...
code_fim
hard
{ "lang": "python", "repo": "sanskruti01/Social-Book", "path": "/Social Book App/dm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self, module_id: ModuleID, hps: AppoLearnerHyperparameters ) -> None: """Update the target policy of each module with the current policy. Do that update via polyak averaging. Args: module_id: The module ID, whose target network(s) need to be updated. ...
code_fim
hard
{ "lang": "python", "repo": "ray-project/ray", "path": "/rllib/algorithms/appo/appo_learner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ray-project/ray path: /rllib/algorithms/appo/appo_learner.py import abc from dataclasses import dataclass from typing import Any, Mapping from ray.rllib.algorithms.impala.impala_learner import ( ImpalaLearner, ImpalaLearnerHyperparameters, ) from ray.rllib.core.rl_module.marl_module impo...
code_fim
hard
{ "lang": "python", "repo": "ray-project/ray", "path": "/rllib/algorithms/appo/appo_learner.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: trillionmonster/TensorFlowASR path: /tensorflow_asr/datasets/keras/asr_dataset.py # Copyright 2020 Huy Le Nguyen (@usimarit) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Licens...
code_fim
hard
{ "lang": "python", "repo": "trillionmonster/TensorFlowASR", "path": "/tensorflow_asr/datasets/keras/asr_dataset.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> features, input_length, label, label_length, \ prediction, prediction_length = tf.numpy_function( self.preprocess, inp=[example["audio"], example["transcript"]], Tout=[tf.float32, tf.int32, tf.int32, tf.int32, tf.int32, tf.int32] ...
code_fim
hard
{ "lang": "python", "repo": "trillionmonster/TensorFlowASR", "path": "/tensorflow_asr/datasets/keras/asr_dataset.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for D in D_list: # First convert each reference so it points to the right Device converted_references = [] for e in D.references: ref_device = cell_to_device[e.ref_cell] if isinstance(e, gdspy.CellReference): d...
code_fim
hard
{ "lang": "python", "repo": "aisichenko/gdsfactory", "path": "/gdsfactory/read/import_gds.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> else: D_list = [] cell_to_device = {} for c in gdsii_lib.cells.values(): D = Component(name=c.name) D.paths = c.paths D.polygons = c.polygons D.references = c.references D.name = c.name for label in c.label...
code_fim
hard
{ "lang": "python", "repo": "aisichenko/gdsfactory", "path": "/gdsfactory/read/import_gds.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aisichenko/gdsfactory path: /gdsfactory/read/import_gds.py from functools import lru_cache from pathlib import Path from typing import Callable, Optional, Union, cast import gdspy import numpy as np from omegaconf import OmegaConf from phidl.device_layout import CellArray, DeviceReference from ...
code_fim
hard
{ "lang": "python", "repo": "aisichenko/gdsfactory", "path": "/gdsfactory/read/import_gds.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>timeseries_preparator = TimeseriesPreparator(dku_config) input_df = input_dataset.get_dataframe(infer_with_pandas=False) df_prepared = timeseries_preparator.prepare_timeseries_dataframe(input_df) input_validator.check(df_prepared) start = perf_counter() logger.info("Decomposing time series...") transform...
code_fim
hard
{ "lang": "python", "repo": "dataiku/dss-plugin-timeseries-preparation", "path": "/custom-recipes/timeseries-preparation-decomposition/recipe.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dataiku/dss-plugin-timeseries-preparation path: /custom-recipes/timeseries-preparation-decomposition/recipe.py import sys from dku_config.utils import PluginCodeEnvError if sys.version_info.major == 2: raise PluginCodeEnvError("This custom recipe requires a Python 3 code env. You are using ...
code_fim
hard
{ "lang": "python", "repo": "dataiku/dss-plugin-timeseries-preparation", "path": "/custom-recipes/timeseries-preparation-decomposition/recipe.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from dataiku.customrecipe import get_recipe_config from io_utils import get_input_output, set_column_description from recipe_config_loading import get_decomposition_params from safe_logger import SafeLogger from timeseries_preparation.preparation import TimeseriesPreparator logger = SafeLogger("Timeseri...
code_fim
medium
{ "lang": "python", "repo": "dataiku/dss-plugin-timeseries-preparation", "path": "/custom-recipes/timeseries-preparation-decomposition/recipe.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: frey1186/Dsystem path: /blog/migrations/0008_auto_20170303_1200.py # -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2017-03-03 12:00 from __future__ import unicode_literals from django.db import migrations, models <|fim_suffix|> dependencies = [ ('blog', '0007_auto_20170226_080...
code_fim
medium
{ "lang": "python", "repo": "frey1186/Dsystem", "path": "/blog/migrations/0008_auto_20170303_1200.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('blog', '0007_auto_20170226_0802'), ] operations = [ migrations.AddField( model_name='comments', name='remote_host', field=models.CharField(blank=True, max_length=16, null=True, verbose_name='客户端地址'), ), mig...
code_fim
medium
{ "lang": "python", "repo": "frey1186/Dsystem", "path": "/blog/migrations/0008_auto_20170303_1200.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: carachancla/tfg path: /xpander_generation/python/jellyfishGen.py import matlab.engine import os import sys if len(sys.argv)!=3: print("Usage: jellyFishGen (int)numV (int)degree") exit(0) <|fim_suffix|># add ToRs Links path = os.path.dirname(os.path.abspath(__file__)) eng = matlab.engi...
code_fim
hard
{ "lang": "python", "repo": "carachancla/tfg", "path": "/xpander_generation/python/jellyfishGen.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># add ToRs Links path = os.path.dirname(os.path.abspath(__file__)) eng = matlab.engine.start_matlab() eng.addpath(path + '/../lib') eng.addpath(path + '/../expansion_algs') eng.addpath(path + '/../graph_generation') tf = eng.jellyfish(numV, degree) # add servers? topoFile.write("# Links \n") for x in r...
code_fim
hard
{ "lang": "python", "repo": "carachancla/tfg", "path": "/xpander_generation/python/jellyfishGen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DrewDennison/dlint path: /dlint/linters/bad_hashlib_use.py #!/usr/bin/env python from __future__ import ( absolute_import, division, print_function, unicode_literals, ) from .helpers import bad_module_attribute_use class BadHashlibUseLinter(bad_module_attribute_use.BadModuleAt...
code_fim
medium
{ "lang": "python", "repo": "DrewDennison/dlint", "path": "/dlint/linters/bad_hashlib_use.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """This linter looks for unsafe use of the Python "hashlib" module. Use of md5|sha1 is known to have hash collision weaknesses. """ off_by_default = False _code = 'DUO130' _error_tmpl = 'DUO130 insecure use of "hashlib" module' @property def illegal_module_attributes(self...
code_fim
medium
{ "lang": "python", "repo": "DrewDennison/dlint", "path": "/dlint/linters/bad_hashlib_use.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> eprint, getc, getf, geti, gets try: from .standard import getlong except Exception: pass finally: sys.path = path<|fim_prefix|># repo: vivekgupta1mg/miniprojectapp path: /env/lib/python3.8/site-packages/standard/__init__.py import os import sys try: path = sys.path[:] ...
code_fim
medium
{ "lang": "python", "repo": "vivekgupta1mg/miniprojectapp", "path": "/env/lib/python3.8/site-packages/standard/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vivekgupta1mg/miniprojectapp path: /env/lib/python3.8/site-packages/standard/__init__.py import os import sys try: path = sys.path[:] sys.path = [p for<|fim_suffix|>getlong except Exception: pass finally: sys.path = path<|fim_middle|> p in sys.path if p not in ("", os.ge...
code_fim
medium
{ "lang": "python", "repo": "vivekgupta1mg/miniprojectapp", "path": "/env/lib/python3.8/site-packages/standard/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nkbyrne/pyplus path: /class5/ex1.py #!/usr/bin/env python from jinja2 import Template template = """router bgp {{ local_as }} neighbor {{ peer1_ip }} remote-as {{ peer1_ip_as }} update-source loopback99 ebgp-multihop 2 address-family ipv4 unicast neighbor {{ peer2_ip }} remote-a...
code_fim
medium
{ "lang": "python", "repo": "nkbyrne/pyplus", "path": "/class5/ex1.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>j2_template = Template(template) output = j2_template.render(**my_vars) print(output)<|fim_prefix|># repo: nkbyrne/pyplus path: /class5/ex1.py #!/usr/bin/env python from jinja2 import Template template = """router bgp {{ local_as }} neighbor {{ peer1_ip }} remote-as {{ peer1_ip_as }} update-sourc...
code_fim
medium
{ "lang": "python", "repo": "nkbyrne/pyplus", "path": "/class5/ex1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ("standardpages", "0010_image_block"), ("standardpages", "0010_button_block"), ] operations = []<|fim_prefix|># repo: nimasmi/buckinghamshire-council path: /bc/standardpages/migrations/0011_merge_20200331_1633.py # Generated by Django 2.2.10 on 2020-03-31 15...
code_fim
easy
{ "lang": "python", "repo": "nimasmi/buckinghamshire-council", "path": "/bc/standardpages/migrations/0011_merge_20200331_1633.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ("standardpages", "0010_image_block"), ("standardpages", "0010_button_block"), ] operations = []<|fim_prefix|># repo: nimasmi/buckinghamshire-council path: /bc/standardpages/migrations/0011_merge_20200331_1633.py # Gen...
code_fim
easy
{ "lang": "python", "repo": "nimasmi/buckinghamshire-council", "path": "/bc/standardpages/migrations/0011_merge_20200331_1633.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nimasmi/buckinghamshire-council path: /bc/standardpages/migrations/0011_merge_20200331_1633.py # Generated by Django 2.2.10 on 2020-03-31 15:33 <|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ("standardpages", "0010_image_block"), ("standardpages", "00...
code_fim
easy
{ "lang": "python", "repo": "nimasmi/buckinghamshire-council", "path": "/bc/standardpages/migrations/0011_merge_20200331_1633.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: benjaminxscott/goldlist path: /db_seed.py from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from db_setup import Base, Listing, Location engine = create_engine('postgres://catalog:supersecret@localhost/listings') Base.metadata.bind = engine DBSession = sessionmaker(b...
code_fim
medium
{ "lang": "python", "repo": "benjaminxscott/goldlist", "path": "/db_seed.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>listings.append( Listing (location = store, name = "Gold Glasses", description = "worn by the man himself", price = 92) ) listings.append( Listing (location = pawn, name = 'Lock of Hair', price = 18) ) listings.append( Listing (location = pawn, name = "Samuel L Jackson's arm", description = "An arm foun...
code_fim
medium
{ "lang": "python", "repo": "benjaminxscott/goldlist", "path": "/db_seed.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># ----- listings = [] listings.append( Listing (location = store, name = "Gold Glasses", description = "worn by the man himself", price = 92) ) listings.append( Listing (location = pawn, name = 'Lock of Hair', price = 18) ) listings.append( Listing (location = pawn, name = "Samuel L Jackson's arm", des...
code_fim
medium
{ "lang": "python", "repo": "benjaminxscott/goldlist", "path": "/db_seed.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='users', name='token', field=models.CharField(default=b'00000000', max_length=50, verbose_name=b'oauth_token'), ), migrations.AddField( model_name='users', name='token_sec...
code_fim
hard
{ "lang": "python", "repo": "claudiaw111/cs411project", "path": "/levelup/app/migrations/0002_auto_20151125_1426.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: claudiaw111/cs411project path: /levelup/app/migrations/0002_auto_20151125_1426.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AddField( ...
code_fim
hard
{ "lang": "python", "repo": "claudiaw111/cs411project", "path": "/levelup/app/migrations/0002_auto_20151125_1426.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': main()<|fim_prefix|># repo: ClockworkNet/svyn path: /svyn_runner.py #!/usr/bin/env python """Convenience wrapper for running svyn directly from source tree.""" <|fim_middle|>from svyn.svyn import main
code_fim
easy
{ "lang": "python", "repo": "ClockworkNet/svyn", "path": "/svyn_runner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ClockworkNet/svyn path: /svyn_runner.py #!/usr/bin/env python """Convenience wrapper for running svyn directly from source tree.""" <|fim_suffix|> if __name__ == '__main__': main()<|fim_middle|>from svyn.svyn import main
code_fim
easy
{ "lang": "python", "repo": "ClockworkNet/svyn", "path": "/svyn_runner.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aiida-vasp/aiida-vasp path: /aiida_vasp/utils/delegates.py """ Delegate types. --------------- Module containing decorators and classes implementing delegate types. """ from functools import update_wrapper def delegate_method_kwargs(prefix='_init_with_'): """ Get a kwargs delegating de...
code_fim
medium
{ "lang": "python", "repo": "aiida-vasp/aiida-vasp", "path": "/aiida_vasp/utils/delegates.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def decorator(meth): """Decorate a class method to delegate kwargs.""" def wrapper(*args, **kwargs): for kwarg, value in kwargs.items(): getattr(args[0], prefix + kwarg)(value) meth(*args, **kwargs) update_wrapper(wrapper, meth) ...
code_fim
medium
{ "lang": "python", "repo": "aiida-vasp/aiida-vasp", "path": "/aiida_vasp/utils/delegates.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> update_wrapper(wrapper, meth) return wrapper return decorator<|fim_prefix|># repo: aiida-vasp/aiida-vasp path: /aiida_vasp/utils/delegates.py """ Delegate types. --------------- Module containing decorators and classes implementing delegate types. """ from functools import update_wr...
code_fim
hard
{ "lang": "python", "repo": "aiida-vasp/aiida-vasp", "path": "/aiida_vasp/utils/delegates.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jay-johnson/redten-python path: /redten/shellprinting.py GRAY_COLOR = '\x1b[37m' BLUE_COLOR = '\x1b[36m' PURPLE_COLOR = '\x1b[35m' YELLOW_COLOR = '\x1b[33m' GREEN_COLOR = '\x1b[32m' FAIL_COLOR = '\x1b[31m' END_COLOR = '\x1b[0m' def blue...
code_fim
hard
{ "lang": "python", "repo": "jay-johnson/redten-python", "path": "/redten/shellprinting.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def lg(msg, color_num=6): if color_num == 0: red_print(msg) elif color_num == 1: blue_print(msg) elif color_num == 2: yellow_print(msg) elif color_num == 3: purple_print(msg) elif color_num == 4: gray_print(msg) elif color_num == 5: g...
code_fim
hard
{ "lang": "python", "repo": "jay-johnson/redten-python", "path": "/redten/shellprinting.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def anmt(msg): yellow_print(msg) # end of anmt def info(msg): lg(msg) # end of info def mark(msg): lg("", 6) anmt("------------------") boom(msg) anmt("------------------") lg("", 6) # end of mark def lg(msg, color_num=6): if color_num == 0: red_print(msg) ...
code_fim
hard
{ "lang": "python", "repo": "jay-johnson/redten-python", "path": "/redten/shellprinting.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mrooney/django-supervisor path: /djsupervisor/templatetags/djtags.py import os from django import template register = template.Library() <|fim_suffix|> templated_path = full_path + '.templated' open(templated_path, 'w').write(templated) return templated_path<|fim_middle|>project_dir ...
code_fim
hard
{ "lang": "python", "repo": "mrooney/django-supervisor", "path": "/djsupervisor/templatetags/djtags.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> templated_path = full_path + '.templated' open(templated_path, 'w').write(templated) return templated_path<|fim_prefix|># repo: mrooney/django-supervisor path: /djsupervisor/templatetags/djtags.py import os from django import template register = template.Library() project_dir = None ctx = N...
code_fim
medium
{ "lang": "python", "repo": "mrooney/django-supervisor", "path": "/djsupervisor/templatetags/djtags.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@register.filter def templated(template_path): full_path = os.path.join(project_dir, template_path) t = template.Template(open(full_path).read()) templated = t.render(template.Context(ctx)).encode('ascii') templated_path = full_path + '.templated' open(templated_path, 'w').write(templ...
code_fim
easy
{ "lang": "python", "repo": "mrooney/django-supervisor", "path": "/djsupervisor/templatetags/djtags.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HamidL/AMMM_Project path: /GreedyGRASP/ValidateInputData.py # Validate instance attributes read from a DAT file. # It validates the structure of the parameters read from the DAT file. # It does not validate that the instance is feasible or not. # Use Problem.checkInstance() function to validate t...
code_fim
hard
{ "lang": "python", "repo": "HamidL/AMMM_Project", "path": "/GreedyGRASP/ValidateInputData.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for value in cap: if (not isinstance(value, int) or (value < 0)): raise Exception( 'Invalid parameter value(%s) in cap. Should be an integer greater or equal than zero.' % str(value)) # Validate eurosMin eurosMin = data.eurosMin ...
code_fim
hard
{ "lang": "python", "repo": "HamidL/AMMM_Project", "path": "/GreedyGRASP/ValidateInputData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: justanr/uchan path: /uchan/lib/service/board_service.py import string from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import lazyload from sqlalchemy.orm.exc import NoResultFound from uchan import g from uchan.lib import ArgumentError from uchan.lib.configs import BoardConfig from ...
code_fim
hard
{ "lang": "python", "repo": "justanr/uchan", "path": "/uchan/lib/service/board_service.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def add_board(self, board): if not self.check_board_name_validity(board.name): raise ArgumentError('Invalid board name') db = get_db() board_config = BoardConfig() board.config_id = g.config_service.save_config(board_config, None).id db.add(board)...
code_fim
hard
{ "lang": "python", "repo": "justanr/uchan", "path": "/uchan/lib/service/board_service.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LBL-EESA/TECA path: /doc/source/stats_callbacks.py from teca import * import numpy as np import sys def get_request_callback(rank, var_names): def request(port, md_in, req_in): sys.stderr.write('descriptive_stats::request MPI %d\n'%(rank)) req = teca_metadata(req_in) ...
code_fim
medium
{ "lang": "python", "repo": "LBL-EESA/TECA", "path": "/doc/source/stats_callbacks.py", "mode": "psm", "license": "BSD-3-Clause-LBNL", "source": "the-stack-v2" }
<|fim_suffix|> table = teca_table.New() table.declare_columns(['step','time'], ['ul','d']) table << mesh.get_time_step() << mesh.get_time() for var_name in var_names: table.declare_columns(['min '+var_name, 'avg '+var_name, \ 'max '+var_name, 'std '+var_name,...
code_fim
hard
{ "lang": "python", "repo": "LBL-EESA/TECA", "path": "/doc/source/stats_callbacks.py", "mode": "spm", "license": "BSD-3-Clause-LBNL", "source": "the-stack-v2" }
<|fim_prefix|># repo: EC-Earth/ece2cmor3 path: /test/cmor_source_test.py import logging import unittest from testfixtures import LogCapture from ece2cmor3.cmor_source import ifs_source, netcdf_source, grib_code logging.basicConfig(level=logging.DEBUG) class cmor_source_tests(unittest.TestCase): @staticmethod ...
code_fim
hard
{ "lang": "python", "repo": "EC-Earth/ece2cmor3", "path": "/test/cmor_source_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> src = ifs_source.read("88", "(var144==0)*sqrt(sq(var131)+sq(var132))", mask_expr="var172>0.5") assert src.get_grib_code() == grib_code(88, 128) assert set(src.get_root_codes()) == {grib_code(144, 128), grib_code(131, 128), grib_code(132, 128), ...
code_fim
hard
{ "lang": "python", "repo": "EC-Earth/ece2cmor3", "path": "/test/cmor_source_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BigNianNGS/AI path: /python_base/write_file.py filename = 'test_write.txt' # a 追加 w 重写 with open(filename,'a') as file_o<|fim_suffix|>ht\n') file_object.write('dierhang\n')<|fim_middle|>bject: file_object.write('you are rig
code_fim
easy
{ "lang": "python", "repo": "BigNianNGS/AI", "path": "/python_base/write_file.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>bject: file_object.write('you are right\n') file_object.write('dierhang\n')<|fim_prefix|># repo: BigNianNGS/AI path: /python_base/write_file.py filename = 'test_write.txt' # a 追加 <|fim_middle|>w 重写 with open(filename,'a') as file_o
code_fim
easy
{ "lang": "python", "repo": "BigNianNGS/AI", "path": "/python_base/write_file.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ht\n') file_object.write('dierhang\n')<|fim_prefix|># repo: BigNianNGS/AI path: /python_base/write_file.py filename = 'test_write.txt' # a 追加 w 重写 with open(filename,'a') as file_o<|fim_middle|>bject: file_object.write('you are rig
code_fim
easy
{ "lang": "python", "repo": "BigNianNGS/AI", "path": "/python_base/write_file.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Raekon/pythonfiles path: /on-demand.py from PIL import Image import threading import ftplib import time import os import datetime import guizero width_text="" def update_size(width): picture_width=int(float(width)) picture_height=int(picture_width//1.33) print(int(picture_height)) ...
code_fim
medium
{ "lang": "python", "repo": "Raekon/pythonfiles", "path": "/on-demand.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def videoUpload(): pass def videoNoUpload(): pass app=guizero.App(title="Surveillance tools") menu=guizero.MenuBar(app,toplevel=["Photo", "Video"],options=[[["With upload",photoUpload],["Without upload",photoNoUpload]],[["with upload",videoUpload],["Without upload",videoNoUpload]]]) picsize=gui...
code_fim
hard
{ "lang": "python", "repo": "Raekon/pythonfiles", "path": "/on-demand.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Seraphid/padchest path: /read_data.py # Load the Pandas libraries with alias 'pd' import math import pandas as pd import ast import matplotlib.pyplot as plt LABELS_COL=31 #Column number of the column with labels # Read data from file 'filename.csv' # (in the same directory that your python pr...
code_fim
medium
{ "lang": "python", "repo": "Seraphid/padchest", "path": "/read_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>plt.plot(range(1,len(freqs)+1), freqs) plt.show() plt.plot(range(10,len(freqs)+1), freqs[9:]) plt.show() plt.plot(range(100,len(freqs)+1), freqs[99:]) plt.show()<|fim_prefix|># repo: Seraphid/padchest path: /read_data.py # Load the Pandas libraries with alias 'pd' import math import pandas as pd impo...
code_fim
hard
{ "lang": "python", "repo": "Seraphid/padchest", "path": "/read_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kartikeyangupta/Python-photoshop path: /FaceDetection/face_detection_camera.py import cv2 cascade_path = "./haarcascade_frontalface_alt.xml" color = (255, 255, 255) # color of rectangle for face detection cam = cv2.VideoCapture(0) count=0 <|fim_suffix|> count=0 cv2.imshow('face d...
code_fim
hard
{ "lang": "python", "repo": "kartikeyangupta/Python-photoshop", "path": "/FaceDetection/face_detection_camera.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if len(facerect) > 0: for rect in facerect: cv2.rectangle(image, tuple(rect[0:2]),tuple(rect[0:2]+rect[2:4]), color, thickness=2) count=0 cv2.imshow('face detector', image) cam.release() cv2.destroyAllWindows()<|fim_prefix|># repo: kartikeyangupta/Pyth...
code_fim
hard
{ "lang": "python", "repo": "kartikeyangupta/Python-photoshop", "path": "/FaceDetection/face_detection_camera.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kamronald/pymatgen path: /tests/entries/test_exp_entries.py from __future__ import annotations import json import unittest from monty.json import MontyDecoder from pytest import approx <|fim_suffix|> assert self.entry.energy == approx(-825.5) def test_as_from_dict(self): d ...
code_fim
hard
{ "lang": "python", "repo": "kamronald/pymatgen", "path": "/tests/entries/test_exp_entries.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_energy(self): assert self.entry.energy == approx(-825.5) def test_as_from_dict(self): d = self.entry.as_dict() e = ExpEntry.from_dict(d) assert e.energy == approx(-825.5) def test_str(self): assert str(self.entry) is not None<|fim_prefix|># re...
code_fim
hard
{ "lang": "python", "repo": "kamronald/pymatgen", "path": "/tests/entries/test_exp_entries.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not (self.expr_list or self.expr_tensor): self.expr_list = [self[i] for i in range(len(self))] return super().__iter__() def __getitem__(self, key): if self.expr_list or self.expr_tensor: return super().__getitem__(key) else: return torch.tensor( np.array([se...
code_fim
hard
{ "lang": "python", "repo": "LHWsleeve/xnmt", "path": "/xnmt/expression_seqs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class BaseReversedExpressionSequence(BaseExpressionSequence): def __init__(self, base_expr_seq): self.base_expr_seq = base_expr_seq self.expr_tensor = None self.expr_list = None self.expr_transposed_tensor = None if base_expr_seq.mask is None: self.mask = None else: s...
code_fim
hard
{ "lang": "python", "repo": "LHWsleeve/xnmt", "path": "/xnmt/expression_seqs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: LHWsleeve/xnmt path: /xnmt/expression_seqs.py [tt.Tensor]] = None, expr_tensor: Optional[tt.Tensor] = None, expr_transposed_tensor: Optional[tt.Tensor] = None, mask: Optional['batchers.Mask'] = None, tensor_type = None) -> None: """C...
code_fim
hard
{ "lang": "python", "repo": "LHWsleeve/xnmt", "path": "/xnmt/expression_seqs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DerWeh/gftools path: /gftool/statistics.py """Functionality related or derived from the Fermi and Bose statistics. Per default, the functions refer to Fermi statistics, a tailing '_b' indicates Bose statistics instead. """ from warnings import catch_warnings, filterwarnings import numpy as np ...
code_fim
hard
{ "lang": "python", "repo": "DerWeh/gftools", "path": "/gftool/statistics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> References ---------- .. [ozaki2007] Ozaki, Taisuke. Continued Fraction Representation of the Fermi-Dirac Function for Large-Scale Electronic Structure Calculations. Physical Review B 75, no. 3 (January 23, 2007): 035123. https://doi.org/10.1103/PhysRevB.75.035123. .....
code_fim
hard
{ "lang": "python", "repo": "DerWeh/gftools", "path": "/gftool/statistics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> See Also -------- fermi_fct_inv : The inverse of the Fermi function for real arguments. Examples -------- >>> eps = np.linspace(-15, 15, num=501) >>> fermi = gt.fermi_fct(eps, beta=1.0) >>> import matplotlib.pyplot as plt >>> _ = plt.plot(eps, fermi) >>> _ = plt.x...
code_fim
hard
{ "lang": "python", "repo": "DerWeh/gftools", "path": "/gftool/statistics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Aadit-Bhojgi/Automated-Attendance-System path: /RowMarking.py import cv2 as cv class RowMarking: def __init__(self, image, path): self.path = path self.image = image <|fim_suffix|> img = cv.imread(self.image) gray = cv.cvtColor(img, 6) thresh = cv.thr...
code_fim
hard
{ "lang": "python", "repo": "Aadit-Bhojgi/Automated-Attendance-System", "path": "/RowMarking.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> img = cv.imread(self.image) gray = cv.cvtColor(img, 6) thresh = cv.threshold(gray, thresh=200, maxval=255, type=cv.THRESH_BINARY_INV)[1] # Find contours on the threshold image contours = cv.findContours(thresh, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)[1] fo...
code_fim
hard
{ "lang": "python", "repo": "Aadit-Bhojgi/Automated-Attendance-System", "path": "/RowMarking.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: content = open('./docs/openapi.yaml', 'r') return Response(content, mimetype="text/yaml") except FileNotFoundError: return Response(status=404)<|fim_prefix|># repo: suricats/surirobot-api-emotions path: /api/server.py from flask import Flask, redirect, Response from f...
code_fim
medium
{ "lang": "python", "repo": "suricats/surirobot-api-emotions", "path": "/api/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: suricats/surirobot-api-emotions path: /api/server.py from flask import Flask, redirect, Response from flask_swagger_ui import get_swaggerui_blueprint from api.microsoft.views import emo_microsoft <|fim_suffix|> @app.route('/docs/openapi.yaml') def swagger_file(): try: content = open(...
code_fim
hard
{ "lang": "python", "repo": "suricats/surirobot-api-emotions", "path": "/api/server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SupriyoDam/DS-450-python path: /Dynamic Programming/Cutting a Rod.py class BottomUp: def rod_cutting(self, price, n, N): self.dp = [[0] * (N+1) for x in range(n+1)] length = [x for x in range(1, n+1)] return self.rod_cutting_util(price, length, n, N) <|fim_suffix|>if ...
code_fim
hard
{ "lang": "python", "repo": "SupriyoDam/DS-450-python", "path": "/Dynamic Programming/Cutting a Rod.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.dp[n][N] if __name__ == '__main__': price = [1,5,8,9,10,17,17,20] N = 8 t = BottomUp() print(t.rod_cutting(price, len(price), N))<|fim_prefix|># repo: SupriyoDam/DS-450-python path: /Dynamic Programming/Cutting a Rod.py class BottomUp: def rod_cutting(self, price...
code_fim
hard
{ "lang": "python", "repo": "SupriyoDam/DS-450-python", "path": "/Dynamic Programming/Cutting a Rod.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> serialized = super().serialize() serialized['frame_deltas'] = [(stamp, pose.serialize()) for stamp, pose in self.frame_deltas.items()] serialized['ground_truth_trajectory'] = [(stamp, pose.serialize()) for stamp, pose in self.ground_...
code_fim
hard
{ "lang": "python", "repo": "jskinn/robot-vision-experiment-framework", "path": "/trials/visual_odometry/visual_odometry_result.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def get_computed_camera_poses(self): """ Get the computed poses, as a map from timestamp to absolute pose This assumes that the first frame is the origin, and builds the trajectory from there, assuming :return: """ pairs = sorted((timestamp, pose...
code_fim
hard
{ "lang": "python", "repo": "jskinn/robot-vision-experiment-framework", "path": "/trials/visual_odometry/visual_odometry_result.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jskinn/robot-vision-experiment-framework path: /trials/visual_odometry/visual_odometry_result.py # Copyright (c) 2017, John Skinner import core.trial_result import util.transform as tf class VisualOdometryResult(core.trial_result.TrialResult): """ The results of running visual odometry ...
code_fim
hard
{ "lang": "python", "repo": "jskinn/robot-vision-experiment-framework", "path": "/trials/visual_odometry/visual_odometry_result.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def get_reports(self) -> typing.Iterator[dict]: response = API_AnalyticsReporting(self.config, self.auth).reports().batchGet(body=self.body).execute() while response: next_body = { "reportRequests":[], "useResourceQuotas":self.body["useResourceQuotas"] } for i...
code_fim
hard
{ "lang": "python", "repo": "google/starthinker", "path": "/starthinker/util/ga.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: google/starthinker path: /starthinker/util/ga.py ########################################################################### # # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # Y...
code_fim
hard
{ "lang": "python", "repo": "google/starthinker", "path": "/starthinker/util/ga.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_dates(self) -> list: report_dates = [] for report in self.body['reportRequests']: dates = [] for date_range in report['dateRanges']: date_start = self.get_date(date_range['startDate']) date_end = self.get_date(date_range['endDate']) while date_start ...
code_fim
hard
{ "lang": "python", "repo": "google/starthinker", "path": "/starthinker/util/ga.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> df = pd.DataFrame({"id": data[:, 0], "text": data[:, 1]}) inOp1 = dataframeToOperator(df, schemaStr='id long, text string', op_type='batch') op = RegexTokenizer().setSelectedCol("text").setGaps(False).setToLowerCase(True).setOutputCol( "token").setPattern("\\w+") ...
code_fim
hard
{ "lang": "python", "repo": "vacaly/Alink", "path": "/python/src/main/python/pyalink/alink/tests/examples/pipeline/test_regex_tokenizer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vacaly/Alink path: /python/src/main/python/pyalink/alink/tests/examples/pipeline/test_regex_tokenizer.py import unittest from pyalink.alink import * class TestPinjiu(unittest.TestCase): def test_regex_tokenizer(self): <|fim_suffix|> df = pd.DataFrame({"id": data[:, 0], "text": data...
code_fim
hard
{ "lang": "python", "repo": "vacaly/Alink", "path": "/python/src/main/python/pyalink/alink/tests/examples/pipeline/test_regex_tokenizer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> import numpy as np import pandas as pd data = np.array([ [0, 'That is an English Book!'], [1, 'Do you like math?'], [2, 'Have a good day!'] ]) df = pd.DataFrame({"id": data[:, 0], "text": data[:, 1]}) inOp1 = dataframeTo...
code_fim
medium
{ "lang": "python", "repo": "vacaly/Alink", "path": "/python/src/main/python/pyalink/alink/tests/examples/pipeline/test_regex_tokenizer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: logicalclocks/hops-util-py path: /hops/experiment_impl/parallel/random_search.py """ Random Search implementation """ from hops.experiment_impl.util import experiment_utils from hops import devices, tensorboard, hdfs from hops.experiment import Direction import threading import six import time ...
code_fim
hard
{ "lang": "python", "repo": "logicalclocks/hops-util-py", "path": "/hops/experiment_impl/parallel/random_search.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> tb_hdfs_path = '' hdfs_exec_logdir = '' t = threading.Thread(target=devices._print_periodic_gpu_utilization) if devices.get_num_gpus() > 0: t.start() try: #Arguments if args_dict: param_string, params, args = exp...
code_fim
hard
{ "lang": "python", "repo": "logicalclocks/hops-util-py", "path": "/hops/experiment_impl/parallel/random_search.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> hp_names = random_dict.keys() concatenated_hp_combs_arr = [] for index in range(samples): separated_hp_comb = "" for hp in hp_names: separated_hp_comb = separated_hp_comb + str(random_dict[hp][index]) + "&" concatenated_hp_combs_arr.append(separated_hp_comb)...
code_fim
hard
{ "lang": "python", "repo": "logicalclocks/hops-util-py", "path": "/hops/experiment_impl/parallel/random_search.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert torch.all( torch.isclose( predictions, torch.tensor( [[-15.5485, -22.0652], [-21.3081, -18.0292]], ), atol=1e-01, ) ) @staticmethod def test_prototypical_networks_rai...
code_fim
hard
{ "lang": "python", "repo": "sicara/easy-few-shot-learning", "path": "/easyfsl/tests/methods/prototypical_networks_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> query_images = torch.randn((4, 3, 224, 224)) model(query_images) @staticmethod @pytest.mark.parametrize( ( "support_set_path", "expected_prototypes", ), [ ( "easyfsl/tests/datasets/resources/unbalanced_sup...
code_fim
hard
{ "lang": "python", "repo": "sicara/easy-few-shot-learning", "path": "/easyfsl/tests/methods/prototypical_networks_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sicara/easy-few-shot-learning path: /easyfsl/tests/methods/prototypical_networks_test.py import pytest import torch from torch import nn from easyfsl.datasets import SupportSetFolder from easyfsl.methods import PrototypicalNetworks class TestPrototypicalNetworksPipeline: @staticmethod ...
code_fim
hard
{ "lang": "python", "repo": "sicara/easy-few-shot-learning", "path": "/easyfsl/tests/methods/prototypical_networks_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: astrofrog/glue path: /glue/core/data_exporters/qt/dialog.py from __future__ import absolute_import, division, print_function from qtpy import compat from glue import config <|fim_suffix|> exporters = {} for e in config.data_exporter: if e.extension == '': fltr = "{0} ...
code_fim
medium
{ "lang": "python", "repo": "astrofrog/glue", "path": "/glue/core/data_exporters/qt/dialog.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> filename = str(filename) if not filename: return exporters[fltr](data, filename)<|fim_prefix|># repo: astrofrog/glue path: /glue/core/data_exporters/qt/dialog.py from __future__ import absolute_import, division, print_function from qtpy import compat from glue import config def ex...
code_fim
hard
{ "lang": "python", "repo": "astrofrog/glue", "path": "/glue/core/data_exporters/qt/dialog.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> filters = ';;'.join(sorted(exporters)) filename, fltr = compat.getsavefilename(caption="Choose an output filename", filters=filters) filename = str(filename) if not filename: return exporters[fltr](data, filename)<|fim_prefix|># re...
code_fim
hard
{ "lang": "python", "repo": "astrofrog/glue", "path": "/glue/core/data_exporters/qt/dialog.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: opencobra/optlang path: /src/optlang/tests/test_inspyred_interface.py import unittest try: import inspyred from inspyred import benchmarks from optlang.inspyred_interface import Model, Objective, Variable def make_individual(evaluator): def _(candidate): r...
code_fim
hard
{ "lang": "python", "repo": "opencobra/optlang", "path": "/src/optlang/tests/test_inspyred_interface.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self): self.model = Model(algorithm='PSO') self.model.configuration.terminator = inspyred.ec.terminators.generation_termination x = Variable('x', lb=0, ub=2) y = Variable('y', lb=0, ub=2) rosenbrock_obj = Objective((1 - x) ** 2...
code_fim
hard
{ "lang": "python", "repo": "opencobra/optlang", "path": "/src/optlang/tests/test_inspyred_interface.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> best = max(final_pop) self.assertAlmostEqual(best.fitness, 0) def test_pso(self): self.model.algorithm = 'PSO' self.model.configuration.max_generations = 100 final_pop = self.model.optimize() best = max(final_pop) ...
code_fim
hard
{ "lang": "python", "repo": "opencobra/optlang", "path": "/src/optlang/tests/test_inspyred_interface.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cadia-lvl/LOBE path: /migrations/versions/9af187822adc_.py """empty message Revision ID: 9af187822adc Revises: 75287632e523 Create Date: 2020-07-07 18:10:14.818730 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '9af187822adc' down_revisi...
code_fim
hard
{ "lang": "python", "repo": "cadia-lvl/LOBE", "path": "/migrations/versions/9af187822adc_.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ### op.drop_table('progression_icon') # ### end Alembic commands ###<|fim_prefix|># repo: cadia-lvl/LOBE path: /migrations/versions/9af187822adc_.py """empty message Revision ID: 9af187822adc Revises: 75287632e523 Create Date: 2020-07...
code_fim
hard
{ "lang": "python", "repo": "cadia-lvl/LOBE", "path": "/migrations/versions/9af187822adc_.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>en(h)) print(' '.join(str(e[1]) for e in sorted(h.values())))<|fim_prefix|># repo: cielavenir/procon path: /hackerrank/word-order.py #!/usr/bin/python import sys if sys.version_info[0]>=3: raw_input=input h={} for i in range(int(raw_input())): s=raw_inp<|fim_middle|>ut().rstrip() if s not in h: h[s]=[i...
code_fim
medium
{ "lang": "python", "repo": "cielavenir/procon", "path": "/hackerrank/word-order.py", "mode": "spm", "license": "0BSD", "source": "the-stack-v2" }