text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: gustavomspinheiro/cid_search path: /cidsystem/source/Support/mail.py from flask import render_template from flask_mail import Message, Mail class Email(): def __init__(self, message, recipients): <|fim_suffix|> def bootstrapReset(self, path, email, emailLink, auxReset): self.messa...
code_fim
hard
{ "lang": "python", "repo": "gustavomspinheiro/cid_search", "path": "/cidsystem/source/Support/mail.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.message.html = render_template(path, email=email, emailLink=emailLink, auxReset=auxReset) return self def sendMail(self, mail): try: mail.send(self.message) return True except: return False<|fim_prefix|># repo: gustavomspinh...
code_fim
hard
{ "lang": "python", "repo": "gustavomspinheiro/cid_search", "path": "/cidsystem/source/Support/mail.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> abstract = True def __call__(self, *args, **kwargs): with app.app_context(): return TaskBase.__call__(self, *args, **kwargs) celery.Task = ContextTask app.logger.info('初始化celery成功') def init_limiter(): limiter.init_app(app) def init_cache(): ...
code_fim
hard
{ "lang": "python", "repo": "zhangnian/fastapi", "path": "/fastapi/fastapi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhangnian/fastapi path: /fastapi/fastapi.py import os import time import logging from logging.handlers import TimedRotatingFileHandler from celery import Celery from werkzeug.utils import find_modules, import_string from raven.contrib.flask import Sentry from sqlalchemy import engine, event from...
code_fim
hard
{ "lang": "python", "repo": "zhangnian/fastapi", "path": "/fastapi/fastapi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def init_sentry(): enable_sentry = app.config.get('ENABLE_SENTRY', False) if not enable_sentry: pass Sentry(app, dsn=app.config.get('SENTRY_DSN')) app.logger.info('初始化Sentry成功') def init_celery(): celery.conf.update(app.config) TaskBase = celery.Task class ContextTa...
code_fim
hard
{ "lang": "python", "repo": "zhangnian/fastapi", "path": "/fastapi/fastapi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BatmanDao/ocr-db path: /tesseract.py import os from subprocess import check_output import debug from debug import logger DELETE_BUFFER_FILES = True DEBUG_TESSERACT = True if not DEBUG_TESSERACT: logger.setLevel(debug.logging.INFO) class tesseract: txt_buffer_name = "txt_buffer" ...
code_fim
medium
{ "lang": "python", "repo": "BatmanDao/ocr-db", "path": "/tesseract.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print check_output("tesseract " + self.input_file_name + " " + self.txt_buffer_name, shell=True) pdf_text = self.strip_text() return pdf_text def create_searchable_pdf(input_file_name, output_file_path): print check_output("tesseract " + self.input_file_path + " " + o...
code_fim
medium
{ "lang": "python", "repo": "BatmanDao/ocr-db", "path": "/tesseract.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wirawan0/wpylib path: /py/stdout_capture.py # -*- python -*- # # wpylib.py.stdout_capture # Created: 20110809 # Wirawan Purwanto # # Hack tools for capturing sys.stdout in a function call. # """ wpylib.py.stdout_capture Capture tool for sys.stdout output, for interactive uses (primarily, so that...
code_fim
hard
{ "lang": "python", "repo": "wirawan0/wpylib", "path": "/py/stdout_capture.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """A stdout proxy that works with StdoutCapture.""" if not hasattr(self, "my_stdout_proxy"): self.my_stdout_proxy = self.outfile_proxy() self.my_stdout_proxy_created = 1 return self.my_stdout_proxy def Capture(self, proc, *args, **argkw): '''Captures sys.stdout while running...
code_fim
hard
{ "lang": "python", "repo": "wirawan0/wpylib", "path": "/py/stdout_capture.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ ('index', '%s.tex' % project, u'%s Documentation' % project, u'OpenStack Foundation', 'manual'), ] # Example configuratio...
code_fim
hard
{ "lang": "python", "repo": "sreeteja7/nova-dpm", "path": "/doc/source/conf.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>html_static_path = ['_static'] # Output file base name for HTML help builder. htmlhelp_basename = '%sdoc' % project # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ ('index', '%s....
code_fim
hard
{ "lang": "python", "repo": "sreeteja7/nova-dpm", "path": "/doc/source/conf.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sreeteja7/nova-dpm path: /doc/source/conf.py # Copyright 2016 IBM Corp. # # All Rights Reserved. # # 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 # # ht...
code_fim
hard
{ "lang": "python", "repo": "sreeteja7/nova-dpm", "path": "/doc/source/conf.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: albertoaldanar/betmatcherAPI path: /cride/events/serializers/events.py """Users Seliralizers""" #DRF from rest_framework import serializers #Models from cride.events.models import Event #Django from django.db import models #Serializer from cride.events.serializers import ( TeamModelSerializer,...
code_fim
hard
{ "lang": "python", "repo": "albertoaldanar/betmatcherAPI", "path": "/cride/events/serializers/events.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sport = SportModelSerializer(read_only = True) league = LeagueModelSerializer(read_only = True) local = TeamModelSerializer(read_only = True) visit = TeamModelSerializer(read_only = True) class Meta: """Meta class""" model = Event fields= ( "name", "date", "traded", "unmatched...
code_fim
hard
{ "lang": "python", "repo": "albertoaldanar/betmatcherAPI", "path": "/cride/events/serializers/events.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andela/ah-the-unsullied path: /authors/apps/articles/serializers.py import readtime from rest_framework import serializers from .models import ( Article, Comments, LikeDislike, FavoriteArticle, HighlightArticleModel,ReportArticle ) from authors.apps.profiles.models import UserProfile...
code_fim
hard
{ "lang": "python", "repo": "andela/ah-the-unsullied", "path": "/authors/apps/articles/serializers.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def format_date(self, date): return date.strftime('%d %b %Y %H:%M:%S') def to_representation(self, instance): """ override representation for custom output """ threads = [ { 'id': thread.id, 'body': thread.body, ...
code_fim
hard
{ "lang": "python", "repo": "andela/ah-the-unsullied", "path": "/authors/apps/articles/serializers.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bjlhx15/python-algorithm path: /src/python-opencv/003-cut/test_001_pos.py # -*- coding: UTF-8 -*- import os import cv2 import numpy as np # 遍历指定目录,显示目录下的所有文件名 def CropImage4File(filepath,destpath): <|fim_suffix|>if __name__ == '__main__': filepath ='src/python-opencv/' #源图像 ...
code_fim
hard
{ "lang": "python", "repo": "bjlhx15/python-algorithm", "path": "/src/python-opencv/003-cut/test_001_pos.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': filepath ='src/python-opencv/' #源图像 destpath='src/python-opencv/003-cut/dist_img' # resized images saved here CropImage4File(filepath,destpath)<|fim_prefix|># repo: bjlhx15/python-algorithm path: /src/python-opencv/003-cut/test_001_pos.py # -*- co...
code_fim
hard
{ "lang": "python", "repo": "bjlhx15/python-algorithm", "path": "/src/python-opencv/003-cut/test_001_pos.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> spikes_split = [] max_time = max(spike_times) for t0 in np.arange(0, max_time, time_window): spikes_in_window = spike_times[(spike_times > t0) & (spike_times <= t0 + time_window)] spikes_split.append(spikes_in_window) def spike_count_by_time_window(spike_times, time_window, m...
code_fim
medium
{ "lang": "python", "repo": "Tom83B/rate-code-eff-2019", "path": "/coding/analysis/analysis_old.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Tom83B/rate-code-eff-2019 path: /coding/analysis/analysis_old.py import pickle import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.interpolate import interp1d from analysis.plotting import voltage_plot, voltage_threshold_intensity from simulations.simulation import N...
code_fim
medium
{ "lang": "python", "repo": "Tom83B/rate-code-eff-2019", "path": "/coding/analysis/analysis_old.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return grid def interpolation(grid, input_frequencies): x = input_frequencies y = np.arange(0, grid.shape[1], 1) new_y = np.linspace(y.min(), y.max(), 1000) grid_pdf = np.array(grid, copy=True, dtype=float) for i in range(len(x)): f = InterpolatedUnivariateSpline(y, gri...
code_fim
hard
{ "lang": "python", "repo": "Tom83B/rate-code-eff-2019", "path": "/coding/analysis/analysis_old.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print"===============================================================" operation=raw_input('Enter the operation(+ - * /):\n') a=input("enter 1st operator value: ") b=input("enter 2nd operator value:") l=operation+"#"+str(a)+"#"+str(b) s.send(l) result=s.recv(1024) print "Result for operation:",operation p...
code_fim
medium
{ "lang": "python", "repo": "modihere/NetLabS5", "path": "/Socket/Calc/Distributed Calc/client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: modihere/NetLabS5 path: /Socket/Calc/Distributed Calc/client.py import socket HOST = 'localhost' PORT = 5021 s = socket.socket() s.connect((HOST, PORT)) <|fim_suffix|>print"===============================================================" operation=raw_input('Enter the operation(+ - * /):\n') a=...
code_fim
medium
{ "lang": "python", "repo": "modihere/NetLabS5", "path": "/Socket/Calc/Distributed Calc/client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhengyhn/cifar-practice path: /resnet152.py import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from solver import Solver from resnet import ResNet, BlockType class ResNet152(ResNet): def add_res_layers(self): <|fim_suffix|>solver = Solver(train_percentage=0...
code_fim
hard
{ "lang": "python", "repo": "zhengyhn/cifar-practice", "path": "/resnet152.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>solver = Solver(train_percentage=0.95, train_batch_size=512) model = ResNet152(solver.num_label) solver.train_model(model, warmup_epochs=10, num_epoch_to_log=5, learning_rate=1e-3, weight_decay=0.001, epochs=70, checkpoint='checkpoint/resnet152') solver.test(model) new_model = solver.caribrate(model) solv...
code_fim
hard
{ "lang": "python", "repo": "zhengyhn/cifar-practice", "path": "/resnet152.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cloudify-PS/cloudify-training-labs path: /developing-simple-plugin/solution/plugin/workflows.py ######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with ...
code_fim
medium
{ "lang": "python", "repo": "Cloudify-PS/cloudify-training-labs", "path": "/developing-simple-plugin/solution/plugin/workflows.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> graph.add_task(instance.execute_operation(operation, kwargs={"log_output": log_output}, allow_kwargs_override=True)) return graph.execute()<|fim_prefix|># repo: Cloudify-PS/cloudify-training-labs path: /developing-simple-plugin/solution/plugin/workflows.py ######## # Copyright (c) 20...
code_fim
medium
{ "lang": "python", "repo": "Cloudify-PS/cloudify-training-labs", "path": "/developing-simple-plugin/solution/plugin/workflows.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.basic = ['portfolio']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_portfolios.py #calss header class _PORTFOLIOS(): <|fim_middle|> def __init__(self,): self.name = "PORTFOLIOS" s...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_portfolios.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_portfolios.py #calss header class _PORTFOLIOS(): <|fim_suffix|> self.basic = ['portfolio']<|fim_middle|> def __init__(self,): self.name = "PORTFOLIOS" self.definitions = portfolio self.parents = [] self.childen = [] self.properties...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_portfolios.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> = dfs[0].lastRun.apply(lambda d: None if pd.isna(d) else d + pd.Timedelta(seconds=60)) for df in dfs: df.sort_index(axis=1, inplace=True)<|fim_prefix|># repo: xyla-io/datadragon path: /input/verify/verify_dry_run_rules.py import pandas as pd dfs[1].loc[dfs[1].shouldPerformAction == False, <|fim_middl...
code_fim
medium
{ "lang": "python", "repo": "xyla-io/datadragon", "path": "/input/verify/verify_dry_run_rules.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xyla-io/datadragon path: /input/verify/verify_dry_run_rules.py import pandas as pd dfs[1].loc[dfs[1].shouldPerformAction == False, <|fim_suffix|>elta(seconds=60)) for df in dfs: df.sort_index(axis=1, inplace=True)<|fim_middle|>'isEnabled'] = False dfs[1].shouldPerformAction = False dfs[0].last...
code_fim
medium
{ "lang": "python", "repo": "xyla-io/datadragon", "path": "/input/verify/verify_dry_run_rules.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mc('/stats', controller='front', action='stats') mc('/feedback', controller='feedback', action='feedback') mc('/ad_inq', controller='feedback', action='ad_inq') mc('/admin/i18n', controller='i18n', action='list') mc('/admin/i18n/:action', controller='i18n') mc('/admin/...
code_fim
hard
{ "lang": "python", "repo": "harshp8l/deep-learning-lang-detection", "path": "/data/train/python/fd5a957cd7816452843f6e944288bd706852e780routing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: harshp8l/deep-learning-lang-detection path: /data/train/python/fd5a957cd7816452843f6e944288bd706852e780routing.py # The contents of this file are subject to the Common Public Attribution # License Version 1.0. (the "License"); you may not use this file except in # compliance with the License. You...
code_fim
hard
{ "lang": "python", "repo": "harshp8l/deep-learning-lang-detection", "path": "/data/train/python/fd5a957cd7816452843f6e944288bd706852e780routing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: conan-io/conan path: /conans/test/integration/conanfile/test_conanfile_txt_test_requires.py from conans.test.assets.genconanfile import GenConanfile from conans.test.utils.tools import TestClient def test_test_requires(): <|fim_suffix|> c.run("install consumer") c.assert_listed_require({...
code_fim
hard
{ "lang": "python", "repo": "conan-io/conan", "path": "/conans/test/integration/conanfile/test_conanfile_txt_test_requires.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> c.run("install consumer") c.assert_listed_require({"test/0.1": "Cache"}, test=True) c.assert_listed_binary({"test/0.1": ("a3cb1345b8297bfdffea4ef4bb1b2694c54d1d69", "Cache")}, test=True)<|fim_prefix|># repo: conan-io/conan path: /conans/test/integration/conanfile/te...
code_fim
hard
{ "lang": "python", "repo": "conan-io/conan", "path": "/conans/test/integration/conanfile/test_conanfile_txt_test_requires.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if "-" in db_name: prefix, epoch = db_name.split("-", 2) # Consider the database created 10 mins before this call as the test database return "Test" in prefix and int(epoch) < time.time_ns() // 1000000 - 600000 return False<|fim_prefix|># repo: RxJellyBot/Jelly-Bot path:...
code_fim
medium
{ "lang": "python", "repo": "RxJellyBot/Jelly-Bot", "path": "/mongodb/factory/_dbctrl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RxJellyBot/Jelly-Bot path: /mongodb/factory/_dbctrl.py import os import time from extutils.logger import SYSTEM from env_var import is_testing __all__ = ("get_single_db_name", "SINGLE_DB_NAME", "is_test_db",) def get_single_db_name(): """ Method to get the single db name, if any. ...
code_fim
medium
{ "lang": "python", "repo": "RxJellyBot/Jelly-Bot", "path": "/mongodb/factory/_dbctrl.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Too many arguments for "Operation" self.record.append(cls(*args, **kwargs)) return proxy class transaction: """ Create an atomic transaction for the given *table*. All IO actions during the transaction are executed within a database-local lock. :param table: A ...
code_fim
hard
{ "lang": "python", "repo": "stungkit/tinyrecord", "path": "/tinyrecord/transaction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param table: A TinyDB table. """ _locks: MutableMapping[Table, Lock] = WeakKeyDictionary() def __init__(self, table: Table) -> None: self.record = Changeset(table) self.lock = (self._locks.get(table) or self._locks.setdefault(table, Lock())) ins...
code_fim
hard
{ "lang": "python", "repo": "stungkit/tinyrecord", "path": "/tinyrecord/transaction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stungkit/tinyrecord path: /tinyrecord/transaction.py from functools import wraps from threading import Lock from types import TracebackType from typing import Any, Callable, MutableMapping, NoReturn, Optional, Type from weakref import WeakKeyDictionary from tinydb.table import Table from tinyre...
code_fim
hard
{ "lang": "python", "repo": "stungkit/tinyrecord", "path": "/tinyrecord/transaction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>maior} pessoas com mais de 18 anos de idade.\n' f'Foram cadastrados {homem} homens. \n' f'E temos {mulher} mulheres com menos de 20 anos de idade')<|fim_prefix|># repo: wandersonDeve/Curso-em-Video path: /Aula 15 - While Parte 02/ex069 – Análise de dados do grupo.py print('==== SUPER FORMULAR...
code_fim
hard
{ "lang": "python", "repo": "wandersonDeve/Curso-em-Video", "path": "/Aula 15 - While Parte 02/ex069 – Análise de dados do grupo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wandersonDeve/Curso-em-Video path: /Aula 15 - While Parte 02/ex069 – Análise de dados do grupo.py print('==== SUPER FORMULARIO ====') maior = homem = mulher = 0 while True: print('-'*20) age = int(input('Qual sua Idade: ')) sexo = str(input('<|fim_suffix|>mulher += 1 cond = str(...
code_fim
medium
{ "lang": "python", "repo": "wandersonDeve/Curso-em-Video", "path": "/Aula 15 - While Parte 02/ex069 – Análise de dados do grupo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>mulher += 1 cond = str(input('Deseja continuar ? [S/N] ')).upper().strip() if cond == 'N': break print('-'*20) print(f'Existe nesse cadastro {maior} pessoas com mais de 18 anos de idade.\n' f'Foram cadastrados {homem} homens. \n' f'E temos {mulher} mulheres com menos de 20 anos...
code_fim
medium
{ "lang": "python", "repo": "wandersonDeve/Curso-em-Video", "path": "/Aula 15 - While Parte 02/ex069 – Análise de dados do grupo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def import_txt(cls, txt_file, feed): '''Import from a stops.txt file Stations need to be imported before stops ''' txt = txt_file.read() def is_station(pairs): '''Does the row represent a station?''' for name, val in p...
code_fim
hard
{ "lang": "python", "repo": "tulsawebdevs/django-multi-gtfs", "path": "/multigtfs/models/stop.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tulsawebdevs/django-multi-gtfs path: /multigtfs/models/stop.py # # Copyright 2012-2014 John Whitlock # # 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.apac...
code_fim
hard
{ "lang": "python", "repo": "tulsawebdevs/django-multi-gtfs", "path": "/multigtfs/models/stop.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> logger.info("Importing non-station stops") stops = super(Stop, cls).import_txt(StringIO(txt), feed, is_stop) logger.info("Imported %d non-station stops", stops) return stations + stops @receiver(post_save, sender=Stop, dispatch_uid="post_save_stop") def post_save_stop(sen...
code_fim
hard
{ "lang": "python", "repo": "tulsawebdevs/django-multi-gtfs", "path": "/multigtfs/models/stop.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> - name: refreshID description: Contains the refresh ID set by processing unit refresh event. type: string exposed: true required: true example_value: xxxx-xxxx-xxxx<|fim_prefix|># repo: jvillmer/gaia path: /specs/pingrequest.spec # Model model: rest_name: pingrequest resource_na...
code_fim
hard
{ "lang": "python", "repo": "jvillmer/gaia", "path": "/specs/pingrequest.spec", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jvillmer/gaia path: /specs/pingrequest.spec # Model model: rest_name: pingrequest resource_name: pingrequests entity_name: PingRequest package: guy group: core/enforcer description: Initiates a ping request for enforcer debugging. # Attributes attributes: v1: - name: iterations ...
code_fim
medium
{ "lang": "python", "repo": "jvillmer/gaia", "path": "/specs/pingrequest.spec", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = cms.string(globaltag) process.looper.applyDbAlignment = True process.MuonAlignmentFromReferenceInputDB.connect = cms.string("sqlite_file:%s" % inputdb) process.MuonAlignmentFromReferenceInputDB....
code_fim
hard
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/Alignment/MuonAlignmentAlgorithms/python/align_cfg.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cms-sw/cmssw path: /Alignment/MuonAlignmentAlgorithms/python/align_cfg.py import os import FWCore.ParameterSet.Config as cms alignmenttmp = os.environ["ALIGNMENT_ALIGNMENTTMP"].split("\n") iteration = int(os.environ["ALIGNMENT_ITERATION"]) globaltag = os.environ["ALIGNMENT_GLOBALTAG"] inputdb =...
code_fim
hard
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/Alignment/MuonAlignmentAlgorithms/python/align_cfg.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: csleex/swift-setup path: /swift_setup/node/deploy.py """ See COPYING for license information """ import os from sys import exit from swift_setup.common.exceptions import ConfigFileError, \ ResponseError, UploadTemplatesError, ConfigSyncError from swift_setup.common.utils import readconf from...
code_fim
hard
{ "lang": "python", "repo": "csleex/swift-setup", "path": "/swift_setup/node/deploy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Restarting some services """ if sudo('service git-daemon start').failed: status = 500 msg = 'Error restarting git-daemon' raise ResponseError(status, msg) if sudo...
code_fim
hard
{ "lang": "python", "repo": "csleex/swift-setup", "path": "/swift_setup/node/deploy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: datacom-teracom/l2tester path: /examples/python/send_and_check.py ################################################################################################### # This script demonstrate the use of the SendAndCheck feature. # From source interface, 2 tagged and 2 untagged packets are sent. #...
code_fim
hard
{ "lang": "python", "repo": "datacom-teracom/l2tester", "path": "/examples/python/send_and_check.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> filter = l2tester.EthernetFilter() filter.src_mac = '10:00:01:02:03:04' filter.compile() send_frames = { if_src : 2 * [ str(untag), str(tag100) ], } expected_frames = { if_src : [], if_dst : [ str(tag100) ] + 3 * [ str(untag) ], } send_and_check = l2tester.SendAndCheck(send_fra...
code_fim
hard
{ "lang": "python", "repo": "datacom-teracom/l2tester", "path": "/examples/python/send_and_check.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eddowh/ctci-python3 path: /making_anagrams/subtract_sum_of_len.py # -*- coding: utf-8 -*- from collections import Counter def number_needed(a, b): count_a = Counter(a) count_b = Counter(b) <|fim_suffix|> def main(): a = input().strip() b = input().strip() print(number_nee...
code_fim
hard
{ "lang": "python", "repo": "eddowh/ctci-python3", "path": "/making_anagrams/subtract_sum_of_len.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): a = input().strip() b = input().strip() print(number_needed(a, b)) if __name__ == '__main__': main()<|fim_prefix|># repo: eddowh/ctci-python3 path: /making_anagrams/subtract_sum_of_len.py # -*- coding: utf-8 -*- from collections import Counter def number_needed(a, b): ...
code_fim
medium
{ "lang": "python", "repo": "eddowh/ctci-python3", "path": "/making_anagrams/subtract_sum_of_len.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: carissaallen/convex-hull path: /graham_scan.py #!/usr/bin/env python3 """ Graham's Scan Algorithm: 1. Choose point p with the lowest y-coordinate; in case of a tie, choose the leftmost point. Since no point is below p, it must be a vertex on the convex hull. (This is our 'anchor' point.) 2...
code_fim
hard
{ "lang": "python", "repo": "carissaallen/convex-hull", "path": "/graham_scan.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Returns the polar angle (in radians) from points p0 to p1.""" if p1 == None: p1 = anchor y_span = p0[1] - p1[1] x_span = p0[0] - p1[0] return atan2(y_span, x_span) def distance(self, p0, p1=None): """Returns the eculidean distance from p0...
code_fim
hard
{ "lang": "python", "repo": "carissaallen/convex-hull", "path": "/graham_scan.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_hull_points(self, show_progress): """Returns points on the convex hull, displaying input and output points.""" if self.points and not self.hull_points: self.graham_scan(show_progress) print("Input: {} points").format(len(self.points)) print("...
code_fim
hard
{ "lang": "python", "repo": "carissaallen/convex-hull", "path": "/graham_scan.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jonlwowski012/Super-Resolution-Image_Using-CNN path: /Resize.py from os import listdir from os.path import join from scipy import misc import os input_size = (128, 128) label_size = (256, 256) <|fim_suffix|> scaled = misc.imresize(image, input_size, 'bicubic') scaled = misc.imresize(scaled...
code_fim
hard
{ "lang": "python", "repo": "jonlwowski012/Super-Resolution-Image_Using-CNN", "path": "/Resize.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> misc.imsave(join(output_dir, "input", input_name), scaled) misc.imsave(join(output_dir, "label", input_name), image)<|fim_prefix|># repo: jonlwowski012/Super-Resolution-Image_Using-CNN path: /Resize.py from os import listdir from os.path import join from scipy import misc import os <|fim_middle|>...
code_fim
hard
{ "lang": "python", "repo": "jonlwowski012/Super-Resolution-Image_Using-CNN", "path": "/Resize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_exclude_paths_from_environ_multiple(monkeypatch): monkeypatch.setenv('WSGI_AUTH_EXCLUDE_PATHS', '/foo/bar;/bar/foo') result = wsgi_basic_auth._exclude_paths_from_environ() assert result == ['/foo/bar', '/bar/foo'] def test_include_paths_from_environ_multiple(monkeypatch): monkey...
code_fim
hard
{ "lang": "python", "repo": "jinowolski/wsgi-basic-auth", "path": "/tests/test_wsgi_basic_auth.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jinowolski/wsgi-basic-auth path: /tests/test_wsgi_basic_auth.py from webtest import TestApp import wsgi_basic_auth def wsgi_app(environ, start_response): body = b'this is private! go away!' headers = [ ('Content-Type', 'text/html; charset=utf8'), ('Content-Length', str(...
code_fim
hard
{ "lang": "python", "repo": "jinowolski/wsgi-basic-auth", "path": "/tests/test_wsgi_basic_auth.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_users_from_environ_multiple(monkeypatch): monkeypatch.setenv('WSGI_AUTH_CREDENTIALS', 'foo:bar|bar:foo') result = wsgi_basic_auth._users_from_environ() assert result == {'foo': 'bar', 'bar': 'foo'} def test_exclude_paths_from_environ(monkeypatch): monkeypatch.setenv('WSGI_AUTH_...
code_fim
hard
{ "lang": "python", "repo": "jinowolski/wsgi-basic-auth", "path": "/tests/test_wsgi_basic_auth.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if response.status_code == 202 and endpoint != "get_deferred_results": return self._resolve_deferred_response(response, self.deferred_result_max_attempts) else: return response def _resolve_deferred_response(self, response, remaining, deferred_id=None): ...
code_fim
hard
{ "lang": "python", "repo": "pzl/bsd-api-python", "path": "/bsdapi/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def put(self, endpoint, params=None, data=None): """Wraps PUT requests to the Blue State Digital API. :param endpoint: The Tools API endpoint to call. Does not need to include '/page/api'. :param params: (optional) Dictionary or bytes to be sent in the query string for the :cl...
code_fim
hard
{ "lang": "python", "repo": "pzl/bsd-api-python", "path": "/bsdapi/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pzl/bsd-api-python path: /bsdapi/client.py from time import sleep import requests from .auth import BsdApiAuth class BsdApiClient(object): """BsdApiClient""" def __init__(self, base_url, api_id, api_secret): """Constructs the BsdApiClient :param base_url: The secure UR...
code_fim
hard
{ "lang": "python", "repo": "pzl/bsd-api-python", "path": "/bsdapi/client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tkmru/biwx path: /detail_window.py #!/usr/bin/env python3.7 # coding: UTF-8 import wx import string import subprocess import ui_parts import pdfid_v0_2_5.pdfid as pdfidlib from multiprocessing import Queue, Process class DetailWindow(wx.Notebook): def __init__(self, *args, **kwargs): ...
code_fim
hard
{ "lang": "python", "repo": "tkmru/biwx", "path": "/detail_window.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> self.signature_textctrl.AppendText('HEADER\n') for key in header_indexies.keys(): self.signature_textctrl.AppendText(key + ': ' + str(len(header_indexies[key])) + 'signature\n') self.signature_textctrl.AppendText('\nFOOTER\n') for key in footer_indexies.keys():...
code_fim
hard
{ "lang": "python", "repo": "tkmru/biwx", "path": "/detail_window.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> xmlDoc = pdfidlib.PDFiD(filename) header = 'PDF Header: {0}\n'.format(xmlDoc.documentElement.getAttribute('Header')) yield header for node in xmlDoc.documentElement.getElementsByTagName('Keywords')[0].childNodes: yield '{0: <15}{1: 5d}\n'.format(node.getAttribute('Name'), int(node....
code_fim
hard
{ "lang": "python", "repo": "tkmru/biwx", "path": "/detail_window.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, weights=(0.299, 0.587, 0.114)): super(Grayscale, self).__init__() self.weights = weights def process(self, state): state = (self.weights * state).sum(-1) return np.reshape(state, tuple(state.shape) + (1,)) def processed_shape(self, shape): ...
code_fim
medium
{ "lang": "python", "repo": "wassname/tensorforce", "path": "/tensorforce/core/preprocessing/grayscale.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wassname/tensorforce path: /tensorforce/core/preprocessing/grayscale.py # Copyright 2017 reinforce.io. All Rights Reserved. # # 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...
code_fim
hard
{ "lang": "python", "repo": "wassname/tensorforce", "path": "/tensorforce/core/preprocessing/grayscale.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def process(self, state): state = (self.weights * state).sum(-1) return np.reshape(state, tuple(state.shape) + (1,)) def processed_shape(self, shape): return tuple(shape[:-1]) + (1,)<|fim_prefix|># repo: wassname/tensorforce path: /tensorforce/core/preprocessing/grayscale...
code_fim
hard
{ "lang": "python", "repo": "wassname/tensorforce", "path": "/tensorforce/core/preprocessing/grayscale.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xcbat/consolemd path: /tests/test_cmdline.py from io import StringIO # requires pytest-console-scripts def test_unknown_file(script_runner): ret = script_runner.run('consolemd', 'no_such_file') assert not ret.success assert ret.returncode == 2 def test_readme_file(script_runner): ...
code_fim
medium
{ "lang": "python", "repo": "xcbat/consolemd", "path": "/tests/test_cmdline.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_pipe_stdin(script_runner): input = "ȧƈƈḗƞŧḗḓ ŧḗẋŧ ƒǿř ŧḗşŧīƞɠ" stdin = StringIO(input) ret = script_runner.run('consolemd', stdin=stdin) assert ret.success assert ret.stdout == input + '\n' assert ret.stderr == ''<|fim_prefix|># repo: xcbat/consolemd path: /tests/test_cm...
code_fim
medium
{ "lang": "python", "repo": "xcbat/consolemd", "path": "/tests/test_cmdline.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_pipe_empty_stdin(script_runner): stdin = StringIO() ret = script_runner.run('consolemd', stdin=stdin) assert ret.success assert ret.stdout == '' assert ret.stderr == '' def test_pipe_stdin(script_runner): input = "ȧƈƈḗƞŧḗḓ ŧḗẋŧ ƒǿř ŧḗşŧīƞɠ" stdin = StringIO(input) ...
code_fim
hard
{ "lang": "python", "repo": "xcbat/consolemd", "path": "/tests/test_cmdline.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: olivierh59500/spacebin path: /bingroundctrl/decode_log.py #!/usr/bin/env python # Copyright (c) 2016, SafeBreach # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: # # 1. Redistr...
code_fim
hard
{ "lang": "python", "repo": "olivierh59500/spacebin", "path": "/bingroundctrl/decode_log.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if pid_order.count(pid) == 0: pid_order.append(pid) pid_buffer[pid] = {} pid_buffer[pid][msg_seq_id] = data except Exception: pass # For each PID for pid in pid_or...
code_fim
hard
{ "lang": "python", "repo": "olivierh59500/spacebin", "path": "/bingroundctrl/decode_log.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> cmd = 'zip -P {} -r {}_{}_{}.zip {}'.format(zip_pass, output_file, i, last_index, ' '.join(id_group)) log_path = '/var/log/face/zip.log' kwargs = {'cwd': base_dir} returncode = exec_command(cmd, log_path, **kwargs) if returncode != 0: raise RuntimeError...
code_fim
hard
{ "lang": "python", "repo": "kkltcjk/face", "path": "/face/common/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def do_zip(output_file, base_dir, zip_pass): LOG.debug('zip dir %s to %s', base_dir, output_file) ids = os.listdir(base_dir) for i in range(0, len(ids), 1000): last_index = i + 1000 if (i + 1000) < len(ids) else len(ids) id_group = ids[i: last_index] cmd = 'zip -P {} ...
code_fim
hard
{ "lang": "python", "repo": "kkltcjk/face", "path": "/face/common/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kkltcjk/face path: /face/common/utils.py import os import logging import subprocess import zipfile import shutil from datetime import datetime import yaml from stevedore import extension from retrying import retry LOG = logging.getLogger(__name__) LOG.setLevel(logging.DEBUG) def get_subclass(...
code_fim
hard
{ "lang": "python", "repo": "kkltcjk/face", "path": "/face/common/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_should_read_image_from_source(self): img = processor.create_image_from("../samples/Toledo/sources/0001-enf.jpg") self.assertIsNotNone(img, "Image not loaded!") if __name__ == '__main__': unittest.main()<|fim_prefix|># repo: dgomezg/hdtr-python path: /tests/Ima...
code_fim
easy
{ "lang": "python", "repo": "dgomezg/hdtr-python", "path": "/tests/ImageTest.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': unittest.main()<|fim_prefix|># repo: dgomezg/hdtr-python path: /tests/ImageTest.py import unittest from image_processing import processor <|fim_middle|>class TestStringMethods(unittest.TestCase): def test_should_read_image_from_source(self): img = processor.c...
code_fim
hard
{ "lang": "python", "repo": "dgomezg/hdtr-python", "path": "/tests/ImageTest.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: dgomezg/hdtr-python path: /tests/ImageTest.py import unittest from image_processing import processor <|fim_suffix|> if __name__ == '__main__': unittest.main()<|fim_middle|>class TestStringMethods(unittest.TestCase): def test_should_read_image_from_source(self): img = pr...
code_fim
hard
{ "lang": "python", "repo": "dgomezg/hdtr-python", "path": "/tests/ImageTest.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|>if disc < 0: print ("No tiene solucion") else: x1= (-b + (disc)**0.5)/(2*a) x2= (-b - (disc)**0.5)/(2*a) print ("El resultado de x es:", x1, x2)<|fim_prefix|># repo: Laura-ss/Python path: /Prácticas/1. Primeras pruebas/Ejercicio_ecuac_2_grado.py a=float (input("Escriba un número para e...
code_fim
easy
{ "lang": "python", "repo": "Laura-ss/Python", "path": "/Prácticas/1. Primeras pruebas/Ejercicio_ecuac_2_grado.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Laura-ss/Python path: /Prácticas/1. Primeras pruebas/Ejercicio_ecuac_2_grado.py a=float (input("Escriba un número para el valor de a:")) b=float (input("Escriba un número para el valor de b:")) c=float (input("Escriba un número para el valor de c:")) <|fim_suffix|>if disc < 0: print ("No tie...
code_fim
easy
{ "lang": "python", "repo": "Laura-ss/Python", "path": "/Prácticas/1. Primeras pruebas/Ejercicio_ecuac_2_grado.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aijiajia/py_structure path: /chap6_bintree.py # -*- coding: utf-8 -*- """ 定义二叉树类 """ class BinTNode(object): def __init__(self, dat, left=None, right=None): self.data = dat self.left = left self.right = right class BinTree(object): """docstring for BinTree""" ...
code_fim
hard
{ "lang": "python", "repo": "aijiajia/py_structure", "path": "/chap6_bintree.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self._root def lchild(self): return self._root.left def rchild(self): return self._root.right def set_root(self, rootnode): self._root = rootnode def set_lchild(self, leftchild): self._root.left = leftchild def set_rchild(self, rightc...
code_fim
medium
{ "lang": "python", "repo": "aijiajia/py_structure", "path": "/chap6_bintree.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dbca-wa/wildlifecompliance path: /wildlifecompliance/migrations/0296_auto_20190906_1424.py # -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2019-09-06 06:24 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "dbca-wa/wildlifecompliance", "path": "/wildlifecompliance/migrations/0296_auto_20190906_1424.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('wildlifecompliance', '0295_auto_20190905_1552'), ] operations = [ migrations.CreateModel( name='AllegedOffence', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')...
code_fim
hard
{ "lang": "python", "repo": "dbca-wa/wildlifecompliance", "path": "/wildlifecompliance/migrations/0296_auto_20190906_1424.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: shelfworthy/django-stats path: /stats/tasks.py from celery.task import Task from celery.registry import tasks <|fim_suffix|> def run(self, key, value, date, **kwargs): point, created = DataPoint.objects.get_or_create(key=key, date_added=date) if value > 0: point.va...
code_fim
medium
{ "lang": "python", "repo": "shelfworthy/django-stats", "path": "/stats/tasks.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> point, created = DataPoint.objects.get_or_create(key=key, date_added=date) if value > 0: point.value += value elif value < 0: point.value -= abs(value) point.save() tasks.register(DataPointUpdate)<|fim_prefix|># repo: shelfworthy/django-stats path: ...
code_fim
easy
{ "lang": "python", "repo": "shelfworthy/django-stats", "path": "/stats/tasks.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class DataPointUpdate(Task): def run(self, key, value, date, **kwargs): point, created = DataPoint.objects.get_or_create(key=key, date_added=date) if value > 0: point.value += value elif value < 0: point.value -= abs(value) point.save() tasks.reg...
code_fim
easy
{ "lang": "python", "repo": "shelfworthy/django-stats", "path": "/stats/tasks.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jhonnold/fndash-flask path: /manage.py from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from app import app, db, celery from app.models import Game, User, Stat, StatHistory, Input migrate = Migrate(app, db) manager = Manager(app) manager.add_command('db', Migra...
code_fim
medium
{ "lang": "python", "repo": "jhonnold/fndash-flask", "path": "/manage.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @app.shell_context_processor def make_shell_context(): return dict(app=app, db=db, migrate=migrate, User=User, Game=Game, Stat=Stat, StatHistory=StatHistory, Input=Input) if __name__ == "__main__": manager.run()<|fim_prefix|># repo: jhonnold/fndash-flask path: /manage.py from flask_script impo...
code_fim
medium
{ "lang": "python", "repo": "jhonnold/fndash-flask", "path": "/manage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Create api response object apiResponse = { "isBase64Encoded": False, "statusCode": 200, "body": responseBody, "headers": { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET" } } # Return api response...
code_fim
hard
{ "lang": "python", "repo": "kingslyroche/my_serverless_website_backend", "path": "/lambda/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kingslyroche/my_serverless_website_backend path: /lambda/app.py import json import boto3 import os dynamodb = boto3.resource('dynamodb') tbl_name = os.environ['databaseName'] table = dynamodb.Table(tbl_name) <|fim_suffix|> # Format dynamodb response into variable responseBody = json.dum...
code_fim
hard
{ "lang": "python", "repo": "kingslyroche/my_serverless_website_backend", "path": "/lambda/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>.ListType): self._add_include(includes, 'external', 'list') self._needed_includes_from_type(_type.containedTypeDesc, includes)<|fim_prefix|># repo: DragonFlyBSD/DPorts path: /net/liblinphone/files/patch-wrappers-cpp-genwrapper.py --- wrappers/cpp/genwrapper.py.orig 2017-06-20 10:03:59 UTC +++ wra...
code_fim
hard
{ "lang": "python", "repo": "DragonFlyBSD/DPorts", "path": "/net/liblinphone/files/patch-wrappers-cpp-genwrapper.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: DragonFlyBSD/DPorts path: /net/liblinphone/files/patch-wrappers-cpp-genwrapper.py --- wrappers/cpp/genwrapper.py.orig 2017-06-20 10:03:59 UTC +++ wrappers/cpp/genwrapper.py @@ -650,6 +650,8 @@ class ClassHeader(obje<|fim_suffix|>.ListType): self._add_include(includes, 'external', 'list') ...
code_fim
hard
{ "lang": "python", "repo": "DragonFlyBSD/DPorts", "path": "/net/liblinphone/files/patch-wrappers-cpp-genwrapper.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: akhileshkaushal/annotation-refinery path: /process_kegg.py import os import sys from collections import defaultdict from ConfigParser import SafeConfigParser from slugify import slugify from utils import build_tags_dictionary # Import and set logger import logging logger = logging.getLogger(__n...
code_fim
hard
{ "lang": "python", "repo": "akhileshkaushal/annotation-refinery", "path": "/process_kegg.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }