text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: kuri65536/python-for-android path: /python-modules/twisted/twisted/spread/publish.py # -*- test-case-name: twisted.test.test_pb -*- # Copyright (c) 2001-2008 Twisted Matrix Laboratories. # See LICENSE for details. """ Persistently cached objects for PB. Maintainer: Glyph Lefkowitz Future Plans...
code_fim
hard
{ "lang": "python", "repo": "kuri65536/python-for-android", "path": "/python-modules/twisted/twisted/spread/publish.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: blakaut/WebMark2 path: /qleader/serializers.py from rest_framework import serializers from qleader.models import Run <|fim_suffix|> class Meta: model = Run fields = ['id', 'created', 'energy', 'optimizer', 'tqversion', 'variables', 'history_energies', 'gradie...
code_fim
hard
{ "lang": "python", "repo": "blakaut/WebMark2", "path": "/qleader/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = Run fields = ['id', 'created', 'energy', 'optimizer', 'tqversion', 'variables', 'history_energies', 'gradients', 'angles', 'energies_calls', 'gradients_calls', 'angles_calls', 'final_simplex', 'fun', 'message', 'nfev', 'nit', 'sta...
code_fim
hard
{ "lang": "python", "repo": "blakaut/WebMark2", "path": "/qleader/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = Run fields = ['id', 'created', 'energy', 'optimizer', 'tqversion', 'variables', 'history_energies', 'gradients', 'angles', 'energies_calls', 'gradients_calls', 'angles_calls', 'final_simplex', 'fun', 'message', 'nfev', 'nit', 'status', ...
code_fim
hard
{ "lang": "python", "repo": "blakaut/WebMark2", "path": "/qleader/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@click.group() @util.pass_context def cli(ctx, **kwargs): """Logs resource. """ pass @cli.command() @click.option('--ofile', type=click.STRING, help='Output file name for logs archive.') @util.pass_context def download(ctx, **kwargs): logapi = LogAPI(ecx_session=ctx.ecx_session) outf...
code_fim
medium
{ "lang": "python", "repo": "ghas-results/ecxclient", "path": "/ecxclient/cli/commands/cmd_logs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> logapi = LogAPI(ecx_session=ctx.ecx_session) outfile = logapi.download_logs(kwargs['ofile']) click.echo("Log archive: %s" % outfile)<|fim_prefix|># repo: ghas-results/ecxclient path: /ecxclient/cli/commands/cmd_logs.py import json import logging import sys import time import click from tabu...
code_fim
hard
{ "lang": "python", "repo": "ghas-results/ecxclient", "path": "/ecxclient/cli/commands/cmd_logs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ghas-results/ecxclient path: /ecxclient/cli/commands/cmd_logs.py import json import logging import sys import time import click from tabulate import tabulate <|fim_suffix|>@cli.command() @click.option('--ofile', type=click.STRING, help='Output file name for logs archive.') @util.pass_context d...
code_fim
medium
{ "lang": "python", "repo": "ghas-results/ecxclient", "path": "/ecxclient/cli/commands/cmd_logs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return render_template('notfound.html'),404<|fim_prefix|># repo: OscarMugendi/Pizza-Shop path: /app/main/error.py from flask import render_template from . import main <|fim_middle|>@main.errorhandler(404) def notFoundError(error):
code_fim
easy
{ "lang": "python", "repo": "OscarMugendi/Pizza-Shop", "path": "/app/main/error.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return render_template('notfound.html'),404<|fim_prefix|># repo: OscarMugendi/Pizza-Shop path: /app/main/error.py from flask import render_template from . import main <|fim_middle|>@main.errorhandler(404) def notFoundError(error):
code_fim
easy
{ "lang": "python", "repo": "OscarMugendi/Pizza-Shop", "path": "/app/main/error.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OscarMugendi/Pizza-Shop path: /app/main/error.py from flask import render_template from . import main <|fim_suffix|> return render_template('notfound.html'),404<|fim_middle|>@main.errorhandler(404) def notFoundError(error):
code_fim
easy
{ "lang": "python", "repo": "OscarMugendi/Pizza-Shop", "path": "/app/main/error.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pmartin23/metapub path: /bin/demo_get_related_pmids.py from __future__ import absolute_import, print_function, unicode_literals <|fim_suffix|>result = fetch.related_pmids(pmid) for key in list(result.keys()): print(key) for pmid in result[key]: outp = pmid article = fetc...
code_fim
medium
{ "lang": "python", "repo": "pmartin23/metapub", "path": "/bin/demo_get_related_pmids.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from metapub import PubMedFetcher fetch = PubMedFetcher() try: pmid = sys.argv[1] except IndexError: print("Supply a pubmed ID as the argument to this script.") sys.exit() result = fetch.related_pmids(pmid) for key in list(result.keys()): print(key) for pmid in result[key]: ...
code_fim
medium
{ "lang": "python", "repo": "pmartin23/metapub", "path": "/bin/demo_get_related_pmids.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def update(self): ensure_path_nonexistent(self.path) with open(self.path, "w"): # We're just touching it. pass @property def namevar_for_breadcrumb(self): if isinstance(self.parent, File): return os.path.basename(self.path) r...
code_fim
hard
{ "lang": "python", "repo": "flyingcircusio/batou", "path": "/src/batou/lib/file.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: flyingcircusio/batou path: /src/batou/lib/file.py ty file in the work directory. # If you really want an empty File then you can either use # Presence(), or (recommended) use File('asdf', content='') to # make this explicit. We don't want to acciden...
code_fim
hard
{ "lang": "python", "repo": "flyingcircusio/batou", "path": "/src/batou/lib/file.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Cause the rendered data to be human readable. Not all parsers support # this so it can be turned off. human_readable = True # The final content that will be written out to the target. content_compact = None content_readable = None _content_source_attribute = "data" def...
code_fim
hard
{ "lang": "python", "repo": "flyingcircusio/batou", "path": "/src/batou/lib/file.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual( kb.isa(logic.expr('Petunia'), logic.expr('Petunia')), True) self.assertEqual(kb.isa(logic.expr('Petunia'), logic.expr('Mammal')), True) self.assertEqual(kb.isa(logic.expr('Petunia'), logic.expr('Cat')), True) self.assertEqual(kb.isa(logic.expr('Petunia'), logi...
code_fim
hard
{ "lang": "python", "repo": "Energid/energid_nlp", "path": "/energid_nlp/tests/logic_test.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Define 'Color' as an inherited fluent. kb.define_fluent(logic.expr('Color'), inherited=True) kb.tell(logic.expr('Color(Petunia, Gray)')) # Define 'Name' as an non-inherited fluent. kb.define_fluent(logic.expr('Name'), inherited=False) kb.tell(logic.expr('Name(Animal, Peter)')) ...
code_fim
hard
{ "lang": "python", "repo": "Energid/energid_nlp", "path": "/energid_nlp/tests/logic_test.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Energid/energid_nlp path: /energid_nlp/tests/logic_test.py tAllBindingsEqual( kb.ask_all(logic.expr('Bind(?x, boo)')), [{'?x': 'boo'}]) self.assertBindingsEqual( kb.ask(logic.expr('(Color(Cat, ?b) & Bind(?b, Boo))')), False) # Shouldn't be able to assert a 'Bind'. self.as...
code_fim
hard
{ "lang": "python", "repo": "Energid/energid_nlp", "path": "/energid_nlp/tests/logic_test.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_is_parallel3(self): # plane 1: -7.926x + 8.625y - 7.217 z = -7.952 # plane 2: -2.642x + 2.875y - 2.404z = -2.443 plane1 = Plane(Vector([-7.926, 8.625, -7.212]), -7.952) plane2 = Plane(Vector([-2.642, 2.875, -2.404]), -2.443) result = plane1.is_parallel...
code_fim
hard
{ "lang": "python", "repo": "kholohan/ud953-linear-algebra", "path": "/test/testPlane.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # plane 1: -0.412x + 3.806y + 0.728z = -3.46 # plane 2: 1.03x + 9.515y - 1.82z = 8.65 plane1 = Plane(Vector([-0.412, 3.806, 0.728]), -3.46) plane2 = Plane(Vector([1.03, 9.515, -1.82]), 8.65) result = plane1.is_parallel(plane2) self.assertFalse(result) ...
code_fim
hard
{ "lang": "python", "repo": "kholohan/ud953-linear-algebra", "path": "/test/testPlane.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kholohan/ud953-linear-algebra path: /test/testPlane.py # -*- coding: utf-8 -*- # Author: github.com/kholohan import unittest from vector import Vector from plane import Plane class PlaneTest(unittest.TestCase): def test_is_equal(self): # plane 1: -0.412x + 3.806y + 0.728z = -3.46 ...
code_fim
hard
{ "lang": "python", "repo": "kholohan/ud953-linear-algebra", "path": "/test/testPlane.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def query(query, parameters=(), single=False): """ Sends a formatted query to the database. Can return a list of rows or a single value depending on the ``single`` argument. """ cur = get_db().execute(query, parameters) cur.row_factory = dict_factory #cur = cur.cursor() if...
code_fim
hard
{ "lang": "python", "repo": "kevinschoonover/park-king", "path": "/backend/backend/database.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Disconnects from the current database. """ db = getattr(g, '_database', None) if db is not None: db.close() def query(query, parameters=(), single=False): """ Sends a formatted query to the database. Can return a list of rows or a single value depending on the...
code_fim
hard
{ "lang": "python", "repo": "kevinschoonover/park-king", "path": "/backend/backend/database.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kevinschoonover/park-king path: /backend/backend/database.py """ Implementation of the connection to the application database. """ import sqlite3 from flask import g #DATABASE = ':memory:' DATABASE = '/tmp/park-king.db' def init_app(app): """ Initializes the database and runs the ``sc...
code_fim
medium
{ "lang": "python", "repo": "kevinschoonover/park-king", "path": "/backend/backend/database.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NVIDIA/DALI path: /tools/lint.py #!/usr/bin/env python # Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. 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 o...
code_fim
hard
{ "lang": "python", "repo": "NVIDIA/DALI", "path": "/tools/lint.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def gen_cmd(dali_root_dir, file_list, process_includes=False): """ Command for calling cpplint.py """ if not file_list: return ["true"] cmd = ["python", os.path.join(dali_root_dir, "third_party", "cpplint.py"), "--quiet", "--linelength=100", ...
code_fim
hard
{ "lang": "python", "repo": "NVIDIA/DALI", "path": "/tools/lint.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def add_scalar(self, title=None, value=None, n_iter=None): if title not in self.plots.keys(): self.plots[title] = _PlotData() self.plots[title].add(x=n_iter, y=value) def plot(self, title): if title in self.plots.keys(): self.plots[title].plot(title...
code_fim
medium
{ "lang": "python", "repo": "zhuyin521/LightNLP", "path": "/lightnlp/utils/visualizer/_summary_writer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): self.plots = dict() def add_scalar(self, title=None, value=None, n_iter=None): if title not in self.plots.keys(): self.plots[title] = _PlotData() self.plots[title].add(x=n_iter, y=value) def plot(self, title): if title in self.p...
code_fim
hard
{ "lang": "python", "repo": "zhuyin521/LightNLP", "path": "/lightnlp/utils/visualizer/_summary_writer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhuyin521/LightNLP path: /lightnlp/utils/visualizer/_summary_writer.py import matplotlib.pyplot as plt class _PlotData: def __init__(self): self.x = list() self.y = list() def add(self, x=None, y=None): <|fim_suffix|> x, y = self.x, self.y if len(y) == 0:...
code_fim
medium
{ "lang": "python", "repo": "zhuyin521/LightNLP", "path": "/lightnlp/utils/visualizer/_summary_writer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def drawHier(self): d = self.mouse[1]-self.drag[1] if self.drag[0] != -1 else 0 self.hier.draw(self.canv,(0,self.yoff+d)) def drawHighlight(self): csy = (self.highlight+1)*self.hier.y_unit+self.yoff self.canv[csy-self.hier.y_unit+5:csy+5]=self.color_highlight ...
code_fim
hard
{ "lang": "python", "repo": "asdlei99/cvDictUI", "path": "/cvDictUI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def kill(self): cv2.destroyWindow(self.name) if __name__ == "__main__": def demo1(): dict_obj = {u'control': {u'affirmation_speed': 0.004, u'identity_threshold': 1.0, u'charge_max': 50, u'discharge_max': 100}, u'log': {u'timer': False}, u'language': u'es', u'camera': ...
code_fim
hard
{ "lang": "python", "repo": "asdlei99/cvDictUI", "path": "/cvDictUI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: asdlei99/cvDictUI path: /cvDictUI.py import cv2 import numpy as np import os import csv KEY_UP = [0,91] KEY_DOWN = [1,93] KEY_RETURN = [13] KEY_ESCAPE = [27] KEY_BACKSPACE = [8,127] MODE_VIEW = 0 MODE_ENTRY = 1 CV_FONT_WIDTH = 10 INT_STRING = "01234567890-" FLOAT_STRING = "01234567890.-" STR_...
code_fim
hard
{ "lang": "python", "repo": "asdlei99/cvDictUI", "path": "/cvDictUI.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> acc_s = df['D acc src'][-100:].mean() acc_t = df['D acc tgt'][-100:].mean() if accs == None: accs = acc_s else: accs = max(accs, acc_s) if acct == None: acct = acc_t else: ...
code_fim
hard
{ "lang": "python", "repo": "mrsempress/transfer_learning", "path": "/codes/AssociativeDA/solver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mrsempress/transfer_learning path: /codes/AssociativeDA/solver.py # encoding=utf-8 """ Created on 14:23 2019/07/24 @author: Chenxi Huang Minimal Training Script for Associative Domain Adaptation """ import time import pandas as pd import tqdm import torch from torch import nn import L...
code_fim
hard
{ "lang": "python", "repo": "mrsempress/transfer_learning", "path": "/codes/AssociativeDA/solver.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> num_iter += 1 df = pd.DataFrame(train_hist) # df.to_csv(osp.join(savedir, 'losshistory.csv')) acc_s = df['D acc src'][-100:].mean() acc_t = df['D acc tgt'][-100:].mean() if accs == None: accs = acc_s el...
code_fim
hard
{ "lang": "python", "repo": "mrsempress/transfer_learning", "path": "/codes/AssociativeDA/solver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for i in sorted(intervals, key=lambda x: x[0]): if result and result[-1][1] >= i[0]: result[-1][1] = max(result[-1][1], i[1]) else: result.append(i) return result<|fim_prefix|># repo: Voley/AlgorithmicProblemsV2 path: /Sort/merge/Solution.py # Support cod...
code_fim
medium
{ "lang": "python", "repo": "Voley/AlgorithmicProblemsV2", "path": "/Sort/merge/Solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Voley/AlgorithmicProblemsV2 path: /Sort/merge/Solution.py # Support code def merge(intervals): <|fim_suffix|> result = [] for i in sorted(intervals, key=lambda x: x[0]): if result and result[-1][1] >= i[0]: result[-1][1] = max(result[-1][1], i[1]) else: ...
code_fim
easy
{ "lang": "python", "repo": "Voley/AlgorithmicProblemsV2", "path": "/Sort/merge/Solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hadryan/FairnessRetrievalResults path: /adversarial_mitigation/metrics_utility.py import os import sys import subprocess import pdb import pickle import argparse MAX_MRR_RANK = 200 class EvaluationTool(): def __init__(self): pass def evaluate(self, candidate, run_path_for_s...
code_fim
hard
{ "lang": "python", "repo": "Hadryan/FairnessRetrievalResults", "path": "/adversarial_mitigation/metrics_utility.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def evaluate(self, candidate, run_path_for_save, evalparam=None, validaterun=False): """Compute MRR metric """ results_perq = {'recip_rank':{}} results_avg = {'recip_rank':{}} MRR = 0 ranking = [] for qid in candidate: if qid...
code_fim
hard
{ "lang": "python", "repo": "Hadryan/FairnessRetrievalResults", "path": "/adversarial_mitigation/metrics_utility.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> I_f=self.I_E(self.fake_B) self.fake_B_recon=self.netG(torch.cat([I_f.data,AUR],dim=1)) torchvision.utils.save_image((self.fake_B_recon*0.5)+0.5,desti+'/'+str(i)+'_re'+'.png') # #put your video_path ...
code_fim
hard
{ "lang": "python", "repo": "RocketFlash/potternews", "path": "/icface/models/pix2pix_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # initialize optimizers self.schedulers = [] self.optimizers = [] self.optimizer_I = torch.optim.Adam(self.I_E.parameters(),lr=opt.lr, betas=(opt.beta1, 0.999)) #0.1 in other program self.optimizer_G = torch.optim.RMSprop(self.netG....
code_fim
hard
{ "lang": "python", "repo": "RocketFlash/potternews", "path": "/icface/models/pix2pix_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RocketFlash/potternews path: /icface/models/pix2pix_model.py import torch from collections import OrderedDict #from torch.autograd import Variable import util.util as util from util.image_pool import ImagePool from .base_model import BaseModel from . import networks #import itertools import torch...
code_fim
hard
{ "lang": "python", "repo": "RocketFlash/potternews", "path": "/icface/models/pix2pix_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kvesteri/sqlalchemy-continuum path: /tests/test_composite_primary_key.py import sqlalchemy as sa from sqlalchemy_continuum import version_class from tests import TestCase class TestCompositePrimaryKey(TestCase): def create_models(self): class User(self.Model): __tablenam...
code_fim
hard
{ "lang": "python", "repo": "kvesteri/sqlalchemy-continuum", "path": "/tests/test_composite_primary_key.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class TeamMember(self.Model): __tablename__ = 'team_member' __versioned__ = {} user_id = sa.Column( sa.Integer, nullable=False ) team_id = sa.Column( sa.Integer, nullable=Fal...
code_fim
hard
{ "lang": "python", "repo": "kvesteri/sqlalchemy-continuum", "path": "/tests/test_composite_primary_key.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: chaofan-zheng/tedu-python-demo path: /month01/all_code/day02/exercise04.py """ 画出下列代码内存图,说出终端显示结果 """ # insert 键:切换插入或者改写模式 name_of_<|fim_suffix|>beijing + region region = "省" print(name_of_beijing_region) # 北京市 del name_of_beijing print(name_of_beijing_region) # 北京市<|fim_middle|>beijing, r...
code_fim
medium
{ "lang": "python", "repo": "chaofan-zheng/tedu-python-demo", "path": "/month01/all_code/day02/exercise04.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># 北京市 del name_of_beijing print(name_of_beijing_region) # 北京市<|fim_prefix|># repo: chaofan-zheng/tedu-python-demo path: /month01/all_code/day02/exercise04.py """ 画出下列代码内存图,说出终端显示结果 """ # insert 键:切换插入或者改写模式 name_of_<|fim_middle|>beijing, region = "北京", "市" name_of_beijing_region = name_of_beijing + ...
code_fim
medium
{ "lang": "python", "repo": "chaofan-zheng/tedu-python-demo", "path": "/month01/all_code/day02/exercise04.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class PaginationContext(StaffUserMixin, TestCase): """Ensure proper pagination structures are placed in the template context""" permissions = ['browse_sms', ] model = SMS def setUp(self): super(PaginationContext, self).setUp() self.factory = RequestFactory() self....
code_fim
hard
{ "lang": "python", "repo": "SmartElect/SmartElect", "path": "/libya_elections/tests/test_bread_views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SmartElect/SmartElect path: /libya_elections/tests/test_bread_views.py from django.test import TestCase, RequestFactory from django.urls import NoReverseMatch, reverse from libya_elections.tests.utils import ResponseCheckerMixin from libya_site.tests.factories import UserFactory from register.mo...
code_fim
hard
{ "lang": "python", "repo": "SmartElect/SmartElect", "path": "/libya_elections/tests/test_bread_views.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Double check that generic and anonymous site users can't access bread views.""" def test_access(self): UserFactory(username='joe', password='puppy') for m in models: instance = m() urls = instance.get_urls() for url in urls: t...
code_fim
hard
{ "lang": "python", "repo": "SmartElect/SmartElect", "path": "/libya_elections/tests/test_bread_views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kwpolska/django-expenses path: /expenses/migrations/0005_expensetemplate_name.py # Generated by Django 2.1.2 on 2018-10-11 12:20 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('expenses', '0004_delete_billitemtemplate'), ] operations = [ ...
code_fim
easy
{ "lang": "python", "repo": "Kwpolska/django-expenses", "path": "/expenses/migrations/0005_expensetemplate_name.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('expenses', '0004_delete_billitemtemplate'), ] operations = [ migrations.AddField( model_name='expensetemplate', name='name', field=models.CharField(default='', max_length=40, verbose_name='name'), preserve_def...
code_fim
easy
{ "lang": "python", "repo": "Kwpolska/django-expenses", "path": "/expenses/migrations/0005_expensetemplate_name.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: usnistgov/labbench path: /labbench/_serialize.pyi from . import util as util from ._rack import ( Rack as Rack, import_as_rack as import_as_rack, update_parameter_dict as update_parameter_dict, ) from _typeshed import Incomplete from pathlib import Path <|fim_suffix|> rack: Rack, ...
code_fim
medium
{ "lang": "python", "repo": "usnistgov/labbench", "path": "/labbench/_serialize.pyi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def write_table_stub(rack: Rack, name: str, path: Path, with_defaults: bool = ...): ... def dump_rack( rack: Rack, output_path: Path, sourcepath: Path, pythonpath: Path = ..., exist_ok: bool = ..., with_defaults: bool = ..., skip_tables: bool = ..., ): ... def read_yaml_config(...
code_fim
medium
{ "lang": "python", "repo": "usnistgov/labbench", "path": "/labbench/_serialize.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.key def is_root(self): return not bool(self.key) def has_view(self): from djangobmf.sites import site return self.key in [i.key for i in getattr(site, 'dashboards', [])] class Meta: abstract = True ordering = ('key',)<|fim_prefix|>...
code_fim
hard
{ "lang": "python", "repo": "caputomarcos/django-bmf", "path": "/djangobmf/models/dashboard.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return not bool(self.key) def has_view(self): from djangobmf.sites import site return self.key in [i.key for i in getattr(site, 'dashboards', [])] class Meta: abstract = True ordering = ('key',)<|fim_prefix|># repo: caputomarcos/django-bmf path: /djangobm...
code_fim
hard
{ "lang": "python", "repo": "caputomarcos/django-bmf", "path": "/djangobmf/models/dashboard.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: caputomarcos/django-bmf path: /djangobmf/models/dashboard.py #!/usr/bin/python # ex:set fileencoding=utf-8: from __future__ import unicode_literals # from django.conf import settings from django.db import models from django.utils.encoding import python_2_unicode_compatible # from django.utils.t...
code_fim
medium
{ "lang": "python", "repo": "caputomarcos/django-bmf", "path": "/djangobmf/models/dashboard.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pipeline.add_stage(stage_name = 'Source', actions = [ cp_actions.GithubSourceAction( oauth_token = github_token, output = source_output, repo = 'devops-serverless-app-aws-cdk', branch = 'main', owner = 'adamdubey', ...
code_fim
hard
{ "lang": "python", "repo": "adamdubey/devops-serverless-app-aws-cdk", "path": "/stacks/codepipeline_backend.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adamdubey/devops-serverless-app-aws-cdk path: /stacks/codepipeline_backend.py from aws_cdk import ( aws_codepipeline as cp, aws_codepipeline_actions as cp_actions, aws_codebuild as cb, aws_s3 as s3, aws_secretsmanager as sm, aws_iam as iam, aws_ssm as ssm, core ) ...
code_fim
hard
{ "lang": "python", "repo": "adamdubey/devops-serverless-app-aws-cdk", "path": "/stacks/codepipeline_backend.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: uk-gov-mirror/LandRegistry.maintain-frontend path: /maintain_frontend/app.py from flask import Flask, g, request, redirect, current_app, Response from maintain_frontend.dependencies.session_api.session import Session from maintain_frontend.constants.permissions import Permissions from werkzeug.co...
code_fim
hard
{ "lang": "python", "repo": "uk-gov-mirror/LandRegistry.maintain-frontend", "path": "/maintain_frontend/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> expire_date = datetime.datetime.now() expire_date = expire_date + datetime.timedelta(minutes=5) redirect_to_logout = redirect(path) if not request.is_xhr: response = current_app.make_response(redirect_to_logout) response.set_cookie('Location', value=request.path, httponly=...
code_fim
hard
{ "lang": "python", "repo": "uk-gov-mirror/LandRegistry.maintain-frontend", "path": "/maintain_frontend/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @commands.command(aliases=["re"]) async def redo(self, ctx: commands.Context): """Reply to a message to rerun it if its a command, helps when you've made typos""" ref = ctx.message.reference if not ref: return try: message = await ctx.channel...
code_fim
hard
{ "lang": "python", "repo": "CodeWithSwastik/Tech-Struck", "path": "/bot/core.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CodeWithSwastik/Tech-Struck path: /bot/core.py from discord import Color, Embed, NotFound from discord.ext import commands class Common(commands.Cog): def __init__(self, bot: commands.Bot): self.bot = bot @commands.command(aliases=["latency"]) async def ping(self, ctx: comm...
code_fim
hard
{ "lang": "python", "repo": "CodeWithSwastik/Tech-Struck", "path": "/bot/core.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> await ctx.send(embed=embed) @commands.command(aliases=["re"]) async def redo(self, ctx: commands.Context): """Reply to a message to rerun it if its a command, helps when you've made typos""" ref = ctx.message.reference if not ref: return try: ...
code_fim
hard
{ "lang": "python", "repo": "CodeWithSwastik/Tech-Struck", "path": "/bot/core.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> DEBUG = 100 INFO = 300 WARNING = 500 ERROR = 700 @classmethod def to_choices(cls): return ( (cls.DEBUG, 'DEBUG'), (cls.INFO, 'INFO'), (cls.WARNING, 'WARNING'), (cls.ERROR, 'ERROR'),...
code_fim
hard
{ "lang": "python", "repo": "wbar/poc-import", "path": "/src/pocimport/importing/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wbar/poc-import path: /src/pocimport/importing/models.py from django.db import models from .managers import ImportProcessManager # Create your models here. class ImportProcess(models.Model): thunder_id = models.PositiveIntegerField( verbose_name='Thundering frame id', unique...
code_fim
medium
{ "lang": "python", "repo": "wbar/poc-import", "path": "/src/pocimport/importing/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cubacrazy/Rust-Server path: /UPNP/upnp-add-port #!/usr/bin/env python import miniupnpc u = miniupnpc.UPnP() u.discoverdelay=200;u.discover();u.selectigd() import sys if len(sys.ar<|fim_suffix|>: sys.stderr.write("Syntax: upnp-add-port external-port [internal-port]\n"),sys.exit(1) u.addportmappin...
code_fim
medium
{ "lang": "python", "repo": "cubacrazy/Rust-Server", "path": "/UPNP/upnp-add-port", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ntPortNo,'upnp-add-port '+str(extPortNo),'') u.addportmapping(extPortNo,'UDP',u.lanaddr,intPortNo,'upnp-add-port '+str(extPortNo),'')<|fim_prefix|># repo: cubacrazy/Rust-Server path: /UPNP/upnp-add-port #!/usr/bin/env python import miniupnpc u = miniupnpc.UPnP() u.discoverdelay=200;u.discover();u.selecti...
code_fim
hard
{ "lang": "python", "repo": "cubacrazy/Rust-Server", "path": "/UPNP/upnp-add-port", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, ExecuteProcess, EmitEvent from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import LaunchConfiguration, PythonExpression from...
code_fim
medium
{ "lang": "python", "repo": "MROS-RobMoSys-ITP/mros_modes_observer", "path": "/launch/mros_components_obs_launch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MROS-RobMoSys-ITP/mros_modes_observer path: /launch/mros_components_obs_launch.py # Copyright (c) 2018 Intel Corporation # # 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...
code_fim
hard
{ "lang": "python", "repo": "MROS-RobMoSys-ITP/mros_modes_observer", "path": "/launch/mros_components_obs_launch.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> title = TextMobject("Hyperdarts") title.scale(1.5) title.to_edge(UP) n = self.num_darts_in_initial_flurry points = np.random.normal(size=n * 3).reshape((n, 3)) points[:, 2] = 0 points *= 0.75 board = Dartboard() board.match_width(sq...
code_fim
hard
{ "lang": "python", "repo": "pdcxs/manim", "path": "/active_projects/hyperdarts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pdcxs/manim path: /active_projects/hyperdarts.py ass HyperdartScene(Scene): CONFIG = { "square_width": 6, "square_style": { "stroke_width": 2, "fill_color": BLUE, "fill_opacity": 0.5, }, "circle_style": { "fill_co...
code_fim
hard
{ "lang": "python", "repo": "pdcxs/manim", "path": "/active_projects/hyperdarts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pdcxs/manim path: /active_projects/hyperdarts.py elf.circle_center_dot) def get_square(self): return Square( side_length=self.square_width, **self.square_style ) def get_circle(self, square=None): square = square or self.square cir...
code_fim
hard
{ "lang": "python", "repo": "pdcxs/manim", "path": "/active_projects/hyperdarts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: buscarini/meta path: /templates/model/platforms/swift_coredata/Platform.py import sys import os import json import meta import inflect pluralEngine = inflect.engine() from meta.MetaProcessor import MetaProcessor class Platform(MetaProcessor): """docstring for Platform""" def entityName...
code_fim
hard
{ "lang": "python", "repo": "buscarini/meta", "path": "/templates/model/platforms/swift_coredata/Platform.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """docstring for finalFileName""" entityName = None if hash!=None and 'entityName' in hash: entityName = hash['entityName'] if (entityName): fileName = fileName.replace("entity",entityName) return fileName<|fim_prefix|># repo: busca...
code_fim
hard
{ "lang": "python", "repo": "buscarini/meta", "path": "/templates/model/platforms/swift_coredata/Platform.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_output(grad, inputv, inputm, input_param, beta_1, one_minus_beta_1, beta_2, one_minus_beta_2, epsilon, steps, do_use_weight, weight_decay_rate, enable_graph_kernel=False): context.set_context(enable_graph_kernel=enable_graph_kernel) opt = Net(Tensor(inputv), Tensor(inputm))...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/mindspore", "path": "/tests/st/ops/graph_kernel/test_lamb_apply_optimizer_assign.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> expect = get_output(grad, inputv, inputm, input_param, beta_1, one_minus_beta_1, beta_2, one_minus_beta_2, epsilon, steps, do_use_weight, weight_decay_rate, False) output = get_output(grad, inputv, inputm, input_param, beta_1, one_minus_beta_1, beta_2, one_minus_beta_2, eps...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/mindspore", "path": "/tests/st/ops/graph_kernel/test_lamb_apply_optimizer_assign.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mindspore-ai/mindspore path: /tests/st/ops/graph_kernel/test_lamb_apply_optimizer_assign.py # Copyright 2021 Huawei Technologies Co., Ltd # # 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 ...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/mindspore", "path": "/tests/st/ops/graph_kernel/test_lamb_apply_optimizer_assign.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: darylantony/ghostly path: /ghostly/tests/django/testapp/views.py # -*- coding: utf-8 -*- """ module.name ~~~~~~~~~~~~~~~ Preamble... """ from __future__ import absolute_import, print_function, unicode_literals from django.views.generic import TemplateView class ParameterisedTitleVi...
code_fim
hard
{ "lang": "python", "repo": "darylantony/ghostly", "path": "/ghostly/tests/django/testapp/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def post(self, *args, **kwargs): return self.get(*args, **kwargs) def get_context_data(self, **kwargs): kwargs.update( title=self.request.POST.get('title', self.request.GET.get('title', ...
code_fim
hard
{ "lang": "python", "repo": "darylantony/ghostly", "path": "/ghostly/tests/django/testapp/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tdpsk/flask-miracle-acl path: /flask_miracle/base.py ''' flask_miracle.base ------------------ base class for flask_miracle ''' from miracle.acl import Acl as MiracleAcl class Acl(): """ Base class that communications between Miracle ACL and Flask """ acl = MiracleAcl() ap...
code_fim
hard
{ "lang": "python", "repo": "tdpsk/flask-miracle-acl", "path": "/flask_miracle/base.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Arguments: resource -- the resource to check permission -- the permission to check roles -- a list of roles (default: None) """ if roles is None: roles = self._determine_roles() return self.acl.check_all(roles, resource, permission) ...
code_fim
hard
{ "lang": "python", "repo": "tdpsk/flask-miracle-acl", "path": "/flask_miracle/base.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if hasattr(cls, 'GRANTS'): acl_dict['grants'] = cls.GRANTS return self.load_from_dict(acl_dict) def load_from_dict(self, acl_dict): """ Load acl data from dict, see load_acl for details Arguments: acl_dict -- the dictionary to import ...
code_fim
hard
{ "lang": "python", "repo": "tdpsk/flask-miracle-acl", "path": "/flask_miracle/base.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def inner(request, *args, **kwargs): if request.method != "GET": return json_405_response() request.data = {} return func(request, *args, **kwargs) inner.__name__ = func.__name__ inner.__module__ = func.__module__ inner.__doc__ = func.__doc__ inner._...
code_fim
hard
{ "lang": "python", "repo": "manibhushan05/tms", "path": "/web/transiq/api/decorators.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: manibhushan05/tms path: /web/transiq/api/decorators.py import json from api.helper import json_405_response, json_error_response def no_test(func): """ Use for URLs that do not require testing, use wisely """ def inner(request, *args, **kwargs): return func(request, *ar...
code_fim
hard
{ "lang": "python", "repo": "manibhushan05/tms", "path": "/web/transiq/api/decorators.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if request.method != "GET": return json_405_response() request.data = {} return func(request, *args, **kwargs) inner.__name__ = func.__name__ inner.__module__ = func.__module__ inner.__doc__ = func.__doc__ inner.__dict__ = func.__dict__ return inner ...
code_fim
medium
{ "lang": "python", "repo": "manibhushan05/tms", "path": "/web/transiq/api/decorators.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wilbertgeng/LintCode_exercise path: /Binary_Search/462.py """462. Total Occurrence of Target """ class Solution: """ @param A: A an integer array sorted in ascending order @param target: An integer @return: An integer """ def totalOccurrence(self, A, target): <|fim_suffix|...
code_fim
hard
{ "lang": "python", "repo": "wilbertgeng/LintCode_exercise", "path": "/Binary_Search/462.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while start + 1 < end: mid = (start + end) // 2 if A[mid] < target: start = mid else: end = mid occur = 0 if A[start] == target: occur = start elif A[end] == target: occur = end ...
code_fim
hard
{ "lang": "python", "repo": "wilbertgeng/LintCode_exercise", "path": "/Binary_Search/462.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> line_num += 1 if len(line) in points_count_freq: points_count_freq[len(line)] += 1 else: points_count_freq[len(line)] = 1 if line_num <= start_from: continue # if line is not empty if line and len(line) >= minimum_value...
code_fim
hard
{ "lang": "python", "repo": "samadDotDev/fileStreamSimulation", "path": "/parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: samadDotDev/fileStreamSimulation path: /parser.py from csv import reader import time import argparse # Define defaults default_streaming_delay = 1 # Streaming Delay in seconds to generate a new values file for each trajectory (line) in output dir default_minimum_values = 50 # Minimum number ...
code_fim
hard
{ "lang": "python", "repo": "samadDotDev/fileStreamSimulation", "path": "/parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>anna Featuring Mikky Ekko'): (2013, 13), ('Get Lucky', 'Daft Punk Featuring Pharrell Williams'): (2013, 14), ('I Knew You Were Trouble.', 'Taylor Swift'): (2013, 16), ("We Can't Stop", 'Miley Cyrus'): (2013, 17), ('Suit & Tie', 'Justin Timberlake Featuring JAY Z'): (2013, 20), ("Cups (Pitch Perfect's When...
code_fim
hard
{ "lang": "python", "repo": "prathits012/songData", "path": "/data/songs_dict.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: prathits012/songData path: /data/songs_dict.py ant', 'Lady Gaga Featuring R. Kelly'): (2014, 84), ("Can't Remember To Forget You", 'Shakira Featuring Rihanna'): (2014, 85), ('Amnesia', '5 Seconds Of Summer'): (2014, 86), ('No Mediocre', 'T.I. Featuring Iggy Azalea'): (2014, 87), ('Come With Me No...
code_fim
hard
{ "lang": "python", "repo": "prathits012/songData", "path": "/data/songs_dict.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>no Mars'): (2013, 8), ('Cruise', 'Florida Georgia Line Featuring Nelly'): (2013, 9), ('Locked Out Of Heaven', 'Bruno Mars'): (2013, 11), ('Ho Hey', 'The Lumineers'): (2013, 12), ('Stay', 'Rihanna Featuring Mikky Ekko'): (2013, 13), ('Get Lucky', 'Daft Punk Featuring Pharrell Williams'): (2013, 14), ('I Kn...
code_fim
hard
{ "lang": "python", "repo": "prathits012/songData", "path": "/data/songs_dict.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('ptart', '0003_project_conclusion'), ] operations = [ migrations.AddField( model_name='screenshot', name='caption', field=models.CharField(blank=True, default='', max_length=256), ), ]<|fim_prefix|># repo: cert...
code_fim
easy
{ "lang": "python", "repo": "certmichelin/PTART", "path": "/ptart/migrations/0004_screenshot_caption.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: certmichelin/PTART path: /ptart/migrations/0004_screenshot_caption.py # Generated by Django 2.2.1 on 2019-07-01 16:19 <|fim_suffix|> dependencies = [ ('ptart', '0003_project_conclusion'), ] operations = [ migrations.AddField( model_name='screenshot', ...
code_fim
medium
{ "lang": "python", "repo": "certmichelin/PTART", "path": "/ptart/migrations/0004_screenshot_caption.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>flm = FLM(H, alpha, M=2, N=l, scale=0.035, correct_hurst=True) flm.generate_realizations(nrealizations) flm.autocorrelation() h_estimate = np.log(2 * flm.acf[:, 1].mean() + 2) / (2 * np.log(2)) flm.plot_autocorrelation(label='Corrected Input H \n Estimated H: %.2f' % h_estimate, overlay=True, max_k=max_k)...
code_fim
hard
{ "lang": "python", "repo": "NKM-ML/LLC_Membranes", "path": "/Ben_Manuscripts/stochastic_transport/supporting_figures/demonstrate_hurst_correction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NKM-ML/LLC_Membranes path: /Ben_Manuscripts/stochastic_transport/supporting_figures/demonstrate_hurst_correction.py #!/usr/bin/env python from LLC_Membranes.timeseries.fractional_levy_motion import FLM import numpy as np import matplotlib.pyplot as plt <|fim_suffix|>flm = FLM(H, alpha, M=2, N=l...
code_fim
medium
{ "lang": "python", "repo": "NKM-ML/LLC_Membranes", "path": "/Ben_Manuscripts/stochastic_transport/supporting_figures/demonstrate_hurst_correction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/ms_data/datatypes/facets/long/long_max_inclusive003_xsd/__init__.py from output.models.ms_data.datatypes.facets<|fim_suffix|>) __all__ = [ "FooType", "Test", ]<|fim_middle|>.long.long_max_inclusive003_xsd.long_max_inclusive003 import ( FooT...
code_fim
medium
{ "lang": "python", "repo": "tefra/xsdata-w3c-tests", "path": "/output/models/ms_data/datatypes/facets/long/long_max_inclusive003_xsd/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>clusive003 import ( FooType, Test, ) __all__ = [ "FooType", "Test", ]<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/ms_data/datatypes/facets/long/long_max_inclusive003_xsd/__init__.py from output.models.ms_data.datatypes.facets<|fim_middle|>.long.long_max_inclusive003_...
code_fim
easy
{ "lang": "python", "repo": "tefra/xsdata-w3c-tests", "path": "/output/models/ms_data/datatypes/facets/long/long_max_inclusive003_xsd/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Reads temperature em Celcius """ return self.read_short(65) / 340.0 + 36.53 def acceleration(self): """ Reads acceleration g """ return [(self.read_short(i) / 16384.0) for i in xrange(59, 65, 2)] def data(self): """ ...
code_fim
hard
{ "lang": "python", "repo": "schindler/vibration_analyzer", "path": "/raspberry/mpu6050/mpu6050.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: schindler/vibration_analyzer path: /raspberry/mpu6050/mpu6050.py """ MPU6050 Module """ try: import smbus except ImportError: #Probably running test cases import mocksmbus as smbus from time import sleep class Sensor(object): """ Basic configuration https://www...
code_fim
medium
{ "lang": "python", "repo": "schindler/vibration_analyzer", "path": "/raspberry/mpu6050/mpu6050.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }