text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: icui/seisflows path: /seisflows/preprocess/ortho.py
import sys
import numpy as np
import obspy
from os.path import join
from seisflows.tools import msg, unix
from seisflows.tools.tools import exists, getset
from seisflows.config import ParameterError, custom_import
from seisflows.plugins impor... | code_fim | hard | {
"lang": "python",
"repo": "icui/seisflows",
"path": "/seisflows/preprocess/ortho.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def write_adjoint_traces(self, path, syn, obs, channel,att=""):
""" Writes "adjoint traces" required for gradient computation
(overwrites synthetic data in the process)
INPUT
PATH - location "adjoint traces" will be written
SYN - obspy Stream object ... | code_fim | hard | {
"lang": "python",
"repo": "icui/seisflows",
"path": "/seisflows/preprocess/ortho.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('-n', '--number', type=int, required=True, help='Number of element')
def handle(self, **kwargs):
fake = Faker()
number = kwargs['number']
tmp = []
for _ in tqdm(range(number)... | code_fim | medium | {
"lang": "python",
"repo": "zxalif/simpleapi",
"path": "/game/management/commands/create_fake_game.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zxalif/simpleapi path: /game/management/commands/create_fake_game.py
from django.core.management.base import BaseCommand
from game.models import Category, Game
from tqdm import tqdm
import random
from faker import Faker
<|fim_suffix|> parser.add_argument('-n', '--number', type=int, re... | code_fim | medium | {
"lang": "python",
"repo": "zxalif/simpleapi",
"path": "/game/management/commands/create_fake_game.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fagan2888/scikit-lr path: /sklr/ensemble/__init__.py
"""
The :mod:`sklr.ensemble` module includes ensemble-based methods for
Label Ranking and Partial Label Ranking problems.
"""
# =============================================================================
# Imports
# ========================... | code_fim | hard | {
"lang": "python",
"repo": "fagan2888/scikit-lr",
"path": "/sklr/ensemble/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># =============================================================================
# Public objects
# =============================================================================
# Set the classes that are accessible
# from the module sklr.ensemble
__all__ = [
"BaggingLabelRanker", "BaggingPartialLabel... | code_fim | medium | {
"lang": "python",
"repo": "fagan2888/scikit-lr",
"path": "/sklr/ensemble/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: direkshan-digital/iris-agent path: /backend/iris/state_machine/middleware.py
from .core import StateMachine
from .basic import Print
#
class Middleware:
def test(self, text):
return True
def transform(self):
pass
def hint(self):
return []
# print out a help m... | code_fim | hard | {
"lang": "python",
"repo": "direkshan-digital/iris-agent",
"path": "/backend/iris/state_machine/middleware.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|># execute a help automata then return to caller (store help_state in closure)
def gen_state_caller(help_state):
def anon(caller):
if caller.get_when_done_state():
return help_state.when_done(caller.get_when_done_state())
return help_state
return anon
# TODO: given docs... | code_fim | medium | {
"lang": "python",
"repo": "direkshan-digital/iris-agent",
"path": "/backend/iris/state_machine/middleware.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: margrietpalm/montage_movies path: /montage_movies.py
#!/usr/bin/env python
"""Combine multiple movies into one"""
import argparse
import sys
import os
import glob
import shutil
import future
from im2movie import makeMovie
__author__ = "Margriet Palm"
__copyright__ = "Copyright 2018"
__credits_... | code_fim | hard | {
"lang": "python",
"repo": "margrietpalm/montage_movies",
"path": "/montage_movies.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># # get command-line arguments
# opt = parse_args()
# # check arguments
# if not opt.inputpath.endswith('/'):
# opt.inputpath += '/'
# if not opt.outputpath.endswith('/'):
# opt.outputpath += '/'
# makeMovie(opt.id, opt.imtype, opt.moviename, opt.inputpath, opt.outputpa... | code_fim | hard | {
"lang": "python",
"repo": "margrietpalm/montage_movies",
"path": "/montage_movies.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.nodeItem.setColor(QtGui.QColor(color))
self.nodeItem.setUnselectedColor(self.nodeItem.getColor().darker(125))
self.nodeItem.setSelectedColor(self.nodeItem.getColor().lighter(175))
self.nodeItem.setHoveredColor(self.nodeItem.getColor().lighter(110))
# =======
#... | code_fim | hard | {
"lang": "python",
"repo": "r4inm4ker/Kraken",
"path": "/Python/kraken/ui/backdrop_inspector.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: r4inm4ker/Kraken path: /Python/kraken/ui/backdrop_inspector.py
#
# Copyright 2010-2014 Fabric Technologies Inc. All rights reserved.
#
from PySide import QtGui, QtCore
from kraken.ui.color_widget import KColorWidget
class BackdropInspector(QtGui.QDialog):
"""A widget providing the abilit... | code_fim | hard | {
"lang": "python",
"repo": "r4inm4ker/Kraken",
"path": "/Python/kraken/ui/backdrop_inspector.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setNodeColor(self, color):
self.nodeItem.setColor(QtGui.QColor(color))
self.nodeItem.setUnselectedColor(self.nodeItem.getColor().darker(125))
self.nodeItem.setSelectedColor(self.nodeItem.getColor().lighter(175))
self.nodeItem.setHoveredColor(self.nodeItem.getColor()... | code_fim | hard | {
"lang": "python",
"repo": "r4inm4ker/Kraken",
"path": "/Python/kraken/ui/backdrop_inspector.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: d3v3l0/sketchstore path: /python/cube_board.py
import math
import os
from typing import Sequence, Tuple
import numpy as np
import pandas as pd
from tqdm import tqdm
import sketch.compress_freq as cf
import sketch.compress_quant as cq
import sketch.compress_dyadic as cd
import sketch.sketch_gen ... | code_fim | hard | {
"lang": "python",
"repo": "d3v3l0/sketchstore",
"path": "/python/cube_board.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ("q_pps", "uniform", False),
("q_random_sample", "weighted@20", False),
]
}, # 0
{
"data_name": "bsynthf@4",
"board_size": 50000,
"quantile": False,
"workload_p": .2,
"sketch_types": [
# ("top_values", "uniform", ... | code_fim | hard | {
"lang": "python",
"repo": "d3v3l0/sketchstore",
"path": "/python/cube_board.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>experiment_runs = [
{
"data_name": "bsynthq@4",
"board_size": 50000,
"quantile": True,
"workload_p": .2,
"sketch_types": [
# ("q_top_values", "uniform", False),
("q_pps", "weighted@20", False),
("q_random_sample", "uniform", F... | code_fim | hard | {
"lang": "python",
"repo": "d3v3l0/sketchstore",
"path": "/python/cube_board.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> prev_net_fd = open("/proc/self/ns/net", 'rb')
r = LIBC.unshare(CLONE_NEWNET)
if r != 0:
print('[!] Are you running within "unshare -Ur" ? Need unshare() syscall.')
sys.exit(-1)
# mode tun, since we don't actually plan on anyon... | code_fim | hard | {
"lang": "python",
"repo": "AkihiroSuda/slirpnetstack",
"path": "/tests/base.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AkihiroSuda/slirpnetstack path: /tests/base.py
from . import utils
import ctypes
import errno
import functools
import io
import os
import re
import shlex
import signal
import socket
import subprocess
import unittest
import random
LIBC = ctypes.CDLL("libc.so.6")
SLIRPNETSTACKBIN = os.environ.get(... | code_fim | hard | {
"lang": "python",
"repo": "AkihiroSuda/slirpnetstack",
"path": "/tests/base.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = utils.connect(*args, **kwargs)
payload = b'bob%f\n' % random.random()
s.sendall(payload)
self.assertEqual(payload, s.recv(1024))
s.close()
def assertTcpRefusedError(self, ip="127.0.0.1", port=0):
with self.assertRaises(socket.error) as e:
... | code_fim | hard | {
"lang": "python",
"repo": "AkihiroSuda/slirpnetstack",
"path": "/tests/base.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Adds transparency according to a pre-computed mask of the central circle.
"""
black_mask_undistorted_file = open(os.path.join(settings.BASE_DIR, 'static', 'mask_undistorted.npy'), 'r')
black_mask_undistorted = np.load(black_mask_undistorted_file)
alpha = 200 * black_mask_u... | code_fim | hard | {
"lang": "python",
"repo": "FSavoy/visuo-server",
"path": "/data/tasks.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def transparency(img):
"""
Adds transparency according to a pre-computed mask of the central circle.
"""
black_mask_undistorted_file = open(os.path.join(settings.BASE_DIR, 'static', 'mask_undistorted.npy'), 'r')
black_mask_undistorted = np.load(black_mask_undistorted_file)
alp... | code_fim | hard | {
"lang": "python",
"repo": "FSavoy/visuo-server",
"path": "/data/tasks.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FSavoy/visuo-server path: /data/tasks.py
from cStringIO import StringIO
from django.core.files.uploadedfile import SimpleUploadedFile
import numpy as np
import os
from django.conf import settings
from PIL import Image
from data.models import SkyPicture
from alligator import Gator
import scipy.mis... | code_fim | medium | {
"lang": "python",
"repo": "FSavoy/visuo-server",
"path": "/data/tasks.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: soitun/hiphop-php path: /third-party/thrift/src/thrift/lib/python/capi/test/test_marshal.py
#!/usr/bin/env fbpython
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... | code_fim | hard | {
"lang": "python",
"repo": "soitun/hiphop-php",
"path": "/third-party/thrift/src/thrift/lib/python/capi/test/test_marshal.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_float64(self) -> None:
for x in (-float_info.max, -1.0, 0.0, float_info.max):
self.assertEqual(x, fixture.roundtrip_double(x))
self.assert_type_error(fixture.roundtrip_double, None, "oops")
def test_bool(self) -> None:
for x in (True, False):
... | code_fim | hard | {
"lang": "python",
"repo": "soitun/hiphop-php",
"path": "/third-party/thrift/src/thrift/lib/python/capi/test/test_marshal.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VE7PPE/js8cli path: /lib/location.py
"""
This file is part of js8cli by ThreeSixes https://github.com/threesixes
"""
from pprint import pprint
import maidenhead as mh
import gpsd
class Location:
"""
Location data class.
"""
def __init__(self, gpsd_host='127.0.0.1', gpsd_port=2... | code_fim | hard | {
"lang": "python",
"repo": "VE7PPE/js8cli",
"path": "/lib/location.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return mh_resp
def coords(self):
"""
Get coordinates from the GPS unit.
"""
return self.__get_gps_location()
def maidenhead(self, level=4):
"""
Get maidenhead grid locator from GPS.
"""
return self.__get_maidenhead(level... | code_fim | hard | {
"lang": "python",
"repo": "VE7PPE/js8cli",
"path": "/lib/location.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Viewing cone calculation constants
ANGULAR_VELOCITY_EARTH = 7.2921159e-5 # rad/sec
EARTH_A_AXIS = 6378137.0 # Earth's semi major axis(meters)
EARTH_B_AXIS = 6356752.3142 # Earth's semi minor axis (meters)
SECONDS_PER_DAY = 23 * 60 * 60 + 56 * 60 + mp.mpf('4.0989')
THETA_NAUGHT = 0 # visibility thres... | code_fim | medium | {
"lang": "python",
"repo": "KMC-70/kaos",
"path": "/kaos/constants.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KMC-70/kaos path: /kaos/constants.py
"""This file defines the constants used in satellite-to-site visibility calculations.
Author: Team KMC-70
"""
<|fim_suffix|># Viewing cone calculation constants
ANGULAR_VELOCITY_EARTH = 7.2921159e-5 # rad/sec
EARTH_A_AXIS = 6378137.0 # Earth's semi major a... | code_fim | medium | {
"lang": "python",
"repo": "KMC-70/kaos",
"path": "/kaos/constants.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def pushed_down():
selected[0] = (selected[0] + 1) % 3
def pushed_right():
selected[1] = (selected[1] + 1) % 3
def deselect():
for i in range(3):
for ii in range(3):
grid[i][ii][2] = 0
def select():
deselect()
... | code_fim | hard | {
"lang": "python",
"repo": "Bamiot/morpyon-for-sense-hat",
"path": "/main.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bamiot/morpyon-for-sense-hat path: /main.py
from sense_hat import SenseHat
from time import sleep as wait
from AI import morpyon
#from morpyon.AI import morpyon
sense = SenseHat()
sense.clear()
sense.low_light = True
activate_ai = True
red = [255, 0, 0]
green = [0, 255, 0]
blue = ... | code_fim | hard | {
"lang": "python",
"repo": "Bamiot/morpyon-for-sense-hat",
"path": "/main.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> showCircEventsDownload: {{ "true" if show_circ_events_download else "false" }},
settingUp: {{ "true" if setting_up else "false" }}
});
</script>
</body>
</html>
"""
admin_sign_in_again = """
<!doctype html>
<html>
<head><title>Circulation Manager</title></head>
<body>
<p>You are n... | code_fim | medium | {
"lang": "python",
"repo": "datalogics-dans/circulation",
"path": "/api/admin/templates.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: datalogics-dans/circulation path: /api/admin/templates.py
admin = """
<!doctype html>
<html>
<head>
<title>Circulation Manager</title>
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
<link href=\"/admin/static/circulation-web.css<|fim_suffix|> showCircEventsDownloa... | code_fim | medium | {
"lang": "python",
"repo": "datalogics-dans/circulation",
"path": "/api/admin/templates.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/or-tools/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.packa... | code_fim | hard | {
"lang": "python",
"repo": "JayjeetAtGithub/spack",
"path": "/var/spack/repos/builtin/packages/or-tools/package.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> cmake_args = []
cmake_args.append("-DBUILD_DEPS=OFF")
cmake_args.append("-DBUILD_PYTHON=OFF")
cmake_args.append(self.define_from_variant("USE_COINOR", "coin"))
cmake_args.append("-DUSE_SCIP=ON")
cmake_args.append("-DBUILD_SCIP=ON")
cmake_args.append(... | code_fim | hard | {
"lang": "python",
"repo": "JayjeetAtGithub/spack",
"path": "/var/spack/repos/builtin/packages/or-tools/package.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Django's regex for URL validation
regex = re.compile(
r'^(?:http|ftp)s?://' # http:// or https://
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' # domain...
r'localhost|' # localhost...
... | code_fim | hard | {
"lang": "python",
"repo": "chezmix/cuenco",
"path": "/cuenco/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chezmix/cuenco path: /cuenco/models.py
import re
from cuenco import db
class WebLink(db.Model):
id = db.Column(db.Integer, primary_key=True)
long_url = db.Column(db.String(512))
url_hash = db.Column(db.String(10), unique=True)
md5_hash = db.Column(db.String(32), unique=True)
... | code_fim | hard | {
"lang": "python",
"repo": "chezmix/cuenco",
"path": "/cuenco/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: isabella232/mantissa path: /xmantissa/test/livetest_prefs.py
from axiom.store import Store
from axiom.dependency import installOn
from nevow.livetrial.testcase import TestCase
from nevow.athena import expose
from xmantissa import prefs
<|fim_suffix|> f.tab = Tab
f.setFragmentPa... | code_fim | hard | {
"lang": "python",
"repo": "isabella232/mantissa",
"path": "/xmantissa/test/livetest_prefs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class GeneralPrefs(_PrefMixin, TestCase):
"""
Test case which renders L{xmantissa.ixmantissa.DefaultPreferenceCollection}
and ensures that values changed client-side are correctly persisted
"""
jsClass = u'Mantissa.Test.GeneralPrefs'
def checkPersisted(self, itemsPerPage, timezone... | code_fim | hard | {
"lang": "python",
"repo": "isabella232/mantissa",
"path": "/xmantissa/test/livetest_prefs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: swistov/amtg path: /notifications.py
import asyncio
from abc import ABCMeta, abstractmethod
from typing import Optional, Union, List
from aiogram import Bot
class NotificationChannel(metaclass=ABCMeta):
@abstractmethod
async def notify(self, text: str) -> None:
pass
class Tel... | code_fim | hard | {
"lang": "python",
"repo": "swistov/amtg",
"path": "/notifications.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def notify_all(self, text: str) -> None:
await asyncio.gather(
*[ch.notify(text) for ch in self.channels]
)
notifier = Notifier()<|fim_prefix|># repo: swistov/amtg path: /notifications.py
import asyncio
from abc import ABCMeta, abstractmethod
from typing import Opt... | code_fim | hard | {
"lang": "python",
"repo": "swistov/amtg",
"path": "/notifications.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abhatia05/Udemy---Colt-Steele-Modern-Python-Bootcamp-Codebook path: /07. FirstProject/tuple.py
ages = (22, 3, 44, 50, 99, 1)
# Above defined data is called tuple and it is immutable.
# Immutable data can't be changed in terms of its value once assigne<|fim_suffix|>t to print 1st 2nd 3rd element... | code_fim | medium | {
"lang": "python",
"repo": "abhatia05/Udemy---Colt-Steele-Modern-Python-Bootcamp-Codebook",
"path": "/07. FirstProject/tuple.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>aries, Functions
# Regular Expressions, Strings
# Exception Handling and File Handling
# Classes and Objects
# Database Connections
# Modules and Packages<|fim_prefix|># repo: abhatia05/Udemy---Colt-Steele-Modern-Python-Bootcamp-Codebook path: /07. FirstProject/tuple.py
ages = (22, 3, 44, 50, 99, 1)... | code_fim | hard | {
"lang": "python",
"repo": "abhatia05/Udemy---Colt-Steele-Modern-Python-Bootcamp-Codebook",
"path": "/07. FirstProject/tuple.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 合并相同方法的结果
data_Aqua_KNN = data_Aqua_KNN.set_index(data_Aqua.index)
data_Aqua_KNN.columns = data_Aqua.columns
data_Aqua_KNN["日期合并用"] = data_Aqua_KNN.index
data_Aqua_ewm = data_Aqua_ewm.set_index(data_Aqua.index)
data_Aqua_ewm.columns = data_Aqua.columns
data_Aqua_ewm["日期合并用"] ... | code_fim | hard | {
"lang": "python",
"repo": "MddeLip/MODIS_AOD_PM25",
"path": "/气溶胶/四种插值方法和结果.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MddeLip/MODIS_AOD_PM25 path: /气溶胶/四种插值方法和结果.py
# -*- coding: utf-8 -*-
# 作者: xcl
# 时间: 2019/8/7 11:10
# 库
import pandas as pd
import numpy as np
from fancyimpute import KNN, IterativeImputer
import os
# 路径
input_file_path_Aqua = "D:\\毕业论文程序\\气溶胶光学厚度\\空间转换模块\\Aqua\\2018\\"
input_file_path_Terra ... | code_fim | hard | {
"lang": "python",
"repo": "MddeLip/MODIS_AOD_PM25",
"path": "/气溶胶/四种插值方法和结果.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 空间局部: IDW
data_Aqua_IDW = get_IDW(data_Aqua)
data_Terra_IDW = get_IDW(data_Terra)
# 空间全局: 迭代函数法,缺失特征作为y,其他特征作为x
data_Aqua_Iterative = IterativeImputer(
max_iter=10).fit_transform(data_Aqua)
data_Aqua_Iterative = pd.DataFrame(data_Aqua_Iterative)
data_Terra_Iterative ... | code_fim | hard | {
"lang": "python",
"repo": "MddeLip/MODIS_AOD_PM25",
"path": "/气溶胶/四种插值方法和结果.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: microsoft/simple_ado path: /simple_ado/utilities.py
"""Utilities for dealing with the ADO REST API."""
import logging
from typing import Callable, Optional
import requests
from simple_ado.exceptions import ADOHTTPException
def boolstr(value: bool) -> str:
<|fim_suffix|> :param value: The ... | code_fim | medium | {
"lang": "python",
"repo": "microsoft/simple_ado",
"path": "/simple_ado/utilities.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if callback is not None:
callback(total_downloaded, total_size)
if total_size != 0:
progress = int((total_downloaded * 100.0) / total_size)
log.info(f"Download progress: {progress}%")<|fim_prefix|># repo: microsoft/simple_ado path: ... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/simple_ado",
"path": "/simple_ado/utilities.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@bot.message_handler(func=helpers.check_new_color_theme)
def set_color_theme(message):
if not message.chat.id in users:
users[message.chat.id] = User()
users[message.chat.id].set_color_theme(message.text)
bot.reply_to(message, 'Новая тема установлена!')
@bot.message_handler(func=lambda message: Tru... | code_fim | hard | {
"lang": "python",
"repo": "googlewaitme/picture-bot",
"path": "/bot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: googlewaitme/picture-bot path: /bot.py
import telebot
import settings
import helpers
from models import User
bot = telebot.TeleBot(settings.token, parse_mode=None)
users = dict()
@bot.message_handler(commands=['start', 'help'])
def send_help(message):
if not message.chat.id in users:
users[... | code_fim | hard | {
"lang": "python",
"repo": "googlewaitme/picture-bot",
"path": "/bot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andela/ah-bird-box path: /authors/apps/articles/serializers.py
from rest_framework import serializers
from .models import Article, Tag
from authors.apps.articles.relations import TagsRelation
class ArticleSerializers(serializers.ModelSerializer):
def format_date(self, date):
return... | code_fim | hard | {
"lang": "python",
"repo": "andela/ah-bird-box",
"path": "/authors/apps/articles/serializers.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Article
fields = (
'title',
'description',
'body',
'slug',
'image',
'image_url',
'author',
'tags',
'created_at',
'updated_at',
'averageRating',
... | code_fim | hard | {
"lang": "python",
"repo": "andela/ah-bird-box",
"path": "/authors/apps/articles/serializers.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ###
op.create_table('product',
sa.Column('id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), nullable=False),
sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
sa.Column('updated_at', ... | code_fim | medium | {
"lang": "python",
"repo": "agaverdi/anbar_maqazin_service",
"path": "/anbar_service/migrations/versions/e42634bdeca3_.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('anbar',
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('created_at', postgresql.TIMESTAMP(), server_default=sa.text('now()'), autoincrement=False, nullable=T... | code_fim | hard | {
"lang": "python",
"repo": "agaverdi/anbar_maqazin_service",
"path": "/anbar_service/migrations/versions/e42634bdeca3_.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agaverdi/anbar_maqazin_service path: /anbar_service/migrations/versions/e42634bdeca3_.py
"""empty message
Revision ID: e42634bdeca3
Revises: 9b413d81e5f7
Create Date: 2020-08-15 13:11:44.225101
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
import ... | code_fim | hard | {
"lang": "python",
"repo": "agaverdi/anbar_maqazin_service",
"path": "/anbar_service/migrations/versions/e42634bdeca3_.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.axial_coordinates = np.array([axial_coordinates])
self.position = hx.axial_to_pixel(self.axial_coordinates, radius)
self.color = color
self.radius = radius
self.image = make_hex_surface(color, radius, border=True)
def get_color(self):
return self.c... | code_fim | hard | {
"lang": "python",
"repo": "NicholasCG/HexBattleSimulator",
"path": "/main/__main__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NicholasCG/HexBattleSimulator path: /main/__main__.py
sorted_x = sorted(points[:, 0])
sorted_y = sorted(points[:, 1])
minx = sorted_x[0]
maxx = sorted_x[-1]
miny = sorted_y[0]
maxy = sorted_y[-1]
sorted_idxs = np.lexsort((points[:, 0], points[:, 1]))
surf_size ... | code_fim | hard | {
"lang": "python",
"repo": "NicholasCG/HexBattleSimulator",
"path": "/main/__main__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NicholasCG/HexBattleSimulator path: /main/__main__.py
seemed to default to ALSA, which was causing an underrun error.
import os
os.environ['SDL_AUDIODRIVER'] = 'dsp'
import hexy as hx
import numpy as np
import pygame as pg
from tkinter import filedialog, Tk
import game_board as hxgame
COLORS =... | code_fim | hard | {
"lang": "python",
"repo": "NicholasCG/HexBattleSimulator",
"path": "/main/__main__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> heapq.heappush(heap, (-value, key))
ct = len(arr)/2 if len(arr)%2==0 else (len(arr)+1)/2
a = 0
while ct>0:
x = heappop(heap)
ct-= -1 * x[0]
a +=1
return a<|fim_prefix|># repo: Khalid-Sultan/Phase-2-Algorithms-Prep path: /Leetc... | code_fim | hard | {
"lang": "python",
"repo": "Khalid-Sultan/Phase-2-Algorithms-Prep",
"path": "/Leetcode/Array/2_-_Medium/1338._Reduce_Array_Size_to_The_Half.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Khalid-Sultan/Phase-2-Algorithms-Prep path: /Leetcode/Array/2_-_Medium/1338._Reduce_Array_Size_to_The_Half.py
class Solution:
def minSetSize(self, arr: List[int]) -> int:
d = {}
for i in arr:
if<|fim_suffix|> heapq.heappush(heap, (-value, key))
ct... | code_fim | hard | {
"lang": "python",
"repo": "Khalid-Sultan/Phase-2-Algorithms-Prep",
"path": "/Leetcode/Array/2_-_Medium/1338._Reduce_Array_Size_to_The_Half.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: j-kun/Irre-Katze-Level-Editor path: /py/model_background_catalog.py
#!/usr/bin/env python
import os.path
import logging
import locales
_ = locales._
from gui_image_opener import toAbsPath, getBackground
PATH_BACKGROUNDS = toAbsPath('backgrounds/gif')
pattern_fn = 'irka3_{fld}{scheme}.fld'
TI... | code_fim | medium | {
"lang": "python",
"repo": "j-kun/Irre-Katze-Level-Editor",
"path": "/py/model_background_catalog.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|>CATEGORY_BORDER = list()
CATEGORY_TOUCHED = list()
CATEGORY_UNTOUCHED = list()
def getBackgrounds():
l = os.listdir(PATH_BACKGROUNDS)
for fn in l:
if fn[0] == '.':
logging.debug(_("ignoring hidden file {fn} in {path}").format(fn=fn, path=PATH_IMAGES))
continue
... | code_fim | medium | {
"lang": "python",
"repo": "j-kun/Irre-Katze-Level-Editor",
"path": "/py/model_background_catalog.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
tk = Tk()
tk.resizable(width=FALSE, height=FALSE)
tk.title('Change Google sharing uri to img uri')
app = AppGui(tk)
app.mainloop()
if __name__ == '__main__':
main()<|fim_prefix|># repo: pokk/AutoScriptor path: /GenerateGoogleFileLink/generate_google_file_link.py
""... | code_fim | hard | {
"lang": "python",
"repo": "pokk/AutoScriptor",
"path": "/GenerateGoogleFileLink/generate_google_file_link.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pokk/AutoScriptor path: /GenerateGoogleFileLink/generate_google_file_link.py
""" Created by jieyi on 4/27/17. """
from tkinter import Frame, Tk, Label, Entry
from tkinter.constants import FALSE
class AppGui(Frame):
def __init__(self, master=None):
# Init the window frame.
Fr... | code_fim | medium | {
"lang": "python",
"repo": "pokk/AutoScriptor",
"path": "/GenerateGoogleFileLink/generate_google_file_link.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ''' UDP nothing returns if server is unavailable '''
try:
r = self.server.status(tries=self.timeout)
self.latency = r.latency/1000
self.is_alive = True
text = r.description
except Exception as err:
self.latency... | code_fim | medium | {
"lang": "python",
"repo": "hamsteruser/gameservers_checking_tool",
"path": "/game_servers_status/minecraft.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_server_ping(self) -> float:
self.server_monitoring()
return self.latency
def is_server_alive(self) -> bool:
self.server_monitoring()
return self.is_alive
def __del__(self):
pass<|fim_prefix|># repo: hamsteruser/ga... | code_fim | hard | {
"lang": "python",
"repo": "hamsteruser/gameservers_checking_tool",
"path": "/game_servers_status/minecraft.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hamsteruser/gameservers_checking_tool path: /game_servers_status/minecraft.py
#!/usr/bin/env python
from mcstatus import MinecraftServer
class TargetGame(object):
def __init__(self, host: str, port: int, timeout: int):
<|fim_suffix|> ''' UDP nothing returns if server is unavailab... | code_fim | hard | {
"lang": "python",
"repo": "hamsteruser/gameservers_checking_tool",
"path": "/game_servers_status/minecraft.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aman-roy/oppia path: /core/domain/feedback_jobs_one_off_test.py
# Copyright 2019 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at... | code_fim | hard | {
"lang": "python",
"repo": "aman-roy/oppia",
"path": "/core/domain/feedback_jobs_one_off_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _check_model_validity(
self, user_id, thread_id, original_user_feedback_model):
"""Checks if the model was migrated correctly."""
migrated_user_feedback_model = (
feedback_models.GeneralFeedbackThreadUserModel
.get(user_id, thread_id))
se... | code_fim | hard | {
"lang": "python",
"repo": "aman-roy/oppia",
"path": "/core/domain/feedback_jobs_one_off_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_successful_migration_unchanged_model(self):
user_id = 'user_id'
thread_id = 'exploration.exp_id.thread_id'
instance_id = '%s.%s' % (user_id, thread_id)
user_feedback_model = feedback_models.GeneralFeedbackThreadUserModel(
id=instance_id, user_id=use... | code_fim | hard | {
"lang": "python",
"repo": "aman-roy/oppia",
"path": "/core/domain/feedback_jobs_one_off_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: astropy/astropy path: /astropy/io/ascii/tests/test_c_reader.py
ascii.read(text, format="basic", guess=False, comment="##")
@pytest.mark.parametrize("parallel", [True, False])
def test_read_tab(parallel, read_tab):
"""
The fast reader for tab-separated values should not strip whitespac... | code_fim | hard | {
"lang": "python",
"repo": "astropy/astropy",
"path": "/astropy/io/ascii/tests/test_c_reader.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(f"Saving the table to {filename}")
t.write(filename, format="ascii.csv", overwrite=True)
t = None
print(
"Counting the number of lines in the csv, it should be {NB_ROWS} + 1 (header)."
)
with open(filename) as f:
assert sum(1 for line in f) == NB_ROWS + 1
... | code_fim | hard | {
"lang": "python",
"repo": "astropy/astropy",
"path": "/astropy/io/ascii/tests/test_c_reader.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: astropy/astropy path: /astropy/io/ascii/tests/test_c_reader.py
e wrong answer).
Attempts to produce a more minimal example were unsuccessful, so the whole
thing is included.
"""
tbl = dedent(
"""
"ID","TIMESTAMP","addendum_id","bib_reference","bib_reference_url","clien... | code_fim | hard | {
"lang": "python",
"repo": "astropy/astropy",
"path": "/astropy/io/ascii/tests/test_c_reader.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return inputString == inputString[::-1]
if __name__ == '__main__':
assert not checkPalindrome("zzzazzazz")
assert checkPalindrome("abacaba")<|fim_prefix|># repo: RafayAK/CodingPrep path: /CodeSignal/check_palindrome.py
"""
Given the string, check if it is a palindrome.
Example
For inputStr... | code_fim | medium | {
"lang": "python",
"repo": "RafayAK/CodingPrep",
"path": "/CodeSignal/check_palindrome.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RafayAK/CodingPrep path: /CodeSignal/check_palindrome.py
"""
Given the string, check if it is a palindrome.
<|fim_suffix|>def checkPalindrome(inputString):
return inputString == inputString[::-1]
if __name__ == '__main__':
assert not checkPalindrome("zzzazzazz")
assert checkPalindro... | code_fim | hard | {
"lang": "python",
"repo": "RafayAK/CodingPrep",
"path": "/CodeSignal/check_palindrome.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> count = 0
for tweet in tweepy.Cursor(api.search , q=word,count =1000,lang="en",since_id = date1,until = date2).items():
print(tweet.created_at)
date.append(tweet.created_at)
print(tweet.id)
user_id.append(tweet.id)
print(tweet.user.verified)
verified... | code_fim | medium | {
"lang": "python",
"repo": "ShubhangiSoni1603/Forecasting-US-Elections",
"path": "/Extraction/Extracting Tweets/Scrape Trump.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>data1 = list(zip(date,user_id,verified,text,user,location,source,likes,followers,following,retweets))
df1 = pd.DataFrame(data =data1, columns =["Date","Tweet_id","Verified","Tweet",
"User","Location","Source","Likes","Followers","Following","Retweets"])
df1.to_csv('twee... | code_fim | medium | {
"lang": "python",
"repo": "ShubhangiSoni1603/Forecasting-US-Elections",
"path": "/Extraction/Extracting Tweets/Scrape Trump.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShubhangiSoni1603/Forecasting-US-Elections path: /Extraction/Extracting Tweets/Scrape Trump.py
import tweepy
import pandas as pd
consumer_key= "XXX"
consumer_secret = "XXX"
access_token ="XXX"
access_token_secret= "XXX"
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
# authenticati... | code_fim | medium | {
"lang": "python",
"repo": "ShubhangiSoni1603/Forecasting-US-Elections",
"path": "/Extraction/Extracting Tweets/Scrape Trump.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ms32035/inspector path: /inspector/checks/tests.py
from random import shuffle
import pytest
from django.contrib.auth import get_user_model
from rest_framework.reverse import reverse
from ..systems.tests import create_environment, create_system
from .models import CheckRun, Datacheck, Environmen... | code_fim | hard | {
"lang": "python",
"repo": "ms32035/inspector",
"path": "/inspector/checks/tests.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_detail_datacheck(self, authenticated_client):
authenticated_client.add_permission(Datacheck, "view_datacheck")
datacheck = create_datacheck()
url = reverse("checks:datacheck-detail", args=[datacheck.pk])
response = authenticated_client.client.get(url)
a... | code_fim | hard | {
"lang": "python",
"repo": "ms32035/inspector",
"path": "/inspector/checks/tests.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ENCODE-DCC/pyencoded-tools path: /pipeline_input_scripts/generate_mirna_input_json.py
.md#inputs
This script takes experiment accessions as inputs, pulls required metadata for
those experiments, and then generates an input.json file for each one as
output. It will also output a caper_submit_comm... | code_fim | hard | {
"lang": "python",
"repo": "ENCODE-DCC/pyencoded-tools",
"path": "/pipeline_input_scripts/generate_mirna_input_json.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ENCODE-DCC/pyencoded-tools path: /pipeline_input_scripts/generate_mirna_input_json.py
.com/ENCODE-DCC/mirna-seq-pipeline/blob/master/docs/reference.md#inputs
This script takes experiment accessions as inputs, pulls required metadata for
those experiments, and then generates an input.json file fo... | code_fim | hard | {
"lang": "python",
"repo": "ENCODE-DCC/pyencoded-tools",
"path": "/pipeline_input_scripts/generate_mirna_input_json.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> adapter_accession = None
for adapter in file_input_df.loc[link].at['replicate.library.adapters']:
if adapter['type'] == "read1 5' adapter" and adapter_accession is None:
adapter_accession = '{}{}@@d... | code_fim | hard | {
"lang": "python",
"repo": "ENCODE-DCC/pyencoded-tools",
"path": "/pipeline_input_scripts/generate_mirna_input_json.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maasencioh/silk-ml path: /tests/test_classification.py
import unittest
from silk_ml.classification import Classifier
from .helper import generate_test
class TestClassification(unittest.TestCase):
<|fim_suffix|> def test_metrics(self):
classifier = generate_test()
metrics = ... | code_fim | hard | {
"lang": "python",
"repo": "maasencioh/silk-ml",
"path": "/tests/test_classification.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Check kind of values, p-values are variables
self.assertEqual(
metrics['cardinality kind'].tolist(),
['numerical', 'numerical', 'categorical']
)
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: maasencioh/silk-ml path: /tests/test_cla... | code_fim | hard | {
"lang": "python",
"repo": "maasencioh/silk-ml",
"path": "/tests/test_classification.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lahwran/crow2 path: /crow2/__init__.py
"""
Crow2 twisted plugin-based app system
"""
from crow2.events.hooktree import HookTree
from twisted.python impor<|fim_suffix|>"log"]
hook = HookTree(start_lazy=True, name="crow2.hook")<|fim_middle|>t log # in case we change how we log
__all__ = ["hook", | code_fim | easy | {
"lang": "python",
"repo": "lahwran/crow2",
"path": "/crow2/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>t log # in case we change how we log
__all__ = ["hook", "log"]
hook = HookTree(start_lazy=True, name="crow2.hook")<|fim_prefix|># repo: lahwran/crow2 path: /crow2/__init__.py
"""
Crow2 twisted plugin-based app system
"""
from crow2.<|fim_middle|>events.hooktree import HookTree
from twisted.python impor | code_fim | easy | {
"lang": "python",
"repo": "lahwran/crow2",
"path": "/crow2/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> rawImage = easygui.fileopenbox() # open file dialog for acquiring the image
imageData = cv2.imread(rawImage, 1) # get the image data with OpenCV
height, width, byteValue = imageData.shape
byteValue = byteValue * width
rgbImage = cv2.cvtColor(imageData, cv2.COLOR_B... | code_fim | medium | {
"lang": "python",
"repo": "roxy0230/Assaskin",
"path": "/Controller/ImageManipulation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@staticmethod
def getImage(imageWidget):
rawImage = easygui.fileopenbox() # open file dialog for acquiring the image
imageData = cv2.imread(rawImage, 1) # get the image data with OpenCV
height, width, byteValue = imageData.shape
byteValue = byteValue * width
... | code_fim | medium | {
"lang": "python",
"repo": "roxy0230/Assaskin",
"path": "/Controller/ImageManipulation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: roxy0230/Assaskin path: /Controller/ImageManipulation.py
# -*- coding: utf-8 -*-
import cv2
import easygui
from PyQt5 import QtCore, QtGui
from PyQt5.QtGui import QImage
<|fim_suffix|> rawImage = easygui.fileopenbox() # open file dialog for acquiring the image
imageData = cv2.imr... | code_fim | medium | {
"lang": "python",
"repo": "roxy0230/Assaskin",
"path": "/Controller/ImageManipulation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Handle battery
self.update_battery()
def set_no_alert(self):
# Change background colors
for frame in self.frames:
frame.config(bg=Theme.active().ALERT_BAR_OK)
# Change text colors
for label in self.textual:
label.config(bg=The... | code_fim | hard | {
"lang": "python",
"repo": "VMS19/Inhalator",
"path": "/graphics/alert_bar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VMS19/Inhalator path: /graphics/alert_bar.py
import os
import time
import timeago
import datetime
from tkinter import *
from data.alerts import Alert, AlertCodes
from graphics.themes import Theme
from data.configurations import ConfigurationManager
from graphics.version import __version__
THIS... | code_fim | hard | {
"lang": "python",
"repo": "VMS19/Inhalator",
"path": "/graphics/alert_bar.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pinobatch/pagination path: /code/solve_genetic.py
#!/usr/bin/env python
# encoding: utf-8
import genetic
import random
import solver_tools
name = "GeneticSimple"
def firstFit(pages,tiles):
for tile in tiles:
for page in pages:
if tile.canFitIn(page):
pag... | code_fim | medium | {
"lang": "python",
"repo": "pinobatch/pagination",
"path": "/code/solve_genetic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # for (knownPaginationIndex,knownPagination) in enumerate(knownPaginations):
# if knownPagination.isValid() and len(knownPagination) == maxPageCount:
# for (tileIndex,tile) in enumerate(tiles):
# env.population[knownPaginationIndex].chromosome[tileIndex] = knownPagi... | code_fim | hard | {
"lang": "python",
"repo": "pinobatch/pagination",
"path": "/code/solve_genetic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: coronasafe/care path: /care/facility/migrations_old/0020_auto_20200323_1029.py
# Generated by Django 2.2.11 on 2020-03-23 10:29
from django.db import migrations
<|fim_suffix|> dependencies = [
("facility", "0019_auto_20200322_2056"),
]
operations = [
migrations.Alte... | code_fim | medium | {
"lang": "python",
"repo": "coronasafe/care",
"path": "/care/facility/migrations_old/0020_auto_20200323_1029.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
("facility", "0019_auto_20200322_2056"),
]
operations = [
migrations.AlterUniqueTogether(
name="facilitycapacity",
unique_together={("facility", "room_type", "deleted")},
),
migrations.AlterUniqueTogether(
na... | code_fim | medium | {
"lang": "python",
"repo": "coronasafe/care",
"path": "/care/facility/migrations_old/0020_auto_20200323_1029.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yolecomte/pyqgis_utility path: /difference_EBC_buffer.py
layer = iface.activeLayer()
tampon = QgsMapLayerRegistry.instance().mapLayersByName('Tampon')[0]
layer.startEditi<|fim_suffix|>at.id())
for elem in tampon.getFeatures():
geom = feat.geometry().difference(elem.geometry())... | code_fim | medium | {
"lang": "python",
"repo": "Yolecomte/pyqgis_utility",
"path": "/difference_EBC_buffer.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|>at.id())
for elem in tampon.getFeatures():
geom = feat.geometry().difference(elem.geometry())
print geom.exportToWkt()
#feat.clearGeometry()
layer.changeGeometry(feat.id(),geom)<|fim_prefix|># repo: Yolecomte/pyqgis_utility path: /difference_EBC_buffer.py
... | code_fim | medium | {
"lang": "python",
"repo": "Yolecomte/pyqgis_utility",
"path": "/difference_EBC_buffer.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Find out what URL to hit for Google login
google_provider_cfg = get_google_provider_cfg()
authorization_endpoint = google_provider_cfg["authorization_endpoint"]
# Use library to construct the request for Google login and provide
# scopes that let you retrieve user's profile from Goo... | code_fim | hard | {
"lang": "python",
"repo": "patrykwenz/flask_google_auth_voting",
"path": "/website/auth.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: patrykwenz/flask_google_auth_voting path: /website/auth.py
from flask import Blueprint, redirect, request, url_for
from flask_login import (
login_required,
login_user,
logout_user,
)
import requests
import json
from .models import User
from .config.mongo_config import db
from .config... | code_fim | hard | {
"lang": "python",
"repo": "patrykwenz/flask_google_auth_voting",
"path": "/website/auth.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Find out what URL to hit to get tokens that allow you to ask for
# things on behalf of a user
google_provider_cfg = get_google_provider_cfg()
token_endpoint = google_provider_cfg["token_endpoint"]
# Prepare and send a request to get tokens! Yay tokens!
token_url, headers, body =... | code_fim | hard | {
"lang": "python",
"repo": "patrykwenz/flask_google_auth_voting",
"path": "/website/auth.py",
"mode": "spm",
"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.