text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> def __len__(self):
return int(np.floor(np.array(self.x).shape[0]) / self.batch)
def __getitem__(self, index):
path_x = self.x[index * self.batch:(index + 1) * self.batch]
path_y = self.y[index * (self.batch):(index + 1) * self.batch]
X = []
Y = pat... | code_fim | hard | {
"lang": "python",
"repo": "anikett12/Flipkart_Grid-Object_localization",
"path": "/Generator function.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anikett12/Flipkart_Grid-Object_localization path: /Generator function.py
'''
'''
#** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **
from keras.utils import Sequence
class Generator(Sequence):
def __init__(self, X, Y, batch):
... | code_fim | hard | {
"lang": "python",
"repo": "anikett12/Flipkart_Grid-Object_localization",
"path": "/Generator function.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __getitem__(self, index):
path_x = self.x[index * self.batch:(index + 1) * self.batch]
path_y = self.y[index * (self.batch):(index + 1) * self.batch]
X = []
Y = path_y
# print(path_y)
for x_path in path_x:
img = cv2.imread(x_pa... | code_fim | hard | {
"lang": "python",
"repo": "anikett12/Flipkart_Grid-Object_localization",
"path": "/Generator function.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kwendel/deeplearning path: /models/transformer.py
import tensorflow as tf
from utils.modules import get_token_embeddings, ff, positional_encoding, multihead_attention
import logging
logging.basicConfig(level=logging.INFO)
class Transformer:
def __init__(self, hp):
self.hp = hp
... | code_fim | hard | {
"lang": "python",
"repo": "kwendel/deeplearning",
"path": "/models/transformer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Vanilla attention
dec = multihead_attention(queries=dec,
keys=memory,
values=memory,
num_heads=self.hp.num_heads,
... | code_fim | hard | {
"lang": "python",
"repo": "kwendel/deeplearning",
"path": "/models/transformer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dec += positional_encoding(dec, self.hp.maxlen2)
dec = tf.layers.dropout(dec, self.hp.dropout_rate, training=training)
# Blocks
for i in range(self.hp.num_blocks):
with tf.variable_scope("num_blocks_{}".format(i), reuse=tf.AUTO_REUSE):
... | code_fim | hard | {
"lang": "python",
"repo": "kwendel/deeplearning",
"path": "/models/transformer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Main Function."""
print "Main"
cli = clihandler.CliHandler()
print cli.namespace
if __name__ == '__main__':
main()<|fim_prefix|># repo: bdastur/utils path: /pydashing/src/pydashing.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
PyDashing:
----------
Build HTML Dashboards.
... | code_fim | easy | {
"lang": "python",
"repo": "bdastur/utils",
"path": "/pydashing/src/pydashing.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bdastur/utils path: /pydashing/src/pydashing.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
PyDashing:
----------
Build HTML Dashboards.
<|fim_suffix|> """Main Function."""
print "Main"
cli = clihandler.CliHandler()
print cli.namespace
if __name__ == '__main__':
main(... | code_fim | easy | {
"lang": "python",
"repo": "bdastur/utils",
"path": "/pydashing/src/pydashing.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MONICA-Project/sfn path: /WP5/KU/Algorithms/crowd_density_local/C_CNN/src/data_loader.py
import numpy as np
import cv2
import os
import random
import pandas as pd
import sys
class ImageDataLoader():
def __init__(self, data_path, gt_path, shuffle=False, gt_downsample=False, pre_load=False, n... | code_fim | hard | {
"lang": "python",
"repo": "MONICA-Project/sfn",
"path": "/WP5/KU/Algorithms/crowd_density_local/C_CNN/src/data_loader.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def read_image_and_gt(self, fname):
img = cv2.imread(os.path.join(self.data_path, fname), 0)
img = img.astype(np.float32, copy=False)
ht = img.shape[0]
wd = img.shape[1]
ht_1 = (ht/4)*4
wd_1 = (wd/4)*4
img = cv2.resize(img, (int(wd_1), int(ht_1))... | code_fim | hard | {
"lang": "python",
"repo": "MONICA-Project/sfn",
"path": "/WP5/KU/Algorithms/crowd_density_local/C_CNN/src/data_loader.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
min_count = sys.maxint
max_count = 0
gt_count_array = np.zeros(self.num_samples)
i = 0
for fname in self.data_files:
den = pd.read_csv(os.path.join(self.gt_path,os.path.splitext(fname)[0] + '.csv'), sep=',', header=None)\
.as_mat... | code_fim | hard | {
"lang": "python",
"repo": "MONICA-Project/sfn",
"path": "/WP5/KU/Algorithms/crowd_density_local/C_CNN/src/data_loader.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> LayerOutput.register_activations(self.model, self.activation_names)
self.session = QuantizationSimModel.build_session(self.model, ['CPUExecutionProvider'])
self.sanitized_activation_names = [name[:-len('_updated')] if name.endswith('_updated') else name for name in self.activation... | code_fim | hard | {
"lang": "python",
"repo": "quic/aimet",
"path": "/TrainingExtensions/onnx/src/python/aimet_onnx/layer_output_utils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> quantized_activation_names = [name for name in self.activation_names if name.endswith('_updated')]
if quantized_activation_names:
self.activation_names = quantized_activation_names
LayerOutput.register_activations(self.model, self.activation_names)
self.sessio... | code_fim | hard | {
"lang": "python",
"repo": "quic/aimet",
"path": "/TrainingExtensions/onnx/src/python/aimet_onnx/layer_output_utils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quic/aimet path: /TrainingExtensions/onnx/src/python/aimet_onnx/layer_output_utils.py
# /usr/bin/env python3.8
# -*- mode: python -*-
# =============================================================================
# @@-COPYRIGHT-START-@@
#
# Copyright (c) 2023, Qualcomm Innovation Center, Inc. ... | code_fim | hard | {
"lang": "python",
"repo": "quic/aimet",
"path": "/TrainingExtensions/onnx/src/python/aimet_onnx/layer_output_utils.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> es = Elasticsearch(
hosts=[{'host': esendpoint, 'port': 443}],
http_auth=awsauth,
use_ssl=True,
verify_certs=True,
ca_certs=certifi.where(),
connection_class=RequestsHttpConnection
)
esinfo = es.info();
print(esin... | code_fim | hard | {
"lang": "python",
"repo": "namratatripathi97/auro-product",
"path": "/index.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> session = boto3.session.Session()
credentials = session.get_credentials().get_frozen_credentials()
awsauth = AWSRequestsAuth(
aws_access_key=credentials.access_key,
aws_secret_access_key=credentials.secret_key,
aws_token=credentials.token,
aws_ho... | code_fim | medium | {
"lang": "python",
"repo": "namratatripathi97/auro-product",
"path": "/index.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: namratatripathi97/auro-product path: /index.py
# Run get info from Elasticsearch from AWS Lambda.
from __future__ import print_function
import boto3
import certifi
import yaml
from aws_requests_auth.aws_auth import AWSRequestsAuth
from elasticsearch import Elasticsearch, RequestsHttpConnection
... | code_fim | medium | {
"lang": "python",
"repo": "namratatripathi97/auro-product",
"path": "/index.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> what = message.data.get("WhatKeyword")
where = message.data.get("WhereKeyword")
domoticz = Domoticz(
self.settings.get("hostname"),
self.settings.get("port"),
self.settings.get("protocol"),
self.settings.get("authentication"),
... | code_fim | hard | {
"lang": "python",
"repo": "treussart/domoticz_skill",
"path": "/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def handle_domoticz_infos_intent(self, message):
what = message.data.get("WhatKeyword")
where = message.data.get("WhereKeyword")
domoticz = Domoticz(
self.settings.get("hostname"),
self.settings.get("port"),
self.settings.get("protocol"),
... | code_fim | hard | {
"lang": "python",
"repo": "treussart/domoticz_skill",
"path": "/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: treussart/domoticz_skill path: /__init__.py
# Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eith... | code_fim | hard | {
"lang": "python",
"repo": "treussart/domoticz_skill",
"path": "/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('core', '0042_candidateassignmentgrouphistory_examinerassignmentgrouphistory'),
]
operations = [
migrations.AlterField(
model_name='assignment',
name='deadline_handling',
field=models.PositiveIntegerField(choices=[(0, 'Sof... | code_fim | medium | {
"lang": "python",
"repo": "devilry/devilry-django",
"path": "/devilry/apps/core/migrations/0043_auto_20180302_1139.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: devilry/devilry-django path: /devilry/apps/core/migrations/0043_auto_20180302_1139.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-03-02 10:39
import devilry.apps.core.models.assignment
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suff... | code_fim | medium | {
"lang": "python",
"repo": "devilry/devilry-django",
"path": "/devilry/apps/core/migrations/0043_auto_20180302_1139.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: allcaps/tvdordrecht.nl path: /tvdordrecht/training/urls.py
from django.conf.urls import patterns, url
from .views import (
SessionList,
SessionDetail,
DisciplineList,
LocationList,
)
urlpatterns = pa<|fim_suffix|>t.as_view(),
name='discipline_list',
),
url(
... | code_fim | medium | {
"lang": "python",
"repo": "allcaps/tvdordrecht.nl",
"path": "/tvdordrecht/training/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rl(
r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<pk>[A-Za-z0-9-_]+)/$',
SessionDetail.as_view(),
name='session',
),
)<|fim_prefix|># repo: allcaps/tvdordrecht.nl path: /tvdordrecht/training/urls.py
from django.conf.urls import patterns, url
from .views import (
... | code_fim | hard | {
"lang": "python",
"repo": "allcaps/tvdordrecht.nl",
"path": "/tvdordrecht/training/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, port, window):
threading.Thread.__init__(self)
self.port = port
self.window = window
self.seqdata = window.seqdata
self.setDaemon(True)
def run(self):
server = SocketServer.ThreadingTCPServer(('', self.port), TCPLogHandler)
... | code_fim | hard | {
"lang": "python",
"repo": "sunaga-lab/vizexec",
"path": "/lib/vizexec_server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sunaga-lab/vizexec path: /lib/vizexec_server.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import threading
import SocketServer
import StringIO
SocketServer.TCPServer.allow_reuse_address = True
class ReadThread(threading.Thread):
def __init__(self, fn, window):
threading.Thread.... | code_fim | hard | {
"lang": "python",
"repo": "sunaga-lab/vizexec",
"path": "/lib/vizexec_server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kmgowda/kmg-leetcode-python path: /design-linked-list/design-linked-list.py
// https://leetcode.com/problems/design-linked-list
class Node:
def __init__(self, val):
self.val = val
self.nxt = None
class MyLinkedList(object):
def __init__(self):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "kmgowda/kmg-leetcode-python",
"path": "/design-linked-list/design-linked-list.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def addAtHead(self, val):
"""
Add a node of value val before the first element of the linked list. After the insertion, the new node will be the first node of the linked list.
:type val: int
:rtype: void
"""
tmp = Node(val)
tmp.nxt = self.head
... | code_fim | hard | {
"lang": "python",
"repo": "kmgowda/kmg-leetcode-python",
"path": "/design-linked-list/design-linked-list.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ooojustin/mixcord path: /mixcord/bots/mixer.py
titor_mixcord_user["balance"]:
return "@{} no longer has sufficient funding to run this bet.".format(username)
# determine winner/loser
pick = random.randint(0, 1) == 1
winner_id = user.id if pick ... | code_fim | hard | {
"lang": "python",
"repo": "ooojustin/mixcord",
"path": "/mixcord/bots/mixer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ooojustin/mixcord path: /mixcord/bots/mixer.py
ging
log = logging.getLogger("mixer")
import random, json, asyncio, os, utils
from threading import Timer
from time import time
from __main__ import database
from __main__ import settings as settings_all
settings = settings_all["mixer"]
currency_n... | code_fim | hard | {
"lang": "python",
"repo": "ooojustin/mixcord",
"path": "/mixcord/bots/mixer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@chat.command()
async def modulus(message, number1: ParamType.NUMBER, number2: ParamType.NUMBER):
"""Products the remainder of the result of number1 divided by number2."""
try:
rem = number1 % number2
return "remainder = " + str(rem)
except:
return "failed to perform mo... | code_fim | hard | {
"lang": "python",
"repo": "ooojustin/mixcord",
"path": "/mixcord/bots/mixer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> between_distances = []
all_within_distances = dict()
for i, (label_1, distr_set_1) in enumerate(sp_distr_sets):
within_distances = []
print "Computing within distances for", label_1
for j, distr_1 in enumerate(distr_set_1[:-1]):
for distr_2 in distr_set_1[j+... | code_fim | hard | {
"lang": "python",
"repo": "xenoavenger/bug-free-funicular",
"path": "/plots.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xenoavenger/bug-free-funicular path: /plots.py
import random
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import networkx as nx
def plot_graphs(flname, graphs):
plt.clf()
G = nx.disjoint_union_all(graphs)
c = [random.random() for i in xrange(nx.number_of... | code_fim | hard | {
"lang": "python",
"repo": "xenoavenger/bug-free-funicular",
"path": "/plots.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rahul38888/coding_practice path: /src/practices/practice/anagrams/script.py
# https://practice.geeksforgeeks.org/problems/print-anagrams-together/1
def merge(word, s, m, e):
l = list(word)
i = s
j = m + 1
st = []
while i <= m and j <= e:
if l[i] < l[j]:
st... | code_fim | medium | {
"lang": "python",
"repo": "rahul38888/coding_practice",
"path": "/src/practices/practice/anagrams/script.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if s >= e:
return word
m = int((s + e) / 2)
word = sortString(word, s, m)
word = sortString(word, m + 1, e)
return merge(word, s, m, e)
def Anagrams(words, n):
sorted_words = [0] * n
for i in range(n):
sorted_words[i] = sortString(words[i], 0, len(words[i]) - ... | code_fim | medium | {
"lang": "python",
"repo": "rahul38888/coding_practice",
"path": "/src/practices/practice/anagrams/script.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andriykohut/blab path: /manage.py
#!/usr/bin/env python3
import argparse
from rethinkdb.errors import RqlRuntimeError
from blab import app
from blab import config
from blab import loop
def runserver(host, port):
if not app.r.db_list().contains(config.DB_NAME).run(app.conn):
print... | code_fim | medium | {
"lang": "python",
"repo": "andriykohut/blab",
"path": "/manage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
app.r.db_create(config.DB_NAME).run(app.conn)
print("Database '{}' created successfully".format(config.DB_NAME))
except RqlRuntimeError as e:
print(e.message)
def main():
parser = argparse.ArgumentParser()
subp = parser.add_subparsers(dest='cmd')
runserve... | code_fim | medium | {
"lang": "python",
"repo": "andriykohut/blab",
"path": "/manage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # logger.debug(
# msg_base,
# seed, numvoters, cnum, trial, ndim, stol, base)
# c = spatial.Candidates(v, seed=trial + cseed)
# c.add_random(cnum, sdev=1.5)
# e.set_models(voters=v, candidates=c)
# # Save parameters
# ... | code_fim | hard | {
"lang": "python",
"repo": "johnh865/election_sim",
"path": "/docs/multiwinner/benchmark.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: johnh865/election_sim path: /docs/multiwinner/benchmark.py
# -*- coding: utf-8 -*-
import logging
import pdb
import numpy as np
import votesim
import votesim.benchmarks.runtools as runtools
from votesim.models import spatial
from votesim import votemethods
from votesim.metrics import TacticCompar... | code_fim | hard | {
"lang": "python",
"repo": "johnh865/election_sim",
"path": "/docs/multiwinner/benchmark.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# cseed = seed * trialnum
# for trial in range(trialnum):
# logger.debug(
# msg_base,
# seed, numvoters, cnum, trial, ndim, stol, base)
# c = spatial.Candidates(v, seed=trial + ... | code_fim | hard | {
"lang": "python",
"repo": "johnh865/election_sim",
"path": "/docs/multiwinner/benchmark.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
return _fit_data(args)
except RuntimeError:
print('There was an issue running model {0}, skipping...'.format(args[0]))
return None#args[0]
#todo decide about multiple versions of model
def _fit_data(args):
"""
Helper function that allows parallel processing to occur.
:param args: All the ... | code_fim | hard | {
"lang": "python",
"repo": "srodney/sntd",
"path": "/sntd/fitting.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: srodney/sntd path: /sntd/fitting.py
_fitseries,[args])
else:
curves=_fitseries(args)
else:
if args['parlist']:
par_arg_vals=[]
for i in range(len(args['curves'])):
temp_args={}
for par_key in ['snType','bounds','constants','t0_guess','refModel','color_curve','seriesGrids']:... | code_fim | hard | {
"lang": "python",
"repo": "srodney/sntd",
"path": "/sntd/fitting.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
else:
if len(args['mods'])==1:
doFit=False
else:
doFit=True
args['doFit']=doFit
fits.append(_fit_data_wrap((mod,args)))
else:
args['doFit']=True
fits=pyParz.foreach(args['mods'],_fit_data,args)
if len(fits)>1:
bestChisq=np.inf
for f in fits:
if f:
... | code_fim | hard | {
"lang": "python",
"repo": "srodney/sntd",
"path": "/sntd/fitting.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: banillie/bcompiler path: /bcompiler/tests/test_file_parsing.py
import os
import tempfile
from datetime import date
from openpyxl import load_workbook
import bcompiler.compile as compile_module
from bcompiler.utils import runtime_config as config
from ..compile import parse_comparison_master
fro... | code_fim | hard | {
"lang": "python",
"repo": "banillie/bcompiler",
"path": "/bcompiler/tests/test_file_parsing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_compile_all_returns_to_master_with_date_comparison(datamap, previous_quarter_master, populated_template_comparison):
"""
This depends upon the fixture setting an earlier date in the previous_quarter_master.
:param datamap:
:param previous_quarter_master:
:return:
"""
s... | code_fim | hard | {
"lang": "python",
"repo": "banillie/bcompiler",
"path": "/bcompiler/tests/test_file_parsing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: D-Anir/algos path: /filling_jars.py
#!/bin/python3
import os
import sys
# Complete the solve function below.
def solve(n, operations):
S=0
for i in operations:
a=i[0]
b=i[1]
jars=(b-a)+1
S+=jars*i[2]
return((S//n))
if __name__ == '__main__':
... | code_fim | medium | {
"lang": "python",
"repo": "D-Anir/algos",
"path": "/filling_jars.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = []
for _ in range(m):
operations.append(list(map(int, input().rstrip().split())))
result = solve(n, operations)
fptr.write(str(result) + '\n')
fptr.close()<|fim_prefix|># repo: D-Anir/algos path: /filling_jars.py
#!/bin/python3
import os
import sys
# Complet... | code_fim | hard | {
"lang": "python",
"repo": "D-Anir/algos",
"path": "/filling_jars.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if full_suite and not failures and options.coverage:
# Assert that various files have full coverage
for path in enforce_fully_covered:
missing_lines = cov.analysis2(path)[3]
if len(missing_lines) > 0:
print(f"ERROR: {path} no longer has complete ... | code_fim | hard | {
"lang": "python",
"repo": "zulip/zulip",
"path": "/tools/test-backend",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zulip/zulip path: /tools/test-backend
y
"zerver/data_import/sequencer.py",
"zerver/data_import/slack.py",
"zerver/data_import/gitter.py",
"zerver/data_import/import_util.py",
# Webhook integrations with incomplete coverage
"zerver/webhooks/greenhouse/view.py",
"zerver/... | code_fim | hard | {
"lang": "python",
"repo": "zulip/zulip",
"path": "/tools/test-backend",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # to transform forward slashes '/' introduced by the zerver_test_dir into dots '.'
# taking care of any forward slashes that might be present
for i, suite in enumerate(args):
args[i] = suite.replace("/", ".")
full_suite = len(args) == 0
if full_suite:
... | code_fim | hard | {
"lang": "python",
"repo": "zulip/zulip",
"path": "/tools/test-backend",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(output)
if __name__=='__main__':
main()<|fim_prefix|># repo: tokuma09/algorithm_problems path: /problems/chapter12/mshibatatt/002.py
# https://atcoder.jp/contests/abc121/tasks/abc121_c
def main():
N, M = map(int, input().split())
stores = []
for _ in range(N):
stores.a... | code_fim | medium | {
"lang": "python",
"repo": "tokuma09/algorithm_problems",
"path": "/problems/chapter12/mshibatatt/002.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> stores.sort()
output = 0
counter = 0
i = 0
while counter < M:
output += stores[i][0] * min(stores[i][1], M - counter)
counter += stores[i][1]
i += 1
print(output)
if __name__=='__main__':
main()<|fim_prefix|># repo: tokuma09/algorithm_problems path: /... | code_fim | medium | {
"lang": "python",
"repo": "tokuma09/algorithm_problems",
"path": "/problems/chapter12/mshibatatt/002.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tokuma09/algorithm_problems path: /problems/chapter12/mshibatatt/002.py
# https://atcoder.jp/contests/abc121/tasks/abc121_c
def main():
<|fim_suffix|> stores.sort()
output = 0
counter = 0
i = 0
while counter < M:
output += stores[i][0] * min(stores[i][1], M - counter)
... | code_fim | medium | {
"lang": "python",
"repo": "tokuma09/algorithm_problems",
"path": "/problems/chapter12/mshibatatt/002.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
### Use this to test the Mqtt connection
pimqttclient = pimqttClient("pihome","atfgrotan9mr4-ats.iot.eu-central-1.amazonaws.com")
pimqttclient.mqttConfigureCertificates()
pimqttclient.mqttConfiguration()
pimqttclient.mqttConnect()
pimqttclient.mqttDisconnect()
pimqttclien... | code_fim | hard | {
"lang": "python",
"repo": "ericawesome/BCG_IOT_smart_travel_system",
"path": "/pimqtt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ericawesome/BCG_IOT_smart_travel_system path: /pimqtt.py
#!/usr/bin/python
import time
import os
import logging
import json
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
##python aws-iot-device-sdk-python/samples/basicPubSub/basicPubSub.py -e atfgrotan9mr4-ats.iot.eu-central-1.amazona... | code_fim | hard | {
"lang": "python",
"repo": "ericawesome/BCG_IOT_smart_travel_system",
"path": "/pimqtt.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def mqttunSubscribe(self, topic):
self.mqttClient.unsubscribe(topic)
def mqttPublish(self, topic , payload):
self.mqttClient.publish(topic, payload, 0)
def mqttDisconnect(self):
self.mqttClient.disconnect()
print("pimqttClient Disconnected successfully ")
if __name__ == "__main__":
### U... | code_fim | hard | {
"lang": "python",
"repo": "ericawesome/BCG_IOT_smart_travel_system",
"path": "/pimqtt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
io = StringIO(XMLUtil.data1)
_ignore_etree, root = readXML(io)
changeSubElementText(root, "help", "changed text")
self._checkXML(root, XMLUtil.data5)
def test_changeElement_new(self):
io = StringIO(XMLUtil.data1)
_ignore_etree, root = readXML(io)
... | code_fim | hard | {
"lang": "python",
"repo": "ass-a2s/ccs-calendarserver",
"path": "/twistedcaldav/test/test_xmlutil.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ass-a2s/ccs-calendarserver path: /twistedcaldav/test/test_xmlutil.py
##
# Copyright (c) 2005-2017 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the L... | code_fim | hard | {
"lang": "python",
"repo": "ass-a2s/ccs-calendarserver",
"path": "/twistedcaldav/test/test_xmlutil.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: albertosantagostino/systemd-servicehandler path: /servicehandler/servicehandler.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Helper class to ease access to systemd services (daemons)
"""
import logging
import os
import signal
import sys
import subprocess
import time
from enum import En... | code_fim | hard | {
"lang": "python",
"repo": "albertosantagostino/systemd-servicehandler",
"path": "/servicehandler/servicehandler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @expectation(target_state=ServiceState.STOPPED)
def stop(self):
"""Stop the service"""
self._systemctl_command('stop')
# target_state for kill() depends on the parameter restart in the unit file (FIXME)
@expectation(target_state=ServiceState.RUNNING)
def kill(self):
... | code_fim | hard | {
"lang": "python",
"repo": "albertosantagostino/systemd-servicehandler",
"path": "/servicehandler/servicehandler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __eq__(self, other):
return self.service_name == other.service_name
def _systemctl_command(self, command):
"""Run: systemctl --user {command} {unit_file}"""
subprocess.call(['systemctl', '--user', command, self.unit_file])
def state(self):
"""Get the curre... | code_fim | hard | {
"lang": "python",
"repo": "albertosantagostino/systemd-servicehandler",
"path": "/servicehandler/servicehandler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dpazel/music_rep path: /tests/transformation_tests/shift_tests/test_t_shift.py
import unittest
from harmonicmodel.chord_template import ChordTemplate
from structure.LineGrammar.core.line_grammar_executor import LineGrammarExecutor
from harmoniccontext.harmonic_context import HarmonicContext
from... | code_fim | hard | {
"lang": "python",
"repo": "dpazel/music_rep",
"path": "/tests/transformation_tests/shift_tests/test_t_shift.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> temporal_extent = Interval(Fraction(0), Fraction(3, 1))
score_line, score_hct = tshift.apply(temporal_extent)
TestTShift.print_notes(score_line)
TestTShift.print_hct(score_hct)
notes = score_line.get_all_notes()
assert 14 == len(notes)
assert 'G:4'... | code_fim | hard | {
"lang": "python",
"repo": "dpazel/music_rep",
"path": "/tests/transformation_tests/shift_tests/test_t_shift.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> next_number = next(self.counter)
return str(hex(next_number))[2:]<|fim_prefix|># repo: aboussouf/kata-train-reservation path: /train_reservation/booking_reference_service.py
import cherrypy
import itertools
<|fim_middle|>class BookingReferenceService:
def __init__(self, starting_poi... | code_fim | hard | {
"lang": "python",
"repo": "aboussouf/kata-train-reservation",
"path": "/train_reservation/booking_reference_service.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.counter = itertools.count(int(str(starting_point), 16) + 1)
@cherrypy.expose()
def booking_reference(self):
next_number = next(self.counter)
return str(hex(next_number))[2:]<|fim_prefix|># repo: aboussouf/kata-train-reservation path: /train_reservation/booking_refere... | code_fim | medium | {
"lang": "python",
"repo": "aboussouf/kata-train-reservation",
"path": "/train_reservation/booking_reference_service.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aboussouf/kata-train-reservation path: /train_reservation/booking_reference_service.py
import cherrypy
import itertools
class BookingReferenceService:
def __init__(self, starting_point):
<|fim_suffix|> next_number = next(self.counter)
return str(hex(next_number))[2:]<|fim_mid... | code_fim | medium | {
"lang": "python",
"repo": "aboussouf/kata-train-reservation",
"path": "/train_reservation/booking_reference_service.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XinyuHua/textgen-emnlp19 path: /src/eval_utils/rouge.py
# coding=utf-8
# Copyright 2019 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#... | code_fim | hard | {
"lang": "python",
"repo": "XinyuHua/textgen-emnlp19",
"path": "/src/eval_utils/rouge.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Valid rouge types that can be computed are:
rougen (e.g. rouge1, rouge2): n-gram based scoring.
rougeL: Longest common subsequence based scoring.
Args:
rouge_types: A list of rouge types to calculate.
use_stemmer: Bool indicating whether Porter stemmer should be used to
... | code_fim | hard | {
"lang": "python",
"repo": "XinyuHua/textgen-emnlp19",
"path": "/src/eval_utils/rouge.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Invokes the command
#
# nvs_partition_gen.py --input file.csv --output inputFile.bin --size 0x3000
#
invoke_args = INVOKE_ARGS_G + [inputFile, "--output", output, "--size", "0x3000"]
subprocess.check_call(invoke_args)
def FlashPartition(args):
print("Flashing to data parti... | code_fim | medium | {
"lang": "python",
"repo": "jmeckst/BnoMaster",
"path": "/partitions/bnoPartitionTool.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jmeckst/BnoMaster path: /partitions/bnoPartitionTool.py
# ------------------------------------------------------------------------------------------- #
# Imports section
import os
import sys
import subprocess
import argparse
GEN_PATH = os.path.join("nvs_flash", "nvs_partition_generator", "nvs_... | code_fim | hard | {
"lang": "python",
"repo": "jmeckst/BnoMaster",
"path": "/partitions/bnoPartitionTool.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# ------------------------------------------------------------------------------------------- #
# Main function
def main():
global INVOKE_ARGS_G
global INVOKE_ARGS_P
parser = argparse.ArgumentParser('BNO055 Partition Tool. Generates binary' \
' partition ... | code_fim | hard | {
"lang": "python",
"repo": "jmeckst/BnoMaster",
"path": "/partitions/bnoPartitionTool.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with raises(FunctionDeclarationException):
compiler.compile_code(bad_code)
@pytest.mark.parametrize('constant', list(BUILTIN_CONSTANTS)+list(ENVIRONMENT_VARIABLES))
def test_reserved_keywords_memory(constant, get_contract, assert_compile_failed):
code = f"""
@public
def test():
{cons... | code_fim | medium | {
"lang": "python",
"repo": "YellowBrainz/vyper",
"path": "/tests/parser/types/test_variable_naming.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.parametrize('constant', list(BUILTIN_CONSTANTS)+list(ENVIRONMENT_VARIABLES))
def test_reserved_keywords_fn_args(constant, get_contract, assert_compile_failed):
code = f"""
@public
def test({constant}: int128):
pass
"""
assert_compile_failed(lambda: get_contract(code), Functio... | code_fim | hard | {
"lang": "python",
"repo": "YellowBrainz/vyper",
"path": "/tests/parser/types/test_variable_naming.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YellowBrainz/vyper path: /tests/parser/types/test_variable_naming.py
import pytest
from pytest import (
raises,
)
from vyper import (
compiler,
)
from vyper.exceptions import (
FunctionDeclarationException,
VariableDeclarationException,
)
from vyper.parser.expr import (
BUILT... | code_fim | hard | {
"lang": "python",
"repo": "YellowBrainz/vyper",
"path": "/tests/parser/types/test_variable_naming.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def insert(self, key):
if self.find(key):
return
id_rst = self.hash_rst(key)
id_snd = self.hash_snd(key)
if self.hash_table1[id_rst] == -1:
self.hash_table1[id_rst] = key
elif self.hash_table2[id_snd] == -1:
... | code_fim | hard | {
"lang": "python",
"repo": "grayondream/algorithm-forth",
"path": "/src/search/cuckoo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: grayondream/algorithm-forth path: /src/search/cuckoo.py
import math
def is_prime(no):
if no <= 0:
return False
else:
i = 2
while i <= int(math.sqrt(no)):
if no % i == 0:
return False
return True
def get_prime(no)... | code_fim | hard | {
"lang": "python",
"repo": "grayondream/algorithm-forth",
"path": "/src/search/cuckoo.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(name, 'ok')
name = prefix + zdrav
field_f = 0
field_i = 1
field_o = 2
field_date = 3
field_sex = 4
field_phone = 7
field_email = 6
field_snils = 5
with open(name, 'r') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
for row in reader:
fio = (row[field_f] + ' '... | code_fim | hard | {
"lang": "python",
"repo": "anokata/pythonPetProjects",
"path": "/dump.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anokata/pythonPetProjects path: /dump.py
#!/usr/bin/python3
#TODO frequency analyze for delimeters
#TODO format of fields
import csv
# if not exist(dest_path):
# sudo mkdir /run/fio/
# sudo chown user:group /run/fio
data = dict()
intersect = 0
count = 0
prefix = '/run/fio/'
#prefix = '/home/ksi/D... | code_fim | hard | {
"lang": "python",
"repo": "anokata/pythonPetProjects",
"path": "/dump.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 10000 Step만큼 최적화를 수행합니다.
for i in range(10000):
batch = next_batch(128, x_train, y_train_one_hot.eval())
# 100 Step마다 training 데이터셋에 대한 정확도와 loss를 출력합니다.
if i % 100 == 0:
train_accuracy = accuracy.eval(feed_dict={x: batch[0], y: batch[1], keep_prob: 1.0})
loss_print = loss.e... | code_fim | hard | {
"lang": "python",
"repo": "HEUNG-BAE-LEE/computer_vision",
"path": "/deep_learning_image_recognition/6week/6week_assignment/cifar10_classification_using_cnn_with_tensorboard.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> h_conv5_flat = tf.reshape(h_conv5, [-1, 8*8*128])
h_fc1 = tf.nn.relu(tf.matmul(h_conv5_flat, W_fc1) + b_fc1)
# Dropout - 모델의 복잡도를 컨트롤합니다. 특징들의 co-adaptation을 방지합니다.
h_fc1_drop = tf.nn.dropout(h_fc1, keep_prob)
# Fully Connected Layer 2 - 384개의 특징들(feature)을 10개의 클래스-airplane, automobile, bird... | code_fim | hard | {
"lang": "python",
"repo": "HEUNG-BAE-LEE/computer_vision",
"path": "/deep_learning_image_recognition/6week/6week_assignment/cifar10_classification_using_cnn_with_tensorboard.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HEUNG-BAE-LEE/computer_vision path: /deep_learning_image_recognition/6week/6week_assignment/cifar10_classification_using_cnn_with_tensorboard.py
# -*- coding: utf-8 -*-
"""
CIFAR-10 Convolutional Neural Networks(CNN) 예제
next_batch function is copied from edo's answer
https://stackoverflow.com/... | code_fim | hard | {
"lang": "python",
"repo": "HEUNG-BAE-LEE/computer_vision",
"path": "/deep_learning_image_recognition/6week/6week_assignment/cifar10_classification_using_cnn_with_tensorboard.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lih627/python-algorithm-templates path: /LeetCodeSolutions/LeetCode_0159.py
class Solution:
def lengthOfLongestSubstringTwoDistinct(self, s: str) -> int:
ret, l, r = 0, 0, 0
cnt = dict()
hash_set = set()
while <|fim_suffix|> 1
cnt[s[l]] -= 1
... | code_fim | hard | {
"lang": "python",
"repo": "lih627/python-algorithm-templates",
"path": "/LeetCodeSolutions/LeetCode_0159.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 1
cnt[s[l]] -= 1
hash_set.remove(s[l])
l += 1
ret = max(ret, r - l + 1)
r += 1
return ret<|fim_prefix|># repo: lih627/python-algorithm-templates path: /LeetCodeSolutions/LeetCode_0159.py
class Solution:
def lengthOfLonge... | code_fim | hard | {
"lang": "python",
"repo": "lih627/python-algorithm-templates",
"path": "/LeetCodeSolutions/LeetCode_0159.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>[cs] += 1
hash_set.add(cs)
if len(hash_set) > 2:
while cnt[s[l]] != 1:
cnt[s[l]] -= 1
l += 1
cnt[s[l]] -= 1
hash_set.remove(s[l])
l += 1
ret = max(ret, r - l + 1)
... | code_fim | hard | {
"lang": "python",
"repo": "lih627/python-algorithm-templates",
"path": "/LeetCodeSolutions/LeetCode_0159.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: swag1ong/ray path: /python/ray/experimental/data/impl/block_list.py
from typing import Iterable, List
from ray.types import ObjectRef
from ray.experimental.data.block import Block, BlockMetadata
class BlockList(Iterable[ObjectRef[Block]]):
<|fim_suffix|> def get_metadata(self) -> List[Block... | code_fim | hard | {
"lang": "python",
"repo": "swag1ong/ray",
"path": "/python/ray/experimental/data/impl/block_list.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._metadata.copy()
def __len__(self):
return len(self._blocks)
def __iter__(self):
return iter(self._blocks)<|fim_prefix|># repo: swag1ong/ray path: /python/ray/experimental/data/impl/block_list.py
from typing import Iterable, List
from ray.types import Object... | code_fim | hard | {
"lang": "python",
"repo": "swag1ong/ray",
"path": "/python/ray/experimental/data/impl/block_list.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: magnusstubman/mal00 path: /features/exit.py
from features import addFeature
import sys
class ExitCommand:
command = 'exit'
def run(arguments, implant):
<|fim_suffix|>addFeature(ExitCommand)<|fim_middle|> sys.exit(0)
def help():
return 'exits the application'
| code_fim | medium | {
"lang": "python",
"repo": "magnusstubman/mal00",
"path": "/features/exit.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 'exits the application'
addFeature(ExitCommand)<|fim_prefix|># repo: magnusstubman/mal00 path: /features/exit.py
from features import addFeature
import sys
class ExitCommand:
command = 'exit'
<|fim_middle|> def run(arguments, implant):
sys.exit(0)
def help():
| code_fim | medium | {
"lang": "python",
"repo": "magnusstubman/mal00",
"path": "/features/exit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
addFeature(ExitCommand)<|fim_prefix|># repo: magnusstubman/mal00 path: /features/exit.py
from features import addFeature
import sys
class ExitCommand:
command = 'exit'
<|fim_middle|> def run(arguments, implant):
sys.exit(0)
def help():
return 'exits the application'
| code_fim | medium | {
"lang": "python",
"repo": "magnusstubman/mal00",
"path": "/features/exit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, n_qubits, coupling_map,
basis_gates=None,
name='AbstractBackend'):
"""
Args:
n_qubits (int): Number of qubits.
coupling_map (list): Coupling map.
basis_gates (list): Basis gates.
name (... | code_fim | medium | {
"lang": "python",
"repo": "nonhermitian/qiskit_addons",
"path": "/pauls_qiskit_addons/backends/abstract_backend.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nonhermitian/qiskit_addons path: /pauls_qiskit_addons/backends/abstract_backend.py
# -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "nonhermitian/qiskit_addons",
"path": "/pauls_qiskit_addons/backends/abstract_backend.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if a ** 2 + b ** 2 == c ** 2 else "wrong")<|fim_prefix|># repo: ucyang/AlgoEx path: /baekjoon/4153/right_triangle.py
while True:
a, b, c = sorted(map(int, input().split()))
if a == 0 and b == 0 <|fim_middle|>and c == 0:
break
print("right" | code_fim | easy | {
"lang": "python",
"repo": "ucyang/AlgoEx",
"path": "/baekjoon/4153/right_triangle.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ucyang/AlgoEx path: /baekjoon/4153/right_triangle.py
while True:
a, b, c = sorted(map(int, <|fim_suffix|>and c == 0:
break
print("right" if a ** 2 + b ** 2 == c ** 2 else "wrong")<|fim_middle|>input().split()))
if a == 0 and b == 0 | code_fim | easy | {
"lang": "python",
"repo": "ucyang/AlgoEx",
"path": "/baekjoon/4153/right_triangle.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isChange:
country = item["value"]
result.append({
'ORIGIN' : task['ORIGIN'],
'DATE' : task['DATE'],
'RV-ROUTE' : task['ROUTE'],
'RV-LENGTH' : task['LENGTH'],
... | code_fim | hard | {
"lang": "python",
"repo": "rimaulana/gsirs-routeviews-with-whois",
"path": "/worker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if item["key"] == "RegDate": # ARIN
if isChange:
dateCreated = item["value"]
if item["key"] == "created": # LACNIC, RIPE(different format than lacnic)
if isChange:
... | code_fim | hard | {
"lang": "python",
"repo": "rimaulana/gsirs-routeviews-with-whois",
"path": "/worker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rimaulana/gsirs-routeviews-with-whois path: /worker.py
import json
import urllib
import csv
import shutil
import os
import sys
rootFolder = os.path.abspath(os.path.dirname(__file__))
sourceFile = '{root}/{folder}/{filename}'.format(root=rootFolder,folder="worked",filename=sys.argv[1])
resultDest... | code_fim | hard | {
"lang": "python",
"repo": "rimaulana/gsirs-routeviews-with-whois",
"path": "/worker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Saving the bounded words from the page image in sorted way
i = 0
print("esraa before loop")
for line in lines:
print("Esraa fe el loop el kbeera")
text = crop.copy()
for (x1, y1, x2, y2) in line:
print("Esraa fe el loop el so3'ayara")
# roi = text[y1:y2, x1:x2]
save =... | code_fim | hard | {
"lang": "python",
"repo": "shazabahnacy/Graduation-project-ver1",
"path": "/word_segmentation-master/checkout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shazabahnacy/Graduation-project-ver1 path: /word_segmentation-master/checkout.py
"""
For Testing purposes
Take image from user, crop the background and transform perspective
from the perspective detect the word and return the array of word's
bounding boxes
"""
import cv2
from PIL imp... | code_fim | medium | {
"lang": "python",
"repo": "shazabahnacy/Graduation-project-ver1",
"path": "/word_segmentation-master/checkout.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run(self):
engine = self.engine.index_item
for item in Item.objects.all():
engine(item)<|fim_prefix|># repo: moyaya/python-stdnet path: /stdnet/apps/searchengine/tests/bench.py
__benchmark__ = True
from stdnet import test, orm
from stdnet.utils import zip
from ... | code_fim | medium | {
"lang": "python",
"repo": "moyaya/python-stdnet",
"path": "/stdnet/apps/searchengine/tests/bench.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: moyaya/python-stdnet path: /stdnet/apps/searchengine/tests/bench.py
__benchmark__ = True
from stdnet import test, orm
from stdnet.utils import zip
from . import regression
from .fuzzy import makeItems, Item, Word, WordItem, SearchEngine
<|fim_suffix|> makeItems(100,300)
... | code_fim | medium | {
"lang": "python",
"repo": "moyaya/python-stdnet",
"path": "/stdnet/apps/searchengine/tests/bench.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.