text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: wonderocean/pysvr_framework path: /SqlSvr.py
# -*- coding: UTF-8 -*-
import sqlite3
#Sql模块
Svr_Table = {"3":"SqlSqlite3", #Sqlite3服务
}
<|fim_suffix|> print "service %s was called" % req["SvrNo"]
conn = sqlite3.connect("test.db")
conn.execute("update test set id=id+1")
conn.commi... | code_fim | easy | {
"lang": "python",
"repo": "wonderocean/pysvr_framework",
"path": "/SqlSvr.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Notes
-----
Data information for a FOOOF object is the frequency range and frequency resolution.
"""
return {dat_info : getattr(f_obj, dat_info) for dat_info in get_obj_desc()['freq_info']}
def compare_settings(lst):
"""Compare the settings between FOOOF and/or FOOOFGroup object... | code_fim | hard | {
"lang": "python",
"repo": "ArcadeShrimp/fooof",
"path": "/fooof/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ArcadeShrimp/fooof path: /fooof/utils.py
"""Utility functions for FOOOF."""
import numpy as np
from fooof.synth import gen_freqs
from fooof.core.utils import get_obj_desc
###################################################################################################
#######################... | code_fim | hard | {
"lang": "python",
"repo": "ArcadeShrimp/fooof",
"path": "/fooof/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akiozihao/center_track path: /mmtrack/core/optimizer/__init__.py
from .sot_lr_updater import SiameseRPNLrUpdaterHook
from .sot_optimizer_hook import Si<|fim_suffix|>PNOptimizerHook', 'SiameseRPNLrUpdaterHook']<|fim_middle|>ameseRPNOptimizerHook
__all__ = ['SiameseR | code_fim | easy | {
"lang": "python",
"repo": "akiozihao/center_track",
"path": "/mmtrack/core/optimizer/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>PNOptimizerHook', 'SiameseRPNLrUpdaterHook']<|fim_prefix|># repo: akiozihao/center_track path: /mmtrack/core/optimizer/__init__.py
from .sot_lr_updater import SiameseRPNLrUpd<|fim_middle|>aterHook
from .sot_optimizer_hook import SiameseRPNOptimizerHook
__all__ = ['SiameseR | code_fim | medium | {
"lang": "python",
"repo": "akiozihao/center_track",
"path": "/mmtrack/core/optimizer/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mbravofuentes/Codingpractice path: /python/aaah.py
def main():
f = input()
s = input()
if len(f) >= len(s):
<|fim_suffix|>("no")
if __name__=='__main__':main()<|fim_middle|> print ("go")
else:
print | code_fim | easy | {
"lang": "python",
"repo": "mbravofuentes/Codingpractice",
"path": "/python/aaah.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>("no")
if __name__=='__main__':main()<|fim_prefix|># repo: mbravofuentes/Codingpractice path: /python/aaah.py
def main():
f = input()
s = i<|fim_middle|>nput()
if len(f) >= len(s):
print ("go")
else:
print | code_fim | medium | {
"lang": "python",
"repo": "mbravofuentes/Codingpractice",
"path": "/python/aaah.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, filename):
self.filename = filename
if sys.version_info[0] < 3:
self.fd = codecs.open(
'%s.new' % self.filename, 'w', 'latin-1', 'replace')
else:
# io.open is available from Python 2.6, but we only use it with
... | code_fim | medium | {
"lang": "python",
"repo": "nomed/ebetl",
"path": "/ebetl/lib/helpers.py",
"mode": "spm",
"license": "Artistic-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nomed/ebetl path: /ebetl/lib/helpers.py
# -*- coding: utf-8 -*-
"""WebHelpers used in ebetl."""
import sys
from webhelpers import date, feedgenerator, html, number, misc, text
from datetime import datetime
import sys
import os
import re
import codecs
import io
import collections
# pychecker g... | code_fim | medium | {
"lang": "python",
"repo": "nomed/ebetl",
"path": "/ebetl/lib/helpers.py",
"mode": "psm",
"license": "Artistic-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aplbrain/ndingest path: /test/test_tilebucket.py
# Copyright 2014 NeuroData (http://neurodata.io)
# Copyright 2016 The Johns Hopkins University Applied Physics Laboratory
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... | code_fim | hard | {
"lang": "python",
"repo": "aplbrain/ndingest",
"path": "/test/test_tilebucket.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test policy creation with a folder"""
statements = [{
'Sid': 'WriteAccess',
'Effect': 'Allow',
'Action': ['s3:PutObject']
}]
expName = 'ndingest_test_tile_bucket_policy'
folder = 'some/folder'
actual = self.tile_bucket.createPolicy(statements, expName, fold... | code_fim | hard | {
"lang": "python",
"repo": "aplbrain/ndingest",
"path": "/test/test_tilebucket.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># kill the logger process of a channel
def remove_logger(channel):
global running_logger
if channel in running_logger:
print("killing logger for " + channel)
running_logger[channel].kill()
running_logger.pop(channel)
# spawn a twitch chat logger for a channel
def add_logge... | code_fim | hard | {
"lang": "python",
"repo": "gamedeff/Twitch_Batch_Logger",
"path": "/log_selected.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gamedeff/Twitch_Batch_Logger path: /log_selected.py
import os
import sys
import time
import json
import subprocess
from urllib.request import urlopen
from urllib.error import HTTPError
from copy import deepcopy
def channel_type_check(channel):
time.sleep(0.5)
url = "http://api.twitch.tv/... | code_fim | hard | {
"lang": "python",
"repo": "gamedeff/Twitch_Batch_Logger",
"path": "/log_selected.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: labd/commercetools-python-sdk path: /src/commercetools/testing/subscriptions.py
import datetime
import typing
import uuid
from commercetools.platform import models
from commercetools.platform.models._schemas.error import ErrorResponseSchema
from commercetools.platform.models._schemas.subscriptio... | code_fim | hard | {
"lang": "python",
"repo": "labd/commercetools-python-sdk",
"path": "/src/commercetools/testing/subscriptions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> obj = self._schema_draft().loads(request.body)
if isinstance(obj.destination, models.SqsDestination):
dest = obj.destination
message = (
"A test message could not be delivered to this destination: "
"SQS %r in %r for %r. "
... | code_fim | hard | {
"lang": "python",
"repo": "labd/commercetools-python-sdk",
"path": "/src/commercetools/testing/subscriptions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SStauden/adversarial-squad path: /matchlstm/txt2js.py
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import json
import string
from nltk.tokenize import word_tokenize
<|fim_suffix|>predictions = {}
for c in js["data"]:
for p in c["paragraphs"]:
context = p["context"]
context_word... | code_fim | medium | {
"lang": "python",
"repo": "SStauden/adversarial-squad",
"path": "/matchlstm/txt2js.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pred = fpr.readline().strip()
newpred = []
pre_word = ''
words = pred.split()
for word in words:
word = word.replace("``", "\"")
word = word.replace("''", "\"")
if pre_word != '' :
if newpred[-1]+word in context:
newpred[-1] = newpred[-1]+word
else:
newpred... | code_fim | medium | {
"lang": "python",
"repo": "SStauden/adversarial-squad",
"path": "/matchlstm/txt2js.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: criteo-forks/hue path: /desktop/core/ext-py/pysaml2-4.9.0/src/saml2/cryptography/pki.py
"""This module provides methods for PKI operations."""
<|fim_suffix|> """Load X.509 PEM certificate."""
return _x509.load_pem_x509_certificate(data, _backends.default_backend())<|fim_middle|>import cry... | code_fim | medium | {
"lang": "python",
"repo": "criteo-forks/hue",
"path": "/desktop/core/ext-py/pysaml2-4.9.0/src/saml2/cryptography/pki.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Load X.509 PEM certificate."""
return _x509.load_pem_x509_certificate(data, _backends.default_backend())<|fim_prefix|># repo: criteo-forks/hue path: /desktop/core/ext-py/pysaml2-4.9.0/src/saml2/cryptography/pki.py
"""This module provides methods for PKI operations."""
import cryptography.hazm... | code_fim | easy | {
"lang": "python",
"repo": "criteo-forks/hue",
"path": "/desktop/core/ext-py/pysaml2-4.9.0/src/saml2/cryptography/pki.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def load_pem_x509_certificate(data):
"""Load X.509 PEM certificate."""
return _x509.load_pem_x509_certificate(data, _backends.default_backend())<|fim_prefix|># repo: criteo-forks/hue path: /desktop/core/ext-py/pysaml2-4.9.0/src/saml2/cryptography/pki.py
"""This module provides methods for PKI op... | code_fim | medium | {
"lang": "python",
"repo": "criteo-forks/hue",
"path": "/desktop/core/ext-py/pysaml2-4.9.0/src/saml2/cryptography/pki.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stefanm-git/Data-Science path: /20-Machine-Learning-Supervised-Learning/logistic_regression_project.py
import codecademylib3_seaborn
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import ... | code_fim | hard | {
"lang": "python",
"repo": "stefanm-git/Data-Science",
"path": "/20-Machine-Learning-Supervised-Learning/logistic_regression_project.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Perform train, test, split
train_features, test_features, train_labels, test_labels = train_test_split(features, survived)
# Scale the feature data so it has mean = 0 and standard deviation = 1
scaler = StandardScaler()
train_features = scaler.fit_transform(train_features)
test_features = scaler.... | code_fim | hard | {
"lang": "python",
"repo": "stefanm-git/Data-Science",
"path": "/20-Machine-Learning-Supervised-Learning/logistic_regression_project.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Combine passenger arrays
sample_passengers = np.array([Jack, Rose, You])
# Scale the sample passenger features
sample_passengers = scaler.transform(sample_passengers)
# Make survival predictions!
print(model.predict(sample_passengers))
print(model.predict_proba(sample_passengers))<|fim_prefix|... | code_fim | hard | {
"lang": "python",
"repo": "stefanm-git/Data-Science",
"path": "/20-Machine-Learning-Supervised-Learning/logistic_regression_project.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlexPivnenko/python_lab2 path: /message_getter/message_getter/pipelines.py
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
from .items import ForumMessa... | code_fim | medium | {
"lang": "python",
"repo": "AlexPivnenko/python_lab2",
"path": "/message_getter/message_getter/pipelines.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(item, ForumTopicItem):
self.__db.save_topic(item.__dict__['_values'])
elif isinstance(item, ForumMessageItem):
self.__db.save_message(item.__dict__['_values'])
return item
def close_spider(self, spider):
self.__db.close()<|fim_pref... | code_fim | medium | {
"lang": "python",
"repo": "AlexPivnenko/python_lab2",
"path": "/message_getter/message_getter/pipelines.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def process_item(self, item, spider):
if isinstance(item, ForumTopicItem):
self.__db.save_topic(item.__dict__['_values'])
elif isinstance(item, ForumMessageItem):
self.__db.save_message(item.__dict__['_values'])
return item
def close_spider(self, sp... | code_fim | medium | {
"lang": "python",
"repo": "AlexPivnenko/python_lab2",
"path": "/message_getter/message_getter/pipelines.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: melfm/avod-ssd path: /avod/core/trainer_test.py
"""Tests for avod.core.trainer with a dummy Detection Model"""
import tensorflow as tf
import numpy as np
from tensorflow.contrib.layers.python.layers import layers
from tensorflow.python.framework import random_seed
from tensorflow.python.ops impo... | code_fim | hard | {
"lang": "python",
"repo": "melfm/avod-ssd",
"path": "/avod/core/trainer_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(16):
j = int(2 * labels[i] + np.random.randint(0, 2))
inputs[i, j] = 1
random_seed.set_random_seed(0)
tf_inputs = constant_op.constant(inputs, dtype=dtypes.float32)
tf_labels = constant_op.constant(labels, dtype=dtypes.float32)
... | code_fim | hard | {
"lang": "python",
"repo": "melfm/avod-ssd",
"path": "/avod/core/trainer_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ausecocloud/pyramid_oidc path: /setup.py
from setuptools import setup, find_packages
version = '0.2.0'
setup(
name='pyramid_oidc',
version=version,
description="Pyramid OIDC authentication",
long_description=(open("README.rst").read() + "\n\n" +
open("HISTO... | code_fim | hard | {
"lang": "python",
"repo": "ausecocloud/pyramid_oidc",
"path": "/setup.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'setuptools',
'pyramid',
'python-jose',
'oauthlib', # [rsa,signedtoken,signals]
'requests[security]', # [security,socks]
'requests-oauthlib', # [rsa]
'dogpile.cache'
],
extras_require={
'test': [
'pytest',
... | code_fim | hard | {
"lang": "python",
"repo": "ausecocloud/pyramid_oidc",
"path": "/setup.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.single_item == False:
self.queue.append(data)
self.timestamps.append(time_stamp)
elif self.single_item == True:
self.queue = [data]
self.timestamps = [time_stamp]
else:
self.l... | code_fim | hard | {
"lang": "python",
"repo": "createchaos/abb_communication",
"path": "/src/abb_communication/clients_withRN/rfl_robot/communication/messages/dataqueues.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: createchaos/abb_communication path: /src/abb_communication/clients_withRN/rfl_robot/communication/messages/dataqueues.py
'''
// /////////////////////////////////////
// Created on 06.09.2015
@author: DORF_RUST
// /////////////////////////////////////
'''
import time
from threading i... | code_fim | hard | {
"lang": "python",
"repo": "createchaos/abb_communication",
"path": "/src/abb_communication/clients_withRN/rfl_robot/communication/messages/dataqueues.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif len(self.queue) < self.maxsize:
" The queue is not empty, but is not yet full, put item on queue "
if self.single_item == False:
self.queue.append(data)
self.timestamps.append(time_stamp)
elif self.singl... | code_fim | hard | {
"lang": "python",
"repo": "createchaos/abb_communication",
"path": "/src/abb_communication/clients_withRN/rfl_robot/communication/messages/dataqueues.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: narcotis/Welbot-V2 path: /rest/views.py
pResponse('Course initialized!')
def culture_genre_init(request):
genre = ['클래식', '뮤지컬_오페라', '전시회', '연극', '콘서트', '국악', '무용', '전시_관람']
genre_bulk = []
for i, val in enumerate(genre):
data = Culture_genre(id = (i+1),
... | code_fim | hard | {
"lang": "python",
"repo": "narcotis/Welbot-V2",
"path": "/rest/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = None
try:
result = User.objects.get(id = user['id'])
result.lat = user['lat']
result.lon = user['lon']
result.temp = user['temp']
result.weather = user['weather']
except :
result = User(id = user['id'], lat=user['lat'], lon... | code_fim | hard | {
"lang": "python",
"repo": "narcotis/Welbot-V2",
"path": "/rest/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
for i, val in enumerate(df2.values):
data = Course_point(id = (i+1),
name = val[1],
course = Course.objects.get(name = val[0]),
desc= val[2])
point_bulk.append(data)
Course_point.objec... | code_fim | hard | {
"lang": "python",
"repo": "narcotis/Welbot-V2",
"path": "/rest/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('app', '0008_auto_20210331_2220'),
]
operations = [
migrations.CreateModel(
name='loginlogs',
fields=[
('slug', models.AutoField(primary_key=True, serialize=False)),
('slug_ref', autoslug.fields.AutoSlug... | code_fim | medium | {
"lang": "python",
"repo": "Vasilis-Moustis/Recycling-Business-Portofolio",
"path": "/UCycleAPI/app/migrations/0009_loginlogs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vasilis-Moustis/Recycling-Business-Portofolio path: /UCycleAPI/app/migrations/0009_loginlogs.py
# Generated by Django 3.1.7 on 2021-03-31 22:31
import autoslug.fields
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrat... | code_fim | medium | {
"lang": "python",
"repo": "Vasilis-Moustis/Recycling-Business-Portofolio",
"path": "/UCycleAPI/app/migrations/0009_loginlogs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> env = PepEnvironment( PepCppRenderer() )
builtins.add_builtins( env )
value = PepFunctionCall( PepSymbol( "print" ), (
PepPlus(
PepString( "known" ),
PepArrayLookup( PepSysArgv(), PepInt( "1" ) )
),
) )
assert_equal( value.render( env )... | code_fim | hard | {
"lang": "python",
"repo": "andybalaam/pepper",
"path": "/old/pepper1/src/test/testoperatorsunknown.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andybalaam/pepper path: /old/pepper1/src/test/testoperatorsunknown.py
# Copyright (C) 2011-2012 Andy Balaam and The Pepper Developers
# Released under the MIT License. See the file COPYING.txt for details.
from nose.tools import *
from libpepper import builtins
from libpepper.environment impo... | code_fim | medium | {
"lang": "python",
"repo": "andybalaam/pepper",
"path": "/old/pepper1/src/test/testoperatorsunknown.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haowen-xu/tfsnippet path: /tfsnippet/ops/convolution.py
import tensorflow as tf
from tfsnippet.utils import add_name_arg_doc
from .shape_utils import flatten_to_ndims, unflatten_from_ndims
__all__ = ['space_to_depth', 'depth_to_space']
@add_name_arg_doc
def space_to_depth(input, block_size, c... | code_fim | medium | {
"lang": "python",
"repo": "haowen-xu/tfsnippet",
"path": "/tfsnippet/ops/convolution.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Wraps :func:`tf.depth_to_space`, to support tensors higher than 4-d.
Args:
input: The input tensor, at least 4-d.
block_size (int): An int >= 2, the size of the spatial block.
channels_last (bool): Whether or not the channels axis
is the last axis in th... | code_fim | medium | {
"lang": "python",
"repo": "haowen-xu/tfsnippet",
"path": "/tfsnippet/ops/convolution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
tf.Tensor: The output tensor.
See Also:
:func:`tf.space_to_depth`
"""
block_size = int(block_size)
data_format = 'NHWC' if channels_last else 'NCHW'
input = tf.convert_to_tensor(input)
with tf.name_scope(name or 'space_to_depth', values=[input]):
... | code_fim | hard | {
"lang": "python",
"repo": "haowen-xu/tfsnippet",
"path": "/tfsnippet/ops/convolution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zekkontro/kodluyoruz-pomodoro-bot path: /bot.py
import discord
from discord.ext import commands
import os
import platform
from apscheduler.schedulers.asyncio import AsyncIOScheduler
import datetime
from utils import get_expire_time
from discord import FFmpegPCMAudio, PCMVolumeTransformer, ... | code_fim | hard | {
"lang": "python",
"repo": "zekkontro/kodluyoruz-pomodoro-bot",
"path": "/bot.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@todo.command(name='+', aliases=('add', 'a', 'ekle'))
@todo_cooldown
async def todo_add(ctx: Context, *, content: str):
if len(content) > TODO_MAX_LENGTH:
await ctx.send(f'İçerik çok uzun!!! İçeriğiniz şundan daha kısa olmalıdır: {TODO_MAX_LENGTH} ')
return
data_message = awa... | code_fim | hard | {
"lang": "python",
"repo": "zekkontro/kodluyoruz-pomodoro-bot",
"path": "/bot.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def cooldwon(self):
return self._cooldown
@classmethod
def from_cooldown(cls, rate, per, type):
return cls(SharedCooldown(rate, per, type))
def shared_cooldown(rate, per, type=BucketType.default):
cooldown = SharedCooldown(rate, per, type)
co... | code_fim | hard | {
"lang": "python",
"repo": "zekkontro/kodluyoruz-pomodoro-bot",
"path": "/bot.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vandorjw/django-traceability path: /traceability/views/item.py
from django.views import generic
from traceability.models.item import Item
from traceability.forms.item import ItemUpdate
<|fim_suffix|>
class ItemList(generic.ListView):
template_name = 'traceability/item/item_list.html'
mo... | code_fim | medium | {
"lang": "python",
"repo": "vandorjw/django-traceability",
"path": "/traceability/views/item.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> template_name = 'traceability/item/item_form.html'
model = Item
form_class = ItemUpdate<|fim_prefix|># repo: vandorjw/django-traceability path: /traceability/views/item.py
from django.views import generic
from traceability.models.item import Item
from traceability.forms.item import ItemUpdate... | code_fim | medium | {
"lang": "python",
"repo": "vandorjw/django-traceability",
"path": "/traceability/views/item.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MorningBanana/LeetCode-Notebook path: /source/All_Solutions/排序数组.py
# 给定一个整数数组 nums,将该数组升序排列。
#
#
#
# 示例 1:
#
# 输入:[5,2,3,1]
# 输出:[1,2,3,5]
# 示例 2:
#
# 输入:[5,1,1,2,0,0]
# 输出:[0,0,1,1,2,5]
class Solution:
def sortArray(self, nums: List[int]) -> List[int]:
<|fim_suffix|> de... | code_fim | medium | {
"lang": "python",
"repo": "MorningBanana/LeetCode-Notebook",
"path": "/source/All_Solutions/排序数组.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while left < right:
while left < right and nums[right] >= mid:
right -= 1
nums[left] = nums[right]
while left < right and nums[left] < mid:
left += 1
nums[right] = nums[left]
nums[left] = mid
se... | code_fim | hard | {
"lang": "python",
"repo": "MorningBanana/LeetCode-Notebook",
"path": "/source/All_Solutions/排序数组.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_circle():
circ = Circle(2)
assert circ.radius == 2.0
assert circ.diameter == 4.0<|fim_prefix|># repo: brittainhard/py path: /samples/getters_setters.py
class Circle(object):
"""You don't actually set the radius here, but you have to have an init
function that can handle radiu... | code_fim | hard | {
"lang": "python",
"repo": "brittainhard/py",
"path": "/samples/getters_setters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brittainhard/py path: /samples/getters_setters.py
class Circle(object):
"""You don't actually set the radius here, but you have to have an init
function that can handle radius. It might actually get set, but I'm not
sure."""
def __init__(self, radius):
self.radius = radiu... | code_fim | medium | {
"lang": "python",
"repo": "brittainhard/py",
"path": "/samples/getters_setters.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> circ = Circle(2)
assert circ.radius == 2.0
assert circ.diameter == 4.0<|fim_prefix|># repo: brittainhard/py path: /samples/getters_setters.py
class Circle(object):
"""You don't actually set the radius here, but you have to have an init
function that can handle radius. It might actuall... | code_fim | medium | {
"lang": "python",
"repo": "brittainhard/py",
"path": "/samples/getters_setters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>'0.1.0',
packages=find_packages(),
entry_points={'scrapy': ['settings = {{ cookiecutter.repo_name }}.settings']}, # noqa
)<|fim_prefix|># repo: arthuralvim/scrapy-project-template path: /{{ cookiecutter.repo_name }}/setup.py
# -*- coding: utf-8 -*-
from setuptools import setup, find_packa<|fim_... | code_fim | medium | {
"lang": "python",
"repo": "arthuralvim/scrapy-project-template",
"path": "/{{ cookiecutter.repo_name }}/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arthuralvim/scrapy-project-template path: /{{ cookiecutter.repo_name }}/setup.py
# -*- coding: utf-8 -*-
from setuptools import setup, find_packa<|fim_suffix|>: ['settings = {{ cookiecutter.repo_name }}.settings']}, # noqa
)<|fim_middle|>ges
setup(
name='{{ cookiecutter.repo_name }}',
... | code_fim | medium | {
"lang": "python",
"repo": "arthuralvim/scrapy-project-template",
"path": "/{{ cookiecutter.repo_name }}/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
**Updates the uplink settings for your MX network.**
https://api.meraki.com/api_docs#updates-the-uplink-settings-for-your-mx-network
- networkId (string)
- bandwidthLimits (object): A mapping of uplinks to their bandwidth settings (be sure to check whic... | code_fim | hard | {
"lang": "python",
"repo": "itbj/meraki-dashboard",
"path": "/meraki/api/uplink_settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: itbj/meraki-dashboard path: /meraki/api/uplink_settings.py
class UplinkSettings(object):
def __init__(self, session):
super(UplinkSettings, self).__init__()
self._session = session
def getNetworkUplinkSettings(self, networkId: str):
"""
**Returns the u... | code_fim | hard | {
"lang": "python",
"repo": "itbj/meraki-dashboard",
"path": "/meraki/api/uplink_settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: microsoft/onnxruntime-openenclave path: /onnxruntime/__init__.py
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# ------------------------------------------------------------... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/onnxruntime-openenclave",
"path": "/onnxruntime/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> \
ExecutionMode, OrtDevice, SessionIOBinding
from onnxruntime.capi.session import InferenceSession, IOBinding
from onnxruntime.capi import onnxruntime_validation
from onnxruntime.capi.training import * # noqa: F403
onnxruntime_validation.check_distro_info()<|fim_prefix|># repo: microsoft/onnxrunti... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/onnxruntime-openenclave",
"path": "/onnxruntime/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> redControl(ON)
greenControl(OFF)
# Turn on the green led and turn off the red led. Used when the current occupants has not yet reached the capacity
def belowLimit():
redControl(OFF)
greenControl(ON)<|fim_prefix|># repo: rodrigo3500/SYSC_3010_L3_T_4 path: /endNodes/ledControl.py
# Author:... | code_fim | hard | {
"lang": "python",
"repo": "rodrigo3500/SYSC_3010_L3_T_4",
"path": "/endNodes/ledControl.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Turn on the red led and turn off green led. Used when current occupants has exceed the capacity
def aboveLimit():
redControl(ON)
greenControl(OFF)
# Turn on the green led and turn off the red led. Used when the current occupants has not yet reached the capacity
def belowLimit():
redControl(... | code_fim | hard | {
"lang": "python",
"repo": "rodrigo3500/SYSC_3010_L3_T_4",
"path": "/endNodes/ledControl.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rodrigo3500/SYSC_3010_L3_T_4 path: /endNodes/ledControl.py
# Author: Hari
# Controls the red and green led indicators
from gpiozero import LED
import RPi.GPIO as GPIO
from time import sleep
# Constants
ON = 1 # GPIO output 1 = on
OFF = 0 # GPIO output 0 = off
red = 25 # GPIO board pin for red LE... | code_fim | medium | {
"lang": "python",
"repo": "rodrigo3500/SYSC_3010_L3_T_4",
"path": "/endNodes/ledControl.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def value(self) -> str: ...
_valueOf_0__T = typing.TypeVar('_valueOf_0__T', bound=java.lang.Enum) # <T>
@typing.overload
@staticmethod
def valueOf(class_: typing.Type[_valueOf_0__T], string: str) -> _valueOf_0__T: ...
@typing.overload
@staticmethod
... | code_fim | hard | {
"lang": "python",
"repo": "gpassero/cogroo4py",
"path": "/python/org-stubs/cogroo/tools/checker/rules/model/__init__.pyi",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gpassero/cogroo4py path: /python/org-stubs/cogroo/tools/checker/rules/model/__init__.pyi
osition(java.io.Serializable):
def __init__(self): ...
def getAnd(self) -> 'Operator': ...
def getOr(self) -> 'Operator': ...
def setAnd(self, operator: 'Operator') -> None: ...
def setOr(... | code_fim | hard | {
"lang": "python",
"repo": "gpassero/cogroo4py",
"path": "/python/org-stubs/cogroo/tools/checker/rules/model/__init__.pyi",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gpassero/cogroo4py path: /python/org-stubs/cogroo/tools/checker/rules/model/__init__.pyi
f, xMLGregorianCalendar: javax.xml.datatype.XMLGregorianCalendar) -> None: ...
class ObjectFactory:
def __init__(self): ...
def createBoundaries(self) -> Boundaries: ...
def createComposition(sel... | code_fim | hard | {
"lang": "python",
"repo": "gpassero/cogroo4py",
"path": "/python/org-stubs/cogroo/tools/checker/rules/model/__init__.pyi",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BYU-PCCL/vae-rl path: /Rainbow/vlae/trainer.py
from vlae.visualize import *
import time
from glob import glob
from vlae.dataset.dataset_atari import AtariDataset
# Added in numpy.
import numpy as np
class NoisyTrainer:
def __init__(self, network, dataset, args):
self.network = netwo... | code_fim | hard | {
"lang": "python",
"repo": "BYU-PCCL/vae-rl",
"path": "/Rainbow/vlae/trainer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def plot_reconstruction(self, epoch, test_image, noisy_image, reconstruction, num_plot=3):
if test_image.shape[-1] == 1:
canvas = np.zeros((num_plot*self.data_dims[0], 3*self.data_dims[1] + 20, self.data_dims[2]))
else:
canvas = np.ones((num_plot*self.data_dims[... | code_fim | hard | {
"lang": "python",
"repo": "BYU-PCCL/vae-rl",
"path": "/Rainbow/vlae/trainer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> from Views.AdminPage import AdminPage
self._master.switch_frame(AdminPage, AdminPageModel)
def DeleteCopy(self, copyId):
self._model.DeleteCopy(copyId)<|fim_prefix|># repo: GreatHorizon/library path: /Controllers/DeleteCopyController.py
from Models.AdminPageModel import Admin... | code_fim | medium | {
"lang": "python",
"repo": "GreatHorizon/library",
"path": "/Controllers/DeleteCopyController.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GreatHorizon/library path: /Controllers/DeleteCopyController.py
from Models.AdminPageModel import AdminPageModel
<|fim_suffix|> def __init__(self, master, model, view):
self._master = master
self._model = model
self._view = view
def BackToAdminPage(self):
... | code_fim | easy | {
"lang": "python",
"repo": "GreatHorizon/library",
"path": "/Controllers/DeleteCopyController.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lay_atl as atl,
display_bc as bc,
display_dev as dev,
display_info as info,
display_market as market,
display_score as score,
display_social as social,
display_web as web,
)
from .santiment_view import display_github_activity as gh
from .tokenterminal_view import (
display_... | code_fim | hard | {
"lang": "python",
"repo": "conrad-strughold/GamestonkTerminal",
"path": "/openbb_terminal/cryptocurrency/due_diligence/due_diligence_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: conrad-strughold/GamestonkTerminal path: /openbb_terminal/cryptocurrency/due_diligence/due_diligence_api.py
"""Due Diligence API."""
import os
from openbb_terminal.helper_classes import ModelsNamespace as _models
# flake8: noqa
# pylint: disable=unused-import
from .binance_view import display_... | code_fim | hard | {
"lang": "python",
"repo": "conrad-strughold/GamestonkTerminal",
"path": "/openbb_terminal/cryptocurrency/due_diligence/due_diligence_api.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>,
)
from .messari_view import (
display_fundraising as fr,
display_governance as gov,
display_investors as inv,
display_links as links,
display_marketcap_dominance as mcapdom,
display_messari_timeseries as mt,
display_messari_timeseries_list as get_mt,
display_project_info ... | code_fim | hard | {
"lang": "python",
"repo": "conrad-strughold/GamestonkTerminal",
"path": "/openbb_terminal/cryptocurrency/due_diligence/due_diligence_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eeue56/music-of-the-machines path: /instruments.py
from __future__ import division
from random import randint
class Instrument(object):
def __init__(self, data_length, volume_max):
self.data_length = data_length
self.volume_max = volume_max
self.fifth = self.... | code_fim | hard | {
"lang": "python",
"repo": "eeue56/music-of-the-machines",
"path": "/instruments.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> tenth = self.tenth
volume_increase = self.volume_increase
if current_i <= tenth:
return current_volume + volume_increase
elif current_i <= tenth * 2:
return current_volume - (volume_increase / 10)
elif current_i >= tenth * 9:
... | code_fim | hard | {
"lang": "python",
"repo": "eeue56/music-of-the-machines",
"path": "/instruments.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: esabitova/aws-digito-artifacts-gameday path: /resource_manager/src/util/sts_utils.py
import uuid
import botocore
from boto3 import Session
from .boto3_client_factory import client
<|fim_suffix|> """
Assume role
:param role_arn: ARN to other role for assuming
:param session: Base b... | code_fim | medium | {
"lang": "python",
"repo": "esabitova/aws-digito-artifacts-gameday",
"path": "/resource_manager/src/util/sts_utils.py",
"mode": "psm",
"license": "MIT-0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Assume role
:param role_arn: ARN to other role for assuming
:param session: Base boto3 session
:return: new assumed role
"""
sts_client = client('sts', session)
assume_role_response = sts_client.assume_role(RoleArn=role_arn, RoleSessionName=str(uuid.uuid4()))
creden... | code_fim | medium | {
"lang": "python",
"repo": "esabitova/aws-digito-artifacts-gameday",
"path": "/resource_manager/src/util/sts_utils.py",
"mode": "spm",
"license": "MIT-0",
"source": "the-stack-v2"
} |
<|fim_suffix|> botocore_session = botocore.session.Session()
botocore_session._credentials = botocore.credentials.Credentials(access_key, secret_key, token)
return Session(botocore_session=botocore_session)<|fim_prefix|># repo: esabitova/aws-digito-artifacts-gameday path: /resource_manager/src/util/sts_util... | code_fim | hard | {
"lang": "python",
"repo": "esabitova/aws-digito-artifacts-gameday",
"path": "/resource_manager/src/util/sts_utils.py",
"mode": "spm",
"license": "MIT-0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MasayoshiI/ride_ready path: /ride_ready_app/main.py
from flask import Flask, render_template, request, jsonify
import requests, sys, json
# sys.path.insert(0, os.getcwd()+"/uberAPI")
# import uberAPI.uber_request as ur
# sys.path.append("/test_flask/")
import uberapi.uber_request as ur
app = Flas... | code_fim | hard | {
"lang": "python",
"repo": "MasayoshiI/ride_ready",
"path": "/ride_ready_app/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Initiate returning data
return_data = {}
# iterate to find uber rates here
for rate in ride_rates:
# add pool, x, xl in json
if rate["display_name"] in ("UberPool", "UberX", "UberXL"):
return_data[rate["display_name"]] = rate["display_name"] + ":\t" +str(rat... | code_fim | hard | {
"lang": "python",
"repo": "MasayoshiI/ride_ready",
"path": "/ride_ready_app/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Create rede request class here
ride_request = ur.UberRequest(budget,start_lat,start_long,dest_lat,dest_long,seat_count)
ride_rates = ride_request.get_estimate_price()
# Initiate returning data
return_data = {}
# iterate to find uber rates here
for rate in ride_rates:
... | code_fim | hard | {
"lang": "python",
"repo": "MasayoshiI/ride_ready",
"path": "/ride_ready_app/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>month_patterns = [
re_path(r'^(?P<year>\d{4})/(?P<month>\d{2})/$',
EntryMonth.as_view(),
name='entry_archive_month'),
re_path(_(r'^(?P<year>\d{4})/(?P<month>\d{2})/page/(?P<page>\d+)/$'),
EntryMonth.as_view(),
name='entry_archive_month_paginated'),
]
day_patterns =... | code_fim | hard | {
"lang": "python",
"repo": "jplehmann/django-blog-zinnia",
"path": "/zinnia/urls/archives.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>day_patterns = [
re_path(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$',
EntryDay.as_view(),
name='entry_archive_day'),
re_path(_(r'^(?P<year>\d{4})/(?P<month>\d{2})/'
r'(?P<day>\d{2})/page/(?P<page>\d+)/$'),
EntryDay.as_view(),
name='entry_archive_... | code_fim | hard | {
"lang": "python",
"repo": "jplehmann/django-blog-zinnia",
"path": "/zinnia/urls/archives.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jplehmann/django-blog-zinnia path: /zinnia/urls/archives.py
"""Urls for the Zinnia archives"""
from django.urls import path, re_path
from zinnia.urls import _
from zinnia.views.archives import EntryDay
from zinnia.views.archives import EntryIndex
from zinnia.views.archives import EntryMonth
from... | code_fim | hard | {
"lang": "python",
"repo": "jplehmann/django-blog-zinnia",
"path": "/zinnia/urls/archives.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: google/mediapipe path: /mediapipe/tasks/python/components/containers/detections.py
# Copyright 2022 The MediaPipe Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License ... | code_fim | hard | {
"lang": "python",
"repo": "google/mediapipe",
"path": "/mediapipe/tasks/python/components/containers/detections.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.to_pb2().__eq__(other.to_pb2())
@dataclasses.dataclass
class DetectionResult:
"""Represents the list of detected objects.
Attributes:
detections: A list of `Detection` objects.
"""
detections: List[Detection]
@doc_controls.do_not_generate_docs
def to_pb2(self) -> _Dete... | code_fim | hard | {
"lang": "python",
"repo": "google/mediapipe",
"path": "/mediapipe/tasks/python/components/containers/detections.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def read_sprite_info(rom, column_count_offset, sprite_data_offset):
"""Reads sprite offsets and column counts from the rom.
Wolf3D-style, complex...
"""
rom.seek(column_count_offset)
sprites = []
while True:
sprite_info = {
'column_count': rom.read_ushort(),
... | code_fim | hard | {
"lang": "python",
"repo": "defcon201/snes-wolf3d-extractor",
"path": "/extractor/roms/wolfenstein_3d.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: defcon201/snes-wolf3d-extractor path: /extractor/roms/wolfenstein_3d.py
import struct
from ..entrytype import *
from ..utils import insert_string
# These must be modified by rom info files using this one as their base.
def init(rom, **kwargs):
# Using USA rom values as default.
start... | code_fim | hard | {
"lang": "python",
"repo": "defcon201/snes-wolf3d-extractor",
"path": "/extractor/roms/wolfenstein_3d.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def parse_syscall(self, abi, decl, children):
if len(decl) != 2:
raise Exception('Invalid declaration: {}'.format(' '.join(decl)))
name = decl[1]
if name in abi.syscalls:
raise Exception('Duplicate syscall name: {}'.format(name))
input = Struct... | code_fim | hard | {
"lang": "python",
"repo": "sailfishos-mirror/rust-cloudabi",
"path": "/generator/parser.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sailfishos-mirror/rust-cloudabi path: /generator/parser.py
# Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors.
#
# SPDX-License-Identifier: BSD-2-Clause
from .itf import read_itf, Node
from .abi import *
class AbiParser:
def parse_abi_file(self, file_name):
return self.p... | code_fim | hard | {
"lang": "python",
"repo": "sailfishos-mirror/rust-cloudabi",
"path": "/generator/parser.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def parse_variant(self, abi, tag_member, children):
tag_type = tag_member.type
members = []
for node in children:
tag_value_names = node.text.split()
tag_values = []
for vname in tag_value_names:
val = [v for v in tag_type.va... | code_fim | hard | {
"lang": "python",
"repo": "sailfishos-mirror/rust-cloudabi",
"path": "/generator/parser.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>agentDcbxGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 58, 1))
agentDcbxTable = MibTable((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 58, 1, 1), )
if mibBuilder.loadTexts: agentDcbxTable.setStatus('current')
agentDcbxEntry = MibTableRow((1, 3, 6, 1, 4, 1, 674, 10895, 500... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp/DNOS-DCBX-MIB.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/DNOS-DCBX-MIB.py
#
# PySNMP MIB module DNOS-DCBX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DNOS-DCBX-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:36:31 2019
# On host DAVWANG4-M-1475 platform Dar... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp/DNOS-DCBX-MIB.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bgeng777/flink-ai-extended path: /flink-ai-flow/bin/start_aiflow.py
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright own... | code_fim | hard | {
"lang": "python",
"repo": "bgeng777/flink-ai-extended",
"path": "/flink-ai-flow/bin/start_aiflow.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _prepare_args():
parser = argparse.ArgumentParser()
parser.add_argument('--database-conn', type=str, default=None,
help='Database connection info')
parser.add_argument('--airflow-deploy-path', type=str, default=None,
help='The directory whic... | code_fim | hard | {
"lang": "python",
"repo": "bgeng777/flink-ai-extended",
"path": "/flink-ai-flow/bin/start_aiflow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JasperGeurtz/aoc-2020 path: /d03.py
import utils
m = utils.opener.lines("input/03.txt")
x, y, t = 0, 0, 0
while y < len(m):
if m[y][x] == "#":
t += 1
x = (x + 3) % len(m[0])
y += 1
<|fim_suffix|>c = [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]
t = [0 for _ in range(len(c))]
for... | code_fim | easy | {
"lang": "python",
"repo": "JasperGeurtz/aoc-2020",
"path": "/d03.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>c = [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]
t = [0 for _ in range(len(c))]
for i, (xi, yi) in enumerate(c):
x, y = 0, 0
while y < len(m):
if m[y][x] == "#":
t[i] += 1
x = (x + xi) % len(m[0])
y += yi
print("2:", utils.multiply(t))<|fim_prefix|># repo: JasperGe... | code_fim | easy | {
"lang": "python",
"repo": "JasperGeurtz/aoc-2020",
"path": "/d03.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ishma59/Plusfinance path: /micro_admin/migrations/0019_auto_20160915_0759.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-09-15 07:59
from __future__ import unicode_literals
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
('micro_admin', '001... | code_fim | medium | {
"lang": "python",
"repo": "Ishma59/Plusfinance",
"path": "/micro_admin/migrations/0019_auto_20160915_0759.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('micro_admin', '0018_loanrepaymentevery'),
]
operations = [
migrations.RemoveField(
model_name='menu',
name='parent',
),
migrations.DeleteModel(
name='Page',
),
migrations.AlterModelOptions(
... | code_fim | medium | {
"lang": "python",
"repo": "Ishma59/Plusfinance",
"path": "/micro_admin/migrations/0019_auto_20160915_0759.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mpbagot/mata path: /mods/default/client/gui/messages.py
from api.gui.gui import *
from api.gui.objects import *
from mods.default.client.gui.extras import *
class MessageScreen(Gui):
def __init__(self, message):
super().__init__()
self.message = message
self.backImg =... | code_fim | hard | {
"lang": "python",
"repo": "mpbagot/mata",
"path": "/mods/default/client/gui/messages.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__(message)
self.buttons = [MenuButton([300, 500, 424, 80])]
class LoadingScreen(MessageScreen):
def __init__(self):
super().__init__('Loading...')<|fim_prefix|># repo: mpbagot/mata path: /mods/default/client/gui/messages.py
from api.gui.gui import *
from api.g... | code_fim | hard | {
"lang": "python",
"repo": "mpbagot/mata",
"path": "/mods/default/client/gui/messages.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.