text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> if self.id is None:
condition = "state='draft'"
batch_id = ()
else:
condition = "batch=%s"
batch_id = (self.id,)
return condition, batch_id
def loadCommentChanges(self, critic):
cursor = critic.getDatabaseCursor()
... | code_fim | hard | {
"lang": "python",
"repo": "jensl/critic",
"path": "/src/api/impl/batch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jensl/critic path: /src/api/impl/batch.py
# -*- mode: python; encoding: utf-8 -*-
#
# Copyright 2017 the Critic contributors, Opera Software ASA
#
# 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... | code_fim | hard | {
"lang": "python",
"repo": "jensl/critic",
"path": "/src/api/impl/batch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.__modified_comments is None:
self.loadCommentChanges(critic)
new_type_by_comment_id = {
modified_comment.id: modified_comment.new_type
for modified_comment in self.__modified_comments
if modified_comment.new_type is not None
}... | code_fim | hard | {
"lang": "python",
"repo": "jensl/critic",
"path": "/src/api/impl/batch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> version = '%d.%d.%d' % __version__[0:3]
if __version__[3]:
version = '%s-%s%s' % (version, __version__[3],
(__version__[4] and str(__version__[4])) or '')
return version<|fim_prefix|># repo: jszakmeister/trac-backlog path: /backlog/__init__.py
__version__ = (... | code_fim | easy | {
"lang": "python",
"repo": "jszakmeister/trac-backlog",
"path": "/backlog/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jszakmeister/trac-backlog path: /backlog/__init__.py
__version__ = (0, 4, 0, 'dev', 0)
<|fim_suffix|> version = '%d.%d.%d' % __version__[0:3]
if __version__[3]:
version = '%s-%s%s' % (version, __version__[3],
(__version__[4] and str(__version__[4])) or '... | code_fim | easy | {
"lang": "python",
"repo": "jszakmeister/trac-backlog",
"path": "/backlog/__init__.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Combine two arrays
converted_zerod_oned = np.array([[zerod_array], [oned_array]])
#Combine all three arrays
total_converted = np.array([[zerod_array],[oned_array], [twod_array]])
# Right now just return the oned array, but it's modifiable
return(oned_array)
def file_len(filenam... | code_fim | hard | {
"lang": "python",
"repo": "TRI-AMDD/mof_tda",
"path": "/mof_tda/persistence_images/calculate_persistence_image.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TRI-AMDD/mof_tda path: /mof_tda/persistence_images/calculate_persistence_image.py
"""
Calculate persistence images from the persistence diagrams
"""
import pickle
from typing import (Any, Set, List, Tuple, Dict, Optional, TextIO)
import os
import numpy as np
import matplotlib.pyplot as plt
import... | code_fim | hard | {
"lang": "python",
"repo": "TRI-AMDD/mof_tda",
"path": "/mof_tda/persistence_images/calculate_persistence_image.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> persistence_diagram = unpickle_persistence_diagram(structure_name)
oned_persistence_array = convert_persistence_diagrams_1d(persistence_diagram)
img = convert_to_image_multiprocessing(oned_persistence_array)
# Store the persistence image output, this folder name can be changed depending on... | code_fim | hard | {
"lang": "python",
"repo": "TRI-AMDD/mof_tda",
"path": "/mof_tda/persistence_images/calculate_persistence_image.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: punchcutter/fontgoggles path: /Tests/test_bidi.py
from collections import deque
import pytest
from fontgoggles.misc.bidi import applyBiDi, getBiDiInfo
testData = [
("Abc", "Abc",
{'base_dir': 'L',
'base_level': 0,
'chars': [{'ch': 'A',
'index': 0,
... | code_fim | hard | {
"lang": "python",
"repo": "punchcutter/fontgoggles",
"path": "/Tests/test_bidi.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.parametrize("testString,expectedString,expectedRunLengths,expectedDir,expectedToBiDi,expectedFromBiDi",
testDataApplyBiDi)
def test_applyBiDi(testString, expectedString, expectedRunLengths, expectedDir, expectedToBiDi, expectedFromBiDi):
display, runLenghts, baseD... | code_fim | hard | {
"lang": "python",
"repo": "punchcutter/fontgoggles",
"path": "/Tests/test_bidi.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: graphcore/examples path: /nlp/bert/pytorch/tests/cpu_ipu_test.py
# Copyright (c) 2021 Graphcore Ltd. 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 License a... | code_fim | hard | {
"lang": "python",
"repo": "graphcore/examples",
"path": "/nlp/bert/pytorch/tests/cpu_ipu_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> batch_size = config.micro_batch_size
batch = (
inputs["input_ids"].repeat(batch_size, 1),
inputs["attention_mask"].repeat(batch_size, 1),
inputs["token_type_ids"].repeat(batch_size, 1),
inputs["masked_lm_positions"].repeat(batch_size, 1),
inputs["labels"].r... | code_fim | hard | {
"lang": "python",
"repo": "graphcore/examples",
"path": "/nlp/bert/pytorch/tests/cpu_ipu_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> nonExecutableActions = self.actions.getNonExecutable(belief, self.lastSystemAction)
executable = self._createExecutable(nonExecutableActions)
if self.alwaysShowAllActions:
actionList = self.actions.action_names
else:
actionList = executable
... | code_fim | hard | {
"lang": "python",
"repo": "paulaWesselmann/testing_pydial",
"path": "/policy/Wizard.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Produce a list of executable actions from non executable actions
:param nonExecutableActions:
:type nonExecutableActions:
'''
executable_actions = []
for act_i in self.actions.action_names:
if act_i in nonExec... | code_fim | hard | {
"lang": "python",
"repo": "paulaWesselmann/testing_pydial",
"path": "/policy/Wizard.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paulaWesselmann/testing_pydial path: /policy/Wizard.py
###############################################################################
# PyDial: Multi-domain Statistical Spoken Dialogue System Software
###############################################################################
#
# Copyright 2... | code_fim | hard | {
"lang": "python",
"repo": "paulaWesselmann/testing_pydial",
"path": "/policy/Wizard.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pcastillol/X-Serv-15.5-Django-CMS path: /cms/views.py
from django.shortcuts import render
from .models import Pages
from django.http import HttpResponse, HttpResponseNotFound
# Create your views here.
def pagina_inicio(request):
pages = Pages.objects.all()
respuesta = "Bienvenido a la pagina ... | code_fim | medium | {
"lang": "python",
"repo": "pcastillol/X-Serv-15.5-Django-CMS",
"path": "/cms/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def showContent(request, identificador):
try:
page = Pages.objects.get(id=identificador)
respuesta = page.page
return HttpResponse(respuesta)
except Pages.DoesNotExist:
respuesta = "Page not found: /web/%d." %int(identificador) #hago esto ya que identificador es str... | code_fim | hard | {
"lang": "python",
"repo": "pcastillol/X-Serv-15.5-Django-CMS",
"path": "/cms/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MDSplus/mdsplus path: /python/MDSplus/mdsscalar.py
#
# Copyright (c) 2017, Massachusetts Institute of Technology All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistribu... | code_fim | hard | {
"lang": "python",
"repo": "MDSplus/mdsplus",
"path": "/python/MDSplus/mdsscalar.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Int128(Uint128):
"""128-bit number"""
dtype_id = 26
def __init__(self):
raise TypeError("Int128 is not yet supported")
_dsc._add_dtype_to_class(Int128)
class FloatG(Float64):
"""64-bit VMS floating point number"""
dtype_id = 27
_dsc._add_dtype_to_class(FloatG)
cl... | code_fim | hard | {
"lang": "python",
"repo": "MDSplus/mdsplus",
"path": "/python/MDSplus/mdsscalar.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chris-castillo/DIY_Thermostat path: /copy_to_pi/send_temp_to_influx.py
from influxdb import InfluxDBClient
import pi_functions as pi_fn
import os
import glob
import time
localIP = pi_fn.get_ip()
<|fim_suffix|>base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')... | code_fim | medium | {
"lang": "python",
"repo": "chris-castillo/DIY_Thermostat",
"path": "/copy_to_pi/send_temp_to_influx.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'
while True:
pi_fn.write_temp(device_file,localIP,client)
time.sleep(30)<|fim_prefix|># repo: chris-castillo/DIY_Thermostat path: /copy_to_pi/send_temp_to_influx.py
fro... | code_fim | hard | {
"lang": "python",
"repo": "chris-castillo/DIY_Thermostat",
"path": "/copy_to_pi/send_temp_to_influx.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
async def _handle_webhook(job, trigger_data, hass, webhook_id, request):
"""Handle incoming webhook."""
result = {"platform": "webhook", "webhook_id": webhook_id}
if "json" in request.headers.get(hdrs.CONTENT_TYPE, ""):
result["json"] = await request.json()
else:
result["... | code_fim | medium | {
"lang": "python",
"repo": "BenWoodford/home-assistant",
"path": "/homeassistant/components/webhook/trigger.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
async def async_attach_trigger(hass, config, action, automation_info):
"""Trigger based on incoming webhooks."""
trigger_data = automation_info.get("trigger_data", {}) if automation_info else {}
webhook_id = config.get(CONF_WEBHOOK_ID)
job = HassJob(action)
hass.components.webhook.asy... | code_fim | hard | {
"lang": "python",
"repo": "BenWoodford/home-assistant",
"path": "/homeassistant/components/webhook/trigger.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BenWoodford/home-assistant path: /homeassistant/components/webhook/trigger.py
"""Offer webhook triggered automation rules."""
from functools import partial
from aiohttp import hdrs
import voluptuous as vol
from homeassistant.const import CONF_PLATFORM, CONF_WEBHOOK_ID
from homeassistant.core im... | code_fim | medium | {
"lang": "python",
"repo": "BenWoodford/home-assistant",
"path": "/homeassistant/components/webhook/trigger.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> R = R(e1, phi1) R(e2, phi2) R(e3, phi3)
where R(e, phi) is the rotation matrix for a rotation by angle phi around
axis e"""
assert R.is_r3_rotation_matrix()
e1 = matrix.col(e1).normalize()
e2 = matrix.col(e2).normalize()
e3 = matrix.col(e3).normalize()
# Fail if e2 & e3 ... | code_fim | hard | {
"lang": "python",
"repo": "dials/dials",
"path": "/src/dials/algorithms/refinement/rotation_decomposition.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dials/dials path: /src/dials/algorithms/refinement/rotation_decomposition.py
from __future__ import annotations
import math
from scitbx import matrix
"""A Python version of the Rotation::euler_explicit method from Pointless"""
def solve_r3_rotation_for_angles_given_axes(
R, e1, e2, e3, s... | code_fim | hard | {
"lang": "python",
"repo": "dials/dials",
"path": "/src/dials/algorithms/refinement/rotation_decomposition.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhexiao/ezhost path: /ezhost/main.py
# -*- coding: utf-8 -*-
#!/usr/bin/python
"""
This module contains `main` method plus related subroutines.
`main` is executed as the command line ``ezhost`` program and takes care of
parsing options and commands
The other callables defined in this module are ... | code_fim | hard | {
"lang": "python",
"repo": "zhexiao/ezhost",
"path": "/ezhost/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument(
'-C', '--config',
help='配置文件路径',
nargs=2
)
parser.add_argument(
'-H', '--host',
help='客户机地址',
)
parser.add_argument(
'-U', '--user',
help='客户机用户名',
)
parser.add_argument(
'-P', '--passwd',
... | code_fim | hard | {
"lang": "python",
"repo": "zhexiao/ezhost",
"path": "/ezhost/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@skygear.op("weather:hourly_forecast")
def hourly_forecast():
return {"content": "here is the forecast by the hour"}
def register_weather(settings):
five_day_forecast
hourly_forecast<|fim_prefix|># repo: lyoung83/chat path: /chat-plugin/cloud/weather/__init__.py
import skygear
@skygear.op("... | code_fim | medium | {
"lang": "python",
"repo": "lyoung83/chat",
"path": "/chat-plugin/cloud/weather/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def register_weather(settings):
five_day_forecast
hourly_forecast<|fim_prefix|># repo: lyoung83/chat path: /chat-plugin/cloud/weather/__init__.py
import skygear
@skygear.op("weather:five_day_forecast")
def five_day_forecast():
return {"content": "here is the weather for the next five days"}
... | code_fim | medium | {
"lang": "python",
"repo": "lyoung83/chat",
"path": "/chat-plugin/cloud/weather/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lyoung83/chat path: /chat-plugin/cloud/weather/__init__.py
import skygear
@skygear.op("weather:five_day_forecast")
def five_day_forecast():
<|fim_suffix|> return {"content": "here is the forecast by the hour"}
def register_weather(settings):
five_day_forecast
hourly_forecast<|fim_mid... | code_fim | medium | {
"lang": "python",
"repo": "lyoung83/chat",
"path": "/chat-plugin/cloud/weather/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.url = 'https://aur.archlinux.org/aurutils-git.git'
self.tmp = TemporaryDirectory()
self.repopath = Path(self.tmp.name, 'repo')
def test_git_clone(self):
repo = GitRepo(self.repopath)
repo.clone(self.url)
self.assertTrue(repo.is_repo())
def tea... | code_fim | medium | {
"lang": "python",
"repo": "jcrd/python-pkgbuilder",
"path": "/test/test_aur.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jcrd/python-pkgbuilder path: /test/test_aur.py
from pathlib import Path
from tempfile import TemporaryDirectory
import unittest
from pkgbuilder.aur import GitRepo
<|fim_suffix|> def setUp(self):
self.url = 'https://aur.archlinux.org/aurutils-git.git'
self.tmp = TemporaryDirec... | code_fim | medium | {
"lang": "python",
"repo": "jcrd/python-pkgbuilder",
"path": "/test/test_aur.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> edisp = obs.edisp.to_energy_dispersion(offset='1 deg')
# edisp.plot_matrix(ax=axes[1])
psf_edep = obs.psf.to_table_psf(theta='1 deg')
for energy in [1, 3] * u.TeV:
psf = psf_edep.table_psf_at_energy(energy)
psf.plot_psf_vs_theta()
plt.xscale('linear')
plt.yscale('l... | code_fim | hard | {
"lang": "python",
"repo": "open-gamma-ray-astro/open-gamma-ray-astro-gamma2016",
"path": "/proceeding/figures/plot_iact_dl3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: open-gamma-ray-astro/open-gamma-ray-astro-gamma2016 path: /proceeding/figures/plot_iact_dl3.py
"""Make IACT DL3 example plot.
"""
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
plt.style.use('ggplot')
import astropy.units as u
from gammapy.data import DataStore
def peek... | code_fim | hard | {
"lang": "python",
"repo": "open-gamma-ray-astro/open-gamma-ray-astro-gamma2016",
"path": "/proceeding/figures/plot_iact_dl3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
name = node.get('name')
orcid = node.get('orcid', '')
email = node.get('email', '')
contributorType = node.get('contributorType', '')
return cls(name, orcid, email, contributorType)
class Contributors(suiteModule.Suite):
moniker = 'contributors'
suiteNam... | code_fim | hard | {
"lang": "python",
"repo": "LLNL/fudge",
"path": "/xData/Documentation/contributor.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LLNL/fudge path: /xData/Documentation/contributor.py
# <<BEGIN-copyright>>
# Copyright 2022, Lawrence Livermore National Security, LLC.
# See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# <<END-copyright>>
"""
This module contains the classes representing... | code_fim | hard | {
"lang": "python",
"repo": "LLNL/fudge",
"path": "/xData/Documentation/contributor.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """."""
return self.__contributorType
def XML_extraAttributes(self, **kwargs):
attributes = abstractClassesModule.AuthorAbstract.XML_extraAttributes(self, **kwargs)
attributes += ' contributorType="%s"' % self.__contributorType
return attributes
@classme... | code_fim | hard | {
"lang": "python",
"repo": "LLNL/fudge",
"path": "/xData/Documentation/contributor.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dlandi/keripy-1 path: /tests/app/cli/commands/multisig/test_multisig.py
# -*- encoding: utf-8 -*-
"""
tests.app.cli.commands.multisig
"""
import json
import os
import shutil
import time
from hio.base import doing, tyming
from keri.app import indirecting, habbing
from keri.app.cli.commands imp... | code_fim | hard | {
"lang": "python",
"repo": "dlandi/keripy-1",
"path": "/tests/app/cli/commands/multisig/test_multisig.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> inceptor = InceptingDoer()
doers = wanDoers + wilDoers + wesDoers + [inceptor]
limit = 2.0
tock = 0.03125
doist = doing.Doist(tock=tock, limit=limit, doers=doers)
doist.enter()
tymer = tyming.Tymer(tymth=doist.tymen(), duration=doist.limit)
... | code_fim | hard | {
"lang": "python",
"repo": "dlandi/keripy-1",
"path": "/tests/app/cli/commands/multisig/test_multisig.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nance-Lab/diff_classifier path: /notebooks/geoaverage.py
#!/usr/bin/env python
import turtle
import sys
import diff_classifier.knotlets as kn
import numpy as np
import diff_classifier.aws as aws
import diff_classifier.msd as msd
folder = '09_26_18_tissue_study'
bucket = 'hpontes.data'
#experime... | code_fim | hard | {
"lang": "python",
"repo": "Nance-Lab/diff_classifier",
"path": "/notebooks/geoaverage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> aws.download_s3('{}/msd_{}.csv'.format(folder, sample_name), 'msd_{}.csv'.format(sample_name), bucket_name=bucket)
geomean[sample_name], gSEM[sample_name] = msd.geomean_msdisp(sample_name, umppx=umppx, fps=fps,
remote_folder=folder, ... | code_fim | hard | {
"lang": "python",
"repo": "Nance-Lab/diff_classifier",
"path": "/notebooks/geoaverage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: slavaGanzin/ramda.py path: /ramda/private/accepts_varargs.py
from inspect import getfullargspec
def argspec_has_varargs(argspec):
<|fim_suffix|>def accepts_varargs(f):
return argspec_has_varargs(getfullargspec(f))<|fim_middle|> return argspec.varargs is not None or argspec.varkw is not N... | code_fim | medium | {
"lang": "python",
"repo": "slavaGanzin/ramda.py",
"path": "/ramda/private/accepts_varargs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return argspec_has_varargs(getfullargspec(f))<|fim_prefix|># repo: slavaGanzin/ramda.py path: /ramda/private/accepts_varargs.py
from inspect import getfullargspec
<|fim_middle|>
def argspec_has_varargs(argspec):
return argspec.varargs is not None or argspec.varkw is not None
def accepts_vararg... | code_fim | medium | {
"lang": "python",
"repo": "slavaGanzin/ramda.py",
"path": "/ramda/private/accepts_varargs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tmizu23/CustomedFreehandRastereGeoreferencer path: /freehandrastergeoreferencer_commands.py
from qgis.core import *
from qgis.gui import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import math
import os.path
class ExportAsRasterCommand(object):
def __init__(self, iface):
... | code_fim | hard | {
"lang": "python",
"repo": "tmizu23/CustomedFreehandRastereGeoreferencer",
"path": "/freehandrastergeoreferencer_commands.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> widget = QgsMessageBar.createMessage("Raster Geoferencer", "Raster exported successfully.")
self.iface.messageBar().pushWidget(widget, QgsMessageBar.INFO, 2)
except Exception as ex:
QgsMessageLog.logMessage(repr(ex))
widget = QgsMessageBar.createMes... | code_fim | hard | {
"lang": "python",
"repo": "tmizu23/CustomedFreehandRastereGeoreferencer",
"path": "/freehandrastergeoreferencer_commands.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> track_searcher = TrackSearcher(self.config)
albums_searcher = AlbumsSearcher(self.config)
lyrics_searcher = LyricsSearcher(albums_searcher, track_searcher, self.config)
lyrics_list = lyrics_searcher.get_lyrics('Mc Rodolfinho')
self.assertIsInstance(lyrics_list, lis... | code_fim | hard | {
"lang": "python",
"repo": "LimaGuilherme/what-is-your-band-favorite-word-api",
"path": "/tests/integration/test_lyrics_searcher.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LimaGuilherme/what-is-your-band-favorite-word-api path: /tests/integration/test_lyrics_searcher.py
from unittest import TestCase
from src.lyrics.searchers import AlbumsSearcher
from src.lyrics.searchers import LyricsSearcher
from src.lyrics.searchers import TrackSearcher
from src.lyrics.entity ... | code_fim | hard | {
"lang": "python",
"repo": "LimaGuilherme/what-is-your-band-favorite-word-api",
"path": "/tests/integration/test_lyrics_searcher.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> lyrics_list = lyrics_searcher.get_lyrics('Mc Rodolfinho')
self.assertIsInstance(lyrics_list, list)
for lyrics in lyrics_list:
self.assertIsInstance(lyrics, Lyrics)<|fim_prefix|># repo: LimaGuilherme/what-is-your-band-favorite-word-api path: /tests/integration/test_lyr... | code_fim | hard | {
"lang": "python",
"repo": "LimaGuilherme/what-is-your-band-favorite-word-api",
"path": "/tests/integration/test_lyrics_searcher.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: i-sylar/wordfreud path: /wordfreud.py
import argparse
import time
import os
from classes import Toolbox
from classes import Properties
from classes import App
# Create object to deal with application logic
app = App()
# By default, switch off info/debug output (-v switches it on)
app.setVerbose(... | code_fim | hard | {
"lang": "python",
"repo": "i-sylar/wordfreud",
"path": "/wordfreud.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>totalResults = 0
for line in wLines:
app.output("processing " + line)
variations = Toolbox(properties).genLineVariations(line)
app.output("- it has " + str(len(variations)) + " word-variations")
result = Toolbox(properties).addNumbers(variations, numbList)
app.output("- and it has " + str(len(result)... | code_fim | hard | {
"lang": "python",
"repo": "i-sylar/wordfreud",
"path": "/wordfreud.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if (s['poster_path'] is None):
fcsv.write("{};https://image.tmdb.org/t/p/w185/NONE;{};{};{}\n".format(s['title'], gVideo, s['release_date'].rsplit('-',2)[0], gName))
else:
fcsv.write("{};https://image.tmdb.org/t/p/w185... | code_fim | hard | {
"lang": "python",
"repo": "sbksba/Movie-Assistant",
"path": "/MovieAssistant/scraper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sbksba/Movie-Assistant path: /MovieAssistant/scraper.py
import tmdbsimple as tmdb
import csv, sys, shutil
from os import listdir
from os.path import isfile, join
from tools import *
def scraper_directorie(CSV_filepath,DIR_path):
<|fim_suffix|> if (s['poster_path'] is None):
... | code_fim | hard | {
"lang": "python",
"repo": "sbksba/Movie-Assistant",
"path": "/MovieAssistant/scraper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return y_predicted
'''
def vhdl_gen(feature_array,label_class):
dict1 = {'1' : ' ', '0' : ' not('}
dict2 = {'1' : ' ', '0' : ' ) '}
pos = np.where(label_class == 1)
for i in range(len(pos)):
not_pos = '{0:06b}'.format(pos[i])
log.write('tree_0_' + 'path_' + str(i) + ' = ')
for j in range(5):
... | code_fim | hard | {
"lang": "python",
"repo": "AmirAliEbrahimi/PoET-BiN",
"path": "/cifar/new_st_class_8/lvl_wise_copy2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AmirAliEbrahimi/PoET-BiN path: /cifar/new_st_class_8/lvl_wise_copy2.py
import numpy as np
'''
import gzip,pickle
f=gzip.open(r'D:\siva\Masters\Thesis\04_ETE_18\W1\mnist.pkl.gz')
MNIST=pickle.load(f)
logFile=r'D:\siva\Masters\Thesis\06_AUT_18\W3\Mec\logFile.log'
logFile2=r'D:\siva\Masters\Thesis... | code_fim | hard | {
"lang": "python",
"repo": "AmirAliEbrahimi/PoET-BiN",
"path": "/cifar/new_st_class_8/lvl_wise_copy2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dluschan/olymp path: /vseros/2014-15/sch/polyndrom.py
import math
#n = int(input())
n = 100
pair = int(math.log((n + 1) / 2, 10)) + 1
numdigits = pair*2 - 1
<|fim_suffix|>base = 10**((numdigits - 1) // 2) + n - leftnumbers - 1
copy = base // 10**(numdigits % 2)
while copy:
base = 10*base + ... | code_fim | medium | {
"lang": "python",
"repo": "dluschan/olymp",
"path": "/vseros/2014-15/sch/polyndrom.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>base = 10**((numdigits - 1) // 2) + n - leftnumbers - 1
copy = base // 10**(numdigits % 2)
while copy:
base = 10*base + copy % 10
copy /= 10
print(base)<|fim_prefix|># repo: dluschan/olymp path: /vseros/2014-15/sch/polyndrom.py
import math
#n = int(input())
n = 100
pair = int(math.log((n + ... | code_fim | medium | {
"lang": "python",
"repo": "dluschan/olymp",
"path": "/vseros/2014-15/sch/polyndrom.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ivelinakaraivanova/Escape_rooms path: /src/escape_rooms/escape_rooms/escape_app/permissions.py
from rest_framework.permissions import BasePermission, SAFE_METHODS
from escape_rooms.escape_app.models import Team, Room
from escape_rooms.organizations_app.models import Employee
def is_company_emp... | code_fim | hard | {
"lang": "python",
"repo": "ivelinakaraivanova/Escape_rooms",
"path": "/src/escape_rooms/escape_rooms/escape_app/permissions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if 'room' in request.data:
return is_company_employee(request.user.id, get_room_owner_company_id(request.data['room']))
return True
def has_object_permission(self, request, view, obj):
if request.method in SAFE_METHODS or (request.user and request.user.is_superuse... | code_fim | hard | {
"lang": "python",
"repo": "ivelinakaraivanova/Escape_rooms",
"path": "/src/escape_rooms/escape_rooms/escape_app/permissions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ (HTML) formatted item for display in the dropdown """
return self.format_item_display(obj)
def format_item_display(self, obj):
""" (HTML) formatted item for displaying item in the selected deck area """
return u"%s" % (escape(obj.nombre))<|fim_prefix|># repo: TechF... | code_fim | medium | {
"lang": "python",
"repo": "TechFitU/MDSOM",
"path": "/src/inmediag/lookups.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TechFitU/MDSOM path: /src/inmediag/lookups.py
from ajax_select import LookupChannel, register
from django.utils.html import escape
from django.db.models import Q
from inmediag.models import Paciente, Doctor
@register('pacientes')
class PacienteLookup(LookupChannel):
model = Paciente
de... | code_fim | medium | {
"lang": "python",
"repo": "TechFitU/MDSOM",
"path": "/src/inmediag/lookups.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def format_match(self, obj):
""" (HTML) formatted item for display in the dropdown """
return self.format_item_display(obj)
def format_item_display(self, obj):
""" (HTML) formatted item for displaying item in the selected deck area """
return u"%s" % (escape(obj.no... | code_fim | hard | {
"lang": "python",
"repo": "TechFitU/MDSOM",
"path": "/src/inmediag/lookups.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>e
from .compare import compare_descriptions<|fim_prefix|># repo: curino/schema-matching path: /src/schema_matching/actions/__init__.py
from ._argparser import p as argument_parse<|fim_middle|>r
from .collect import collect
from .match import match
from .validate import validat | code_fim | medium | {
"lang": "python",
"repo": "curino/schema-matching",
"path": "/src/schema_matching/actions/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: curino/schema-matching path: /src/schema_matching/actions/__init__.py
from ._argparser import p as argument_parse<|fim_suffix|> import match
from .validate import validate
from .compare import compare_descriptions<|fim_middle|>r
from .collect import collect
from .match | code_fim | easy | {
"lang": "python",
"repo": "curino/schema-matching",
"path": "/src/schema_matching/actions/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='document',
name='source',
field=models.ManyToManyField(blank=True, to='application.Source'),
),
]<|fim_prefix|># repo: ChrnyaevEK/sticky_link path: /application/migrations/0043_auto_20210616_2216... | code_fim | medium | {
"lang": "python",
"repo": "ChrnyaevEK/sticky_link",
"path": "/application/migrations/0043_auto_20210616_2216.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ChrnyaevEK/sticky_link path: /application/migrations/0043_auto_20210616_2216.py
# Generated by Django 3.1.5 on 2021-06-16 22:16
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
('application', '0042_auto_20210616_2213'),
]
operations = [
mig... | code_fim | easy | {
"lang": "python",
"repo": "ChrnyaevEK/sticky_link",
"path": "/application/migrations/0043_auto_20210616_2216.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chanedwin/mlmutation path: /analysis/machinelearning/utils/createconcordancemain.py
from createconcordancemethods import *
#deprecated
def execute_main(paths):
concordnumber, inputpaths, output_path = load_references_create(paths)
vcf_records_object = build_record_object(concordnumbe... | code_fim | hard | {
"lang": "python",
"repo": "chanedwin/mlmutation",
"path": "/analysis/machinelearning/utils/createconcordancemain.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="train neural net")
parser.add_argument('-i', '--input', help="give directories with files")
parser.add_argument('-C', '--concordance', help="")
parser.add_argument('-o', '--output', help="")
paths = parser.parse_... | code_fim | hard | {
"lang": "python",
"repo": "chanedwin/mlmutation",
"path": "/analysis/machinelearning/utils/createconcordancemain.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Equipment(models.Model):
headend = models.ForeignKey(HeadEnd)
device = models.ForeignKey(Hardware)
ip_address = models.CharField(max_length=16)
subnet = models.CharField(max_length=16)
gateway = models.CharField(max_length=16)<|fim_prefix|># repo: theSoloBrewer/Project_Management path: /apps... | code_fim | medium | {
"lang": "python",
"repo": "theSoloBrewer/Project_Management",
"path": "/apps/headends/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: theSoloBrewer/Project_Management path: /apps/headends/models.py
from django.db import models
from apps.hardware.models import Hardware
<|fim_suffix|>class Equipment(models.Model):
headend = models.ForeignKey(HeadEnd)
device = models.ForeignKey(Hardware)
ip_address = models.CharField(max_lengt... | code_fim | medium | {
"lang": "python",
"repo": "theSoloBrewer/Project_Management",
"path": "/apps/headends/models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> headend = models.ForeignKey(HeadEnd)
device = models.ForeignKey(Hardware)
ip_address = models.CharField(max_length=16)
subnet = models.CharField(max_length=16)
gateway = models.CharField(max_length=16)<|fim_prefix|># repo: theSoloBrewer/Project_Management path: /apps/headends/models.py
from django.d... | code_fim | hard | {
"lang": "python",
"repo": "theSoloBrewer/Project_Management",
"path": "/apps/headends/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Given a set of points and the coefficients of a linear
discriminant, this function returns a set of labels for
the points with respect to this discriminant.
"""
assert_points_2d (points)
assert_discriminant (theta)
score = lin_discr (points, theta)
labels = fun... | code_fim | hard | {
"lang": "python",
"repo": "mtgingrass/cse6040-ipynbs",
"path": "/cse6040utils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mtgingrass/cse6040-ipynbs path: /cse6040utils.py
f alpha_chars_pairs (text):
"""
(Generator) Yields every one of the 4-choose-2 pairs of
'positionally distinct' alphabetic characters in a string.
That is, each position of the string is regarded as distinct,
but the pair o... | code_fim | hard | {
"lang": "python",
"repo": "mtgingrass/cse6040-ipynbs",
"path": "/cse6040utils.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mtgingrass/cse6040-ipynbs path: /cse6040utils.py
airs (text):
"""
(Generator) Yields every one of the 4-choose-2 pairs of
'positionally distinct' alphabetic characters in a string.
That is, each position of the string is regarded as distinct,
but the pair of characters co... | code_fim | hard | {
"lang": "python",
"repo": "mtgingrass/cse6040-ipynbs",
"path": "/cse6040utils.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IzaakWN/cmssw path: /RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py
import FWCore.ParameterSet.Config as cms
<|fim_suffix|># This customization will be removed once we get the templates for phase2 pixel
from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracke... | code_fim | medium | {
"lang": "python",
"repo": "IzaakWN/cmssw",
"path": "/RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># This customization will be removed once we get the templates for phase2 pixel
from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
phase2_tracker.toModify(templates2,
LoadTemplatesFromDB = False,
DoLorentz = False,
)<|fim_prefix|># repo: IzaakWN/cmssw path: /RecoLocalTracker/Si... | code_fim | medium | {
"lang": "python",
"repo": "IzaakWN/cmssw",
"path": "/RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dalemyers/pngpadder path: /command_line/pngpadder
#!/usr/bin/env python2
from argparse import ArgumentParser
import pngpadder
def _handle_arguments():
"""Handle command line arguments and call the correct method."""
<|fim_suffix|> group.add_argument(
"--to",
dest="to",... | code_fim | medium | {
"lang": "python",
"repo": "dalemyers/pngpadder",
"path": "/command_line/pngpadder",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args.to is not None:
size = args.to
else:
size = args.by
try:
size = int(size)
except ValueError:
print "Size value was not an integer"
sys.exit(1)
try:
if args.to is not None:
pngpadder.pad_to(args.input, args.output, si... | code_fim | medium | {
"lang": "python",
"repo": "dalemyers/pngpadder",
"path": "/command_line/pngpadder",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wweschen/Capstone path: /bert/tf1_to_keras_checkpoint_converter.py
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Li... | code_fim | hard | {
"lang": "python",
"repo": "wweschen/Capstone",
"path": "/bert/tf1_to_keras_checkpoint_converter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>## Required parameters
flags.DEFINE_string("checkpoint_from_path", None,
"Source BERT checkpoint path.")
flags.DEFINE_string("checkpoint_to_path", None,
"Destination BERT checkpoint path.")
flags.DEFINE_string(
"exclude_patterns", None,
"Comma-delimited stri... | code_fim | hard | {
"lang": "python",
"repo": "wweschen/Capstone",
"path": "/bert/tf1_to_keras_checkpoint_converter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: devops-customers-18/customers path: /service/resources/home_page.py
"""
This module contains routes without Resources
"""
from flask_restful import Resource
from flask_api import status
from service import app, api
from . import CustomerCollection
<|fim_suffix|> """ Return something usefu... | code_fim | hard | {
"lang": "python",
"repo": "devops-customers-18/customers",
"path": "/service/resources/home_page.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Return something useful by default """
return app.send_static_file('index.html')<|fim_prefix|># repo: devops-customers-18/customers path: /service/resources/home_page.py
"""
This module contains routes without Resources
"""
from flask_restful import Resource
from flask_api import stat... | code_fim | hard | {
"lang": "python",
"repo": "devops-customers-18/customers",
"path": "/service/resources/home_page.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Resource for the Home Page """
def get(self):
""" Return something useful by default """
return app.send_static_file('index.html')<|fim_prefix|># repo: devops-customers-18/customers path: /service/resources/home_page.py
"""
This module contains routes without Resources
"""
fro... | code_fim | medium | {
"lang": "python",
"repo": "devops-customers-18/customers",
"path": "/service/resources/home_page.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chemalot/tOpt path: /tOpt/batch_lbfgs.py
onfs, dtype=torch.int16, device=lbfgs.device)
def filter_(self, fltr:torch.tensor):
self.in_confIdx = self.in_confIdx[fltr]
self.lr = self.lr[fltr]
self.loss = self.loss[fltr]
if self.std is not None: s... | code_fim | hard | {
"lang": "python",
"repo": "chemalot/tOpt",
"path": "/tOpt/batch_lbfgs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
# directional derivative
#gtd = torch.sum(st.flat_grad * st.d, dim=1) # g * d
# no line search, simply move with fixed-step
st.t = self._add_grad(a_coords, st.t, st.d)
if n_iter != self.con... | code_fim | hard | {
"lang": "python",
"repo": "chemalot/tOpt",
"path": "/tOpt/batch_lbfgs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # evaluate initial f(x) and df/dx
loss, std = energy_helper.compute_energy() # loss[nConf]
st = OptState(self, n_total_confs, n_atoms, loss.dtype)
st.loss = loss
st.std = std
min_loss = st.loss.detach().clone()
minE_no_constraints = energ... | code_fim | hard | {
"lang": "python",
"repo": "chemalot/tOpt",
"path": "/tOpt/batch_lbfgs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Create charges for all accounts payable.
"""
#pylint:disable=too-many-nested-blocks
until = datetime_or_now(until)
LOGGER.info("create charges for balance at %s ...", until)
for organization in get_organization_model().objects.filter(
nb_renewal_attempts__lt=set... | code_fim | hard | {
"lang": "python",
"repo": "djaodjin/djaodjin-saas",
"path": "/saas/renewals.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: djaodjin/djaodjin-saas path: /saas/renewals.py
+ relativedelta(months=recognize_period_idx + 1))
LOGGER.debug('process subscription %d %s', subscription.id, subscription)
for order in Transaction.objects.get_subscription_receivable(
subscription, until=until):
# ... | code_fim | hard | {
"lang": "python",
"repo": "djaodjin/djaodjin-saas",
"path": "/saas/renewals.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: djaodjin/djaodjin-saas path: /saas/renewals.py
ECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LI... | code_fim | hard | {
"lang": "python",
"repo": "djaodjin/djaodjin-saas",
"path": "/saas/renewals.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def compare_entries(entries1: Entries, entries2: Entries) -> bool: ...
# def includes_entries(subset_entries: Any, entries: Any): ...
# def excludes_entries(subset_entries: Any, entries: Any): ...<|fim_prefix|># repo: Linusp/fava path: /stubs/beancount/core/compare.pyi
# pylint: disable=missing-docstrin... | code_fim | medium | {
"lang": "python",
"repo": "Linusp/fava",
"path": "/stubs/beancount/core/compare.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Linusp/fava path: /stubs/beancount/core/compare.pyi
# pylint: disable=missing-docstring,unused-argument,multiple-statements
from beancount.core.data import Directive
from beancount.core.data import Entries
<|fim_suffix|>def hash_entries(entries: Entries) -> str: ...
def compare_entries(entries1:... | code_fim | medium | {
"lang": "python",
"repo": "Linusp/fava",
"path": "/stubs/beancount/core/compare.pyi",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vchateauneu/survol path: /Experimental/WindowsPyDbg/hookwin.py
from pefile import *
from hooking import *
from pydbg import *
from pydbg.defines import *
import sys
num_args=4
def create_entry(name):
def hook_entry(dbg,args):
print "\n>> %s" % name
for i in range(num_args):... | code_fim | hard | {
"lang": "python",
"repo": "vchateauneu/survol",
"path": "/Experimental/WindowsPyDbg/hookwin.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print "setting hooks"
hc=hook_container()
for entry in pe.DIRECTORY_ENTRY_IMPORT:
for func in entry.imports:
print 'hook ',func.name," in ",entry.dll
if entry.dll != 'kernel32.dll':
hookadd=dbg.func_resolve_debuggee(entry.dll,func.name)
... | code_fim | medium | {
"lang": "python",
"repo": "vchateauneu/survol",
"path": "/Experimental/WindowsPyDbg/hookwin.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@abstractmethod
def subtrees(self) -> "Iterable<IRootedTree<T>>": pass
@abstractmethod
def tree(self, v: "T") -> "IRootedTree<T>": pass #]rooted<|fim_prefix|># repo: antoniosarosi/algoritmia path: /src/algoritmia/datastructures/trees/interfaces.py
from abc import ABCMeta, abst... | code_fim | hard | {
"lang": "python",
"repo": "antoniosarosi/algoritmia",
"path": "/src/algoritmia/datastructures/trees/interfaces.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: antoniosarosi/algoritmia path: /src/algoritmia/datastructures/trees/interfaces.py
from abc import ABCMeta, abstractproperty, abstractmethod #[rooted
class IRootedTree(metaclass=ABCMeta):
@abstractproperty
def root(self) -> "T": pass
@abstractmethod
def succs(self, v: "T")... | code_fim | hard | {
"lang": "python",
"repo": "antoniosarosi/algoritmia",
"path": "/src/algoritmia/datastructures/trees/interfaces.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@abstractmethod
def preds(self, v: "T") -> "empty Iterable<T> or Iterable<T> with a single item":
pass
@abstractmethod
def in_degree(self, v: "T") -> "0 or 1": pass
@abstractmethod
def out_degree(self, v: "T") -> "int": pass
@abstractmethod
def ... | code_fim | medium | {
"lang": "python",
"repo": "antoniosarosi/algoritmia",
"path": "/src/algoritmia/datastructures/trees/interfaces.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shannonxtreme/DeepReg path: /test/output/test_networks.py
"""
Unit test for special config settings
"""
from deepreg.test_util import train_and_predict_with_config
<|fim_suffix|> # the model outputs predicted label
train_and_predict_with_config(
test_name="unpaired_labeled_nifti... | code_fim | hard | {
"lang": "python",
"repo": "shannonxtreme/DeepReg",
"path": "/test/output/test_networks.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_conditional_network():
# the model outputs predicted label
train_and_predict_with_config(
test_name="unpaired_labeled_nifti_conditional",
config_path=[
"deepreg/config/test/ddf.yaml",
"deepreg/config/test/conditional.yaml",
"deepreg/conf... | code_fim | hard | {
"lang": "python",
"repo": "shannonxtreme/DeepReg",
"path": "/test/output/test_networks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # the model outputs predicted label
train_and_predict_with_config(
test_name="unpaired_labeled_nifti_conditional",
config_path=[
"deepreg/config/test/ddf.yaml",
"deepreg/config/test/conditional.yaml",
"deepreg/config/test/unpaired_nifti.yaml",
... | code_fim | hard | {
"lang": "python",
"repo": "shannonxtreme/DeepReg",
"path": "/test/output/test_networks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # make sure data is intact
assert_read(container, test_msg)
test_msg = 'EXEC_WORKS_AFTER_STOP'
assert_execute(container, test_msg)
rep2 = client.wait_success(replicas[1].stop())
assert rep2.state == 'stopped'
# now controller should be stopped, vo... | code_fim | hard | {
"lang": "python",
"repo": "meldafrawi/longhorn-tests",
"path": "/engine/validation-test/storagetest/core/test_longhorn_basic.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.