text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: Coloquinte/torchSR path: /torchsr/datasets/realsr.py
from .common import pil_loader, FolderByDir
import os
from typing import Callable, List, Optional, Tuple, Union
class RealSRv3(FolderByDir):
"""`RealSR v3 <https://github.com/csjcai/RealSR>` Superresolution Dataset
Args:
roo... | code_fim | hard | {
"lang": "python",
"repo": "Coloquinte/torchSR",
"path": "/torchsr/datasets/realsr.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(
self,
root: str,
scale: int = 2,
track: Union[str, List[str]] = 'canon',
split: str = 'train',
transform: Optional[Callable] = None,
loader: Callable = pil_loader,
download: bool = False,
... | code_fim | hard | {
"lang": "python",
"repo": "Coloquinte/torchSR",
"path": "/torchsr/datasets/realsr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> raise NotImplementedError()
def list_samples_realsr(self, track, split, scale):
track_dir = self.get_dir(track, split, scale)
all_samples = sorted(os.listdir(track_dir))
all_samples = [s for s in all_samples if s.lower().endswith(self.extensions)]
all_samples =... | code_fim | hard | {
"lang": "python",
"repo": "Coloquinte/torchSR",
"path": "/torchsr/datasets/realsr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def rotate(self, new_squares):
self.piece_rotation = self.get_next_rotation()
self.squares = new_squares
def get_next_rotation(self):
new_rotation = self.piece_rotation + 1
if new_rotation >= len(self.piece_array):
new_rotation = 0
return new_ro... | code_fim | hard | {
"lang": "python",
"repo": "palu3492/tetris-game-updated",
"path": "/Piece.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: palu3492/tetris-game-updated path: /Piece.py
# Tetris piece class
import random
import pygame
from Square import Square
class Piece:
pieces = [
['110,011,000',
'001,011,010',
'000,110,011',
'010,110,100'],
['010,111,000',
'010,011,010',
... | code_fim | hard | {
"lang": "python",
"repo": "palu3492/tetris-game-updated",
"path": "/Piece.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # iterate through the stages in reverse order
# so adding lines doesn't invalidate line numbers from structure dicts.
# first add a bogus instruction to represent EOF in our iteration.
froms.append({'startline': len(df_lines) + 1})
for stage in range(len(froms)-2, -... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/dockerfile-parse",
"path": "/dockerfile_parse/parser.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pombredanne/dockerfile-parse path: /dockerfile_parse/parser.py
eobj cannot be used together.")
else:
self.fileobj.seek(0)
else:
path = path or '.'
if path.endswith(DOCKERFILE_FILENAME):
self.dockerfile_path = path
... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/dockerfile-parse",
"path": "/dockerfile_parse/parser.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pombredanne/dockerfile-parse path: /dockerfile_parse/parser.py
'ARG'):
raise ValueError("Unsupported instruction '{0}'".format(name))
in_stage = False
top_args = {}
instructions = {}
args = {}
envs = {}
for instruction_desc in self.str... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/dockerfile-parse",
"path": "/dockerfile_parse/parser.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: myDevicesIoT/cayenne-plugin-mcp4725 path: /cayenne_mcp4725/__init__.py
"""
This module provides classes for interfacing with a MCP4725 Analog I/O extension.
"""
from myDevices.devices.i2c import I2C
from myDevices.devices.analog import DAC
from myDevices.plugins.analog import AnalogOutput
from my... | code_fim | hard | {
"lang": "python",
"repo": "myDevicesIoT/cayenne-plugin-mcp4725",
"path": "/cayenne_mcp4725/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Class for simulating a MCP4725 device."""
def __init__(self):
"""Initializes the test class."""
self.bytes = bytearray(3)
MCP4725.__init__(self)
def readBytes(self, size=1):
"""Read specified number of bytes."""
return self.bytes
def writeBytes... | code_fim | hard | {
"lang": "python",
"repo": "myDevicesIoT/cayenne-plugin-mcp4725",
"path": "/cayenne_mcp4725/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Read specified number of bytes."""
return self.bytes
def writeBytes(self, data):
"""Write data bytes."""
self.bytes[1] = (data[0] << 4) | (data[1] >> 4)
self.bytes[2] = (data[1] << 4) & 0xF0<|fim_prefix|># repo: myDevicesIoT/cayenne-plugin-mcp4725 path: /ca... | code_fim | hard | {
"lang": "python",
"repo": "myDevicesIoT/cayenne-plugin-mcp4725",
"path": "/cayenne_mcp4725/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_strip(self):
self.assertEqual(ss.strip_pronunciation_marker('cat(1)'), 'cat')
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: sanigak/Phyme path: /test/songStats_test.py
import unittest
import sys
sys.path.append('../')
from Phyme import songStats as ss
class ... | code_fim | medium | {
"lang": "python",
"repo": "sanigak/Phyme",
"path": "/test/songStats_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sanigak/Phyme path: /test/songStats_test.py
import unittest
import sys
sys.path.append('../')
from Phyme import songStats as ss
class SongStatsTest(unittest.TestCase):
def test_get_count(self):
self.assertTrue(ss.get_count_rank("i'm") == 0)
def test_get_pairs(self):
... | code_fim | medium | {
"lang": "python",
"repo": "sanigak/Phyme",
"path": "/test/songStats_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_get_pairs_missing(self):
self.assertGreater(ss._sort_key('aslfjalsdf', {'say': 0}), '9999')
def test_strip(self):
self.assertEqual(ss.strip_pronunciation_marker('cat(1)'), 'cat')
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: sanigak/Phyme path... | code_fim | hard | {
"lang": "python",
"repo": "sanigak/Phyme",
"path": "/test/songStats_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> product_dao = Product_DAO()
product_dao.get_products_json()
product_list = product_dao.get_product_list()
return render_template("home.html", product_list = product_list)<|fim_prefix|># repo: UniversidadeDeVassouras/labproginter-2020.2-LucasLeal-p2 path: /application/controller/home_contr... | code_fim | easy | {
"lang": "python",
"repo": "UniversidadeDeVassouras/labproginter-2020.2-LucasLeal-p2",
"path": "/application/controller/home_controller.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UniversidadeDeVassouras/labproginter-2020.2-LucasLeal-p2 path: /application/controller/home_controller.py
from application import app
from flask import render_template, request
from application.model.dao.product_dao import Product_DAO
<|fim_suffix|> product_dao = Product_DAO()
product_dao... | code_fim | easy | {
"lang": "python",
"repo": "UniversidadeDeVassouras/labproginter-2020.2-LucasLeal-p2",
"path": "/application/controller/home_controller.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> counter+=1
note=pretty_midi.Note(pitch=int(input_values[i]),velocity=int(velocity_values[i]),start=start_time[i],end=start_time[i]+duration[i])
self.cello.notes.append(note)
final_list.append(note)
note=pre... | code_fim | hard | {
"lang": "python",
"repo": "pkaplish20/UAlberta-Multimedia-Masters-Program-Music-is-all-you-need-to-analyze-data",
"path": "/Temporal-Based Approach/postprocessing/convert_to_midi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pkaplish20/UAlberta-Multimedia-Masters-Program-Music-is-all-you-need-to-analyze-data path: /Temporal-Based Approach/postprocessing/convert_to_midi.py
import pretty_midi
class ConvertToMIDI():
'''
Combine the pitch values, velocity, duration etc. to music and save in MIDI format
'''
... | code_fim | hard | {
"lang": "python",
"repo": "pkaplish20/UAlberta-Multimedia-Masters-Program-Music-is-all-you-need-to-analyze-data",
"path": "/Temporal-Based Approach/postprocessing/convert_to_midi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hrgadeha/concept path: /automobile/automobile/doctype/received_oem_claim/received_oem_claim.py
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Hardik Gadesha and contributors
# For license information, please see license.txt
<|fim_suffix|> for i in self.transaction_records:
si = frappe.get_lis... | code_fim | hard | {
"lang": "python",
"repo": "hrgadeha/concept",
"path": "/automobile/automobile/doctype/received_oem_claim/received_oem_claim.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def on_cancel(self):
for i in self.transaction_records:
si = frappe.get_list('Sales Invoice', filters={'serial': i.chassis_number}, fields=['name'])
for d in si:
sinv = frappe.get_doc("Sales Invoice",d)
sinv.oem_claim_received = 0
sinv.save()<|fim_prefix|># repo: hrgadeha/concept pat... | code_fim | hard | {
"lang": "python",
"repo": "hrgadeha/concept",
"path": "/automobile/automobile/doctype/received_oem_claim/received_oem_claim.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: plaidml/plaidml path: /networks/scitile/storti_integrals/storti_integral_tests.py
import unittest
import numpy.testing as npt
from hypersphere import (hypersphere, hypersphere_area_exact, hypersphere_volume_exact)
from op import *
from torus import (integrand_inertia, toroidal_shell_integral_mom... | code_fim | medium | {
"lang": "python",
"repo": "plaidml/plaidml",
"path": "/networks/scitile/storti_integrals/storti_integral_tests.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> R = 1.0 # radius
p = 2.0 # Lp distance measure
N = 32
minval = -1.25 * R
maxval = 1.25 * R
eps = 1.0e-8
exact_value = hypersphere_area_exact(R)
result = integral_surface_area_4D(N, minval, maxval, eps, hypersphere, [R, p],
... | code_fim | hard | {
"lang": "python",
"repo": "plaidml/plaidml",
"path": "/networks/scitile/storti_integrals/storti_integral_tests.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> R = 10.0 # major radius
r = 2.0 # minor radius
N = 128 # number of grid points
minval = -1.25 * R
maxval = 1.25 * R
# G = 0 # Daubechies wavelet genus ( 1 <= G <= 7 ) #TODO: add genus
eps = 1.0e-8
exact_value = torus_surface_area_exact(R,... | code_fim | hard | {
"lang": "python",
"repo": "plaidml/plaidml",
"path": "/networks/scitile/storti_integrals/storti_integral_tests.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>video_frame_ns = []
last = -1
for line in data_list:
info = line.strip().split(' ')
video_frame_n = min(int(info[3]), 900)
if video_frame_n != last:
video_frame_ns.append(video_frame_n)
last = video_frame_n
print('VidOR VID AVG frame num: %.2f' % (sum(video_frame_ns)*1.0/len(v... | code_fim | hard | {
"lang": "python",
"repo": "sx14/Flow-Guided-Feature-Aggregation",
"path": "/vidvrd_challenge/vidor/analyze/analyze_interval.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sx14/Flow-Guided-Feature-Aggregation path: /vidvrd_challenge/vidor/analyze/analyze_interval.py
imagenet_train_list_path = '../../../data/ILSVRC2015/ImageSets/VID_train_15frames.txt'
vidor_train_list_path = '../../../data/VidOR/ImageSets/VID_train_15frames.txt'
with open(imagenet_train_list_path)... | code_fim | hard | {
"lang": "python",
"repo": "sx14/Flow-Guided-Feature-Aggregation",
"path": "/vidvrd_challenge/vidor/analyze/analyze_interval.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: w0de/margarita path: /margarita/saml_auth.py
#!/usr/bin/env python
import os
from urlparse import urlparse
from flask import flash, request, session, abort, redirect
from onelogin.saml2.auth import OneLogin_Saml2_Auth
from onelogin.saml2.utils import OneLogin_Saml2_Utils
class BaseAuth(object)... | code_fim | hard | {
"lang": "python",
"repo": "w0de/margarita",
"path": "/margarita/saml_auth.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:returns: `True` if the user is authorized, or `False` otherwise.
"""
for key in ["samlUserdata", "samlNameId", "samlSessionIndex"]:
if key not in session.keys():
return False
return True
def current_user(self):
return se... | code_fim | hard | {
"lang": "python",
"repo": "w0de/margarita",
"path": "/margarita/saml_auth.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> :returns: A request object compatible with `OneLogin_Saml2_Auth`
"""
# TODO If server is behind proxys or balancers use the HTTP_X_FORWARDED fields
url_data = urlparse(req.url)
return {
"https": "on" if req.scheme == "https" else "off",
"htt... | code_fim | hard | {
"lang": "python",
"repo": "w0de/margarita",
"path": "/margarita/saml_auth.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> component_configuration,
):
"""Test 'load_component_from_config' method when a "ModuleNotFoundError" occurs for a generic import path (non framework related."""
with mock.patch.object(
Protocol,
"from_config",
side_effect=ModuleNotFoundError("No module named 'generic.pa... | code_fim | hard | {
"lang": "python",
"repo": "nunoedgar-invest/agents-aea",
"path": "/tests/test_components/test_loader.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nunoedgar-invest/agents-aea path: /tests/test_components/test_loader.py
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you... | code_fim | hard | {
"lang": "python",
"repo": "nunoedgar-invest/agents-aea",
"path": "/tests/test_components/test_loader.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def post(self):
g = Game(self.request.body)
g.id = id_generator()
g.save()
self.set_header('Content-Type', 'application/json')
self.finish(g.toJSON())
def get(self):
pass<|fim_prefix|># repo: ncknt/tarot_stats path: /server/handlers/game.py
import ... | code_fim | medium | {
"lang": "python",
"repo": "ncknt/tarot_stats",
"path": "/server/handlers/game.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ncknt/tarot_stats path: /server/handlers/game.py
import tornado.web
import tornado.template
import string
import random
from data.game import Game
def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
<|fim_suffix|>... | code_fim | medium | {
"lang": "python",
"repo": "ncknt/tarot_stats",
"path": "/server/handlers/game.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyfarm/pyfarm-master path: /pyfarm/models/core/functions.py
# No shebang line, this module is meant to be imported
#
# Copyright 2013 Oliver Palmer
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obta... | code_fim | hard | {
"lang": "python",
"repo": "pyfarm/pyfarm-master",
"path": "/pyfarm/models/core/functions.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> >>> from pyfarm.master.config import config
>>> from pyfarm.models.agent import Agent
>>> modelfor(Agent("foo", "10.56.0.0", "255.0.0.0"), config.get("table_agent"))
True
"""
try:
return model.__tablename__ == table
except AttributeError:
return False
def getu... | code_fim | hard | {
"lang": "python",
"repo": "pyfarm/pyfarm-master",
"path": "/pyfarm/models/core/functions.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: remusao/wgraph path: /wgraph/app.py
#!/usr/bin/env python
from flask import Flask, escape, request
from wgraph.summary import go
from wgraph.graph import load, apply_styles
<|fim_suffix|>
@app.route("/")
def home():
return """
<form method="POST">
<input name="word">
<input type="... | code_fim | medium | {
"lang": "python",
"repo": "remusao/wgraph",
"path": "/wgraph/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> apply_styles(word, graph).render("output")
with open("output.svg") as inputs:
svg = inputs.read()
start = svg.find("<svg ")
if start != -1:
svg = svg[start:]
# TODO - return svg MIME type
return f"""
<!DOCTYPE html>
<html lang="en">
<head>
<... | code_fim | medium | {
"lang": "python",
"repo": "remusao/wgraph",
"path": "/wgraph/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> word = request.form["word"]
return sumup(word)
@app.route("/summary", methods=["GET"])
def summary():
word = request.args.get("word")
return sumup(word)<|fim_prefix|># repo: remusao/wgraph path: /wgraph/app.py
#!/usr/bin/env python
from flask import Flask, escape, request
from wgraph.... | code_fim | hard | {
"lang": "python",
"repo": "remusao/wgraph",
"path": "/wgraph/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='pegastudioorders',
name='email',
field=models.EmailField(default=b'', max_length=254, verbose_name='E-mail', blank=True),
),
migrations.AlterField(
model_name='pegastudioorders',
... | code_fim | hard | {
"lang": "python",
"repo": "dresl/leonardo-form-pegastudio",
"path": "/leonardo_form_pegastudio/migrations/0013_auto_20180205_2005.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dresl/leonardo-form-pegastudio path: /leonardo_form_pegastudio/migrations/0013_auto_20180205_2005.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrati... | code_fim | hard | {
"lang": "python",
"repo": "dresl/leonardo-form-pegastudio",
"path": "/leonardo_form_pegastudio/migrations/0013_auto_20180205_2005.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> relative_festival_rules = read_old_festival_rules_dict(os.path.join(CODE_ROOT, 'panchangam/data/relative_festival_rules.json'))
for festival_name in relative_festival_rules:
offset = int(relative_festival_rules[festival_name]['offset'])
rel_festival_name = relative_festival_rules[fest... | code_fim | hard | {
"lang": "python",
"repo": "skkulkarni/jyotisha",
"path": "/jyotisha/panchangam/spatio_temporal/annual.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if all([sun_hasta_jd_start, moon_hasta_jd_start, t30_start]):
# We have a GC yoga
gc_30_start = max(sun_hasta_jd_start, moon_hasta_jd_start, t30_start)
gc_30_end = min(sun_hasta_jd_end, moon_hasta_jd_end, t30_end)
if gc_30_start < gc_30_end:
gc_... | code_fim | hard | {
"lang": "python",
"repo": "skkulkarni/jyotisha",
"path": "/jyotisha/panchangam/spatio_temporal/annual.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skkulkarni/jyotisha path: /jyotisha/panchangam/spatio_temporal/annual.py
angam.temporal.get_tithi(
self.jd_sunrise[d] - (1 / 15.0) *
(self.jd_sunrise[d] - self.jd_sunrise[d - 1]), ayanamsha_id=self.ayanamsha_id)
if tithi_arunodayam == 10:
self.festiva... | code_fim | hard | {
"lang": "python",
"repo": "skkulkarni/jyotisha",
"path": "/jyotisha/panchangam/spatio_temporal/annual.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Handles steps without infusions
if infusionTemp == "":infusionTemp = stepTemp
if volumeAdded == "":volumeAdded = "0"
rowPosition = int(stepNum) - 1
self.Mash_Steps.insertRow(rowPosition)
self.Mash_Steps.setItem(rowPosition,0,QtWidgets.QTableWidgetItem("{:.... | code_fim | hard | {
"lang": "python",
"repo": "Bobstin/AutomatedBrewery",
"path": "/automatedbrewery/BeerSmithImporter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bobstin/AutomatedBrewery path: /automatedbrewery/BeerSmithImporter.py
nnect(self.addStep)
self.Cancel.clicked.connect(self.cancel)
def addStep(self):
self.addMashSignal.emit(self.Step_Num.text(),self.Infusion_Temp.text(),self.Volume_Added.text(),self.Step_Temp.text(),self.Ris... | code_fim | hard | {
"lang": "python",
"repo": "Bobstin/AutomatedBrewery",
"path": "/automatedbrewery/BeerSmithImporter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.tempValues[0] = float(self.Strike_Temp.text()[:-2])
self.tempValues[1] = float(self.HLT_Fill_2_Temp.text()[:-2])
self.tempValues[2] = float(self.Sparge_Temp.text()[:-2])
self.pHValues[0] = float(self.Mash_pH.text())
self.boilTime = float(self.Boil_Time.text()... | code_fim | hard | {
"lang": "python",
"repo": "Bobstin/AutomatedBrewery",
"path": "/automatedbrewery/BeerSmithImporter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JayUpadhyayCS/SideProjects-LearningProjects-Blackhole path: /Blackhole Projects/opencv-course-master/draw.py
import cv2 as cv
import numpy as np
blank=np.zeros((500,500,3), dtype='uint8')
#paint image a certain color
blank[200:300, 300:400]=0,0,255
<|fim_suffix|>
cv.line(blank,(0,0),(25... | code_fim | hard | {
"lang": "python",
"repo": "JayUpadhyayCS/SideProjects-LearningProjects-Blackhole",
"path": "/Blackhole Projects/opencv-course-master/draw.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#Write text
cv.putText(blank, "Hello", (225,225), cv.FONT_HERSHEY_TRIPLEX, 1.0, (0,255,0), 2)
cv.imshow("Text", blank)
cv.waitKey(0)<|fim_prefix|># repo: JayUpadhyayCS/SideProjects-LearningProjects-Blackhole path: /Blackhole Projects/opencv-course-master/draw.py
import cv2 as cv
import numpy as n... | code_fim | hard | {
"lang": "python",
"repo": "JayUpadhyayCS/SideProjects-LearningProjects-Blackhole",
"path": "/Blackhole Projects/opencv-course-master/draw.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>cv.rectangle(blank,(0,0),(250,250),(0,255,0),thickness=cv.FILLED)
cv.imshow("Rectangle", blank)
#img=cv.imread('Resources/Photos/cat.jpg')
#cv.imshow("Cat",img)
cv.circle(blank,(250,250),40,(255,0,0), thickness=3)
cv.imshow("Circle", blank)
cv.line(blank,(0,0),(250,250),(255,255,255),thickness=3... | code_fim | medium | {
"lang": "python",
"repo": "JayUpadhyayCS/SideProjects-LearningProjects-Blackhole",
"path": "/Blackhole Projects/opencv-course-master/draw.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PyLadiesCZ/Zpetnovazebnik path: /blog/migrations/0004_longer_password.py
# Generated by Django 2.1.7 on 2019-02-16 15:35
import secrets
from django.db import migrations, models
from blog.models import make_random_password
class Migration(migrations.Migration):
<|fim_suffix|> operations = [... | code_fim | medium | {
"lang": "python",
"repo": "PyLadiesCZ/Zpetnovazebnik",
"path": "/blog/migrations/0004_longer_password.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('blog', '0003_course_unique_slug'),
]
operations = [
migrations.AlterField(
model_name='course',
name='password',
field=models.CharField(default=make_random_password, max_length=50),
),
]<|fim_prefix|># repo: P... | code_fim | easy | {
"lang": "python",
"repo": "PyLadiesCZ/Zpetnovazebnik",
"path": "/blog/migrations/0004_longer_password.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='course',
name='password',
field=models.CharField(default=make_random_password, max_length=50),
),
]<|fim_prefix|># repo: PyLadiesCZ/Zpetnovazebnik path: /blog/migrations/0004_longer_password.py
#... | code_fim | medium | {
"lang": "python",
"repo": "PyLadiesCZ/Zpetnovazebnik",
"path": "/blog/migrations/0004_longer_password.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bernhard-42/jupyter-cadquery path: /jupyter_cadquery/cad_objects.py
Solid, Face, Wire, Edge, Vertex)")
if isinstance(cad_obj, bd.Compound):
t = type(list(cad_obj)[0])
if all(isinstance(obj, t) for obj in cad_obj):
cad... | code_fim | hard | {
"lang": "python",
"repo": "bernhard-42/jupyter-cadquery",
"path": "/jupyter_cadquery/cad_objects.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(cad_obj, bd.Shape):
_debug(f"CAD Obj {obj_id}: build123d.Shape (Solid, Face, Wire, Edge, Vertex)")
if isinstance(cad_obj, bd.Compound):
t = type(list(cad_obj)[0])
if all(isinstance(obj, t) for obj in cad_obj)... | code_fim | hard | {
"lang": "python",
"repo": "bernhard-42/jupyter-cadquery",
"path": "/jupyter_cadquery/cad_objects.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif _is_edgelist(cad_obj):
_debug(f"CAD Obj {obj_id}: edgelist")
obj_name = "Edges" if obj_name is None else obj_name
assembly.add_list(_from_edgelist(cad_obj, obj_id, obj_name, obj_color, show_parent=show_parent))
elif _is_wirelist(cad_obj):
... | code_fim | hard | {
"lang": "python",
"repo": "bernhard-42/jupyter-cadquery",
"path": "/jupyter_cadquery/cad_objects.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>print (df2)
print ("-"*30)
print (df2.iloc[0,1])
print (df2.iloc[0:2,:])
print (df2.iloc[:,1:2])
print (df2.iloc[0:2,0:2])
print (df2.iloc[[0,2],[0,2]])
print (df2.iloc[2,2])<|fim_prefix|># repo: SamL999/Python path: /pandasfile3.py
import pandas as pd
import numpy as np
"""
df = pd.DataFram... | code_fim | medium | {
"lang": "python",
"repo": "SamL999/Python",
"path": "/pandasfile3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SamL999/Python path: /pandasfile3.py
import pandas as pd
import numpy as np
"""
df = pd.DataFrame(np.random.rand(5,3),\
index=list("ABCDE"), columns=list("XYZ"))
<|fim_suffix|>print (df2)
print ("-"*30)
print (df2.iloc[0,1])
print (df2.iloc[0:2,:])
print (df2.iloc[:,1:2])
... | code_fim | hard | {
"lang": "python",
"repo": "SamL999/Python",
"path": "/pandasfile3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> syn_mask_dilated = dilation(self.syn_mask)
pred_instances = measure.label(syn_mask_dilated)
print('Remove instances with size less than %d pixels.' % (min_size))
self.pred_instances = remove_small_objects(
pred_instances, min_size=min_size, connectivity=1, in_pl... | code_fim | hard | {
"lang": "python",
"repo": "donglaiw/pytorch_connectomics",
"path": "/tools/evaluation/evaluate_syn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> TP1 = 0
TP2 = 0
FP, FN = 0, 0
Eva_08nm = SynEvaluate(pd_path, gt_path, iou_thres=float(sys.argv[1]))
dataloader = torch.utils.data.DataLoader(
Eva_08nm, batch_size=64, shuffle=False, collate_fn=collate_fn_list,
num_workers=8, pin_memory=True)
f1 = open('tpfp.txt',... | code_fim | hard | {
"lang": "python",
"repo": "donglaiw/pytorch_connectomics",
"path": "/tools/evaluation/evaluate_syn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: donglaiw/pytorch_connectomics path: /tools/evaluation/evaluate_syn.py
# Multi-CPU Implementation of Synapse Evaluation
# based on Intersection over Union (IoU)
# Year 2019
# Zudi Lin
from __future__ import division, print_function
import os
import sys
import glob
import numpy as np
import rando... | code_fim | hard | {
"lang": "python",
"repo": "donglaiw/pytorch_connectomics",
"path": "/tools/evaluation/evaluate_syn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_deploy_revs_and_diffs(environment, args):
"""Check the revisions to deploy from the arguments against the
defaults configured for the environment and return the final
revisions to deploy and whether they are different from the defaults.
"""
default_branch = environment.fab_sett... | code_fim | hard | {
"lang": "python",
"repo": "rameshganne/commcare-cloud",
"path": "/src/commcare_cloud/commands/deploy/commcare.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rameshganne/commcare-cloud path: /src/commcare_cloud/commands/deploy/commcare.py
from datetime import datetime
import pytz
from commcare_cloud.alias import commcare_cloud
from commcare_cloud.cli_utils import ask
from commcare_cloud.colors import color_notice
from commcare_cloud.commands.deploy.... | code_fim | hard | {
"lang": "python",
"repo": "rameshganne/commcare-cloud",
"path": "/src/commcare_cloud/commands/deploy/commcare.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> from fabric.api import cd, sudo
def _task():
with cd(environment.remote_conf.code_current):
return sudo('git rev-parse HEAD')
host = environment.sshable_hostnames_by_group["django_manage"][0]
res = run_fab_task(_task, host, 'ansible', environment.get_ansible_user_pass... | code_fim | hard | {
"lang": "python",
"repo": "rameshganne/commcare-cloud",
"path": "/src/commcare_cloud/commands/deploy/commcare.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NoodleEducation/dborutils path: /dborutils/key_service.py
from uuid import uuid1
from uuid import uuid4
from numpy_excerpt import base_repr
# Changing this will require DB migrations in both dbor_wip and
# noodle-api!!! Do not reduce below the longest existing nice_keys
# across all tables!!!
... | code_fim | hard | {
"lang": "python",
"repo": "NoodleEducation/dborutils",
"path": "/dborutils/key_service.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> doc = dest_doc[0]
nice_key = doc['nice_key']
self.source_client.update(
{"_id": source_doc["_id"]},
{"$set": {"nice_key": nice_key, "ids.nice_key": nice_key}},
upsert=False
)
... | code_fim | hard | {
"lang": "python",
"repo": "NoodleEducation/dborutils",
"path": "/dborutils/key_service.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> CLASSES = ('top', 'skirt', 'leggings', 'dress', 'outer', 'pants', 'bag',
'neckwear', 'headwear', 'eyeglass', 'belt', 'footwear', 'hair',
'skin', 'face')<|fim_prefix|># repo: Ascend/ModelZoo-PyTorch path: /PyTorch/built-in/cv/detection/RetinaNet_for_PyTorch/mmdet/datasets... | code_fim | medium | {
"lang": "python",
"repo": "Ascend/ModelZoo-PyTorch",
"path": "/PyTorch/built-in/cv/detection/RetinaNet_for_PyTorch/mmdet/datasets/deepfashion.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ascend/ModelZoo-PyTorch path: /PyTorch/built-in/cv/detection/RetinaNet_for_PyTorch/mmdet/datasets/deepfashion.py
from .builder import DATASETS
from .coco import CocoDataset
<|fim_suffix|>
CLASSES = ('top', 'skirt', 'leggings', 'dress', 'outer', 'pants', 'bag',
'neckwear', 'he... | code_fim | medium | {
"lang": "python",
"repo": "Ascend/ModelZoo-PyTorch",
"path": "/PyTorch/built-in/cv/detection/RetinaNet_for_PyTorch/mmdet/datasets/deepfashion.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: geerlingguy/molecule path: /molecule/provisioner/ansible_playbook.py
# Copyright (c) 2015-2018 Cisco Systems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software... | code_fim | hard | {
"lang": "python",
"repo": "geerlingguy/molecule",
"path": "/molecule/provisioner/ansible_playbook.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class AnsiblePlaybook(object):
"""Privisioner Playbook."""
def __init__(self, playbook, config, out=LOG.out, err=LOG.error):
"""
Set up the requirements to execute ``ansible-playbook`` and returns \
None.
:param playbook: A string containing the path to the playb... | code_fim | hard | {
"lang": "python",
"repo": "geerlingguy/molecule",
"path": "/molecule/provisioner/ansible_playbook.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param playbook: A string containing the path to the playbook.
:param config: An instance of a Molecule config.
:param out: An optional function to process STDOUT for underlying
:func:``sh`` call.
:param err: An optional function to process STDERR for underlying
... | code_fim | hard | {
"lang": "python",
"repo": "geerlingguy/molecule",
"path": "/molecule/provisioner/ansible_playbook.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SaucyOfficiale/hummingbot path: /test/hummingbot/strategy/fixed_grid/test_fixed_grid.py
import logging
import unittest
from decimal import Decimal
from typing import Optional
import pandas as pd
from hummingbot.client.config.client_config_map import ClientConfigMap
from hummingbot.client.config... | code_fim | hard | {
"lang": "python",
"repo": "SaucyOfficiale/hummingbot",
"path": "/test/hummingbot/strategy/fixed_grid/test_fixed_grid.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Simulate grid buy order filled
self.simulate_maker_market_trade(False, 60.0, 119.5)
self.assertEqual(1, len(strategy.active_buys))
self.assertEqual(8, len(strategy.active_sells))
def test_no_rebalance_required_and_grid_operation(self):
strategy = self.no_reba... | code_fim | hard | {
"lang": "python",
"repo": "SaucyOfficiale/hummingbot",
"path": "/test/hummingbot/strategy/fixed_grid/test_fixed_grid.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_suffix(self, text):
if self.slug_path:
if self.type == 'dir':
return self.slug_gen(self.slug_path + ' ' + text)
else:
return self.slug_gen(self.filename() + ' ' + text)
else:
return self.slug_gen(self.filename(... | code_fim | hard | {
"lang": "python",
"repo": "venomnert/renamer",
"path": "/filename.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: venomnert/renamer path: /filename.py
import os
import sys
from slugify import Slugify
class Filename:
def __init__(self, abs_path):
self.id = abs_path
self.type = self.file_type()
self.mod_path = None
self.slug_path = None
self.file_ext = None
... | code_fim | hard | {
"lang": "python",
"repo": "venomnert/renamer",
"path": "/filename.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: phcerdan/scikit-build path: /tests/test_distribution.py
from pathlib import Path
import pytest
from . import initialize_git_repo_and_commit, prepare_project
DIR = Path(__file__).parent.resolve()
DIST_DIR = DIR.parent / "dist"
# Test if package can be imported to allow testing on
# conda-forge... | code_fim | hard | {
"lang": "python",
"repo": "phcerdan/scikit-build",
"path": "/tests/test_distribution.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> wheels = DIST_DIR.glob("*.whl") if DIST_DIR.exists() else []
if not wheels:
pytest.skip("no wheel available")
assert len(wheels) == 1
virtualenv.run("pip install %s" % wheels[0])
assert "scikit-build" in virtualenv.installed_packages()
prepare_project("hello-no-language",... | code_fim | hard | {
"lang": "python",
"repo": "phcerdan/scikit-build",
"path": "/tests/test_distribution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> prepare_project("hello-no-language", virtualenv.workspace, force=True)
initialize_git_repo_and_commit(virtualenv.workspace, verbose=False)
virtualenv.run("python setup.py bdist_wheel")<|fim_prefix|># repo: phcerdan/scikit-build path: /tests/test_distribution.py
from pathlib import Path
impo... | code_fim | hard | {
"lang": "python",
"repo": "phcerdan/scikit-build",
"path": "/tests/test_distribution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _lock = Lock()
_state_db = dict()
def launch_process(self,userID):
with self._lock:
self._state_db[userID] = dict()
self._state_db[userID]['answer'] = Queue()
self._state_db[userID]['thread'] = Thread(target = create_cloud_resource, args=(userID, self._state_db[userID]['answer']))
self._... | code_fim | medium | {
"lang": "python",
"repo": "en-medina/RPI_REACTOR_CSTR_TOG",
"path": "/app/_test/threading_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: en-medina/RPI_REACTOR_CSTR_TOG path: /app/_test/threading_test.py
from flask import Flask, request
from time import sleep
from random import randint, uniform
from threading import Thread, Lock
from queue import Queue
def create_cloud_resource(id, answer):
sleep(10)
answer.put(uniform(-1, -100)... | code_fim | hard | {
"lang": "python",
"repo": "en-medina/RPI_REACTOR_CSTR_TOG",
"path": "/app/_test/threading_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> except Exception as e:
logger.error(e)
continue
def _get_addr_coverage(self):
"""
Extract address coverage from the JSON file(s) generated by the
``TranslationBlockCoverage`` plugin.
Note that these addresses are an over-app... | code_fim | hard | {
"lang": "python",
"repo": "YuKnight/s2e-env",
"path": "/s2e_env/commands/code_coverage/lcov.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if count:
num_non_zero_lines += 1
num_instrumented_lines += 1
f.write('LH:%d\n' % num_non_zero_lines)
f.write('LF:%d\n' % num_instrumented_lines)
f.write('end_of_record\n')
return lcov_... | code_fim | hard | {
"lang": "python",
"repo": "YuKnight/s2e-env",
"path": "/s2e_env/commands/code_coverage/lcov.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YuKnight/s2e-env path: /s2e_env/commands/code_coverage/lcov.py
"""
Copyright (c) 2017 Dependable Systems Laboratory, EPFL
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software wit... | code_fim | hard | {
"lang": "python",
"repo": "YuKnight/s2e-env",
"path": "/s2e_env/commands/code_coverage/lcov.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def register(self):
''' Registers The User Into The Service Container '''
self.app.bind('User', User)
def boot(self):
pass<|fim_prefix|># repo: hellomasonite/masonite-forum path: /app/providers/UserModelProvider.py
''' A User Model Service Provider '''
from masonite.provi... | code_fim | easy | {
"lang": "python",
"repo": "hellomasonite/masonite-forum",
"path": "/app/providers/UserModelProvider.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hellomasonite/masonite-forum path: /app/providers/UserModelProvider.py
''' A User Model Service Provider '''
from masonite.provider import ServiceProvider
from app.User import User
class UserModelProvider(ServiceProvider):
<|fim_suffix|> wsgi = False
def register(self):
''' Regis... | code_fim | medium | {
"lang": "python",
"repo": "hellomasonite/masonite-forum",
"path": "/app/providers/UserModelProvider.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neurips2020submission11699/metarl path: /tests/metarl/tf/baselines/test_gaussian_cnn_baseline.py
import pickle
from unittest import mock
import numpy as np
import pytest
import tensorflow as tf
from metarl.envs import MetaRLEnv
from metarl.misc.tensor_utils import normalize_pixel_batch
from met... | code_fim | hard | {
"lang": "python",
"repo": "neurips2020submission11699/metarl",
"path": "/tests/metarl/tf/baselines/test_gaussian_cnn_baseline.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> env = MetaRLEnv(DummyDiscretePixelEnv(), is_image=False)
with mock.patch(('metarl.tf.baselines.'
'gaussian_cnn_baseline.'
'GaussianCNNRegressor'),
new=SimpleGaussianCNNRegressor):
with mock.patch(
... | code_fim | hard | {
"lang": "python",
"repo": "neurips2020submission11699/metarl",
"path": "/tests/metarl/tf/baselines/test_gaussian_cnn_baseline.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Manual change the parameter of GaussianCNNBaseline
with tf.compat.v1.variable_scope('GaussianCNNBaseline', reuse=True):
return_var = tf.compat.v1.get_variable(
'SimpleGaussianCNNModel/return_var')
return_var.load(1.0)
old_param_values = gcb.ge... | code_fim | hard | {
"lang": "python",
"repo": "neurips2020submission11699/metarl",
"path": "/tests/metarl/tf/baselines/test_gaussian_cnn_baseline.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for protocol in self.protocol.factory.protocols.itervalues():
protocol.send_chat_message("%sSERVER BROADCAST: %s%s" % (self.config.colors["admin"], message.message[3:], self.config.colors["default"]))
self.logger.info("Broadcast from %s. Message: %s", self.protocol.player.n... | code_fim | hard | {
"lang": "python",
"repo": "Hexicube/StarryPy",
"path": "/plugins/admin_messenger.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hexicube/StarryPy path: /plugins/admin_messenger.py
from base_plugin import BasePlugin
from core_plugins.player_manager import permissions, UserLevels
import packets
class AdminMessenger(BasePlugin):
"""Adds support to message moderators/admins/owner with a ## prefixed message."""
name ... | code_fim | hard | {
"lang": "python",
"repo": "Hexicube/StarryPy",
"path": "/plugins/admin_messenger.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> def on_chat_sent(self, data):
data = packets.chat_sent().parse(data.data)
if data.message[:3] == self.prefix*3:
self.broadcast_message(data)
return False
if data.message[:2] == self.prefix*2:
self.message_admins(data)
return False... | code_fim | hard | {
"lang": "python",
"repo": "Hexicube/StarryPy",
"path": "/plugins/admin_messenger.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JeremyPorquez/MicroscoperPython path: /microscoper/MicroscoperComponents.py
import time
import os
import configparser
from threading import Thread
from Devices.AnalogDigitalOut import AnalogDigital_output_MCC, Digital_output, Analog_output
from Devices.AnalogIn import AnalogInput
from MNetw... | code_fim | hard | {
"lang": "python",
"repo": "JeremyPorquez/MicroscoperPython",
"path": "/microscoper/MicroscoperComponents.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for widget in widgets:
widgetName = widget.objectName().lower()
if 'slider' in widgetName :
if self.__hasNumbers(widgetName) :
n = self.__getNumber(widgetName)
self.sliderWidgets.append(widget)
... | code_fim | hard | {
"lang": "python",
"repo": "JeremyPorquez/MicroscoperPython",
"path": "/microscoper/MicroscoperComponents.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='shelfimage',
name='image_name',
field=models.CharField(default='', max_length=200),
),
]<|fim_prefix|># repo: huachao2017/goodsdl path: /goods/migrations/0065_shelfimage_image_name.py
# -*- coding:... | code_fim | medium | {
"lang": "python",
"repo": "huachao2017/goodsdl",
"path": "/goods/migrations/0065_shelfimage_image_name.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: huachao2017/goodsdl path: /goods/migrations/0065_shelfimage_image_name.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2019-05-05 18:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operation... | code_fim | medium | {
"lang": "python",
"repo": "huachao2017/goodsdl",
"path": "/goods/migrations/0065_shelfimage_image_name.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>subcols = ['Position']
subrows = [
['CEO'],
['CFO'],
['CTO'],
['Court Jester'],
['Something much longer! wow such long much amaze']
]
subtable = termtable.TerminalTable(subcols, subrows, header=False)
def controller(key, index):
global subtable
if key == 'q':
return '... | code_fim | hard | {
"lang": "python",
"repo": "jknielse/termtable",
"path": "/interactive_check.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jknielse/termtable path: /interactive_check.py
import termtable
cols = ['Name', 'Position', 'Thingy']
rows = [
['Joe', 'CEO', 'A thing'],
['Fred', 'CFO', 'Another thing'],
['Bob', 'CTO', 'One more thing'],
['Bloop', 'Court Jester', 'Additional thing'],
]
tt = termtable.TerminalT... | code_fim | medium | {
"lang": "python",
"repo": "jknielse/termtable",
"path": "/interactive_check.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ######################
## Tenant Resources ##
######################
@property
def resources(self):
return self._resources
def get_resources(self):
return json.dumps(self._resources)
def get_resource(self, tenant_resource_name) -> TenantResource:
return self._resources.get_by_n... | code_fim | hard | {
"lang": "python",
"repo": "turnbros/tbc-api",
"path": "/tenant_handler/tenant.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def update_resource(self, tenant_resource):
self._resources.put_resource(tenant_resource)
def remove_resource(self, tenant_resource_name):
self._resources.remove_resource(tenant_resource_name)
def to_json(self):
return {
"name": self.name,
"lock": self.lock,
"state": ... | code_fim | hard | {
"lang": "python",
"repo": "turnbros/tbc-api",
"path": "/tenant_handler/tenant.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: turnbros/tbc-api path: /tenant_handler/tenant.py
import json
from collections import KeysView
from tenant_handler.state import TenantState
from tenant_handler.resource import TenantResourceCollection, TenantResource
class Tenant(object):
def __init__(self, name):
self._name = name
sel... | code_fim | hard | {
"lang": "python",
"repo": "turnbros/tbc-api",
"path": "/tenant_handler/tenant.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
img = cv2.equalizeHist(img)
img = img/255
return img
while True:
# success,imgOriginal = cap.read()
imgOriginal = cv2.imread(r"Test/p5.jpg")
img = np.asarray(imgOriginal)
img = cv2.resize(img,(32,32))
img = preProcessing(img)... | code_fim | hard | {
"lang": "python",
"repo": "marci0903/Mechine-Learning-Projects",
"path": "/Image_classifier/Testing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marci0903/Mechine-Learning-Projects path: /Image_classifier/Testing.py
import numpy as np
import cv2
import pickle
from decimal import Decimal
width = 640
height = 480
threshold = 0.65 # MINIMUM PROBABILITY TO CLASSIFY
catagory = ["Airplane","Gun"]
# cap = cv2.VideoCapture(0)
# cap.set(3,width)... | code_fim | hard | {
"lang": "python",
"repo": "marci0903/Mechine-Learning-Projects",
"path": "/Image_classifier/Testing.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.