text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> return geometry
def sphere_geometry(Rminus, Rplus, Rext, Rpml, Rother, c, delta, hsample, hmax):
geometry = CSGeometry()
o_ext = (Sphere(Pnt(0,0,0), Rext)).bc("outer")
pml = Sphere(Pnt(0,0,0),Rpml)
o_plus = Sphere(Pnt(0,0,0), Rplus).bc("interface")
#This is to define the two clos... | code_fim | hard | {
"lang": "python",
"repo": "irenedet/Maxwell-ATC",
"path": "/mygeometry_1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> geometry.Add ((o_ext - pml).mat("pml"))
geometry.Add ((pml-o_plus).mat("air"))
geometry.Add ((o_plus-o_minus_with_layer).mat("oplus").maxh(hmax))
geometry.Add ((o_minus).mat("ominus").maxh(hmax))
geometry.Add (yes_olayer.mat("olayer").maxh(hmax),bcmod=[(pl1,"crack")])
geometry.... | code_fim | hard | {
"lang": "python",
"repo": "irenedet/Maxwell-ATC",
"path": "/mygeometry_1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: irenedet/Maxwell-ATC path: /mygeometry_1.py
from ngsolve import *
from netgen.csg import *
from ngsolve.internal import *
def ATCerror_brick_geometry(Rminus, Rplus, Rext, Rpml, delta, hmax):
geometry = CSGeometry()
o_ext = (Sphere(Pnt(0,0,0), Rext)).bc("outer")
pml = Sphere(Pnt(0,0,... | code_fim | hard | {
"lang": "python",
"repo": "irenedet/Maxwell-ATC",
"path": "/mygeometry_1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DNLINYJ/Bilibili-Downloader-Python path: /bv_dec_or_enc.py
table='fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF'
tr={}
for i in range(58):
tr[table[i]]=i
s=[11,10,3,8,4,6,2,9,5,7]
xor=177451812
add=100618342136696320
def dec(x):
r=0
for i in range(10):
r+=tr[x[s[i]]]... | code_fim | easy | {
"lang": "python",
"repo": "DNLINYJ/Bilibili-Downloader-Python",
"path": "/bv_dec_or_enc.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def enc(x):
x=(x^xor)+add
r=list('BV ')
for i in range(10):
r[s[i]]=table[x//58**i%58]
return ''.join(r)<|fim_prefix|># repo: DNLINYJ/Bilibili-Downloader-Python path: /bv_dec_or_enc.py
table='fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF'
tr={}
for i in range(58):
tr[... | code_fim | medium | {
"lang": "python",
"repo": "DNLINYJ/Bilibili-Downloader-Python",
"path": "/bv_dec_or_enc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LimitBreaker01/bilibiliupload path: /engine/plugins/__init__.py
import logging
import os
import re
import time
from threading import Event
import psutil
from common.timer import Timer
logger = logging.getLogger('log01')
class BatchCheckBase:
def __init__(self, pattern_id, urls):
se... | code_fim | hard | {
"lang": "python",
"repo": "LimitBreaker01/bilibiliupload",
"path": "/engine/plugins/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(patterns) == 1:
pattern = patterns[0]
match = re.search(pattern, text)
if match:
return match.group(1)
else:
return None
else:
ret = []
for pattern in patterns:
match = re.search(pattern, text)
i... | code_fim | hard | {
"lang": "python",
"repo": "LimitBreaker01/bilibiliupload",
"path": "/engine/plugins/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x, y = self.get_data()
x = x.reshape(x.shape[0], 784)
self.generator, self.discriminator, self.gan = train(self.random_dim, self.random_gen, x, epochs, batch_size)
if to_save:
self.save()
return self.generator, self.discriminator, self.gan
def gener... | code_fim | hard | {
"lang": "python",
"repo": "erickfmm/ML-experiments",
"path": "/test/gan_mnist.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: erickfmm/ML-experiments path: /test/gan_mnist.py
# taken from:
# https://medium.com/sigmoid/a-brief-introduction-to-gans-and-how-to-code-them-2620ee465c30
# https://github.com/sarvasvkulpati/intro_to_gans/blob/master/intro_to_gans.ipynb
import sys
from os.path import dirname, join, abspath
sys.p... | code_fim | hard | {
"lang": "python",
"repo": "erickfmm/ML-experiments",
"path": "/test/gan_mnist.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # We initially set trainable to False since we only want to train either the
# generator or discriminator at a time
discriminator.trainable = False
# gan input (noise) will be 100-dimensional vectors
gan_input = Input(shape=(random_dim,))
# the output of the generator (an image)
... | code_fim | hard | {
"lang": "python",
"repo": "erickfmm/ML-experiments",
"path": "/test/gan_mnist.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> n_row : int
Number of observations
"""
def __init__(self, k=1, x_data):
self.k = k
self.x_data = x_data
self.n_row = data.shape[0]
def _distance(self, new_pt):
"""
Calculate the euclidean distance between a new point and
all pointsin self.data
Parameters
----------
new_pt : np... | code_fim | hard | {
"lang": "python",
"repo": "spitzc32/CropMe",
"path": "/models/regression.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spitzc32/CropMe path: /models/regression.py
import numpy as np
from .utils import euclidean_distance
class LinearRegression():
"""
Definition
----------
To simplify, in Linear regression, we find the correlation
of a given X value then use it to predict our outcome.
Formula
-------
... | code_fim | hard | {
"lang": "python",
"repo": "spitzc32/CropMe",
"path": "/models/regression.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
n_samples = np.size(X, 0)
y = np.hstack((np.ones((n_samples, 1)), (X-np.mean(X, 0)) \
/ np.std(X, 0))) @ self.weights
return y
def get_weight(self):
return self.weights
class KNeighborsRegression():
"""
To simplify, KNeighborsRegression is a algor... | code_fim | hard | {
"lang": "python",
"repo": "spitzc32/CropMe",
"path": "/models/regression.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hadihammurabi/detikcom-scraper path: /engine/__init__.py
from .scraper import get_index, get_berita
from .parser import detikcom as parser
<|fim_suffix|> html_index = get_index(date=opts['date'], page=opts['page'])
parsed_index = parser.parse_index(html_index)
return parsed_index
def get_a... | code_fim | easy | {
"lang": "python",
"repo": "hadihammurabi/detikcom-scraper",
"path": "/engine/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> html_berita = get_berita(url)
parsed_berita = parser.parse_berita(html_berita)
return parsed_berita<|fim_prefix|># repo: hadihammurabi/detikcom-scraper path: /engine/__init__.py
from .scraper import get_index, get_berita
from .parser import detikcom as parser
<|fim_middle|>def get_and_parse_index(... | code_fim | medium | {
"lang": "python",
"repo": "hadihammurabi/detikcom-scraper",
"path": "/engine/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__(parent)
self.setupUi(self)
def setupUi(self, Form):
super().setupUi(Form)
def setMatrix(self, matrix:np.ndarray, names:List[str]):
oldmodel = self.tableView.model()
newmodel = CorrelationCoefficientsModel(matrix, names)
self.tableV... | code_fim | medium | {
"lang": "python",
"repo": "awacha/superfit",
"path": "/src/superfit/correlation/correlation.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: awacha/superfit path: /src/superfit/correlation/correlation.py
from PyQt5 import QtWidgets
from .correlationmodel import CorrelationCoefficientsModel
from .correlation_ui import Ui_Form
import numpy as np
from typing import List
class CorrelationCoefficientsTable(QtWidgets.QWidget, Ui_Form):
<|f... | code_fim | medium | {
"lang": "python",
"repo": "awacha/superfit",
"path": "/src/superfit/correlation/correlation.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eriktaubeneck/foundry path: /tests/base_tests.py
import sys
import unittest
import fudge
from yaml.scanner import ScannerError
from datetime import datetime
from decimal import Decimal
from sqlalchemy.ext.declarative import declarative_base
from tests.models import models_factory
from tests.fudg... | code_fim | hard | {
"lang": "python",
"repo": "eriktaubeneck/foundry",
"path": "/tests/base_tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @fudge.patch(open_function_string)
def test_foundry_default(self, fudged_open):
fudged_open.is_callable().calls(fake_file_factory(fudged_data_files))
self.foundry.load()
fry = self.foundry['fry']
self.assertIsInstance(fry, self.Crew)
self.assertEqual(fry.id,... | code_fim | hard | {
"lang": "python",
"repo": "eriktaubeneck/foundry",
"path": "/tests/base_tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: home-assistant/core path: /tests/components/modem_callerid/__init__.py
"""Tests for the Modem Caller ID integration."""
from unittest.mock import patch
from phone_modem import DEFAULT_PORT
from serial.tools.list_ports_common import ListPortInfo
def patch_init_modem():
"""Mock modem."""
... | code_fim | medium | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/tests/components/modem_callerid/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def com_port():
"""Mock of a serial port."""
port = ListPortInfo(DEFAULT_PORT)
port.serial_number = "1234"
port.manufacturer = "Virtual serial port"
port.device = DEFAULT_PORT
port.description = "Some serial port"
return port<|fim_prefix|># repo: home-assistant/core path: /te... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/tests/components/modem_callerid/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def patch_config_flow_modem():
"""Mock modem config flow."""
return patch(
"homeassistant.components.modem_callerid.config_flow.PhoneModem.test",
)
def com_port():
"""Mock of a serial port."""
port = ListPortInfo(DEFAULT_PORT)
port.serial_number = "1234"
port.manufac... | code_fim | medium | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/tests/components/modem_callerid/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> actual_batch_size = input_img.shape[0]
if use_jitter:
t_loc += torch.randn(actual_batch_size, 2)*jitter_stdev
t_snap = should_snap(t_orient)
input_img, t_loc, t_orient, t_dims, t_snap = input_img.cuda(), t_loc.cuda(), t_orient.cuda(), t_dim... | code_fim | hard | {
"lang": "python",
"repo": "youngmin1324/Smart-Interior",
"path": "/Python/planit-master/scene-synth/orient.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Update D
d_loss = 0.0
# Update G
g_loss = 0.0
# Update E + G (VAE step)
recon_loss = 0.0
kld_loss = 0.0
model.set_requires_grad('VAE', t_cat)
optimizers.g_optimizer(t_cat).zero_grad()
... | code_fim | hard | {
"lang": "python",
"repo": "youngmin1324/Smart-Interior",
"path": "/Python/planit-master/scene-synth/orient.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: youngmin1324/Smart-Interior path: /Python/planit-master/scene-synth/orient.py
et_requires_grad(self.discriminator(cat), False)
set_requires_grad(self.encoder(cat), True)
set_requires_grad(self.cond_prior(cat), True)
set_requires_grad(self.snap_predictor(cat), F... | code_fim | hard | {
"lang": "python",
"repo": "youngmin1324/Smart-Interior",
"path": "/Python/planit-master/scene-synth/orient.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AzmyGansKuy/MusicDownload path: /messages/creator.py
from telegram.utils.helpers import escape_markdown as es
def start_msg(name):
<|fim_suffix|>
def help_msg():
help = """ℹ️⁉⁉ *help*\n
*just send me a jiosaavn song,album or playlist link, I will send you the audio with lyrics*⚡⚡"""
ret... | code_fim | hard | {
"lang": "python",
"repo": "AzmyGansKuy/MusicDownload",
"path": "/messages/creator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def help_msg():
help = """ℹ️⁉⁉ *help*\n
*just send me a jiosaavn song,album or playlist link, I will send you the audio with lyrics*⚡⚡"""
return help<|fim_prefix|># repo: AzmyGansKuy/MusicDownload path: /messages/creator.py
from telegram.utils.helpers import escape_markdown as es
<|fim_middle|... | code_fim | hard | {
"lang": "python",
"repo": "AzmyGansKuy/MusicDownload",
"path": "/messages/creator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print 'tdxy_l_0f3_x= {}'.format(tdxy_l_0f3_x)
print len(tdxy_l_0f3_x)
print 'tdxy_l_0f3_y = {}'.format(tdxy_l_0f3_y)
print len(tdxy_l_0f3_y)
print 'tdxy_r_0f3_x= {}'.format(tdxy_r_0f3_x)
print len(tdxy_r_0f3_x)
print 'tdxy_r_0f3_y = {}'.format(tdxy_r_0f3_y)
print... | code_fim | hard | {
"lang": "python",
"repo": "mahmoud-a-ali/Thesis_Final_FBSSNN",
"path": "/FBSSNN/spin_anmy_TDXY.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mahmoud-a-ali/Thesis_Final_FBSSNN path: /FBSSNN/spin_anmy_TDXY.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 9 17:00:59 2018
@author: mali
"""
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 2 13:09:55 2018
@author: mali
"""
#import time
impo... | code_fim | hard | {
"lang": "python",
"repo": "mahmoud-a-ali/Thesis_Final_FBSSNN",
"path": "/FBSSNN/spin_anmy_TDXY.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sybae/sonatype-nexus-helper path: /main.py
import search_and_delete_component as sd
# Search and Delete Components
def search_and_delete_components():
<|fim_suffix|> search_and_delete_components()
if __name__ == '__main__':
main()<|fim_middle|> sd.init_api_url_search()
s... | code_fim | medium | {
"lang": "python",
"repo": "sybae/sonatype-nexus-helper",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> search_and_delete_components()
if __name__ == '__main__':
main()<|fim_prefix|># repo: sybae/sonatype-nexus-helper path: /main.py
import search_and_delete_component as sd
# Search and Delete Components
def search_and_delete_components():
sd.init_api_url_search()
sd.search_compo... | code_fim | easy | {
"lang": "python",
"repo": "sybae/sonatype-nexus-helper",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
search_and_delete_components()
if __name__ == '__main__':
main()<|fim_prefix|># repo: sybae/sonatype-nexus-helper path: /main.py
import search_and_delete_component as sd
<|fim_middle|># Search and Delete Components
def search_and_delete_components():
sd.init_api_url_... | code_fim | hard | {
"lang": "python",
"repo": "sybae/sonatype-nexus-helper",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># returns total_n_thread, proc_details
def pstree():
n_thread = 0
procs = {} # "pid (comm) pid_ns_id cgroup_ns_id" => n_threads
for n in os.listdir("/proc"):
try:
pid = int(n)
threads = 0
for t in os.listdir("/proc/%d/task" % pid):
... | code_fim | hard | {
"lang": "python",
"repo": "jonsun-zhao/kubelab",
"path": "/apps/pstree/src/pstree.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jonsun-zhao/kubelab path: /apps/pstree/src/pstree.py
#!/usr/bin/env python
#
# IMPORTANT: run this as global root to have access to ns_ids. Without global
# root otherwise pid_ns_id=ns_unknown cgroup_ns_id=cg_ns_unknown. All other
# data, esp cgroup path (aka pod id), will be logged.
#
# This p... | code_fim | hard | {
"lang": "python",
"repo": "jonsun-zhao/kubelab",
"path": "/apps/pstree/src/pstree.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def proc_cgroups(pid):
try:
with open("/proc/%d/cgroup" % pid) as cg:
ret = {}
for line in cg.readlines():
ret[line.strip().split(":")[2]] = True
return ",".join(sorted(ret.keys()))
except:
return "cg_unknown"
def proc_name(pid)... | code_fim | hard | {
"lang": "python",
"repo": "jonsun-zhao/kubelab",
"path": "/apps/pstree/src/pstree.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>* Delete artifact store spa "Cloned_TestArtifact"
* Confirm delete artifact store
* Verify flash message for artifact "The artifact store Cloned_TestArtifact was deleted successfully!"
* Verify if artifact store "Cloned_TestArtifact" is not present
teardown
_______________
* As user "admin" for teardown
... | code_fim | hard | {
"lang": "python",
"repo": "kierarad/ruby-functional-tests",
"path": "/specs/ArtifactStoreSPA.spec",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kierarad/ruby-functional-tests path: /specs/ArtifactStoreSPA.spec
ArtifactStoreSPA
=========
ArtifactStoreSPA
-------------------
tags: artifact-store-spa-foo, spa
Setup of contexts
* External Artifacts Configuration - setup
* Login as "admin" - setup
<|fim_suffix|>* Delete artifact store spa ... | code_fim | hard | {
"lang": "python",
"repo": "kierarad/ruby-functional-tests",
"path": "/specs/ArtifactStoreSPA.spec",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> fields = {
'name': {
'required': True
},
'type-template': {
'required': True,
'valid_value': lambda v: v['type-template'] in [
'open-question',
'closed-question',
'unmatching-answer',
... | code_fim | hard | {
"lang": "python",
"repo": "texttochange/vusion-backend",
"path": "/vusion/persist/template/template.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: texttochange/vusion-backend path: /vusion/persist/template/template.py
from vusion.persist import Model
class Template(Model):
MODEL_TYPE = 'template'
MODEL_VERSION = '1'
<|fim_suffix|> def validate_fields(self):
self._validate(self, self.fields)<|fim_middle|> fi... | code_fim | hard | {
"lang": "python",
"repo": "texttochange/vusion-backend",
"path": "/vusion/persist/template/template.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def validate_fields(self):
self._validate(self, self.fields)<|fim_prefix|># repo: texttochange/vusion-backend path: /vusion/persist/template/template.py
from vusion.persist import Model
class Template(Model):
MODEL_TYPE = 'template'
MODEL_VERSION = '1'
<|fim_middle|> fi... | code_fim | hard | {
"lang": "python",
"repo": "texttochange/vusion-backend",
"path": "/vusion/persist/template/template.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dereyly/mmdet_sota path: /configs/dcn/faster_rcnn_r50_fpn_dpool_1x_coco.py
_base_ = '../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
model = dict(
roi_head=dict(
bbox_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(
_delete_=True,
... | code_fim | hard | {
"lang": "python",
"repo": "dereyly/mmdet_sota",
"path": "/configs/dcn/faster_rcnn_r50_fpn_dpool_1x_coco.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> group_size=1,
trans_std=0.1),
out_channels=256,
featmap_strides=[4, 8, 16, 32])))<|fim_prefix|># repo: dereyly/mmdet_sota path: /configs/dcn/faster_rcnn_r50_fpn_dpool_1x_coco.py
_base_ = '../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
model = dict(
roi_head... | code_fim | hard | {
"lang": "python",
"repo": "dereyly/mmdet_sota",
"path": "/configs/dcn/faster_rcnn_r50_fpn_dpool_1x_coco.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/r-uwot/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package ... | code_fim | hard | {
"lang": "python",
"repo": "JayjeetAtGithub/spack",
"path": "/var/spack/repos/builtin/packages/r-uwot/package.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> version("0.1.11", sha256="4fcf90f1369a2a1f01db9e05a2365b155b2ada8e51e1f7f3ba5122d86affd41b")
version("0.1.10", sha256="6ee1b6027bce679cd5a35f647f516a5b327632234bcf323c7f3d5b5e10807d23")
version("0.1.3", sha256="4936e6922444cae8a71735e945b6bb0828a1012232eb94568054f78451c406d7")
depends_on(... | code_fim | hard | {
"lang": "python",
"repo": "JayjeetAtGithub/spack",
"path": "/var/spack/repos/builtin/packages/r-uwot/package.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_logstart_unicode():
with TemporaryDirectory() as tdir:
logfname = os.path.join(tdir, "test_unicode.log")
_ip.run_cell("'abc€'")
try:
_ip.magic("logstart -to %s" % logfname)
_ip.run_cell("'abc€'")
finally:
_ip.logger.logstop()... | code_fim | medium | {
"lang": "python",
"repo": "ipython/ipython",
"path": "/IPython/core/tests/test_logger.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ipython/ipython path: /IPython/core/tests/test_logger.py
# -*- coding: utf-8 -*-
"""Test IPython.core.logger"""
import os.path
import pytest
from tempfile import TemporaryDirectory
<|fim_suffix|> try:
_ip.run_cell("a=1") # Check it doesn't try to log this
finall... | code_fim | medium | {
"lang": "python",
"repo": "ipython/ipython",
"path": "/IPython/core/tests/test_logger.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> with pytest.raises(IOError):
_ip.logger.logstart(logfname="/") # Opening that filename will fail.
try:
_ip.run_cell("a=1") # Check it doesn't try to log this
finally:
_ip.logger.log_active = False # If this fails, don't let later tests fail
def test... | code_fim | medium | {
"lang": "python",
"repo": "ipython/ipython",
"path": "/IPython/core/tests/test_logger.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> namespace:
- main
- webshell
"""
namespace = namespace if namespace else gget("namespace")
plugin_name = str(plugin_name)
pf = gget(f"{namespace}.pf")
gpf = gget(f"general.pf")
if (plugin_name in gpf):
pf = gpf
namespace = "general"
if(pf.load(plug... | code_fim | medium | {
"lang": "python",
"repo": "kodosan/Doughnuts",
"path": "/doughnuts/general/reload.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kodosan/Doughnuts path: /doughnuts/general/reload.py
from libs.config import alias, gget, color
@alias(True, p="plugin_name", n="namespace")
def run(plugin_name: str, namespace: str = ""):
"""
reload
<|fim_suffix|> namespace:
- main
- webshell
"""
namespace = names... | code_fim | medium | {
"lang": "python",
"repo": "kodosan/Doughnuts",
"path": "/doughnuts/general/reload.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tony-sappe/usaspending-api path: /usaspending_api/etl/elasticsearch_loader_helpers/aggregate_key_functions.py
import json
import logging
from typing import Optional, List
logger = logging.getLogger("script")
def award_recipient_agg_key(record: dict) -> str:
"""Dictionary key order impact... | code_fim | hard | {
"lang": "python",
"repo": "tony-sappe/usaspending-api",
"path": "/usaspending_api/etl/elasticsearch_loader_helpers/aggregate_key_functions.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def pop_congressional_agg_key(record: dict) -> Optional[str]:
return _congressional_agg_key("pop", record)
def recipient_location_congressional_agg_key(record: dict) -> Optional[str]:
return _congressional_agg_key("recipient_location", record)
def _congressional_agg_key(location_type, record: ... | code_fim | hard | {
"lang": "python",
"repo": "tony-sappe/usaspending-api",
"path": "/usaspending_api/etl/elasticsearch_loader_helpers/aggregate_key_functions.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: panernie/Swarm-CG path: /swarmcg/optimize_model.py
f, ns.bins_angles[np.min(np.nonzero(angle_hist))]), max(-np.inf, ns.bins_angles[np.max(np.nonzero(angle_hist))+1])
xmin, xmax = xmin+ns.bw_angles/2, xmax-ns.bw_angles/2
ns.data_BI['angle'].append([np.histogram(angle_values_rad, ra... | code_fim | hard | {
"lang": "python",
"repo": "panernie/Swarm-CG",
"path": "/swarmcg/optimize_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: panernie/Swarm-CG path: /swarmcg/optimize_model.py
': int(5+np.sqrt(ns.nb_constraints+ns.nb_bonds+ns.nb_angles)), 'max_swarm_iter_without_new_global_best': 5, 'val_guess_fact': 1, 'fct_guess_fact': 0.35},
# 1: {'sim_duration': 10, 'max_swarm_iter': int(5+np.sqrt(ns.nb_angles+ns.nb_dihe... | code_fim | hard | {
"lang": "python",
"repo": "panernie/Swarm-CG",
"path": "/swarmcg/optimize_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sim_filenames_args = args_parser.add_argument_group(bullet + 'CG MODEL OPTIMIZATION')
sim_filenames_args.add_argument('-cg_itp', dest='cg_itp_filename',
help='ITP file of the CG model to optimize', type=str,
default=config.metavar... | code_fim | hard | {
"lang": "python",
"repo": "panernie/Swarm-CG",
"path": "/swarmcg/optimize_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: georkap/faster-rcnnwv.pytorch path: /test_net_det.py
# --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Jiasen Lu, Jianwei Yang, based on code from Ross Girshick
# ---------------------------... | code_fim | hard | {
"lang": "python",
"repo": "georkap/faster-rcnnwv.pytorch",
"path": "/test_net_det.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('Called with args:')
print(args)
if torch.cuda.is_available() and not args.cuda:
print("WARNING: You have a CUDA device, so you should probably run with --cuda")
np.random.seed(cfg.RNG_SEED)
if args.dataset == "pascal_voc":
args.imdb_name = "voc_2007_trainval"
args.imdbva... | code_fim | hard | {
"lang": "python",
"repo": "georkap/faster-rcnnwv.pytorch",
"path": "/test_net_det.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YqGao716/ClusterRouting path: /src/utils.py
from __future__ import print_function
import numpy as np
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader, Dataset
def train(args, model, device, train_loader, optimizer, epoch):
model.train()
corre... | code_fim | hard | {
"lang": "python",
"repo": "YqGao716/ClusterRouting",
"path": "/src/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class CustomDataset(Dataset):
""" Creates a custom pytorch dataset, mainly
used for creating validation set splits. """
def __init__(self, data, labels, transform=None):
# shuffle the dataset
idx = np.random.permutation(data.shape[0])
if isinstance(data, torch... | code_fim | hard | {
"lang": "python",
"repo": "YqGao716/ClusterRouting",
"path": "/src/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def invoke(self, context, event):
if context.space_data.type == 'VIEW_3D':
context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'}
else:
self.report({'WARNING'}, "Active space must be a View3d")
return {'CANCELLED'}
def ... | code_fim | hard | {
"lang": "python",
"repo": "byteinc/Phasor",
"path": "/engine/2.80/scripts/templates_py/operator_modal_view3d_raycast.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: byteinc/Phasor path: /engine/2.80/scripts/templates_py/operator_modal_view3d_raycast.py
import bpy
from bpy_extras import view3d_utils
def main(context, event):
"""Run this function on left mouse, execute the ray cast"""
# get the context arguments
scene = context.scene
region =... | code_fim | hard | {
"lang": "python",
"repo": "byteinc/Phasor",
"path": "/engine/2.80/scripts/templates_py/operator_modal_view3d_raycast.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bluttringer/advent-of-code-2020-python path: /day13/day13-part2.py
data = open('day13/input.data').readlines()
time = int(data[0])
<|fim_suffix|>timeToAdd = 1
for index, busId in enumerate(busIds):
print('timeToAdd :', timeToAdd)
if busId != 'x':
while (timestamp + index) % int... | code_fim | medium | {
"lang": "python",
"repo": "bluttringer/advent-of-code-2020-python",
"path": "/day13/day13-part2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>timestamp = 0
#timestamp=0
DEBUG = False
timeToAdd = 1
lastMatchingTimestampCount = 0
timeToAdd = 1
for index, busId in enumerate(busIds):
print('timeToAdd :', timeToAdd)
if busId != 'x':
while (timestamp + index) % int(busId) != 0:
timestamp += timeToAdd
timeToAdd *= ... | code_fim | medium | {
"lang": "python",
"repo": "bluttringer/advent-of-code-2020-python",
"path": "/day13/day13-part2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # rejection sampling to ensure object stays in field of vision for at least self.min_visible_steps steps
while self.pos + self.vel * self.min_visible_steps > 1.0 or self.pos + self.vel * self.min_visible_steps < 0.0:
if isinstance(self.vel_dist, torch.distributions.Distribution):
self.vel = sel... | code_fim | hard | {
"lang": "python",
"repo": "Riley16/vis1d",
"path": "/env/env1D.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def reset(self):
super(Rigid1D, self).reset()
# rejection sampling to ensure object stays in field of vision for at least self.min_visible_steps steps
while self.pos + self.vel * self.min_visible_steps > 1.0 or self.pos + self.vel * self.min_visible_steps < 0.0:
if isinstance(self.vel_dist, tor... | code_fim | hard | {
"lang": "python",
"repo": "Riley16/vis1d",
"path": "/env/env1D.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Riley16/vis1d path: /env/env1D.py
import torch
from torch import nn
from torch.distributions import normal
Normal = normal.Normal
from torch.distributions import uniform
Uniform = uniform.Uniform
import numpy as np
import math
import pdb
import matplotlib.pyplot as plt
class Env1DObject:
def _... | code_fim | hard | {
"lang": "python",
"repo": "Riley16/vis1d",
"path": "/env/env1D.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> acc_value = self.entity.descriptors.get(descriptor.name)
src_value = descriptors.get(descriptor.name)
merged_value = src_value if src_defined else acc_value
# valid the new value
if src_defined and src_value is not None:
... | code_fim | hard | {
"lang": "python",
"repo": "coll-gate/collgate",
"path": "/server/descriptor/describable.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: coll-gate/collgate path: /server/descriptor/describable.py
# -*- coding: utf-8; -*-
#
# @file describable.py
# @brief coll-gate descriptor module, descriptor
# @author Frédéric SCHERMA (INRA UMR1095)
# @date 2016-09-01
# @copyright Copyright (c) 2016 INRA/CIRAD
# @license MIT (see LICENSE file)
#... | code_fim | hard | {
"lang": "python",
"repo": "coll-gate/collgate",
"path": "/server/descriptor/describable.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luci/recipes-py path: /recipe_engine/internal/stream/luci.py
# -*- coding: utf-8 -*-
# Copyright 2019 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import json
import logging
import trac... | code_fim | hard | {
"lang": "python",
"repo": "luci/recipes-py",
"path": "/recipe_engine/internal/stream/luci.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@attr.s
class LUCIStreamEngine(StreamEngine):
"""Implementation of StreamEngine for luciexe mode.
Holds a LogDog datagram stream for Build messages and manages writes to this
stream.
"""
# This causes the 'build.proto' datagram stream to export as JSONPB instead of
# Binary PB. Only used fo... | code_fim | hard | {
"lang": "python",
"repo": "luci/recipes-py",
"path": "/recipe_engine/internal/stream/luci.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>tgt_carn_density = [carn_density[animal.name] for animal in species_carn]
region_surplus = (region_pop.T * [sp.surplus * np.mean(sp.mass) for sp in species_herb]).T / 365.0
carn_herds = np.empty((len(species_carn), len(regions)), dtype=list)
carn_pop = np.zeros((len(species_carn), len(regions)))
carn_coun... | code_fim | hard | {
"lang": "python",
"repo": "PeterZhouSZ/authoring-consistent-landscapes",
"path": "/fauna.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PeterZhouSZ/authoring-consistent-landscapes path: /fauna.py
kernel[1,1] = 0
kernel_idx = np.vstack(np.where(kernel)[::-1]).T-1
neighbs = np.zeros(ma.shape, dtype=int)
for x, y in kernel_idx:
neighbs[0+(y<0):szh-(y>0), 0+(x<0):szw-(x>0)] += ma[0+(y>0):szh-(y<0), 0+(x>0):szw-(x<0)]
neighbs *= ... | code_fim | hard | {
"lang": "python",
"repo": "PeterZhouSZ/authoring-consistent-landscapes",
"path": "/fauna.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PeterZhouSZ/authoring-consistent-landscapes path: /fauna.py
continue
drinks[0+(y<0):szh-(y>0), 0+(x<0):szw-(x>0)] += (water[0+(y>0):szh-(y<0), 0+(x>0):szw-(x<0)] != 0)
drinks *= (accessibility >= 0)
# Compute closest ellipses for each of the pixels near water
contact_where = np.where(... | code_fim | hard | {
"lang": "python",
"repo": "PeterZhouSZ/authoring-consistent-landscapes",
"path": "/fauna.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: groboclown/petronia path: /old_stuff/petronia/cmd.py
# Same as `main.py`, but waits for user input.
# Allows for a "graceful" exit if the quit key isn't working.
from petronia.util import worker_thread
<|fim_suffix|> from petronia import main
bus = main.main_setup(arguments)
def stop(... | code_fim | easy | {
"lang": "python",
"repo": "groboclown/petronia",
"path": "/old_stuff/petronia/cmd.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def start_wait_stop(arguments):
start(arguments)
sys.stdin.read(1)
stop()
if __name__ == '__main__':
start_wait_stop(sys.argv)<|fim_prefix|># repo: groboclown/petronia path: /old_stuff/petronia/cmd.py
# Same as `main.py`, but waits for user input.
# Allows for a "graceful" exit if the... | code_fim | medium | {
"lang": "python",
"repo": "groboclown/petronia",
"path": "/old_stuff/petronia/cmd.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ferringb/pkgcheck path: /tests/checks/test_acct.py
from pkgcheck.checks import acct
from pkgcore.test.misc import FakeRepo
from snakeoil.cli import arghparse
from .. import misc
class TestAcctUser(misc.ReportTestCase):
check_kls = acct.AcctCheck
kind = 'user'
def mk_check(self, ... | code_fim | hard | {
"lang": "python",
"repo": "ferringb/pkgcheck",
"path": "/tests/checks/test_acct.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_unmatching_pkgs(self):
pkgs = (misc.FakePkg('dev-util/foo-0'),
misc.FakePkg('dev-util/bar-1'))
check = self.mk_check(pkgs)
self.assertNoReport(check, pkgs)
def test_correct_ids(self):
pkgs = (self.mk_pkg('foo', 100),
self.mk... | code_fim | hard | {
"lang": "python",
"repo": "ferringb/pkgcheck",
"path": "/tests/checks/test_acct.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mrshahzl/IreneUtility path: /IreneUtility/util/u_gacha.py
from ..Base import Base
from . import u_logger as log
import random
import math
from scipy.special import erf, erfinv
# noinspection SpellCheckingInspection
class Gacha(Base):
def __init__(self, *args):
super().__init__(*args... | code_fim | hard | {
"lang": "python",
"repo": "mrshahzl/IreneUtility",
"path": "/IreneUtility/util/u_gacha.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def random_skill_score(self, card_rarity):
"""Return a random skill score for rap/dance/vocal for the gacha card between 1 and 99
dependent on the rarity of the card."""
if card_rarity == "common":
random.randint(1, 20)
elif card_rarity == "uncommon":
... | code_fim | hard | {
"lang": "python",
"repo": "mrshahzl/IreneUtility",
"path": "/IreneUtility/util/u_gacha.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
parser.parse(options['filename'], limit=limit)
except ImportError as e:
raise CommandError(e)
if verbosity >= 1 and parser.warnings or verbosity >= 2:
self.stdout.write(parser.report())<|fim_prefix|># repo: GeotrekCE/Geotrek-admin path: /g... | code_fim | hard | {
"lang": "python",
"repo": "GeotrekCE/Geotrek-admin",
"path": "/geotrek/common/management/commands/import.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GeotrekCE/Geotrek-admin path: /geotrek/common/management/commands/import.py
import importlib
from os.path import join
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from geotrek.common.parsers import ImportError
class Command(BaseCommand):
... | code_fim | hard | {
"lang": "python",
"repo": "GeotrekCE/Geotrek-admin",
"path": "/geotrek/common/management/commands/import.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> tips = []
def get_tip():
if len(tips) == 0:
tips.extend(get_tips())
return tips.pop()
@bot.respond(r'frog(?: me)?')
def frogs(response):
try:
tip = get_tip()
response.send('TIP #%d: %s' % (tip['number'], tip['tip'],))
e... | code_fim | medium | {
"lang": "python",
"repo": "smarkets/hal",
"path": "/plugins/frogtips.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: smarkets/hal path: /plugins/frogtips.py
import requests
__commands__ = '''
hal (frog) [me] - shows a random frog tip
'''
<|fim_suffix|> try:
tip = get_tip()
response.send('TIP #%d: %s' % (tip['number'], tip['tip'],))
except requests.exceptions.Request... | code_fim | hard | {
"lang": "python",
"repo": "smarkets/hal",
"path": "/plugins/frogtips.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, name):
self.name = name
self.cached_possible_values = None
def evaluate(self, ctx):
return ctx.extras['match_possible_values'][self.name]
class constant(query):
def __init__(self, name):
self.name = name
def evaluate(self, ctx):
... | code_fim | hard | {
"lang": "python",
"repo": "uogbuji/versa",
"path": "/tools/py/query/miniast.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uogbuji/versa path: /tools/py/query/miniast.py
#versa.query.ast
from versa.util import column
class query(object):
'Versa query language abstract syntax tree expression instance'
pass
class conjunction(query):
def __init__(self, left, right):
self.left = left
self.... | code_fim | hard | {
"lang": "python",
"repo": "uogbuji/versa",
"path": "/tools/py/query/miniast.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def evaluate(self, ctx):
if self.name == '?':
#It's the match function
passed_args = [ ctx.matchvars.get(a.name) if isinstance(a, variable) else (None if a == '*' else a) if isinstance(a, str) else a.evaluate(ctx) for a in self.arglist ]
#passed_args = [ Non... | code_fim | hard | {
"lang": "python",
"repo": "uogbuji/versa",
"path": "/tools/py/query/miniast.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bbcawodu/careadvisors-backend path: /picbackend/views/v2/provider_plan_network_views/plans_views/tools/create_update_delete.py
validate_update_row_params(rqst_body, validated_params, rqst_errors)
elif rqst_action == 'delete':
validated_params['rqst_id'] = clean_int_value_from_d... | code_fim | hard | {
"lang": "python",
"repo": "bbcawodu/careadvisors-backend",
"path": "/picbackend/views/v2/provider_plan_network_views/plans_views/tools/create_update_delete.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> copay_string_list = re.findall("\$\d+", cost_string_fragment)
no_of_copays = len(copay_string_list)
if no_of_copays == 1:
copay_numbers = re.findall("\d+", copay_string_list[0])
no_of_copay_numbers = len(copay_numbers)... | code_fim | hard | {
"lang": "python",
"repo": "bbcawodu/careadvisors-backend",
"path": "/picbackend/views/v2/provider_plan_network_views/plans_views/tools/create_update_delete.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if "specialist_standard_cost" in rqst_body:
rqst_specialist_standard_cost = create_healthcare_service_cost_instances_from_string(
clean_string_value_from_dict_object(
rqst_body,
"root",
"specialist_standard_cost",
rqst... | code_fim | hard | {
"lang": "python",
"repo": "bbcawodu/careadvisors-backend",
"path": "/picbackend/views/v2/provider_plan_network_views/plans_views/tools/create_update_delete.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> inter = pyvips.Interpolator.new('bicubic')
You can get a list of all supported interpolators from the command-line
with::
$ vips -l interpolate
See for example :meth:`.affine`.
"""
# logger.debug('VipsInterpolate.new: name = %s', name)
... | code_fim | hard | {
"lang": "python",
"repo": "libvips/pyvips",
"path": "/pyvips/vinterpolate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: libvips/pyvips path: /pyvips/vinterpolate.py
from __future__ import division
import pyvips
from pyvips import ffi, vips_lib, Error, _to_bytes
# import logging
# logger = logging.getLogger(__name__)
class Interpolate(pyvips.VipsObject):
"""Make interpolators for operators like :meth:`.affi... | code_fim | medium | {
"lang": "python",
"repo": "libvips/pyvips",
"path": "/pyvips/vinterpolate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Gaming = Blog.query.filter_by(category="Gaming").all()
Career = Blog.query.filter_by(category="Career").all()
Finance = Blog.query.filter_by(category="Finance").all()
Gossip = Blog.query.filter_by(category="Gossip").all()
Sports = Blog.query.filter_by(category="Sports").all()
Fitne... | code_fim | hard | {
"lang": "python",
"repo": "brayomumo/Blog",
"path": "/app/main/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brayomumo/Blog path: /app/main/views.py
from flask import render_template,request,redirect,url_for,abort
from flask_login import login_required,current_user
from . import main
from .. import db,photos
from ..request import get_quote
from ..models import User,Role,Blog,Comment
from .forms import U... | code_fim | hard | {
"lang": "python",
"repo": "brayomumo/Blog",
"path": "/app/main/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> blog_title= blog_form.blog_title.data
blog_description= blog_form.blog_description.data
story= blog_form.story.data
category= blog_form.category.data
# Updated instance
new_blog = Blog(blog_title=blog_title,blog_description=blog_description,story=story,cat... | code_fim | hard | {
"lang": "python",
"repo": "brayomumo/Blog",
"path": "/app/main/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # arrange
args = test.testutils.create_dummy_args()
# act
testee = TestData(args, X28_HTML)
# assert
assert_that(count_items(testee), is_(0))
assert_that(len(testee), is_(0))
assert_that(testee.row_from(), is_(train_data_count))
asser... | code_fim | medium | {
"lang": "python",
"repo": "tiefenauer/ip7-python",
"path": "/systemtest/test_TestData.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tiefenauer/ip7-python path: /systemtest/test_TestData.py
import unittest
from hamcrest import assert_that, is_
from pony.orm import db_session
import test.testutils
from src.database.test_data import TestData
from src.database.entities_pg import X28_HTML
from test import testutils
<|fim_suffix... | code_fim | hard | {
"lang": "python",
"repo": "tiefenauer/ip7-python",
"path": "/systemtest/test_TestData.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def count_items(testee):
return sum(1 for item in testee)
class TestTestData(unittest.TestCase):
def test_no_split_returns_no_rows(self):
# arrange
args = test.testutils.create_dummy_args()
# act
testee = TestData(args, X28_HTML)
# assert
assert_th... | code_fim | medium | {
"lang": "python",
"repo": "tiefenauer/ip7-python",
"path": "/systemtest/test_TestData.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anae09/electionWebService path: /applications/migrate.py
from flask import Flask;
from configuration import Configuration;
from flask_migrate import Migrate, init, migrate, upgrade;
from models import database;
from sqlalchemy_utils import database_exists, create_database;
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "anae09/electionWebService",
"path": "/applications/migrate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>done = False;
while not done:
try:
if not database_exists(application.config["SQLALCHEMY_DATABASE_URI"]):
create_database(application.config["SQLALCHEMY_DATABASE_URI"]);
database.init_app(application);
with application.app_context() as context:
init()... | code_fim | medium | {
"lang": "python",
"repo": "anae09/electionWebService",
"path": "/applications/migrate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for filename in os.listdir('.'):
if os.path.isdir(filename):
try:
os.remove(os.path.join(filename, 'x.gcno'))
except FileNotFoundError:
pass
try:
os.remove(os.path.join(filename, 'x.gcda'))
except F... | code_fim | hard | {
"lang": "python",
"repo": "quark-zju/cov",
"path": "/cov/test-data/rebuild.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quark-zju/cov path: /cov/test-data/rebuild.py
#!/usr/bin/env python3
import subprocess
import os
import os.path
import sys
import collections
import shutil
Builder = collections.namedtuple('Builder', ['ext', 'cmd', 'gcov'])
BUILDERS = {
'.gcc7': Builder(
ext='.cpp',
cmd=['g... | code_fim | hard | {
"lang": "python",
"repo": "quark-zju/cov",
"path": "/cov/test-data/rebuild.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.