text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: lixinli123/pycrunch-trace path: /pycrunch_trace/tracing/tests/test_file_map.py
from pycrunch_trace.events.method_enter import MethodEnterEvent, ExecutionCursor, StackFrame, MethodExitEvent
from pycrunch_trace.tracing.file_map import FileMap
def test_file_id():
sut = FileMap()
assert 1 =... | code_fim | medium | {
"lang": "python",
"repo": "lixinli123/pycrunch-trace",
"path": "/pycrunch_trace/tracing/tests/test_file_map.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if DEBUG:
with open(TESTCASE) as f:
lines = f.readlines()
else:
lines = sys.stdin.readlines()
d = {}
for line in lines:
k, v = line.strip('\n').split(' ')
d[int(v)] = k
return d
if __name__=='__main__':
d = parse()
findpair(d,... | code_fim | medium | {
"lang": "python",
"repo": "anilpai/paxos",
"path": "/02_Programming/find_pair.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anilpai/paxos path: /02_Programming/find_pair.py
import sys
DEBUG = 1
TESTCASE = 'input_file.txt'
def findpair(d, some_value):
for k in d.keys():
if some_value-k in d:
print(d[some_value-k], some_value-k, ',', d[k], k)
return
<|fim_suffix|> if DEBUG:
... | code_fim | medium | {
"lang": "python",
"repo": "anilpai/paxos",
"path": "/02_Programming/find_pair.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: getkeops/keops path: /keopscore/keopscore/formulas/maths/Scalprod.py
from keopscore.formulas.Chunkable_Op import Chunkable_Op
from keopscore.formulas.maths.Sum import Sum
from keopscore.utils.code_gen_utils import (
c_zero_float,
VectApply,
)
from keopscore.utils.math_functions import keo... | code_fim | hard | {
"lang": "python",
"repo": "getkeops/keops",
"path": "/keopscore/keopscore/formulas/maths/Scalprod.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return out.assign(keops_fma(arga, argb, out))
def DiffT(self, v, gradin):
fa, fb = self.children
return gradin * (fa.DiffT(v, fb) + fb.DiffT(v, fa))
def initacc_chunk(self, acc):
return f"*{acc.id} = 0.0f;\n"
def acc_chunk(self, acc, out):
return f"*{... | code_fim | medium | {
"lang": "python",
"repo": "getkeops/keops",
"path": "/keopscore/keopscore/formulas/maths/Scalprod.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmartzol/axi path: /axi/drawing.py
from __future__ import division
from math import sin, cos, radians, hypot
from .paths import (
simplify_paths, sort_paths, join_paths, crop_paths, convex_hull,
expand_quadratics, paths_length)
try:
import cairocffi as cairo
except ImportError:
... | code_fim | hard | {
"lang": "python",
"repo": "dmartzol/axi",
"path": "/axi/drawing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return Drawing(crop_paths(self.paths, x1, y1, x2, y2))
# def remove_duplicates(self):
# return Drawing(util.remove_duplicates(self.paths))
def add(self, drawing):
self.paths.extend(drawing.paths)
self.dirty()
def transform(self, func):
return Drawing(... | code_fim | hard | {
"lang": "python",
"repo": "dmartzol/axi",
"path": "/axi/drawing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: open-mmlab/mmpretrain path: /mmpretrain/models/multimodal/flamingo/__init__.py
# Copyright (c) OpenMMLab. All rights re<|fim_suffix|>all__ = ['Flamingo', 'FlamingoLMAdapter']<|fim_middle|>served.
from .adapter import FlamingoLMAdapter
from .flamingo import Flamingo
__ | code_fim | medium | {
"lang": "python",
"repo": "open-mmlab/mmpretrain",
"path": "/mmpretrain/models/multimodal/flamingo/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>apter
from .flamingo import Flamingo
__all__ = ['Flamingo', 'FlamingoLMAdapter']<|fim_prefix|># repo: open-mmlab/mmpretrain path: /mmpretrain/models/multimodal/flamingo/__init__.py
# Copyright (c) OpenMMLab. All rights re<|fim_middle|>served.
from .adapter import FlamingoLMAd | code_fim | easy | {
"lang": "python",
"repo": "open-mmlab/mmpretrain",
"path": "/mmpretrain/models/multimodal/flamingo/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xjwanglab/book path: /boucher2007/boucher2007.py
# -*- coding: utf-8 -*-
"""
Example code for a race model for countermanding saccade task
Reference:
Boucher, Leanne, et al.
"Inhibitory control in mind and brain: an interactive race model of countermanding saccades."
Psychological review 114.2 (... | code_fim | hard | {
"lang": "python",
"repo": "xjwanglab/book",
"path": "/boucher2007/boucher2007.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Parameters from fit for Monkey A independent race model (Boucher 2007)
params = dict(
tau = 1,
k = 0, # Leakage
threshold = 1000, # response threshold
mu_go = 5.09,
sigma_go = 26.38,
mu_stop = 50.24,
sigma_stop = 40.17,
beta_go = 0., ... | code_fim | hard | {
"lang": "python",
"repo": "xjwanglab/book",
"path": "/boucher2007/boucher2007.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='startup',
name='acknowledgement',
field=models.BooleanField(
blank=True,
default=False,
help_text=ACKNOWLEDGEMENT_HELP_TEXT,
),
),
m... | code_fim | hard | {
"lang": "python",
"repo": "masschallenge/django-accelerator",
"path": "/accelerator/migrations/0096_remove_nullable_option_on_startup_boolean_fields.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: masschallenge/django-accelerator path: /accelerator/migrations/0096_remove_nullable_option_on_startup_boolean_fields.py
# Generated by Django 2.2.27 on 2022-04-01 14:06
from django.db import (
migrations,
models,
)
ACKNOWLEDGEMENT_HELP_TEXT = (
'I understand that my Startup Profile i... | code_fim | hard | {
"lang": "python",
"repo": "masschallenge/django-accelerator",
"path": "/accelerator/migrations/0096_remove_nullable_option_on_startup_boolean_fields.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anniyanvr/anchore-engine path: /anchore_engine/services/policy_engine/engine/vulns/cpes.py
import re
import typing
from typing import List, Tuple
from anchore_engine.common import os_package_types
from anchore_engine.db.entities.policy_engine import ImageCpe, ImagePackage
def compare_fields(lh... | code_fim | hard | {
"lang": "python",
"repo": "anniyanvr/anchore-engine",
"path": "/anchore_engine/services/policy_engine/engine/vulns/cpes.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # build a hash with vulnerability as the key mapped to a unique set of packages
dedup_hash = dict()
for image_cpe, vuln_cpe in image_vuln_tuples:
# construct key that ties vulnerability and package - a unique indicator for the vulnerability affecting a package
vuln_pkg_key = ... | code_fim | hard | {
"lang": "python",
"repo": "anniyanvr/anchore-engine",
"path": "/anchore_engine/services/policy_engine/engine/vulns/cpes.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cheery/lever path: /runtime/space/setobject.py
from builtin import signature
from interface import Object, null
from listobject import List
from numbers import Integer
from rpython.rlib.objectmodel import compute_hash, r_dict
from rpython.rlib.rarithmetic import intmask, r_uint
import space
def ... | code_fim | hard | {
"lang": "python",
"repo": "cheery/lever",
"path": "/runtime/space/setobject.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@Set.method(u"difference", signature(Set, variadic=True))
def Set_difference(self, argv):
this = Set()
this._set.update(self._set)
Set_difference_update(this, argv)
return this
@Set.method(u"symmetric_difference", signature(Set, Object))
def Set_symmetric_difference(self, arg):
this =... | code_fim | hard | {
"lang": "python",
"repo": "cheery/lever",
"path": "/runtime/space/setobject.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@Set.method(u"difference_update", signature(Set, variadic=True))
def Set_difference_update(self, argv):
for arg in argv:
it = arg.iter()
try:
while True:
item = it.callattr(u"next", [])
try:
del self._set[item]
... | code_fim | hard | {
"lang": "python",
"repo": "cheery/lever",
"path": "/runtime/space/setobject.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Affiche deux boutons permettant de choisir son mode de
difficulté.
'''
a=True
while a:
if var >= 8:
var = 8
elif var <= 1:
var = 1
rectangle(410,y,437,y+17,'black','#A9A9A9')
rectangle(410,y+23,437,y+40,'black','#A9A9A9')
... | code_fim | hard | {
"lang": "python",
"repo": "branyoto-etud/snake",
"path": "/python/snake.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: branyoto-etud/snake path: /python/snake.py
')
rectangle(410,y+23,437,y+40,'black','#A9A9A9')
fleche(424,y+20,424,y+5,'black',2)
fleche(424,y+30,424,y+35,'black',2)
rectangle(445,y,472,y+17,'black','#A9A9A9')
rectangle(445,y+23,472,y+40,'black','#A9A9A9')
... | code_fim | hard | {
"lang": "python",
"repo": "branyoto-etud/snake",
"path": "/python/snake.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Pareil que les pommes.
'''
for x in murs:
affiche_mur(x,couleur)
def affiche_mur(mur,couleur):
'''
Affiche un mur.
'''
x, y = case_vers_pixel(mur)
a = L[3][0]/2
rectangle(x-a,y-a,x+a,y+a,couleur,couleur)
def limitation_de_vitesse(f): #Limite ... | code_fim | hard | {
"lang": "python",
"repo": "branyoto-etud/snake",
"path": "/python/snake.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def get_tone(diatonic_tone_text):
"""
Fetch a cached diatonic tone based on text representation.
Args:
diatonic_tone_text: text specification, e.g. Abb
Returns:
DiatonicTone for specified pitch
... | code_fim | hard | {
"lang": "python",
"repo": "dpazel/music_rep",
"path": "/tonalmodel/diatonic_foundation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Fetch a cached diatonic tone based on text representation.
Args:
diatonic_tone_text: text specification, e.g. Abb
Returns:
DiatonicTone for specified pitch
Exceptions:
If specified pitch cannot be pars... | code_fim | hard | {
"lang": "python",
"repo": "dpazel/music_rep",
"path": "/tonalmodel/diatonic_foundation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dpazel/music_rep path: /tonalmodel/diatonic_foundation.py
"""
File: diatonic_foundation.py
Purpose: Class defining diatonic foundation, a static class that ties the diatonic pitches to the chromatic scale.
"""
from tonalmodel.chromatic_scale import ChromaticScale
from tonalmodel.diatonic_tone i... | code_fim | hard | {
"lang": "python",
"repo": "dpazel/music_rep",
"path": "/tonalmodel/diatonic_foundation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_chrome_manager_with_selenium():
driver_path = ChromeDriverManager().install()
driver = webdriver.Chrome(driver_path)
driver.get("http://automation-remarks.com")
driver.close()
def test_driver_with_ssl_verify_disabled_can_be_downloaded(ssl_verify_enable):
os.environ['WDM_SSL_... | code_fim | hard | {
"lang": "python",
"repo": "aleksandr-kotlyar/webdriver_manager",
"path": "/tests/test_chrome_driver.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aleksandr-kotlyar/webdriver_manager path: /tests/test_chrome_driver.py
import json
import os
import pytest
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.core.constants import ROOT_FOLDER_NAME
def test_chrome_manager_with_cache(d... | code_fim | hard | {
"lang": "python",
"repo": "aleksandr-kotlyar/webdriver_manager",
"path": "/tests/test_chrome_driver.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>async def echo_handler(client):
with client:
while True:
data = await loop.sock_recv(client, 1024)
if not data:
break
await loop.sock_sendall(client, b'Got:'+data)
print('Connection closed')
loop.create_task(echo_server(('',25000)))
loo... | code_fim | hard | {
"lang": "python",
"repo": "chyidl/chyidlTutorial",
"path": "/root/python/PythonPyCon/Threads_Asyncio/pecho.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chyidl/chyidlTutorial path: /root/python/PythonPyCon/Threads_Asyncio/pecho.py
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from socket import *
import play
# Returns an event loop object implementing the AbstractEventLoop
loop = play.Loop()
<|fim_suffix|>
async def echo_handler(client):
wi... | code_fim | hard | {
"lang": "python",
"repo": "chyidl/chyidlTutorial",
"path": "/root/python/PythonPyCon/Threads_Asyncio/pecho.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chibiegg/internet-week-2018-iot-ansible path: /roles/raspi/handson/files/iw2018/answer/DHT11_Python/dht11_led.py
import RPi.GPIO as GPIO
import dht11
import time
import datetime
# initialize GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.cleanup()
<|fim_suffix|>try:
while True:
result = instanc... | code_fim | medium | {
"lang": "python",
"repo": "chibiegg/internet-week-2018-iot-ansible",
"path": "/roles/raspi/handson/files/iw2018/answer/DHT11_Python/dht11_led.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># LED setup
LED = 36
GPIO.setup(LED, GPIO.OUT)
try:
while True:
result = instance.read()
if result.is_valid():
print("Last valid input: " + str(datetime.datetime.now()))
print("Temperature: %d C" % result.temperature)
print("Humidity: %d %%" % resul... | code_fim | medium | {
"lang": "python",
"repo": "chibiegg/internet-week-2018-iot-ansible",
"path": "/roles/raspi/handson/files/iw2018/answer/DHT11_Python/dht11_led.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> time.sleep(1)
GPIO.output(LED, GPIO.LOW)
finally:
GPIO.cleanup()<|fim_prefix|># repo: chibiegg/internet-week-2018-iot-ansible path: /roles/raspi/handson/files/iw2018/answer/DHT11_Python/dht11_led.py
import RPi.GPIO as GPIO
import dht11
import time
import datetime
# initialize GPIO
G... | code_fim | hard | {
"lang": "python",
"repo": "chibiegg/internet-week-2018-iot-ansible",
"path": "/roles/raspi/handson/files/iw2018/answer/DHT11_Python/dht11_led.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EMUNES/TTF-xunlei path: /movie_tai/linkhtml.py
'''
将链接分词后存储到html文件中便于下载
'''
class Html(object):
def __init__(self, file_name='', links=[], img_link='', split=False, movie_name='', *args, **kwargs):
super().__init__(*args, **kwargs)
self.file_name = file_name
... | code_fim | hard | {
"lang": "python",
"repo": "EMUNES/TTF-xunlei",
"path": "/movie_tai/linkhtml.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.split == True:
for link in self.links:
link_name = link.split(':')[0]
link_url = link[len(link_name)+1:]
try:
f.write(linkframe.format(link_url, link_name))
f.write(newline)
... | code_fim | hard | {
"lang": "python",
"repo": "EMUNES/TTF-xunlei",
"path": "/movie_tai/linkhtml.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: the-it/WS_THEbotIT path: /service/ws_re/template/test_property.py
# pylint: disable=no-self-use,protected-access
from unittest import TestCase
from testfixtures import compare
from service.ws_re.template.property import Property
class TestReProperty(TestCase):
def test_init(self):
... | code_fim | hard | {
"lang": "python",
"repo": "the-it/WS_THEbotIT",
"path": "/service/ws_re/template/test_property.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> re_property = Property(name="Test", default="")
pre_hash = hash(re_property)
re_property.value = "value"
self.assertNotEqual(pre_hash, hash(re_property))
def test_repr(self):
re_property = Property(name="Test", default=False)
compare("<Property (name: T... | code_fim | hard | {
"lang": "python",
"repo": "the-it/WS_THEbotIT",
"path": "/service/ws_re/template/test_property.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>s": ["<(module_root_dir)/deps/libmcnet/libmcnet.so"],
}]
]
}
]
}<|fim_prefix|># repo: deoxxa/node-mcnet path: /binding.gyp
{
"targets": [
{
"target_name": "mcnet",
"sources": [
"src/mcnet.cc",
"src/parser.cc"
],
"conditions": [
['O... | code_fim | medium | {
"lang": "python",
"repo": "deoxxa/node-mcnet",
"path": "/binding.gyp",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: deoxxa/node-mcnet path: /binding.gyp
{
"targets": [
{
"target_name": "mcnet",
"sources": [
"src/mcnet.cc",
"src/parser.cc"
],
"conditions": [
['OS=="<|fim_suffix|>s": ["<(module_root_dir)/deps/libmcnet/libmcnet.so"],
}]
]
}
... | code_fim | medium | {
"lang": "python",
"repo": "deoxxa/node-mcnet",
"path": "/binding.gyp",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> parentids = []
# Iterate over all devices to find the parent ID of the one with the correct serial number
for key in self.iter_keys(usb_devs):
for subkey in self.iter_keys(key):
try:
devparams = winreg.OpenKey(subkey, "Device Paramete... | code_fim | hard | {
"lang": "python",
"repo": "mariusgreuel/pyedbglib",
"path": "/pyedbglib/serialport/wincdc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mariusgreuel/pyedbglib path: /pyedbglib/serialport/wincdc.py
"""
Class with helper functions for CDC virtual com ports on Windows.
This code taken from pyatmeltcftester project and minimally adapted for python3.
This code still needs to be Python2 compatible.
This module should not be used direct... | code_fim | hard | {
"lang": "python",
"repo": "mariusgreuel/pyedbglib",
"path": "/pyedbglib/serialport/wincdc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(Network, self).__init__()
# self.bn1 = nn.BatchNorm2d(input_dim)
self.fc1 = nn.Linear(input_dim, hidden_in_dim)
self.fc2 = nn.Linear(hidden_in_dim, hidden_out_dim)
self.fc3 = nn.Linear(hidden_out_dim, output_dim)
self.nonlin = f.relu #leaky_relu
... | code_fim | medium | {
"lang": "python",
"repo": "anguillanneuf/deep-reinforcement-learning",
"path": "/p3_collab-compet/networkforall.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anguillanneuf/deep-reinforcement-learning path: /p3_collab-compet/networkforall.py
import torch
import torch.nn as nn
import torch.nn.functional as f
import numpy as np
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1. / np.sqrt(fan_in)
return (-lim, lim)
class N... | code_fim | hard | {
"lang": "python",
"repo": "anguillanneuf/deep-reinforcement-learning",
"path": "/p3_collab-compet/networkforall.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_kmp():
txts = ["BCBAABACAABABACAA"]
pats = ["ABABAC"]
for txt, pat in zip(txts, pats):
print("text: ", txt)
kmp = KMP(pat)
offset = kmp.search(txt)
print(("pattern:" + " " * offset), pat)
if __name__ == "__main__":
# test_alphabet()
# test_... | code_fim | hard | {
"lang": "python",
"repo": "sywh/algorithms",
"path": "/tests/test_strings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sywh/algorithms path: /tests/test_strings.py
import sys
from stdlib.StdIn import InStream
from Strings.Alphabet import Alphabet
from Strings.Brute import search1, search2
from Strings.KMP import KMP
def test_alphabet():
alpha = Alphabet(sys.argv[1])
R = alpha.R()
count = [0 for _ i... | code_fim | hard | {
"lang": "python",
"repo": "sywh/algorithms",
"path": "/tests/test_strings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jan-PieterBaert/nerdlandbot path: /nerdlandbot/commands/privacy.py
import discord
from discord.ext import commands
from nerdlandbot.helpers.TranslationHelper import get_culture_from_context as culture
from nerdlandbot.translations.Translations import get_text as translate
empty = '\u200b'
<|fi... | code_fim | medium | {
"lang": "python",
"repo": "Jan-PieterBaert/nerdlandbot",
"path": "/nerdlandbot/commands/privacy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> embed = discord.Embed(title=title_txt, description=content_txt)
await ctx.channel.send(embed=embed)
def setup(bot: commands.Bot):
bot.add_cog(Privacy(bot))<|fim_prefix|># repo: Jan-PieterBaert/nerdlandbot path: /nerdlandbot/commands/privacy.py
import discord
from discord.ext import... | code_fim | hard | {
"lang": "python",
"repo": "Jan-PieterBaert/nerdlandbot",
"path": "/nerdlandbot/commands/privacy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>process.MessageLogger = cms.Service("MessageLogger",
cerr = cms.untracked.PSet(
enableStatistics = cms.untracked.bool(False)
),
cout = cms.untracked.PSet(
enable = cms.untracked.bool(True),
default = cms.untracked.PSet (
limit = cms.untracked.int32(0)
... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/FWCore/Framework/test/test_deepCall_unscheduled_cfg.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>process.result2 = cms.EDProducer("AddIntsProducer",
labels = cms.VInputTag('result1',
'one')
)
process.result4 = cms.EDProducer("AddIntsProducer",
labels = cms.VInputTag('result2',
'result2')
)
process.get = cms.EDAnalyzer("IntTestAnalyzer",
valueMustMatch = cms.untracked.int... | code_fim | medium | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/FWCore/Framework/test/test_deepCall_unscheduled_cfg.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cms-sw/cmssw path: /FWCore/Framework/test/test_deepCall_unscheduled_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
import FWCore.Framework.test.cmsExceptionsFatalOption_cff
process.options = cms.untracked.PSet(
Rethrow = FWCore.Framework.test.cmsExceptionsFata... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/FWCore/Framework/test/test_deepCall_unscheduled_cfg.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlexFire-Dev/Billing path: /apps/bills/urls.py
from django.contrib.auth.decorators import login_required
from django.urls import path, reverse_lazy, include
<|fim_suffix|> path('', login_required(IndexBillView.as_view()), name='index')
]<|fim_middle|>from .views import *
urlpatterns = [
... | code_fim | hard | {
"lang": "python",
"repo": "AlexFire-Dev/Billing",
"path": "/apps/bills/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> path('', login_required(IndexBillView.as_view()), name='index')
]<|fim_prefix|># repo: AlexFire-Dev/Billing path: /apps/bills/urls.py
from django.contrib.auth.decorators import login_required
from django.urls import path, reverse_lazy, include
<|fim_middle|>from .views import *
urlpatterns = [
... | code_fim | hard | {
"lang": "python",
"repo": "AlexFire-Dev/Billing",
"path": "/apps/bills/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> path('success/', SuccessBillView.as_view(), name='success-bill'),
path('', login_required(IndexBillView.as_view()), name='index')
]<|fim_prefix|># repo: AlexFire-Dev/Billing path: /apps/bills/urls.py
from django.contrib.auth.decorators import login_required
from django.urls import path, reverse_... | code_fim | medium | {
"lang": "python",
"repo": "AlexFire-Dev/Billing",
"path": "/apps/bills/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # create a new XML file with the results
mydata = ET.tostring(data)
myfile = open("RunCounter.xml", "w")
myfile.write(mydata)
print "Loop Number= ", RunCounter
time.sleep(2)<|fim_prefix|># repo: cannotilever/EmergencyPi path: /Block 1/Experimental/XMLWriter.py
#This is a test of the feasibility... | code_fim | hard | {
"lang": "python",
"repo": "cannotilever/EmergencyPi",
"path": "/Block 1/Experimental/XMLWriter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cannotilever/EmergencyPi path: /Block 1/Experimental/XMLWriter.py
#This is a test of the feasibility of a crash handler watchdog
import os
import time
import math
import lxml
import xml.etree.ElementTree as ET
<|fim_suffix|> # create a new XML file with the results
mydata = ET.tostring(data)
... | code_fim | hard | {
"lang": "python",
"repo": "cannotilever/EmergencyPi",
"path": "/Block 1/Experimental/XMLWriter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>myButton3 = Button(root, text="Mostrar Bases de Datos", command=borarOmostrar)
myButton3.pack()
myButton3.place(x=170, y=90)
textlabel = ttk.Entry(root)
textlabel.place(x=550, y=190)
root.mainloop()<|fim_prefix|># repo: 3liezerSong/tytus path: /storage/team10/First_Gui2.py
from tkinter import *
from ... | code_fim | hard | {
"lang": "python",
"repo": "3liezerSong/tytus",
"path": "/storage/team10/First_Gui2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 3liezerSong/tytus path: /storage/team10/First_Gui2.py
from tkinter import *
from tkinter import ttk
root = Tk()
root.title('Menu de dropdowns!')
root.geometry("700x400+1000+500")
root.configure(background='dark turquoise')
BasesdeDatos = ["Bd1","Bd2","Bd3","Bd4","Bd5","Bd6","Bd7"]
Tablas = [... | code_fim | medium | {
"lang": "python",
"repo": "3liezerSong/tytus",
"path": "/storage/team10/First_Gui2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>myButton = Button(root, text="Mostrar Tablas de:", command=borarOmostrar)
myButton.pack()
myButton.place(x=45, y=150)
myButton2 = Button(root, text="Mostrar Tuplas de:", command=borarOmostrar)
myButton2.pack()
myButton2.place(x=220, y=150)
myButton3 = Button(root, text="Mostrar Bases de Datos", comman... | code_fim | hard | {
"lang": "python",
"repo": "3liezerSong/tytus",
"path": "/storage/team10/First_Gui2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: byung-u/real_estate_in_korea path: /real_estate_in_korea/data.py
# -*- coding: utf-8 -*-
from real_estate_in_korea.local_code import get_local_code
import re
import urllib.request
from bs4 import BeautifulSoup
from datetime import datetime
def request_price(url: str, options) -> int:
req ... | code_fim | hard | {
"lang": "python",
"repo": "byung-u/real_estate_in_korea",
"path": "/real_estate_in_korea/data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_trade_price(options) -> None:
local_code = get_local_code(options.local_code, options.gu)
if local_code == -1:
print('get_local_code falied, 서울시 %s' % options.gu)
return
if options.start_month == '0':
now = datetime.now()
year = now.year
month... | code_fim | hard | {
"lang": "python",
"repo": "byung-u/real_estate_in_korea",
"path": "/real_estate_in_korea/data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if options.text is False :
ret_msg = '%s %s(%sm²) %s층 %s만원(월세%s) 준공:%s 거래:%s년%s월%s일' % (
info[3], info[5], info[9], info[12], info[4], info[7],
info[1], info[2], info[6], info[8])
else:
ret_msg = '%s,%s,%s,%s,%s,%s,%s,%s%0... | code_fim | hard | {
"lang": "python",
"repo": "byung-u/real_estate_in_korea",
"path": "/real_estate_in_korea/data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nafur/pydelta path: /pydelta/manager.py
import collections
import copy
import logging
import queue
import sys
import tempfile
import threading
from . import checker
from . import mutator
from . import options
from . import parser
from . import semantics
Candidate = collections.namedtuple('Candi... | code_fim | hard | {
"lang": "python",
"repo": "nafur/pydelta",
"path": "/pydelta/manager.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def producer(self, original, skip):
"""Produces new mutated variants of the given input."""
original_size = semantics.node_count(original)
gen = mutator.MutationGenerator(skip)
for candidate in gen.generate_mutations(original):
if options.args().mode_aggress... | code_fim | hard | {
"lang": "python",
"repo": "nafur/pydelta",
"path": "/pydelta/manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: InnoFang/algo-set path: /LeetCode/0053. Maximum Subarray/solution.py
"""
209 / 209 test cases passed.
Runtime: 248 ms
Memory Usage: 26 MB
"""
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
dp = [0] * (len(nums) + 1)
ans = nums[0]
for i, num in enumerate... | code_fim | medium | {
"lang": "python",
"repo": "InnoFang/algo-set",
"path": "/LeetCode/0053. Maximum Subarray/solution.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
209 / 209 test cases passed.
Runtime: 180 ms
Memory Usage: 25.7 MB
"""
class Solution2:
def maxSubArray(self, nums: List[int]) -> int:
ans, prev = nums[0], 0
for i, num in enumerate(nums):
curr = max(prev + num, num)
ans = max(ans, curr)
prev = c... | code_fim | hard | {
"lang": "python",
"repo": "InnoFang/algo-set",
"path": "/LeetCode/0053. Maximum Subarray/solution.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if Txt_or_File.__class__ in [file, StringIO]:
sh = Txt_or_File
sh_ref = sh
position = sh.tell()
else:
sh = StringIO(Txt_or_File)
sh_ref = -1
start_position = sh.tell()
try:
# -- parse regular expression, build state machine
... | code_fim | hard | {
"lang": "python",
"repo": "lavrod/grit-complement",
"path": "/dependencies/quex-0.34.1/quex/input/regular_expression.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lavrod/grit-complement path: /dependencies/quex-0.34.1/quex/input/regular_expression.py
from StringIO import StringIO
from quex.input.setup import setup as Setup
from quex.frs_py.file_in import EndOfStreamException, error_msg
from quex.exception import RegularExpress... | code_fim | hard | {
"lang": "python",
"repo": "lavrod/grit-complement",
"path": "/dependencies/quex-0.34.1/quex/input/regular_expression.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return check_password_hash(self.password_hash, password)
def to_json(self):
json_user = {
'username': self.username
}
return json_user
def generate_auth_token(self, expiration):
s = Serializer(current_app.config['SECRET_KEY'], expires_in=expira... | code_fim | hard | {
"lang": "python",
"repo": "akahard2dj/GreenLight",
"path": "/app/__models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akahard2dj/GreenLight path: /app/__models.py
'''
from datetime import datetime
import hashlib
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask import current_app, request, url_for
from flas... | code_fim | hard | {
"lang": "python",
"repo": "akahard2dj/GreenLight",
"path": "/app/__models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> json_user = {
'username': self.username
}
return json_user
def generate_auth_token(self, expiration):
s = Serializer(current_app.config['SECRET_KEY'], expires_in=expiration)
return s.dumps({'id': self.id}).decode('ascii')
@staticmethod
def ... | code_fim | hard | {
"lang": "python",
"repo": "akahard2dj/GreenLight",
"path": "/app/__models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cequn/mitx-grading-library path: /mitxgraders/comparers/__init__.py
# Comparers can be imported by using "from mitxgraders import comparers"
# and referenced<|fim_suffix|>comparer',
'congruence_comparer',
'eigenvector_comparer',
'between_comparer'
]<|fim_middle|> as "comparers.compare... | code_fim | medium | {
"lang": "python",
"repo": "cequn/mitx-grading-library",
"path": "/mitxgraders/comparers/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ce_comparer,
eigenvector_comparer,
between_comparer
)
__all__ = [
'equality_comparer',
'congruence_comparer',
'eigenvector_comparer',
'between_comparer'
]<|fim_prefix|># repo: cequn/mitx-grading-library path: /mitxgraders/comparers/__init__.py
# Comparers can be imported by using... | code_fim | medium | {
"lang": "python",
"repo": "cequn/mitx-grading-library",
"path": "/mitxgraders/comparers/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Read the data back after editing and check whether anything
# changed.
with codecs.open(new.name, encoding='utf-8') as f:
new_str = f.read()
if new_str == old_str:
ui.print_("No changes; aborting.")
... | code_fim | hard | {
"lang": "python",
"repo": "beetbox/beets",
"path": "/beetsplug/edit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: beetbox/beets path: /beetsplug/edit.py
# This file is part of beets.
# Copyright 2016
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
#... | code_fim | hard | {
"lang": "python",
"repo": "beetbox/beets",
"path": "/beetsplug/edit.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def apply_data(self, objs, old_data, new_data):
"""Take potentially-updated data and apply it to a set of Model
objects.
The objects are not written back to the database, so the changes
are temporary.
"""
if len(old_data) != len(new_data):
s... | code_fim | hard | {
"lang": "python",
"repo": "beetbox/beets",
"path": "/beetsplug/edit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for p in guide_paths:
dirname = os.path.dirname(p)
os.chdir(dirname) # must change dirs so pandoc can validate relative image paths in markdown
ipynb = p.replace('md', 'ipynb')
pypandoc.convert_file(p, 'ipynb', outputfile=ipynb)
with open(ipynb, 'r') as f:
... | code_fim | medium | {
"lang": "python",
"repo": "scyphers-/opensarlab-container",
"path": "/images/sar/jupyter-hooks/scripts/osl_user_guides_to_ipynb.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scyphers-/opensarlab-container path: /images/sar/jupyter-hooks/scripts/osl_user_guides_to_ipynb.py
#!/usr/bin/python
# osl_user_guides_to_ipynb.py
# Alex Lewandowski
# 10-14-20
import glob
import os
import json
import pypandoc
import argparse
<|fim_suffix|> for p in guide_paths:
di... | code_fim | medium | {
"lang": "python",
"repo": "scyphers-/opensarlab-container",
"path": "/images/sar/jupyter-hooks/scripts/osl_user_guides_to_ipynb.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>@filterable()
def setrange(stream: Stream, *args, **kwargs) -> FilterableStream:
"""https://ffmpeg.org/ffmpeg-filters.html#setrange"""
return filter(stream, setrange.__name__, *args, **kwargs)
@filterable()
def asettb(stream: Stream, *args, **kwargs) -> FilterableStream:
"""https://ffmpeg.or... | code_fim | hard | {
"lang": "python",
"repo": "rdaim/ffmpeg-generator",
"path": "/ffmpeg/filters/avfilters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """https://ffmpeg.org/ffmpeg-filters.html#asidedata"""
return filter(stream, asidedata.__name__, *args, **kwargs)
@filterable()
def spectrumsynth(stream: Stream, *args, **kwargs) -> FilterableStream:
"""https://ffmpeg.org/ffmpeg-filters.html#spectrumsynth"""
return filter(stream, spectru... | code_fim | hard | {
"lang": "python",
"repo": "rdaim/ffmpeg-generator",
"path": "/ffmpeg/filters/avfilters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rdaim/ffmpeg-generator path: /ffmpeg/filters/avfilters.py
'''
Date: 2021.02-25 14:34:07
LastEditors: Rustle Karl
LastEditTime: 2021.04.25 13:31:36
'''
import contextlib
from typing import List
from .._utils import drop_empty_dict_values
from ..nodes import filterable, FilterableStream, FilterNod... | code_fim | hard | {
"lang": "python",
"repo": "rdaim/ffmpeg-generator",
"path": "/ffmpeg/filters/avfilters.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liulab-dfci/CHIPS path: /modules/scripts/report/downstream/conserv_motif_table.py
#!/usr/bin/env python3
"""GALI BAI
Script to summary conservation and motif finding results
When homer is on, prints out a csv file with header- 'Sample', 'Conservation', 'Motif', 'Homer Motif Logo', 'Negative Log P... | code_fim | hard | {
"lang": "python",
"repo": "liulab-dfci/CHIPS",
"path": "/modules/scripts/report/downstream/conserv_motif_table.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not options.homer:
print("homer is disabled")
out = open(options.output, "w")
#write header
out.write("%s\n" % ",".join(['Sample', 'Conservation']))
for k in conserv_out.keys():
s = [str(k)]
l = conserv_out[k]
s.extend(l)
... | code_fim | hard | {
"lang": "python",
"repo": "liulab-dfci/CHIPS",
"path": "/modules/scripts/report/downstream/conserv_motif_table.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bharadwajyarlagadda/korona path: /korona/lib/utils.py
# -*- coding: utf-8 -*-
from future.moves.urllib.parse import urlparse
import datetime
from ..exceptions import AttributeValueError, TagAttributeError
from ..html.root.tags import TAGS
def validate_tag(tag=None):
"""Validates whether t... | code_fim | hard | {
"lang": "python",
"repo": "bharadwajyarlagadda/korona",
"path": "/korona/lib/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def validate_attribute_values(tag,
attribute_name,
attribute_value,
default_values):
"""Validates whether the given attribute value is a valid value or not.
Some of the attributes have confined values. Even ... | code_fim | hard | {
"lang": "python",
"repo": "bharadwajyarlagadda/korona",
"path": "/korona/lib/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Load tool
try:
with open(tool_path, "r") as f:
tool_env = json.load(f)
log.debug('Read tool successfully: {}'.format(tool_path))
except IOError:
log.debug(
'Unable to find the environment file: "{}"'.format(tool_... | code_fim | hard | {
"lang": "python",
"repo": "jrsndl/pype-setup",
"path": "/vendor/python/acre/acre/core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jrsndl/pype-setup path: /vendor/python/acre/acre/core.py
import logging
import json
import re
import os
import platform
from . import lib
PLATFORM = platform.system().lower()
logging.basicConfig()
log = logging.getLogger()
class CycleError(ValueError):
"""A cyclic dependency in dynamic ... | code_fim | hard | {
"lang": "python",
"repo": "jrsndl/pype-setup",
"path": "/vendor/python/acre/acre/core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = {}
for variable, value in env.items():
# Platform specific values
if isinstance(value, dict):
value = value.get(platform_name, "")
if not value:
continue
# Allow to have lists as values in the tool data
if isinstance(value... | code_fim | hard | {
"lang": "python",
"repo": "jrsndl/pype-setup",
"path": "/vendor/python/acre/acre/core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robfalck/AoC2018 path: /aoc2018/dec07/part1.py
from __future__ import print_function, division, absolute_import
import itertools
import numpy as np
def time_to_do_step(step):
return ord(step) - 4
class Step(object):
def __init__(self, name, test=False):
self.name = name
... | code_fim | hard | {
"lang": "python",
"repo": "robfalck/AoC2018",
"path": "/aoc2018/dec07/part1.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> while len(completed_steps) != len(steps):
# Find the steps whose prereqs are satisfied and are not already completed
next = get_eligible_steps(steps, completed_steps)[0]
completed_steps.append(next)
print(''.join(completed_steps))
return completed_steps
if __nam... | code_fim | hard | {
"lang": "python",
"repo": "robfalck/AoC2018",
"path": "/aoc2018/dec07/part1.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> steps = parse_steps(instructions)
# Find the start point
completed_steps = []
while len(completed_steps) != len(steps):
# Find the steps whose prereqs are satisfied and are not already completed
next = get_eligible_steps(steps, completed_steps)[0]
completed_steps.... | code_fim | hard | {
"lang": "python",
"repo": "robfalck/AoC2018",
"path": "/aoc2018/dec07/part1.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with pytest.allure.step('Create new group if list is empty'):
if len(db.get_group_list()) == 0:
app.group.create(Group(name="test9", header="Python group", footer="comment"))
with pytest.allure.step('Given a group list'):
old_groups = db.get_group_list()
with pytest.... | code_fim | hard | {
"lang": "python",
"repo": "annovikov/Python_education",
"path": "/tests/test_del_group.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: annovikov/Python_education path: /tests/test_del_group.py
# -*- coding: utf-8 -*-
from model.groups import Group
from random import randrange
import random
import pytest
def test_delete_first_group(app):
with pytest.allure.step('Create new group if list is empty'):
if app.group.count... | code_fim | hard | {
"lang": "python",
"repo": "annovikov/Python_education",
"path": "/tests/test_del_group.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> gsutil_wipe_path(gcs_cache_url)
flow = builder.build()
assert flow.get('xy') == 6
assert xy.times_called() == 0
local_wipe_path(local_cache_path_str)
flow = builder.build()
assert flow.get('xy') == 6
assert xy.times_called() == 0
gsutil_wipe_path(gcs_cache_url)
... | code_fim | hard | {
"lang": "python",
"repo": "jqmp/bionic",
"path": "/tests/test_flow/test_persistence_gcs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jqmp/bionic path: /tests/test_flow/test_persistence_gcs.py
'''
This module tests Bionic's GCS caching. In order to run it, you need to set
the ``BIONIC_GCS_TEST_BUCKET`` environmet variable with the name of a GCS
bucket you have access to. Bionic will cache its data to randomly-generated
prefix... | code_fim | hard | {
"lang": "python",
"repo": "jqmp/bionic",
"path": "/tests/test_flow/test_persistence_gcs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tongzhongkai/FastSpec path: /SpectreGAN/model_utils/variable_mapping.py
# Copyright 2017 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 th... | code_fim | hard | {
"lang": "python",
"repo": "Tongzhongkai/FastSpec",
"path": "/SpectreGAN/model_utils/variable_mapping.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> [print(v) for v in tf.trainable_variables()]
#input('variable_mapping')
## Encoder variables.
encoder_lstm_w_0 = [
v for v in tf.trainable_variables() if v.op.name ==
'dis/encoder/rnn/rnn/multi_rnn_cell/cell_0/basic_lstm_cell/kernel'
][0]
encoder_lstm_b_0 = [
v for v in tf.tr... | code_fim | hard | {
"lang": "python",
"repo": "Tongzhongkai/FastSpec",
"path": "/SpectreGAN/model_utils/variable_mapping.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jbasko/configmanager path: /tests/test_item_awareness.py
from configmanager import Config, Item
def test_item_knows_the_section_it_has_been_added_to():
enabled = Item(default=False)
assert enabled.section is None
uploads = Config({'enabled': enabled})
assert enabled.section is ... | code_fim | hard | {
"lang": "python",
"repo": "jbasko/configmanager",
"path": "/tests/test_item_awareness.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> main_config = Config({
'uploads': uploads_config,
'downloads': downloads_config,
})
assert uploads_config.section is main_config
assert downloads_config.section is main_config
# Adding to another section updates the state
app_config = Config({
'up': uploads... | code_fim | hard | {
"lang": "python",
"repo": "jbasko/configmanager",
"path": "/tests/test_item_awareness.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YSabarad/monopyly path: /monopyly/squares/street.py
from collections import namedtuple
from .property import Property
class Street(Property):
'''
A type of Property representing a street.
Manages rents, house-building and so on.
'''
def __init__(self, name, property_set, p... | code_fim | hard | {
"lang": "python",
"repo": "YSabarad/monopyly",
"path": "/monopyly/squares/street.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
The player has landed on a square owned by another player
and must pay rent.
'''
# Are there any houses?
if self.number_of_houses == 0:
rent = self.rents[0]
owner = self.owner
if self.property_set in owner.state.owned_... | code_fim | hard | {
"lang": "python",
"repo": "YSabarad/monopyly",
"path": "/monopyly/squares/street.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from .runtime_variable import add_sample_dimension, add_sample_dimension_to_arrays, expectation, is_sampled_array, get_num_samples, as_samples
from .var_trans import Softplus, PositiveTransformation
from .variable import Variable, VariableType<|fim_prefix|># repo: tdiethe/MXFusion path: /mxfusion/compone... | code_fim | medium | {
"lang": "python",
"repo": "tdiethe/MXFusion",
"path": "/mxfusion/components/variables/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tdiethe/MXFusion path: /mxfusion/components/variables/__init__.py
"""Contains the Variable class, Variable transformations, and runtime methods on variables.
Submodules
==========
<|fim_suffix|>from .runtime_variable import add_sample_dimension, add_sample_dimension_to_arrays, expectation, is_s... | code_fim | medium | {
"lang": "python",
"repo": "tdiethe/MXFusion",
"path": "/mxfusion/components/variables/__init__.py",
"mode": "psm",
"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.