text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> probVal = Decimal(float(probVal*100)) probVal = round(probVal,2) ac = str(probVal) if probVal> threshold: cv2.putText(imgOriginal,str(catagory[i]),(50,70),cv2.FONT_HERSHEY_SIMPLEX,2,(0,0,255),2) cv2.putText(imgOriginal,"acc = "+ac+'%',(30, 140), cv2.FONT_HERSHEY_COMPLEX, 1,...
code_fim
hard
{ "lang": "python", "repo": "marci0903/Mechine-Learning-Projects", "path": "/Image_classifier/Testing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>API'} with open('flaskbox.yml', 'w') as file: yaml.dump(base_app, file, default_flow_style=False)<|fim_prefix|># repo: nik849/Flaskbox path: /tests/conftest.py import yaml def create_init_file(): """Create In<|fim_middle|>it file""" base_app = {'application': 'My restful
code_fim
easy
{ "lang": "python", "repo": "nik849/Flaskbox", "path": "/tests/conftest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nik849/Flaskbox path: /tests/conftest.py import yaml def create_init_file(): """Create Init file""" base_app = {'application': 'My restful <|fim_suffix|> yaml.dump(base_app, file, default_flow_style=False)<|fim_middle|>API'} with open('flaskbox.yml', 'w') as file:
code_fim
easy
{ "lang": "python", "repo": "nik849/Flaskbox", "path": "/tests/conftest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @data.setter def data(self, value): self._tensor.data = value def __repr__(self): return f"{self.__class__.__name__}({self._tensor})" def __bool__(self): """Override bool operator since encrypted tensors cannot evaluate""" raise RuntimeError("Cannot evalua...
code_fim
hard
{ "lang": "python", "repo": "facebookresearch/CrypTen", "path": "/crypten/cryptensor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: facebookresearch/CrypTen path: /crypten/cryptensor.py rad_input is None: if self.nelement() == 1: grad_input = self.new(torch.ones_like(self.data)) else: raise RuntimeError( "grad c...
code_fim
hard
{ "lang": "python", "repo": "facebookresearch/CrypTen", "path": "/crypten/cryptensor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: facebookresearch/CrypTen path: /crypten/cryptensor.py # in initial backward call, identify all required nodes: if top_node: self._identify_required_grads() # if undefined, set gradient input to one: if grad_input is ...
code_fim
hard
{ "lang": "python", "repo": "facebookresearch/CrypTen", "path": "/crypten/cryptensor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DiyanKalaydzhiev23/OOP---Python path: /Polymorphism and Abstraction - Exercise/Groups.py class Person: def __init__(self, name, surname): self.name = name self.surname = surname def __repr__(self): return f"{self.name} {self.surname}" def __add__(self, other...
code_fim
hard
{ "lang": "python", "repo": "DiyanKalaydzhiev23/OOP---Python", "path": "/Polymorphism and Abstraction - Exercise/Groups.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> p0 = Person('Aliko', 'Dangote') p1 = Person('Bill', 'Gates') p2 = Person('Warren', 'Buffet') p3 = Person('Elon', 'Musk') p4 = p2 + p3 first_group = Group('__VIP__', [p0, p1, p2]) second_group = Group('Special', [p3, p4]) third_group = first_group + second_group print(len(first_group)) print(second_grou...
code_fim
hard
{ "lang": "python", "repo": "DiyanKalaydzhiev23/OOP---Python", "path": "/Polymorphism and Abstraction - Exercise/Groups.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> .. [2] Huber, Peter et al (1964) Robust Estimation of a Location Parameter https://projecteuclid.org/euclid.aoms/1177703732 """ predictions, targets = align_targets(predictions, targets) abs_diff = abs(targets - predictions) ift = 0.5 * squared_error(targets, pred...
code_fim
hard
{ "lang": "python", "repo": "Ram-Aditya/Healthcare-Data-Analytics", "path": "/env/lib/python2.7/site-packages/lasagne/objectives.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> .. math:: L_i = \\frac{(p - t)^2}{2}, |p - t| \\le \\delta L_i = \\delta (|p - t| - \\frac{\\delta}{2} ), |p - t| \\gt \\delta Parameters ---------- predictions : Theano 2D tensor or 1D tensor Prediction outputs of a neural network. targets : Theano 2D tensor or 1D ...
code_fim
hard
{ "lang": "python", "repo": "Ram-Aditya/Healthcare-Data-Analytics", "path": "/env/lib/python2.7/site-packages/lasagne/objectives.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ram-Aditya/Healthcare-Data-Analytics path: /env/lib/python2.7/site-packages/lasagne/objectives.py :nosignatures: aggregate Note that these functions only serve to write more readable code, but are completely optional. Essentially, any differentiable scalar Theano expression can be used ...
code_fim
hard
{ "lang": "python", "repo": "Ram-Aditya/Healthcare-Data-Analytics", "path": "/env/lib/python2.7/site-packages/lasagne/objectives.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fuvity/mc906project2 path: /graphics.py from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter import numpy as np from math import sqrt, ceil def getChild(A, B): if crossover_method == ...
code_fim
hard
{ "lang": "python", "repo": "fuvity/mc906project2", "path": "/graphics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if itt == max_iterations-1: ax = plt.figure() plt.title('Última geração') p = plt.imshow(Z, cmap=cm.viridis) plt.colorbar(p) childrenx = [] childreny = [] for child in children: childrenx.append(child[0]) childreny.append(...
code_fim
hard
{ "lang": "python", "repo": "fuvity/mc906project2", "path": "/graphics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chor-nyan/trimap path: /example.py # https://github.com/eamid/examples import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import fetch_openml from utils import plot_results import matplotlib.cm as cm from sklearn.decomposition import PCA from sklearn.manifold import TSNE # ...
code_fim
hard
{ "lang": "python", "repo": "chor-nyan/trimap", "path": "/example.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>plt.scatter(yo_trimap[:, 0], yo_trimap[:, 1], s=0.1, c=cols[L, :]) # plt.scatter(yo_trimap[index,0], yo_trimap[index,1], s=80, c='red', marker='x') plt.show() # yo_pca = PCA(n_components = 2).fit_transform(Xo) # plt.scatter(yo_pca[:,0], yo_pca[:,1], s=0.1, c=cols[L,:]) # plt.scatter(yo_pca[index,0], yo_...
code_fim
hard
{ "lang": "python", "repo": "chor-nyan/trimap", "path": "/example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>scale = False if scale: flag1 = yo_trimap[:, 0] > -150 flag2 = yo_trimap[:, 1] < 130 flag = flag1 & flag2 plt.scatter(yo_trimap[flag,0], yo_trimap[flag,1], s=0.1, c=cols[L[flag],:]) plt.show() # flag = [True] * Xo.shape[0] # flag[index] = False # plt.scatter(yo_trimap[flag,0], yo_trima...
code_fim
hard
{ "lang": "python", "repo": "chor-nyan/trimap", "path": "/example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> host, _ = deploy.get_socket() port = 50001 if not 'KUBE_OPENEO_API_PORT' in os.environ else os.environ['KUBE_OPENEO_API_PORT'] def on_started() -> None: from openeo_driver.views import app app.logger.setLevel('DEBUG') server.run(title="OpenEO API", descrip...
code_fim
hard
{ "lang": "python", "repo": "bartjanssens92/openeo-geopyspark-driver", "path": "/openeogeotrellis/deploy/kubernetes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bartjanssens92/openeo-geopyspark-driver path: /openeogeotrellis/deploy/kubernetes.py """ Script to start a production server on Kubernetes. This script can serve as the mainApplicationFile for the SparkApplication custom resource of the spark-operator """ import logging from logging.config impor...
code_fim
hard
{ "lang": "python", "repo": "bartjanssens92/openeo-geopyspark-driver", "path": "/openeogeotrellis/deploy/kubernetes.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Calculate one transitive-fraternal-augmentation-step and # result a tuple (newgraph, transedges, fratedges) # @memorized(['orig', 'step']) def truncated_tf_augmentation(orig, g, trans, frat, col, nodes, step, td, ldoFunc): fratGraph = Graph() newTrans = {} for ...
code_fim
medium
{ "lang": "python", "repo": "TheoryInPractice/CONCUSS", "path": "/lib/coloring/basic/truncated_tf_augmentation.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheoryInPractice/CONCUSS path: /lib/coloring/basic/truncated_tf_augmentation.py #!/usr/bin/python # # This file is part of CONCUSS, https://github.com/theoryinpractice/concuss/, # and is Copyright (C) North Carolina State University, 2015. It is licensed # under the three-clause BSD license; see ...
code_fim
hard
{ "lang": "python", "repo": "TheoryInPractice/CONCUSS", "path": "/lib/coloring/basic/truncated_tf_augmentation.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> indegs = [] for v in g: #Flexible indegs[v] = g.in_degree(v) if v < len(indegs): indegs[v] = g.in_degree(v) else: indegs.extend([0 for x in range(len(indegs), v)]) indegs.insert( v, g.in_degree(v) ) fratDigraph = ldoFunc(fratGraph, ...
code_fim
hard
{ "lang": "python", "repo": "TheoryInPractice/CONCUSS", "path": "/lib/coloring/basic/truncated_tf_augmentation.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mr-sivamareedu/infraform path: /infraform/cli/list/parser.py # Copyright 2019 Arie Bregman # # 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://w...
code_fim
medium
{ "lang": "python", "repo": "mr-sivamareedu/infraform", "path": "/infraform/cli/list/parser.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """The parser for sub command 'list'.""" list_parser = subparsers.add_parser("list") list_parser.set_defaults(func=list_cli.main) list_parser.add_argument('--scenarios', '-s', dest="scenarios", action='store_true', ...
code_fim
medium
{ "lang": "python", "repo": "mr-sivamareedu/infraform", "path": "/infraform/cli/list/parser.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class YamlSerializer(Serializer[str]): @classmethod def serialize(cls, obj: Any, **opts: Any) -> str: return yaml.safe_dump(obj, **opts) # type: ignore class YamlDeserializer(Deserializer[str]): @classmethod def deserialize(cls, data: str, **opts: Any) -> Any: return yam...
code_fim
medium
{ "lang": "python", "repo": "yukinarit/pyserde", "path": "/serde/yaml.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yukinarit/pyserde path: /serde/yaml.py """ Serialize and Deserialize in YAML format. This module depends on [pyyaml](https://pypi.org/project/PyYAML/) package. """ from typing import Type, Any, overload, Optional import yaml from .compat import T from .de import Deserializer, from_dict from .se...
code_fim
hard
{ "lang": "python", "repo": "yukinarit/pyserde", "path": "/serde/yaml.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ... def from_yaml(c: Any, s: str, de: Type[Deserializer[str]] = YamlDeserializer, **opts: Any) -> Any: """ `c` is a class obejct and `s` is YAML string. If you supply keyword arguments other than `de`, they will be passed in `yaml.safe_load` function. If you want to use the other ya...
code_fim
hard
{ "lang": "python", "repo": "yukinarit/pyserde", "path": "/serde/yaml.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: starkbank/sdk-python path: /tests/utils/rule.py from copy import deepcopy from random import choice, randint from starkbank import CorporateRule, MerchantCountry, CardMethod, MerchantCategory example_rule = CorporateRule( name="Example Rule", interval="day", amount=100000, curre...
code_fim
medium
{ "lang": "python", "repo": "starkbank/sdk-python", "path": "/tests/utils/rule.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def generateExampleRuleJson(n=1): rules = [] for _ in range(n): example_rule.interval = choice(["day", "week", "month", "instant"]) example_rule.amount = randint(1000, 100000) example_rule.currency_code = choice(["BRL", "USD"]) example_rule.countries = [MerchantCoun...
code_fim
medium
{ "lang": "python", "repo": "starkbank/sdk-python", "path": "/tests/utils/rule.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PyreWatch/pyrefinder path: /tests/test_db.py import datetime from pyrefinder import db def test_add_fighter(): DB = db.DatabaseManager() topic = "dt/fighter/bob" message = {"latitude": 100, "longitude": 100} db.add_fighter(topic, message) result = DB.query_db( "se...
code_fim
hard
{ "lang": "python", "repo": "PyreWatch/pyrefinder", "path": "/tests/test_db.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fighter_time_result = DB3.query_db( "select last_time from fighter where id=? and last_time=?", ["sam", now]) DB3.modify_db("delete from fighter_data where client_id=?", ["sam"]) DB3.modify_db("delete from fighter where id=?", ["sam"]) del DB3 assert fighter_time_res...
code_fim
hard
{ "lang": "python", "repo": "PyreWatch/pyrefinder", "path": "/tests/test_db.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert fighter_time_result != (now, ) def test_update_of_last_status(): DB4 = db.DatabaseManager() now = datetime.datetime.now() topic = "dt/fighter/sam" message = {"status": "NOFIRE", "latitude": 100, "longitude": 100} db.add_fighter(topic, message) message = {"status": "...
code_fim
hard
{ "lang": "python", "repo": "PyreWatch/pyrefinder", "path": "/tests/test_db.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dorucioclea/posthog path: /posthog/migrations/0220_backfill_primary_dashboards.py import structlog from django.db import connection, migrations def backfill_primary_dashboards(apps, _): logger = structlog.get_logger(__name__) logger.info("starting 0220_set_primary_dashboard") Team ...
code_fim
hard
{ "lang": "python", "repo": "dorucioclea/posthog", "path": "/posthog/migrations/0220_backfill_primary_dashboards.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Because of the nature of this backfill, there's no way to reverse it without potentially destroying customer data # However, we still need a reverse function, so that we can rollback other migrations def reverse(apps, _): pass class Migration(migrations.Migration): atomic = False dependen...
code_fim
hard
{ "lang": "python", "repo": "dorucioclea/posthog", "path": "/posthog/migrations/0220_backfill_primary_dashboards.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RekGRpth/auto-indexing-PostgreSQL path: /test/test1_0.py import csv import re import sys import subprocess import psycopg2 import json import math import random import time # Open Connection to database conn = psycopg2.connect(database = "test", user = "postgres", password = "", host = "localhos...
code_fim
hard
{ "lang": "python", "repo": "RekGRpth/auto-indexing-PostgreSQL", "path": "/test/test1_0.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cur.execute(stmt21.format(random.randint(0,129))) result = str(cur.fetchall()) cur.execute(stmt22.format(snames[random.randint(0,len(snames)-1)])) result = str(cur.fetchall()) cur.execute(stmt3.format(deps[random.randint(0,len(deps)-1)] , random.randint(0,129))) result = str(cur.fetchall()) conn...
code_fim
hard
{ "lang": "python", "repo": "RekGRpth/auto-indexing-PostgreSQL", "path": "/test/test1_0.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with open('ReleaseStatus.xml') as infile: soup = BeautifulSoup(infile, 'lxml') synsets = soup.find_all('synset') synsets = [synsets[i].attrs['wnid'] for i in range(len(synsets)) if int(synsets[i].attrs['numimages']) > 100] extra_train = np.random.choice(synsets, 100) extra_test = np.random.choice(s...
code_fim
hard
{ "lang": "python", "repo": "JobQiu/PrototypicalNetwork", "path": "/data/mini-imagenet/demo.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JobQiu/PrototypicalNetwork path: /data/mini-imagenet/demo.py import numpy as np np.random.seed(42) from bs4 import BeautifulSoup with open('empty_dir') as f: content = f.readlines() # you may also want to remove whitespace characters like `\n` at the end of each line content = [x.strip() fo...
code_fim
hard
{ "lang": "python", "repo": "JobQiu/PrototypicalNetwork", "path": "/data/mini-imagenet/demo.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: inventree/InvenTree path: /InvenTree/plugin/builtin/integration/test_core_notifications.py """Tests for core_notifications.""" from django.core import mail from part.test_part import BaseNotificationIntegrationTest from plugin import registry from plugin.builtin.integration.core_notifications i...
code_fim
medium
{ "lang": "python", "repo": "inventree/InvenTree", "path": "/InvenTree/plugin/builtin/integration/test_core_notifications.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # enable plugin and set mail setting to true plugin = registry.plugins.get('inventreecorenotificationsplugin') plugin.set_setting('ENABLE_NOTIFICATION_EMAILS', True) NotificationUserSetting.set_setting( key='NOTIFICATION_METHOD_MAIL', value=True, ...
code_fim
medium
{ "lang": "python", "repo": "inventree/InvenTree", "path": "/InvenTree/plugin/builtin/integration/test_core_notifications.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_email(self): """Ensure that the email notifications run.""" # No email should be send self.assertEqual(len(mail.outbox), 0) # enable plugin and set mail setting to true plugin = registry.plugins.get('inventreecorenotificationsplugin') plugin.se...
code_fim
medium
{ "lang": "python", "repo": "inventree/InvenTree", "path": "/InvenTree/plugin/builtin/integration/test_core_notifications.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # only add augmentation to first reader (not validation reader) self.readers[0].add_preprocessing_layers( normalisation_layers + augmentation_layers) for reader in self.readers[1:]: reader.add_preprocessing_layers(normalisation_layers) def initialise_s...
code_fim
hard
{ "lang": "python", "repo": "12SigmaTechnologies/NiftyNet-1", "path": "/niftynet/application/gan_application.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 12SigmaTechnologies/NiftyNet-1 path: /niftynet/application/gan_application.py # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function import tensorflow as tf from niftynet.application.base_application import BaseApplication from niftynet.engine.application_factory import ...
code_fim
hard
{ "lang": "python", "repo": "12SigmaTechnologies/NiftyNet-1", "path": "/niftynet/application/gan_application.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def initialise_sampler(self): self.sampler = [] if self.is_training: self.sampler.append([ResizeSampler( reader=reader, window_sizes=self.data_param, batch_size=self.net_param.batch_size, windows_per_image=1, ...
code_fim
hard
{ "lang": "python", "repo": "12SigmaTechnologies/NiftyNet-1", "path": "/niftynet/application/gan_application.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def retain( self, resource ): if not hasattr( self, '__resources' ): self.__resources = [] guard = ResRef( resource ) self.__resources.append( guard ) def release( self, resource ): for i, guard in iter( self.__resources ): if guard.data is resource: self.__resources = self.__resource...
code_fim
hard
{ "lang": "python", "repo": "pixpil/gii", "path": "/lib/gii/core/res.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pixpil/gii path: /lib/gii/core/res.py from abc import ABCMeta, abstractmethod ##----------------------------------------------------------------## _resGuardDictCache = {} _resGuardDict = {} def registerResGuard( typeId, guard ): _resGuardDict[ typeId ] = guard def findResGuard( typeId ): g = ...
code_fim
hard
{ "lang": "python", "repo": "pixpil/gii", "path": "/lib/gii/core/res.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass ##----------------------------------------------------------------## class ResRef(object): def __init__(self, data): self.data = data def __dealloc__( self ): self.release( self.data ) def release( self, data ): typeId = type( data ) guard = findResGuard( typeId ) if guard: gua...
code_fim
hard
{ "lang": "python", "repo": "pixpil/gii", "path": "/lib/gii/core/res.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: marcomusy/vedo path: /examples/advanced/meshquality.py """Metrics of quality for the cells of a triangular mesh (zoom to see cell label values)""" from vedo import dataurl, Mesh, show from vedo.pyplot import histogram mesh = Mesh(dataurl + "panther.stl").compute_normals().linewidth(0.1).flat() ...
code_fim
hard
{ "lang": "python", "repo": "marcomusy/vedo", "path": "/examples/advanced/meshquality.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># create numeric labels of active scalar on top of cells labs = mesh.labels(on="cells", precision=3, scale=0.4, font="Quikhand", c="black") cam = dict( pos=(59.8, -191, 78.9), focal_point=(27.9, -2.94, 3.33), viewup=(-0.0170, 0.370, 0.929), distance=205, clipping_range=(87.8, 355), ) ...
code_fim
hard
{ "lang": "python", "repo": "marcomusy/vedo", "path": "/examples/advanced/meshquality.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>) equipment_map = {"车锁":"lock","头盔":"helmet","手套":"glove","手机支架":"phoneHolder","水壶架":"kettleHolder","梁包":"bag","后座":"backseat","码表":"stopwatch","手电":"flashlight","尾灯":"backlight","指南针":"compass"} if order[7]: temp = order[7].split(',') for i,equipment in enumerate(t...
code_fim
hard
{ "lang": "python", "repo": "kinsney/sport", "path": "/orderConvert.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kinsney/sport path: /orderConvert.py import pymysql as pm from django.contrib.auth.hashers import make_password qike = pm.connect(host='localhost',user='root',passwd='root',db='qike',port=3306,charset='utf8') sport = pm.connect(host='localhost',user='root',passwd='root',db='sport',port=3306,chars...
code_fim
hard
{ "lang": "python", "repo": "kinsney/sport", "path": "/orderConvert.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>odified,scoreRenter,scoreOwner,bike_id,renter_id) print(sql_order) sc.execute(sql_order) print(id) if order[20].strip(): commentId+=1 rentercontent = order[20] sql_comment = "INSERT INTO order_comments VALUES({0},'{1}',{2},{3},'{4}')".for...
code_fim
hard
{ "lang": "python", "repo": "kinsney/sport", "path": "/orderConvert.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def ROT_Z(theta=0): return qOp([[np.exp(-1j * theta/2.0), 0], [0, np.exp(1j * theta/2.0)]]) # Two-qubit gates SWAP = qOp([[1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) CNOT = qOp([[1, 0, 0, 0], [0, 1, 0, 0], [0, ...
code_fim
hard
{ "lang": "python", "repo": "jasonelhaderi/pypsqueak", "path": "/pypsqueak/gates.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jasonelhaderi/pypsqueak path: /pypsqueak/gates.py ''' Static gates ============ Pre-defined ``qOp`` objects are provided implementing the common static gates ``X``, ``Y``, ``Z``, ``I``, ``H``, ``S`` (phase), and ``T`` (pi/8). Parametric gates ================ Common parametric gates (such as rot...
code_fim
medium
{ "lang": "python", "repo": "jasonelhaderi/pypsqueak", "path": "/pypsqueak/gates.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> client = DataAPIClient(get_api_endpoint_from_stage(arguments['<stage>']), arguments['<data_api_token>']) user = arguments['<user>'] or getpass.getuser() framework_slugs = arguments.get("<framework_slugs>") and arguments["<framework_slugs>"].split(",") dry_run = bool(arguments.get("--dry-ru...
code_fim
hard
{ "lang": "python", "repo": "alphagov-mirror/digitalmarketplace-scripts", "path": "/scripts/oneoff/migrate-supplier-data-from-declarations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alphagov-mirror/digitalmarketplace-scripts path: /scripts/oneoff/migrate-supplier-data-from-declarations.py #!/usr/bin/env python """Selectively migrate supplier information from a recent framework declaration to new fields on supplier itself Usage: scripts/oneoff/migrate-supplier-data-from-...
code_fim
hard
{ "lang": "python", "repo": "alphagov-mirror/digitalmarketplace-scripts", "path": "/scripts/oneoff/migrate-supplier-data-from-declarations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZhuoZhuoCrayon/AcousticKeyBoard-Web path: /apps/example/serializers.py # -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from apps.example import constants, models from apps.example.tests import mock_data from djangocli.utils.d...
code_fim
hard
{ "lang": "python", "repo": "ZhuoZhuoCrayon/AcousticKeyBoard-Web", "path": "/apps/example/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class CommonValidateExceptionRequestSer(filter.PageSerializer): class Meta: swagger_schema_fields = {"example": mock_data.API_COMMON_VALIDATE_EXCEPTION.request_data} class CommonValidateExceptionResponseSer(serializers.Serializer): class Meta: swagger_schema_fields = {"example":...
code_fim
hard
{ "lang": "python", "repo": "ZhuoZhuoCrayon/AcousticKeyBoard-Web", "path": "/apps/example/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: huaweicloud/huaweicloud-sdk-python-v3 path: /huaweicloud-sdk-cfw/huaweicloudsdkcfw/v1/model/flavor.py # coding: utf-8 import six from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization class Flavor: """ Attributes: openapi_types (dict): The key is attribute n...
code_fim
hard
{ "lang": "python", "repo": "huaweicloud/huaweicloud-sdk-python-v3", "path": "/huaweicloud-sdk-cfw/huaweicloudsdkcfw/v1/model/flavor.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> 日志存储 :return: The log_storage of this Flavor. :rtype: int """ return self._log_storage @log_storage.setter def log_storage(self, log_storage): """Sets the log_storage of this Flavor. 日志存储 :param log_storage: The log_storage of thi...
code_fim
hard
{ "lang": "python", "repo": "huaweicloud/huaweicloud-sdk-python-v3", "path": "/huaweicloud-sdk-cfw/huaweicloudsdkcfw/v1/model/flavor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @log_storage.setter def log_storage(self, log_storage): """Sets the log_storage of this Flavor. 日志存储 :param log_storage: The log_storage of this Flavor. :type log_storage: int """ self._log_storage = log_storage def to_dict(self): """R...
code_fim
hard
{ "lang": "python", "repo": "huaweicloud/huaweicloud-sdk-python-v3", "path": "/huaweicloud-sdk-cfw/huaweicloudsdkcfw/v1/model/flavor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: daisycrego/mercury-telemetry path: /ag_data/tests/test_error_record.py from django.test import TestCase from ag_data.error_record import record from ag_data.models import ErrorLog class TestErrorRecord(TestCase): <|fim_suffix|> foo = ErrorLog.objects.first() self.assertEqual(foo...
code_fim
hard
{ "lang": "python", "repo": "daisycrego/mercury-telemetry", "path": "/ag_data/tests/test_error_record.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_save(self): foo = ErrorLog.objects.first() self.assertEqual(foo.error_code, self.test_data["error_code"]) self.assertEqual(foo.description, self.test_data["description"]) self.assertEqual(foo.raw_data, self.test_data["raw_data"])<|fim_prefix|># repo: daisycrego...
code_fim
hard
{ "lang": "python", "repo": "daisycrego/mercury-telemetry", "path": "/ag_data/tests/test_error_record.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self): record.save_error( raw_data=self.test_data["raw_data"], error_code=self.test_data["error_code"], error_description=self.test_data["description"], ) def test_save(self): foo = ErrorLog.objects.first() self.assertE...
code_fim
hard
{ "lang": "python", "repo": "daisycrego/mercury-telemetry", "path": "/ag_data/tests/test_error_record.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GitHubChengPeng/jMetalPy path: /jmetal/util/ckecking.py class NoneParameterException(Exception): def __init__(self, message: str = ""): self.error_message = message class InvalidConditionException(Exception): def __init__(self, message: str): self.error_message = message...
code_fim
medium
{ "lang": "python", "repo": "GitHubChengPeng/jMetalPy", "path": "/jmetal/util/ckecking.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if value < 0.0 or value > 1.0: raise InvalidProbabilityValueException(value) @staticmethod def value_is_in_range(value: float, lowest_value: float, highest_value: float): if value < lowest_value or value > highest_value: raise ValueOutOfRangeException(value...
code_fim
medium
{ "lang": "python", "repo": "GitHubChengPeng/jMetalPy", "path": "/jmetal/util/ckecking.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def probability_is_valid(value: float): if value < 0.0 or value > 1.0: raise InvalidProbabilityValueException(value) @staticmethod def value_is_in_range(value: float, lowest_value: float, highest_value: float): if value < lowest_value or value > h...
code_fim
hard
{ "lang": "python", "repo": "GitHubChengPeng/jMetalPy", "path": "/jmetal/util/ckecking.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_sample_data_set(): """ """ (initial_state, rules) = parse_data(TEST_DATA) pots = Pots(initial_state) for gen in range(20): actual = to_string(pots).strip(".") expected = GENERATIONS[gen].strip(".") assert actual == expected, f"Failed at gen {gen}" ...
code_fim
hard
{ "lang": "python", "repo": "xpqz/aoc-18", "path": "/tests/test_day12.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xpqz/aoc-18 path: /tests/test_day12.py from day12 import Pots, parse_data TEST_DATA = [ "initial state: #..#.#..##......###...###", "...## => #", "..#.. => #", ".#... => #", ".#.#. => #", ".#.## => #", ".##.. => #", ".#### => #", "#.#.# => #", "#.### => #"...
code_fim
hard
{ "lang": "python", "repo": "xpqz/aoc-18", "path": "/tests/test_day12.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: amarsdd/R-NET-Behavioral-Navigation path: /plotter.py import numpy as np import matplotlib.pyplot as plt import pandas as pd from numpy import genfromtxt models = ["0", "1"] ndim = ["50", "100"] nlayers = ["1", "3"] plt.rc('font', family='serif') plt.rc('xtick', labelsize='medium') plt.rc('y...
code_fim
hard
{ "lang": "python", "repo": "amarsdd/R-NET-Behavioral-Navigation", "path": "/plotter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> name = csvpath+"model_"+models[i]+"_hdim_"+ndim[n_row]+"_nlayers_"+nlayers[n_col]+"_loss.csv" loss = genfromtxt(name, delimiter=',') vname = csvpath+"model_" + models[i] + "_hdim_" + ndim[n_row] + "_nlayers_" + nlayers[n_col]+"_val_loss.csv" vloss = genfromtxt(vname, delim...
code_fim
hard
{ "lang": "python", "repo": "amarsdd/R-NET-Behavioral-Navigation", "path": "/plotter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> context = { 'preload': {}, 'now': arrow.now(), 'url': self.request.url, } self.render(self.context)<|fim_prefix|># repo: erichiggins/gae-mixy path: /handlers/main.py #!/usr/bin/env python # -*- coding: utf-8 -*- import httplib import logging import sys import arrow import...
code_fim
hard
{ "lang": "python", "repo": "erichiggins/gae-mixy", "path": "/handlers/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: erichiggins/gae-mixy path: /handlers/main.py #!/usr/bin/env python # -*- coding: utf-8 -*- import httplib import logging import sys import arrow import webapp2 from google.appengine.api import memcache from google.appengine.ext import deferred from google.appengine.ext import ndb from google.a...
code_fim
hard
{ "lang": "python", "repo": "erichiggins/gae-mixy", "path": "/handlers/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = [ 'Home', 'Admin', 'WarmUp', #'ExteriorImage', ] class WarmUp(main.Health, base.BaseHandler): """Handler for warmup requests sent to /_ah/warmup.""" def get(self, *args, **kwargs): """Print out health status to try and keep the frontend instance up.""" status = htt...
code_fim
medium
{ "lang": "python", "repo": "erichiggins/gae-mixy", "path": "/handlers/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> import string import os import sys from os.path import join from org.batfish.util.util import make_sure_path_exists from org.batfish.util.batfish_exception import BatfishException # check if this line starts with @param def isParamAttr(s): return s.find("@param") == 0 and (len(s) == 6 or s[6] in st...
code_fim
hard
{ "lang": "python", "repo": "Network-verification/batfish", "path": "/projects/pybatfish/src/org/batfish/questions_to_html/questions_to_html.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Network-verification/batfish path: /projects/pybatfish/src/org/batfish/questions_to_html/questions_to_html.py # Author: Todd Millstein # Copyright 2016 # This script parses Javadoc comments in Batfish question files and produces a documentation page batfish-questions.html. # If a command-line a...
code_fim
hard
{ "lang": "python", "repo": "Network-verification/batfish", "path": "/projects/pybatfish/src/org/batfish/questions_to_html/questions_to_html.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> train_files = [args.train_dir + 'train.bucket' + str(i) + '.txt' for i in range(args.num_buckets)] if args.combinator == fcm.FORM_ONLY: args.sample_context_words = 1 elif args.combinator == fcm.CONTEXT_ONLY: args.nmin = 1 args.nmax = 1 if args.log_file is not Non...
code_fim
hard
{ "lang": "python", "repo": "timoschick/form-context-model", "path": "/fcm/train.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> batch_builder = InputProcessor( word_embeddings_file=args.emb_file, word_embeddings_format=args.emb_format, train_files=train_files, vocab_file=args.vocab, vector_size=args.emb_dim, nmin=args.nmin, nmax=args.nmax, ngram_dropout=args.dropo...
code_fim
hard
{ "lang": "python", "repo": "timoschick/form-context-model", "path": "/fcm/train.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: timoschick/form-context-model path: /fcm/train.py import argparse import io import os import datetime import socket import form_context_model as fcm import my_log from batch_builder import InputProcessor logger = my_log.get_logger('root') def main(): parser = argparse.ArgumentParser() ...
code_fim
hard
{ "lang": "python", "repo": "timoschick/form-context-model", "path": "/fcm/train.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: c1rdan/pytan path: /lib/taniumpy/__init__.py '''A python package that handles the serialization/deserialization of XML SOAP requests/responses<|fim_suffix|> import Session # from .question_asker import QuestionAsker from .object_types.base import BaseType from .object_types.result_set import Resu...
code_fim
medium
{ "lang": "python", "repo": "c1rdan/pytan", "path": "/lib/taniumpy/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pe from .object_types.result_set import ResultSet from .object_types.result_info import ResultInfo<|fim_prefix|># repo: c1rdan/pytan path: /lib/taniumpy/__init__.py '''A python package that handles the serialization/deserialization of XML SOAP requests/responses<|fim_middle|> from Tanium to/from python o...
code_fim
medium
{ "lang": "python", "repo": "c1rdan/pytan", "path": "/lib/taniumpy/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Damon8q/geonotebook path: /devops/filter_plugins/groups.py def cidr_list_to_rules(values): <|fim_suffix|> return { 'cidr_list_to_rules': cidr_list_to_rules }<|fim_middle|> return [{'proto': 'all', 'cidr_ip': v} for v in values] class FilterModule(object): def fi...
code_fim
medium
{ "lang": "python", "repo": "Damon8q/geonotebook", "path": "/devops/filter_plugins/groups.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return { 'cidr_list_to_rules': cidr_list_to_rules }<|fim_prefix|># repo: Damon8q/geonotebook path: /devops/filter_plugins/groups.py def cidr_list_to_rules(values): return [{'proto': 'all', 'cidr_ip': v} for v in values] <|fim_middle|>class FilterModule(object): def fi...
code_fim
easy
{ "lang": "python", "repo": "Damon8q/geonotebook", "path": "/devops/filter_plugins/groups.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: slochower/openforcefield path: /openforcefield/tests/test_utils.py #!/usr/bin/env python # ============================================================================================= # MODULE DOCSTRING # ==========================================================================================...
code_fim
hard
{ "lang": "python", "repo": "slochower/openforcefield", "path": "/openforcefield/tests/test_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass subclass_names = [cls.__name__ for cls in utils.all_subclasses(Foo)] assert set(subclass_names) == set( ["FooSubclass1", "FooSubclass2", "FooSubSubclass"] ) def test_temporary_cd(): """Test temporary_cd() context manager""" initial_dir = os.getcwd() temporar...
code_fim
hard
{ "lang": "python", "repo": "slochower/openforcefield", "path": "/openforcefield/tests/test_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: contrun/dotfiles path: /dot_config/sway/scripts/executable_i3session #!/usr/bin/env python2 import os import i3 import sys import pickle import subprocess import logging from time import sleep from xdg.BaseDirectory import * class Node: def __init__(self, data, parent = None): self....
code_fim
hard
{ "lang": "python", "repo": "contrun/dotfiles", "path": "/dot_config/sway/scripts/executable_i3session", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> pickle.dump(session, open(config_file, "wb")) print "Session saved to " + config_file elif sys.argv[1] == 'restore': nag_bar = nag_bar_process() print "Restoring..." # load session from file try: session = pickle.load(open(config_file, "rb")...
code_fim
hard
{ "lang": "python", "repo": "contrun/dotfiles", "path": "/dot_config/sway/scripts/executable_i3session", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> assert device.by_id == device.links[0] assert device.major == 5 assert device.minor == 10<|fim_prefix|># repo: home-assistant/supervisor path: /tests/hardware/test_data.py """Test HardwareManager Module.""" from pathlib import Path from supervisor.hardware.data import Device # pylint: disab...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/supervisor", "path": "/tests/hardware/test_data.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_device_property(coresys): """Test device cgroup policy.""" device = Device( "ttyACM0", Path("/dev/ttyACM0"), Path("/sys/bus/usb/001"), "tty", None, [Path("/dev/serial/by-id/fixed-device")], {"MAJOR": "5", "MINOR": "10"}, [],...
code_fim
medium
{ "lang": "python", "repo": "home-assistant/supervisor", "path": "/tests/hardware/test_data.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant/supervisor path: /tests/hardware/test_data.py """Test HardwareManager Module.""" from pathlib import Path from supervisor.hardware.data import Device # pylint: disable=protected-access def test_device_property(coresys): <|fim_suffix|> assert device.by_id == device.links[0] ...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/supervisor", "path": "/tests/hardware/test_data.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> temp = line.split() norm = 2 * int(temp[0]) inv = 2 * int(temp[1]) tag = str(norm) + ' ' + str(inv) + ' ' smallRel = float(temp[4]) smallErr = float(temp[5]) for inner_line in open(largeFile): if inner_line.startswith(tag): temp = inner_line.split() largeR...
code_fim
hard
{ "lang": "python", "repo": "daschaich/susy_scripts", "path": "/analyze_blocked_loops.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> p = float(norm + inv) / 4.0 rescaled = largeLoop * np.power(xi, p) # de(xi^p) = p (xi^{p - 1}) de(x) err1 = largeErr / largeLoop err2 = (p * np.power(xi, p - 1.0) * xi_err) / xi err = rescaled * np.sqrt(err1**2 + err2**2) # print "%d %d %.4g" % (int(norm) / 2, int(inv) / 2, float(...
code_fim
hard
{ "lang": "python", "repo": "daschaich/susy_scripts", "path": "/analyze_blocked_loops.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: daschaich/susy_scripts path: /analyze_blocked_loops.py #!/usr/bin/python import os import sys import glob import numpy as np # ------------------------------------------------------------------ # Determine xi from small-volume and blocked-large-volume Wilson loops, # scaling mu \propto 1 / L # T...
code_fim
hard
{ "lang": "python", "repo": "daschaich/susy_scripts", "path": "/analyze_blocked_loops.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: Yelp/task_processing path: /tests/unit/plugins/mesos/constraints_test.py import pytest from pyrsistent import m from task_processing.plugins.mesos.constraints import attributes_match_constraints from task_processing.plugins.mesos.constraints import Constraint @pytest.fixture def fake_dict(): ...
code_fim
hard
{ "lang": "python", "repo": "Yelp/task_processing", "path": "/tests/unit/plugins/mesos/constraints_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_constraints_all_match(fake_dict): assert attributes_match_constraints( fake_dict, [ Constraint( attribute="region", operator="==", value="fake_region_text", ), Constraint( attri...
code_fim
hard
{ "lang": "python", "repo": "Yelp/task_processing", "path": "/tests/unit/plugins/mesos/constraints_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_constraints_LIKE_match(fake_dict): assert attributes_match_constraints( fake_dict, [ Constraint( attribute="region", operator="LIKE", value="fak.*t..t", ), ], ) assert attributes_match_cons...
code_fim
hard
{ "lang": "python", "repo": "Yelp/task_processing", "path": "/tests/unit/plugins/mesos/constraints_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: XrosLiang/SymmetryNet path: /tools/prcurve/pr.py import numpy as np import matplotlib.pyplot as plt savedir = './shapenet/' datadir = './shapenet/data/' # ycb rot # file1 = datadir+'heavy-new_ins-oursdis=15.txt' # file2 = datadir+'mid-new_ins-oursdis=15.txt' # file3 = datadir+'light-new_ins-ours...
code_fim
hard
{ "lang": "python", "repo": "XrosLiang/SymmetryNet", "path": "/tools/prcurve/pr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>plt.plot(recall1, precision1, linewidth = 2, color = 'tab:red', zorder = 10, label='holdout category') plt.plot(recall2, precision2, linewidth = 2, color = 'tab:green', zorder = 10, label='holdout instance') plt.plot(recall3, precision3, linewidth = 2, color = 'tab:blue', zorder = 10, label='holdout vi...
code_fim
hard
{ "lang": "python", "repo": "XrosLiang/SymmetryNet", "path": "/tools/prcurve/pr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: atultherajput/doc2text path: /doc2text.py import convert import ocr def getText(): docType=input("1. Aadhaar Card\n2. PAN Card\nEnter Document Type: ") filename = input("File Name: ") if docType == "1": aadhaar=convert.convert(filename) return {'file': filename, 'aadh...
code_fim
medium
{ "lang": "python", "repo": "atultherajput/doc2text", "path": "/doc2text.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>': aadhaar[2]} elif docType=="2": name, f_name, dob, pan = ocr.get_pan(filename) return {'file': filename, 'pan': pan, 'name': name, 'f_name': f_name, 'dob':dob} else: print("Wrong Option! Try again.") if __name__ == '__main__': result = getText() print(result)<|fi...
code_fim
medium
{ "lang": "python", "repo": "atultherajput/doc2text", "path": "/doc2text.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmatiasr/django-demo path: /mysite/RentApp/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2019-01-06 18:55 from __future__ import unicode_literals from django.conf import settings import django.contrib.gis.db.models.fields from django.db import migrations, mod...
code_fim
hard
{ "lang": "python", "repo": "dmatiasr/django-demo", "path": "/mysite/RentApp/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }