text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: david8862/keras-YOLOv3-model-set path: /yolo3/models/layers.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Common layer definition for YOLOv3 models building
"""
from functools import wraps, reduce
import tensorflow.keras.backend as K
from tensorflow.keras.layers import Conv2D, DepthwiseC... | code_fim | hard | {
"lang": "python",
"repo": "david8862/keras-YOLOv3-model-set",
"path": "/yolo3/models/layers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> y = compose(
Concatenate(),
DarknetConv2D_BN_Leaky(num_filters, (1,1)))([y3, y2, y1, x])
return y
def make_last_layers(x, num_filters, out_filters, predict_filters=None, predict_id='1'):
'''6 Conv2D_BN_Leaky layers followed by a Conv2D_linear layer'''
x = compose(... | code_fim | hard | {
"lang": "python",
"repo": "david8862/keras-YOLOv3-model-set",
"path": "/yolo3/models/layers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def tiny_yolo3_predictions(feature_maps, feature_channel_nums, num_anchors, num_classes):
f1, f2 = feature_maps
f1_channel_num, f2_channel_num = feature_channel_nums
#feature map 1 transform
x1 = DarknetConv2D_BN_Leaky(f1_channel_num//2, (1,1))(f1)
#feature map 1 output (13x13 for 41... | code_fim | hard | {
"lang": "python",
"repo": "david8862/keras-YOLOv3-model-set",
"path": "/yolo3/models/layers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@socketio.on('disconnect', namespace='/live')
def test_disconnect():
print('Client disconnected')
@socketio.on('event', namespace='/live')
def test_message(message):
print('incoming from %s'%(message['id']))
emit('event',{'data': 'Hello World!'},broadcast=True)<|fim_prefix|># repo: ryanle88/P... | code_fim | hard | {
"lang": "python",
"repo": "ryanle88/Python-DevOps",
"path": "/16.flask-socketio-redis-nginx-loadbalancer/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('incoming from %s'%(message['id']))
emit('event',{'data': 'Hello World!'},broadcast=True)<|fim_prefix|># repo: ryanle88/Python-DevOps path: /16.flask-socketio-redis-nginx-loadbalancer/app.py
from flask import Flask
from flask_socketio import SocketIO, send, emit
import time
from flask impor... | code_fim | medium | {
"lang": "python",
"repo": "ryanle88/Python-DevOps",
"path": "/16.flask-socketio-redis-nginx-loadbalancer/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ryanle88/Python-DevOps path: /16.flask-socketio-redis-nginx-loadbalancer/app.py
from flask import Flask
from flask_socketio import SocketIO, send, emit
import time
from flask import current_app
import json
import eventlet
eventlet.monkey_patch()
app = Flask(__name__)
socketio = SocketIO(app, mes... | code_fim | medium | {
"lang": "python",
"repo": "ryanle88/Python-DevOps",
"path": "/16.flask-socketio-redis-nginx-loadbalancer/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def index(request):
moes = Moe.objects.all().values_list('url', flat=True)
moe_src = random.choice(moes or RMS_PHOTOS)
return render(request, 'moe/index.html', {'moe_src': moe_src})<|fim_prefix|># repo: steverecio/moe-django-postgres path: /moe/views.py
import random
from django.http import H... | code_fim | hard | {
"lang": "python",
"repo": "steverecio/moe-django-postgres",
"path": "/moe/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: steverecio/moe-django-postgres path: /moe/views.py
import random
from django.http import HttpResponse
from django.shortcuts import render
from moe.models import Moe
RMS_PHOTOS = [
"https://stallman.org/photos/rms-working/mid/mid_p1000844.jpg",
"https://stallman.org/photos/rms-working/mi... | code_fim | medium | {
"lang": "python",
"repo": "steverecio/moe-django-postgres",
"path": "/moe/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> moes = Moe.objects.all().values_list('url', flat=True)
moe_src = random.choice(moes or RMS_PHOTOS)
return render(request, 'moe/index.html', {'moe_src': moe_src})<|fim_prefix|># repo: steverecio/moe-django-postgres path: /moe/views.py
import random
from django.http import HttpResponse
from dja... | code_fim | medium | {
"lang": "python",
"repo": "steverecio/moe-django-postgres",
"path": "/moe/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: royl88/talos path: /talos/utils/http.py
# coding=utf-8
from __future__ import absolute_import
import functools
import logging
import requests
from talos.core.i18n import _
from talos.core import exceptions
LOG = logging.getLogger(__name__)
def json_or_error(func):
@functools.wraps(func... | code_fim | hard | {
"lang": "python",
"repo": "royl88/talos",
"path": "/talos/utils/http.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> resp = requests.get(url, **kwargs)
return resp
def patch(url, **kwargs):
resp = requests.patch(url, **kwargs)
return resp
@staticmethod
def delete(url, **kwargs):
resp = requests.delete(url, **kwargs)
return resp
def put(url, **kwargs):
resp = requests.put(url, **kwargs)
... | code_fim | hard | {
"lang": "python",
"repo": "royl88/talos",
"path": "/talos/utils/http.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: newtonjain/hacktheplanet path: /bmw/models/_driver.py
from django.db import models
from address.models import AddressField
from users.models import User
<|fim_suffix|>
class Driver(User):
bike_model = models.CharField(
max_length=100,
choices=BIKE_MODELS,
default='BM... | code_fim | medium | {
"lang": "python",
"repo": "newtonjain/hacktheplanet",
"path": "/bmw/models/_driver.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> bike_model = models.CharField(
max_length=100,
choices=BIKE_MODELS,
default='BMW G 650 GS')
location = AddressField(
blank=True,
null=True)<|fim_prefix|># repo: newtonjain/hacktheplanet path: /bmw/models/_driver.py
from django.db import models
from address... | code_fim | medium | {
"lang": "python",
"repo": "newtonjain/hacktheplanet",
"path": "/bmw/models/_driver.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _filter(self, entries, _):
return [entry for entry in entries if self._include_entry(entry)]
def apply(self, entries, options):
if self.value:
return self._filter(entries, options)
else:
return entries
def __bool__(self):
return boo... | code_fim | hard | {
"lang": "python",
"repo": "mkolosick/fava",
"path": "/fava/api/filters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mkolosick/fava path: /fava/api/filters.py
import re
from beancount.core import account
from beancount.core.data import Transaction
from beancount.ops import summarize
from beancount.query import (
query_compile, query_env, query_execute, query_parser)
from fava.util.date import parse_date
... | code_fim | hard | {
"lang": "python",
"repo": "mkolosick/fava",
"path": "/fava/api/filters.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>cli = {
'database': DatabaseCli(),
'query': QueryCli(),
'server': ServerCli(),
}<|fim_prefix|># repo: julienc91/dbtrigger path: /dbtrigger/cli/__init__.py
# -*- coding: utf-8 -*-
<|fim_middle|>from .database import DatabaseCli
from .query import QueryCli
from .server import ServerCli
| code_fim | medium | {
"lang": "python",
"repo": "julienc91/dbtrigger",
"path": "/dbtrigger/cli/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: julienc91/dbtrigger path: /dbtrigger/cli/__init__.py
# -*- coding: utf-8 -*-
<|fim_suffix|>cli = {
'database': DatabaseCli(),
'query': QueryCli(),
'server': ServerCli(),
}<|fim_middle|>from .database import DatabaseCli
from .query import QueryCli
from .server import ServerCli
| code_fim | medium | {
"lang": "python",
"repo": "julienc91/dbtrigger",
"path": "/dbtrigger/cli/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kokin/handson-algorithmic-trading-with-python path: /ch03/algorithms.py
import quantopian.algorithm as algo
from quantopian.pipeline import Pipeline
from quantopian.pipeline.data.builtin import USEquityPricing
from quantopian.pipeline.filters import Q500US
from quantopian.pipeline.data import ... | code_fim | hard | {
"lang": "python",
"repo": "kokin/handson-algorithmic-trading-with-python",
"path": "/ch03/algorithms.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Flatten position for this security.
order_target_percent(security, 0)
# Plot updated winners and losers variables.
record_vars(context, data)
def generate_entries(context, data):
"""
Execute orders to enter positions according to our sch... | code_fim | hard | {
"lang": "python",
"repo": "kokin/handson-algorithmic-trading-with-python",
"path": "/ch03/algorithms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: callat-qcd/lattedb path: /lattedb/project/formfac/models/data/ff4d.py
"""Models ofform factor 4D files.
"""
from django.db import models
from lattedb.project.formfac.models.data import (
AbstractFormFactor4DFile,
PhysicalFormFactor4DFile,
)
from lattedb.project.formfac.models.data.tsliced... | code_fim | hard | {
"lang": "python",
"repo": "callat-qcd/lattedb",
"path": "/lattedb/project/formfac/models/data/ff4d.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> configuration = models.IntegerField(help_text="Number of configuration.")
t_separation = models.IntegerField(help_text="Source sink time separation.")
source = models.CharField(
max_length=100, help_text="Source location in format `xXyYzZtT`."
)
dependent = models.OneToOneField... | code_fim | medium | {
"lang": "python",
"repo": "callat-qcd/lattedb",
"path": "/lattedb/project/formfac/models/data/ff4d.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: giftig/s3-browser path: /s3_browser/tests/test_bookmarks.py
import json
import os
import unittest
import uuid
from s3_browser import bookmarks
class BookmarksTest(unittest.TestCase):
FILE_PREFIX = 's3_browser_tests_'
data = {
'bookmarks': {
'foo': {
... | code_fim | hard | {
"lang": "python",
"repo": "giftig/s3-browser",
"path": "/s3_browser/tests/test_bookmarks.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> f = self.gen_filename()
man = bookmarks.BookmarkManager(f)
man.add_bookmark('awesome_bookmark', 'amazing/path')
self.assertFalse(man.remove_bookmark('lame_bookmark'))
def test_save_bookmarks(self):
f = self.gen_filename()
man1 = bookmarks.BookmarkManage... | code_fim | hard | {
"lang": "python",
"repo": "giftig/s3-browser",
"path": "/s3_browser/tests/test_bookmarks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_remove_missing_bookmark(self):
f = self.gen_filename()
man = bookmarks.BookmarkManager(f)
man.add_bookmark('awesome_bookmark', 'amazing/path')
self.assertFalse(man.remove_bookmark('lame_bookmark'))
def test_save_bookmarks(self):
f = self.gen_filena... | code_fim | hard | {
"lang": "python",
"repo": "giftig/s3-browser",
"path": "/s3_browser/tests/test_bookmarks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Quansight-Labs/uarray path: /uarray/tests/example_helpers.py
import uarray as ua
class _TypedBackend:
__ua_domain__ = "ua_examples"
def __init__(self, *my_types):
self.my_types = my_types
def __ua_convert__(self, dispatchables, coerce):
if not all(type(d.value) in ... | code_fim | medium | {
"lang": "python",
"repo": "Quansight-Labs/uarray",
"path": "/uarray/tests/example_helpers.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
BackendA = _TypedBackend(TypeA)
BackendB = _TypedBackend(TypeB)
BackendC = _TypedBackend(TypeC)
BackendAB = _TypedBackend(TypeA, TypeB)
BackendBC = _TypedBackend(TypeB, TypeC)
creation_multimethod = ua.generate_multimethod(
lambda: (), lambda a, kw, d: (a, kw), "ua_examples"
)
call_multime... | code_fim | medium | {
"lang": "python",
"repo": "Quansight-Labs/uarray",
"path": "/uarray/tests/example_helpers.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Local testing
# g = GoogleFetcher()
# t, io = g.fetch_google_card(None, 0, 't', 'https://www.google.com/search?client=firefox-b-d&q=msft', 'c')
# print(t)<|fim_prefix|># repo: akenneth/smarty-selenium-telegram-bot path: /fetchers/goolge_fetcher.py
import io
import logging
import string
from typing impo... | code_fim | hard | {
"lang": "python",
"repo": "akenneth/smarty-selenium-telegram-bot",
"path": "/fetchers/goolge_fetcher.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akenneth/smarty-selenium-telegram-bot path: /fetchers/goolge_fetcher.py
import io
import logging
import string
from typing import Any
from fetchers.base_fetcher import BaseSeleniumFetcher
class GoogleFetcher(BaseSeleniumFetcher):
def fetch_google_card(self, bot: Any, chat_id: int, title: s... | code_fim | hard | {
"lang": "python",
"repo": "akenneth/smarty-selenium-telegram-bot",
"path": "/fetchers/goolge_fetcher.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: the-watchmaker/exporterhub.io path: /api/user/migrations/0007_auto_20210330_1335.py
# Generated by Django 3.1.6 on 2021-03-30 04:35
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('user', '0006_user_github_id'),
]
operations = [
migrations.A... | code_fim | medium | {
"lang": "python",
"repo": "the-watchmaker/exporterhub.io",
"path": "/api/user/migrations/0007_auto_20210330_1335.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='user',
name='intro',
field=models.CharField(max_length=4000, null=True),
),
migrations.AlterField(
model_name='user',
name='github_id',
field=models.IntegerFi... | code_fim | medium | {
"lang": "python",
"repo": "the-watchmaker/exporterhub.io",
"path": "/api/user/migrations/0007_auto_20210330_1335.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('user', '0006_user_github_id'),
]
operations = [
migrations.AddField(
model_name='user',
name='intro',
field=models.CharField(max_length=4000, null=True),
),
migrations.AlterField(
model_name='us... | code_fim | medium | {
"lang": "python",
"repo": "the-watchmaker/exporterhub.io",
"path": "/api/user/migrations/0007_auto_20210330_1335.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arubdesu/zentral path: /zentral/contrib/mdm/commands/install_enterprise_application.py
import logging
from django.db import transaction
from django.urls import reverse
from zentral.conf import settings
from zentral.contrib.mdm.models import ArtifactOperation, Channel, DeviceArtifact, Platform, Ta... | code_fim | hard | {
"lang": "python",
"repo": "arubdesu/zentral",
"path": "/zentral/contrib/mdm/commands/install_enterprise_application.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def build_command(self):
# TODO manage options
# see https://developer.apple.com/documentation/devicemanagement/installenterpriseapplicationcommand/command
manifest = self.artifact_version.enterprise_app.manifest
manifest["items"][0]["assets"][0]["url"] = "https://{}{}"... | code_fim | hard | {
"lang": "python",
"repo": "arubdesu/zentral",
"path": "/zentral/contrib/mdm/commands/install_enterprise_application.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> X = np.zeros(((fs//2-fmin)//2*10, int(fs*interval)), np.float32)
Y = np.zeros((fs//2-fmin)//2*10, np.float32)
counter=0
for k in tqdm(range(fmin,fs//2, 2)): # Creating signals with different frequencies
for phi in np.arange(0,1,0.1):
X[counter]=np.sin(2*np.pi*(k*t+phi)... | code_fim | medium | {
"lang": "python",
"repo": "HudsonHuang/nnAudio",
"path": "/Trainable_STFT/helperfunctions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HudsonHuang/nnAudio path: /Trainable_STFT/helperfunctions.py
from tqdm import tqdm
import numpy as np
def get_dummy_dataset():
<|fim_suffix|> X = np.zeros(((fs//2-fmin)//2*10, int(fs*interval)), np.float32)
Y = np.zeros((fs//2-fmin)//2*10, np.float32)
counter=0
for k in tqdm(range... | code_fim | medium | {
"lang": "python",
"repo": "HudsonHuang/nnAudio",
"path": "/Trainable_STFT/helperfunctions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
This class will inherit from multiple Queries
as we begin to add more apps to our project
"""
pass
schema = graphene.Schema(query=Query, mutation=Mutation)<|fim_prefix|># repo: lunyamwis/appraisal-system-bend path: /app/schema.py
import graphene
from app.api.authentication.muta... | code_fim | hard | {
"lang": "python",
"repo": "lunyamwis/appraisal-system-bend",
"path": "/app/schema.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lunyamwis/appraisal-system-bend path: /app/schema.py
import graphene
from app.api.authentication.mutations import Mutation as auth_mutation
from app.api.authentication.query import Query as user_query
from app.api.employee.mutations import Mutation as employee_mutation
from app.api.employee.quer... | code_fim | medium | {
"lang": "python",
"repo": "lunyamwis/appraisal-system-bend",
"path": "/app/schema.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
num=[int(x) for x in num]
return num<|fim_prefix|># repo: viewv/leetcode path: /66. Plus One.py
class Solution:
def plusOne(self, digits):
<|fim_middle|> num=[str(x) for x in digits]
num=''.join(num)
num=int(num)+1
num=list(str(num)) | code_fim | medium | {
"lang": "python",
"repo": "viewv/leetcode",
"path": "/66. Plus One.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: viewv/leetcode path: /66. Plus One.py
class Solution:
def plusOne(self, digits):
num=[str(x) for x in digits]
num=''.join(n<|fim_suffix|>
num=[int(x) for x in num]
return num<|fim_middle|>um)
num=int(num)+1
num=list(str(num)) | code_fim | easy | {
"lang": "python",
"repo": "viewv/leetcode",
"path": "/66. Plus One.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>um)
num=int(num)+1
num=list(str(num))
num=[int(x) for x in num]
return num<|fim_prefix|># repo: viewv/leetcode path: /66. Plus One.py
class Solution:
def plusOne(self, digits):
<|fim_middle|> num=[str(x) for x in digits]
num=''.join(n | code_fim | easy | {
"lang": "python",
"repo": "viewv/leetcode",
"path": "/66. Plus One.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def render(self, surface, colour):
surface.fill(colour, self.rect)
def colliderect(self, r):
return self.rect.collide(r)
def collidelist(self, l):
return self.rect.collidelist(l)<|fim_prefix|># repo: realh/SiliconGlitch path: /src/render.py
from pygame import Color, ... | code_fim | hard | {
"lang": "python",
"repo": "realh/SiliconGlitch",
"path": "/src/render.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: realh/SiliconGlitch path: /src/render.py
from pygame import Color, Surface
class Renderable:
""" diffuse and specular are pygame Color values. z is a single float. """
def __init__(self, diffuse, specular, z):
self.diffuse = diffuse
self.specular = specular
self.z... | code_fim | hard | {
"lang": "python",
"repo": "realh/SiliconGlitch",
"path": "/src/render.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__(diffuse, specular, z)
self.rect = rect
self.x = rect.x
self.y = rect.y
self.w = rect.w
self.h = rect.h
def render(self, surface, colour):
surface.fill(colour, self.rect)
def colliderect(self, r):
return self.rect.co... | code_fim | hard | {
"lang": "python",
"repo": "realh/SiliconGlitch",
"path": "/src/render.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jxhangithub/leetcode path: /solutions/python3/204.py
class Solution:
def countPrimes(self, n):
primes = [i for i in range(2, n)]
for i in range(2, n):
for prime i<|fim_suffix|> i:
primes.remove(prime)
return len(primes)<|fim_middle|>n pr... | code_fim | hard | {
"lang": "python",
"repo": "jxhangithub/leetcode",
"path": "/solutions/python3/204.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>n primes:
if i ** (prime - 1) % prime != 1 and prime > i:
primes.remove(prime)
return len(primes)<|fim_prefix|># repo: jxhangithub/leetcode path: /solutions/python3/204.py
class Solution:
def countPrimes(self, n):
primes = [i for <|fim_middle|>i in ... | code_fim | hard | {
"lang": "python",
"repo": "jxhangithub/leetcode",
"path": "/solutions/python3/204.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #创建二维列表
h, w = img.shape[:2]
vis0 = np.zeros((h,w), np.float32)
vis0[:h,:w] = img #填充数据
#二维Dct变换
vis1 = cv.dct(cv.dct(vis0))
#cv.SaveImage('a.jpg',cv.fromarray(vis0)) #保存图片
vis1.resize(32,32)
#把二维list变成一维list
img_list=list(itertools.chain.from_iterable(v... | code_fim | hard | {
"lang": "python",
"repo": "heiyixueren/python_code",
"path": "/search_by_map/phash.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: heiyixueren/python_code path: /search_by_map/phash.py
# python + opencv实现的phash算法 生成图片的指纹字符串 并存储到redis中的
# python phash.py -f n 计算图库中图片的指纹字符串
# python phash.py -p test_img/123.jpg 计算图片和图库中图片的相似度 >=0.85被认为是相似的
import cv2 as cv
import os
from optparse import OptionParser
import numpy as np
import ... | code_fim | hard | {
"lang": "python",
"repo": "heiyixueren/python_code",
"path": "/search_by_map/phash.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> import Attention
from slixmpp.plugins.xep_0224.attention import XEP_0224
register_plugin(XEP_0224)<|fim_prefix|># repo: poezio/slixmpp path: /slixmpp/plugins/xep_0224/__init__.py
# Slixmpp: The Slick XMPP Library
# Copyright (C) 2011 Nathanael C. Fritz, Lance J.T. Stout
# This <|fim_middle|>file is p... | code_fim | hard | {
"lang": "python",
"repo": "poezio/slixmpp",
"path": "/slixmpp/plugins/xep_0224/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: poezio/slixmpp path: /slixmpp/plugins/xep_0224/__init__.py
# Slixmpp: The Slick XMPP Library
# Copyright (C) 2011 Nathanael C. Fritz, Lance J.T. Stout
# This file is part of Slixmpp.
# See the file LICENSE for copying permission.
from slixmpp.plugins.base imp<|fim_suffix|> import Attention
from ... | code_fim | medium | {
"lang": "python",
"repo": "poezio/slixmpp",
"path": "/slixmpp/plugins/xep_0224/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def url_for(self, filename, expire=300):
return "https://example.com/artifacts/{}".format(filename)
def get_file(self, filename):
return BytesIO(_cache[filename])
@staticmethod
def clear():
_cache.clear()<|fim_prefix|># repo: robopsi/zeus path: /zeus/storage/mock... | code_fim | medium | {
"lang": "python",
"repo": "robopsi/zeus",
"path": "/zeus/storage/mock.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robopsi/zeus path: /zeus/storage/mock.py
from io import BytesIO
from .base import FileStorage
_cache = {}
class FileStorageCache(FileStorage):
global _cache
def delete(self, filename):
_cache.pop(filename, None)
<|fim_suffix|> return BytesIO(_cache[filename])
@st... | code_fim | hard | {
"lang": "python",
"repo": "robopsi/zeus",
"path": "/zeus/storage/mock.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ohlogic/py3dEngine path: /dataobjects/terrain.py
#!/usr/bin/python3
import pyglet
from pyglet.gl import *
import numpy as np
from noise import pnoise2
import math
import numpy as np
class Ground():
floor = None
drawTerrain = None
def __init__(self, floor):
... | code_fim | hard | {
"lang": "python",
"repo": "ohlogic/py3dEngine",
"path": "/dataobjects/terrain.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def walk_on_create_floor(self, x, z):
icoords = self.coords_to_indices(x, z)
create = False
if self.all_floors[icoords[0],icoords[1]] == None:
create = True
if create:
self.all_floors[icoords[0],icoords[1]] = Ground(
... | code_fim | hard | {
"lang": "python",
"repo": "ohlogic/py3dEngine",
"path": "/dataobjects/terrain.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uetchy/generative-models path: /GAN/dual_gan/dualgan_pytorch.py
import torch
import torch.nn
import torch.nn.functional as nn
import torch.autograd as autograd
import torch.optim as optim
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import os
from torc... | code_fim | hard | {
"lang": "python",
"repo": "uetchy/generative-models",
"path": "/GAN/dual_gan/dualgan_pytorch.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Print and plot every now and then
if it % 1000 == 0:
print('Iter-{}; D_loss: {:.4}; G_loss: {:.4}'
.format(it, D1_loss.data[0] + D2_loss.data[0], G_loss.data[0]))
real1 = X1.data.numpy()[:4]
real2 = X2.data.numpy()[:4]
samples1 = X1_sample.data.nump... | code_fim | hard | {
"lang": "python",
"repo": "uetchy/generative-models",
"path": "/GAN/dual_gan/dualgan_pytorch.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> return json,200
def delete(self,id):
json = []
try:
mensagem = MensagemModel.encontrar_pelo_id(id)
if mensagem:
mensagem.remover()
lista = MensagemModel.listar()
schema = MensagemSchema(many=True,exclude=[... | code_fim | hard | {
"lang": "python",
"repo": "erickotsuka/sistema-contratacao-backend",
"path": "/toko/resources/mensagem_resource.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> except Exception as ex:
print(ex)
return {"message": "erro"}, 500
def put(self):
json = ''
try:
data = MensagemResource.parser.parse_args()
id_chat = data['id_chat']
id_usuario_de = data['id_usuario_de']
i... | code_fim | hard | {
"lang": "python",
"repo": "erickotsuka/sistema-contratacao-backend",
"path": "/toko/resources/mensagem_resource.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: erickotsuka/sistema-contratacao-backend path: /toko/resources/mensagem_resource.py
from flask_restful import Resource, reqparse, abort
from flask import request
from toko.models.mensagem_model import MensagemModel
from toko.schemas.mensagem_schema import MensagemSchema
from datetime import dateti... | code_fim | hard | {
"lang": "python",
"repo": "erickotsuka/sistema-contratacao-backend",
"path": "/toko/resources/mensagem_resource.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># time python3 load/TestCleanup.py test-video ENGESVP2DV
# This should load 2 files of Mark chapter 1
# time python3 load/UpdateDBPVideoTables.py test-video /Volumes/FCBH/all-dbp-etl-test/ ENGESVP2DV
# This should load 2 files of Matt chapter 2, Mark must be intact after load
# time python3 load/UpdateD... | code_fim | hard | {
"lang": "python",
"repo": "faithcomesbyhearing/dbp-etl",
"path": "/load/UpdateDBPVideoTables.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: faithcomesbyhearing/dbp-etl path: /load/UpdateDBPVideoTables.py
# UpdateDBPVideoTables.py
# This program updates the bible_file_stream_bandwidth, and bible_file_stream_ts files for video
import re
from Config import *
from SQLUtility import *
from SQLBatchExec import *
from TranscodeVideo impor... | code_fim | hard | {
"lang": "python",
"repo": "faithcomesbyhearing/dbp-etl",
"path": "/load/UpdateDBPVideoTables.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if filename not in self.dbpBandwidthMap.keys():
insertRows.append((fileId, bandwidth, width, height, codec, stream, filename))
else:
(dbpFileId, dbpBandwidth, dbpWidth, dbpHeight, dbpCodec, dbpStream) = self.dbpBandwidthMap[filename]
if isinstance(fileId, int) and fileId != dbpFileI... | code_fim | hard | {
"lang": "python",
"repo": "faithcomesbyhearing/dbp-etl",
"path": "/load/UpdateDBPVideoTables.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: google/grr path: /grr/server/grr_response_server/flows/general/webhistory.py
#!/usr/bin/env python
"""Flow to recover history files."""
# DISABLED for now until it gets converted to artifacts.
import collections
import datetime
import os
from typing import cast, Iterator
from grr_response_cor... | code_fim | hard | {
"lang": "python",
"repo": "google/grr",
"path": "/grr/server/grr_response_server/flows/general/webhistory.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
username: Username as string.
Returns:
A list of strings containing paths to look for history files in.
Raises:
OSError: On invalid system in the Schema
"""
client = data_store.REL_DB.ReadClientSnapshot(self.client_id)
system = client.knowledge_base.os
... | code_fim | hard | {
"lang": "python",
"repo": "google/grr",
"path": "/grr/server/grr_response_server/flows/general/webhistory.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Data loader
train_params = {'train': True,
'batch_size': batch_size,
'input_shape': input_shape,
'mosaic': True,
'annotation_path': annotation_path,
'classes_path': classes_path,
... | code_fim | hard | {
"lang": "python",
"repo": "monchhichizzq/CenterNet",
"path": "/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.5, patience=20, verbose=1)
early_stopping = EarlyStopping(monitor='val_loss', min_delta=0, patience=6, verbose=1)
mAP_callback = VOC2012mAP_Callback(input_shape = (448, 448, 3),
data_path = data... | code_fim | hard | {
"lang": "python",
"repo": "monchhichizzq/CenterNet",
"path": "/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: monchhichizzq/CenterNet path: /train.py
# -*- coding: utf-8 -*-
# @Time : 2021/2/14 0:33
# @Author : Zeqi@@
# @FileName: train.py
# @Software: PyCharm
import os
import logging
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.callbacks import Early... | code_fim | hard | {
"lang": "python",
"repo": "monchhichizzq/CenterNet",
"path": "/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
User should be able to accept or reject an answer to a question
'''
@jwt_required
def put(self, question_id, answers_id):
"""
accept or reject answer to a question
---
tags:
- Answers
security:
- Bearer: []
des... | code_fim | hard | {
"lang": "python",
"repo": "briank254/stackoverflow--lite",
"path": "/app_v2/answers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: briank254/stackoverflow--lite path: /app_v2/answers.py
"""
Implements the answers endpoints
"""
from flask import request
from flask_restful import Resource
from jsonschema import validate, ValidationError
from flask_jwt_extended import jwt_required
from database.models.answers_model import Answe... | code_fim | hard | {
"lang": "python",
"repo": "briank254/stackoverflow--lite",
"path": "/app_v2/answers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> This class is not backwards compatible with dictionaries."""
def __init__(self, lookup_dict):
self._lookup_dict = lookup_dict
def __getattr__(self, attr):
try:
return self._lookup_dict[attr]
except KeyError:
raise AttributeError
def __setat... | code_fim | hard | {
"lang": "python",
"repo": "thomasw/querylist",
"path": "/querylist/dict.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thomasw/querylist path: /querylist/dict.py
class BetterDict(dict):
def __getattr__(self, attr):
if attr in self:
return self.__dict_to_BetterDict(attr)
raise AttributeError
def __dict_to_BetterDict(self, attr):
"""Convert the passed attr to a BetterDi... | code_fim | hard | {
"lang": "python",
"repo": "thomasw/querylist",
"path": "/querylist/dict.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('CÁLCULO DAS COMPRAS EM UM MERCADINHO')
dist = input('Digite a distância a ser percorrida pelo carro (em km): ')
dist = dist.replace("," , ".")
dist = float(dist)
velMedia = input('Digite a velocidade média do carro esperada na viagem (em km/h): ')
velMedia = velMedia.replace("," , ".")
velMedia =... | code_fim | hard | {
"lang": "python",
"repo": "AldenisFranca/PythonListasExercicios",
"path": "/Lista1/lista_exercicios1_aldenis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AldenisFranca/PythonListasExercicios path: /Lista1/lista_exercicios1_aldenis.py
# -*- coding: utf-8 -*-
"""Lista_Exercicios1_Aldenis.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1oBKR-muS_ZuZ63_J6J3y8yxI2G-LiI79
###IFPE ... | code_fim | hard | {
"lang": "python",
"repo": "AldenisFranca/PythonListasExercicios",
"path": "/Lista1/lista_exercicios1_aldenis.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('CÁLCULO DO VALOR RECEBIDO PELO USUÁRIO EM UMA INICIATIVA ECOLÓGICA')
recip1lt = int(input('Digite a quantidade de recipientes de 1 litro: '))
recip2lt = int(input('Digite a quantidade de recipientes de 2 litros: '))
print('\nO valor recebido pelo usuário é de R$ {}'.format((recip1lt*0.1)+(recip2l... | code_fim | hard | {
"lang": "python",
"repo": "AldenisFranca/PythonListasExercicios",
"path": "/Lista1/lista_exercicios1_aldenis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>contents = file.read()
contents = contents.split(" ")
dict ={}
count = 0
for word in contents:
if word not in dict:
count += 1
dict.update({word : count})
count = 0
else:
count = dict.get(word)
count += 1
dict.update({word : count})
count = 0... | code_fim | medium | {
"lang": "python",
"repo": "Ujwal36/Ujwal",
"path": "/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ujwal36/Ujwal path: /test.py
file = open("touch.txt", "wt")
str = "there once was a fish and the fish was always eating once as there were no other fishes near that fish"
file.write(str)
<|fim_suffix|>
file = open("touch.txt", "rt")
contents = file.read()
contents = contents.split(" ")
dict ={}... | code_fim | medium | {
"lang": "python",
"repo": "Ujwal36/Ujwal",
"path": "/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> year = mongodb.IntField()
month = mongodb.IntField()
day = mongodb.IntField()
member_count = mongodb.IntField()
topic_count = mongodb.IntField()
comment_count = mongodb.IntField()
meta = {'collection': 'social_circles'}<|fim_prefix|># repo: medsci-tech/mime_analysis_flask_mon... | code_fim | medium | {
"lang": "python",
"repo": "medsci-tech/mime_analysis_flask_mongodb_2017",
"path": "/app/models/social_circle.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: medsci-tech/mime_analysis_flask_mongodb_2017 path: /app/models/social_circle.py
from . import mongodb
from . import Doctor
class SocialCircle(mongodb.Document):
<|fim_suffix|> member_count = mongodb.IntField()
topic_count = mongodb.IntField()
comment_count = mongodb.IntField()
m... | code_fim | medium | {
"lang": "python",
"repo": "medsci-tech/mime_analysis_flask_mongodb_2017",
"path": "/app/models/social_circle.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elggem/EveNet path: /interactive_generator/shell.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from ttsserver.api import cerevoice
from termcolor import colored
from time import sleep
import urllib
import subprocess
import cmd
import sys
import socket
imp... | code_fim | hard | {
"lang": "python",
"repo": "elggem/EveNet",
"path": "/interactive_generator/shell.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> EveShell.currentEmotion = 7
def do_disgusted(self, arg):
EveShell.currentEmotion = 8
def do_other(self, arg):
EveShell.currentEmotion = 9
# ----- demo function -----
def do_demo(self, arg):
EveShell.do_neutral(self, arg)
print("Switching to %s" % ... | code_fim | hard | {
"lang": "python",
"repo": "elggem/EveNet",
"path": "/interactive_generator/shell.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # unit/area conversion factor
factor = (k_G*f_N2O*area_grid)/1000/1000/1000/1000
factor = factor[datarng]
factor_area = (area_grid/1000/1000/1000/1000)[datarng] # from g m-2 y-1 to Tg y-1 per gridcell
# find the years to use - nearest covered by the dataset
datayears = years.... | code_fim | hard | {
"lang": "python",
"repo": "elizaharris/IsoTONE",
"path": "/2_Final_Model_v3_Tanomfix.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elizaharris/IsoTONE path: /2_Final_Model_v3_Tanomfix.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 16 13:17:17 2020
@author: elizaharris
"""
#%% Define the model
#x = params[:,0]
def model(x,fullres="N",d15Nrandomise="N"):
c_prea_new=[x[0],7.5]
scale_fitN2_ne... | code_fim | hard | {
"lang": "python",
"repo": "elizaharris/IsoTONE",
"path": "/2_Final_Model_v3_Tanomfix.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Use slicing to get columns 3 to 4
print(temperatures.iloc[:, 2:4])
# Use slicing in both directions at once
print(temperatures.iloc[:5, 2:4])<|fim_prefix|># repo: CodeHemP/CAREER-TRACK-Data-Scientist-with-Python path: /04_Data Manipulation with pandas/03_Slicing and Indexing/08_Subsetting by row-colum... | code_fim | hard | {
"lang": "python",
"repo": "CodeHemP/CAREER-TRACK-Data-Scientist-with-Python",
"path": "/04_Data Manipulation with pandas/03_Slicing and Indexing/08_Subsetting by row-column number.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ------------------------------------------------
temperatures.head()
date city country avg_temp_c
0 2000-01-01 Abidjan Côte D'Ivoire 27.293
1 2000-02-01 Abidjan Côte D'Ivoire 27.685
2 2000-03-01 Abidjan Côte D'Ivoire 29.061
3 2000-04-01 Abidjan Côte D'Ivoire ... | code_fim | hard | {
"lang": "python",
"repo": "CodeHemP/CAREER-TRACK-Data-Scientist-with-Python",
"path": "/04_Data Manipulation with pandas/03_Slicing and Indexing/08_Subsetting by row-column number.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CodeHemP/CAREER-TRACK-Data-Scientist-with-Python path: /04_Data Manipulation with pandas/03_Slicing and Indexing/08_Subsetting by row-column number.py
'''
08 - Subsetting by row/column
The most common ways to subset rows are the ways we've previously discussed:
using a Boolean condition or by ... | code_fim | medium | {
"lang": "python",
"repo": "CodeHemP/CAREER-TRACK-Data-Scientist-with-Python",
"path": "/04_Data Manipulation with pandas/03_Slicing and Indexing/08_Subsetting by row-column number.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brianbarbieri/Advent-of-code-speed-tests path: /2020/day 12/solutions/solution_3.py
import sys, os
sys.path.append(os.path.abspath('../day 1'))
from baseclass import Solution
# imports required for solution:
class Solution_Repo(Solution):
def __init__(self):
Solution.__init__(self)... | code_fim | hard | {
"lang": "python",
"repo": "brianbarbieri/Advent-of-code-speed-tests",
"path": "/2020/day 12/solutions/solution_3.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(os.path.dirname(__file__) + "/../input.txt", "r") as f:
data = [line.strip() for line in f.readlines()]
x, y, wx, wy = 0, 0, 10, 1
dirs = ((1,1), (-1, 1), (-1, -1), (1, -1))
idx = 0
for instruction in data:
action = instruction[0]
... | code_fim | hard | {
"lang": "python",
"repo": "brianbarbieri/Advent-of-code-speed-tests",
"path": "/2020/day 12/solutions/solution_3.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dblackrun/pbpstats path: /pbpstats/resources/enhanced_pbp/jump_ball.py
class JumpBall(object):
"""
Class for jump ball events
"""
<|fim_suffix|> """
returns team id that won the jump ball
"""
return self.team_id
@property
def event_stats(self):... | code_fim | easy | {
"lang": "python",
"repo": "dblackrun/pbpstats",
"path": "/pbpstats/resources/enhanced_pbp/jump_ball.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
returns list of dicts with all stats for event
"""
return self.base_stats<|fim_prefix|># repo: dblackrun/pbpstats path: /pbpstats/resources/enhanced_pbp/jump_ball.py
class JumpBall(object):
"""
Class for jump ball events
"""
@property
def winning_t... | code_fim | easy | {
"lang": "python",
"repo": "dblackrun/pbpstats",
"path": "/pbpstats/resources/enhanced_pbp/jump_ball.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: testtest1999/hs-console path: /Lib/hstest.py
from hs import unity as _unity
from hs import translate
#Setup configuration to be favorable for screenshots
@_unity
def setupconfig():
"""Setup configuration to be favorable for screenshots"""
from Manager import Studio
studio = Studio.In... | code_fim | hard | {
"lang": "python",
"repo": "testtest1999/hs-console",
"path": "/Lib/hstest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def run():
import hs
import time
from Manager import Studio
studio = Studio.Instance
setup()
hsfem = create_female('[GX] Mother')
if not hsfem:
return None
return play_actions(hsfem)
def runall():
itr = run()
while(itr.next()): time.sleep(1)
... | code_fim | hard | {
"lang": "python",
"repo": "testtest1999/hs-console",
"path": "/Lib/hstest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # This env variable is required for airflow's kubernetes configuration validation
environ["AIRFLOW__KUBERNETES__DAGS_IN_IMAGE"] = "True"
super(DbndKubernetesExecutor, self).__init__()
from multiprocessing.managers import SyncManager
self._manager = SyncManager()
... | code_fim | hard | {
"lang": "python",
"repo": "Dtchil/dbnd",
"path": "/modules/dbnd-airflow/src/dbnd_airflow/executors/kubernetes_executor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if event["type"] == "ERROR":
return self.process_error(event)
pod_data = event["object"]
pod_name = pod_data.metadata.name
phase = pod_data.status.phase
if self.processed_events.get(pod_name):
... | code_fim | hard | {
"lang": "python",
"repo": "Dtchil/dbnd",
"path": "/modules/dbnd-airflow/src/dbnd_airflow/executors/kubernetes_executor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dtchil/dbnd path: /modules/dbnd-airflow/src/dbnd_airflow/executors/kubernetes_executor.py
RuntimeError, DatabandSigTermError
from dbnd._core.utils.basics.signal_utils import safe_signal
from dbnd_airflow_contrib.kubernetes_metrics_logger import KubernetesMetricsLogger
from dbnd_docker.kubernetes.... | code_fim | hard | {
"lang": "python",
"repo": "Dtchil/dbnd",
"path": "/modules/dbnd-airflow/src/dbnd_airflow/executors/kubernetes_executor.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# opening - erosion followed by dilation
def opening(image):
kernel = np.ones((5, 5), np.uint8)
return cv2.morphologyEx(image, cv2.MORPH_OPEN, kernel)
# canny edge detection
def canny(image):
return cv2.Canny(image, 100, 200)<|fim_prefix|># repo: buemura/license-plate-recognition path: /sr... | code_fim | hard | {
"lang": "python",
"repo": "buemura/license-plate-recognition",
"path": "/src/lib/filters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: buemura/license-plate-recognition path: /src/lib/filters.py
import cv2
import numpy as np
import pytesseract
try:
from PIL import Image
except ImportError:
import Image
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract'
# get grayscale image
def get_gra... | code_fim | medium | {
"lang": "python",
"repo": "buemura/license-plate-recognition",
"path": "/src/lib/filters.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Shadofer/Pincer path: /pincer/objects/events/typing_start.py
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
from dataclasses import dataclass
from pincer.objects.guild_member import GuildMember
from pincer.utils.api_object import APIObject
from... | code_fim | medium | {
"lang": "python",
"repo": "Shadofer/Pincer",
"path": "/pincer/objects/events/typing_start.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param member:
the member who started typing if this happened in a guild
"""
channel_id: Snowflake
user_id: Snowflake
timestamp: int
guild_id: APINullable[Snowflake] = MISSING
member: APINullable[GuildMember] = MISSING<|fim_prefix|># repo: Shadofer/Pincer path: /pince... | code_fim | medium | {
"lang": "python",
"repo": "Shadofer/Pincer",
"path": "/pincer/objects/events/typing_start.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# NOTE: Overridden to pass the flag to disable dirtyfields from the queryset to the model creation
# Additions are surrounded by ### comment blocks
class ModelIterable(django.db.models.query.ModelIterable):
def __iter__(self):
queryset = self.queryset
###
# Get disable_dirty... | code_fim | hard | {
"lang": "python",
"repo": "1024inc/django-dirtyfields",
"path": "/src/dirtyfields/django_patches.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 1024inc/django-dirtyfields path: /src/dirtyfields/django_patches.py
"""
Override some of the core classes of django
"""
import logging
import django.db.models.query
from .dirtyfields import DirtyFieldsMixin
log = logging.getLogger(__name__)
# NOTE: Overridden to pass the flag to disable dirt... | code_fim | hard | {
"lang": "python",
"repo": "1024inc/django-dirtyfields",
"path": "/src/dirtyfields/django_patches.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(log_file, "a") as log:
log.write("{0},{1}\n".format(strftime("%Y-%m-%d %H:%M:%S"),str(temp)))
while True:
temp = cpu.temperature
write_temp(temp)
sleep(PAUSE_INTERVAL)<|fim_prefix|># repo: tnc-ca-geo/animl-base path: /temp-monitor.py
import os
from gpiozero import CPUT... | code_fim | medium | {
"lang": "python",
"repo": "tnc-ca-geo/animl-base",
"path": "/temp-monitor.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.