text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> 'Intended Audience :: Information Technology', 'Intended Audience :: System Administrators', 'License :: OSI Approved :: Apache Software License', 'Operating System :: POSIX', 'Operating System :: Microsof...
code_fim
hard
{ "lang": "python", "repo": "chaitanyashah/aws-with", "path": "/setup.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chaitanyashah/aws-with path: /setup.py from setuptools import setup import sys import aws_with install_requires = [ "boto3 >= 1.4.6", "pyyaml", ] if sys.version_info[:2] < (2, 7): install_requires += [ "argparse", ] setup( name=aws_with.__title__, version=aws_wi...
code_fim
hard
{ "lang": "python", "repo": "chaitanyashah/aws-with", "path": "/setup.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chromium/chromium path: /third_party/wpt_tools/wpt/tools/serve/serve.py def replace_end(s, old, new): """ Given a string `s` that ends with `old`, replace that occurrence of `old` with `new`. """ assert s.endswith(old) return s[:-len(old)] + new def domains_are_distinct...
code_fim
hard
{ "lang": "python", "repo": "chromium/chromium", "path": "/third_party/wpt_tools/wpt/tools/serve/serve.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: chromium/chromium path: /third_party/wpt_tools/wpt/tools/serve/serve.py -tests/from-local-system.html#system-setup " "for instructions.") def replace_end(s, old, new): """ Given a string `s` that ends with `old`, replace that occurrence of `old` with `new`. ""...
code_fim
hard
{ "lang": "python", "repo": "chromium/chromium", "path": "/third_party/wpt_tools/wpt/tools/serve/serve.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> try: return wptserve.WebTestHttpd(host=host, port=port, doc_root=paths["doc_root"], routes=routes, rewrites=rewrites, ...
code_fim
hard
{ "lang": "python", "repo": "chromium/chromium", "path": "/third_party/wpt_tools/wpt/tools/serve/serve.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: anushreejangid/csmpe-main path: /csmpe/core_plugins/csm_install_operations/ios_xr/package_lib.py # ============================================================================= # # Copyright (c) 2016, Cisco Systems # All rights reserved. # # Redistribution and use in source and binary forms, with...
code_fim
hard
{ "lang": "python", "repo": "anushreejangid/csmpe-main", "path": "/csmpe/core_plugins/csm_install_operations/ios_xr/package_lib.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>package_type = None version_re = 5.3.3 smu_re = CSCuz33376 sp_re = None subversion_re = 1.0.0 """ platforms = ["asr9k", "hfr"] package_types = "mini mcast mgbl mpls k9sec diags fpd doc bng li optic services services-infa " \ "infra-test video 9000v asr901 asr903 ncs500x".split() version_re...
code_fim
hard
{ "lang": "python", "repo": "anushreejangid/csmpe-main", "path": "/csmpe/core_plugins/csm_install_operations/ios_xr/package_lib.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if self.sp or self.smu: result = re.search(subversion_re, self.package_name) return result.group("SUBVERSION") if result else None return None def is_valid(self): return self.platform and self.version and self.architecture and (self.package_type or self...
code_fim
hard
{ "lang": "python", "repo": "anushreejangid/csmpe-main", "path": "/csmpe/core_plugins/csm_install_operations/ios_xr/package_lib.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mlinderm/npsv path: /src/npsv/feature_extraction.py import argparse, io, json, logging, os, re, subprocess, sys, tempfile from collections import defaultdict import vcf import pysam import pysam.bcftools as bcftools import pybedtools.bedtool as bed import numpy as np import pandas as pd from path...
code_fim
hard
{ "lang": "python", "repo": "mlinderm/npsv", "path": "/src/npsv/feature_extraction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def extract( args: argparse.Namespace, input_vcf: str, input_bam: str, out_file=sys.stdout, max_reads: int = None, ac: int = None, sample: Sample = None, force_variant: Variant = None, insert_hist: bool = True, ): """Extract and print deletion SV features for a VC...
code_fim
hard
{ "lang": "python", "repo": "mlinderm/npsv", "path": "/src/npsv/feature_extraction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class WikiLoginRecord(db.Document): username = db.StringField() timestamp = db.DateTimeField(default=datetime.now) browser = db.StringField() platform = db.StringField() details = db.StringField() ip = db.StringField() meta = { 'collection': 'wiki_login_record', ...
code_fim
hard
{ "lang": "python", "repo": "gregnordin/Project-Wiki", "path": "/app/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gregnordin/Project-Wiki path: /app/models.py from collections import OrderedDict from datetime import datetime from flask_login import UserMixin, AnonymousUserMixin, current_user from mongoengine.context_managers import switch_db from markdown.util import etree import difflib from . import db, l...
code_fim
hard
{ "lang": "python", "repo": "gregnordin/Project-Wiki", "path": "/app/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' Get serializer class ''' if self.request.method == 'POST': return NotExistingCustomMembershipLabelSerializer return ExistingCustomMembershipLabelSerializer def list(self, request, *args, **kwargs): ''' List custom membership labels ''' queryset ...
code_fim
hard
{ "lang": "python", "repo": "810Teams/clubs-and-events-backend", "path": "/membership/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 810Teams/clubs-and-events-backend path: /membership/views.py ''' Get permissions ''' if self.request.method == 'GET': return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsAbleToRetrieveRequest()) elif self.request.method == 'POST': return ...
code_fim
hard
{ "lang": "python", "repo": "810Teams/clubs-and-events-backend", "path": "/membership/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' Get membership default labels API ''' return Response([ { 'position': 3, 'labels': { 'club': _('President'), 'event': _('President'), 'community_event': _('Event Creator'), 'lab': _('Lab Supervisor'...
code_fim
hard
{ "lang": "python", "repo": "810Teams/clubs-and-events-backend", "path": "/membership/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ds4dm/ecole-paper path: /src/ecole_vs_gasse/utils.py import pathlib import ecole SOURCE_DIR = pathlib.Path(__file__).parent.parent.parent.resolve() DATA_DIR = SOURCE_DIR / "vendor/ecole/libecole/tests/data" <|fim_suffix|> """Return a Model object with a valid problem.""" model = ecole....
code_fim
medium
{ "lang": "python", "repo": "ds4dm/ecole-paper", "path": "/src/ecole_vs_gasse/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Return a Model object with a valid problem.""" model = ecole.scip.Model.from_file(str(DATA_DIR / "bppc8-02.mps")) model.disable_cuts() model.disable_presolve() model.set_param("randomization/permuteconss", True) model.set_param("randomization/permutevars", True) model.set_pa...
code_fim
medium
{ "lang": "python", "repo": "ds4dm/ecole-paper", "path": "/src/ecole_vs_gasse/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GreatFruitOmsk/pyobjc-mirror path: /pyobjc-framework-WebKit/PyObjCTest/test_wkopenpanelparameters.py from PyObjCTools.TestSupport import * from WebKit import * <|fim_suffix|> @onlyOn64Bit @min_os_level('10.12') def testMethods10_12(self): self.assertResultIsBOOL(WKOpenPanelPar...
code_fim
easy
{ "lang": "python", "repo": "GreatFruitOmsk/pyobjc-mirror", "path": "/pyobjc-framework-WebKit/PyObjCTest/test_wkopenpanelparameters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertResultIsBOOL(WKOpenPanelParameters.allowsDirectories) if __name__ == "__main__": main()<|fim_prefix|># repo: GreatFruitOmsk/pyobjc-mirror path: /pyobjc-framework-WebKit/PyObjCTest/test_wkopenpanelparameters.py from PyObjCTools.TestSupport import * from WebKit import * <|fim_midd...
code_fim
hard
{ "lang": "python", "repo": "GreatFruitOmsk/pyobjc-mirror", "path": "/pyobjc-framework-WebKit/PyObjCTest/test_wkopenpanelparameters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #Google Trends pytrends = TrendReq(geo='GB-ENG',tz=360) df=pytrends.trending_searches() gtrendsus=df.title.tolist() strGog=" ,".join(str(x) for x in gtrendsus[0:15]) #print(strGog) #yahoo trending charts page = requests.get("https://finance.yahoo.com/trending-tickers/"...
code_fim
hard
{ "lang": "python", "repo": "datainvestor/Trends-script", "path": "/script/trends.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #global trends globaltrends=twitter.trends.place(_id = 1) twittrendlist=[] for i in globaltrends[0]['trends']: twittrendlist.append(i['name']) def isEnglish(s): try: s.encode(encoding='utf-8').decode('ascii') except UnicodeDecodeError: ...
code_fim
hard
{ "lang": "python", "repo": "datainvestor/Trends-script", "path": "/script/trends.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: datainvestor/Trends-script path: /script/trends.py import json import urllib.request from twitter import Twitter, OAuth, TwitterHTTPError, TwitterStream from bs4 import BeautifulSoup import requests from pytrends.request import TrendReq import datetime from pushbullet.pushbullet import PushBulle...
code_fim
hard
{ "lang": "python", "repo": "datainvestor/Trends-script", "path": "/script/trends.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ASFHyP3/hyp3-insar-gamma path: /tests/test_ifm_sentinel.py from re import match import pytest from hyp3lib import GranuleError from hyp3_insar_gamma import ifm_sentinel def test_get_copol(): assert ifm_sentinel.get_copol('S1B_WV_SLC__1SSV_20200923T184541_20200923T185150_023506_02CA71_AABB...
code_fim
hard
{ "lang": "python", "repo": "ASFHyP3/hyp3-insar-gamma", "path": "/tests/test_ifm_sentinel.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> payload = { 'reference_name': 'S1A_IW_SLC__1SSV_20160527T014319_20160527T014346_011438_011694_26B0', 'secondary_name': 'S1A_IW_SLC__1SSV_20160714T014322_20160714T014349_012138_012CE7_96A0', 'orbit_files': [ 'S1A_OPER_AUX_POEORB_OPOD_20160616T121500_V20160526T225943_...
code_fim
medium
{ "lang": "python", "repo": "ASFHyP3/hyp3-insar-gamma", "path": "/tests/test_ifm_sentinel.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: henriquenunez/songtron path: /tests/test_mingus.py from mingus.midi import fluidsynth from mingus.containers.note import Note from mingus.containers.note_container import NoteContainer import time fluidsynth.init("../assets/sound_fonts/Drama Piano.sf2", 'alsa') # # and b with notes #fluidsynth....
code_fim
hard
{ "lang": "python", "repo": "henriquenunez/songtron", "path": "/tests/test_mingus.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|># Fur elise #fluidsynth.play_Note(Note("E")) #time.sleep(0.25) #fluidsynth.play_Note(Note("D#")) #time.sleep(0.25) #fluidsynth.play_Note(Note("E")) #time.sleep(0.25) #fluidsynth.play_Note(Note("D#")) #time.sleep(0.25) #fluidsynth.play_Note(Note("E")) #time.sleep(0.25) #fluidsynth.play_Note(Note("B")) #tim...
code_fim
hard
{ "lang": "python", "repo": "henriquenunez/songtron", "path": "/tests/test_mingus.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: bundgus/scabbard path: /tests/rest/Air_Search/test_V3_4_0ShopAltairportsFlightsPost.py from scabbard import get_client import json import datetime def test__v3_4_0_shop_altairports_flights_post(): client = get_client() today = datetime.datetime.now() departure1_datetime = (today + ...
code_fim
hard
{ "lang": "python", "repo": "bundgus/scabbard", "path": "/tests/rest/Air_Search/test_V3_4_0ShopAltairportsFlightsPost.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> itineraries = client.Air_Search\ .V3_4_0ShopAltairportsFlightsPost(bargainfindermaxalternateairportrequest=j, mode='live', limit='50', offset=1 ...
code_fim
hard
{ "lang": "python", "repo": "bundgus/scabbard", "path": "/tests/rest/Air_Search/test_V3_4_0ShopAltairportsFlightsPost.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: XXQ2/CrawlAndScrape path: /chapter_2/13.scrape_rss.py # ==ElementTreeでRSSをパースする== from xml.etree import ElementTree # parse()でファイルを読み込んで、ElementTreeオブジェクトを得る。 tree = ElementTree.parse('rss2.xml') <|fim_suffix|># channel/item要素以下のtitle要素とlink要素の文字列を取得し、表示する。 for item in root.findall('channel/it...
code_fim
medium
{ "lang": "python", "repo": "XXQ2/CrawlAndScrape", "path": "/chapter_2/13.scrape_rss.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># getroot()でXMLのルート要素(この例ではRSS要素)に対応するElementオブジェクトを得る root = tree.getroot() # channel/item要素以下のtitle要素とlink要素の文字列を取得し、表示する。 for item in root.findall('channel/item'): title = item.find('title').text link = item.find('link').text print(link, title)<|fim_prefix|># repo: XXQ2/CrawlAndScrape pat...
code_fim
medium
{ "lang": "python", "repo": "XXQ2/CrawlAndScrape", "path": "/chapter_2/13.scrape_rss.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # save data to client from response self._process_response(response) return response def request( self, endpoint: str = "account", method: str = "get", params: dict = {}, json: dict = None, data: str = None, ) -> t.Dict[str,...
code_fim
hard
{ "lang": "python", "repo": "atugushev/dolib", "path": "/dolib/client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: atugushev/dolib path: /dolib/client.py import typing as t from types import TracebackType import httpx import requests from . import managers as do_managers class BaseClient: API_DOMAIN = "api.digitalocean.com" API_VERSION = "v2" account: t.Optional[do_managers.AccountManager] = ...
code_fim
hard
{ "lang": "python", "repo": "atugushev/dolib", "path": "/dolib/client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class AsyncClient(BaseClient): def __init__(self, token: str = None): super().__init__(token) self._rclient = httpx.AsyncClient() def _load_managers(self) -> None: for manager in do_managers.__async_managers__: klass = getattr(do_managers, manager) ...
code_fim
hard
{ "lang": "python", "repo": "atugushev/dolib", "path": "/dolib/client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = SKLModel(model=LinearRegression()) x = [[1, 2], [3, 4]] y = [3, 7] model.fit(x, y) model.train(x, y) self.assertAlmostEqual(model.predict_objs([[4, 5]])[0], 9) with ScratchDir("."): model.save("test_model.sav") model.f...
code_fim
medium
{ "lang": "python", "repo": "materialsvirtuallab/maml", "path": "/tests/base/test_model.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: materialsvirtuallab/maml path: /tests/base/test_model.py from __future__ import annotations import unittest from monty.tempfile import ScratchDir from maml.base import KerasModel, SKLModel, is_keras_model, is_sklearn_model class TestBaseModel(unittest.TestCase): def test_sklmodel(self): ...
code_fim
medium
{ "lang": "python", "repo": "materialsvirtuallab/maml", "path": "/tests/base/test_model.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: vlad17/mips_revisit path: /mips_revisit/main/local_motivation_bert_agg.py """ Given a path prefix PREFIX of directories containing files config.json dev/{summary.json,average_activations.npy,average_norms.npy} train/summary.json,average_activations.npy,average_norms.npy} In the directory associ...
code_fim
medium
{ "lang": "python", "repo": "vlad17/mips_revisit", "path": "/mips_revisit/main/local_motivation_bert_agg.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def _main(_argv): log.init() main(flags.FLAGS.prefix, flags.FLAGS.cache, flags.FLAGS.overwrite, flags.FLAGS.task) if __name__ == "__main__": flags.mark_flag_as_required("task") flags.mark_flag_as_required("prefix") app.run(_main)<|fim_prefix|># repo: vlad17/mips_revisit path: /mips_...
code_fim
medium
{ "lang": "python", "repo": "vlad17/mips_revisit", "path": "/mips_revisit/main/local_motivation_bert_agg.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: whosgriffith/ig-clone-api path: /ig_clone_api/photos/migrations/0001_initial.py # Generated by Django 3.1.13 on 2021-08-19 01:24 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True...
code_fim
hard
{ "lang": "python", "repo": "whosgriffith/ig-clone-api", "path": "/ig_clone_api/photos/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ld(auto_now_add=True, help_text='Date time on which the object was created.', verbose_name='Created at')), ('modified', models.DateTimeField(auto_now_add=True, help_text='Date time of the last time the object was modified.', verbose_name='Last modified at')), ('photo', mode...
code_fim
hard
{ "lang": "python", "repo": "whosgriffith/ig-clone-api", "path": "/ig_clone_api/photos/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rohitmusti/Question-Answer-Engine-RH path: /exp-x/data_clean_toy.py """ tldr: modifies the squad data to fit the requirements of my experiment 2 (topic contexts) author: @rohitmusti """ import ujson as json from tqdm import tqdm from toolkit import fancyprint, save, quick_clean import config fro...
code_fim
hard
{ "lang": "python", "repo": "rohitmusti/Question-Answer-Engine-RH", "path": "/exp-x/data_clean_toy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> new_data["data"].append(topic_dict) topic_counter -= 1 if topic_counter == 0: break save(filename=out_file, obj=new_data, message="saving toy data") if __name__ == "__main__": data = config.data() toy_transformer(in_file=data.train_data_...
code_fim
hard
{ "lang": "python", "repo": "rohitmusti/Question-Answer-Engine-RH", "path": "/exp-x/data_clean_toy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: msdejong/ntp-release path: /ntp/scripts/algo_experiment.py #!/usr/bin/env python """Main experimental script. Randomly generates dataset and trains NTP model on dataset n times, and reports aggregate results.""" import os import argparse import random import re from collections import OrderedDi...
code_fim
hard
{ "lang": "python", "repo": "msdejong/ntp-release", "path": "/ntp/scripts/algo_experiment.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> n_pred = conf["experiment"]["n_pred"] n_constants = conf["experiment"]["n_constants"] n_rel = conf["experiment"]["n_rel"] body_predicates = conf["experiment"]["n_body"] order = conf["experiment"]["order"] n_rules = conf["experiment"]["n_rules"] p_normal = conf["experiment"]["p_...
code_fim
hard
{ "lang": "python", "repo": "msdejong/ntp-release", "path": "/ntp/scripts/algo_experiment.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fparma/events path: /website/errorhandler.py from flask import render_template from website import app @app.errorhandler(403) def not_authorized(path): return render_template('status/403.html'), 403 @app.errorhandler(404) def page_not_found(path): <|fim_suffix|> @app.errorhandler(410) def...
code_fim
easy
{ "lang": "python", "repo": "fparma/events", "path": "/website/errorhandler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return render_template('status/404.html'), 404 @app.errorhandler(410) def resource_gone(path): return render_template('status/410.html'), 410<|fim_prefix|># repo: fparma/events path: /website/errorhandler.py from flask import render_template from website import app @app.errorhandler(403) def ...
code_fim
medium
{ "lang": "python", "repo": "fparma/events", "path": "/website/errorhandler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_init_no_values(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text(""" kik: """, ConsoleConfiguration(), ".") kik_config = KikConfiguration() kik_config.load_configuration(yaml, ".") self.assert...
code_fim
hard
{ "lang": "python", "repo": "jaygeet/cotoba-agent-oss", "path": "/dialogue-engine/test/programytest/clients/restful/flask/kik/test_config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jaygeet/cotoba-agent-oss path: /dialogue-engine/test/programytest/clients/restful/flask/kik/test_config.py """ Copyright (c) 2020 COTOBA DESIGN, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),...
code_fim
hard
{ "lang": "python", "repo": "jaygeet/cotoba-agent-oss", "path": "/dialogue-engine/test/programytest/clients/restful/flask/kik/test_config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jr-garcia/Engendro3D path: /e3d/gui/TextEnums.py class FontWeightEnum(object): <|fim_suffix|>class OutlineLenghtEnum(object): NoOutline = 0 Little = 0.125 Medium = 0.25 Big = 0.5<|fim_middle|> Light = .4 Normal = .6 Bold = .9
code_fim
easy
{ "lang": "python", "repo": "jr-garcia/Engendro3D", "path": "/e3d/gui/TextEnums.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jr-garcia/Engendro3D path: /e3d/gui/TextEnums.py class FontWeightEnum(object): Light = .4 Normal = .6 Bold = .9 <|fim_suffix|> NoOutline = 0 Little = 0.125 Medium = 0.25 Big = 0.5<|fim_middle|> class OutlineLenghtEnum(object):
code_fim
easy
{ "lang": "python", "repo": "jr-garcia/Engendro3D", "path": "/e3d/gui/TextEnums.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class OutlineLenghtEnum(object): NoOutline = 0 Little = 0.125 Medium = 0.25 Big = 0.5<|fim_prefix|># repo: jr-garcia/Engendro3D path: /e3d/gui/TextEnums.py class FontWeightEnum(object): <|fim_middle|> Light = .4 Normal = .6 Bold = .9
code_fim
easy
{ "lang": "python", "repo": "jr-garcia/Engendro3D", "path": "/e3d/gui/TextEnums.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__=='__main__': parser=argparse.ArgumentParser() parser.add_argument("--dir",default="features",type=str) parser.add_argument("--id",default=[0],type=int,nargs='+') parser.add_argument("--seq",default="basketball",type=str) args=parser.parse_args() root_dir="/home/...
code_fim
hard
{ "lang": "python", "repo": "LittleCherry11/Deeppftracking", "path": "/examples/tracker/vis_square_all.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> data_box=data_box.reshape((n,n)+data_box.shape[1:]).transpose((0,2,1,3)+tuple(range(4,data_box.ndim+1))) data_box=data_box.reshape((n*data_box.shape[1],n*data_box.shape[3])+data_box.shape[4:]) plt.imshow(data_box) plt.title(title+"gt_box+50") plt.axis('off') plt.show() if...
code_fim
hard
{ "lang": "python", "repo": "LittleCherry11/Deeppftracking", "path": "/examples/tracker/vis_square_all.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: LittleCherry11/Deeppftracking path: /examples/tracker/vis_square_all.py import numpy as np import collections import matplotlib.pyplot as plt import argparse import sys import os #data:(nboxes,channel,width,height) def vis_square(data,title): data_box=data[0] #box0:(channel,height...
code_fim
hard
{ "lang": "python", "repo": "LittleCherry11/Deeppftracking", "path": "/examples/tracker/vis_square_all.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: tennessean/SHARPpy path: /sharppy/sharptab/params.py cl = prof.mlpcl except: mlpcl = parcelx(prof, flag=4) mlcape = mlpcl.b3km lr03 = prof.lapserate_3km # C/km if lr03 < 7. or mlpcl.bplus < 250.: return 0 esp = (mlcape / 50.) * ((lr03 - 7.0) / (1.0...
code_fim
hard
{ "lang": "python", "repo": "tennessean/SHARPpy", "path": "/sharppy/sharptab/params.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def brooks_b(prof): ''' Brooks B Parameter (*) Formulation taken from Rasmussen and Blanchard 1998, WAF v.13 pg. 1158. This equation was originally derived in Brooks et. al. 1994, WAF v.9 pgs. 606-618, as part of a study on the relationship between low-level helicity,...
code_fim
hard
{ "lang": "python", "repo": "tennessean/SHARPpy", "path": "/sharppy/sharptab/params.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def jli(prof): ''' Johnson Lag Index (*) Developed by D. L. Johnson in 1982, this index was based on a series of soundings made during experiments in the 1970s. It is a parametric index that takes into account temperature and moisture differences at several layers, an...
code_fim
hard
{ "lang": "python", "repo": "tennessean/SHARPpy", "path": "/sharppy/sharptab/params.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: vladimirivkovic/lambda-architecture4crypto-analytics path: /producers/exchange-rate/app.py import os import websocket import json import time from kafka import KafkaProducer import kafka.errors try: import thread except ImportError: import _thread as thread import time KAFKA_BROKER = os...
code_fim
medium
{ "lang": "python", "repo": "vladimirivkovic/lambda-architecture4crypto-analytics", "path": "/producers/exchange-rate/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("### closed ###") def on_open(ws): def run(*args): ws.send(SUB_MSG) thread.start_new_thread(run, ()) def main(): global producer print("Starting Exchange Rate listener ...") producer = connect_to_kafka() time.sleep(START_DELAY) websocket.enableTrace(True)...
code_fim
hard
{ "lang": "python", "repo": "vladimirivkovic/lambda-architecture4crypto-analytics", "path": "/producers/exchange-rate/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dut.expect_unity_test_output()<|fim_prefix|># repo: KollarRichard/esp-idf path: /components/mqtt/test_apps/test_mqtt5/pytest_mqtt5_ut.py # SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Unlicense OR CC0-1.0 import pytest from pytest_embedded import Dut <|...
code_fim
medium
{ "lang": "python", "repo": "KollarRichard/esp-idf", "path": "/components/mqtt/test_apps/test_mqtt5/pytest_mqtt5_ut.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: KollarRichard/esp-idf path: /components/mqtt/test_apps/test_mqtt5/pytest_mqtt5_ut.py # SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Unlicense OR CC0-1.0 import pytest from pytest_embedded import Dut <|fim_suffix|> dut.expect_unity_test_output()<...
code_fim
medium
{ "lang": "python", "repo": "KollarRichard/esp-idf", "path": "/components/mqtt/test_apps/test_mqtt5/pytest_mqtt5_ut.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dainis-boumber/jdot-palab path: /data_helper.py import numpy as np <|fim_suffix|> data = np.genfromtxt('data/' + str(name) + '.csv',delimiter=',') X = data[:,:-1] y = data[:, -1] return X, y<|fim_middle|>def get_data(name):
code_fim
easy
{ "lang": "python", "repo": "dainis-boumber/jdot-palab", "path": "/data_helper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dainis-boumber/jdot-palab path: /data_helper.py import numpy as np <|fim_suffix|> X = data[:,:-1] y = data[:, -1] return X, y<|fim_middle|>def get_data(name): data = np.genfromtxt('data/' + str(name) + '.csv',delimiter=',')
code_fim
medium
{ "lang": "python", "repo": "dainis-boumber/jdot-palab", "path": "/data_helper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> X = data[:,:-1] y = data[:, -1] return X, y<|fim_prefix|># repo: dainis-boumber/jdot-palab path: /data_helper.py import numpy as np <|fim_middle|>def get_data(name): data = np.genfromtxt('data/' + str(name) + '.csv',delimiter=',')
code_fim
medium
{ "lang": "python", "repo": "dainis-boumber/jdot-palab", "path": "/data_helper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fabrixxm/django-italian-utils path: /italian_utils/management/commands/importacomuni.py from django.core.management.base import BaseCommand, CommandError import zipfile import re import csv from django.utils.six import PY3 from italian_utils.models import Comune class Command(BaseCommand): ...
code_fim
hard
{ "lang": "python", "repo": "fabrixxm/django-italian-utils", "path": "/italian_utils/management/commands/importacomuni.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> except IndexError: raise CommandError('Nessun file specificato') except IOError: raise CommandError('File non trovato o corrotto')<|fim_prefix|># repo: fabrixxm/django-italian-utils path: /italian_utils/management/commands/importacomuni.py from django.core.manageme...
code_fim
hard
{ "lang": "python", "repo": "fabrixxm/django-italian-utils", "path": "/italian_utils/management/commands/importacomuni.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> comuni_reader = csv.DictReader(csvfile, delimiter=';') for row in comuni_reader: nome = row['Solo denominazione in italiano'] codice_catastale = row['Codice Catastale '] if nome and codice_catastale: c = Comune(nom...
code_fim
hard
{ "lang": "python", "repo": "fabrixxm/django-italian-utils", "path": "/italian_utils/management/commands/importacomuni.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MuhammadEzzatHBK/CyclopeptideSequencing path: /code/processes.py # -*- coding: utf-8 -*- """ Created on Sun May 16 09:31:53 2021 @author: Muhammad Ayman Ezzat Youmna Magdy Abdullah """ from utils import get_molecular_weight, linear_spectrum, subset_spectrum, reversed_map ...
code_fim
hard
{ "lang": "python", "repo": "MuhammadEzzatHBK/CyclopeptideSequencing", "path": "/code/processes.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> """Extends a given kmer. INPUT : oneMers: array-like. A list of amino acids that will be used to extend the given kmer. kmer: string. The given kmer required to extend. OUTPUT: .: List. A list of extended kmers. """ extentions = [] for oneMer in oneMers...
code_fim
hard
{ "lang": "python", "repo": "MuhammadEzzatHBK/CyclopeptideSequencing", "path": "/code/processes.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>def get_world_data(imagefile, imagesize): # TODO: implement support for skewed images... worldfile = imagefile[:-2]+imagefile[-1]+'w' with open(worldfile, 'r') as f: data = [float(x) for x in f.read().split('\n')] xres = data[0] yres = -data[3] w = xres * imagesize[0] h...
code_fim
hard
{ "lang": "python", "repo": "olegsson/tilebeard", "path": "/tilebeard/tilesource.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: olegsson/tilebeard path: /tilebeard/tilesource.py import math from PIL import Image import asyncio from io import BytesIO import os import mercantile import fiona from shapely import speedups if speedups.available: speedups.enable() from shapely import geometry as shp import ujson from .tbut...
code_fim
hard
{ "lang": "python", "repo": "olegsson/tilebeard", "path": "/tilebeard/tilesource.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': try: path = sys.argv[1] except: usage() exit(1) configure_logging() rval = main(path.encode('UTF-8')) exit(rval)<|fim_prefix|># repo: Wildsong/docker-ubuntu-server path: /watcher.py #!/usr/bin/env python # This code is based on the...
code_fim
hard
{ "lang": "python", "repo": "Wildsong/docker-ubuntu-server", "path": "/watcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(path): try: i = inotify.adapters.InotifyTree(path) except Exception as e: print("Make sure you have read permission on \"%s\", including subdirectories!" % path) print("Error:", e) return 1 try: for event in i.event_gen(): if event ...
code_fim
medium
{ "lang": "python", "repo": "Wildsong/docker-ubuntu-server", "path": "/watcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wildsong/docker-ubuntu-server path: /watcher.py #!/usr/bin/env python # This code is based on the sample at https://pypi.python.org/pypi/inotify # from __future__ import print_function, unicode_literals import logging import inotify.adapters import sys def usage(): print("""python watcher.p...
code_fim
medium
{ "lang": "python", "repo": "Wildsong/docker-ubuntu-server", "path": "/watcher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: loads/loads-broker path: /loadsbroker/dockerctrl.py """ Interacts with a Docker Daemon on a remote instance""" import random from typing import ( Any, Dict, List, Optional ) import docker from requests.exceptions import ConnectionError, Timeout from loadsbroker import logger fro...
code_fim
hard
{ "lang": "python", "repo": "loads/loads-broker", "path": "/loadsbroker/dockerctrl.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Example of what the images command output looks like: [{'Created': 1406605442, 'RepoTags': ['bbangert/simpletest:dev'], 'Id': '824823...31ae0d6fc69e6e666a4b44118b0a3', 'ParentId': 'da7b...ee6b9eb2ee47c2b1427eceb51d291a', 'Size': ...
code_fim
hard
{ "lang": "python", "repo": "loads/loads-broker", "path": "/loadsbroker/dockerctrl.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Imports a container from a URL""" stdin, stdout, stderr = client.exec_command( 'curl %s | docker load' % container_url) # Wait for termination output = stdout.channel.recv(4096) stdin.close() stdout.close() stderr.close() retur...
code_fim
hard
{ "lang": "python", "repo": "loads/loads-broker", "path": "/loadsbroker/dockerctrl.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mscroggs/KLBFAX path: /pages/140.py import os from page import Page from random import choice from file_handler import f_read_json import config def award_show(self,award, data, icon): self.add_text(award,fg="GREEN") self.add_newline() try: winners = data[award] except Ke...
code_fim
hard
{ "lang": "python", "repo": "mscroggs/KLBFAX", "path": "/pages/140.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for n,it in awards_on_pages.items(): for i in it: if i == a: return n return "???" class AwardsPage(Page): def __init__(self, page_num,title="",icon=u"\u263B"): super(AwardsPage, self).__init__(page_num) self.in_index = False self.aw...
code_fim
hard
{ "lang": "python", "repo": "mscroggs/KLBFAX", "path": "/pages/140.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: edebie/pyalcs path: /lcs/agents/acs2/ClassifiersList.py from __future__ import annotations from itertools import chain from random import random, choice, sample from typing import Optional, List from lcs import Perception, TypedList from lcs.agents.acs2.components.alp import expected_case, unex...
code_fim
hard
{ "lang": "python", "repo": "edebie/pyalcs", "path": "/lcs/agents/acs2/ClassifiersList.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if len(self) == 0: return None cl_del = None while cl_del is None: # We must delete at least one for cl in self.expand(): if randomfunc() < 1. / 3.: if cl_del is None: cl_del = cl ...
code_fim
hard
{ "lang": "python", "repo": "edebie/pyalcs", "path": "/lcs/agents/acs2/ClassifiersList.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def overall_numerosity(self): return sum(cl.num for cl in self) def set_ga_timestamp(self, time: int): """ Sets the GA time stamps to the current time to control the GA application frequency. :param time: :return: """ for cl in self:...
code_fim
hard
{ "lang": "python", "repo": "edebie/pyalcs", "path": "/lcs/agents/acs2/ClassifiersList.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def readInkscapeFromStartMenu() -> List[str]: candidates = [] for profile in [os.environ.get("ALLUSERSPROFILE", ""), os.environ.get("USERPROFILE", "")]: path = os.path.join(profile, "Microsoft", "Windows", "Start Menu", "Programs", "Inkscape", "Inkscape.lnk") ...
code_fim
hard
{ "lang": "python", "repo": "yaqwsx/PcbDraw", "path": "/pcbdraw/convert_windows.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yaqwsx/PcbDraw path: /pcbdraw/convert_windows.py import os # Reports false error on Linux as LnkParse3 is Windows-only dependency import LnkParse3 # type: ignore from typing import List from pcbdraw.convert_common import chooseInkscapeCandidate <|fim_suffix|>def readInkscapeFromStartMenu() -> Li...
code_fim
hard
{ "lang": "python", "repo": "yaqwsx/PcbDraw", "path": "/pcbdraw/convert_windows.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if isinstance(path, (list, tuple)): return [record for p in path for record in load_records(p)] no_extension, extension = os.path.splitext(path) fmt = {".fa": "fasta", ".gb": "genbank", ".gbk": "genbank", ".dna": "snapgene"}[ extension ] if fmt == "snapgene": re...
code_fim
medium
{ "lang": "python", "repo": "Edinburgh-Genome-Foundry/sequenticon", "path": "/sequenticon/tools.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Edinburgh-Genome-Foundry/sequenticon path: /sequenticon/tools.py import os from Bio import SeqIO from snapgene_reader import snapgene_file_to_seqrecord <|fim_suffix|> if isinstance(path, (list, tuple)): return [record for p in path for record in load_records(p)] no_extension, ex...
code_fim
medium
{ "lang": "python", "repo": "Edinburgh-Genome-Foundry/sequenticon", "path": "/sequenticon/tools.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def lambda_handler(event, context): # This lambda will handle new user files uploaded to the customer s3 bucket for record in event['Records']: bucket = record['s3']['bucket']['name'] key = record['s3']['object']['key'] logging.debug("Got a new customer file") dyn...
code_fim
medium
{ "lang": "python", "repo": "ymkamat/protego-examples", "path": "/proact/inputs/python_new_file_handler/python_new_file_handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> logging.debug("Got a new customer file") dynamodb_client.put_item(TableName=CUSTOMERS_TABLE_NAME, Item={"key": key}) if with_sns_msg: notify_new_customer(key) return event # if __name__ == "__main__": # lambda_namdler({})<|fim_prefix|># repo: ymkamat/protego-...
code_fim
hard
{ "lang": "python", "repo": "ymkamat/protego-examples", "path": "/proact/inputs/python_new_file_handler/python_new_file_handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ymkamat/protego-examples path: /proact/inputs/python_new_file_handler/python_new_file_handler.py import boto3 import logging import os import json dynamodb_client = boto3.client('dynamodb', region_name="us-east-1") sns_client = boto3.client('sns', region_name="us-east-1") CUSTOMERS_TABLE_NAME =...
code_fim
hard
{ "lang": "python", "repo": "ymkamat/protego-examples", "path": "/proact/inputs/python_new_file_handler/python_new_file_handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sanjanamadhekar/Olympics-Data-Analysis path: /code.py # -------------- #Importing header files import pandas as pd import numpy as np import matplotlib.pyplot as plt #Path of the file is stored in the variable path #Code starts here # Data Loading data = pd.read_csv(path) data.rename(columns=...
code_fim
hard
{ "lang": "python", "repo": "sanjanamadhekar/Olympics-Data-Analysis", "path": "/code.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> top_10_summer = top_ten(top_countries, 'Total_Summer') top_10_winter = top_ten(top_countries, 'Total_Winter') top_10 = top_ten(top_countries, 'Total_Medals') common = list(set(top_10_summer).intersection(top_10_winter).intersection(top_10)) # Plotting top 10 fig, ax = plt.subplots(3) summer_df = da...
code_fim
hard
{ "lang": "python", "repo": "sanjanamadhekar/Olympics-Data-Analysis", "path": "/code.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> target = target.float() """ #return self.bce(input_, target) return self.bce(input, target)<|fim_prefix|># repo: Gopi-Durgaprasad/Kaggle-Cornell-Birdcall-Identification path: /stage3/losses.py import torch import torch.nn as nn import torch.nn.functional as F class PANNs...
code_fim
hard
{ "lang": "python", "repo": "Gopi-Durgaprasad/Kaggle-Cornell-Birdcall-Identification", "path": "/stage3/losses.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Gopi-Durgaprasad/Kaggle-Cornell-Birdcall-Identification path: /stage3/losses.py import torch import torch.nn as nn import torch.nn.functional as F class PANNsLoss(nn.Module): def __init__(self): super().__init__() self.bce = nn.BCEWithLogitsLoss() self.cel = nn.Cross...
code_fim
hard
{ "lang": "python", "repo": "Gopi-Durgaprasad/Kaggle-Cornell-Birdcall-Identification", "path": "/stage3/losses.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ctm_file_path: str, segments_dictionary: Dict[str, str], confidence: bool ) -> dict: with codecs.open(ctm_file_path, encoding="utf8") as file: ctm_entries = list(reader(file, delimiter=" ")) ctm_dictionary = dict() for entry in ctm_entries: utterance_id, segment_start_time ...
code_fim
hard
{ "lang": "python", "repo": "CoEDL/elpis", "path": "/elpis/engines/common/output/ctm_to_elan.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CoEDL/elpis path: /elpis/engines/common/output/ctm_to_elan.py #!/usr/bin/python3 """ Takes a CTM (time aligned) file and produces an Elan file. If the CTM has confidence values, write them as a ref tier. Copyright: University of Queensland, 2021 Contributors: Ben Foley - (Universit...
code_fim
hard
{ "lang": "python", "repo": "CoEDL/elpis", "path": "/elpis/engines/common/output/ctm_to_elan.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def wav_scp_to_dictionary(scp_file_name: str) -> dict: wav_dictionary = dict() with open(scp_file_name) as file: wav_entries = file.read().splitlines() for line in wav_entries: entry = line.split(" ", 1) # use 1 here in case wav filenames include spaces ut...
code_fim
hard
{ "lang": "python", "repo": "CoEDL/elpis", "path": "/elpis/engines/common/output/ctm_to_elan.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def testTileBoundsAndAddress(self): gagrid = GeoadminTileGridLV03() tbe = [548000.0, 196400.0, 573600.0, 222000.0] tb = gagrid.tileBounds(17, 5, 5) self.assertEqual(tb[0], tbe[0]) self.assertEqual(tb[1], tbe[1]) self.assertEqual(tb[2], tbe[2]) se...
code_fim
hard
{ "lang": "python", "repo": "cclauss/lib-gatilegrid", "path": "/tests/test_tilegrids.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def testNumberOfTilesMercator(self): grid = GlobalMercatorTileGrid() zoom = 0 nb = grid.numberOfTilesAtZoom(zoom) nbx = grid.numberOfXTilesAtZoom(zoom) nby = grid.numberOfYTilesAtZoom(zoom) self.assertEqual(nb, nbx * nby) self.assertEqual(nb, 1) ...
code_fim
hard
{ "lang": "python", "repo": "cclauss/lib-gatilegrid", "path": "/tests/test_tilegrids.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cclauss/lib-gatilegrid path: /tests/test_tilegrids.py # -*- coding: utf-8 -*- import math import unittest from gatilegrid import getTileGrid, GeoadminTileGridLV03, \ GeoadminTileGridLV95, GlobalMercatorTileGrid, GlobalGeodeticTileGrid class TestGeoadminTileGrid(unittest.TestCase): def...
code_fim
hard
{ "lang": "python", "repo": "cclauss/lib-gatilegrid", "path": "/tests/test_tilegrids.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ue_ip_addr = "192.168.128.30" self.classifier_controller.install_paging_flow( 200, IPAddress(version=IPAddress.IPV4, address=ue_ip_addr.encode('utf-8')), True, ) # Create a set of packets pkt_sender = ScapyPacketInjector(self.BRID...
code_fim
hard
{ "lang": "python", "repo": "magma/magma", "path": "/lte/gateway/python/magma/pipelined/tests/test_paging.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: magma/magma path: /lte/gateway/python/magma/pipelined/tests/test_paging.py """ Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writin...
code_fim
hard
{ "lang": "python", "repo": "magma/magma", "path": "/lte/gateway/python/magma/pipelined/tests/test_paging.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }