text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>
#
# return gru_out_.output, update_gate_.output
#
# s_update, _ = theano.scan(recurrence,
# sequences=[self.x], # along with images, feed in the index of the current frame
# outputs_info=[tensor.zeros_like(np.zeros(s_shape),
# ... | code_fim | hard | {
"lang": "python",
"repo": "keven425/3D-R2N2",
"path": "/models/gru_net.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ishine/EEND path: /eend/chainer_backend/encoder_decoder_attractor.py
#!/usr/bin/env python3
# Copyright 2020 Hitachi, Ltd. (author: Shota Horiguchi)
# Licensed under the MIT license.
from chainer import Chain, cuda
import chainer.functions as F
import chainer.links as L
class EncoderDecoderAt... | code_fim | hard | {
"lang": "python",
"repo": "ishine/EEND",
"path": "/eend/chainer_backend/encoder_decoder_attractor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Calculate attractors from embedding sequences with given number of speakers
Args:
xs: List of (T,D)-shaped embeddings
n_speakers: List of number of speakers, or None if the number of speakers is unknown (ex. test phase)
Returns:
loss: Attr... | code_fim | hard | {
"lang": "python",
"repo": "ishine/EEND",
"path": "/eend/chainer_backend/encoder_decoder_attractor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bartman0/mstrio-py path: /mstrio/api/authentication.py
import requests
def login(connection, verbose=False):
"""
Authenticate a user and create an HTTP session on the web server where the user’s MicroStrategy sessions are stored.
This request returns an authorization token (X-MSTR-A... | code_fim | hard | {
"lang": "python",
"repo": "Bartman0/mstrio-py",
"path": "/mstrio/api/authentication.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def sessions(connection, verbose=False):
"""
Extends the HTTP and Intelligence Server sessions by resetting the timeouts.
:param connection: MicroStrategy REST API connection object
:param verbose: Verbosity of request response; defaults to False
:return: Complete HTTP response object... | code_fim | hard | {
"lang": "python",
"repo": "Bartman0/mstrio-py",
"path": "/mstrio/api/authentication.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mars-project/mars path: /mars/tensor/images/tests/test_images_execution.py
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License... | code_fim | hard | {
"lang": "python",
"repo": "mars-project/mars",
"path": "/mars/tensor/images/tests/test_images_execution.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> with tempfile.TemporaryDirectory() as tempdir:
raws = []
for i in range(10):
array = np.random.randint(0, 256, 2500, dtype=np.uint8).reshape((50, 50))
raws.append(array)
im = Image.fromarray(array)
im.save(os.path.join(tempdir, f"random_{... | code_fim | medium | {
"lang": "python",
"repo": "mars-project/mars",
"path": "/mars/tensor/images/tests/test_images_execution.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Might be neat to sort by edit distance or something, but for now alphabetical is fine.
specs = [''.join(pair) for pair in sorted(specs)]
# Give different error messages depending on whether BUILD file was empty.
one_of = ' one of' if len(specs) > 1 else '' # Handle plurality, just for ... | code_fim | hard | {
"lang": "python",
"repo": "awiss/pants",
"path": "/src/python/pants/build_graph/address_mapper.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: awiss/pants path: /src/python/pants/build_graph/address_mapper.py
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_... | code_fim | hard | {
"lang": "python",
"repo": "awiss/pants",
"path": "/src/python/pants/build_graph/address_mapper.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param Address address: the address to lookup in a BUILD file
:raises AddressLookupError: if the path to the address is not found.
:returns: A tuple of the natively mapped BuildFileAddress and the Addressable it points to.
"""
def resolve_spec(self, spec):
"""Converts a spec to an a... | code_fim | hard | {
"lang": "python",
"repo": "awiss/pants",
"path": "/src/python/pants/build_graph/address_mapper.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rinsekloek/netbox path: /netbox/utilities/filters.py
import django_filters
from dcim.forms import MACAddressField
from django import forms
from django.conf import settings
from django.db import models
from extras.models import Tag
def multivalue_field_factory(field_class):
"""
Given a f... | code_fim | hard | {
"lang": "python",
"repo": "rinsekloek/netbox",
"path": "/netbox/utilities/filters.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class NumericInFilter(django_filters.BaseInFilter, django_filters.NumberFilter):
"""
Filters for a set of numeric values. Example: id__in=100,200,300
"""
pass
class NullableCharFieldFilter(django_filters.CharFilter):
"""
Allow matching on null field values by passing a special st... | code_fim | hard | {
"lang": "python",
"repo": "rinsekloek/netbox",
"path": "/netbox/utilities/filters.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pythonarcade/arcade path: /arcade/examples/gl/3d_cube_with_cubes.py
"""
3D Example with offscreen rendering.
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.gl.3d_cube_with_cubes
"""
from __future__ import annotations
from pyglet... | code_fim | hard | {
"lang": "python",
"repo": "pythonarcade/arcade",
"path": "/arcade/examples/gl/3d_cube_with_cubes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.on_resize(*self.get_size())
self.time = 0
self.frame = 0
self.fbo1 = self.ctx.framebuffer(
color_attachments=[self.ctx.texture((self.get_size()))],
depth_attachment=self.ctx.depth_texture(self.get_size()),
)
self.fbo2 = self.ctx... | code_fim | hard | {
"lang": "python",
"repo": "pythonarcade/arcade",
"path": "/arcade/examples/gl/3d_cube_with_cubes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Capture frame-by-frame
if proceed:
ret, frame = cap.read()
if ret:
height , width , layers = frame.shape
new_h = height//2; new_w = width//2
shrunk = cv2.resize(frame, (new_w, new_h))
# Display the resulting frame
cv2.imshow('Fram... | code_fim | hard | {
"lang": "python",
"repo": "peria1/yolact",
"path": "/annotate_video.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> keycode = cv2.waitKey(wait_ms) & 0xFF
# Press Q on keyboard to exit
if keycode == ord('q'):
break
if keycode==ord(' '):
proceed = not proceed
print(proceed)
# When everything done, release
# the video capture object
cap.release()
# Closes all the fra... | code_fim | medium | {
"lang": "python",
"repo": "peria1/yolact",
"path": "/annotate_video.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peria1/yolact path: /annotate_video.py
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 18 09:37:03 2020
@author: Bill
"""
import cv2
#import numpy as np
def user_pressed(key):
wait_ms = 25
return cv2.waitKey(wait_ms) & 0xFF == ord(key)
def key_pressed():
<|fim_suffix|> # Press Q on k... | code_fim | hard | {
"lang": "python",
"repo": "peria1/yolact",
"path": "/annotate_video.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.k = k
zero = property(lambda self: (infinity,) * self.k)
one = property(lambda self: (0,) + (infinity,) * (self.k-1))
def plus(self, left, right):
result = [None] * self.k
i, j, m = 0, 0, 0
while i < len(left) and j < len(right) and m < self.k:
... | code_fim | medium | {
"lang": "python",
"repo": "antoniosarosi/algoritmia",
"path": "/src/algoritmia/semirings/kbest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: antoniosarosi/algoritmia path: /src/algoritmia/semirings/kbest.py
from algoritmia.semirings.interfaces import ISemiRing
from algoritmia.utils import infinity
<|fim_suffix|> zero = property(lambda self: (infinity,) * self.k)
one = property(lambda self: (0,) + (infinity,) * (self.k-1))
... | code_fim | medium | {
"lang": "python",
"repo": "antoniosarosi/algoritmia",
"path": "/src/algoritmia/semirings/kbest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Encrypt the information
NEWaccountsStr = f"{accountsFromDB}{name},{account.number};"
encryptedAccounts = encrypt(enKey, NEWaccountsStr)
user.accounts = encryptedAccounts.decode('utf-8')
# Save the stuff.
db.session.add(account)
db.session.add(user)
db.session.commit()
... | code_fim | hard | {
"lang": "python",
"repo": "Levang/dat250-prosjekt",
"path": "/safecoin/safecoin/accounts_db.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Levang/dat250-prosjekt path: /safecoin/safecoin/accounts_db.py
from flask_login import current_user
from random import randint
from safecoin import db
from safecoin.models import Account, User
from safecoin.encryption import decrypt, encrypt, redis_sync, illegalChar, verify_pwd_2FA
from safecoin... | code_fim | hard | {
"lang": "python",
"repo": "Levang/dat250-prosjekt",
"path": "/safecoin/safecoin/accounts_db.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: killa1218/sense2guass path: /e_step/setup.py
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
from Cython.Distutils import build_ext
<|fim_suffix|>try:
os.rename("cinference.cpython-35m-x86_64-linux-gnu.so", "cinference.so")
except... | code_fim | hard | {
"lang": "python",
"repo": "killa1218/sense2guass",
"path": "/e_step/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>try:
os.rename("cinference.cpython-35m-x86_64-linux-gnu.so", "cinference.so")
except Exception:
try:
os.rename("cinference.cpython-34m.so", "cinference.so")
except Exception:
os.rename("cinference.cpython-35m-darwin.so", "cinference.so")
from e_step.cinference import test
test... | code_fim | hard | {
"lang": "python",
"repo": "killa1218/sense2guass",
"path": "/e_step/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.next_move = next_move
super(TwitterHumanPlayer, self).__init__(marker)
def get_square(self, current_board, previous_move, message):
return self.next_move<|fim_prefix|># repo: c17r/tic-tweet-toe path: /tic_tweet_toe/twitter_game.py
from ttt.game import AbstractGame
from t... | code_fim | medium | {
"lang": "python",
"repo": "c17r/tic-tweet-toe",
"path": "/tic_tweet_toe/twitter_game.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: c17r/tic-tweet-toe path: /tic_tweet_toe/twitter_game.py
from ttt.game import AbstractGame
from ttt.player import AbstractPlayer
class TwitterGame(AbstractGame):
def __init__(self):
super(TwitterGame, self).__init__(human, cpu)
def display_board(self):
pass
def dis... | code_fim | medium | {
"lang": "python",
"repo": "c17r/tic-tweet-toe",
"path": "/tic_tweet_toe/twitter_game.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> session.install(f".[{laz_backend}]")
session.run("pytest", "-q", "tests")<|fim_prefix|># repo: hobu/laspy path: /noxfile.py
import nox
@nox.session(python=["3.7", "3.8", "3.9", "3.10"])
@nox.parametrize("laz_backend", [None, "lazrs", "laszip"])
def tests(session, laz_backend):
session.i... | code_fim | medium | {
"lang": "python",
"repo": "hobu/laspy",
"path": "/noxfile.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hobu/laspy path: /noxfile.py
import nox
@nox.session(python=["3.7", "3.8", "3.9", "3.10"])
@nox.parametrize("la<|fim_suffix|> session.install(f".[{laz_backend}]")
session.run("pytest", "-q", "tests")<|fim_middle|>z_backend", [None, "lazrs", "laszip"])
def tests(session, laz_backend):... | code_fim | medium | {
"lang": "python",
"repo": "hobu/laspy",
"path": "/noxfile.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(
ExtractorsIp(request_without_ip_x_forwarded_for()).call(),
request_ip()
)<|fim_prefix|># repo: jprestel-rue/castle-python path: /castle/test/extractors/ip_test.py
from castle.test import unittest, mock
from castle.extractors.ip import ExtractorsIp... | code_fim | medium | {
"lang": "python",
"repo": "jprestel-rue/castle-python",
"path": "/castle/test/extractors/ip_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jprestel-rue/castle-python path: /castle/test/extractors/ip_test.py
from castle.test import unittest, mock
from castle.extractors.ip import ExtractorsIp
def request_ip():
return '127.0.0.1'
def request():
req = mock.Mock(spec=['ip'])
req.ip = request_ip()
return req
def reques... | code_fim | hard | {
"lang": "python",
"repo": "jprestel-rue/castle-python",
"path": "/castle/test/extractors/ip_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(
ExtractorsIp(request_without_ip_remote_addr()).call(),
request_ip()
)
def test_extract_ip_from_wsgi_request_x_forwarded_for(self):
self.assertEqual(
ExtractorsIp(request_without_ip_x_forwarded_for()).call(),
req... | code_fim | hard | {
"lang": "python",
"repo": "jprestel-rue/castle-python",
"path": "/castle/test/extractors/ip_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if k == "__mapper__":
continue
if c.extension_type == ASSOCIATION_PROXY:
continue
if c.extension_type == HYBRID_PROPERTY:
cls.__hybrids.append(k)
elif k not in mapper.relationships:
cls.__colu... | code_fim | hard | {
"lang": "python",
"repo": "ahurta92/QCFractal",
"path": "/qcfractal/storage_sockets/models/sql_base.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> session = object_session(self)
old_set = {x for x in old_list} if old_list else set()
new_set = {x for x in new_list} if new_list else set()
# Update many-to-many relations
# Remove old relations and apply the new ones
if old_set != new_set:
to... | code_fim | hard | {
"lang": "python",
"repo": "ahurta92/QCFractal",
"path": "/qcfractal/storage_sockets/models/sql_base.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ahurta92/QCFractal path: /qcfractal/storage_sockets/models/sql_base.py
from qcelemental.util import msgpackext_dumps, msgpackext_loads
from sqlalchemy import and_, inspect
from sqlalchemy.dialects.postgresql import BYTEA
from sqlalchemy.ext.associationproxy import ASSOCIATION_PROXY
from sqlalchem... | code_fim | hard | {
"lang": "python",
"repo": "ahurta92/QCFractal",
"path": "/qcfractal/storage_sockets/models/sql_base.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CryptoCoinsWorks/backtest_utils path: /tools/calendar_hitmap.py
import sys
from collections import OrderedDict
import calplot
import pandas as pd
def loadData(filename: str):
df = pd.read_csv(filename, usecols=['DateTime', 'Open', 'High', 'Low', 'Close', 'Volume'], na_values=['nan'])
d... | code_fim | hard | {
"lang": "python",
"repo": "CryptoCoinsWorks/backtest_utils",
"path": "/tools/calendar_hitmap.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
file_path = sys.argv[1]
data_frame = loadData(file_path)
# data_frame = resample(data_frame)
data_frame['hasDay'] = 1
fig, _ = calplot.calplot(data_frame['hasDay'], cmap='Blues', colorbar=False)
print(f"Calendar hitmap has been saved to {file_path}_hitma... | code_fim | hard | {
"lang": "python",
"repo": "CryptoCoinsWorks/backtest_utils",
"path": "/tools/calendar_hitmap.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
file_path = sys.argv[1]
data_frame = loadData(file_path)
# data_frame = resample(data_frame)
data_frame['hasDay'] = 1
fig, _ = calplot.calplot(data_frame['hasDay'], cmap='Blues', colorbar=False)
print(f"Calendar hitmap has been saved to {file_path}_hitmap... | code_fim | hard | {
"lang": "python",
"repo": "CryptoCoinsWorks/backtest_utils",
"path": "/tools/calendar_hitmap.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fga-eps-mds/2019.1-Tino path: /microservices/professor.py
from flask import Flask
from pymongo import MongoClient
import csv
app = Flask(__name__)
# Set db settings
client = MongoClient('localhost:27017', username='rasa', password='rasa')
db = client['admin']
collection = db['professor-contat... | code_fim | hard | {
"lang": "python",
"repo": "fga-eps-mds/2019.1-Tino",
"path": "/microservices/professor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for each in reader:
row = {}
# Fields requireds
if each['name'] != "" and each['room'] != "" \
and each['coordination'] != "":
row = each
collection.insert_one(row)
count = count + 1
else:
continue
print("Foram adicionado(s) {} professore(s)".format(... | code_fim | hard | {
"lang": "python",
"repo": "fga-eps-mds/2019.1-Tino",
"path": "/microservices/professor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KCzenczek/RPi-code path: /Rover/testing_wheels.py
import RPi.GPIO as GPIO
import time
<|fim_suffix|>GPIO.output(7, True)
time.sleep(1)
GPIO.output(7, False)
GPIO.output(11, True)
time.sleep(1)
GPIO.output(11, False)
GPIO.output(13, True)
time.sleep(1)
GPIO.output(13, False)
GPIO.output(15, True... | code_fim | medium | {
"lang": "python",
"repo": "KCzenczek/RPi-code",
"path": "/Rover/testing_wheels.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>GPIO.output(7, True)
time.sleep(1)
GPIO.output(7, False)
GPIO.output(11, True)
time.sleep(1)
GPIO.output(11, False)
GPIO.output(13, True)
time.sleep(1)
GPIO.output(13, False)
GPIO.output(15, True)
time.sleep(1)
GPIO.output(15, False)
GPIO.cleanup()<|fim_prefix|># repo: KCzenczek/RPi-code path: /Rover/te... | code_fim | medium | {
"lang": "python",
"repo": "KCzenczek/RPi-code",
"path": "/Rover/testing_wheels.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cristi161/eecvf path: /MachineLearning/main_flow.py
from MachineLearning.Models.unet_edge import unet
from keras.callbacks import ModelCheckpoint
from keras.preprocessing.image import ImageDataGenerator
import numpy as np
import os
import skimage.io as io
import skimage.transform as trans
... | code_fim | hard | {
"lang": "python",
"repo": "cristi161/eecvf",
"path": "/MachineLearning/main_flow.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> my_gene = train_generator(2, data_gen_args)
if not os.path.isfile(os.path.join(CONFIG.ML_WEIGHT_OUTPUT_LOCATION, 'unet_edge.hdf5')):
model = unet()
# add path
model_checkpoint = ModelCheckpoint(filepath=os.path.join(CONFIG.ML_WEIGHT_OUTPUT_LOCATION, 'unet_edge.hdf5'),... | code_fim | hard | {
"lang": "python",
"repo": "cristi161/eecvf",
"path": "/MachineLearning/main_flow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if dt == np.longdouble and np.dtype('g') == np.dtype('d'):
pytest.skip('longdouble is double')
sos = np.array(sos, dtype=dt)
x = np.array(x, dtype=dt)
y = sosfilter(sos, x)
assert_equal(y.dtype, dt)
assert_array_equal(y, expected_y)<|fim_prefix|># repo: WarrenWeckesser/ufun... | code_fim | medium | {
"lang": "python",
"repo": "WarrenWeckesser/ufunclab",
"path": "/ufunclab/tests/test_sosfilter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WarrenWeckesser/ufunclab path: /ufunclab/tests/test_sosfilter.py
import pytest
import numpy as np
from numpy.testing import assert_array_equal, assert_equal
from ufunclab import sosfilter
exact_test_cases = [
# sos, x, expected_y
([[1, 0.5, -0.75, 1, 0, 0]],
[0, 0, 1, 0, 0, 0, 0, ... | code_fim | medium | {
"lang": "python",
"repo": "WarrenWeckesser/ufunclab",
"path": "/ufunclab/tests/test_sosfilter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.parametrize('dt', [np.float32, np.float64, np.longdouble])
@pytest.mark.parametrize('sos, x, expected_y', exact_test_cases)
def test_simple_float(dt, sos, x, expected_y):
if dt == np.longdouble and np.dtype('g') == np.dtype('d'):
pytest.skip('longdouble is double')
sos = np.ar... | code_fim | hard | {
"lang": "python",
"repo": "WarrenWeckesser/ufunclab",
"path": "/ufunclab/tests/test_sosfilter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def is_legal_video_file_name(file_name: str):
return pathlib.Path(file_name).suffix.lower() in LEGAL_VIDEO_FILE_EXTENSIONS<|fim_prefix|># repo: cjwcommuny/datascience path: /datascience/video.py
from typing import Set
import pathlib
<|fim_middle|>LEGAL_VIDEO_FILE_EXTENSIONS: Set[str] = {".mp4", ".3... | code_fim | medium | {
"lang": "python",
"repo": "cjwcommuny/datascience",
"path": "/datascience/video.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return pathlib.Path(file_name).suffix.lower() in LEGAL_VIDEO_FILE_EXTENSIONS<|fim_prefix|># repo: cjwcommuny/datascience path: /datascience/video.py
from typing import Set
import pathlib
<|fim_middle|>LEGAL_VIDEO_FILE_EXTENSIONS: Set[str] = {".mp4", ".3gp", ".ogg", ".wmv", ".webm", ".flv", ".avi", ... | code_fim | medium | {
"lang": "python",
"repo": "cjwcommuny/datascience",
"path": "/datascience/video.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cjwcommuny/datascience path: /datascience/video.py
from typing import Set
import pathlib
LEGAL_VIDEO_FILE_EXTENSIONS: Set[str] = {".mp4", ".3gp", ".ogg", ".wmv", ".webm", ".flv", ".avi", ".mkv"}
<|fim_suffix|> return pathlib.Path(file_name).suffix.lower() in LEGAL_VIDEO_FILE_EXTENSIONS<|fim... | code_fim | easy | {
"lang": "python",
"repo": "cjwcommuny/datascience",
"path": "/datascience/video.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SwissDataScienceCenter/renku-python path: /tests/cli/test_indirect.py
#
# Copyright 2019-2023 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License,... | code_fim | hard | {
"lang": "python",
"repo": "SwissDataScienceCenter/renku-python",
"path": "/tests/cli/test_indirect.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.skip("renku update is not implemented with new database, reenable once it is.")
def test_indirect_parameters_update(renku_cli, project):
"""Test updating of indirect parameters."""
with chdir(project.path):
Path(".renku/tmp").mkdir(exist_ok=True)
Path("script.sh").wr... | code_fim | hard | {
"lang": "python",
"repo": "SwissDataScienceCenter/renku-python",
"path": "/tests/cli/test_indirect.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elupus/home-assistant path: /tests/helpers/test_start.py
"""Test starting HA helpers."""
from homeassistant import core
from homeassistant.const import EVENT_HOMEASSISTANT_START
from homeassistant.helpers import start
async def test_at_start_when_running_awaitable(hass):
"""Test at start wh... | code_fim | hard | {
"lang": "python",
"repo": "elupus/home-assistant",
"path": "/tests/helpers/test_start.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Check the unnecessary cancel did not generate warnings or errors
for record in caplog.records:
assert record.levelname in ("DEBUG", "INFO")
async def test_cancelling_when_starting(hass):
"""Test cancelling at start when yet to start."""
hass.state = core.CoreState.not_running
... | code_fim | hard | {
"lang": "python",
"repo": "elupus/home-assistant",
"path": "/tests/helpers/test_start.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> vocab = Vocab()
vocab.strings.set_frozen(True)
doc = get_doc(vocab, ['whata'])<|fim_prefix|># repo: ryfeus/lambda-packs path: /Spacy/source2.7/spacy/tests/regression/test_issue589.py
# coding: utf-8
from __future__ import unicode_literals
from ...vocab import Vocab
from ..util import get_doc... | code_fim | easy | {
"lang": "python",
"repo": "ryfeus/lambda-packs",
"path": "/Spacy/source2.7/spacy/tests/regression/test_issue589.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ryfeus/lambda-packs path: /Spacy/source2.7/spacy/tests/regression/test_issue589.py
# coding: utf-8
from __future__ import unicode_literals
<|fim_suffix|>@pytest.mark.xfail
def test_issue589():
vocab = Vocab()
vocab.strings.set_frozen(True)
doc = get_doc(vocab, ['whata'])<|fim_middle|... | code_fim | medium | {
"lang": "python",
"repo": "ryfeus/lambda-packs",
"path": "/Spacy/source2.7/spacy/tests/regression/test_issue589.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KaihuaQin/teether path: /teether/util/utils.py
from sha3 import keccak_256
def sha3(data):
return keccak_256(data).digest()
TT256 = 2 ** 256
TT256M1 = 2 ** 256 - 1
TT255 = 2 ** 255
SECP256K1P = 2 ** 256 - 4294968273
def big_endian_to_int(x):
return int.from_bytes(x, byteorder='big')... | code_fim | hard | {
"lang": "python",
"repo": "KaihuaQin/teether",
"path": "/teether/util/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> a = tuple(a)
b = tuple(b)
# True iff a is a substring of b
p = 0
l = len(a)
while True:
try:
p = b.index(a[0], p)
if b[p:p + l] == a:
return True
p += 1
except ValueError:
break
return False<|fim_pr... | code_fim | hard | {
"lang": "python",
"repo": "KaihuaQin/teether",
"path": "/teether/util/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tubbz-alt/muzero-2 path: /utils/game_utils.py
from dataclasses import dataclass
import typing
import gym
from gym import Env, spaces
from gym.envs.atari import AtariEnv
import numpy as np
@dataclass
class GameState:
<|fim_suffix|>class DiscretizeAction(gym.ActionWrapper):
""" Factorizes th... | code_fim | hard | {
"lang": "python",
"repo": "Tubbz-alt/muzero-2",
"path": "/utils/game_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, env, n):
assert isinstance(env.action_space, spaces.Box), (
"expected Box action space, got {}".format(type(env.action_space)))
assert env.action_space.is_bounded(), "expected bounded Box action space"
# We could support multiple dimensions, but ... | code_fim | hard | {
"lang": "python",
"repo": "Tubbz-alt/muzero-2",
"path": "/utils/game_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TakutoYoshikai/levec path: /levec
#!/usr/bin/env python3
import Levenshtein
import sys
<|fim_suffix|>min_distance = 100
nearest = None
for _cmd in list:
distance = Levenshtein.distance(cmd, _cmd)
if min_distance > distance:
min_distance = distance
nearest = _cmd
if min_distance < 3... | code_fim | medium | {
"lang": "python",
"repo": "TakutoYoshikai/levec",
"path": "/levec",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>min_distance = 100
nearest = None
for _cmd in list:
distance = Levenshtein.distance(cmd, _cmd)
if min_distance > distance:
min_distance = distance
nearest = _cmd
if min_distance < 3:
print(nearest)<|fim_prefix|># repo: TakutoYoshikai/levec path: /levec
#!/usr/bin/env python3
import Leve... | code_fim | medium | {
"lang": "python",
"repo": "TakutoYoshikai/levec",
"path": "/levec",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def do_native_app_authentication(client_id, redirect_uri,
requested_scopes=None):
"""
Does a Native App authentication flow and returns a
dict of tokens keyed by service name.
"""
client = globus_sdk.NativeAppAuthClient(client_id=client_id)
# pass r... | code_fim | hard | {
"lang": "python",
"repo": "NickolausDS/concierge-cli",
"path": "/concierge/globus_login.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NickolausDS/concierge-cli path: /concierge/globus_login.py
import sys
import os
import json
import globus_sdk
from globus_sdk.exc import TransferAPIError
from six.moves import input
import webbrowser
from concierge.exc import LoginRequired
from concierge import CONCIERGE_SCOPE
CLIENT_ID = 'd686f... | code_fim | hard | {
"lang": "python",
"repo": "NickolausDS/concierge-cli",
"path": "/concierge/globus_login.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> p, t, _ = permuted_ols(
all_data["delta{0}".format(iq)].values,
all_data[conns].values,
all_data[["Age", "Mod", "Strt.Level", "post phys retr fd"]].values,
)
sig["Male students, delta: {0}, phys retr".format(iq)] = np.max(p[0])
# -
for key in sig.keys():
if sig[key... | code_fim | hard | {
"lang": "python",
"repo": "NBCLab/IDConn",
"path": "/idconn/statistics/poststats_network_conn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NBCLab/IDConn path: /idconn/statistics/poststats_network_conn.py
[fci_shen_pre["condition"] == "lower-level"]
fci_shen_post = fci_shen[fci_shen["session"] == 1]
fci_shen_post_phys = fci_shen_post[fci_shen_post["condition"] == "high-level"]
fci_shen_post_ctrl = fci_shen_post[fci_shen_post["conditi... | code_fim | hard | {
"lang": "python",
"repo": "NBCLab/IDConn",
"path": "/idconn/statistics/poststats_network_conn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NBCLab/IDConn path: /idconn/statistics/poststats_network_conn.py
phys fci fd", "post": "post phys fci fd"}, axis=1, inplace=True
)
df_pivot = fci_fd[fci_fd["condition"] == "lower-level"].reset_index()
fci_ctrl_fd = df_pivot.pivot(index="subject", columns="session", values="average fd")
fci_ctrl... | code_fim | hard | {
"lang": "python",
"repo": "NBCLab/IDConn",
"path": "/idconn/statistics/poststats_network_conn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kaecchi/oprogramowanie path: /oprogramowanie_1/Zadanie09.py
# -*- coding: utf-8 -*-
# Zadanie 9 ---------------------------------
kwota = float(input('Proszę podać kwotę pieniężną: '))
<|fim_suffix|>ile_20 = int(kwota_temp/20)
kwota_temp -= 20 * ile_20
ile_10 = int(kwota_temp/10)
kwota_temp -... | code_fim | hard | {
"lang": "python",
"repo": "Kaecchi/oprogramowanie",
"path": "/oprogramowanie_1/Zadanie09.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ile_10 = int(kwota_temp/10)
kwota_temp -= 10 * ile_10
ile_5 = int(kwota_temp/5)
kwota_temp -= 5 * ile_5
ile_1 = int(kwota_temp/1)
kwota_temp -= 1 * ile_1
print('\nIlość potrzebnych nominałów: ')
print('\n200 zł:', ile_200, '\n100 zł:', ile_100, '\n50 zł:', ile_50, '\n20 zł:', ile_20, '\n10 zł:', ile... | code_fim | medium | {
"lang": "python",
"repo": "Kaecchi/oprogramowanie",
"path": "/oprogramowanie_1/Zadanie09.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ile_5 = int(kwota_temp/5)
kwota_temp -= 5 * ile_5
ile_1 = int(kwota_temp/1)
kwota_temp -= 1 * ile_1
print('\nIlość potrzebnych nominałów: ')
print('\n200 zł:', ile_200, '\n100 zł:', ile_100, '\n50 zł:', ile_50, '\n20 zł:', ile_20, '\n10 zł:', ile_10, '\n5 zł:', ile_5, '\n1 zł:', ile_1)<|fim_prefi... | code_fim | medium | {
"lang": "python",
"repo": "Kaecchi/oprogramowanie",
"path": "/oprogramowanie_1/Zadanie09.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shashankpr/sleep-classification path: /src/utils.py
import numpy as np
import logging
import threading
from sklearn.metrics import confusion_matrix
class Metrics(object):
def __init__(self, predicted_values, true_values):
self.predicted_values = predicted_values
self.true_v... | code_fim | hard | {
"lang": "python",
"repo": "shashankpr/sleep-classification",
"path": "/src/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ThreadSafe(object):
"""Make a generator thread safe.
Takes an iterator/generator and makes it thread-safe by
serializing call to the `next` method of given iterator/generator.
"""
def __init__(self, it):
self.it = it
self.lock = threading.Lock()
def __iter_... | code_fim | hard | {
"lang": "python",
"repo": "shashankpr/sleep-classification",
"path": "/src/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DL-ViT/iLAT path: /utils/utils.py
import time
import sys
import numpy as np
from PIL import Image, ImageDraw
import math
import yaml
import os
import torch.nn.functional as F
from torch.optim.lr_scheduler import LambdaLR
import torch
import cv2
class Config(object):
def __init__(self, confi... | code_fim | hard | {
"lang": "python",
"repo": "DL-ViT/iLAT",
"path": "/utils/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> im = Image.fromarray(img.cpu().numpy().astype(np.uint8).squeeze())
im.save(path)
def torch_init_model(model, init_checkpoint, key):
state_dict = torch.load(init_checkpoint, map_location='cpu')[key]
missing_keys = []
unexpected_keys = []
error_msgs = []
# copy state_dict so _l... | code_fim | hard | {
"lang": "python",
"repo": "DL-ViT/iLAT",
"path": "/utils/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> now = time.time()
info = ' - %.0fs' % (now - self._start)
if self.verbose == 1:
if (now - self._last_update < self.interval and
self.target is not None and current < self.target):
return
prev_total_width = self._total_wid... | code_fim | hard | {
"lang": "python",
"repo": "DL-ViT/iLAT",
"path": "/utils/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EnergyTransition/Flask-ESDL-service path: /application/api/__init__.py
# This work is based on original code developed and copyrighted by TNO 2020.
# Subsequent contributions are licensed to you by the developers of such code and are
# made available to the Project under one or several contrib... | code_fim | medium | {
"lang": "python",
"repo": "EnergyTransition/Flask-ESDL-service",
"path": "/application/api/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> message = 'An unhandled exception occurred.'
log.exception(message)
if not settings.FLASK_DEBUG:
return {'message': message}, 500<|fim_prefix|># repo: EnergyTransition/Flask-ESDL-service path: /application/api/__init__.py
# This work is based on original code developed and copyright... | code_fim | hard | {
"lang": "python",
"repo": "EnergyTransition/Flask-ESDL-service",
"path": "/application/api/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#urlpatterns+=static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
#urlpatterns+=static(settings.UNINEUROLAB_URL, document_root=settings.UNINEUROLAB_ROOT)
# necesito especificar donde esta la ruta para que se pueda conectar el formulario con la base de datos<|fim_prefix|># repo: Juan-Manuel-Diaz/... | code_fim | hard | {
"lang": "python",
"repo": "Juan-Manuel-Diaz/UniNeuroLab",
"path": "/UniNeuroLab/gestionNeuroLab_Panel_de_Control/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Juan-Manuel-Diaz/UniNeuroLab path: /UniNeuroLab/gestionNeuroLab_Panel_de_Control/urls.py
# ARCHIVO URLS DE LA APLICACION COORDINADORA
"""gestionNeuroLab_Panel_de_Control URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject... | code_fim | hard | {
"lang": "python",
"repo": "Juan-Manuel-Diaz/UniNeuroLab",
"path": "/UniNeuroLab/gestionNeuroLab_Panel_de_Control/urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return '%s %s' % (self.first_name, self.last_name)
def save(self, *args, **kwargs):
user = CuserMiddleware.get_user()
if user.is_staff:
self.public = True
super(Profile, self).save(*args, **kwargs)
@property
def full_name(sel... | code_fim | hard | {
"lang": "python",
"repo": "Aleccc/gtcrew",
"path": "/team/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return '%s' % self.email
@register_snippet
class Title(WorkflowMixin, DraftStateMixin, RevisionMixin, index.Indexed, models.Model):
title = models.CharField(max_length=64)
sequence = models.PositiveSmallIntegerField(default=0)
held_by = models.CharField(
... | code_fim | hard | {
"lang": "python",
"repo": "Aleccc/gtcrew",
"path": "/team/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aleccc/gtcrew path: /team/models.py
from cuser.middleware import CuserMiddleware
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.fields import GenericRelation
from django.core.validators import RegexValidator
from django.db import models
from django.urls import rev... | code_fim | hard | {
"lang": "python",
"repo": "Aleccc/gtcrew",
"path": "/team/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vfaronov/django-httpolice path: /django_httpolice/__init__.py
from django_httpolice.__metadata__ import version as __version__
from django_<|fim_suffix|> HTTPoliceMiddleware, backlog
from django_httpolice.views import report_view
__all__ = ['HTTPoliceMiddleware', 'ProtocolError', 'backlog', 'rep... | code_fim | medium | {
"lang": "python",
"repo": "vfaronov/django-httpolice",
"path": "/django_httpolice/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
__all__ = ['HTTPoliceMiddleware', 'ProtocolError', 'backlog', 'report_view']<|fim_prefix|># repo: vfaronov/django-httpolice path: /django_httpolice/__init__.py
from django_httpolice.__metadata__ import version as __version__
from django_<|fim_middle|>httpolice.common import ProtocolError
from django_htt... | code_fim | medium | {
"lang": "python",
"repo": "vfaronov/django-httpolice",
"path": "/django_httpolice/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> git.checkout.assert_called_once_with(branch=checkout, cwd=path)
git.pull_submodules.assert_called_once_with(cwd=path)
# Reset the git mock
git.reset_mock()
# Simulate a normal branch (non-detached head)
git.is_detached_head.return_value = False
# The destination folder is alr... | code_fim | medium | {
"lang": "python",
"repo": "steinwurf/waf",
"path": "/test/python/test_git_checkout_resolver.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # The destination folder is already created, so the next resolve
# should just run git pull
path3 = resolver.resolve()
assert path3 == path
assert git.checkout.called is False
assert git.pull.called is False
git.pull_submodules.assert_called_once_with(cwd=path)<|fim_prefix|>#... | code_fim | hard | {
"lang": "python",
"repo": "steinwurf/waf",
"path": "/test/python/test_git_checkout_resolver.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: steinwurf/waf path: /test/python/test_git_checkout_resolver.py
import os
import mock
from wurf.git_checkout_resolver import GitCheckoutResolver
def test_git_checkout_resolver(testdirectory):
ctx = mock.Mock()
git = mock.Mock()
dependency = mock.Mock()
cwd = testdirectory.path(... | code_fim | hard | {
"lang": "python",
"repo": "steinwurf/waf",
"path": "/test/python/test_git_checkout_resolver.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: deeplearningunb/review_analyzer path: /web_scrapping/get_review.py
from bs4 import BeautifulSoup
import requests
import csv
import os
import sys
class ReviewScrapper:
def get_page(self, url):
aux = 1
csv_data = []
url_test = url.replace("https://www.rottentomatoe... | code_fim | hard | {
"lang": "python",
"repo": "deeplearningunb/review_analyzer",
"path": "/web_scrapping/get_review.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
filename = sys.argv[1]
f = open(filename, "r")
for i in f:
url = str(i.replace("\n", ""))
reviews = ReviewScrapper()
reviews.get_page(url)<|fim_prefix|># repo: deeplearningunb/review_analyzer path: /web_scrapping/get_review.py
from bs4 import... | code_fim | hard | {
"lang": "python",
"repo": "deeplearningunb/review_analyzer",
"path": "/web_scrapping/get_review.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if another:
aux = 0
else:
aux = aux + 1
print(soup.find_all('row review_table_row'))
for review in soup.find_all("div", class_="row review_table_row"):
review_text = review.find("div", class_="the_review")
... | code_fim | hard | {
"lang": "python",
"repo": "deeplearningunb/review_analyzer",
"path": "/web_scrapping/get_review.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nahog/pico-tetris path: /char_numbers.py
self._display.pixel(x+9, y-3)
self._display.pixel(x+9, y-4)
self._display.pixel(x+9, y-5)
self._display.pixel(x+9, y-6)
self._display.pixel(x+9, y-7)
# Line 11
self._display.pixel(x+10... | code_fim | hard | {
"lang": "python",
"repo": "nahog/pico-tetris",
"path": "/char_numbers.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|>lf._display.pixel(x+6, y-7)
self._display.pixel(x+6, y-8)
# Line 8
self._display.pixel(x+7, y-1)
self._display.pixel(x+7, y-2)
self._display.pixel(x+7, y-3)
self._display.pixel(x+7, y-4)
self._display.pixel(x+7, y-5)
... | code_fim | hard | {
"lang": "python",
"repo": "nahog/pico-tetris",
"path": "/char_numbers.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|>+13, y)
self._display.pixel(x+13, y-1)
self._display.pixel(x+13, y-2)
self._display.pixel(x+13, y-6)
self._display.pixel(x+13, y-7)
self._display.pixel(x+13, y-8)
# Line 15
self._display.pixel(x+14, y)
self._di... | code_fim | hard | {
"lang": "python",
"repo": "nahog/pico-tetris",
"path": "/char_numbers.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thisisjeffchen/gans_graphic_generation path: /tensorflow_version/copy_results.py
import argparse
import os
import glob
import shutil
import errno
GEN_SAMPLES_DIR = "gen_samples"
STYLE_SAMPLES_DIR = "styled_gen_samples"
def main():
parser = argparse.ArgumentParser()
parser.add_argument('... | code_fim | hard | {
"lang": "python",
"repo": "thisisjeffchen/gans_graphic_generation",
"path": "/tensorflow_version/copy_results.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if os.path.exists(complete_style_path):
shutil.rmtree(os.path.join(dest_path, STYLE_SAMPLES_DIR))
shutil.copytree(complete_style_path,
os.path.join(dest_path, STYLE_SAMPLES_DIR))
for filename in glob.glob(os.path.join(from_path, '*.txt')):
shutil.co... | code_fim | hard | {
"lang": "python",
"repo": "thisisjeffchen/gans_graphic_generation",
"path": "/tensorflow_version/copy_results.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for filename in glob.glob(os.path.join(from_path, '*.txt')):
shutil.copy(filename, dest_path)
if __name__ == '__main__':
main()<|fim_prefix|># repo: thisisjeffchen/gans_graphic_generation path: /tensorflow_version/copy_results.py
import argparse
import os
import glob
import shutil... | code_fim | hard | {
"lang": "python",
"repo": "thisisjeffchen/gans_graphic_generation",
"path": "/tensorflow_version/copy_results.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robert-g-butler/python_reference_guide path: /module_matplotlib.py
'''
This script contains examples of functions that can be used from the
MatplotLib module.
'''
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(start=1, stop=5, num=11)
y = x**2
# Functional Meth... | code_fim | hard | {
"lang": "python",
"repo": "robert-g-butler/python_reference_guide",
"path": "/module_matplotlib.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Making Subplots with OO Plotting
fig, axes = plt.subplots(nrows=1, ncols=2) # subplots() is just a multi-axes wrapper for figure()
fig
axes
for ax in axes:
ax.plot(x,y)
fig
axes[0].plot(x,y)
axes[1].plot(y,x)
fig
axes[0].set_title('1st')
axes[1].set_title('2nd')
fig
# Setting Size an... | code_fim | hard | {
"lang": "python",
"repo": "robert-g-butler/python_reference_guide",
"path": "/module_matplotlib.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: youqingkui/alexa_skill_server path: /config/error.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/11/20 17:17
# @Author : youqingkui
# @File : __init__.py
# @Desc :
class Err(object):
<|fim_suffix|>
class Msg(object):
Invalid_request = 'Invalid Request'
... | code_fim | medium | {
"lang": "python",
"repo": "youqingkui/alexa_skill_server",
"path": "/config/error.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Msg(object):
Invalid_request = 'Invalid Request'
Internal_server_error = 'Internal Server Error'
Not_found = 'Not Found'
Unknown_error = 'Unknown Error'<|fim_prefix|># repo: youqingkui/alexa_skill_server path: /config/error.py
#!/usr/bin/env python
# -*- coding: ... | code_fim | medium | {
"lang": "python",
"repo": "youqingkui/alexa_skill_server",
"path": "/config/error.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while h:
nh = h.next
while nh and nh.val == h.val:
nh = nh.next
h.next = nh
h = h.next
return head
if __name__ == '__main__':
s1 = ListNode(1)
s2 = ListNode(1)
s3 = ListNode(2)
s1.next = s2
s2.next = s3
... | code_fim | medium | {
"lang": "python",
"repo": "wh-acmer/minixalpha-acm",
"path": "/LeetCode/Python/remove_duplicates_from_sorted_list.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wh-acmer/minixalpha-acm path: /LeetCode/Python/remove_duplicates_from_sorted_list.py
#!/usr/bin/env python
#coding: utf-8
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
<|fim_suffix|> s = Solution()
s1 = s.del... | code_fim | hard | {
"lang": "python",
"repo": "wh-acmer/minixalpha-acm",
"path": "/LeetCode/Python/remove_duplicates_from_sorted_list.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.