text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> """ Getter method for the history """ return self.history def get_parent(self): """ Getter method for the parent object """ return self.parent def get_api(self): """ Getter method for the InstructureApi object """ return self.api def get_setti...
code_fim
hard
{ "lang": "python", "repo": "rioksusanto/CanvasSync", "path": "/CanvasSync/local_entities/local_canvas_entity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rioksusanto/CanvasSync path: /CanvasSync/local_entities/local_canvas_entity.py """ LocalCanvasEntity.py, Base class The LocalCanvasEntity class is a module very similar to CanvasEntity, except that it represents the CanvasEntity from the point of view of the local file system. """ # Inbuilt m...
code_fim
hard
{ "lang": "python", "repo": "rioksusanto/CanvasSync", "path": "/CanvasSync/local_entities/local_canvas_entity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adorsk/mission_control path: /mc/houston/subcommands/get_or_create_job.py import json from ._base_subcommand import BaseSubcommand class Subcommand(BaseSubcommand): help = "Get an existing job, or create a new job if it does not yet exist" def add_arguments(self, parser=None): <|fim_s...
code_fim
hard
{ "lang": "python", "repo": "adorsk/mission_control", "path": "/mc/houston/subcommands/get_or_create_job.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _create_job(self, job=None): with self.session.begin(subtransactions=True): self.db.session.add(job) return job<|fim_prefix|># repo: adorsk/mission_control path: /mc/houston/subcommands/get_or_create_job.py import json from ._base_subcommand import BaseSubcommand cl...
code_fim
medium
{ "lang": "python", "repo": "adorsk/mission_control", "path": "/mc/houston/subcommands/get_or_create_job.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SoulCoders/PyAtx path: /atx/FindS.py """ findS ~~~~~~~~~~~~ FindS is a tool for search keywords in a path. Author: tkorays Datatime: 2017-12-8 """ import os import re import sys import click import tkinter as tk import tkinter.ttk as ttk class FileFilter: ...
code_fim
hard
{ "lang": "python", "repo": "SoulCoders/PyAtx", "path": "/atx/FindS.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class ExtensionFilter(FileFilter): def __init__(self, exts): super().__init__() self.exts = [exts, ] if isinstance(exts, str) else exts def filt(self, p): return os.path.splitext(p)[1] in self.exts @click.command() @click.version_option("v1.0.0") @click.option...
code_fim
hard
{ "lang": "python", "repo": "SoulCoders/PyAtx", "path": "/atx/FindS.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.printElement = PrintElement() def writeDzn(self, fileName, answer, omegap, omegan, atMostOne): self.openFile(fileName) self.writeParams(answer) self.writeLineBreak(1) self.writeOmegap(omegap) self.writeLineBreak(2) self.writeOmegan(omegan) ...
code_fim
medium
{ "lang": "python", "repo": "alejandrohn/SCI-generator", "path": "/writeDzn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alejandrohn/SCI-generator path: /writeDzn.py from printElement import PrintElement TAnswer = '%number of attributes' KAnswer = '%maximum size of support set' NAnswer = '%number of positive instances' MAnswer = '%number of negative instances' CAnswer = '%number of atMostOne Constraints' <|fim_su...
code_fim
hard
{ "lang": "python", "repo": "alejandrohn/SCI-generator", "path": "/writeDzn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.f.close() def writeLine(self, attribute, text, symbol): self.f.write(symbol + '=' + attribute.__str__() + '; ' + text + '\n') def writeOmegap(self, omegap): self.f.write( 'omegap = ' + self.printElement.printMatrixWithPipe(omegap)) def writeOmegan(se...
code_fim
hard
{ "lang": "python", "repo": "alejandrohn/SCI-generator", "path": "/writeDzn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> import psutil, os p = psutil.Process(os.getpid()) p.nice(psutil.IDLE_PRIORITY_CLASS) def main(name=datetime.now().strftime('%Y%m%d%H%M%S')): parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-s', '--seed', help='RNG seed', ty...
code_fim
hard
{ "lang": "python", "repo": "jcsharp/DriveIt", "path": "/trainppo2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jcsharp/DriveIt path: /trainppo2.py #!/usr/bin/env python import sys import os.path as osp import argparse from datetime import datetime from belief import BeliefDriveItEnv from car import Car from autopilot import LaneFollowingPilot #, ReflexPilot, SharpPilot # from PositionTracking import TrueP...
code_fim
hard
{ "lang": "python", "repo": "jcsharp/DriveIt", "path": "/trainppo2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: samodeh97/data-structures-and-algorithms path: /python/hashmap-repeated-word/hashmap_repeated_word/hashmap_repeated_word.py import re class Hashtable: def __init__(self, size): self.size = size self.map = [None]*size def hash(self, key): index = 0 fo...
code_fim
hard
{ "lang": "python", "repo": "samodeh97/data-structures-and-algorithms", "path": "/python/hashmap-repeated-word/hashmap_repeated_word/hashmap_repeated_word.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sentence = "Once upon a time, there was a brave princess who..." print(repeated_word(sentence)) sentence = "it was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of...
code_fim
hard
{ "lang": "python", "repo": "samodeh97/data-structures-and-algorithms", "path": "/python/hashmap-repeated-word/hashmap_repeated_word/hashmap_repeated_word.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Converts draft change list from state version 29 to 30. State version 30 replaces tagged_misconception_id with tagged_skill_misconception_id. Args: draft_change_list: list(ExplorationChange). The list of ExplorationChange domain objects to up...
code_fim
hard
{ "lang": "python", "repo": "import-keshav/oppia", "path": "/core/domain/draft_upgrade_services.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: import-keshav/oppia path: /core/domain/draft_upgrade_services.py # coding: utf-8 # # Copyright 2019 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a cop...
code_fim
hard
{ "lang": "python", "repo": "import-keshav/oppia", "path": "/core/domain/draft_upgrade_services.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/nova path: /nova/tests/unit/compute/test_virtapi.py # Copyright 2012 IBM Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://...
code_fim
hard
{ "lang": "python", "repo": "openstack/nova", "path": "/nova/tests/unit/compute/test_virtapi.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _set_traits_for_provider( self, context, rp_uuid, traits, generation=None): self.provider_traits[rp_uuid] = traits def _event_waiter(self): event = mock.MagicMock() event.status = 'completed' return event def _prepare_for_instance_event(self, i...
code_fim
hard
{ "lang": "python", "repo": "openstack/nova", "path": "/nova/tests/unit/compute/test_virtapi.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def is_product_supported(cls, product, role): """ check if plugin is capable of supporting product """ return False # end is_product_supported @abc.abstractmethod def initialize(self): """Initialize local data structures""" # ene initialize ...
code_fim
hard
{ "lang": "python", "repo": "tungstenfabric/tf-controller", "path": "/src/config/device-manager/device_manager/device_conf.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tungstenfabric/tf-controller path: /src/config/device-manager/device_manager/device_conf.py # # Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. # """ This file contains implementation plugin base class for device config module """ from builtins import str from builtins import obj...
code_fim
hard
{ "lang": "python", "repo": "tungstenfabric/tf-controller", "path": "/src/config/device-manager/device_manager/device_conf.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: TomShoe/parsing-website path: /main/teams.py teams = { #Big East 'Pirates': 'Seton Hall University', 'Villanova Wildcats': 'Villanova University', 'St. John\'s University eSports': 'St. John\'s University', 'DePaul Blue Demons': 'DePaul University', 'Georgetown Reflection': 'Georgetown Univ...
code_fim
hard
{ "lang": "python", "repo": "TomShoe/parsing-website", "path": "/main/teams.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ence 'RMU Esports': 'Robert Morris University Illinois', 'Illinois College': 'Illinois College', 'Grand View Vikings ': 'Grand View University', 'Drury University': 'Drury University', 'Shockers': 'Wichita State University', 'Mizzou Esports': 'University of Missouri', 'Midland Warriors': 'Midland U...
code_fim
hard
{ "lang": "python", "repo": "TomShoe/parsing-website", "path": "/main/teams.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arianepaola/tg2jython path: /toscawidgets/examples/tg1sample/tg1sample/controllers.py import pprint import turbogears as tg from turbogears import controllers, expose, flash, validate, error_handler <|fim_suffix|> # Tells turbogears to call index() if validation fails @error_handler(index...
code_fim
hard
{ "lang": "python", "repo": "arianepaola/tg2jython", "path": "/toscawidgets/examples/tg1sample/tg1sample/controllers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Tells turbogears to call index() if validation fails @error_handler(index) # Tells turbogears to validate input with the form @validate(form) @expose() def process_form(self, **kw): return pprint.pformat(kw)<|fim_prefix|># repo: arianepaola/tg2jython path: /toscawidgets/...
code_fim
hard
{ "lang": "python", "repo": "arianepaola/tg2jython", "path": "/toscawidgets/examples/tg1sample/tg1sample/controllers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: prakashgowinji/Django_experiment path: /django_experiment/accounts/models.py from django.contrib import auth from django.contrib.auth.models import User from django.db import models from django.utils import timezone #from django.core.validators import MaxValueValidator class User(auth.models.Use...
code_fim
hard
{ "lang": "python", "repo": "prakashgowinji/Django_experiment", "path": "/django_experiment/accounts/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return "%s " % self.place.name class Security(models.Model): company = models.ForeignKey(Company, on_delete=models.CASCADE) name = models.CharField(max_length=50) def __str__(self): return "%s at %s" % (self.name, self.company) # # class Employee(mode...
code_fim
hard
{ "lang": "python", "repo": "prakashgowinji/Django_experiment", "path": "/django_experiment/accounts/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class Security(models.Model): company = models.ForeignKey(Company, on_delete=models.CASCADE) name = models.CharField(max_length=50) def __str__(self): return "%s at %s" % (self.name, self.company) # # class Employee(models.Model): # #user = models.OneToOneField(User, on_delete=m...
code_fim
hard
{ "lang": "python", "repo": "prakashgowinji/Django_experiment", "path": "/django_experiment/accounts/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>= "" consumer_secret = "" return access_token, access_token_secret, consumer_key, consumer_secret<|fim_prefix|># repo: geekwhocodes/Twitter-Sentiment-Analysis-with-TextBlob-and-Tweepy- path: /credentials.py def getCredentials(): ''' returns "credentials in access_token, access_token_secr...
code_fim
hard
{ "lang": "python", "repo": "geekwhocodes/Twitter-Sentiment-Analysis-with-TextBlob-and-Tweepy-", "path": "/credentials.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: geekwhocodes/Twitter-Sentiment-Analysis-with-TextBlob-and-Tweepy- path: /credentials.py def getCredentials(): ''' returns "credentials in access_token, access_token_secret, consumer_key<|fim_suffix|> \\ Replace with your credentials access_token = "" access_token_secret = "" ...
code_fim
medium
{ "lang": "python", "repo": "geekwhocodes/Twitter-Sentiment-Analysis-with-TextBlob-and-Tweepy-", "path": "/credentials.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jango/calculon path: /calculon/Calculon.py from multiprocessing import Queue, Pipe from Consumer import ConsumerProcess, ConsumerThread from Producer import ProducerProcess, ProducerThread class Calculon: """Producer-consumer class. Responsible for initializing producers and consumers and ...
code_fim
hard
{ "lang": "python", "repo": "jango/calculon", "path": "/calculon/Calculon.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Join on the consumers. for cons_obj in cons_objs: cons_obj.join() # Collect result values. result = {"producers": [], "consumers": []} for counter, prod_obj in enumerate(prod_objs): if isinstance(prod_obj, ProducerProces...
code_fim
hard
{ "lang": "python", "repo": "jango/calculon", "path": "/calculon/Calculon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: trec-kba/streamcorpus-pipeline path: /streamcorpus_pipeline/_serif.py #!/usr/bin/env python '''streamcorpus_pipeline.BatchTransform for Serif .. This software is released under an MIT/X11 open source license. Copyright 2012-2015 Diffeo, Inc. ''' from __future__ import absolute_import import ...
code_fim
hard
{ "lang": "python", "repo": "trec-kba/streamcorpus-pipeline", "path": "/streamcorpus_pipeline/_serif.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> logger.info('serif cmd: %r', cmd) start_time = time.time() # make sure we are using as little memory as possible gc.collect() try: self._child = subprocess.Popen(cmd, stderr=subprocess.PIPE, shell=False) ...
code_fim
hard
{ "lang": "python", "repo": "trec-kba/streamcorpus-pipeline", "path": "/streamcorpus_pipeline/_serif.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> start_time = time.time() # make sure we are using as little memory as possible gc.collect() try: self._child = subprocess.Popen(cmd, stderr=subprocess.PIPE, shell=False) except OSError, exc: logger.e...
code_fim
hard
{ "lang": "python", "repo": "trec-kba/streamcorpus-pipeline", "path": "/streamcorpus_pipeline/_serif.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: idanhovav/BerkFood path: /caldining.py from lxml import html import requests CALDINING_URL='http://services.housing.berkeley.edu/FoodPro/dining/static/DiningMenus.asp?strCurLocation=0' <|fim_suffix|> url = CALDINING_URL + str(dining_hall_id) page = requests.get(url) html_tree = html.fromstrin...
code_fim
easy
{ "lang": "python", "repo": "idanhovav/BerkFood", "path": "/caldining.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_menu_items(dining_hall_id): url = CALDINING_URL + str(dining_hall_id) page = requests.get(url) html_tree = html.fromstring(page.text) items = html_tree.xpath('//font/text()')[3:] return items<|fim_prefix|># repo: idanhovav/BerkFood path: /caldining.py from lxml import html import requests <...
code_fim
medium
{ "lang": "python", "repo": "idanhovav/BerkFood", "path": "/caldining.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sylvia9628/nbdev_testing path: /nbdev_testing/None.py # Cell from .preprocess import * from .tfidf import * <|fim_suffix|># Cell from .preprocess import * from .tfidf import *<|fim_middle|># Cell from .preprocess import * from .tfidf import *
code_fim
easy
{ "lang": "python", "repo": "Sylvia9628/nbdev_testing", "path": "/nbdev_testing/None.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Cell from .preprocess import * from .tfidf import *<|fim_prefix|># repo: Sylvia9628/nbdev_testing path: /nbdev_testing/None.py # Cell from .preprocess import * from .tfidf import * <|fim_middle|># Cell from .preprocess import * from .tfidf import *
code_fim
easy
{ "lang": "python", "repo": "Sylvia9628/nbdev_testing", "path": "/nbdev_testing/None.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> name = "asahi_articles" def start_requests(self): urls = [ "http://www.asahi.com/national/list", "http://www.asahi.com/politics/list", "http://www.asahi.com/business/list", "http://www.asahi.com/international/list", "http://w...
code_fim
hard
{ "lang": "python", "repo": "cr1m5onk1ng/japanese_news_scraper", "path": "/news_scraper/spiders/asahi_spider.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cr1m5onk1ng/japanese_news_scraper path: /news_scraper/spiders/asahi_spider.py import scrapy from news_scraper.items import AsahiTopicItem from scrapy import Request from scrapy.loader import ItemLoader class AsahiTopicSpider(scrapy.Spider): name = "asahi_topics" start_urls = ["https://ww...
code_fim
hard
{ "lang": "python", "repo": "cr1m5onk1ng/japanese_news_scraper", "path": "/news_scraper/spiders/asahi_spider.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def start_requests(self): urls = [ "http://www.asahi.com/national/list", "http://www.asahi.com/politics/list", "http://www.asahi.com/business/list", "http://www.asahi.com/international/list", "http://www.asahi.com/sports/list", ...
code_fim
hard
{ "lang": "python", "repo": "cr1m5onk1ng/japanese_news_scraper", "path": "/news_scraper/spiders/asahi_spider.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kevinshenyang07/Data-Structures-and-Algorithms path: /algorithms/dynamic_programming/house_robber.py # House Robber II # all houses are arranged in a circle class SolutionQ2(object): def rob(self, nums): """ :type nums: List[int] :rtype: int """ if len(...
code_fim
hard
{ "lang": "python", "repo": "kevinshenyang07/Data-Structures-and-Algorithms", "path": "/algorithms/dynamic_programming/house_robber.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># [5, 2, 3] # [0, 5, 2, 8] R # [0, 0, 5, 5] N # [2, 3, 4] # [0, 2, 3, 6] R # [0, 0, 2, 3] N<|fim_prefix|># repo: kevinshenyang07/Data-Structures-and-Algorithms path: /algorithms/dynamic_programming/house_robber.py # House Robber II # all houses are arranged in a circle class SolutionQ2(ob...
code_fim
hard
{ "lang": "python", "repo": "kevinshenyang07/Data-Structures-and-Algorithms", "path": "/algorithms/dynamic_programming/house_robber.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: greenbender/aoc path: /2015/day07/solve.py import sys def op_assign(value): return value def op_rshift(value, b): return value >> b def op_lshift(value, b): return value << b def op_or(v1, v2): return v1 | v2 def op_and(v1, v2): return v1 & v2 def op_not(value)...
code_fim
hard
{ "lang": "python", "repo": "greenbender/aoc", "path": "/2015/day07/solve.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _getInput(self, value): try: return self._getLiteral(value) except: return self.getWire(value) def addWire(self, line): op, target = [p.strip() for p in line.split(' -> ')] target = self.getWire(target) if 'NOT' in op: ...
code_fim
hard
{ "lang": "python", "repo": "greenbender/aoc", "path": "/2015/day07/solve.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print('filtered-->',cnt_f) print('eliminated-->',cnt_e)<|fim_prefix|># repo: DisneyAladdin/kenkyu path: /program/adaptation/06_filter.py a = open('adapted.csv','r') b = open('filtered.csv','w') c = open('eliminated.csv','w') border = float(input('please enter the border\n--->')) <|fim_middle|>cnt=0 cnt...
code_fim
hard
{ "lang": "python", "repo": "DisneyAladdin/kenkyu", "path": "/program/adaptation/06_filter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DisneyAladdin/kenkyu path: /program/adaptation/06_filter.py a = open('adapted.csv','r') b = open('filtered.csv','w') c = open('eliminated.csv','w') <|fim_suffix|> print('filtered-->',cnt_f) print('eliminated-->',cnt_e)<|fim_middle|>border = float(input('please enter the border\n--->')) cnt=0 cn...
code_fim
hard
{ "lang": "python", "repo": "DisneyAladdin/kenkyu", "path": "/program/adaptation/06_filter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gottaegbert/penter path: /the-python-standard-library-by-example/copy/copy_recursion.py # -*- coding: utf-8 -*- import copy import pprint class Graph: def __init__(self, name, connections): <|fim_suffix|> def add_connection(self, other): self.connections.append(other) def ...
code_fim
medium
{ "lang": "python", "repo": "gottaegbert/penter", "path": "/the-python-standard-library-by-example/copy/copy_recursion.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> root = Graph('root', []) a = Graph('a', [root]) b = Graph('b', [a, root]) root.add_connection(a) root.add_connection(b) dup = copy.deepcopy(root)<|fim_prefix|># repo: gottaegbert/penter path: /the-python-standard-library-by-example/copy/copy_recursion.py # -*- coding: utf-8 -*- import copy import ppri...
code_fim
hard
{ "lang": "python", "repo": "gottaegbert/penter", "path": "/the-python-standard-library-by-example/copy/copy_recursion.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Check Nginx configuration and return boolean""" Log.debug(self, "Testing Nginx configuration ") # Check Nginx configuration before executing command sub = subprocess.Popen('nginx -t', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) output, erro...
code_fim
medium
{ "lang": "python", "repo": "WordOps/WordOps", "path": "/wo/core/nginx.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: WordOps/WordOps path: /wo/core/nginx.py """WordOps Nginx Manager""" import subprocess from wo.core.logging import Log <|fim_suffix|> """Check Nginx configuration and return boolean""" Log.debug(self, "Testing Nginx configuration ") # Check Nginx configuration before executing comman...
code_fim
medium
{ "lang": "python", "repo": "WordOps/WordOps", "path": "/wo/core/nginx.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ruanpei1010/quickbot_api path: /research/speed_sign_plot.py import matplotlib.pyplot as plt data = [] with open('speed_sign.csv') as f: for line in f: data.append(tuple(float(x) for x in line.strip().split(', '))) <|fim_suffix|>plt.plot(timer, speed_left, color='r', label='speed (left)') plt...
code_fim
medium
{ "lang": "python", "repo": "ruanpei1010/quickbot_api", "path": "/research/speed_sign_plot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>plt.plot(timer, speed_left, color='r', label='speed (left)') plt.plot(timer, speed_right, color='g', label='speed (right)') plt.plot(timer, ticks_right, color='m', label='ticks (left)') plt.plot(timer, ticks_left, color='c', label='ticks (right)') plt.plot(timer, torque, color='b', label='torque') plt.leg...
code_fim
medium
{ "lang": "python", "repo": "ruanpei1010/quickbot_api", "path": "/research/speed_sign_plot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Camiloasc1/AstronomyUNAL path: /CelestialMechanics/physics.py from astropy import units as u <|fim_suffix|> r = r.to(u.m) r = r.value / norm(r) ** 3 / u.m ** 2 return G * m1 * m2 * r<|fim_middle|>def GravitationalForce(r, m1, m2): from astropy.constants import G from numpy.li...
code_fim
medium
{ "lang": "python", "repo": "Camiloasc1/AstronomyUNAL", "path": "/CelestialMechanics/physics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> from astropy.constants import G from numpy.linalg import norm r = r.to(u.m) r = r.value / norm(r) ** 3 / u.m ** 2 return G * m1 * m2 * r<|fim_prefix|># repo: Camiloasc1/AstronomyUNAL path: /CelestialMechanics/physics.py from astropy import units as u <|fim_middle|>def Gravitational...
code_fim
easy
{ "lang": "python", "repo": "Camiloasc1/AstronomyUNAL", "path": "/CelestialMechanics/physics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: qiboteam/qibo path: /tests/test_models_circuit_qasm.py """Tests creating abstract Qibo circuits from OpenQASM code.""" import numpy as np import pytest import qibo from qibo import Circuit, __version__, gates def assert_strings_equal(a, b): """Asserts that two strings are identical charact...
code_fim
hard
{ "lang": "python", "repo": "qiboteam/qibo", "path": "/tests/test_models_circuit_qasm.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_from_qasm_multiqubit_gates(): target = f"""// Generated by QIBO {__version__} OPENQASM 2.0; include "qelib1.inc"; qreg q[3]; cx q[0],q[2]; x q[1]; swap q[0],q[1]; cx q[1],q[0]; ccx q[1],q[2],q[0];""" c = Circuit.from_qasm(target) assert c.nqubits == 3 assert c.depth == 4 asse...
code_fim
hard
{ "lang": "python", "repo": "qiboteam/qibo", "path": "/tests/test_models_circuit_qasm.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> target = """OPENQASM 2.0; include "qelib1.inc"; qreg q[5]; creg a[3]; creg b[2]; measure q[0] -> a[0]; x q[3]; measure q[1] -> b[0]; measure q[2] -> a[1]; measure q[4] -> a[2]; measure q[3] -> b[1];""" c = Circuit.from_qasm(target) assert c.depth == 2 assert isinstance(c.queue[1], gates.X)...
code_fim
hard
{ "lang": "python", "repo": "qiboteam/qibo", "path": "/tests/test_models_circuit_qasm.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Mixin(util.U128Mixin, int): __slots__ = () value = Mixin(0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) dto = [[0xFFFFFFFF, 0xFFFFFFFF], [0xFFFFFFFF, 0x7FFFFFFF]] catbuffer = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7f' self.assertEqua...
code_fim
hard
{ "lang": "python", "repo": "proximax-storage/python-xpx-chain-sdk", "path": "/tests/main/util/mixin_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Mixin(util.U32Mixin, int): __slots__ = () value = Mixin(0x7FFFFFFF) dto = 0x7FFFFFFF catbuffer = b'\xff\xff\xff\x7f' self.assertEqual(value.to_dto(None), dto) self.assertEqual(Mixin.create_from_dto(dto, None), value) self.assertEqu...
code_fim
hard
{ "lang": "python", "repo": "proximax-storage/python-xpx-chain-sdk", "path": "/tests/main/util/mixin_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: proximax-storage/python-xpx-chain-sdk path: /tests/main/util/mixin_test.py from xpxchain import util from tests import harness class TestUMixin(harness.TestCase): def test_u8mixin(self): class Mixin(util.U8Mixin, int): __slots__ = () value = Mixin(0x7F) ...
code_fim
hard
{ "lang": "python", "repo": "proximax-storage/python-xpx-chain-sdk", "path": "/tests/main/util/mixin_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_corona_info(self, country_name): url = "https://api.covid19api.com/summary" response = requests.get(url) # Intermittently URL responds with a message - You have reached maximum request limit. if response.text == "You have reached maximum request limit.": ...
code_fim
hard
{ "lang": "python", "repo": "sukeesh/Jarvis", "path": "/jarviscli/plugins/corona.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> new_recovered = corona_info["NewRecovered"] jarvis.say(f"\tNew recovered : {new_recovered}", Fore.GREEN) total_recovered = corona_info["TotalRecovered"] jarvis.say(f"\tTotal recovered : {total_recovered}", Fore.GREEN) def get_corona_i...
code_fim
hard
{ "lang": "python", "repo": "sukeesh/Jarvis", "path": "/jarviscli/plugins/corona.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sukeesh/Jarvis path: /jarviscli/plugins/corona.py import requests from colorama import Fore from plugin import plugin, require from inspect import cleandoc @require(network=True) @plugin("corona") class CoronaInfo: """ corona : Display total cases of the world corona <Country n...
code_fim
hard
{ "lang": "python", "repo": "sukeesh/Jarvis", "path": "/jarviscli/plugins/corona.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """This node will have an optional ``ArgumentNode`` and/or ``ContentNode`` child.""" def __init__( self, rawsource, *, name: str, module: str, conversion: str, options_list: List[Tuple[str, Any]], **kwargs ) -> None: supe...
code_fim
medium
{ "lang": "python", "repo": "bertabus/rst-to-myst", "path": "/rst_to_myst/nodes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bertabus/rst-to-myst path: /rst_to_myst/nodes.py from typing import Any, List, Tuple from docutils import nodes class UnprocessedText(nodes.Text): """Text that should not be processed in any way (e.g. escaping characters).""" class EvalRstNode(nodes.Element): """Should contain a sing...
code_fim
hard
{ "lang": "python", "repo": "bertabus/rst-to-myst", "path": "/rst_to_myst/nodes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class ArgumentNode(nodes.Element): """The parsed argument of a directive.""" class ContentNode(nodes.Element): """The parsed content of a directive.""" class FrontMatterNode(nodes.Element): """Contains the first field list in the document."""<|fim_prefix|># repo: bertabus/rst-to-myst pat...
code_fim
hard
{ "lang": "python", "repo": "bertabus/rst-to-myst", "path": "/rst_to_myst/nodes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ standard errors """ def getTraitCovarStdErrors(self, term_i): """ Returns standard errors on trait covariances from term_i (for the covariance estimate \see getTraitCovar) Args: term_i: index of the term we are interested in """ assert ...
code_fim
hard
{ "lang": "python", "repo": "noahpieta/limix", "path": "/limix/vardec/vardec.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Return the estimated trait covariance matrix for term_i (or the total if term_i is None) To retrieve the matrix of correlation coefficient use \see getTraitCorrCoef Args: term_i: index of the random effect term we want to retrieve the covariance mat...
code_fim
hard
{ "lang": "python", "repo": "noahpieta/limix", "path": "/limix/vardec/vardec.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: noahpieta/limix path: /limix/vardec/vardec.py for i in range(n_times): if init_method == 'random': params = {'covar': sp.randn(params0['covar'].shape[0])} self.gp.setParams(params) elif perturb: params = { ...
code_fim
hard
{ "lang": "python", "repo": "noahpieta/limix", "path": "/limix/vardec/vardec.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def write_shortcode(self, shortcode, url, encoding): raise Exception('This method is not used.')<|fim_prefix|># repo: ArchiveTeam/terroroftinytown path: /terroroftinytown/format/projectsettings.py '''Serialize project settings.''' import json from terroroftinytown.format.base import BaseWrit...
code_fim
medium
{ "lang": "python", "repo": "ArchiveTeam/terroroftinytown", "path": "/terroroftinytown/format/projectsettings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ArchiveTeam/terroroftinytown path: /terroroftinytown/format/projectsettings.py '''Serialize project settings.''' import json from terroroftinytown.format.base import BaseWriter <|fim_suffix|> def write_project(self, project): text = json.dumps(project.to_dict()) self.fp.write...
code_fim
easy
{ "lang": "python", "repo": "ArchiveTeam/terroroftinytown", "path": "/terroroftinytown/format/projectsettings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def write_project(self, project): text = json.dumps(project.to_dict()) self.fp.write(text.encode('utf-8')) def write_shortcode(self, shortcode, url, encoding): raise Exception('This method is not used.')<|fim_prefix|># repo: ArchiveTeam/terroroftinytown path: /terroroftin...
code_fim
easy
{ "lang": "python", "repo": "ArchiveTeam/terroroftinytown", "path": "/terroroftinytown/format/projectsettings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.__server_list.append(Server(name)) def responsible_server(self, key_name: str) -> Server: return self.__server_list[self.__hasher.hash_function(key_name) % len(self.__server_list)]<|fim_prefix|># repo: acatalfano/chord-dht path: /src/app/load_balancing/mod_n.py from ..node.serve...
code_fim
medium
{ "lang": "python", "repo": "acatalfano/chord-dht", "path": "/src/app/load_balancing/mod_n.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: acatalfano/chord-dht path: /src/app/load_balancing/mod_n.py from ..node.server import Server from ..hash_function import HashFunction from .load_balancer import LoadBalancer class ModN(LoadBalancer): '''a class that implements a mod-n hashing lookup. it maintains a list of servers ...
code_fim
medium
{ "lang": "python", "repo": "acatalfano/chord-dht", "path": "/src/app/load_balancing/mod_n.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _init_server_storage(self, server_list: list[Server] = None) -> None: self.__server_list = server_list if server_list is not None else [] def add_server(self, name: str) -> None: self.__server_list.append(Server(name)) def responsible_server(self, key_name: str) -> Server...
code_fim
hard
{ "lang": "python", "repo": "acatalfano/chord-dht", "path": "/src/app/load_balancing/mod_n.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cbbbbbbbb/sspywork path: /savecode/threeyears/idownclient/scout/plugin/searchengine/bing/azbing.py """ 使用微软云服务的Api去爬取bing的信息 create by judy 2019/11/14 """ import requests from idownclient.config_spiders import bingapikey class AzBingApi(object): @classmethod def bing_web_search(cls, qu...
code_fim
hard
{ "lang": "python", "repo": "cbbbbbbbb/sspywork", "path": "/savecode/threeyears/idownclient/scout/plugin/searchengine/bing/azbing.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> search_url = "https://api.cognitive.microsoft.com/bing/v7.0/search" headers = {"Ocp-Apim-Subscription-Key": subscription_key} params = {"q": query, 'count': count, 'offset': offset, "textDecorations": True, "textFormat": "HTML"} response = requests.get(search_url, headers=...
code_fim
hard
{ "lang": "python", "repo": "cbbbbbbbb/sspywork", "path": "/savecode/threeyears/idownclient/scout/plugin/searchengine/bing/azbing.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bsaghafi/erdos path: /erdos/utils.py import logging import time from functools import wraps from threading import Thread, Condition _freq_called = set([]) def deadline(*expected_args): """ Deadline decorator to be used for restraining computation latency. Takes in computation's dur...
code_fim
hard
{ "lang": "python", "repo": "bsaghafi/erdos", "path": "/erdos/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def log_graph_to_dot_file(filename, nodes, edges): dot_file = open(filename, 'w') # dot header dot_file.write("digraph G {") dot_file.write("\tgraph [rankdir=\"LR\"]") # nodes dot_file.write("\t{ node [shape=box]") dot_file.write("\t") for n in nodes: # TODO(ionel)...
code_fim
hard
{ "lang": "python", "repo": "bsaghafi/erdos", "path": "/erdos/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dot_file = open(filename, 'w') # dot header dot_file.write("digraph G {") dot_file.write("\tgraph [rankdir=\"LR\"]") # nodes dot_file.write("\t{ node [shape=box]") dot_file.write("\t") for n in nodes: # TODO(ionel): We replace / to _ because dot doesn't support / in...
code_fim
hard
{ "lang": "python", "repo": "bsaghafi/erdos", "path": "/erdos/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Extract magnet link return find_magnet_link(episode_page_object) def find_uri_to_episode_page(page): return page.find('td', { 'class': 'coll-1 name' }).find('a', { 'class': None })['href'] def find_magnet_link(page): return page.select_one('a[href*=magnet]')['href'] def create_pa...
code_fim
hard
{ "lang": "python", "repo": "brunapereira/tv-shows-downloader", "path": "/src/videos/client/x1337.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: brunapereira/tv-shows-downloader path: /src/videos/client/x1337.py import urllib.request from bs4 import BeautifulSoup from prettyconf import config BASE_URL = config('X1337_BASE_URL') <|fim_suffix|> # Find URI to first result uri_to_episode_page = find_uri_to_episode_page(search_page_ob...
code_fim
hard
{ "lang": "python", "repo": "brunapereira/tv-shows-downloader", "path": "/src/videos/client/x1337.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> img = cv2.addWeighted(img,0.8,line_img,1.0, 0.0) # Return the modified image. return img #--------------------------------------------------------------------------------------- min_line_y = 0 max_line_y = height piksel1=0 piksel2=1000...
code_fim
hard
{ "lang": "python", "repo": "yemreak/OTOBIL-Simulator", "path": "/src/furkan_yıldırım(silinecek)/screen-dete.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yemreak/OTOBIL-Simulator path: /src/furkan_yıldırım(silinecek)/screen-dete.py # -*- coding: utf-8 -*- """ Created on Sat Mar 30 09:47:27 2019 @author: MFYDUCK """ from PIL import ImageGrab as ig import numpy as np import time import cv2 import math def mfy(img): """ ...
code_fim
hard
{ "lang": "python", "repo": "yemreak/OTOBIL-Simulator", "path": "/src/furkan_yıldırım(silinecek)/screen-dete.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jeetain/crayon path: /examples/nga.py from __future__ import print_function import crayon # snapshots to analyze filenames = ['bcc.xyz','fcc.xyz','hcp.xyz','liquid.xyz'] # build neighbor list with a Voronoi construction # (or equivalenty Delaunay triangulation) nl = crayon.neighborlist.Vorono...
code_fim
hard
{ "lang": "python", "repo": "jeetain/crayon", "path": "/examples/nga.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># detect outliers using agglomerative clustering traj.detectOutliers(mode='agglomerative') # take distances to a power <1 to exaggerate polymorphs traj.dmap.alpha = 0.50 # build diffusion map from distance matrix traj.buildDMap() # write color maps for visualization in Ovito or VMD traj.writeColors() ...
code_fim
hard
{ "lang": "python", "repo": "jeetain/crayon", "path": "/examples/nga.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Chessdevil-Consulting/rd_django path: /rd_django/cms_plugins.py # Copyright 2017 - 2018 Ruben Decrop # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
code_fim
hard
{ "lang": "python", "repo": "Chessdevil-Consulting/rd_django", "path": "/rd_django/cms_plugins.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> model = RdTab name = 'Tab' module = 'Reddevil' render_template = 'rd_django/tab.html' require_parent = True allow_children = True def render(self, context, instance, placeholder): context['tabtitle'] = instance.tabtitle return super(RdTabPlugin, self).render( ...
code_fim
hard
{ "lang": "python", "repo": "Chessdevil-Consulting/rd_django", "path": "/rd_django/cms_plugins.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ryuichi1208/GetQiitaInfo path: /getqiitainfo.py # -*- coding: utf-8 -*- import sys import time import os import re import requests import json import numpy as np import matplotlib.pyplot as plt domain = "https://qiita.com" username = "" token = "" def check_domain_valid(domain: str): regex...
code_fim
hard
{ "lang": "python", "repo": "ryuichi1208/GetQiitaInfo", "path": "/getqiitainfo.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_views_count(id_list: list): view_list = [] for i in range(len(id_list)): url = "https://qiita.com/api/v2/items/" + id_list[i] tmp = json.loads(exec_http_requrest(url).text) view_list.append(tmp['page_views_count']) time.sleep(3) return view_list def l...
code_fim
hard
{ "lang": "python", "repo": "ryuichi1208/GetQiitaInfo", "path": "/getqiitainfo.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def get_user_ingo(username: str): if exec_http_requrest(gen_url(domain, "agwagopkewpogkew", 0)) == 404: pass def get_itmes(url: str, js: list, pages: int): response = exec_http_requrest(url) tmp = json.loads(response.text) js.extend(tmp) if len(js) % 20 == 0: get_itme...
code_fim
hard
{ "lang": "python", "repo": "ryuichi1208/GetQiitaInfo", "path": "/getqiitainfo.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: thomasdn/sigal path: /tests/test_cli.py import logging import os from os.path import join from click.testing import CliRunner from sigal.__main__ import build, init, serve, set_meta TESTGAL = join(os.path.abspath(os.path.dirname(__file__)), "sample") def test_init(tmpdir): config_file = ...
code_fim
hard
{ "lang": "python", "repo": "thomasdn/sigal", "path": "/tests/test_cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> testdir = tmpdir.mkdir("test") testfile = tmpdir.join("test.jpg") testfile.write("") runner = CliRunner() result = runner.invoke(set_meta, [str(testdir), "title", "testing"]) assert result.exit_code == 0 assert result.output.startswith("1 metadata key(s) written to") ass...
code_fim
hard
{ "lang": "python", "repo": "thomasdn/sigal", "path": "/tests/test_cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> faces = torch.tensor([[0, 1, 2]], dtype=torch.long, device=device) output = trianglemesh.average_edge_length(vertices, faces) expected = torch.tensor([[1.4142], [5.7447]], device=device, dtype=dtype) assert torch.allclose(output, expected, atol=atol, rtol=rtol) @pytest.m...
code_fim
hard
{ "lang": "python", "repo": "le-Greg/kaolin", "path": "/tests/python/kaolin/metrics/test_trianglemesh.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: le-Greg/kaolin path: /tests/python/kaolin/metrics/test_trianglemesh.py # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy ...
code_fim
hard
{ "lang": "python", "repo": "le-Greg/kaolin", "path": "/tests/python/kaolin/metrics/test_trianglemesh.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: katiecheng/Bombolone path: /core/hash_table.py # -*- coding: utf-8 -*- """ core.hash_table.py ~~~~~~ The Hash Table allows you to store multiple Hash Map, each of which has an Name Map and an Hash useful to write the content for use on the web site. :copyright: (c) 2014 by @zizzamia :license: BS...
code_fim
hard
{ "lang": "python", "repo": "katiecheng/Bombolone", "path": "/core/hash_table.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Get len label len_label = int(form["len"]) # I look for fields that contain the keys, # then I browse to the field until the larger number. for i in range(len_label): label_key = 'label-name-{}'.format(i) key = form[label_key].strip() # Check that the key ha...
code_fim
hard
{ "lang": "python", "repo": "katiecheng/Bombolone", "path": "/core/hash_table.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> metrics_to_viewers = { "counter": view_counter, "gauge": view_gauge, "histogram": view_histogram, "meter": view_meter, "timer": view_timer, } def view_all_metrics(): all_data = {metric_type: [] for metric_type in metrics_to_viewers} for (metric_type, name, dims), metric in a...
code_fim
hard
{ "lang": "python", "repo": "Yelp/Tron", "path": "/tron/metrics.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Yelp/Tron path: /tron/metrics.py from pyformance.meters import Counter from pyformance.meters import Histogram from pyformance.meters import Meter from pyformance.meters import SimpleGauge from pyformance.meters import Timer all_metrics = {} def get_metric(metric_type, name, dimensions, defaul...
code_fim
hard
{ "lang": "python", "repo": "Yelp/Tron", "path": "/tron/metrics.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>metrics_to_viewers = { "counter": view_counter, "gauge": view_gauge, "histogram": view_histogram, "meter": view_meter, "timer": view_timer, } def view_all_metrics(): all_data = {metric_type: [] for metric_type in metrics_to_viewers} for (metric_type, name, dims), metric in al...
code_fim
hard
{ "lang": "python", "repo": "Yelp/Tron", "path": "/tron/metrics.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }