text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> p['control_rates:{0}_rate'.format(name)] = \ np.reshape(self.get_values('{0}_rate'.format(name)), shape) p['control_rates:{0}_rate2'.format(name)] = \ np.reshape(self.get_values('{0}_rate2'.format(name)), shape) # Assign design parameters ...
code_fim
hard
{ "lang": "python", "repo": "bbrelje/dymos", "path": "/dymos/utils/simulation/phase_simulation_results.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Parameters ---------- filename : str The path of the file from which to load the simulation results. """ cr = CaseReader(filename) case = cr.system_cases.get_case(-1) loaded_outputs = cr.list_outputs(case=case, explicit=True, implicit=Tru...
code_fim
hard
{ "lang": "python", "repo": "bbrelje/dymos", "path": "/dymos/utils/simulation/phase_simulation_results.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bbrelje/dymos path: /dymos/utils/simulation/phase_simulation_results.py from __future__ import print_function, division, absolute_import from six import iteritems import sys import numpy as np from openmdao.api import Problem, Group, IndepVarComp, SqliteRecorder, CaseReader from openmdao.utils...
code_fim
hard
{ "lang": "python", "repo": "bbrelje/dymos", "path": "/dymos/utils/simulation/phase_simulation_results.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # JSON/Form content type. if args.json or (not args.form and data): if stdin_isatty: data = json.dumps(data) if not files and ('Content-Type' not in headers and (data or args.json)): headers['Content-Type'] = TYPE_JSON elif not files and 'Content-Type' n...
code_fim
hard
{ "lang": "python", "repo": "lorin/httpie", "path": "/httpie/__main__.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> args = parser.parse_args(args if args is not None else sys.argv[1:]) do_prettify = (args.prettify is True or (args.prettify == cli.PRETTIFY_STDOUT_TTY_ONLY and stdout_isatty)) # Parse request headers and data from the command line. headers = CaseInse...
code_fim
hard
{ "lang": "python", "repo": "lorin/httpie", "path": "/httpie/__main__.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lorin/httpie path: /httpie/__main__.py #!/usr/bin/env python import sys import json try: from collections import OrderedDict except ImportError: OrderedDict = dict import requests from requests.compat import urlparse, str from requests.structures import CaseInsensitiveDict from . import c...
code_fim
hard
{ "lang": "python", "repo": "lorin/httpie", "path": "/httpie/__main__.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: PattonChen/okex-py path: /okex/v5/billtype.py from enum import Enum class BillType(Enum): <|fim_suffix|>class BillSubType(Enum): LINEAR = "linear" INVERSE = "inverse" # ...<|fim_middle|> # 划转 TRANSFER = 1 # 交易 TRADE = 2 # 交割 DELIVERY = 3 # 强制换币 FORCE_S...
code_fim
medium
{ "lang": "python", "repo": "PattonChen/okex-py", "path": "/okex/v5/billtype.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> LINEAR = "linear" INVERSE = "inverse" # ...<|fim_prefix|># repo: PattonChen/okex-py path: /okex/v5/billtype.py from enum import Enum class BillType(Enum): <|fim_middle|> # 划转 TRANSFER = 1 # 交易 TRADE = 2 # 交割 DELIVERY = 3 # 强制换币 FORCE_SWAP = 4 # 强平 FORC...
code_fim
medium
{ "lang": "python", "repo": "PattonChen/okex-py", "path": "/okex/v5/billtype.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Iterate over the nums and, when find a "None", means # the element at the position is missing missing = [] for i in range(len(nums)): if nums[i] == None: missing.append(i+1) return missing<|fim_prefix|># repo: mauricioklein/algorithm-exercises path: /challenge-53/solver.py # # Time...
code_fim
hard
{ "lang": "python", "repo": "mauricioklein/algorithm-exercises", "path": "/challenge-53/solver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mauricioklein/algorithm-exercises path: /challenge-53/solver.py # # Time complexity : O(n) (every elements is swapped at most once) # Space complexity: O(1000000) (constant one million, for the extended array) # def first_thousand_missing(nums): <|fim_suffix|> # Put the elements in the rig...
code_fim
medium
{ "lang": "python", "repo": "mauricioklein/algorithm-exercises", "path": "/challenge-53/solver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while(S_n - data[k][3] > 0): if(k < max_k): k += 1 else: flag_day = True break T_n = data[k-1][1] + ((S_n - data[k-1][3])/data[k][4]) #print("At yield: {0}: T_n: {1}; day: {2}".format(n, ...
code_fim
medium
{ "lang": "python", "repo": "CLAHRCWessex/ForecastED-Replica", "path": "/untitled3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CLAHRCWessex/ForecastED-Replica path: /untitled3.py # -*- coding: utf-8 -*- """ Created on Fri Jun 1 15:30:55 2018 @author: tm3y13 """ def nspp(data): k = 1 S_n = 0 T_n = 0 max_k = 24 day = 1 flag_day = False day_overrun = 0 <|fim_suffix|> yield T_...
code_fim
hard
{ "lang": "python", "repo": "CLAHRCWessex/ForecastED-Replica", "path": "/untitled3.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # FIXME: allow a configurable control-character if msg[0] == '.': return msg.split()[0][1:] else: return msg.split()[0] def choose_dest(ievent): if ievent.channel == conf.nickname: return ievent.nick else: return ievent.channel<|fim_prefix|># repo: dpal...
code_fim
medium
{ "lang": "python", "repo": "dpaleino/pollirio", "path": "/pollirio/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dpaleino/pollirio path: /pollirio/__init__.py # -*- coding: utf-8 -*- from confreader import ConfReader conf = ConfReader('pollirio.ini') commands = {} reactors = {} def get_command(msg): <|fim_suffix|>def choose_dest(ievent): if ievent.channel == conf.nickname: return ievent.nick ...
code_fim
medium
{ "lang": "python", "repo": "dpaleino/pollirio", "path": "/pollirio/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mohisen/zdotfiles path: /6/scripts/pr2.py #LT Autograder. A system that automatically grades short answer essays. #Copyright (C) 2012 Luis Tandalla <|fim_suffix|> for row in reader: line = row.split('\t') for i in range(len(line)-1): fi.write( line[i] + '\t' ) text = cleantext( line[len...
code_fim
hard
{ "lang": "python", "repo": "mohisen/zdotfiles", "path": "/6/scripts/pr2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> text = ps.stem(sentences[0]) for i in range(len(sentences)-1): word = sentences[i+1] if word == 'thoughtful': text = text + " " + word else: text = text + " " + ps.stem( word ) return text def process2( nameFileIn, nameFileOut): ps = PorterStemmer() # It initializes stemmer reader = open(nameF...
code_fim
medium
{ "lang": "python", "repo": "mohisen/zdotfiles", "path": "/6/scripts/pr2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nsnitesh7/courtside path: /game/views.py from datetime import datetime from django.contrib.auth.decorators import login_required from django.http import HttpResponseRedirect from django.shortcuts import render, get_object_or_404 from forms.forms import GameForm from game.models import Player, Sp...
code_fim
hard
{ "lang": "python", "repo": "nsnitesh7/courtside", "path": "/game/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> games = {} games['soccer'] = Game.objects.filter(sport=Sport.objects.get(sport="soccer"), active="true") games['volleyball'] = Game.objects.filter(sport=Sport.objects.get(sport="volleyball"), active="true") games['baseball'] = Game.objects.filter(sport=Sport.objects.get(sport="baseball"), ...
code_fim
hard
{ "lang": "python", "repo": "nsnitesh7/courtside", "path": "/game/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@login_required(login_url='/login/') def delete(request, game_id): game = get_object_or_404(Game, pk=game_id) if request.user != game.owner: return HttpResponseRedirect('/game/%s/' % game_id) game.players.clear() game.delete() return HttpResponseRedirect('/') @login_requir...
code_fim
hard
{ "lang": "python", "repo": "nsnitesh7/courtside", "path": "/game/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> argparser.add_argument('--vcf_s3_path', type=str, help='VCF s3 path', required=True) argparser.add_argument('--annotated_vcf_s3_path', type=str, help='Annotated vcf s3 path', required=True) argparser.add_argument('--working_dir', type=str, default='/scratch') argparser.add_argument('--cmd_...
code_fim
medium
{ "lang": "python", "repo": "stevemmarshall/aws-batch-genomics", "path": "/tools/snpeff/src/run_snpeff.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> working_dir = generate_working_dir(args.working_dir) print ('Downloading vcf') local_vcf_path = download_file(args.vcf_s3_path, working_dir) print ('Running snpeff') annotated_vcf_path = run_snpeff(local_vcf_path, args.cmd_args, working_dir) print ('Uploading %s to %s' % (annotate...
code_fim
medium
{ "lang": "python", "repo": "stevemmarshall/aws-batch-genomics", "path": "/tools/snpeff/src/run_snpeff.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: stevemmarshall/aws-batch-genomics path: /tools/snpeff/src/run_snpeff.py from __future__ import print_function import os import shlex import subprocess from argparse import ArgumentParser from common_utils.s3_utils import download_file, upload_file from common_utils.job_utils import generate_wor...
code_fim
medium
{ "lang": "python", "repo": "stevemmarshall/aws-batch-genomics", "path": "/tools/snpeff/src/run_snpeff.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @socketio.on('disconnect', namespace='/socket') def test_disconnect(): print('Client disconnected') def check_and_clear_session(): try: clear_session_as_str = request.args.get('clear_session') if clear_session_as_str: b = bool(util.strtobool(clear_session_as_str)) ...
code_fim
hard
{ "lang": "python", "repo": "james-work-account/grocery-flask", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: james-work-account/grocery-flask path: /app.py import json import time from datetime import timedelta from distutils import util from urllib.error import HTTPError from flask import Flask, request, render_template, session, escape from flask_limiter import Limiter from flask_limiter.util import ...
code_fim
hard
{ "lang": "python", "repo": "james-work-account/grocery-flask", "path": "/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class ProtobufMessage(Base): __slots__ = () @classmethod def from_protobuf(cls, msg): """Create an instance from a protobuf message.""" if not isinstance(msg, cls._protobuf_cls): raise TypeError("Expected message of type " "%r" % cls._p...
code_fim
hard
{ "lang": "python", "repo": "jcrist/skein", "path": "/skein/objects.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __reduce__(self): return (getattr, (type(self), self._value)) def __repr__(self): return '%s.%s' % (type(self).__name__, self._value) def __str__(self): return self._value def __eq__(self, other): return (self is other or (isinstance(o...
code_fim
hard
{ "lang": "python", "repo": "jcrist/skein", "path": "/skein/objects.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jcrist/skein path: /skein/objects.py import json from datetime import datetime import yaml from .exceptions import context from .utils import format_list, ensure_unicode, datetime_to_millis def typename(cls): if cls is str: return 'string' elif cls is int: return 'inte...
code_fim
hard
{ "lang": "python", "repo": "jcrist/skein", "path": "/skein/objects.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name="speakerproposal", name="email", field=models.EmailField( help_text="The email of the speaker (defaults to the logged in user if empty).", max_length=150, ), ...
code_fim
medium
{ "lang": "python", "repo": "bornhack/bornhack-website", "path": "/src/program/migrations/0072_auto_20190616_1746.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bornhack/bornhack-website path: /src/program/migrations/0072_auto_20190616_1746.py # Generated by Django 2.2.2 on 2019-06-16 15:46 from django.db import migrations, models <|fim_suffix|> operations = [ migrations.AlterField( model_name="speakerproposal", name...
code_fim
medium
{ "lang": "python", "repo": "bornhack/bornhack-website", "path": "/src/program/migrations/0072_auto_20190616_1746.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: surbhim18/revise-tool path: /tester_script.py # #!/usr/bin/env python3 import sys import importlib import torchvision.transforms as transforms import torch import os import random import numpy as np import cv2 from operator import itemgetter import pickle NUM_EXS=5 def validate_dataset(datase...
code_fim
hard
{ "lang": "python", "repo": "surbhim18/revise-tool", "path": "/tester_script.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if att and not att[0]: print('ERROR: If no attribute annotations, must be an empty list i.e. [], got:', att, '\n') if att and not isinstance(att[0], list): print('ERROR: Attribute annotation must be in a list, got:', att[0], '\n') elif att and isinstance(att[0], list): ...
code_fim
hard
{ "lang": "python", "repo": "surbhim18/revise-tool", "path": "/tester_script.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if args.out_file is not None: backup_path = pathlib.Path(args.out_file) else: backup_path = None # Sniffer(backup_path, args.backup_frequency).run() with HciParser(backup_path, args.backup_frequency) as parser: parser.run() if __name__ == "__main__": main()<|...
code_fim
hard
{ "lang": "python", "repo": "mgcfish/btle-sniffer", "path": "/src/btlesniffer/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mgcfish/btle-sniffer path: /src/btlesniffer/main.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Scan for Bluetooth Low Energy packets and attempt to identify them. """ import os import sys import argparse import logging import pathlib # from .sniffer import Sniffer from .hci_parser impo...
code_fim
hard
{ "lang": "python", "repo": "mgcfish/btle-sniffer", "path": "/src/btlesniffer/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.loader.get_testset(*args, **kwargs) def synthetic_corruption(self, *args, **kwargs): return self.loader.synthetic_corruption(*args, **kwargs)<|fim_prefix|># repo: robby927/partial_labelling path: /dataloader/synthetic/engine.py from .classification import CLSynthesizer f...
code_fim
medium
{ "lang": "python", "repo": "robby927/partial_labelling", "path": "/dataloader/synthetic/engine.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: robby927/partial_labelling path: /dataloader/synthetic/engine.py from .classification import CLSynthesizer from .interval_regression import IRSynthesizer from .multilabels import MLSynthesizer from .ranking import RKSynthesizer class Synthesizer: def __init__(self, name): """Synthe...
code_fim
medium
{ "lang": "python", "repo": "robby927/partial_labelling", "path": "/dataloader/synthetic/engine.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>df = pd.DataFrame({}) df = df.append(spearman_correlation_repo_meta('$executionTimeRatio$', 'executionTimePercentage', data), ignore_index=True) df = df.append(spearman_correlation_repo_meta('$measurementWarmupRatio$', 'measurementWarmupRatio', data), ignore_index=True) print(dfOutput(df))<|fim_prefix|>#...
code_fim
medium
{ "lang": "python", "repo": "stewue/masterthesis-evaluation", "path": "/RQ1_Python/execution_time_repo_correlation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: stewue/masterthesis-evaluation path: /RQ1_Python/execution_time_repo_correlation.py import pandas as pd from correlation_helper import spearman, dfOutput def spearman_correlation_repo_meta(name, col, data): return pd.DataFrame({ "name": name, "stars": spearman(data, col, 'sta...
code_fim
hard
{ "lang": "python", "repo": "stewue/masterthesis-evaluation", "path": "/RQ1_Python/execution_time_repo_correlation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>data = pd.read_csv('C:\\Users\\stewue\\OneDrive - Wuersten\\Uni\\19_HS\\Masterarbeit\\Repo\\Evaluation\\RQ1_Results\\aggregated\\executiontimerepocorrelation.csv') data['measurementWarmupRatio'] = pd.to_numeric(data['measurementWarmupRatio'], 'coerce') df = pd.DataFrame({}) df = df.append(spearman_corre...
code_fim
medium
{ "lang": "python", "repo": "stewue/masterthesis-evaluation", "path": "/RQ1_Python/execution_time_repo_correlation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: projectceladon/device-androidia-mixins path: /groups/midi/doc.spec === Overview MIDI (Musical Instrument Digital Interface) is a standard protocol for inter-connecting computers with musical instruments, stage lighting, and other time-oriented media. See [1] for MIDI support in Android. <|fim_s...
code_fim
medium
{ "lang": "python", "repo": "projectceladon/device-androidia-mixins", "path": "/groups/midi/doc.spec", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>--- default when not explicitly selected in mixin spec file, the default option will be used.<|fim_prefix|># repo: projectceladon/device-androidia-mixins path: /groups/midi/doc.spec === Overview MIDI (Musical Instrument Digital Interface) is a standard protocol for inter-connecting computers with musica...
code_fim
medium
{ "lang": "python", "repo": "projectceladon/device-androidia-mixins", "path": "/groups/midi/doc.spec", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.run_check(config, mocks=mocks, force_reload=True) self.assertMetric('ceph.num_full_osds', value=1) self.assertMetric('ceph.num_near_full_osds', value=1) def test_tagged_metrics(self): mocks = { '_collect_raw': lambda x,y,z: json.loads( ...
code_fim
hard
{ "lang": "python", "repo": "serverdensity/sd-agent-core-plugins", "path": "/ceph/test_ceph.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: serverdensity/sd-agent-core-plugins path: /ceph/test_ceph.py # (C) Datadog, Inc. 2010-2017 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) # stdlib import os # 3p import simplejson as json # project from tests.checks.common import AgentCheckTest, Fixtures from check...
code_fim
hard
{ "lang": "python", "repo": "serverdensity/sd-agent-core-plugins", "path": "/ceph/test_ceph.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.run_check(config, mocks=mocks, force_reload=True) self.assertServiceCheck('ceph.overall_status', status=AgentCheck.OK) self.assertServiceCheck('ceph.osd_nearfull', status=AgentCheck.OK) self.assertServiceCheck('ceph.pool_app_not_enabled', count=0) def test_luminou...
code_fim
hard
{ "lang": "python", "repo": "serverdensity/sd-agent-core-plugins", "path": "/ceph/test_ceph.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: JOSELIN-CONDORI/Tarea-01-Sistemas path: /tarea9.py def tarea9(): #definir variables print ("consulta que vacuna te toca") #datos de entrada añosX=int(input("ingresa tu edad:")) #p<|fim_suffix|> if sexoX=="hombre": resultadoaños="se le aplica la vacuna A" if sexoX=="mujer...
code_fim
medium
{ "lang": "python", "repo": "JOSELIN-CONDORI/Tarea-01-Sistemas", "path": "/tarea9.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>una B" if añosX<=16: resultadoaños="se le aplica la vacuna tipo A" #datos de salida print("A la persona:",resultadoaños) tarea9()<|fim_prefix|># repo: JOSELIN-CONDORI/Tarea-01-Sistemas path: /tarea9.py def tarea9(): #definir variables print ("consulta que vacuna te toca") #datos de entrad...
code_fim
medium
{ "lang": "python", "repo": "JOSELIN-CONDORI/Tarea-01-Sistemas", "path": "/tarea9.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># __doc_app_begin__ app = MyGradioServer.bind(app1, app2) # __doc_app_end__ # Test example code serve.run(app) response = requests.post( "http://127.0.0.1:8000/api/predict/", json={"data": ["My name is Lewis"]} ) assert response.status_code == 200 print( "gradio-integration-parallel.py: Response ...
code_fim
hard
{ "lang": "python", "repo": "ray-project/ray", "path": "/doc/source/serve/doc_code/gradio-integration-parallel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># __doc_gradio_server_begin__ @serve.deployment class MyGradioServer(GradioIngress): def __init__(self, downstream_model_1, downstream_model_2): self._d1 = downstream_model_1 self._d2 = downstream_model_2 super().__init__(lambda: gr.Interface(self.fanout, "textbox", "textbox")...
code_fim
hard
{ "lang": "python", "repo": "ray-project/ray", "path": "/doc/source/serve/doc_code/gradio-integration-parallel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ray-project/ray path: /doc/source/serve/doc_code/gradio-integration-parallel.py import requests # __doc_import_begin__ import ray from ray import serve from ray.serve.gradio_integrations import GradioIngress import gradio as gr import asyncio from transformers import pipeline # __doc_import_e...
code_fim
medium
{ "lang": "python", "repo": "ray-project/ray", "path": "/doc/source/serve/doc_code/gradio-integration-parallel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Tests estimate_steps_per_epoch() """ num_record = parsing_utils.estimate_steps_per_epoch(self.data_dir, 1) self.assertEqual(num_record, 40) if __name__ == '__main__': tf.test.main()<|fim_prefix|># repo: linkedin/detext path: /test/smart_compose/utils/test_parsing_utils.py...
code_fim
hard
{ "lang": "python", "repo": "linkedin/detext", "path": "/test/smart_compose/utils/test_parsing_utils.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: linkedin/detext path: /test/smart_compose/utils/test_parsing_utils.py import os import tensorflow as tf from smart_compose.utils import parsing_utils from smart_compose.utils.parsing_utils import InputFtrType from smart_compose.utils.testing.test_case import TestCase class TestParsingUtils(Te...
code_fim
hard
{ "lang": "python", "repo": "linkedin/detext", "path": "/test/smart_compose/utils/test_parsing_utils.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: LoganAMorrison/Hazma path: /test/vector_mediator/herwig4dm/F3pi.py # Libraries to load import math from scipy import integrate from . import Resonance from . import alpha ii = complex(0.0, 1.0) gev2nb = 389379.3656 ########################################### # parametrization based on hep-ph...
code_fim
hard
{ "lang": "python", "repo": "LoganAMorrison/Hazma", "path": "/test/vector_mediator/herwig4dm/F3pi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def GammaDM(medMass): """Decay rate of mediator-> 3pions""" if medMass < 3 * mPi_: return 0 pre = medMass / 3.0 # phase space prefactor pre *= 1.0 / (2 * math.pi) ** 3 / 32.0 / medMass ** 4 s = medMass ** 2 form = integrate.nquad(Integrand, [bounds_Qp, bounds_Qm], args=...
code_fim
hard
{ "lang": "python", "repo": "LoganAMorrison/Hazma", "path": "/test/vector_mediator/herwig4dm/F3pi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for file in os.listdir(path): data_xls = pd.read_excel(path+file,index_col=None,names =['x','z','y']) f1 = open(txt_path+file[0:-4]+'.txt','w') for i in range(len(data_xls['x'])): f1.write(str(data_xls['x'][i])+'\t'+str(data_xls['y'][i])+'\t'+str(data_xls['z'][i])+';') print("----...
code_fim
medium
{ "lang": "python", "repo": "yuxiawang1992/Python-Code", "path": "/General Data Preprocessing/xls2txt.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yuxiawang1992/Python-Code path: /General Data Preprocessing/xls2txt.py # Python 3.4.3 # -*- coding:utf-8 -*- ''' convert the xls format file to csv ''' import pandas as pd import os <|fim_suffix|>for file in os.listdir(path): data_xls = pd.read_excel(path+file,index_col=None,names =['x','z...
code_fim
medium
{ "lang": "python", "repo": "yuxiawang1992/Python-Code", "path": "/General Data Preprocessing/xls2txt.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: v1ztep/Parser-online-library path: /tululu.py import os import requests from pathvalidate import sanitize_filename, sanitize_filepath import hashlib import urllib3 def get_hash_sum(response): if not response.status_code == 200: return md5_hash = hashlib.md5(response.content) ...
code_fim
hard
{ "lang": "python", "repo": "v1ztep/Parser-online-library", "path": "/tululu.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: image_response = request_tululu(url) except requests.RequestException: return if image_response.status_code != 200: return correct_filename = f"{get_hash_sum(image_response)}_{sanitize_filename(filename)}" if folder is not None: correct_folder = s...
code_fim
hard
{ "lang": "python", "repo": "v1ztep/Parser-online-library", "path": "/tululu.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> correct_filename = f"{get_hash_sum(image_response)}_{sanitize_filename(filename)}" if folder is not None: correct_folder = sanitize_filepath(os.path.join(folder, 'images')) else: correct_folder = "images" correct_path = os.path.join(correct_folder, correct_filename).replace...
code_fim
hard
{ "lang": "python", "repo": "v1ztep/Parser-online-library", "path": "/tululu.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> t = time() for i in range(N): np.dot(A, B) delta = time() - t del A, B timings["matmul"] += delta/N sleep(2.0) t = time() for i in range(N): np.dot(C, D) delta = time() - t del C, D timings["vecmul"] += delta/N sleep(2.0) t = time() ...
code_fim
hard
{ "lang": "python", "repo": "stjordanis/m1-cpu-benchmarks", "path": "/numpy_benchmarks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stjordanis/m1-cpu-benchmarks path: /numpy_benchmarks.py from tqdm import trange from time import time, sleep import numpy as np import os import argparse parser = argparse.ArgumentParser() parser.add_argument('--nproc', type=int, default=1) parser.add_argument('--runs', type=int, default=10) par...
code_fim
hard
{ "lang": "python", "repo": "stjordanis/m1-cpu-benchmarks", "path": "/numpy_benchmarks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: whitew1994WW/RaspberryPiWatering path: /sensor_aht20/example.py import AHT20 import datetime, time # Initialize an AHT20 aht20 = AHT20.AHT20() <|fim_suffix|> # Print in the console print(data) # Append in a file log = open("log.txt", "a") log.write(data + "\n") log.c...
code_fim
hard
{ "lang": "python", "repo": "whitew1994WW/RaspberryPiWatering", "path": "/sensor_aht20/example.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> # Append in a file log = open("log.txt", "a") log.write(data + "\n") log.close() # Wait time.sleep(2)<|fim_prefix|># repo: whitew1994WW/RaspberryPiWatering path: /sensor_aht20/example.py import AHT20 import datetime, time # Initialize an AHT20 aht20 = AHT20.AHT20() while 1: ...
code_fim
easy
{ "lang": "python", "repo": "whitew1994WW/RaspberryPiWatering", "path": "/sensor_aht20/example.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: dagfr/cruft_helloworld path: /tests/tools/monkeypath_target.py from inspect import getmembers from typing import Callable <|fim_suffix|> """ >>> build_target(getmembers) 'inspect.getmembers' """ return f"{dict(getmembers(target))['__module__']}.{target.__qualname__}"<|fim_midd...
code_fim
easy
{ "lang": "python", "repo": "dagfr/cruft_helloworld", "path": "/tests/tools/monkeypath_target.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ >>> build_target(getmembers) 'inspect.getmembers' """ return f"{dict(getmembers(target))['__module__']}.{target.__qualname__}"<|fim_prefix|># repo: dagfr/cruft_helloworld path: /tests/tools/monkeypath_target.py from inspect import getmembers from typing import Callable <|fim_mid...
code_fim
easy
{ "lang": "python", "repo": "dagfr/cruft_helloworld", "path": "/tests/tools/monkeypath_target.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tdrei/ADS---Python-Example- path: /samples/quickbooksGLtoDatabase.py """ open General Ledger from Excel, reformat into a database. """ import pandas as pd import numpy as np import argparse from itertools import cycle from time import sleep columnNames = ["Account Description", "Type", ...
code_fim
hard
{ "lang": "python", "repo": "tdrei/ADS---Python-Example-", "path": "/samples/quickbooksGLtoDatabase.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # try to open filename as Pandas DataFrame, if error, quit. try: df = pd.read_excel(filename, index_col=None, header=None) return df except: print("Error with filename") quit() # progress bar. Unnecessary for functionality and can be omitted. def prog...
code_fim
hard
{ "lang": "python", "repo": "tdrei/ADS---Python-Example-", "path": "/samples/quickbooksGLtoDatabase.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NamPNQ/rethinkengine path: /rethinkengine/fields.py class BaseField(): creation_counter = 0 auto_creation_counter = -1 def __init__(self, db_field=None, name=None, required=False, default=None, unique=False, unique_with=None, primary_key=False, valid...
code_fim
medium
{ "lang": "python", "repo": "NamPNQ/rethinkengine", "path": "/rethinkengine/fields.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class NumberField(BaseField): pass class StringField(BaseField): pass class DateTimeField(BaseField): pass class BooleanField(BaseField): pass class ObjectField(BaseField): pass class ArrayField(BaseField): pass<|fim_prefix|># repo: NamPNQ/rethinkengine path: /rethinken...
code_fim
medium
{ "lang": "python", "repo": "NamPNQ/rethinkengine", "path": "/rethinkengine/fields.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class EmbeddedDocument(): pass class DynamicEmbeddedDocument(EmbeddedDocument): pass class NumberField(BaseField): pass class StringField(BaseField): pass class DateTimeField(BaseField): pass class BooleanField(BaseField): pass class ObjectField(BaseField): pass c...
code_fim
hard
{ "lang": "python", "repo": "NamPNQ/rethinkengine", "path": "/rethinkengine/fields.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def parse_response_content(self, response_content): response = super(AlipayEbppConfigCitySearchResponse, self).parse_response_content(response_content) if 'area_info_result' in response: self.area_info_result = response['area_info_result']<|fim_prefix|># repo: alipay/alipay...
code_fim
hard
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/response/AlipayEbppConfigCitySearchResponse.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/response/AlipayEbppConfigCitySearchResponse.py #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse from alipay.aop.api.domain.AreaInfo import AreaInfo <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/response/AlipayEbppConfigCitySearchResponse.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pzhao5/eventstream path: /api/googleplus.py import os import pickle import webapp2 from google.appengine.ext.webapp import template from google.appengine.api import urlfetch from datetime import datetime import logging import json from eslib import basehandler from contrib import oauth from urlpa...
code_fim
hard
{ "lang": "python", "repo": "pzhao5/eventstream", "path": "/api/googleplus.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Add to the temp key item = {} item['id_str'] = key item['created_at'] = twitterTime item['text'] = title item['screen_name'] = who item['img_sml'] = img_sml item['img_lrg'] = img_lrg if ( 'objec...
code_fim
hard
{ "lang": "python", "repo": "pzhao5/eventstream", "path": "/api/googleplus.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RoboJackets/robocup-software path: /rj_gameplay/rj_gameplay/play/defend_restart.py import stp.play as play import stp.tactic as tactic from rj_gameplay.tactic import nmark_tactic, goalie_tactic, wall_tactic import stp.skill as skill import stp.role as role from stp.role.assignment.naive import N...
code_fim
hard
{ "lang": "python", "repo": "RoboJackets/robocup-software", "path": "/rj_gameplay/rj_gameplay/play/defend_restart.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Get role requests from all tactics and put them into a dictionary role_requests: play.RoleRequests = {} role_requests[self.markers] = self.markers.get_requests(world_state, None) role_requests[self.goalie] = self.goalie.get_requests(world_state, None) role_request...
code_fim
hard
{ "lang": "python", "repo": "RoboJackets/robocup-software", "path": "/rj_gameplay/rj_gameplay/play/defend_restart.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.outbox.append(message) def handle_connect(self): pass def setup_data(self): return def get_data(self): return def writable(self): return (len(self.outbox) > 0) def handle_write(self): if not self.outbox: return ...
code_fim
hard
{ "lang": "python", "repo": "dsilvers/s67-ppprs-car", "path": "/data-collection-scripts/glue/client.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_prefix|># repo: dsilvers/s67-ppprs-car path: /data-collection-scripts/glue/client.py from __future__ import print_function from glue.config import SOCKET import asyncore import collections import logging import socket import time MAX_MESSAGE_LENGTH = 1024 ADDRESS = SOCKET class Client(asyncore.dispatcher): ...
code_fim
hard
{ "lang": "python", "repo": "dsilvers/s67-ppprs-car", "path": "/data-collection-scripts/glue/client.py", "mode": "psm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|> message = self.recv(MAX_MESSAGE_LENGTH) self.log.info('Received message: %s', message) self.read_data(message) def read_data(self, message): return def handle_close(self): self.close() def start_client(client=None): logging.basicConfig(level=logging....
code_fim
hard
{ "lang": "python", "repo": "dsilvers/s67-ppprs-car", "path": "/data-collection-scripts/glue/client.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_prefix|># repo: jzlou/radon-station path: /radon-station.py #!/usr/bin/env python """Simple logging radon station logic""" from __future__ import print_function import sys import os import struct import logging from datetime import datetime import pika import json from bluepy.btle import UUID, Peripheral if len...
code_fim
hard
{ "lang": "python", "repo": "jzlou/radon-station", "path": "/radon-station.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.name = name self.uuid = uuid self.format_type = format_type self.unit = unit self.scale = scale def get_data(p): sensors = [] sensors.append(Sensor("temperature", UUID(0x2A6E), 'h', "deg C\t", 1.0/100.0)) sensors.append(S...
code_fim
hard
{ "lang": "python", "repo": "jzlou/radon-station", "path": "/radon-station.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: teresasun/DenseShuffleNet path: /myscripts/segment_data_layer.py import os import sys caffe_root = "/home/huijun/caffe-mod/" sys.path.insert(0, caffe_root + "python") import caffe from caffe.proto import caffe_pb2 import lmdb import yaml import numpy as np import cStringIO as StringIO from PIL im...
code_fim
hard
{ "lang": "python", "repo": "teresasun/DenseShuffleNet", "path": "/myscripts/segment_data_layer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> image = np.transpose(image, (2, 0, 1)) # +++++++++++++++++++++++++++++++++++++++++++++++++ # # 2. Mask # +++++++++++++++++++++++++++++++++++++++++++++++++ # self._mask_datum.ParseFromString(label) stream = StringIO.StringIO(self._mas...
code_fim
hard
{ "lang": "python", "repo": "teresasun/DenseShuffleNet", "path": "/myscripts/segment_data_layer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print 'Terminating BlobFetcher' self._prefetch_process.terminate() self._prefetch_process.join() # close all db self._data_lmdb.close() self._mask_lmdb.close() import atexit atexit.register(cleanup) def _get_nex...
code_fim
hard
{ "lang": "python", "repo": "teresasun/DenseShuffleNet", "path": "/myscripts/segment_data_layer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def tag_phrase(tag_fn_list, inner_tags, formatting=False): ''' Hierarchically structured html tags, returns a string, optionally formated with htmlformat ''' tag_phrase_str = inner_tags for tag_fn in tag_fn_list[::-1]: tag_phrase_str = tag_fn(tag_phrase_str) if formatting: tag_phrase_str = f...
code_fim
medium
{ "lang": "python", "repo": "stevetimberman/htmlhelpers", "path": "/htmlhelpers/htmlphrase.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stevetimberman/htmlhelpers path: /htmlhelpers/htmlphrase.py from htmlhelpers.htmlformat import format_phrase def tag_series(tag_fn, text_list): tag_series_str = "".join([tag_fn(text) for text in text_list]) return tag_series_str <|fim_suffix|> ''' tag_phrase_str = inner_tags for tag_fn in t...
code_fim
medium
{ "lang": "python", "repo": "stevetimberman/htmlhelpers", "path": "/htmlhelpers/htmlphrase.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ghoshdoesdesign/geriatric_urban_security path: /copy_of_01_segmentation_code.py # -*- coding: utf-8 -*- """Copy of 01_segmentation_code.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1hyFp5bXuyhc6WrUUCaobH5j1Bbrlyhfu """ #...
code_fim
hard
{ "lang": "python", "repo": "ghoshdoesdesign/geriatric_urban_security", "path": "/copy_of_01_segmentation_code.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>LABEL_NAMES = np.asarray([ 'road', 'sidewalk', 'building', 'wall', 'fence', 'pole', 'traffic light', 'traffic sign', 'vegetation', 'terrain', 'sky', 'person', 'rider', 'car', 'truck', 'bus', 'train', 'motorcycle', 'bicycle', 'void']) FULL_LABEL_MAP = np.arange(len(LABEL_NAMES)).reshape(len(L...
code_fim
hard
{ "lang": "python", "repo": "ghoshdoesdesign/geriatric_urban_security", "path": "/copy_of_01_segmentation_code.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>dupSamples = {} for line in dupSamplesFile: line = line.strip().split() sample1 = line[0] + "^" + line[1] sample2 = line[2] + "^" + line[3] ## need to save both ways around in case 3 way+ duplicates if sample1 in dupSamples: oldEntry = dupSamples[sample1] newEntry = oldEntry + [sample2] ...
code_fim
hard
{ "lang": "python", "repo": "ejh243/BrainFANS", "path": "/array/SNPArray/utilitys/ExcludeDuplicates.py", "mode": "spm", "license": "Artistic-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ejh243/BrainFANS path: /array/SNPArray/utilitys/ExcludeDuplicates.py ## using output of king and plink --miss identify worse performing duplicate for exclusion ## this script is run as follows ## python ExcludeDuplicates.py <king output> <plink --miss output> <output file> import sys print "...
code_fim
hard
{ "lang": "python", "repo": "ejh243/BrainFANS", "path": "/array/SNPArray/utilitys/ExcludeDuplicates.py", "mode": "psm", "license": "Artistic-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kmdalton/reciprocalspaceship path: /reciprocalspaceship/algorithms/scale_merged_intensities.py import numpy as np import reciprocalspaceship as rs from scipy.special import logsumexp from scipy.stats import gamma,norm def _french_wilson_posterior_quad(Iobs, SigIobs, Sigma, centric, npoints=100)...
code_fim
hard
{ "lang": "python", "repo": "kmdalton/reciprocalspaceship", "path": "/reciprocalspaceship/algorithms/scale_merged_intensities.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return Sigma def scale_merged_intensities(ds, intensity_key, sigma_key, output_columns=None, dropna=True, inplace=False, mean_intensity_method="isotropic", bins=100, bw=2.0): """ Scales merged intensities using Bayesian statistics in o...
code_fim
hard
{ "lang": "python", "repo": "kmdalton/reciprocalspaceship", "path": "/reciprocalspaceship/algorithms/scale_merged_intensities.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CORP-RESELLER/luigi-td path: /luigi_td/targets/s3.py from luigi_td.targets.result import ResultTarget from six.moves.urllib.parse import urlencode from six.moves.urllib.parse import quote as url_quote import logging logger = logging.getLogger('luigi-interface') class S3ResultTarget(ResultTarge...
code_fim
medium
{ "lang": "python", "repo": "CORP-RESELLER/luigi-td", "path": "/luigi_td/targets/s3.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_result_url(self): reqs = {} # required reqs['access_key'] = url_quote(self.aws_access_key_id) reqs['secret_key'] = url_quote(self.aws_secret_access_key) reqs['bucket'] = self.bucket reqs['path'] = self.path # optional params = {} ...
code_fim
hard
{ "lang": "python", "repo": "CORP-RESELLER/luigi-td", "path": "/luigi_td/targets/s3.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('bpp', '0013_wydzial_zezwalaj_na_ranking_autorow'), ] operations = [ migrations.AlterField( model_name='wydzial', name='widoczny', field=models.BooleanField(default=True, help_text=b'Czy wydzia\xc5\x82 ma by\xc4\x87 widoczn...
code_fim
medium
{ "lang": "python", "repo": "iplweb/bpp", "path": "/src/bpp/migrations/0014_auto_20150530_1942.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iplweb/bpp path: /src/bpp/migrations/0014_auto_20150530_1942.py # -*- coding: utf-8 -*- from django.db import models, migrations <|fim_suffix|> operations = [ migrations.AlterField( model_name='wydzial', name='widoczny', field=models.BooleanField...
code_fim
medium
{ "lang": "python", "repo": "iplweb/bpp", "path": "/src/bpp/migrations/0014_auto_20150530_1942.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='wydzial', name='widoczny', field=models.BooleanField(default=True, help_text=b'Czy wydzia\xc5\x82 ma by\xc4\x87 widoczny przy przegl\xc4\x85daniu strony dla zak\xc5\x82adki "Uczelnia"?'), preserve...
code_fim
medium
{ "lang": "python", "repo": "iplweb/bpp", "path": "/src/bpp/migrations/0014_auto_20150530_1942.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IMULMUL/acsploit path: /acsploit/exploits/networking/segment_smack.py import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import * import multiprocessing import netifaces import ctypes import os from acsploit.options import Options import time try: defaul...
code_fim
hard
{ "lang": "python", "repo": "IMULMUL/acsploit", "path": "/acsploit/exploits/networking/segment_smack.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> to_send = [] original_count = initial_fragmented_segments for i in range(0, count + 1, 2): to_send.append(i) i = 1 while i + original_count < count: to_send.append(i) to_send.append(original_count + 1 + i) i = i + 2 ...
code_fim
hard
{ "lang": "python", "repo": "IMULMUL/acsploit", "path": "/acsploit/exploits/networking/segment_smack.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> shift = 1 + 1 # 1 from zero-padding in Conv3d, 1 from delay # SE block global average pool is still "filling up" # This takes "temporal_window_size" which is 4 here for t in range(1, target.shape[2]): assert torch.allclose(target[:, :, t], outputs[t + shift], atol=5e-4) # Af...
code_fim
hard
{ "lang": "python", "repo": "sg47/co3d", "path": "/models/cox3d/test_modules/test_x3d.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Training mode has large effect on BatchNorm result - test will fail otherwise trans.eval() rtrans.eval() # Forward through models target = trans([example_clip])[0] outputs = [] # Manual zero pad (due to padding=1 in trans.b Conv3d) zeros = torch.zeros_like(example_clip[...
code_fim
hard
{ "lang": "python", "repo": "sg47/co3d", "path": "/models/cox3d/test_modules/test_x3d.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sg47/co3d path: /models/cox3d/test_modules/test_x3d.py # Download image IMAGE_URL = "https://kids.kiddle.co/images/thumb/8/81/Pacific_Yew_Selfbow.jpg/300px-Pacific_Yew_Selfbow.jpg" # IMAGE_URL = "https://www.thetimes.co.uk/imageserver/image/%2Fmethode%2Ftimes%2Fprod%2Fweb%2Fbin%2F5e...
code_fim
hard
{ "lang": "python", "repo": "sg47/co3d", "path": "/models/cox3d/test_modules/test_x3d.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }