text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: duncanhayward/chemistry-cmislib path: /src/tests/test_type.py # -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regardi...
code_fim
hard
{ "lang": "python", "repo": "duncanhayward/chemistry-cmislib", "path": "/src/tests/test_type.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> cmisClient = CmisClient(self.url, self.user, self.pwd, binding=self.binding, **self.ext_args) repo = cmisClient.getDefaultRepository() typeDefs = repo.getTypeChildren() folderDef = None for typeDef in t...
code_fim
hard
{ "lang": "python", "repo": "duncanhayward/chemistry-cmislib", "path": "/src/tests/test_type.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> H = nx.compose(G_, G_cache_) ccs = nx.connected_component_subgraphs(H) for cc in ccs: cc_nodes = cc.nodes() cc_len = len(cc_nodes) if cc_len < avg_: small_ccs += cc_nodes elif cc_len >= threshold: event_exists = 1 H.remove_nodes_from...
code_fim
hard
{ "lang": "python", "repo": "antonia42/licno", "path": "/code/detect_events.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: antonia42/licno path: /code/detect_events.py import sys import networkx as nx import numpy as np reload(sys) sys.setdefaultencoding('utf-8') def detect_events(G_, G_cache_, theta_, avg_, std_, cc_lengths): """ Function to detect connected components that indicate an event or and event...
code_fim
medium
{ "lang": "python", "repo": "antonia42/licno", "path": "/code/detect_events.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def button1(): window.filename = None filename = None window.filename = tkFileDialog.askopenfilename(parent=window,initialdir = "/", title = "Select file", ...
code_fim
hard
{ "lang": "python", "repo": "Investigative-methods/Emotion-Detection", "path": "/EmotionDetection/Testing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Investigative-methods/Emotion-Detection path: /EmotionDetection/Testing.py from Tkinter import * from Tkinter import * import Tkinter, Tkconstants, tkFileDialog import Tkinter as tk import tkMessageBox from EmotionDetection import WordMap from EmotionDetection import EvaluateText from EmotionDete...
code_fim
hard
{ "lang": "python", "repo": "Investigative-methods/Emotion-Detection", "path": "/EmotionDetection/Testing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> answer = self.MessageBox(window=window) text = txt_file.get() values = value_file.get() if answer=='yes' and text != '': window.destroy() try: with codecs.open(text, 'r', encoding='utf-8', erro...
code_fim
hard
{ "lang": "python", "repo": "Investigative-methods/Emotion-Detection", "path": "/EmotionDetection/Testing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ProfessorSean/Kasutamaiza path: /upcfcardsearch/c23.py import discord from discord.ext import commands from discord.utils import get class c23(commands.Cog, name="c23"): def __init__(self, bot: commands.Bot): <|fim_suffix|> embed.add_field(name='Status (Archetype)', value='Casual:3/T...
code_fim
hard
{ "lang": "python", "repo": "ProfessorSean/Kasutamaiza", "path": "/upcfcardsearch/c23.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> embed.add_field(name='Status (Archetype)', value='Casual:3/Tournament:3 (Temporal)', inline=True) embed.add_field(name='Type (Attribute)', value='Rock/Fusion/Effect (EARTH)', inline=False) embed.add_field(name='Level (ATK/DEF)', value='9 (3000/3000)', inline=False) embed.ad...
code_fim
hard
{ "lang": "python", "repo": "ProfessorSean/Kasutamaiza", "path": "/upcfcardsearch/c23.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='PhoneModel', fields=[ ('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')), ('phone_number', models.CharField(max_length=12, blank=True, validators=...
code_fim
hard
{ "lang": "python", "repo": "ahl54/Tracker", "path": "/data_tracker/tracker/migrations/backup_migrations/0008_auto_20151202_1138.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ahl54/Tracker path: /data_tracker/tracker/migrations/backup_migrations/0008_auto_20151202_1138.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.core.validators class Migration(migrations.Migration): <|fim_suffix|> oper...
code_fim
hard
{ "lang": "python", "repo": "ahl54/Tracker", "path": "/data_tracker/tracker/migrations/backup_migrations/0008_auto_20151202_1138.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: apache/airflow path: /tests/system/providers/google/cloud/compute/example_compute_igm.py # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright owne...
code_fim
hard
{ "lang": "python", "repo": "apache/airflow", "path": "/tests/system/providers/google/cloud/compute/example_compute_igm.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Added to check for idempotence # [START howto_operator_gce_insert_igm_no_project_id] gce_igm_insert2 = ComputeEngineInsertInstanceGroupManagerOperator( task_id="gcp_compute_create_group_task_2", zone=LOCATION, body=INSTANCE_GROUP_MANAGER_BODY, ) # [END howto_o...
code_fim
hard
{ "lang": "python", "repo": "apache/airflow", "path": "/tests/system/providers/google/cloud/compute/example_compute_igm.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jseutter/recording-web-proxy path: /server2.py #!/usr/bin/env python3 """ A simple process that proxies HTTP requests to a backend server, inserting headers along the way. """ # Credit to the simple-python-webserver github project for inspiration. import argparse from http.client import parse_he...
code_fim
hard
{ "lang": "python", "repo": "jseutter/recording-web-proxy", "path": "/server2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": parser = argparse.ArgumentParser(description='Fake out repose') parser.add_argument('lport', type=int, help='port to listen on') parser.add_argument('bport', type=int, help='backend port to forward requests to') args = parser.parse_args() MyHTTPHandler.back...
code_fim
hard
{ "lang": "python", "repo": "jseutter/recording-web-proxy", "path": "/server2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> change = variables[0] + "f" code = code.replace(change, "If") return code def replace_previous(user, code, is_alt): """function replace_previous This function changes the previous lesson code Args: user: user model using tutor code: code that user submitted in la...
code_fim
hard
{ "lang": "python", "repo": "awolste/beginToReason2", "path": "/tutor/py_helper_functions/tutor_helper.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: awolste/beginToReason2 path: /tutor/py_helper_functions/tutor_helper.py """ This module contains our Django helper functions for the "tutor" application. """ import json from django.utils import timezone from django.contrib.auth.models import User from accounts.models import UserInformation from ...
code_fim
hard
{ "lang": "python", "repo": "awolste/beginToReason2", "path": "/tutor/py_helper_functions/tutor_helper.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> lesson_to_log = LessonLog.objects.create(user=user, time_stamp=timezone.now(), lesson_set_key=lesson_set, lesson_key=lesson, ...
code_fim
hard
{ "lang": "python", "repo": "awolste/beginToReason2", "path": "/tutor/py_helper_functions/tutor_helper.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lisaleemcb/zreion path: /src/zreion/__init__.py # -*- coding: utf-8 -*- # Copyright (c) 2020 Paul La Plante # Licensed under the MIT License """Init file for zreion.""" from pkg_resources import get_distribution, DistributionNotFound <|fim_suffix|> from .zreion import apply_zreion, apply_zreion...
code_fim
hard
{ "lang": "python", "repo": "lisaleemcb/zreion", "path": "/src/zreion/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: # Change here if project is renamed and does not equal the package name dist_name = __name__ __version__ = get_distribution(dist_name).version except DistributionNotFound: # pragma: no cover __version__ = "unknown" finally: del get_distribution, DistributionNotFound from .zrei...
code_fim
medium
{ "lang": "python", "repo": "lisaleemcb/zreion", "path": "/src/zreion/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from .zreion import apply_zreion, apply_zreion_fast __all__ = ["apply_zreion", "apply_zreion_fast"]<|fim_prefix|># repo: lisaleemcb/zreion path: /src/zreion/__init__.py # -*- coding: utf-8 -*- # Copyright (c) 2020 Paul La Plante # Licensed under the MIT License """Init file for zreion.""" from pkg_reso...
code_fim
hard
{ "lang": "python", "repo": "lisaleemcb/zreion", "path": "/src/zreion/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.output_path=output_path or '%s/Video/aircam/' % os.environ['EXTERNAL_STORAGE'] self.ffmpeg_path=ffmpeg_path or '/tmp' droid.log("sanitizing ffmpeg") os.system('cp %s/ffmpeg.amr %s/ffmpeg' % (self.FILES_PATH, self.ffmpeg_path)) os.system('chmod 777 %s/ffmpeg' % self.ffmpeg_path) os.system('rm -r...
code_fim
hard
{ "lang": "python", "repo": "manuelnaranjo/AIRi", "path": "/AIRcam/resources/ffmpeg.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not self._running: return self._running=False self._running_p[1].send_bytes("False") self.push_thread.join() self.push_thread = None self.buffer_file.flush() self.buffer_file.close() self.buffer_file = None self.ffmpeg_process.wait() self.push_pipe.close() self.push_pipe1.close() for ...
code_fim
hard
{ "lang": "python", "repo": "manuelnaranjo/AIRi", "path": "/AIRcam/resources/ffmpeg.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: manuelnaranjo/AIRi path: /AIRcam/resources/ffmpeg.py # -*- coding: utf-8 -*- import sys, os, time from fcntl import fcntl, F_GETFL, F_SETFL from subprocess import Popen, PIPE from multiprocessing import Process, Pipe, Value import android droid = android.Android() def ffmpeg_push_thread(fps, pip...
code_fim
hard
{ "lang": "python", "repo": "manuelnaranjo/AIRi", "path": "/AIRcam/resources/ffmpeg.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: RaviTezu/python-scripts path: /sequences.py #!/usr/bin/python """ This scirpt genrates all the possbile english from a word """ import sys import itertools try: import enchant except: print "You should have enchant module installed to run this script: pip install pyenchant works!" sys...
code_fim
hard
{ "lang": "python", "repo": "RaviTezu/python-scripts", "path": "/sequences.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": word = str(raw_input("Please enter a word: ")) if word.isalpha(): sequences = [] d = enchant.Dict("en_US") word_len = len(word) word_list = list(word) print "Generating all possible words..." while word_len > 2: ...
code_fim
hard
{ "lang": "python", "repo": "RaviTezu/python-scripts", "path": "/sequences.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if hasattr(rhs, "integer"): return self.integer >= rhs.integer else: try: return self.integer >= PCI(rhs).integer except StandardError: return NotImplemented class PCIIds(object): def __init__(self, fn): self...
code_fim
hard
{ "lang": "python", "repo": "windofthesky/python-libs", "path": "/xcp/pci.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: windofthesky/python-libs path: /xcp/pci.py #!/usr/bin/env python """ Copyright (c) 2013, Citrix Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source ...
code_fim
hard
{ "lang": "python", "repo": "windofthesky/python-libs", "path": "/xcp/pci.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> d.addErrback(unhandled) # Pass the evaluation jobs to the scheduler. for tick in ready_for_execution: task = self._graph.get_task(tick) inputs = {dest.port : self._graph.get_data(source) for source, dest in self._graph.get_in_connections(tick)} ...
code_fim
hard
{ "lang": "python", "repo": "pydron/pydron", "path": "/pydron/interpreter/traverser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param refine_task_callback: Function which is invoked when a task becomes ready for refinement. The signature is the same as for`ready_task_callback`, the return value is ignored. The returned deferred might get cancelled if the result isn't requir...
code_fim
hard
{ "lang": "python", "repo": "pydron/pydron", "path": "/pydron/interpreter/traverser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pydron/pydron path: /pydron/interpreter/traverser.py # Copyright (C) 2015 Stefan C. Mueller from pydron.dataflow import graph from pydron.interpreter import graphdecorator from twisted.internet import defer from twisted.internet.defer import CancelledError from twisted.python import failure im...
code_fim
hard
{ "lang": "python", "repo": "pydron/pydron", "path": "/pydron/interpreter/traverser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not transpose: df = df.set_index(indexCol) if indexCol in df.columns else df.set_index(df.columns[0]) if gzipResults: df.to_pickle(super()._append_gz(self.filePath), compression='gzip') else: df.to_pickle(self.filePath)<|fim_prefix|># repo: sr...
code_fim
hard
{ "lang": "python", "repo": "srp33/ExpressionAble", "path": "/expressionable/files/picklefile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def write_to_file(self, df, gzipResults=False, includeIndex=False, null='NA', indexCol=None, transpose=False): if not transpose: df = df.set_index(indexCol) if indexCol in df.columns else df.set_index(df.columns[0]) if gzipResults: df.to_pickle(super()._append_...
code_fim
hard
{ "lang": "python", "repo": "srp33/ExpressionAble", "path": "/expressionable/files/picklefile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: srp33/ExpressionAble path: /expressionable/files/picklefile.py import pandas as pd from ..files import EAFile class PickleFile(EAFile): <|fim_suffix|> def write_to_file(self, df, gzipResults=False, includeIndex=False, null='NA', indexCol=None, transpose=False): if not transpose: ...
code_fim
hard
{ "lang": "python", "repo": "srp33/ExpressionAble", "path": "/expressionable/files/picklefile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BendeguzToth/Fun-with-ConvNets path: /project/utils.py import numpy as np import pickle class VectorCrossEntropy: @staticmethod def error(result, label): return - label * np.log(result + 1e-7) @staticmethod def gradient(result, label): return - label / (result +...
code_fim
hard
{ "lang": "python", "repo": "BendeguzToth/Fun-with-ConvNets", "path": "/project/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.counter = 1 self.sum = 0 def __str__(self): return str(self.sum) def __repr__(self): return "[counter: {0}, sum: {1}]".format(self.counter - 1, self.sum) def add(self, x): """ Add a new data point. :param x: New data point to be ...
code_fim
hard
{ "lang": "python", "repo": "BendeguzToth/Fun-with-ConvNets", "path": "/project/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __repr__(self): return "[counter: {0}, sum: {1}]".format(self.counter - 1, self.sum) def add(self, x): """ Add a new data point. :param x: New data point to be added to the average. """ self.sum += (1 / self.counter) * (x - self.sum) sel...
code_fim
hard
{ "lang": "python", "repo": "BendeguzToth/Fun-with-ConvNets", "path": "/project/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> source_embedding, destination_embedding, _ = tgn.compute_temporal_embeddings(sources_batch, destinations_batch, destinations_batch, ...
code_fim
hard
{ "lang": "python", "repo": "twitter-research/tgn", "path": "/evaluation/evaluation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: twitter-research/tgn path: /evaluation/evaluation.py import math import numpy as np import torch from sklearn.metrics import average_precision_score, roc_auc_score def eval_edge_prediction(model, negative_edge_sampler, data, n_neighbors, batch_size=200): # Ensures the random sampler uses a s...
code_fim
hard
{ "lang": "python", "repo": "twitter-research/tgn", "path": "/evaluation/evaluation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> sources_batch = data.sources[s_idx: e_idx] destinations_batch = data.destinations[s_idx: e_idx] timestamps_batch = data.timestamps[s_idx:e_idx] edge_idxs_batch = edge_idxs[s_idx: e_idx] source_embedding, destination_embedding, _ = tgn.compute_temporal_embeddings(sources_batc...
code_fim
hard
{ "lang": "python", "repo": "twitter-research/tgn", "path": "/evaluation/evaluation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: weihengcumt/SOGNN path: /Net.py """ """ import math import torch import torch.nn.functional as F from torch_geometric.data import DataLoader from torch_geometric.nn import GCNConv, ChebConv, SAGEConv, GraphConv, DenseSAGEConv, dense_diff_pool, DenseGCNConv from torch_geometric.nn import TopKPo...
code_fim
hard
{ "lang": "python", "repo": "weihengcumt/SOGNN", "path": "/Net.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.conv3 = Conv2d(64, 128, (1,5)) self.drop3 = Dropout(drop_rate) self.pool3 = MaxPool2d((1,4)) self.sogc3 = SOGC(2*128, 64, 32, topk) self.drop4 = Dropout(drop_rate) self.linend = Linear(self.channels*32*3, 3) def forward(self, ...
code_fim
hard
{ "lang": "python", "repo": "weihengcumt/SOGNN", "path": "/Net.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dawidsielski/medical-data-share path: /data_share/DataShare.py import os import json import base64 from Crypto.Cipher import AES, PKCS1_OAEP from data_share.Pad import Pad from utils.user_validation.UserValidation import UserValidation from Crypto.Hash import SHA256 from Crypto.PublicKey import...
code_fim
hard
{ "lang": "python", "repo": "dawidsielski/medical-data-share", "path": "/data_share/DataShare.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return public_key.verify(h, signature) @staticmethod def validate_signature_using_user_id(message, signature=None): """ This function checks if incoming message is valid for this machine. :param message: (obj) json incoming message :param signature: ...
code_fim
hard
{ "lang": "python", "repo": "dawidsielski/medical-data-share", "path": "/data_share/DataShare.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hecg119/Penne path: /penne/quarantine/db_create.py import os import sqlite3 import traceback from json import load from termcolor import cprint from penne.lib.settings import HOME, WHITELISTED_HASHES penne_json = load(open("{}/penne.json".format(HOME), "r")) penne_db = "{}/{}".format(penne_jso...
code_fim
hard
{ "lang": "python", "repo": "hecg119/Penne", "path": "/penne/quarantine/db_create.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def insert_blob(blob_data, blob_name, where_found, original_name, encrypted, need_to_upload, nonce, key, tag, detected_as): if isinstance(blob_data, str) and isinstance(blob_name, str) and isinstance(where_found, str) and isinstance( original_name, str) and isinstance(encrypted, bool) and...
code_fim
hard
{ "lang": "python", "repo": "hecg119/Penne", "path": "/penne/quarantine/db_create.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> signature = django_filters.CharFilter( lookup_expr='icontains', help_text=Card._meta.get_field('signature').help_text, label=Card._meta.get_field('signature').verbose_name ) text_front = django_filters.CharFilter( lookup_expr='icontains', help_text=Card....
code_fim
medium
{ "lang": "python", "repo": "acdh-oeaw/official-depictions", "path": "/cards/filters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: acdh-oeaw/official-depictions path: /cards/filters.py import django_filters from dal import autocomplete from django import forms from django.contrib.auth.models import User from vocabs.models import SkosConcept from vocabs.filters import generous_concept_filter from entities.models import Inst...
code_fim
medium
{ "lang": "python", "repo": "acdh-oeaw/official-depictions", "path": "/cards/filters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># @TODO: Add unit tests for AsyncSession operations<|fim_prefix|># repo: TheLazzziest/fastapi-session path: /tests/test_sessions/test_async.py from fastapi_session import AsyncSession, FSBackend, RedisBackend <|fim_middle|>def test_create_fs_backend(fs_session: AsyncSession): assert isinstance(fs_s...
code_fim
hard
{ "lang": "python", "repo": "TheLazzziest/fastapi-session", "path": "/tests/test_sessions/test_async.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheLazzziest/fastapi-session path: /tests/test_sessions/test_async.py from fastapi_session import AsyncSession, FSBackend, RedisBackend def test_create_fs_backend(fs_session: AsyncSession): assert isinstance(fs_session._backend, FSBackend) <|fim_suffix|> assert isinstance(redis_session...
code_fim
medium
{ "lang": "python", "repo": "TheLazzziest/fastapi-session", "path": "/tests/test_sessions/test_async.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert isinstance(redis_session._backend, RedisBackend) # @TODO: Add unit tests for AsyncSession operations<|fim_prefix|># repo: TheLazzziest/fastapi-session path: /tests/test_sessions/test_async.py from fastapi_session import AsyncSession, FSBackend, RedisBackend def test_create_fs_backend(fs_se...
code_fim
medium
{ "lang": "python", "repo": "TheLazzziest/fastapi-session", "path": "/tests/test_sessions/test_async.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> step = FormStep(form=MockForm, title='step') data = {'string_field': "Here is whitespace "} expected_output = "Here is whitespace" with app.test_request_context(method='POST', data=data): form = step.create_form(request, prefilled_data={}) self.asser...
code_fim
medium
{ "lang": "python", "repo": "ramboldio/steuerlotse", "path": "/webapp/tests/forms/test_base_form.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ramboldio/steuerlotse path: /webapp/tests/forms/test_base_form.py import unittest from flask import request from app import app from app.forms import SteuerlotseBaseForm from app.forms.fields import SteuerlotseStringField from app.forms.steps.step import FormStep class MockForm(SteuerlotseBas...
code_fim
hard
{ "lang": "python", "repo": "ramboldio/steuerlotse", "path": "/webapp/tests/forms/test_base_form.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>neJupyterWidget from .data_analysis import DataAnalysis from .model_analysis import ModelAnalysis from .auto_modeler import AutoModeler<|fim_prefix|># repo: EricCacciavillani/eFlow path: /eflow/_hidden/parent_objects/__init__.py from .file_output import FileOutput from .data_pipeline_segment imp<|fim_mid...
code_fim
medium
{ "lang": "python", "repo": "EricCacciavillani/eFlow", "path": "/eflow/_hidden/parent_objects/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EricCacciavillani/eFlow path: /eflow/_hidden/parent_objects/__init__.py from .file_output import FileOutput from .data_pipeline_segment import DataPipelineSegment from .pipeline_jupyter_widget import Pipeli<|fim_suffix|>_analysis import ModelAnalysis from .auto_modeler import AutoModeler<|fim_mid...
code_fim
medium
{ "lang": "python", "repo": "EricCacciavillani/eFlow", "path": "/eflow/_hidden/parent_objects/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_tcp_header_big(self): if PYPY: return True header = TCP_HEADER_BIG( source_port = 8080, dest_port = 8080, seq_num = 0xbeefcafe, ack_num = 0xcafebeef, data_offset = 0xf, flag_ns = 1, ...
code_fim
hard
{ "lang": "python", "repo": "KronoSKoderS/CalPack", "path": "/tests/test_Common_IP.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KronoSKoderS/CalPack path: /tests/test_Common_IP.py import unittest import struct from calpack.common.ip import * from calpack.utils import PYPY class Test_UDP_HEADER(unittest.TestCase): def test_udp_header_native(self): """ This test verifies the proper structuring of the ...
code_fim
hard
{ "lang": "python", "repo": "KronoSKoderS/CalPack", "path": "/tests/test_Common_IP.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> expected_data = [ 8080, 8080, 0xbeefcafe, 0xcafebeef, int('11110001', 2), 0xff, 12, 0xffff ] expected_val = struct.pack('>HHIIBBHH', *expected_data) self.assertEqual(header.to_bytes(), expected_val) def test_tcp_header_little(self): if PYPY: ...
code_fim
hard
{ "lang": "python", "repo": "KronoSKoderS/CalPack", "path": "/tests/test_Common_IP.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#ax.legend( (rects1[0]), ('TDB', 'Non-incremental', 'Update 10') ) def autolabel(rects): # attach some text labels for rect in rects: height = rect.get_height() ax.text(rect.get_x()+rect.get_width()/2., height + .1, '%d'%int(height), ha='center', va='bottom') auto...
code_fim
hard
{ "lang": "python", "repo": "twmarshall/tdb", "path": "/charts/overhead.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: twmarshall/tdb path: /charts/overhead.py #!/usr/bin/env python # a bar plot with errorbars import matplotlib.pyplot as plt import numpy as np import string graph_dir = "charts/" N = 3 width = 0.4 # the width of the bars ind = np.arange(N) # the x locations for the groups fig, ax = plt.sub...
code_fim
medium
{ "lang": "python", "repo": "twmarshall/tdb", "path": "/charts/overhead.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def autolabel(rects): # attach some text labels for rect in rects: height = rect.get_height() ax.text(rect.get_x()+rect.get_width()/2., height + .1, '%d'%int(height), ha='center', va='bottom') autolabel(rects1) #autolabel(rects2) #plt.show() plt.savefig(graph_dir ...
code_fim
hard
{ "lang": "python", "repo": "twmarshall/tdb", "path": "/charts/overhead.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BogiHsu/Tacotron2-PyTorch path: /hparams.py from text import symbols class hparams: seed = 0 ################################ # Data Parameters # ################################ text_cleaners=['english_cleaners'] ################################ # Aud...
code_fim
hard
{ "lang": "python", "repo": "BogiHsu/Tacotron2-PyTorch", "path": "/hparams.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ################################ # Model Parameters # ################################ n_symbols = len(symbols) symbols_embedding_dim = 512 # Encoder parameters encoder_kernel_size = 5 encoder_n_convolutions = 3 encoder_embedding_dim = 512 # Decoder pa...
code_fim
hard
{ "lang": "python", "repo": "BogiHsu/Tacotron2-PyTorch", "path": "/hparams.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Location Layer parameters attention_location_n_filters = 32 attention_location_kernel_size = 31 # Mel-post processing network parameters postnet_embedding_dim = 512 postnet_kernel_size = 5 postnet_n_convolutions = 5<|fim_prefix|># repo: BogiHsu/Tacotron2-PyTorch path: /hpar...
code_fim
hard
{ "lang": "python", "repo": "BogiHsu/Tacotron2-PyTorch", "path": "/hparams.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def do(): a = int(raw_input()) b = int(raw_input()) print(a + b) print(a - b) print(a * b) do()<|fim_prefix|># repo: qeedquan/challenges path: /hacker_rank/python-arithmetic-operators.py #!/usr/bin/env python """ Read two integers from STDIN and print three lines where: <|fim_midd...
code_fim
medium
{ "lang": "python", "repo": "qeedquan/challenges", "path": "/hacker_rank/python-arithmetic-operators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: qeedquan/challenges path: /hacker_rank/python-arithmetic-operators.py #!/usr/bin/env python """ Read two integers from STDIN and print three lines where: <|fim_suffix|>def do(): a = int(raw_input()) b = int(raw_input()) print(a + b) print(a - b) print(a * b) do()<|fim_midd...
code_fim
medium
{ "lang": "python", "repo": "qeedquan/challenges", "path": "/hacker_rank/python-arithmetic-operators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> a = int(raw_input()) b = int(raw_input()) print(a + b) print(a - b) print(a * b) do()<|fim_prefix|># repo: qeedquan/challenges path: /hacker_rank/python-arithmetic-operators.py #!/usr/bin/env python """ Read two integers from STDIN and print three lines where: <|fim_middle|>The fi...
code_fim
medium
{ "lang": "python", "repo": "qeedquan/challenges", "path": "/hacker_rank/python-arithmetic-operators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: newby-jay/BVchunker path: /BVchunker/ND2Reader.py import os import sys import time # import google.cloud # from google.cloud import error_reporting, logging from numpy import * from numpy.random import rand from .BVchunker import VideoSplitter, combineTZ, splitBadFiles import apache_beam as beam...
code_fim
hard
{ "lang": "python", "repo": "newby-jay/BVchunker", "path": "/BVchunker/ND2Reader.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if nextBlockStart >= stopPosition: return 0 return iobase.RangeTracker.SPLIT_POINTS_UNKNOWN range_tracker.set_split_points_unclaimed_callback(split_points_unclaimed) ########### basePath, vidName = os.path.split(fileName) _, ext = os....
code_fim
hard
{ "lang": "python", "repo": "newby-jay/BVchunker", "path": "/BVchunker/ND2Reader.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> mdAtributesBytes, mdCalibrationBytes, mdTextBytes, size, Nrecords): ### TODO: probably XML or JSON decoder should work here? """Decode a very minimal set of metadata.""" mdkeysXY = { 'Nx': b'\x00W\x00i\x00d\x00t\x00h\x00\x00\x00', 'NxBytes': b'\x00W\...
code_fim
hard
{ "lang": "python", "repo": "newby-jay/BVchunker", "path": "/BVchunker/ND2Reader.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: magnuswenzer/file_organizer path: /gui/frame_add_tags.py import tkinter as tk from tkinter import ttk from tkinter import messagebox import gui.widgets as tkw class FrameAddTags(tk.Frame): def __init__(self, parent, controller=None, prop_frame={}, **kwargs): self...
code_fim
hard
{ "lang": "python", "repo": "magnuswenzer/file_organizer", "path": "/gui/frame_add_tags.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self._update_widgets() def _update_widgets(self): self._update_widgets_tag_type() self._update_widgets_tag_name() self._update_combobox_add_tag_name() self._clear_entries() def _clear_entries(self): self.stringvar_add_tag_type.set('') self.stringvar_add_tag_name.set('') def _update_w...
code_fim
hard
{ "lang": "python", "repo": "magnuswenzer/file_organizer", "path": "/gui/frame_add_tags.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arturhaddad/Tibialyzer path: /db/parsedungeon.py # Copyright 2016 Mark Raasveldt # # 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://www.apache.org/licenses/L...
code_fim
hard
{ "lang": "python", "repo": "arturhaddad/Tibialyzer", "path": "/db/parsedungeon.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> coordinates = None if 'location' in attributes: locstr = attributes['location'] index = 0; while True: match = re.search(mapperRegex, locstr[index:]) if match == None: break x = convert_x(match.groups()[0]) y ...
code_fim
hard
{ "lang": "python", "repo": "arturhaddad/Tibialyzer", "path": "/db/parsedungeon.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if permission_classes: for permission in [p() for p in permission_classes]: if not permission.has_permission( info.context.get("request"), info.context.get("view") ): raise PermissionDenied(detail=getattr(permissio...
code_fim
hard
{ "lang": "python", "repo": "hilmarhausmart/graphene-django", "path": "/graphene_django/rest_framework/relay/node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hilmarhausmart/graphene-django path: /graphene_django/rest_framework/relay/node.py import warnings from functools import partial from graphene.types.utils import get_type from graphene.relay import node as graphene_node from rest_framework.exceptions import PermissionDenied <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "hilmarhausmart/graphene-django", "path": "/graphene_django/rest_framework/relay/node.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def node_resolver(cls, only_type, permission_classes, root, info, id): if not permission_classes: if hasattr(info, "context") and info.context and info.context.get("view", None): permission_classes = info.context.get( "view" ...
code_fim
hard
{ "lang": "python", "repo": "hilmarhausmart/graphene-django", "path": "/graphene_django/rest_framework/relay/node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LianwMS/autorest.az path: /src/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/vendored_sdks/managednetwork/aio/operations_async/__init__.py # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corpor...
code_fim
hard
{ "lang": "python", "repo": "LianwMS/autorest.az", "path": "/src/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/vendored_sdks/managednetwork/aio/operations_async/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = [ 'ManagedNetworkOperations', 'ScopeAssignmentOperations', 'ManagedNetworkGroupOperations', 'ManagedNetworkPeeringPolicyOperations', 'OperationOperations', ]<|fim_prefix|># repo: LianwMS/autorest.az path: /src/test/scenarios/managed-network/output/src/managed-network/azext_m...
code_fim
hard
{ "lang": "python", "repo": "LianwMS/autorest.az", "path": "/src/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/vendored_sdks/managednetwork/aio/operations_async/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: noah-dev/pptx_pdf_script path: /env/Lib/site-packages/watcher/tests/test_FileSystemWatcher.py # See if we can use unittest2 first if we're on 3.1. # 3.2 has the same features so we can fall back there. try: import unittest2 as unittest except ImportError: import unittest try: import ...
code_fim
hard
{ "lang": "python", "repo": "noah-dev/pptx_pdf_script", "path": "/env/Lib/site-packages/watcher/tests/test_FileSystemWatcher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.fsw.NotifyFilter = FileSystemWatcher.NotifyFilters.LastWrite self.fsw.Changed += self._callback self.fsw.EnableRaisingEvents = True self.assertTrue(self.fsw.EnableRaisingEvents) # Won't pick up events for the add. self.add_files() for name in ...
code_fim
hard
{ "lang": "python", "repo": "noah-dev/pptx_pdf_script", "path": "/env/Lib/site-packages/watcher/tests/test_FileSystemWatcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: soerenbnoergaard/impulseresponder path: /impulseresponder.py import matplotlib matplotlib.use("TkAgg") import numpy as np import tkinter as tk import sounddevice as sd import matplotlib.pyplot as plt from scipy import signal from tkinter import filedialog from matplotlib.backends.backend_tkagg ...
code_fim
hard
{ "lang": "python", "repo": "soerenbnoergaard/impulseresponder", "path": "/impulseresponder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def measure(self, waveform_string): sd.default.device = "Scarlett 2i2 USB: Audio" sd.default.blocksize = 512 sd.default.samplerate = self.sample_rate_Hz sd.default.channels = 1 ...
code_fim
hard
{ "lang": "python", "repo": "soerenbnoergaard/impulseresponder", "path": "/impulseresponder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fr_input.pack(side=tk.LEFT) fr_output.pack(side=tk.LEFT) fr_plot.pack(side=tk.TOP, expand=True, fill=tk.BOTH) # INPUT tk.Label(fr_input, text="Sample rate [Hz]").grid(row=0, column=0) tk.OptionMenu(fr_input, self.var.sample_rate_Hz, "48000", "44100", comman...
code_fim
hard
{ "lang": "python", "repo": "soerenbnoergaard/impulseresponder", "path": "/impulseresponder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for line in difflib.unified_diff(text1, text2): print(line) if(fail_test==False): print("Passou em todos os casos de teste!!!") is_a_AC()<|fim_prefix|># repo: ednunes/competitive-programming path: /scripts/script.py import os, sys, filecmp, difflib impor...
code_fim
medium
{ "lang": "python", "repo": "ednunes/competitive-programming", "path": "/scripts/script.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ednunes/competitive-programming path: /scripts/script.py import os, sys, filecmp, difflib import difflib path = './test_cases/' # r=root, d=directories, f = files def get_test_cases_number(): files = [] for r, d, f in os.walk(path): for file in f: if 'in' in file: ...
code_fim
hard
{ "lang": "python", "repo": "ednunes/competitive-programming", "path": "/scripts/script.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ahmfrz/theprogrammersblog path: /handlers/user.py """Defines UserInfoHandler""" from models.user import UserEntity from handlers.base import BaseHandler class UserInfoHandler(BaseHandler): <|fim_suffix|> """This method adds about info for the logged in user Args: u...
code_fim
hard
{ "lang": "python", "repo": "ahmfrz/theprogrammersblog", "path": "/handlers/user.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.redirect('/') def about_user(self, *args): """This method gets the about page for a given user Args: args[0]: The username(unused, added for more readability of route) args[1]: The user id """ user_for_about = len(args) == 2 and Us...
code_fim
hard
{ "lang": "python", "repo": "ahmfrz/theprogrammersblog", "path": "/handlers/user.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DevWaweru/PaymentSolutions path: /payments/urls.py from django.conf.urls import url from . import views from django.conf.urls.static import static from django.conf import settings urlpatterns = [ url('^$', views.paypa<|fim_suffix|>EBUG: urlpatterns += static(settings.MEDIA_URL, document_...
code_fim
medium
{ "lang": "python", "repo": "DevWaweru/PaymentSolutions", "path": "/payments/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>EBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)<|fim_prefix|># repo: DevWaweru/PaymentSolutions path: /payments/urls.py from django.conf.urls import url from . import views from django.conf.urls.static imp<|fim_middle|>ort static from django.conf import settings ur...
code_fim
medium
{ "lang": "python", "repo": "DevWaweru/PaymentSolutions", "path": "/payments/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jpch89/picpython path: /pp_026_ThreadPoolExecutor4.py from concurrent.futures import ThreadPoolExecutor, as_completed import time, random <|fim_suffix|>""" 小结 标准库模块 concurrent.futures 还提供了两个函数: wait() 和 as_completed() as_completed(fs, timeout=None): 该函数用于将指定的 Future 实例对象序列转换为迭代器。 当序列中的任意一个 Futu...
code_fim
hard
{ "lang": "python", "repo": "jpch89/picpython", "path": "/pp_026_ThreadPoolExecutor4.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>as_completed(fs, timeout=None): 该函数用于将指定的 Future 实例对象序列转换为迭代器。 当序列中的任意一个 Future 实例对象已经完成或者已被取消时,都会被 yield。 这样通过遍历迭代器,就可以在任意一个 Future 实例对象已经完成或者已被取消时, 立即做一些处理,比如调用 result() 来得到执行结果。 参数 fs 用于指定 Future 实例对象序列。 参数 timeout 用于指定超时时间。如果不指定(默认为 None),则不会超时。 该函数的返回值是一个 Future 实例对象的迭代器。 """<|fim_prefix|># repo: j...
code_fim
hard
{ "lang": "python", "repo": "jpch89/picpython", "path": "/pp_026_ThreadPoolExecutor4.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: azogue/pvpcbill path: /pvpcbill/helpers.py # -*- coding: utf-8 -*- """ Electrical billing for small consumers in Spain using PVPC. Helper methods. * load_csv_consumo_cups := to read standard energy hourly consumption CSV files * get_pvpc_data := async method to retrieve PVPC data for a given con...
code_fim
hard
{ "lang": "python", "repo": "azogue/pvpcbill", "path": "/pvpcbill/helpers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # TODO check optional pvpc store async def get_pvpc_data( consumo: pd.Series, path_csv_pvpc_store: Optional[Union[Path, str]] = None ) -> pd.DataFrame: """ Download PVPC data for the given consumption series using `aiopvpc`. If a path for a PVPC local csv store is given, it'll try to use...
code_fim
hard
{ "lang": "python", "repo": "azogue/pvpcbill", "path": "/pvpcbill/helpers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: betty29/code-1 path: /recipes/Python/577539_Convert_PyQt_properties/recipe-577539.py def iterProperties(cls): """ Iterates through the names of all the properties on a PyQt class. """ meta = cls.staticMetaObject for i in range(meta.propertyCount()): yield meta.property...
code_fim
medium
{ "lang": "python", "repo": "betty29/code-1", "path": "/recipes/Python/577539_Convert_PyQt_properties/recipe-577539.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># use in Python 3 @useProperties class Widget(QtGui.QWidget): pass # or simply useProperties(QtGui.QWidget) # then w = QtGui.QWidget() w.font = QtGui.QFont('Droid Sans Mono')<|fim_prefix|># repo: betty29/code-1 path: /recipes/Python/577539_Convert_PyQt_properties/recipe-577539.py def iterProperties...
code_fim
hard
{ "lang": "python", "repo": "betty29/code-1", "path": "/recipes/Python/577539_Convert_PyQt_properties/recipe-577539.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.property(name) return get def setter(name): def set(self, value): return self.setProperty(name, value) return set for name in iterProperties(cls): setattr(cls, name, property(getter(name), setter(name))) return cls # use in P...
code_fim
medium
{ "lang": "python", "repo": "betty29/code-1", "path": "/recipes/Python/577539_Convert_PyQt_properties/recipe-577539.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Dummy loop just to iterate example cases for f in listdir("source_images"): filename="source_images/"+f img_to_check = cv2.imread(filename) # Change into grayscale for template comparison img_gray = cv2.cvtColor(img_to_check, cv2.COLOR_BGR2GRAY) colorcheck(green, (0,255,0), img_gray,...
code_fim
hard
{ "lang": "python", "repo": "tniswong/MtgManaRecognition", "path": "/highlight_mana.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tniswong/MtgManaRecognition path: /highlight_mana.py """ This code will read files from source_images folder. It will then identify and highligh MTG mana icons from those images and save highlighted images into result_images folder. created Apr 2017 by CheapskateProjects --------------------...
code_fim
hard
{ "lang": "python", "repo": "tniswong/MtgManaRecognition", "path": "/highlight_mana.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> results = cv2.matchTemplate(img_gray,color_template,cv2.TM_CCOEFF_NORMED) locations = np.where( results >= matchingThreshold) for pt in zip(*locations[::-1]): cv2.rectangle(img_to_check, pt, (pt[0] + w, pt[1] + h), draw_color, 2) # Dummy loop just to iterate example cases for f in lis...
code_fim
medium
{ "lang": "python", "repo": "tniswong/MtgManaRecognition", "path": "/highlight_mana.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }