text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> @classmethod
def mutate_and_get_payload(cls, root, info, owner, labbook_name,
description_content, client_mutation_id=None):
username = get_logged_in_username()
lb = InventoryManager().load_labbook(username, owner, labbook_name,
... | code_fim | hard | {
"lang": "python",
"repo": "griffinmilsap/gigantum-client",
"path": "/packages/gtmapi/lmsrvlabbook/api/mutations/labbook.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Method to move/rename a file or directory. If file, both src_path and dst_path should contain the file name.
If a directory, be sure to include the trailing slash"""
class Input:
owner = graphene.String(required=True)
labbook_name = graphene.String(required=True)
sec... | code_fim | hard | {
"lang": "python",
"repo": "griffinmilsap/gigantum-client",
"path": "/packages/gtmapi/lmsrvlabbook/api/mutations/labbook.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: griffinmilsap/gigantum-client path: /packages/gtmapi/lmsrvlabbook/api/mutations/labbook.py
obs)
from gtmcore.inventory.inventory import InventoryManager
from gtmcore.logging import LMLogger
from gtmcore.files import FileOperations
from gtmcore.activity import ActivityStore, ActivityDetailRecord,... | code_fim | hard | {
"lang": "python",
"repo": "griffinmilsap/gigantum-client",
"path": "/packages/gtmapi/lmsrvlabbook/api/mutations/labbook.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def run(self):
while True:
data = self.resQ.get()
print('Got data!')
if not data:
break
mimi, peer_addr = data
self.process_result(mimi, peer_addr)
def process_result(self, mimi, peer_addr):
try:
peer_addr = peer_addr.replace(':','_').replace('.','_')
outfile = os... | code_fim | medium | {
"lang": "python",
"repo": "analyticsearch/pypykatz_server",
"path": "/pypykatz_server/resultprocess.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: analyticsearch/pypykatz_server path: /pypykatz_server/resultprocess.py
import os
import json
from multiprocessing import Queue, Process
from pypykatz.commons.common import UniversalEncoder
import traceback
class ResultProcessing(Process):
def __init__(self, resQ, output_dir):
Process.__init__... | code_fim | hard | {
"lang": "python",
"repo": "analyticsearch/pypykatz_server",
"path": "/pypykatz_server/resultprocess.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
peer_addr = peer_addr.replace(':','_').replace('.','_')
outfile = os.path.join(self.output_dir, '%s_%s.json' % (peer_addr,os.urandom(4).hex()))
with open(outfile, 'w') as f:
json.dump(mimi, f, cls = UniversalEncoder, indent=4, sort_keys=True)
kdir = os.path.join(self.output_dir... | code_fim | hard | {
"lang": "python",
"repo": "analyticsearch/pypykatz_server",
"path": "/pypykatz_server/resultprocess.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@_f
@_p.types(_cs.EGLSync,_cs.EGLDisplay,_cs.EGLenum,ctypes.POINTER(_cs.EGLAttrib))
def eglCreateSync(dpy,type,attrib_list):pass
@_f
@_p.types(_cs.EGLBoolean,_cs.EGLDisplay,_cs.EGLSync)
def eglDestroySync(dpy,sync):pass
@_f
@_p.types(_cs.EGLDisplay,_cs.EGLenum,ctypes.c_void_p,ctypes.POINTER(_cs.EGLAttrib)... | code_fim | medium | {
"lang": "python",
"repo": "alexus37/AugmentedRealityChess",
"path": "/pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGL/raw/EGL/VERSION/EGL_1_5.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: danielballan/intake path: /intake/gui/__init__.py
try:
import ipywidgets
from .widgets import DataBrowser
<|fim_suffix|> raise RuntimeError("Please install ipywidgets to use the Data "
"Browser")<|fim_middle|>except ImportError:
class DataBr... | code_fim | medium | {
"lang": "python",
"repo": "danielballan/intake",
"path": "/intake/gui/__init__.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> raise RuntimeError("Please install ipywidgets to use the Data "
"Browser")<|fim_prefix|># repo: danielballan/intake path: /intake/gui/__init__.py
try:
import ipywidgets
from .widgets import DataBrowser
<|fim_middle|>except ImportError:
class DataBr... | code_fim | medium | {
"lang": "python",
"repo": "danielballan/intake",
"path": "/intake/gui/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __repr__(self):
raise RuntimeError("Please install ipywidgets to use the Data "
"Browser")<|fim_prefix|># repo: danielballan/intake path: /intake/gui/__init__.py
try:
import ipywidgets
from .widgets import DataBrowser
<|fim_middle|>except Im... | code_fim | easy | {
"lang": "python",
"repo": "danielballan/intake",
"path": "/intake/gui/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if None is args:
Log.error('没有name参数')
return False
name = args.name.split("/", 1)
# name = ["it", "demo"]
if name[0] == "it":
it(name[1])
elif name[0] == "st":
st(name[1])
elif name[0] == "sm":
sm(name[1])
else:
Log.debug("没有相关类型... | code_fim | medium | {
"lang": "python",
"repo": "bbfpl/Lan",
"path": "/lan/commands/create.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bbfpl/Lan path: /lan/commands/create.py
from lan.log import Log
from lan.commands.it import it
from lan.commands.st import st
from lan.commands.sm import sm
<|fim_suffix|> if None is args:
Log.error('没有name参数')
return False
name = args.name.split("/", 1)
# name = ["it... | code_fim | medium | {
"lang": "python",
"repo": "bbfpl/Lan",
"path": "/lan/commands/create.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PixxxeL/mezaext path: /mezaext/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-24 16:36
from __future__ import unicode_literals
from django.db import migrations, models
<|fim_suffix|>
initial = True
dependencies = [
]
operations = [
... | code_fim | hard | {
"lang": "python",
"repo": "PixxxeL/mezaext",
"path": "/mezaext/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jskinn/robot-vision-experiment-framework path: /benchmarks/ate/tests/test_ate_result.py
# Copyright (c) 2017, John Skinner
import numpy as np
import unittest
import pickle
import util.dict_utils as du
import database.tests.test_entity as entity_test
import benchmarks.ate.ate_result as ate_res
c... | code_fim | hard | {
"lang": "python",
"repo": "jskinn/robot-vision-experiment-framework",
"path": "/benchmarks/ate/tests/test_ate_result.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_std_is_correct(self):
subject = self.make_instance()
trans_error = np.array(list(subject.translational_error.values()))
self.assertEqual(np.std(trans_error), subject.std)
def test_min_is_correct(self):
subject = self.make_instance()
min_ = None
... | code_fim | hard | {
"lang": "python",
"repo": "jskinn/robot-vision-experiment-framework",
"path": "/benchmarks/ate/tests/test_ate_result.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_median_is_correct(self):
subject = self.make_instance()
trans_error = np.array(list(subject.translational_error.values()))
self.assertEqual(np.median(trans_error), subject.median)
def test_std_is_correct(self):
subject = self.make_instance()
trans_... | code_fim | hard | {
"lang": "python",
"repo": "jskinn/robot-vision-experiment-framework",
"path": "/benchmarks/ate/tests/test_ate_result.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bozi6/hello-world path: /sms2xls/lofaszteszt.py
sor = 'kezd'
sorszam = 0
for i in range(50):
if sorsza<|fim_suffix|>ÉSI DIJ 0020953162 UPC; UPC MAGY'.split())
print(szov)<|fim_middle|>m % 25 == 0:
print(sor)
else:
print('nemkezd')
sorszam += 1
szov = " ".join('... | code_fim | medium | {
"lang": "python",
"repo": "bozi6/hello-world",
"path": "/sms2xls/lofaszteszt.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ÉSI DIJ 0020953162 UPC; UPC MAGY'.split())
print(szov)<|fim_prefix|># repo: bozi6/hello-world path: /sms2xls/lofaszteszt.py
sor = 'kezd'
sorszam = 0
for i in range(50):
if sorsza<|fim_middle|>m % 25 == 0:
print(sor)
else:
print('nemkezd')
sorszam += 1
szov = " ".join('... | code_fim | medium | {
"lang": "python",
"repo": "bozi6/hello-world",
"path": "/sms2xls/lofaszteszt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
# noinspection PyAttributeOutsideInit
self._d_datetime = datetime.datetime.strptime(str(value), self.canonic)
return True
except ValueError as e:
raise ValueError(f"Date attribute is not complying with the format defined", e)
def ca... | code_fim | hard | {
"lang": "python",
"repo": "raghu330/aviso",
"path": "/pyaviso/event_listeners/validation/date_handler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: raghu330/aviso path: /pyaviso/event_listeners/validation/date_handler.py
# (C) Copyright 1996- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not ... | code_fim | hard | {
"lang": "python",
"repo": "raghu330/aviso",
"path": "/pyaviso/event_listeners/validation/date_handler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_yields(self):
self.assertEqual("4 servings", self.harvester_class.yields())
def test_image(self):
self.assertEqual(
"https://media-cdn.greatbritishchefs.com/media/mwtkdmv3/img73858.jpg?mode=crop&width=768&height=512",
self.harvester_class.image(),
... | code_fim | hard | {
"lang": "python",
"repo": "hhursev/recipe-scrapers",
"path": "/tests/test_greatbritishchefs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hhursev/recipe-scrapers path: /tests/test_greatbritishchefs.py
from recipe_scrapers.greatbritishchefs import GreatBritishChefs
from tests import ScraperTest
class TestGreatBritishChefsScraper(ScraperTest):
scraper_class = GreatBritishChefs
def test_host(self):
self.assertEqual... | code_fim | hard | {
"lang": "python",
"repo": "hhursev/recipe-scrapers",
"path": "/tests/test_greatbritishchefs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(
"https://media-cdn.greatbritishchefs.com/media/mwtkdmv3/img73858.jpg?mode=crop&width=768&height=512",
self.harvester_class.image(),
)
def test_ingredients(self):
self.assertEqual(
[
"500g of beef mince",
... | code_fim | hard | {
"lang": "python",
"repo": "hhursev/recipe-scrapers",
"path": "/tests/test_greatbritishchefs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getMovieTime(self):
return self.movieReader.getMovieTime()
def getMovieDuration(self):
return self.movieReader.getMovieDuration()
def togglePause(self):
self.movieReader.togglePause()
def skipBack(self, secs):
self.movieReader.skipBack(secs)
def ... | code_fim | hard | {
"lang": "python",
"repo": "rpwagner/tiled-display",
"path": "/flTile/movieTileDisplayObject.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def rewind(self):
return self.movieReader.rewind()
def setLoopOnFinish(self, boolValue):
return self.movieReader.setLoopOnFinish(boolValue)
def getSize(self):
return self.size
def CreateDumbMovieObjectOnEachTile(filename, pos):
# for debugging
r = PyFfmpegMo... | code_fim | hard | {
"lang": "python",
"repo": "rpwagner/tiled-display",
"path": "/flTile/movieTileDisplayObject.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rpwagner/tiled-display path: /flTile/movieTileDisplayObject.py
import os
from glUtils import glTxtrBox, GetMaxTextureSize
from baseTileDisplayObject import BaseTileDisplayObject, NullTileDisplayObject
from groupObject import GroupObject
from flapp.pmath.rect import Rect
from flapp.pmath.vec2 impo... | code_fim | hard | {
"lang": "python",
"repo": "rpwagner/tiled-display",
"path": "/flTile/movieTileDisplayObject.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Adapted from motion3d:scripts/gen_pseudo_gt_tracks.py
Maps track_ids to smallest set of natural numbers
"""
tids = set(a['track_id'] for a in annotations)
tid2nat = {tid: i for i, tid in enumerate(sorted(tids))}
for a in annotations:
a['track_id'] = tid2nat[a['trac... | code_fim | medium | {
"lang": "python",
"repo": "jozhang97/CenterNet2",
"path": "/projects/CenterNet2/centernet/ct_utils/track_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if track_ids_to_update:
next_id = itertools.count(max_track_id + 1)
new_track_ids = defaultdict(lambda: next(next_id))
for ann in annotations:
t = ann['track_id']
v = ann['video_id']
if t in track_ids_to_update:
ann['track_id'... | code_fim | medium | {
"lang": "python",
"repo": "jozhang97/CenterNet2",
"path": "/projects/CenterNet2/centernet/ct_utils/track_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jozhang97/CenterNet2 path: /projects/CenterNet2/centernet/ct_utils/track_utils.py
from collections import defaultdict
import itertools
def _make_track_ids_unique(annotations):
"""
Makes the track IDs unqiue over the whole annotation set. Adapted from https://github.com/TAO-Dataset/
:... | code_fim | medium | {
"lang": "python",
"repo": "jozhang97/CenterNet2",
"path": "/projects/CenterNet2/centernet/ct_utils/track_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rosidotidev/nimbella_todolist_api path: /packages/api/item-update.py
import nimbella
import json
def main(args):
appkey='tdlst'
db = nimbella.redis()
print('log A')
item=args.get("content","")
if item=='':
return {"body":{"response":{"result":"error","description":"item... | code_fim | hard | {
"lang": "python",
"repo": "rosidotidev/nimbella_todolist_api",
"path": "/packages/api/item-update.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> value = json.dumps({
"item": item,
"user-code": usercode,
"code": code})
print('before save')
rsuccess=db.set(key, value)
print('after save')
return {"body":{"response":{"result":"ok","code":code}}}
def search_item(key):
db = nimbella.redis()
value = db.get(key)
... | code_fim | hard | {
"lang": "python",
"repo": "rosidotidev/nimbella_todolist_api",
"path": "/packages/api/item-update.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> rsuccess=db.set(key, value)
print('after save')
return {"body":{"response":{"result":"ok","code":code}}}
def search_item(key):
db = nimbella.redis()
value = db.get(key)
return value<|fim_prefix|># repo: rosidotidev/nimbella_todolist_api path: /packages/api/item-update.py
import nim... | code_fim | hard | {
"lang": "python",
"repo": "rosidotidev/nimbella_todolist_api",
"path": "/packages/api/item-update.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :return: The colour encoded text
:rtype: string
"""
if colour=="red":
return ("\033[31m" + text + "\033[0m")
if colour=="green":
return ("\033[32m" + text + "\033[0m")
if colour=="yellow":
return ("\033[33m" + text + "\033[0m")
if colour=="blue":
... | code_fim | hard | {
"lang": "python",
"repo": "john-hawkins/textplainer",
"path": "/textplainer/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: john-hawkins/textplainer path: /textplainer/utils.py
# -*- coding: utf-8 -*-
import sys
import os
"""
textplainer.utils: Support functions for the textplainer package.
"""
def eprint(*args, **kwargs):
<|fim_suffix|>def get_coloured_text_string(text, colour):
"""
Wrap a string with s... | code_fim | medium | {
"lang": "python",
"repo": "john-hawkins/textplainer",
"path": "/textplainer/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ribuild/delphin_6_automation path: /pytest/test_sampling_worker.py
__author__ = "Christian Kongsgaard"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules
import pytest
# RiBuild Module... | code_fim | hard | {
"lang": "python",
"repo": "ribuild/delphin_6_automation",
"path": "/pytest/test_sampling_worker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> strategy_doc = sample_entry.Strategy.objects().first()
strategy_doc.update(current_iteration=iteration)
strategy_doc.reload()
if iteration == 2:
assert not sampling_worker.is_sampling_ahead(strategy_doc)
else:
assert sampling_worker.is_sampling_ahead(strategy_doc)<|fim... | code_fim | hard | {
"lang": "python",
"repo": "ribuild/delphin_6_automation",
"path": "/pytest/test_sampling_worker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Failed to convert HTML to XML.", file=sys.stderr)
print(e, file=sys.stderr)
outputs = []
r, c = e.position # エラー行と列の取得。行は1から始まる。
lines = txt.split("\n") # 行のリストにする。
errorline = lines[r-1] # エラー行を取得。
lastcolumn = len(errorline) - 1 # エラー行の最終列を取得。
startc, endc = (c-2, c+3) if c>3 else (0... | code_fim | hard | {
"lang": "python",
"repo": "p--q/InlineStyleConverter",
"path": "/InlineStyleConverter/src/html2elem.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: p--q/InlineStyleConverter path: /InlineStyleConverter/src/html2elem.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re, html, sys
from random import randrange
from xml.etree import ElementTree
def html2elem(s):
regex = re.compile(r"(?is)<(?:(?:((script|style).*?)>(.+?)<\/\2)|(\w+).*?|(!DOCT... | code_fim | hard | {
"lang": "python",
"repo": "p--q/InlineStyleConverter",
"path": "/InlineStyleConverter/src/html2elem.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: plewis/phycas path: /src/python/commands/SumT.py
from phycas import randomtree
from phycas.utilities.PhycasCommand import *
from phycas.commands.SumTImpl import TreeSummarizer
import copy
class SumT(PhycasCommand):
def __init__(self):
args = ( ("outgroup_taxon", None, ... | code_fim | hard | {
"lang": "python",
"repo": "plewis/phycas",
"path": "/src/python/commands/SumT.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> PhycasCommand.__init__(self, args, "sumt", "The sumt command is used to summarize a collection of trees (usually trees that have been produced by an MCMC simulation).", o)
# create a variable that will be used to store information about splits
# that can be processed by the user a... | code_fim | hard | {
"lang": "python",
"repo": "plewis/phycas",
"path": "/src/python/commands/SumT.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Overrides the PhycasCommand.hidden method to keep SumT's name from being displayed
in the list of classes displayed when users type help. Delete this function, or
change its return value to False, when it is ready to be advertised.
"""
return False
... | code_fim | hard | {
"lang": "python",
"repo": "plewis/phycas",
"path": "/src/python/commands/SumT.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def send(self, result):
"""Creates an incident in pager duty.
Performs exponential backoff and retry in the case of 403 or 5xx
responses.
"""
logger.debug("Checking if we should send {}".format(result))
if result.is_failure() and self.will_publish(res... | code_fim | hard | {
"lang": "python",
"repo": "PearsonEducation/Alarmageddon",
"path": "/alarmageddon/publishing/pagerduty.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PearsonEducation/Alarmageddon path: /alarmageddon/publishing/pagerduty.py
"""Support for publishing to PagerDuty."""
from alarmageddon.publishing.publisher import Publisher
from alarmageddon.publishing.exceptions import PublishFailure
import requests
import json
import time
import hashlib
impor... | code_fim | hard | {
"lang": "python",
"repo": "PearsonEducation/Alarmageddon",
"path": "/alarmageddon/publishing/pagerduty.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Performs exponential backoff and retry in the case of 403 or 5xx
responses.
"""
logger.debug("Checking if we should send {}".format(result))
if result.is_failure() and self.will_publish(result):
message = self._construct_message(result)
hea... | code_fim | hard | {
"lang": "python",
"repo": "PearsonEducation/Alarmageddon",
"path": "/alarmageddon/publishing/pagerduty.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SySeVR/SySeVR path: /SySeVR_docker/docker_build/home/SySeVR/softdir/py2neo-py2neo-2.0/py2neo/batch/core.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2011-2014, Nigel Small
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... | code_fim | hard | {
"lang": "python",
"repo": "SySeVR/SySeVR",
"path": "/SySeVR_docker/docker_build/home/SySeVR/softdir/py2neo-py2neo-2.0/py2neo/batch/core.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Execute a collection of jobs and yield results as received.
:arg batch: A :class:`.Batch` of jobs.
:rtype: generator
"""
response = self.post(batch)
try:
for i, result_data in grouped(response):
result = JobResult.hydrate(as... | code_fim | hard | {
"lang": "python",
"repo": "SySeVR/SySeVR",
"path": "/SySeVR_docker/docker_build/home/SySeVR/softdir/py2neo-py2neo-2.0/py2neo/batch/core.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __hash__(self):
return hash(id(self))
def __iter__(self):
yield "method", self.method
yield "to", self.target.uri_string
if self.body is not None:
yield "body", self.body
class JobResult(object):
""" The result returned from the server for a s... | code_fim | hard | {
"lang": "python",
"repo": "SySeVR/SySeVR",
"path": "/SySeVR_docker/docker_build/home/SySeVR/softdir/py2neo-py2neo-2.0/py2neo/batch/core.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhuyin521/LightNLP path: /lightnlp/nn/models/atc/_albert_model.py
import torch
import torch.nn as nn
from ...layers import AlbertLayer, LinearLayer
class AlbertClassificationModel(nn.Module):
def __init__(self,
label_num,
hidden_dim,
finet... | code_fim | hard | {
"lang": "python",
"repo": "zhuyin521/LightNLP",
"path": "/lightnlp/nn/models/atc/_albert_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x2 = self.linear1(x1)
x2 = self.dropout(x2)
x3 = self.linear2(x2)
x3 = self.softmax(x3)
outputs = (x3,)
if labels is not None:
loss = self.loss(x3, labels)
outputs = outputs + (loss,)
else:
outputs = outputs + (... | code_fim | hard | {
"lang": "python",
"repo": "zhuyin521/LightNLP",
"path": "/lightnlp/nn/models/atc/_albert_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> email = EmailField(label=_("Email address"), required=False)<|fim_prefix|># repo: hemebond/quaddicted path: /quaddicted/comments/forms.py
from django.forms import Form, ModelForm, EmailField
from django_comments.forms import CommentForm, COMMENT_MAX_LENGTH, DEFAULT_COMMENTS_TIMEOUT
from django.utils.tra... | code_fim | easy | {
"lang": "python",
"repo": "hemebond/quaddicted",
"path": "/quaddicted/comments/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hemebond/quaddicted path: /quaddicted/comments/forms.py
from django.forms import Form, ModelForm, EmailField
from django_comments.forms import CommentForm, COMMENT_MAX_LENGTH, DEFAULT_COMMENTS_TIMEOUT
from django.utils.translation import gettext_lazy as _
<|fim_suffix|> email = EmailField(label... | code_fim | easy | {
"lang": "python",
"repo": "hemebond/quaddicted",
"path": "/quaddicted/comments/forms.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FengYongQ/spock path: /srcPython/cygnss_comp_sp_antenna.py
# This script compares the specular point position and selection algorithm between two runs by SpOCK.
# It was build to compare the SP outputs using a merged antenna gain pattern file and the SP outputs using two antenna gain pattern file... | code_fim | hard | {
"lang": "python",
"repo": "FengYongQ/spock",
"path": "/srcPython/cygnss_comp_sp_antenna.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Read second SpOCK main input file
var_in, var_in_order = read_input_file(filename2)
dt_spock_output = var_in[find_in_read_input_order_variables(var_in_order, \
'dt_output')];
output_file_path_list = var_in[find_in_read_input_order_variables(... | code_fim | hard | {
"lang": "python",
"repo": "FengYongQ/spock",
"path": "/srcPython/cygnss_comp_sp_antenna.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Read second SpOCK main input file
var_in, var_in_order = read_input_file(filename2)
dt_spock_output = var_in[find_in_read_input_order_variables(var_in_order, \
'dt_output')];
output_file_path_list = var_in[find_in_read_input_order_variables(va... | code_fim | hard | {
"lang": "python",
"repo": "FengYongQ/spock",
"path": "/srcPython/cygnss_comp_sp_antenna.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matiascodesal/Qt.py-stubs path: /Qt/QtGui.pyi
ype:PySide2.QtGui.QOpenGLTexture.PixelType, data:int, options:typing.Optional[PySide2.QtGui.QOpenGLPixelTransferOptions]=...): ...
@typing.overload
def setData(self, xOffset:int, yOffset:int, zOffset:int, width:int, height:int, depth:int, mipL... | code_fim | hard | {
"lang": "python",
"repo": "matiascodesal/Qt.py-stubs",
"path": "/Qt/QtGui.pyi",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matiascodesal/Qt.py-stubs path: /Qt/QtGui.pyi
e2.QtCore.Qt.TransformationMode=...) -> PySide2.QtGui.QPixmap: ...
@typing.overload
def scaled(self, w:int, h:int, aspectMode:PySide2.QtCore.Qt.AspectRatioMode=..., mode:PySide2.QtCore.Qt.TransformationMode=...) -> PySide2.QtGui.QPixmap: ...
... | code_fim | hard | {
"lang": "python",
"repo": "matiascodesal/Qt.py-stubs",
"path": "/Qt/QtGui.pyi",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @typing.overload
def drawEllipse(self, r:PySide2.QtCore.QRectF): ...
def drawImage(self, r:PySide2.QtCore.QRectF, pm:PySide2.QtGui.QImage, sr:PySide2.QtCore.QRectF, flags:PySide2.QtCore.Qt.ImageConversionFlags=...): ...
@typing.overload
def drawLines(self, lines:PySide2.QtCore.QLine, l... | code_fim | hard | {
"lang": "python",
"repo": "matiascodesal/Qt.py-stubs",
"path": "/Qt/QtGui.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def initialize_chart(self):
return NotImplemented
@classmethod
def sanitize_dataframe(self, df):
from lux.utils.date_utils import is_timedelta64_series, timedelta64_to_float_seconds
for attr in df.columns:
# Check if dtype is unrecognized by Altair (#247)
... | code_fim | hard | {
"lang": "python",
"repo": "lux-org/lux",
"path": "/lux/vislib/altair/AltairChart.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, vis):
self.vis = vis
self.data = vis.data
self.tooltip = True
# ----- START self.code modification -----
self.code = ""
self.width = 160
self.height = 150
self.chart = self.initialize_chart()
# self.add_tooltip(... | code_fim | hard | {
"lang": "python",
"repo": "lux-org/lux",
"path": "/lux/vislib/altair/AltairChart.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lux-org/lux path: /lux/vislib/altair/AltairChart.py
# Copyright 2019-2020 The Lux 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
#
# http://www.apach... | code_fim | hard | {
"lang": "python",
"repo": "lux-org/lux",
"path": "/lux/vislib/altair/AltairChart.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for options in SOLVERS:
options['dst'] = base_dir+'%s_solver.prototxt' % options['name']
render_solver(template, **options)
if __name__ == "__main__":
main()<|fim_prefix|># repo: Sitin/neuromatriarchy path: /render_solvers.py
#!/usr/bin/env python
from jinja2 import Template
... | code_fim | hard | {
"lang": "python",
"repo": "Sitin/neuromatriarchy",
"path": "/render_solvers.py",
"mode": "spm",
"license": "Artistic-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sitin/neuromatriarchy path: /render_solvers.py
#!/usr/bin/env python
from jinja2 import Template
from settings import SOLVERS, RIA_MODEL_DIR
<|fim_suffix|>
def main():
base_dir = RIA_MODEL_DIR
template = Template(open(base_dir + 'solver.prototxt.template', 'r').read())
for options... | code_fim | hard | {
"lang": "python",
"repo": "Sitin/neuromatriarchy",
"path": "/render_solvers.py",
"mode": "psm",
"license": "Artistic-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> repo = memrepo.MemRepo(room_dicts)
repo_rooms = repo.list(filters={"price__lt": 60})
assert len(repo_rooms) == 2
assert set([r.code for r in repo_rooms]) == {
"f853578c-fc0f-4e65-81b8-566c5dffa35a",
"eed76e77-55c1-41ce-985d-ca49bf6c0585",
}
def test_repository_list_... | code_fim | hard | {
"lang": "python",
"repo": "ftnext/rentomatic",
"path": "/tests/repository/test_memrepo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert len(repo_rooms) == 2
assert set([r.code for r in repo_rooms]) == {
"fe2c3195-aeff-487a-a08f-e0bdc0ec6e9a",
"913694c6-435a-4366-ba0d-da5334a611b2",
}
def test_repository_list_with_price_between_filter(room_dicts):
repo = memrepo.MemRepo(room_dicts)
repo_rooms =... | code_fim | hard | {
"lang": "python",
"repo": "ftnext/rentomatic",
"path": "/tests/repository/test_memrepo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ftnext/rentomatic path: /tests/repository/test_memrepo.py
import pytest
from rentomatic.domain import room as r
from rentomatic.repository import memrepo
@pytest.fixture
def room_dicts():
return [
{
"code": "f853578c-fc0f-4e65-81b8-566c5dffa35a",
"size": 215... | code_fim | hard | {
"lang": "python",
"repo": "ftnext/rentomatic",
"path": "/tests/repository/test_memrepo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def add_module_handler(logger):
logger.addHandler(stream_handler)
def stream_handler(destination=sys.stdout):
handler = logging.StreamHandler(destination)
return handler<|fim_prefix|># repo: yujiho1910/esdemo path: /py/real_python/__init__.py
# __init__.py
import logging
import sys
<|fim_... | code_fim | medium | {
"lang": "python",
"repo": "yujiho1910/esdemo",
"path": "/py/real_python/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yujiho1910/esdemo path: /py/real_python/__init__.py
# __init__.py
import logging
import sys
<|fim_suffix|> logger.addHandler(stream_handler)
def stream_handler(destination=sys.stdout):
handler = logging.StreamHandler(destination)
return handler<|fim_middle|>logger = logging.getLogge... | code_fim | medium | {
"lang": "python",
"repo": "yujiho1910/esdemo",
"path": "/py/real_python/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> handler = logging.StreamHandler(destination)
return handler<|fim_prefix|># repo: yujiho1910/esdemo path: /py/real_python/__init__.py
# __init__.py
import logging
import sys
<|fim_middle|>logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
def add_module_handler(logger):
log... | code_fim | medium | {
"lang": "python",
"repo": "yujiho1910/esdemo",
"path": "/py/real_python/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asifpy/django-crudbuilder path: /crudbuilder/helpers.py
import re
import string
import imp
try:
# Django versions >= 1.9
from django.utils.module_loading import import_module
except ImportError:
# Django versions < 1.9
from django.utils.importlib import import_module
__all__ =... | code_fim | hard | {
"lang": "python",
"repo": "asifpy/django-crudbuilder",
"path": "/crudbuilder/helpers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
imp.find_module('crud', app_path)
except ImportError:
return None
module = import_module("%s.crud" % app)
return module
def auto_discover():
'''
Auto register all apps that have module crud
'''
from django.conf import settings
for app in settin... | code_fim | hard | {
"lang": "python",
"repo": "asifpy/django-crudbuilder",
"path": "/crudbuilder/helpers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arashmjr/ClubHouseFollowers path: /web/dtos/BaseResponse.py
from web.utils.Localization import MessageIds, localize
class BaseResponse:
data: dict
success: bool
message_code: int
message: str
<|fim_suffix|> def serialize(self):
return {
'data': self.data,... | code_fim | hard | {
"lang": "python",
"repo": "arashmjr/ClubHouseFollowers",
"path": "/web/dtos/BaseResponse.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def serialize(self):
return {
"error": {
'code': self.message_code,
'message': self.message,
}
}<|fim_prefix|># repo: arashmjr/ClubHouseFollowers path: /web/dtos/BaseResponse.py
from web.utils.Localization import MessageIds, loca... | code_fim | hard | {
"lang": "python",
"repo": "arashmjr/ClubHouseFollowers",
"path": "/web/dtos/BaseResponse.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with ProcessPoolExecutor(4) as executor:
for i in range(N_ITERS):
print('Submitting', i)
agent = new_agent()
samples = sampler.sample(initial_values=np.zeros(N_BANDITS))
results.append(executor.submit(utils.run_single, agent, samples))
prin... | code_fim | hard | {
"lang": "python",
"repo": "brynhayder/reinforcement_learning_an_introduction",
"path": "/code/exercises/ex_2_5/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brynhayder/reinforcement_learning_an_introduction path: /code/exercises/ex_2_5/run.py
#!/usr/bin/env python
"""
--------------------------------
project: code
created: 10/04/2018 17:39
---------------------------------
"""
import os
import numpy as np
import pandas as pd
import constants as c
... | code_fim | hard | {
"lang": "python",
"repo": "brynhayder/reinforcement_learning_an_introduction",
"path": "/code/exercises/ex_2_5/run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bitdaocao/MASR path: /infer_path.py
import argparse
import functools
import time
import torch
import torch.nn.functional as F
from ctcdecode import CTCBeamDecoder
from data.utility import add_arguments, print_arguments
from utils import data
parser = argparse.ArgumentParser(description=__doc__)
... | code_fim | medium | {
"lang": "python",
"repo": "bitdaocao/MASR",
"path": "/infer_path.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def predict(wav_path):
wav = data.load_audio(wav_path)
spec = data.spectrogram(wav)
spec.unsqueeze_(0)
with torch.no_grad():
spec = spec.cuda()
y = model.cnn(spec)
y = F.softmax(y, 1)
y_len = torch.tensor([y.size(-1)])
y = y.permute(0, 2, 1) # B * T * V
... | code_fim | medium | {
"lang": "python",
"repo": "bitdaocao/MASR",
"path": "/infer_path.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: najoshi/pipresents-next-digital-photo-frame path: /pp_gpio.py
up(num,False)
self.reset_inputs()
PPIO.gpio_enabled=True
#init timer
self.button_tick_timer=None
PPIO.last_scheduler_time=long(time.time())
return True
# called by main program only... | code_fim | hard | {
"lang": "python",
"repo": "najoshi/pipresents-next-digital-photo-frame",
"path": "/pp_gpio.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> #NIK
if pin[PPIO.RISING_NAME] == 'pir-switch-on':
if self.GPIO.input(num):
self.pir_switch_on = True
else:
self.pir_switch_on = False
#NIK
elif pin[PPIO.DIRE... | code_fim | hard | {
"lang": "python",
"repo": "najoshi/pipresents-next-digital-photo-frame",
"path": "/pp_gpio.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> # execute events at the appropriate time and remove from list (runs from main program only)
# runs through list a number of times because of problems with pop messing up list
def do_sequencer(self,schedule_time):
# print 'sequencer run for: ' + str(schedule_time) + ' at ' + str(long(ti... | code_fim | hard | {
"lang": "python",
"repo": "najoshi/pipresents-next-digital-photo-frame",
"path": "/pp_gpio.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matteogrolla/solr_load_test path: /loadtest/QueriesGenFromStoredFields.py
# Copyright 2015 Matteo Grolla
#
# 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.... | code_fim | hard | {
"lang": "python",
"repo": "matteogrolla/solr_load_test",
"path": "/loadtest/QueriesGenFromStoredFields.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> num_docs = self.s.query("*:*").numFound
out_file = codecs.open(output_path, 'w', encoding='utf-8')
incr = num_docs / num_queries
for i in xrange(0, num_queries):
i_str = str(i*incr).rjust(9, '0')
response = self.s.query("%s:%s"%(id_field_name, i_s... | code_fim | hard | {
"lang": "python",
"repo": "matteogrolla/solr_load_test",
"path": "/loadtest/QueriesGenFromStoredFields.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pulumi/pulumi path: /sdk/python/lib/test/langhost/output_all/test_output_all.py
# Copyright 2016-2021, Pulumi Corporation.
#
# 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 ... | code_fim | medium | {
"lang": "python",
"repo": "pulumi/pulumi",
"path": "/sdk/python/lib/test/langhost/output_all/test_output_all.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> _provider, _property_deps, _delete_before_replace, _ignore_changes, _version, _import,
_replace_on_changes, _providers, source_position):
number = 0
if name == "testResource1":
self.assertEqual(ty, "test:index:MyResource")
... | code_fim | medium | {
"lang": "python",
"repo": "pulumi/pulumi",
"path": "/sdk/python/lib/test/langhost/output_all/test_output_all.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
"""
def test_output_all(self):
self.run_test(
program=path.join(self.base_path(), "output_all"),
expected_resource_count=4)
def register_resource(self, _ctx, _dry_run, ty, name, _resource, _dependencies, _parent, _custom, protect,
... | code_fim | medium | {
"lang": "python",
"repo": "pulumi/pulumi",
"path": "/sdk/python/lib/test/langhost/output_all/test_output_all.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kegman/openpilot path: /selfdrive/controls/lib/drive_helpers.py
from common.numpy_fast import clip, interp
from selfdrive.config import Conversions as CV
from selfdrive.kegman_conf import kegman_conf
from cereal import car
# kph
kegman = kegman_conf()
V_CRUISE_MAX = 144
V_CRUISE_MIN = 8
V_CRUISE... | code_fim | medium | {
"lang": "python",
"repo": "kegman/openpilot",
"path": "/selfdrive/controls/lib/drive_helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def initialize_v_cruise(v_ego, buttonEvents, v_cruise_last):
for b in buttonEvents:
# 250kph or above probably means we never had a set speed
if b.type == car.CarState.ButtonEvent.Type.accelCruise and v_cruise_last < 250:
return v_cruise_last
return int(round(clip(v_ego * CV.MS_TO_KPH, ... | code_fim | hard | {
"lang": "python",
"repo": "kegman/openpilot",
"path": "/selfdrive/controls/lib/drive_helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>sp = StockSpanner()
price_list = [100, 80, 60, 70, 60, 75, 85]
for p in price_list:
print(sp.next(p))
# [1,1,1,2,1,4,6]<|fim_prefix|># repo: eroicaleo/LearningPython path: /interview/leet/0000_Stock_Spanner.py
#!/usr/bin/env python3
class StockSpanner:
def __init__(self):
self.price_lis... | code_fim | hard | {
"lang": "python",
"repo": "eroicaleo/LearningPython",
"path": "/interview/leet/0000_Stock_Spanner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eroicaleo/LearningPython path: /interview/leet/0000_Stock_Spanner.py
#!/usr/bin/env python3
class StockSpanner:
def __init__(self):
<|fim_suffix|> ix, ret = len(self.price_list)-1, 1
while ix >= 0 and self.price_list[ix] <= price:
ret += self.span[ix]
... | code_fim | medium | {
"lang": "python",
"repo": "eroicaleo/LearningPython",
"path": "/interview/leet/0000_Stock_Spanner.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # detect potential shared paths between two linestrings
try:
fw_bw = shared_paths(g1, g2)
except ValueError:
self._valerr = True
fw_bw = False
# continue if any shared path was detected
if fw_bw and not fw_bw.is_empty:
... | code_fim | hard | {
"lang": "python",
"repo": "hamid-heydari/topojson",
"path": "/topojson/core/join.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hamid-heydari/topojson path: /topojson/core/join.py
# pylint: disable=unsubscriptable-object
import copy
import pprint
from shapely import geometry
from shapely.wkb import loads
from shapely.ops import shared_paths
from shapely.ops import linemerge
from shapely import speedups
from ..ops import s... | code_fim | hard | {
"lang": "python",
"repo": "hamid-heydari/topojson",
"path": "/topojson/core/join.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, *args, **kwargs):
self.ctrl_list = None
self.return_value = None
self.title = kwargs['title']
self.dir_items = kwargs['dir_items']
self.preselect_guid = kwargs.get('preselect_guid')
self.action_exit_keys_id = [ACTION_PREVIOUS_MENU,
... | code_fim | hard | {
"lang": "python",
"repo": "CastagnaIT/plugin.video.netflix",
"path": "/resources/lib/kodi/ui/xmldialog_profiles.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CastagnaIT/plugin.video.netflix path: /resources/lib/kodi/ui/xmldialog_profiles.py
# -*- coding: utf-8 -*-
"""
Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix)
Copyright (C) 2020 Stefano Gottardo (original implementation module)
XML based dialog
SPDX-License-Identifier... | code_fim | hard | {
"lang": "python",
"repo": "CastagnaIT/plugin.video.netflix",
"path": "/resources/lib/kodi/ui/xmldialog_profiles.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> context = {
'cgroup_dir': argkv.get('cgroup_dir', '/sys/fs/cgroup'),
'get_zk_host': argkv['get_zk_host'],
'zk_prefix': argkv['zk_prefix'],
'zk_auth_data': argkv['zk_auth_data'],
}
cgexec_arg = {}
for cgroup_name in cgroup_names:
cgexec_arg[cgroup_na... | code_fim | hard | {
"lang": "python",
"repo": "bsc-s2/ops",
"path": "/src/pykit/cgrouparch/manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bsc-s2/ops path: /src/pykit/cgrouparch/manager.py
import logging
import os
import time
import redis
from kazoo.client import KazooClient
from pykit import threadutil
from pykit import utfjson
from pykit import zkutil
from pykit.cgrouparch import account
from pykit.cgrouparch import cgroup_manag... | code_fim | hard | {
"lang": "python",
"repo": "bsc-s2/ops",
"path": "/src/pykit/cgrouparch/manager.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kbcao/leetcode path: /1431/1431_ckb.py
# easy
class Solution:
<|fim_suffix|> _max=max(candies)
return [True if i-_max+extraCandies >=0 else False for i in candies]<|fim_middle|> def kidsWithCandies(self, candies: List[int], extraCandies: int) -> List[bool]:
| code_fim | medium | {
"lang": "python",
"repo": "kbcao/leetcode",
"path": "/1431/1431_ckb.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _max=max(candies)
return [True if i-_max+extraCandies >=0 else False for i in candies]<|fim_prefix|># repo: kbcao/leetcode path: /1431/1431_ckb.py
# easy
class Solution:
<|fim_middle|> def kidsWithCandies(self, candies: List[int], extraCandies: int) -> List[bool]:
| code_fim | medium | {
"lang": "python",
"repo": "kbcao/leetcode",
"path": "/1431/1431_ckb.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> client,
mocker,
api_user_pending,
mock_get_user_pending,
mock_send_verify_code,
):
mocker.patch("app.user_api_client.get_user_by_email", return_value=api_user_pending)
with client.session_transaction() as session:
session["user_details"] = {
"id": api_user_... | code_fim | hard | {
"lang": "python",
"repo": "cds-snc/notification-admin",
"path": "/tests/app/main/views/test_code_not_received.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_check_and_redirect_to_two_factor_if_user_active(
client,
api_user_active,
mock_get_user_by_email,
mock_send_verify_code,
):
with client.session_transaction() as session:
session["user_details"] = {
"id": api_user_active["id"],
"email": api_user... | code_fim | hard | {
"lang": "python",
"repo": "cds-snc/notification-admin",
"path": "/tests/app/main/views/test_code_not_received.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cds-snc/notification-admin path: /tests/app/main/views/test_code_not_received.py
import pytest
from bs4 import BeautifulSoup
from flask import url_for
def test_should_render_email_verification_resend_show_email_address_and_resend_verify_email(
client,
mocker,
api_user_active,
mo... | code_fim | hard | {
"lang": "python",
"repo": "cds-snc/notification-admin",
"path": "/tests/app/main/views/test_code_not_received.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shadowCow/gamey path: /games/game.py
from abc import ABC, abstractmethod
from typing import Callable, Any, Optional, List
class State(ABC):
def __init__(
self,
kind: str,
):
self.kind = kind
class GameState(State):
def __init__(
self,
kind: ... | code_fim | hard | {
"lang": "python",
"repo": "shadowCow/gamey",
"path": "/games/game.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.