text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: Kyria/LazyBlacksmith path: /lazyblacksmith/views/industry/price.py # -*- encoding: utf-8 -*- import config from flask import Blueprint from flask import render_template from lazyblacksmith.models import Region <|fim_suffix|> regions = Region.query.filter( Region.id.in_(config.ESI_RE...
code_fim
medium
{ "lang": "python", "repo": "Kyria/LazyBlacksmith", "path": "/lazyblacksmith/views/industry/price.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return render_template('price/price.html', **{ 'regions': regions, })<|fim_prefix|># repo: Kyria/LazyBlacksmith path: /lazyblacksmith/views/industry/price.py # -*- encoding: utf-8 -*- import config from flask import Blueprint from flask import render_template from lazyblacksmith.models ...
code_fim
medium
{ "lang": "python", "repo": "Kyria/LazyBlacksmith", "path": "/lazyblacksmith/views/industry/price.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: eltonplima/django-project-template path: /{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/apps.py from django.apps import AppConfig from django.core import checks <|fim_suffix|> # Import and register the system checks checks.register(check_producti...
code_fim
hard
{ "lang": "python", "repo": "eltonplima/django-project-template", "path": "/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/apps.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> class {{cookiecutter.repo_name|snake_to_pascal_case}}Config(AppConfig): name = "{{cookiecutter.repo_name}}" verbose_name = "{{cookiecutter.project_title}}" def ready(self): # Import and register the system checks checks.register(check_production_settings) checks.regis...
code_fim
medium
{ "lang": "python", "repo": "eltonplima/django-project-template", "path": "/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/apps.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|>_list_unsigned_byte_length_5 import NistschemaSvIvListUnsignedByteLength5 __all__ = [ "NistschemaSvIvListUnsignedByteLength5", ]<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/nist_data/list_pkg/unsigned_byte/schema_instance/nistschema_sv_iv_list_unsigned_byte_length_5_xsd/__init__...
code_fim
medium
{ "lang": "python", "repo": "tefra/xsdata-w3c-tests", "path": "/output/models/nist_data/list_pkg/unsigned_byte/schema_instance/nistschema_sv_iv_list_unsigned_byte_length_5_xsd/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/nist_data/list_pkg/unsigned_byte/schema_instance/nistschema_sv_iv_list_unsigned_byte_length_5_xsd/__init__.py from output.models.nist_data.list_pkg.unsigned_byte.schema_instance.nistschema_sv_iv_list_unsigned_byte_length_5_xsd.nistschema_sv_iv<|fim_suff...
code_fim
medium
{ "lang": "python", "repo": "tefra/xsdata-w3c-tests", "path": "/output/models/nist_data/list_pkg/unsigned_byte/schema_instance/nistschema_sv_iv_list_unsigned_byte_length_5_xsd/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def send_dropdown( channel: discord.TextChannel | discord.Thread, content: str = "", ): view = DropdownView() message = await channel.send(content=content, view=view) timed_out = await view.wait() if message: if timed_out and len(message.embeds) > 0: embe...
code_fim
hard
{ "lang": "python", "repo": "Lazyuki/DiscordStatsBotPython", "path": "/cogs/utils/dropdown.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lazyuki/DiscordStatsBotPython path: /cogs/utils/dropdown.py from typing import List, Optional from discord import ui import discord import asyncio from .resolver import has_any_role NJ_ID = 196765998706196480 FJ_ID = 270391106955509770 NE_ID = 197100137665921024 FE_ID = 241997079168155649 OL_ID ...
code_fim
medium
{ "lang": "python", "repo": "Lazyuki/DiscordStatsBotPython", "path": "/cogs/utils/dropdown.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @ui.select(placeholder="Language Role", options=options) async def select(self, interaction: discord.Interaction, menu: discord.ui.Select): await interaction.response.send_message( f"You have chosen <@&{menu.values[0]}>", ephemeral=True ) async def interaction_chec...
code_fim
medium
{ "lang": "python", "repo": "Lazyuki/DiscordStatsBotPython", "path": "/cogs/utils/dropdown.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bmix/javaconfig path: /test/test_saxon9he.py import os import pytest from .context import javaconfig @pytest.fixture() def s9he_config(request): xmlc = os.path.join(os.path.dirname(__file__), 'xmlconfig.xml') jc = javaconfig.JavaConfigurations(config=xmlc).config("saxon-9he") return ...
code_fim
hard
{ "lang": "python", "repo": "bmix/javaconfig", "path": "/test/test_saxon9he.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert s9he_config.get_property("class") == "net.sf.saxon.Transform" def test_arg(self, s9he_config): assert type(s9he_config.get_property("arg")) is list arg = s9he_config.get_property("arg") assert len(arg) == 4 assert arg[0]["name"] == "x" assert arg...
code_fim
medium
{ "lang": "python", "repo": "bmix/javaconfig", "path": "/test/test_saxon9he.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: draplater/hrg-parser path: /conll_reader.py from __future__ import unicode_literals import codecs from collections import namedtuple import sys import six from typing import Union, Optional, List from namedlist import namedlist class CoNLLNode(object): @classmethod def from_line(cl...
code_fim
hard
{ "lang": "python", "repo": "draplater/hrg-parser", "path": "/conll_reader.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class SimpleSentence(BaseConLLSentence): NodeType = SimpleNode class CoNLL06Sentence(BaseConLLSentence): NodeType = CoNLL06Node class SDPSentence(BaseConLLSentence): NodeType = SDPNode @classmethod def get_sentence(cls, file_object): sentence = cls() for i in file...
code_fim
hard
{ "lang": "python", "repo": "draplater/hrg-parser", "path": "/conll_reader.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: influxdata/influxdb-client-python path: /influxdb_client/service/restore_service.py """ # noqa: E501 local_var_params, path_params, query_params, header_params, body_params = \ self._post_restore_bucket_id_prepare(bucket_id, body, **kwargs) # noqa: E501 return self...
code_fim
hard
{ "lang": "python", "repo": "influxdata/influxdb-client-python", "path": "/influxdb_client/service/restore_service.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> body_params = None if 'body' in local_var_params: body_params = local_var_params['body'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` ...
code_fim
hard
{ "lang": "python", "repo": "influxdata/influxdb-client-python", "path": "/influxdb_client/service/restore_service.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: influxdata/influxdb-client-python path: /influxdb_client/service/restore_service.py rom a backup.. This method makes an asynchronous HTTP request. :param async_req bool :param BucketMetadataManifest bucket_metadata_manifest: Metadata manifest for a bucket. (required) ...
code_fim
hard
{ "lang": "python", "repo": "influxdata/influxdb-client-python", "path": "/influxdb_client/service/restore_service.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> hbox = QHBoxLayout(self) hbox.addWidget(self.lbl) self.setLayout(hbox) self.move(100, 100) self.setWindowTitle('Pict-Qt') self.show() def getfilename(self): filename, _filter = QFileDialog.getOpenFileName \ (parent=self, ...
code_fim
hard
{ "lang": "python", "repo": "ndmoroz/pict-qt", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def clicked(self, x, y): click_x = x click_y = y max_x = self.image.width max_y = self.image.height side = 10 averaging_side = 10 for bi in range(-side, side + 1): for bj in range(-side, side + 1): mixel_center_x = ...
code_fim
hard
{ "lang": "python", "repo": "ndmoroz/pict-qt", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ndmoroz/pict-qt path: /main.py from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import \ QHBoxLayout, \ QLabel, \ QWidget, \ QApplication, \ QFileDialog from PyQt5.QtGui import QPixmap from PIL import Image, ImageDraw from PIL.ImageQt import ImageQt import sys ...
code_fim
hard
{ "lang": "python", "repo": "ndmoroz/pict-qt", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def change_volume(change): current_vol = get_volume() if current_vol is None: print("Failed to get volume...") return if is_muted(): set_muted(False) current_vol += change if current_vol < 0: current_vol = 0 elif current_vol > 100: current_vo...
code_fim
hard
{ "lang": "python", "repo": "GuillaumeGomez/mac-commands", "path": "/volume.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GuillaumeGomez/mac-commands path: /volume.py #!/usr/bin/env python3 import subprocess import sys def get_volume(): r = subprocess.run(["osascript", "-e", "get volume settings"], capture_output=True) for part in [t.strip() for t in r.stdout.decode('utf-8').split(',')]: if not par...
code_fim
hard
{ "lang": "python", "repo": "GuillaumeGomez/mac-commands", "path": "/volume.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> _MASSAGE.__init__(self) self.name = "MASSAGED" self.specie = 'verbs' self.basic = "massage" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_massaged.py from xai.brain.wordbase.verbs._massage import _MASSAGE <|fim_middle|>#calss header class _MASSAGED(_MA...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_massaged.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_massaged.py from xai.brain.wordbase.verbs._massage import _MASSAGE <|fim_suffix|> _MASSAGE.__init__(self) self.name = "MASSAGED" self.specie = 'verbs' self.basic = "massage" self.jsondata = {}<|fim_middle|>#calss header class _MASSAGED(_MA...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_massaged.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>player = Player(os.path.join(getImagePath(), "stay.png"),os.path.join(getImagePath(), "right.png"), os.path.join(getImagePath(), "left.png")) player.set_x(510) player.set_y(280) allBaddies = BaddieRepository(ImagesRepository()) view = GraphicalView() topScoreFile = TopScore("Resources/topScore.txt") menuV...
code_fim
hard
{ "lang": "python", "repo": "ancutahij/FoodCapture", "path": "/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ancutahij/FoodCapture path: /run.py import os from Controller.Logic import KeyBoard from Controller.readWriteFile import TopScore from Model.BaddieRepository import BaddieRepository from Model.Images import ImagesRepository from Model.PlayerEntity import Player from View.Graphic import Graphical...
code_fim
hard
{ "lang": "python", "repo": "ancutahij/FoodCapture", "path": "/run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: strigazi/athena path: /PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMMediumSelectorCutDefs.py # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration # default configuration of the ForwardElectronIsEMSelectorCutDefs # This one is used fo...
code_fim
medium
{ "lang": "python", "repo": "strigazi/athena", "path": "/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMMediumSelectorCutDefs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Define GeV GeV = 1000.0 def ForwardElectronIsEMMediumSelectorConfigMC15(theTool) : ''' These are the photon isEM definitions from *MC15* ''' theTool = GetTool(theTool) theTool.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20170711/ForwardElectronIsEMMediumSelectorCutD...
code_fim
medium
{ "lang": "python", "repo": "strigazi/athena", "path": "/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ForwardElectronIsEMMediumSelectorCutDefs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def sentiment_analysis(keyword): path ="xpression_project\\models\\twitter-roberta-base-sentiment" labels=['negative', 'neutral', 'positive'] count = 0 tokenizer = AutoTokenizer.from_pretrained(path) model = AutoModelForSequenceClassification.from_pretrained(path) start_date = "" end_date = "" ...
code_fim
hard
{ "lang": "python", "repo": "flame-in/xpression", "path": "/analysis/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> new_text = [] for t in text.split(" "): t = '@user' if t.startswith('@') and len(t) > 1 else t t = 'http' if t.startswith('http') else t new_text.append(t) return " ".join(new_text) def sentiment_analysis(keyword): path ="xpression_project\\models\\twitter-roberta...
code_fim
hard
{ "lang": "python", "repo": "flame-in/xpression", "path": "/analysis/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: flame-in/xpression path: /analysis/main.py """ directory that store the file pytorch_model.bin is important path is that directory. Other mdels can also be used almost in the same way. labels are downloaded in originals script. But i just made it into a list of three elements. """ from analysis...
code_fim
medium
{ "lang": "python", "repo": "flame-in/xpression", "path": "/analysis/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ichbinhippo/Adversarial-Attacks-on-CapsNets path: /code/util/util.py """ This module contains various methods, that are used in different places in this project """ import os import importlib import inspect import sys import json import tensorflow as tf import numpy as np from util.config import...
code_fim
hard
{ "lang": "python", "repo": "Ichbinhippo/Adversarial-Attacks-on-CapsNets", "path": "/code/util/util.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> epoch_tensors = graph.get_collection('epoch_key') if len(epoch_tensors) == 2: epoch_op = epoch_tensors[1] else: epoch_op = None return epoch_op def create_epoch(graph=None): """Creates the global epoch counter""" if get_epoch(graph) is not None: raise Valu...
code_fim
hard
{ "lang": "python", "repo": "Ichbinhippo/Adversarial-Attacks-on-CapsNets", "path": "/code/util/util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def get_epoch_op(graph=None): """Get global epoch update op""" graph = graph or tf.get_default_graph() epoch_tensors = graph.get_collection('epoch_key') if len(epoch_tensors) == 2: epoch_op = epoch_tensors[1] else: epoch_op = None return epoch_op def create_e...
code_fim
hard
{ "lang": "python", "repo": "Ichbinhippo/Adversarial-Attacks-on-CapsNets", "path": "/code/util/util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ''' Reads mzXML file and returns a pandas.DataFrame. ''' cols = ['retentionTime', 'm/z array', 'intensity array'] slices = [] file = mzxml.MzXML(filename) while True: try: slices.append( pd.DataFrame(file.next()) ) except: break df =...
code_fim
medium
{ "lang": "python", "repo": "bucknerns/ms-mint", "path": "/ms_mint/io.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bucknerns/ms-mint path: /ms_mint/io.py import pandas as pd from pyteomics import mzxml, mzml def ms_file_to_df(filename): if filename.lower().endswith('.mzxml'): return mzxml_to_pandas_df(filename) elif filename.lower().endswith('.mzml'): return mzml_to_pandas_df(filenam...
code_fim
hard
{ "lang": "python", "repo": "bucknerns/ms-mint", "path": "/ms_mint/io.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' Reads mzML file and returns a pandas.DataFrame. ''' cols = ['retentionTime', 'm/z array', 'intensity array'] slices = [] file = mzml.MzML(filename) while True: try: data = file.next() data['retentionTime'] = data['scanList']['scan'][0]['scan ...
code_fim
hard
{ "lang": "python", "repo": "bucknerns/ms-mint", "path": "/ms_mint/io.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: graphcore/examples path: /tutorials/simple_applications/tensorflow2/mnist/mnist_code_only.py # Copyright (c) 2020 Graphcore Ltd. All rights reserved. # THIS FILE IS AUTOGENERATED. Rerun SST after editing source file: mnist.py import tensorflow as tf from tensorflow import keras from tensorflow...
code_fim
hard
{ "lang": "python", "repo": "graphcore/examples", "path": "/tutorials/simple_applications/tensorflow2/mnist/mnist_code_only.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Create an IPU distribution strategy. strategy = ipu.ipu_strategy.IPUStrategy() with strategy.scope(): # Create an instance of the model. model = create_model() # Get the training dataset. ds = create_dataset() # Train the model. model.compile( loss=keras.losses.SparseC...
code_fim
hard
{ "lang": "python", "repo": "graphcore/examples", "path": "/tutorials/simple_applications/tensorflow2/mnist/mnist_code_only.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: billgreenwald/pgltools path: /Module/PyGLtools/column_flip.py # coding: utf-8 # In[ ]: import argparse import sys # In[ ]: def _processFile(FILENAME, useStdIn): if not useStdIn: header = "" lines = [] for line in open(FILENAME, "r"): if line[0] == "#...
code_fim
hard
{ "lang": "python", "repo": "billgreenwald/pgltools", "path": "/Module/PyGLtools/column_flip.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": # parse arguments parser = argparse.ArgumentParser() parser._optionals.title = "Arguments" parser.add_argument( "-a", help="File Path for file a. Required unless -stdInA is used", required=False, default="%#$", ) parser.a...
code_fim
hard
{ "lang": "python", "repo": "billgreenwald/pgltools", "path": "/Module/PyGLtools/column_flip.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kaelesty/pet-pygame-krege path: /algKlass.py from data import db_session from data.words import Word import datetime as dt import random class Alg: def __init__(self, config): self.config = config <|fim_suffix|> db_sess = db_session.create_session() """ 0 - ...
code_fim
hard
{ "lang": "python", "repo": "Kaelesty/pet-pygame-krege", "path": "/algKlass.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> self.last_sended = random.choice(self.map) return self.last_sended def check_word(self, article): db_sess = db_session.create_session() word = db_sess.query(Word).filter(Word.string == self.last_sended.string).first() if word.accent == article: word...
code_fim
hard
{ "lang": "python", "repo": "Kaelesty/pet-pygame-krege", "path": "/algKlass.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> db_sess = db_session.create_session() word = db_sess.query(Word).filter(Word.string == self.last_sended.string).first() if word.accent == article: word.score -= self.config["alg-ans-step"] if word.score >= 1 else 0 db_sess.commit() return True ...
code_fim
hard
{ "lang": "python", "repo": "Kaelesty/pet-pygame-krege", "path": "/algKlass.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: felixtran39/computation_hist path: /djweb/dj_comp_hist/migrations/0007_auto_20190118_1943.py # Generated by Django 2.1.5 on 2019-01-18 19:43 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('dj_comp_hist', '0006_auto_20190117_1618')...
code_fim
hard
{ "lang": "python", "repo": "felixtran39/computation_hist", "path": "/djweb/dj_comp_hist/migrations/0007_auto_20190118_1943.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> model_name='document', name='title', field=models.CharField(blank=True, max_length=191), ), migrations.AlterField( model_name='document', name='type', field=models.CharField(blank=True, max_length=191), ), migrat...
code_fim
hard
{ "lang": "python", "repo": "felixtran39/computation_hist", "path": "/djweb/dj_comp_hist/migrations/0007_auto_20190118_1943.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> flux = new_csm[0].components[0].flux[0, 0] qa = qa_gaintable(new_csm[1]) residual = qa.data['residual'] rms_phase = qa.data['rms-phase'] log.debug("solve_modelpartition:\t Window %d, flux %s, residual %.3f, rms phase %.3f" % (window_index, ...
code_fim
hard
{ "lang": "python", "repo": "jamiefarnes/algorithm-reference-library", "path": "/processing_components/calibration/modelpartition.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jamiefarnes/algorithm-reference-library path: /processing_components/calibration/modelpartition.py """ Radio interferometric calibration using an expectation maximisation algorithm See the SDP document "Model Partition Calibration View Packet" In this code: - A single model parition is taken t...
code_fim
hard
{ "lang": "python", "repo": "jamiefarnes/algorithm-reference-library", "path": "/processing_components/calibration/modelpartition.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GalSim-developers/GalSim path: /devel/make_sensor_data_symmetrical.py # Copyright (c) 2012-2022 by the GalSim developers team on GitHub # https://github.com/GalSim-developers # # This file is part of GalSim: The modular galaxy image simulation toolkit. # https://github.com/GalSim-developers/GalSi...
code_fim
hard
{ "lang": "python", "repo": "GalSim-developers/GalSim", "path": "/devel/make_sensor_data_symmetrical.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># skip header for line in lines[1:]: bits = line.split() if len(bits) != 5: print("Unexpected line in sensor file:", line) sys.exit(1) # X0 and Y0 (the first two items) are the pixel center co-ordinates # they run from (15,15) to (95,95) and are spaced 10 units apart po...
code_fim
hard
{ "lang": "python", "repo": "GalSim-developers/GalSim", "path": "/devel/make_sensor_data_symmetrical.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if n <= nv2: # lower left return (3*nv2 + 1) + (nv2 - n) elif n < (3*nv2 + 1): # bottom return (3*nv2) - (n-(nv2+1)) elif n <= (4*nv2 + 1): # lower right return nv2 - (n-(3*nv2+1)) elif n <= (5*nv2 + 2): # upper right return (...
code_fim
hard
{ "lang": "python", "repo": "GalSim-developers/GalSim", "path": "/devel/make_sensor_data_symmetrical.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: UFAL-DSG/django-crowdflower-annotations path: /transcription/alex_da-default/ml/features.py self.features = defaultdict(float) def __str__(self): return str(self.features) def __getitem__(self, feat): """Returns the value of `feature' (0.0 if not present).""" ...
code_fim
hard
{ "lang": "python", "repo": "UFAL-DSG/django-crowdflower-annotations", "path": "/transcription/alex_da-default/ml/features.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: UFAL-DSG/django-crowdflower-annotations path: /transcription/alex_da-default/ml/features.py def __str__(self): return str(self.features) def __getitem__(self, feat): """Returns the value of `feature' (0.0 if not present).""" # We perform the test for presence explici...
code_fim
hard
{ "lang": "python", "repo": "UFAL-DSG/django-crowdflower-annotations", "path": "/transcription/alex_da-default/ml/features.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> super(AbstractedFeature, self).__init__( iter_meth=iter_meth, replace_meth=replace_meth, splitter=splitter, make_other=make_other) return AbstractedFeature # DEPRECATED def make_abstracted_tuple(abstr_idxs): """Example usage: AbTuple2 = make_...
code_fim
hard
{ "lang": "python", "repo": "UFAL-DSG/django-crowdflower-annotations", "path": "/transcription/alex_da-default/ml/features.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bijitchakraborty12/MyProjects01 path: /20180729/Excel_02.py # In your python terminal cd into the directory having the excel file. import xlrd book = xlrd.open_workbook("myBook_01.xlsx") # in my case the directory contains the excel file named excel.xls # Now to print the number of worksheets i...
code_fim
medium
{ "lang": "python", "repo": "bijitchakraborty12/MyProjects01", "path": "/20180729/Excel_02.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># viola you have it # Now lets say in my excel sheet data starts with rows = 1 to 3 , and columns =0 to 2 # PS the first row are the titles for j in range(0,4): for i in range(1,4): print("%r" %sheet.cell_value(i,j))<|fim_prefix|># repo: bijitchakraborty12/MyProjects01 path: /20180729/Excel_...
code_fim
medium
{ "lang": "python", "repo": "bijitchakraborty12/MyProjects01", "path": "/20180729/Excel_02.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for j in range(0,4): for i in range(1,4): print("%r" %sheet.cell_value(i,j))<|fim_prefix|># repo: bijitchakraborty12/MyProjects01 path: /20180729/Excel_02.py # In your python terminal cd into the directory having the excel file. import xlrd book = xlrd.open_workbook("myBook_01.xlsx") # in my ...
code_fim
hard
{ "lang": "python", "repo": "bijitchakraborty12/MyProjects01", "path": "/20180729/Excel_02.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>] = 'Recuperação' else: aluno['Situação'] = 'Reprovado' print(40*'=') for k, v in aluno.items(): print(f'- {k}: {v}')<|fim_prefix|># repo: ohentony/Aprendendo-python path: /Coleções em python/Dicionários em python/ex001.py # Faça um programa que leia nome e média de um aluno, guardando também a s...
code_fim
hard
{ "lang": "python", "repo": "ohentony/Aprendendo-python", "path": "/Coleções em python/Dicionários em python/ex001.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ohentony/Aprendendo-python path: /Coleções em python/Dicionários em python/ex001.py # Faça um programa que leia nome e média de um aluno, guardando também a situação em um dicionário. # No final, mostre o co<|fim_suffix|>(input('Média: ')) if aluno['Média'] >= 7: aluno['Situação'] = 'Aprovad...
code_fim
medium
{ "lang": "python", "repo": "ohentony/Aprendendo-python", "path": "/Coleções em python/Dicionários em python/ex001.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: microprediction/ratings path: /tests/test_lattice_bayes.py from ratings.lattice.lattice_bayes import std_posterior_dividend import math <|fim_suffix|> dividends = [2, 3, 6] observations = [0, -1, -0.5] pseudo = std_posterior_dividend(dividends=dividends, ability_std=10, idio_std=2 * ...
code_fim
easy
{ "lang": "python", "repo": "microprediction/ratings", "path": "/tests/test_lattice_bayes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dividends = [2, 3, 6] observations = [0, -1, -0.5] pseudo = std_posterior_dividend(dividends=dividends, ability_std=10, idio_std=2 * math.sqrt(2), observations=observations) print(pseudo)<|fim_prefix|># repo: microprediction/ratings path: /tests/test_la...
code_fim
easy
{ "lang": "python", "repo": "microprediction/ratings", "path": "/tests/test_lattice_bayes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> path = os.path.abspath(value) if not os.path.exists(path): text = "Path '{}' does not exist ({})." raise argparse.ArgumentTypeError(text.format(value, path)) return path class Command(BaseCommand): "Django Command; `store`." help = """ Store the specified file in...
code_fim
medium
{ "lang": "python", "repo": "martinphellwig/bink", "path": "/apps/bink/management/commands/store.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> "Django Command; `store`." help = """ Store the specified file in the database. """ def add_arguments(self, parser): help_text = """ Specify the location of the CSV file and add its contents to the DB. """ parser.add_argument("csv_file", type=_check_pa...
code_fim
hard
{ "lang": "python", "repo": "martinphellwig/bink", "path": "/apps/bink/management/commands/store.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: martinphellwig/bink path: /apps/bink/management/commands/store.py """ This command stores the specified filename in the database. """ import argparse import os from django.core.management.base import BaseCommand from ...functions import store def _check_path(value): path = os.path.abspat...
code_fim
medium
{ "lang": "python", "repo": "martinphellwig/bink", "path": "/apps/bink/management/commands/store.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tu500/voctomix path: /voctocore/lib/sources/decklinkavsource.py import logging from gi.repository import Gst from lib.config import Config from lib.sources.avsource import AVSource class DeckLinkAVSource(AVSource): def __init__(self, name, outputs=None, has_audio=True, has_video=True): ...
code_fim
hard
{ "lang": "python", "repo": "tu500/voctomix", "path": "/voctocore/lib/sources/decklinkavsource.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.has_video: pipeline += """ videoconvert ! {deinterlacer} videoscale ! videorate name=deckvideo """.format( deinterlacer=self.build_deinterlacer() ) else: ...
code_fim
hard
{ "lang": "python", "repo": "tu500/voctomix", "path": "/voctocore/lib/sources/decklinkavsource.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wufengwhu/my_blog path: /exercise/parameters.py def story(**kwds): return 'Once upon a time, there was a ' \ '%(job)s called %(name)s. ' %kwds def power(x, y, *others): <|fim_suffix|> '' if stop is None: start, stop = 0, start result = [] i = start print stop while i < stop: result.ap...
code_fim
medium
{ "lang": "python", "repo": "wufengwhu/my_blog", "path": "/exercise/parameters.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> '' if stop is None: start, stop = 0, start result = [] i = start print stop while i < stop: result.append(i) i += step return result<|fim_prefix|># repo: wufengwhu/my_blog path: /exercise/parameters.py def story(**kwds): return 'Once upon a time, there was a ' \ '%(job)s called %(name)s. '...
code_fim
medium
{ "lang": "python", "repo": "wufengwhu/my_blog", "path": "/exercise/parameters.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fgrunewald/titratable_martini_tools path: /fit_curve.py import numpy as np import symfit as sf from symfit.core.minimizers import BFGS, NelderMead, SLSQP, Powell import matplotlib.pyplot as plt import matplotlib.pyplot as plt import argparse def fit_data(data,guess=10.0,use_err=False): ...
code_fim
medium
{ "lang": "python", "repo": "fgrunewald/titratable_martini_tools", "path": "/fit_curve.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>plt.errorbar(data[:,0],1-data[:,1],yerr=data[:,2],ls=' ', lw=2,marker='>',c="#0039A6",markersize='7') plt.legend() plt.xlabel('pH',fontsize='12') plt.ylabel('degree of deprotonation',fontsize='12') plt.tight_layout() plt.show()<|fim_prefix|># repo: fgrunewald/titratable_martini_tools pa...
code_fim
hard
{ "lang": "python", "repo": "fgrunewald/titratable_martini_tools", "path": "/fit_curve.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ComNets-Bremen/ComNets-contiki path: /examples/iotlab/loging.py #!/usr/bin/env python import serial import csv import time import logging logging.basicConfig(filename = 'lifetime.log', level=logging.ERROR) <|fim_suffix|># open file with open("rcvddata.csv", "a") as csvFile: csvwri...
code_fim
hard
{ "lang": "python", "repo": "ComNets-Bremen/ComNets-contiki", "path": "/examples/iotlab/loging.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> except KeyboardInterrupt as e: # Break out of loop only when user presses CTRL+C logging.error("Keyboard interrupt triggered") break except: logging.error("All other errors bypassing!") pass se...
code_fim
hard
{ "lang": "python", "repo": "ComNets-Bremen/ComNets-contiki", "path": "/examples/iotlab/loging.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bndl/cassandra path: /bndl_cassandra/session.py # 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
code_fim
hard
{ "lang": "python", "repo": "bndl/cassandra", "path": "/bndl_cassandra/session.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def prepare(self, query, custom_payload=None): with _PREPARE_LOCK: return _prepare(self, query, custom_payload) def get_contact_points(ctx, contact_points): if not contact_points: contact_points = ctx.conf.get('bndl_cassandra.contact_points') if isinstance(contact_points, str...
code_fim
hard
{ "lang": "python", "repo": "bndl/cassandra", "path": "/bndl_cassandra/session.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # prefer a replica which is local (share IP address) for replica in replicas: if self.is_node_local(replica): yield replica # dc-local replica's on other machines for replica in replicas: ...
code_fim
hard
{ "lang": "python", "repo": "bndl/cassandra", "path": "/bndl_cassandra/session.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('core', '0016_auto_20200904_1026'), ] operations = [ migrations.AlterField( model_name='mealstoorder', name='ordid', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='...
code_fim
medium
{ "lang": "python", "repo": "Umutbek/crm-food", "path": "/app/core/migrations/0017_auto_20200904_1329.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='mealstoorder', name='ordid', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='meals1', to='core.order'), ), ]<|fim_prefix|># repo: Umutbek/...
code_fim
medium
{ "lang": "python", "repo": "Umutbek/crm-food", "path": "/app/core/migrations/0017_auto_20200904_1329.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Umutbek/crm-food path: /app/core/migrations/0017_auto_20200904_1329.py # Generated by Django 3.1 on 2020-09-04 13:29 from django.db import migrations, models import django.db.models.deletion <|fim_suffix|> dependencies = [ ('core', '0016_auto_20200904_1026'), ] operations =...
code_fim
medium
{ "lang": "python", "repo": "Umutbek/crm-food", "path": "/app/core/migrations/0017_auto_20200904_1329.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class SnippetCategoryViewSet(viewsets.ModelViewSet): serializer_class = SnippetCategorySerializer queryset = SnippetCategory.objects.all() lookup_field = 'id'<|fim_prefix|># repo: pavelsimo/Grifo path: /grifo/snippets/api.py from grifo.snippets.models import Snippet, SnippetCategory from res...
code_fim
medium
{ "lang": "python", "repo": "pavelsimo/Grifo", "path": "/grifo/snippets/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pavelsimo/Grifo path: /grifo/snippets/api.py from grifo.snippets.models import Snippet, SnippetCategory from rest_framework import viewsets <|fim_suffix|>class SnippetViewSet(viewsets.ModelViewSet): serializer_class = SnippetSerializer queryset = Snippet.objects.all() lookup_field = ...
code_fim
medium
{ "lang": "python", "repo": "pavelsimo/Grifo", "path": "/grifo/snippets/api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> serializer_class = SnippetSerializer queryset = Snippet.objects.all() lookup_field = 'id' class SnippetCategoryViewSet(viewsets.ModelViewSet): serializer_class = SnippetCategorySerializer queryset = SnippetCategory.objects.all() lookup_field = 'id'<|fim_prefix|># repo: pavelsimo/...
code_fim
medium
{ "lang": "python", "repo": "pavelsimo/Grifo", "path": "/grifo/snippets/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>x.strftime("%p")) print("%M : ",x.strftime("%M")) print("%S : ",x.strftime("%S")) print("%f : ",x.strftime("%f")) print("%z : ",x.strftime("%z")) print("%Z : ",x.strftime("%Z")) print("%j : ",x.strftime("%j")) print("%U : ",x.strftime("%U")) print("%W : ",x.strftime("%W")) print("...
code_fim
hard
{ "lang": "python", "repo": "NaychukAnastasiya/goiteens-python3-naychuk", "path": "/lesson_7_work/Ex8.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NaychukAnastasiya/goiteens-python3-naychuk path: /lesson_7_work/Ex8.py # Вивести час у різних форматах # mm/dd/yy # NameOfDay Month DateOfDay hh:mm:ss year #### import datetime x = datetime.datetime.now() print("%a : ",x.strftime("%a")) print("%A : ",x.strftime("%A")) print("%w : "...
code_fim
hard
{ "lang": "python", "repo": "NaychukAnastasiya/goiteens-python3-naychuk", "path": "/lesson_7_work/Ex8.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JetBrains/intellij-community path: /python/testData/completion/heavyStarPropagation/lib/_pkg1/_pkg1_0/_pkg1_0_0/_pkg1_0_0_0/_pkg1_0_0_0_0/__init__.py from ._mod1_0_0_0_0_0 import * from ._<|fim_suffix|>_0_0_2 import * from ._mod1_0_0_0_0_3 import * from ._mod1_0_0_0_0_4 import *<|fim_middle|>mod1...
code_fim
easy
{ "lang": "python", "repo": "JetBrains/intellij-community", "path": "/python/testData/completion/heavyStarPropagation/lib/_pkg1/_pkg1_0/_pkg1_0_0/_pkg1_0_0_0/_pkg1_0_0_0_0/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>import * from ._mod1_0_0_0_0_4 import *<|fim_prefix|># repo: JetBrains/intellij-community path: /python/testData/completion/heavyStarPropagation/lib/_pkg1/_pkg1_0/_pkg1_0_0/_pkg1_0_0_0/_pkg1_0_0_0_0/__init__.py from ._mod1_0_0_0_0_0 import * from ._<|fim_middle|>mod1_0_0_0_0_1 import * from ._mod1_0_0_0_...
code_fim
medium
{ "lang": "python", "repo": "JetBrains/intellij-community", "path": "/python/testData/completion/heavyStarPropagation/lib/_pkg1/_pkg1_0/_pkg1_0_0/_pkg1_0_0_0/_pkg1_0_0_0_0/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: clld/amsd path: /amsd/util.py from math import floor from clld.db.meta import DBSession from clld.db.models.common import ( Contributor, Contribution, Contribution_files, ) from clld.web.util.component import Component from clld.web.util.htmllib import HTML from clld.web.util.helpers...
code_fim
hard
{ "lang": "python", "repo": "clld/amsd", "path": "/amsd/util.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_popup_images(req, obj): imgs = obj.get_images(req=req, image_type='web') if imgs: return "%s<br /><br />" % (imgs) return '' # pragma: no cover def get_x_data(model_name=None, context=None, request=None, **kw): m = getattr(amsd.models, model_name) x_m = getattr(amsd...
code_fim
hard
{ "lang": "python", "repo": "clld/amsd", "path": "/amsd/util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def get_data_entry(context=None, request=None, **kw): res = [] if not context.data_entry: # pragma: no cover return None for r in context.data_entry.split(';'): for f in DBSession.query(Contributor).filter(Contributor.id == r): res.append(HTML.a(f.name, href='%s/%s...
code_fim
hard
{ "lang": "python", "repo": "clld/amsd", "path": "/amsd/util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: volnt/tweety path: /main.py import sys try: import keys except ImportError: print >> sys.stderr, "Error : could not import key module (read the README)." exit(1) from time import time import tweepy import sqlitedict from timeit import TimeIt GREEN = "\033[032m" RESET = "\033[0m" ...
code_fim
hard
{ "lang": "python", "repo": "volnt/tweety", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def archive_mentions(self): for tweet in self.tweets: tweet.archive() print "[%s+%s] %s" % (GREEN, RESET, tweet) if not self.tweets: print "No tweet to archive." @TimeIt def main(): auth = AuthHandler(keys.consumer_key, keys.consumer_secret, ...
code_fim
hard
{ "lang": "python", "repo": "volnt/tweety", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>cube = [] for value in range(1,10): cube3 = value**3 cube.append(cube3) print(cube) cube = [value**3 for value in range(1,10)] print(cube)<|fim_prefix|># repo: liqiwa/python_work path: /4/4.3/exercise.py #for value in range(1,21): #print(value) numbers = [value for value in range(1,1000001)] #print(...
code_fim
easy
{ "lang": "python", "repo": "liqiwa/python_work", "path": "/4/4.3/exercise.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: liqiwa/python_work path: /4/4.3/exercise.py #for value in range(1,21): #print(value) numbers = [value for value in range(1,1000001)] #print(numbers) #print("min is "+ str(min(numbers))) ##print("max is " + str(max(numbers))) unevennumber = [value for value in range(1,20,2)] print(unevennumber...
code_fim
easy
{ "lang": "python", "repo": "liqiwa/python_work", "path": "/4/4.3/exercise.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return [{'metric': '.'.join(path), 'is_leaf': node.is_leaf()} for path, node in result] def search(self, node, query_path, path): instruction, arg = query_path[0] if instruction == 'EXACT': matched_children = [(arg, node.children[arg])] if arg in node.children els...
code_fim
hard
{ "lang": "python", "repo": "swoop-inc/graflux", "path": "/graflux/metric_index.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: swoop-inc/graflux path: /graflux/metric_index.py import json import weakref import re GRAPHITE_GLOB_REGEX = re.compile('\*|{') # TODO there are some dumb things done in here, could be faster class MetricNode(object): __slots__ = ['parent', 'children', '__weakref__'] def __init__(self...
code_fim
hard
{ "lang": "python", "repo": "swoop-inc/graflux", "path": "/graflux/metric_index.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> admin.site.register(ParliamentaryGroup) admin.site.register(ParliamentarySession) admin.site.register(CouncilPerson) admin.site.register(File) admin.site.register(Answer) admin.site.register(Motion)<|fim_prefix|># repo: lutoma/open-grgraz path: /api/admin.py from django.contrib import admin from api.mod...
code_fim
easy
{ "lang": "python", "repo": "lutoma/open-grgraz", "path": "/api/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lutoma/open-grgraz path: /api/admin.py from django.contrib import admin from api.models import * <|fim_suffix|>admin.site.register(ParliamentaryGroup) admin.site.register(ParliamentarySession) admin.site.register(CouncilPerson) admin.site.register(File) admin.site.register(Answer) admin.site.reg...
code_fim
easy
{ "lang": "python", "repo": "lutoma/open-grgraz", "path": "/api/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> apmpt.replace_pert_type_for_poscons({"fake filename":df}, {"my pos 1", "my pos 2"}) logger.debug("after replacement df: {}".format(df)) new_pert_type = df.loc[df.pert_iname == "my pos 1", apmpt.pert_type].values[0] self.assertEqual(apmpt.pert_type_poscon, new_pert_type) ...
code_fim
hard
{ "lang": "python", "repo": "dedavison/merino", "path": "/test_adjust_plate_map_pert_type.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: dedavison/merino path: /test_adjust_plate_map_pert_type.py import unittest import logging import setup_logger as setup_logger import adjust_plate_map_pert_type as apmpt import os import pandas logger = logging.getLogger(setup_logger.LOGGER_NAME) # Some notes on testing conventions (more in cu...
code_fim
hard
{ "lang": "python", "repo": "dedavison/merino", "path": "/test_adjust_plate_map_pert_type.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_replace_pert_type_for_poscons(self): df = pandas.DataFrame({apmpt.pert_type:range(3), "pert_iname":["my pos 1", "my pos 2", "not a pos"]}) logger.debug("before replacement df: {}".format(df)) apmpt.replace_pert_type_for_poscons({"fake filename":df}, {"my pos 1", "my ...
code_fim
hard
{ "lang": "python", "repo": "dedavison/merino", "path": "/test_adjust_plate_map_pert_type.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if job.metadata["retries"] > 0: delta = timedelta( seconds=math.pow(factor, job.metadata["retry_count"]) * min_backoff ) dt = datetime.utcnow() + delta enqueued = scheduler.enqueue_at(dt, run_job, *args) j...
code_fim
hard
{ "lang": "python", "repo": "patrickporto/fastlane", "path": "/fastlane/worker/job.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return True if ( result.exit_code != 0 and "retry_count" in job.metadata and job.metadata["retry_count"] < job.metadata["retries"] ): retry_logger = logger.bind( exit_code=result.exit_code, retry_c...
code_fim
hard
{ "lang": "python", "repo": "patrickporto/fastlane", "path": "/fastlane/worker/job.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }