text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: ilebedev/py_web_gui path: /make_assignment.py
#!/usr/bin/env python2.7
import os, sys, shutil, json
from subprocess import call
from distutils.dir_util import copy_tree
def replace_with_file(src_file, token, replacement_file):
with open(src_file, "r+") as sf, open(replacement_file, "r") as rf:... | code_fim | hard | {
"lang": "python",
"repo": "ilebedev/py_web_gui",
"path": "/make_assignment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = models.Screen
fields = ['id', 'name', 'image', 'border']<|fim_prefix|># repo: fcurella/inky-renderer path: /inventory/serializers.py
from rest_framework import serializers
from . import models
<|fim_middle|>class ScreenSerializer(serializers.ModelSerializer):
class Meta:
| code_fim | medium | {
"lang": "python",
"repo": "fcurella/inky-renderer",
"path": "/inventory/serializers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fcurella/inky-renderer path: /inventory/serializers.py
from rest_framework import serializers
from . import models
<|fim_suffix|> model = models.Screen
fields = ['id', 'name', 'image', 'border']<|fim_middle|>
class ScreenSerializer(serializers.ModelSerializer):
class Meta:
| code_fim | medium | {
"lang": "python",
"repo": "fcurella/inky-renderer",
"path": "/inventory/serializers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
model = models.Screen
fields = ['id', 'name', 'image', 'border']<|fim_prefix|># repo: fcurella/inky-renderer path: /inventory/serializers.py
from rest_framework import serializers
from . import models
<|fim_middle|>
class ScreenSerializer(serializers.ModelSerializer):
| code_fim | easy | {
"lang": "python",
"repo": "fcurella/inky-renderer",
"path": "/inventory/serializers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.callback(
Output('dashboard-content', 'children'),
[
Input('url', 'href'),
],
)
def display_page(href):
try:
return serve_layout()
except Exception:
print('Something went wrong!')
print('----------')
traceback.print_exc()
return '404... | code_fim | medium | {
"lang": "python",
"repo": "justin13601/AnnoDash",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: justin13601/AnnoDash path: /main.py
import traceback
from dash import Dash, html, dcc, dash_table, ALL, ctx
from dash.dependencies import State, Input, Output, ClientsideFunction
from src.app.app import app
from src.app.layouts import serve_layout
import src.app.callbacks
<|fim_suffix|> try:... | code_fim | hard | {
"lang": "python",
"repo": "justin13601/AnnoDash",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# run main.py
if __name__ == "__main__":
app.run_server(debug=False, host="0.0.0.0", port=8080, use_reloader=False)<|fim_prefix|># repo: justin13601/AnnoDash path: /main.py
import traceback
from dash import Dash, html, dcc, dash_table, ALL, ctx
from dash.dependencies import State, Input, Output, Cl... | code_fim | hard | {
"lang": "python",
"repo": "justin13601/AnnoDash",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _get_status(self):
status = {"connected": None, "percentage": None}
ifilter = IntentFilter(Intent.ACTION_BATTERY_CHANGED)
batteryStatus = cast('android.content.Intent',
activity.registerReceiver(None, ifilter))
query = batteryStatus.getIntExtra(Batter... | code_fim | medium | {
"lang": "python",
"repo": "brousch/pyohio-kivy-2014",
"path": "/plyer/platforms/android/battery.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ifilter = IntentFilter(Intent.ACTION_BATTERY_CHANGED)
batteryStatus = cast('android.content.Intent',
activity.registerReceiver(None, ifilter))
query = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1)
isCharging = (query == BatteryManager.BATTERY_STAT... | code_fim | hard | {
"lang": "python",
"repo": "brousch/pyohio-kivy-2014",
"path": "/plyer/platforms/android/battery.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brousch/pyohio-kivy-2014 path: /plyer/platforms/android/battery.py
from jnius import autoclass, cast
from plyer.platforms.android import activity
from plyer.facades import Battery
Intent = autoclass('android.content.Intent')
BatteryManager = autoclass('android.os.BatteryManager')
IntentFilter = ... | code_fim | medium | {
"lang": "python",
"repo": "brousch/pyohio-kivy-2014",
"path": "/plyer/platforms/android/battery.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cctbx/cctbx_project path: /mmtbx/regression/tst_dynamics_cli.py
from __future__ import absolute_import, division, print_function
from libtbx.utils import null_out
from six.moves import cStringIO as StringIO
def exercise_dynamics_command():
pdb_in = """\
CRYST1 21.348 25.003 18.365 90.0... | code_fim | hard | {
"lang": "python",
"repo": "cctbx/cctbx_project",
"path": "/mmtbx/regression/tst_dynamics_cli.py",
"mode": "psm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_suffix|> 6.522 18.108 5.030 1.00 0.00
ATOM 53 C ASN A 11 5.662 19.170 5.672 1.00 0.00
ATOM 54 O ASN A 11 5.000 19.964 5.005 1.00 0.00
ATOM 55 CB ASN A 11 5.780 16.740 5.000 1.00 0.00
TER
END
"""
open("tst_geo_min_ss_phil.pdb", "w").write(pdb_in)
... | code_fim | hard | {
"lang": "python",
"repo": "cctbx/cctbx_project",
"path": "/mmtbx/regression/tst_dynamics_cli.py",
"mode": "spm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: julianbetz/DLAS_speech_tokenizer path: /src/utils.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Benjamin Milde
"""
license = '''
Copyright 2017,2018 Benjamin Milde (Language Technology, Universität Hamburg, Germany)
Licensed under the Apache License, Version 2.0 (the "License"... | code_fim | hard | {
"lang": "python",
"repo": "julianbetz/DLAS_speech_tokenizer",
"path": "/src/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def getSignalOld(utterance):
spf = wave.open(utterance, 'r')
sound_info = spf.readframes(-1)
signal = np.fromstring(sound_info, 'Int16')
return signal, spf.getframerate()
# This is needed since the old loader had problems with NIST headers from TIMIT.
# See also https://stackoverflow.com... | code_fim | hard | {
"lang": "python",
"repo": "julianbetz/DLAS_speech_tokenizer",
"path": "/src/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def rolling_window(a, window_len, hop):
print("a.shape[:-1]", a.shape[:-1])
print("a.shape[-1]", a.shape[-1])
shape = a.shape[:-1] + (a.shape[-1] - window_len + 1, window_len)
strides = a.strides + (a.strides[-1],)
print('shape:',shape)
print('strides:',strides)
return np.lib.s... | code_fim | hard | {
"lang": "python",
"repo": "julianbetz/DLAS_speech_tokenizer",
"path": "/src/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> u'type': u'array'}},
u'type': u'object'},
u'transport': {u'description': u'Transport type used by the Sender in URN format',
u'enum': [u'urn:x-nmos:transport:rtp',
... | code_fim | hard | {
"lang": "python",
"repo": "bbc/nmos-registration",
"path": "/nmosregistration/v1_0/schema.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bbc/nmos-registration path: /nmosregistration/v1_0/schema.py
]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$',
u'type': u'string'},
u'type': u'array'},
u'senders': {u... | code_fim | hard | {
"lang": "python",
"repo": "bbc/nmos-registration",
"path": "/nmosregistration/v1_0/schema.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bbc/nmos-registration path: /nmosregistration/v1_0/schema.py
u'items': {u'pattern': u'^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$',
u'type': u'string'},
u'type': u'arra... | code_fim | hard | {
"lang": "python",
"repo": "bbc/nmos-registration",
"path": "/nmosregistration/v1_0/schema.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def validate_arguments(self):
self.set_query_type_from_query(self.query)
printt("Validating arguments: {} - {} - {}".format(self.ontology, self.query, self.query_type))
log.info("Validating arguments: {} - {} - {}".format(self.ontology, self.query, self.query_type))
sel... | code_fim | hard | {
"lang": "python",
"repo": "onesaitplatform/onesait-cloud-platform-clientlibraries",
"path": "/orange3-client/orange3-onesaitplatform/orangecontrib/onesaitplatform/widgets/ospquery.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.connection is None:
self._valid_arguments = False
incorrects.append("connection")
if len(incorrects) > 0:
self.Error.custom("Incorrect arguments: {}".format(", ".join(incorrects)))
log.error("Incorrect arguments: {}".format(", ".join... | code_fim | hard | {
"lang": "python",
"repo": "onesaitplatform/onesait-cloud-platform-clientlibraries",
"path": "/orange3-client/orange3-onesaitplatform/orangecontrib/onesaitplatform/widgets/ospquery.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: onesaitplatform/onesait-cloud-platform-clientlibraries path: /orange3-client/orange3-onesaitplatform/orangecontrib/onesaitplatform/widgets/ospquery.py
import time
import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.widget import OWWidget, ... | code_fim | hard | {
"lang": "python",
"repo": "onesaitplatform/onesait-cloud-platform-clientlibraries",
"path": "/orange3-client/orange3-onesaitplatform/orangecontrib/onesaitplatform/widgets/ospquery.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.__pullDelay > 0:
time.sleep(self.__pullDelay)
logger.info('get quote of {0}'.format(self.__instrument))
tmp = quote(self.__instrument)
if tmp is None:
logger.error('failed to get {0} quote'.format(self.__instrument))
return
... | code_fim | hard | {
"lang": "python",
"repo": "cryptonai/pyalgotrade",
"path": "/pyalgotrade/barfeed/livefeed.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cryptonai/pyalgotrade path: /pyalgotrade/barfeed/livefeed.py
from pyalgotrade import bar
from pyalgotrade.dataseries import bards
from pyalgotrade import feed
from pyalgotrade import dispatchprio
from pyalgotrade.barfeed import BaseBarFeed, MultiFrequencyBarFeed
from pyalgotrade.livefeedbackend i... | code_fim | hard | {
"lang": "python",
"repo": "cryptonai/pyalgotrade",
"path": "/pyalgotrade/barfeed/livefeed.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not self.__data_downloaded:
logger.info('featch history of {0}'.format(self.__instrument))
for i in self.getFrequencies():
tmp = None
if i == Frequency.DAY:
tmp = history(self.__instrument, self.__start_date, None,
... | code_fim | hard | {
"lang": "python",
"repo": "cryptonai/pyalgotrade",
"path": "/pyalgotrade/barfeed/livefeed.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sdcubber/kaggle_planet path: /src/planet.py
# coding: utf-8
# -------imports---------- #
import os
import sys
import time
import argparse
import json
import pandas as pd
import numpy as np
from keras.models import Model
from keras.optimizers import Adam
from keras.callbacks import EarlyStopping... | code_fim | hard | {
"lang": "python",
"repo": "sdcubber/kaggle_planet",
"path": "/src/planet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser = argparse.ArgumentParser(description='Neural network to gain money')
parser.add_argument('name', type=str, help="name of your model")
parser.add_argument('epochs', type=int, help="function to execute")
parser.add_argument('size', type=int, choices=(32,64,96,128), help='image size used for trai... | code_fim | hard | {
"lang": "python",
"repo": "sdcubber/kaggle_planet",
"path": "/src/planet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# ---------Load best model-------------#
logger.log_event("Load model: {}_{}.h5...".format(logger.ts, name))
model.load_weights('../models/{}_{}.h5'.format(logger.ts, name))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
# ---------Making predictions-----------#
... | code_fim | hard | {
"lang": "python",
"repo": "sdcubber/kaggle_planet",
"path": "/src/planet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
from RecoBTag.SoftLepton.SoftLeptonByIP3d_cff import *
from RecoBTag.SoftLepton.SoftLeptonByIP2d_cff import *<|fim_prefix|># repo: simonecid/cmssw path: /RecoBTag/SoftLepton/python/softLepton_cff.py
import FWCore.ParameterSet.Config as cms
from RecoBTag.SoftLepton.softLepton_EventSetup_cff import *
fr... | code_fim | hard | {
"lang": "python",
"repo": "simonecid/cmssw",
"path": "/RecoBTag/SoftLepton/python/softLepton_cff.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simonecid/cmssw path: /RecoBTag/SoftLepton/python/softLepton_cff.py
import FWCore.ParameterSet.Config as cms
from RecoBTag.SoftLepton.softLepton_EventSetup_cff import *
from RecoBTag.SoftLepton.softPFElectronTagInfos_cfi import *
from RecoBTag.SoftLepton.softPFMuonTagInfos_cfi import<|fim_suffi... | code_fim | medium | {
"lang": "python",
"repo": "simonecid/cmssw",
"path": "/RecoBTag/SoftLepton/python/softLepton_cff.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akshay-sridhar/demystifying path: /demystifying/feature_extraction/rbm_feature_extractor.py
import logging
import sys
logging.basicConfig(
stream=sys.stdout,
level=logging.INFO,
format='%(asctime)s %(name)s-%(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
import numpy as... | code_fim | hard | {
"lang": "python",
"repo": "akshay-sridhar/demystifying",
"path": "/demystifying/feature_extraction/rbm_feature_extractor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = np.zeros((nfeatures, nclusters))
frames_per_cluster = np.zeros((nclusters))
for frame_idx, frame in enumerate(labels):
cluster_idx = labels[frame_idx].argmax()
frames_per_cluster[cluster_idx] += 1
for frame_idx, rel... | code_fim | hard | {
"lang": "python",
"repo": "akshay-sridhar/demystifying",
"path": "/demystifying/feature_extraction/rbm_feature_extractor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(relevance.shape[0]):
ind_negative = np.where(relevance[i, :] < 0)[0]
relevance[i, ind_negative] = 0
relevance[i, :] = (relevance[i, :] - np.min(relevance[i, :])) / (
np.max(relevance[i, :]) - np.min(relevanc... | code_fim | hard | {
"lang": "python",
"repo": "akshay-sridhar/demystifying",
"path": "/demystifying/feature_extraction/rbm_feature_extractor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stbraun/fuzzing path: /gp_decorators/__init__.py
# coding=utf-8
"""Decorators.
Copyright 2014, Stefan Braun
Licensed under MIT.
"""
<|fim_suffix|># Symbols available when importing with *.
__all__ = ['singleton']
# Configure NullHandler to prevent warning in case logging is not configured.
# S... | code_fim | easy | {
"lang": "python",
"repo": "stbraun/fuzzing",
"path": "/gp_decorators/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Configure NullHandler to prevent warning in case logging is not configured.
# See https://docs.python.org/2/howto/logging.html#library-config
logging.getLogger('gp_decorators').addHandler(logging.NullHandler())<|fim_prefix|># repo: stbraun/fuzzing path: /gp_decorators/__init__.py
# coding=utf-8
"""Deco... | code_fim | medium | {
"lang": "python",
"repo": "stbraun/fuzzing",
"path": "/gp_decorators/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>se:
name_set.add(si+'.'+ti)
print('No')<|fim_prefix|># repo: taro-masuda/AtCoder path: /ABC/B/0216.py
name_set = set()
n = int(input())
for _ in r<|fim_middle|>ange(n):
si, ti = input().split()
if si+'.'+ti in name_set:
print('Yes')
exit()
el | code_fim | medium | {
"lang": "python",
"repo": "taro-masuda/AtCoder",
"path": "/ABC/B/0216.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ti in name_set:
print('Yes')
exit()
else:
name_set.add(si+'.'+ti)
print('No')<|fim_prefix|># repo: taro-masuda/AtCoder path: /ABC/B/0216.py
name_set = set()
n = int(input())
for _ in r<|fim_middle|>ange(n):
si, ti = input().split()
if si+'.'+ | code_fim | easy | {
"lang": "python",
"repo": "taro-masuda/AtCoder",
"path": "/ABC/B/0216.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: taro-masuda/AtCoder path: /ABC/B/0216.py
name_set = set()
n = int(input())
for _ in r<|fim_suffix|>ti in name_set:
print('Yes')
exit()
else:
name_set.add(si+'.'+ti)
print('No')<|fim_middle|>ange(n):
si, ti = input().split()
if si+'.'+ | code_fim | easy | {
"lang": "python",
"repo": "taro-masuda/AtCoder",
"path": "/ABC/B/0216.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
what do you think, what main should do
"""
yesterday_datestring = (datetime.date.today() - datetime.timedelta(1)).isoformat()
parser = argparse.ArgumentParser(description='generate TimeseriesArrays on local backend')
parser.add_argument('--url', default="https://datalogger-api.... | code_fim | hard | {
"lang": "python",
"repo": "gunny26/datalogger",
"path": "/getters/haproxy_haproxylogs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def datewalk(datestring1, datestring2):
"""
count up from datestring1 to datestring2 in single day steps
yield in isoformat()
"""
date1 = datestring_to_date(datestring1)
date2 = datestring_to_date(datestring2)
assert date2 > date1
oneday = datetime.timedelta(1)
while da... | code_fim | hard | {
"lang": "python",
"repo": "gunny26/datalogger",
"path": "/getters/haproxy_haproxylogs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gunny26/datalogger path: /getters/haproxy_haproxylogs.py
#!/usr/bin/python
"""
Program to read and parse haproxylogs to put them in shape to upload to DataLogger
The input date schould be sorted by date, and finished
the uploaded data will immediately split into TimeseriesArray, so no further dat... | code_fim | hard | {
"lang": "python",
"repo": "gunny26/datalogger",
"path": "/getters/haproxy_haproxylogs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gabocic/python path: /ML/trash/pyProCT-1.4.3/pyproct/clustering/evaluation/metrics/pcaMetrics.py
"""
Created on 13/08/2012
@author: victor
"""
import numpy
from pyRMSD.RMSDCalculator import RMSDCalculator
from pyproct.driver.time.timerHandler import TimerHandler
import scipy.linalg
class PCAMet... | code_fim | hard | {
"lang": "python",
"repo": "gabocic/python",
"path": "/ML/trash/pyProCT-1.4.3/pyproct/clustering/evaluation/metrics/pcaMetrics.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Calculates the covariance matrix for a given number of conformations
@param coordinates: Coordinates of the trajectory frames we want to use in the covariance matrix calculation.
This coordinates are stored in the format [conformation 1..N] where conformation i... | code_fim | hard | {
"lang": "python",
"repo": "gabocic/python",
"path": "/ML/trash/pyProCT-1.4.3/pyproct/clustering/evaluation/metrics/pcaMetrics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @return: the value of the metric.
"""
# Pca for each one of the clusters
pca_mean_val = 0.;
MAX_ELEMENTS = 1000
for c in clustering.clusters:
# Pick the coordinates (ensuring that we are copying them)
element_indexes = c.all_elements
... | code_fim | hard | {
"lang": "python",
"repo": "gabocic/python",
"path": "/ML/trash/pyProCT-1.4.3/pyproct/clustering/evaluation/metrics/pcaMetrics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>/serialVersionUIDChangeChecker",
packages=["serialVersionUIDChangeChecker"],
entry_points = {
"console_scripts": [
"serialVersionUIDChangeChecker = serialVersionUIDChangeChecker.__main__:main",
]
},
python_requires='>=3.6',
)<|fim_prefix|># repo: exasol/serial-v... | code_fim | medium | {
"lang": "python",
"repo": "exasol/serial-version-uid-change-pre-commit-hook",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: exasol/serial-version-uid-change-pre-commit-hook path: /setup.py
import setuptools
setuptools.setup(
name="serialVersionUIDChangeChecker",
version="0.1.0",
author="Exasol",
description="pre-commit plugin that shows a warning if a file was changed but serialVersionUID was not",
... | code_fim | medium | {
"lang": "python",
"repo": "exasol/serial-version-uid-change-pre-commit-hook",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ans = raw_input("Do you want to keep experiment results after sending them to the server?")
if ans.lower() == "yes" or ans.lower() == "y" or ans.lower() == "Y":
c.set("archive_sent_results", "1")
else:
print "Experiment results will not be archived, you can change this by editing the configuration... | code_fim | hard | {
"lang": "python",
"repo": "kevinkoo001/centinel-iclab",
"path": "/init_client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kevinkoo001/centinel-iclab path: /init_client.py
#!/usr/bin/env python
import sys
import os
from os import path
from os.path import exists
from centinel.client import ServerConnection
from centinel.client_config import client_conf
from utils.colors import bcolors
c = client_conf()
print bcolor... | code_fim | medium | {
"lang": "python",
"repo": "kevinkoo001/centinel-iclab",
"path": "/init_client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wajihyassine/l2tscaffolder path: /tests/definitions/manager.py
# !/usr/bin/python
# -*- coding: utf-8 -*-
"""Test class for the definition manager."""
import unittest
from l2tscaffolder.definitions import interface
from l2tscaffolder.definitions import manager
class GoldTestProject(interface.S... | code_fim | hard | {
"lang": "python",
"repo": "wajihyassine/l2tscaffolder",
"path": "/tests/definitions/manager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class DefinitionManagerTest(unittest.TestCase):
"""Test case for the definition manager. """
@classmethod
def setUpClass(cls):
"""Sets up the test class."""
# Need to make sure there are no registered projects, and can't iterate
# directly over projects since changing the dict in the mi... | code_fim | hard | {
"lang": "python",
"repo": "wajihyassine/l2tscaffolder",
"path": "/tests/definitions/manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def testGetDefinitionNames(self):
"""Test getting definition names."""
definitions = list(manager.DefinitionManager.GetDefinitionNames())
self.assertEqual(len(definitions), 2)
correct_definitions = ['gold', 'failing']
self.assertSetEqual(set(definitions), set(correct_definitions))
... | code_fim | hard | {
"lang": "python",
"repo": "wajihyassine/l2tscaffolder",
"path": "/tests/definitions/manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dy = y - (self.location[1])
self._initial_value = min(dy // self.entry_height, len(self.elements) -1)
def _untouched(self):
if self._initial_value is not None:
self._value = -1 # Force update on every touch
self.value(self._initial_value, show = True)
... | code_fim | hard | {
"lang": "python",
"repo": "hiddenvs/micropython_ra8875",
"path": "/widgets/listbox.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hiddenvs/micropython_ra8875 path: /widgets/listbox.py
# listbox.py Extension to ugui providing the Listbox class
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2019 Peter Hinch
from micropython_ra8875.py.ugui import Touchable
from micropython_ra8875.py.colors import *
dol... | code_fim | hard | {
"lang": "python",
"repo": "hiddenvs/micropython_ra8875",
"path": "/widgets/listbox.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _touched(self, x, y):
dy = y - (self.location[1])
self._initial_value = min(dy // self.entry_height, len(self.elements) -1)
def _untouched(self):
if self._initial_value is not None:
self._value = -1 # Force update on every touch
self.value(self... | code_fim | hard | {
"lang": "python",
"repo": "hiddenvs/micropython_ra8875",
"path": "/widgets/listbox.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stasbel/Meme-Machinery-VKHack2018 path: /experiments/scrap.py
"""Parses the Reddit memes subreddits and store it."""
import configparser
import logging
import torch
from mem.gen.scrapper import RedditScrapper
logger = logging.getLogger(__name__)
<|fim_suffix|>def _parse_config():
config ... | code_fim | hard | {
"lang": "python",
"repo": "stasbel/Meme-Machinery-VKHack2018",
"path": "/experiments/scrap.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> logger.info(f'Collected {len(meta)} samples from Reddit.')
torch.save(meta, META_PATH)
def _parse_config():
config = configparser.ConfigParser()
config.read(CONFIG_FILE)
logging.basicConfig(
format='%(asctime)s | %(message)s',
handlers=[
logging.StreamHan... | code_fim | hard | {
"lang": "python",
"repo": "stasbel/Meme-Machinery-VKHack2018",
"path": "/experiments/scrap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def count_mined_pairs(build_groups):
if not build_groups:
return 0, 0, 0, 0
mined_push_build_pairs = mined_push_job_pairs = mined_pr_build_pairs = mined_pr_job_pairs = 0
for group in build_groups.values():
for build_pair in group.pairs:
if build_pair.exclude_from_o... | code_fim | hard | {
"lang": "python",
"repo": "BugSwarm/bugswarm",
"path": "/github-pair-finder/pair_finder.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
args = parse_argv()
try:
log.config_logging(args['log'].upper(), show_thread_name=True)
except ValueError:
log.config_logging('INFO', show_thread_name=True)
log.warning('Unknown/invalid log level "{}". Defaulting to "INFO".'.format(args['log']))
if arg... | code_fim | hard | {
"lang": "python",
"repo": "BugSwarm/bugswarm",
"path": "/github-pair-finder/pair_finder.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BugSwarm/bugswarm path: /github-pair-finder/pair_finder.py
import argparse
import os
import sys
import traceback
import threading
from concurrent.futures import ThreadPoolExecutor, as_completed
from bugswarm.common import log
from bugswarm.common.credentials import DATABASE_PIPELINE_TOKEN, GITHU... | code_fim | hard | {
"lang": "python",
"repo": "BugSwarm/bugswarm",
"path": "/github-pair-finder/pair_finder.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RegsonDR/Project-Estimator-GAE path: /routes/api/views.py
from flask import Blueprint, jsonify, request
from models import *
from routes.api.utils import *
from functools import wraps
api = Blueprint('api', __name__, url_prefix='/api/')
class user_api_request:
def __init__(self, workspace_... | code_fim | hard | {
"lang": "python",
"repo": "RegsonDR/Project-Estimator-GAE",
"path": "/routes/api/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method == 'POST':
allowed_items = {'SkillID': int, 'rating': int}
body = check_body(allowed_items)
if 'code' in body:
return jsonify(body)
contains_all = mandatory(allowed_items, body)
if contains_all != True:
return jsonify(co... | code_fim | hard | {
"lang": "python",
"repo": "RegsonDR/Project-Estimator-GAE",
"path": "/routes/api/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> message = None
if request.method == 'POST':
allowed_items = {'skill_name': unicode}
body = check_body(allowed_items)
if 'code' in body:
return jsonify(body)
contains_all = mandatory(allowed_items, body)
if contains_all != True:
return... | code_fim | hard | {
"lang": "python",
"repo": "RegsonDR/Project-Estimator-GAE",
"path": "/routes/api/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Redirect URIs must be a valid URL and use https unless the host is
localhost for which http is accepted.
"""
sch, netloc, path, par, query, fra = urlparse(value)
if not (sch and netloc):
raise InvalidRedirectURIError()
if sch != 'https':
if ':' in netloc:
... | code_fim | hard | {
"lang": "python",
"repo": "tiborsimko/flask-oauth2server",
"path": "/flask_oauth2server/validators.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tiborsimko/flask-oauth2server path: /flask_oauth2server/validators.py
# -*- coding: utf-8 -*-
#
# This file is part of Flask-OAuth2Server
# Copyright (C) 2014 CERN.
#
# Flask-OAuth2Server is free software; you can redistribute it and/or
# modify it under the terms of the Revised BSD License; see ... | code_fim | hard | {
"lang": "python",
"repo": "tiborsimko/flask-oauth2server",
"path": "/flask_oauth2server/validators.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def command_exec():
"""コマンドを起動します
コマンドライン引数からサブコマンドのインスタンスを生成し、起動します。
"""
args = parser.parse_args()
args.handler(args)<|fim_prefix|># repo: mitama-org/mitama path: /mitama/__init__.py
#!/usr/bin/python
"""コマンド定義
* 1ファイル1コマンドでクラスとして書いてます
* handleがコマンドライン引数の引数部を受け取って実行する
... | code_fim | hard | {
"lang": "python",
"repo": "mitama-org/mitama",
"path": "/mitama/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>gevent.monkey.patch_all()
parser = argparse.ArgumentParser(description="Mitama command utilities")
subparser = parser.add_subparsers()
init = subparser.add_parser("init", help="Initialize directory as a Mitama project")
init.set_defaults(handler=commands.init)
new = subparser.add_parser("new", help="Cr... | code_fim | medium | {
"lang": "python",
"repo": "mitama-org/mitama",
"path": "/mitama/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mitama-org/mitama path: /mitama/__init__.py
#!/usr/bin/python
"""コマンド定義
* 1ファイル1コマンドでクラスとして書いてます
* handleがコマンドライン引数の引数部を受け取って実行する
* 抽象化はするかどうか迷ってる(Pythonで抽象化がどれくらい尊いものかよくわかんない)
* argparseを入れようか迷ったけど、位置引数しか必要に成る予定が無いのでとりあえず入れてない
"""
import warnings
warnings.simplefilter("ignore")
... | code_fim | hard | {
"lang": "python",
"repo": "mitama-org/mitama",
"path": "/mitama/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>a+=i
if soma==n:
print("o numero é perfeito ")
else:
print("o numero NAO é perfeito ")<|fim_prefix|># repo: thiago5171/python. path: /exerc_da_faculdade/ex18.py
n=int(input("diigte um numero: "))
i=1
soma=0
f<|fim_middle|>or i in range(i,n,1):
if n%i==0:
som | code_fim | easy | {
"lang": "python",
"repo": "thiago5171/python.",
"path": "/exerc_da_faculdade/ex18.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thiago5171/python. path: /exerc_da_faculdade/ex18.py
n=int(input("diigte um numero: "))
i=1
soma=0
for i in range(i,n,1):
if n%i==0:
som<|fim_suffix|>o ")
else:
print("o numero NAO é perfeito ")<|fim_middle|>a+=i
if soma==n:
print("o numero é perfeit | code_fim | easy | {
"lang": "python",
"repo": "thiago5171/python.",
"path": "/exerc_da_faculdade/ex18.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>o ")
else:
print("o numero NAO é perfeito ")<|fim_prefix|># repo: thiago5171/python. path: /exerc_da_faculdade/ex18.py
n=int(input("diigte um numero: "))
i=1
soma=0
for i in range(i,n,1):
if n%i==0:
som<|fim_middle|>a+=i
if soma==n:
print("o numero é perfeit | code_fim | easy | {
"lang": "python",
"repo": "thiago5171/python.",
"path": "/exerc_da_faculdade/ex18.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Embed command.
cmd = ui.Subcommand('embedfetchedart',
help='embed already fetched images into file metadata')
cmd.parser.add_option('-r', '--remove', dest='remove',
action='store_true', default=False,
help='r... | code_fim | medium | {
"lang": "python",
"repo": "asteven/beets",
"path": "/beetsplug/embedfetchedart.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asteven/beets path: /beetsplug/embedfetchedart.py
# This file is part of beets.
# Copyright 2012, Steven Armstrong
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software wit... | code_fim | medium | {
"lang": "python",
"repo": "asteven/beets",
"path": "/beetsplug/embedfetchedart.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/io path: /tests/test_atds_avro/utils/stat_t_test_cli.py
# Copyright 2023 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Li... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/io",
"path": "/tests/test_atds_avro/utils/stat_t_test_cli.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> message = (
f"Benchmark results in {first_result.label} "
f"and {second_result.label} have no intersection."
)
logging.warning(message)
def log_not_significant_benchmark_result(benchmarks, label1, label2, order, alpha):
result_messages = create_result_messages(benchmarks,... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/io",
"path": "/tests/test_atds_avro/utils/stat_t_test_cli.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_upload_type(self, name):
if name not in self.files:
raise Exception("")
return self.files[name][0]
def get_upload_content(self, name):
if name not in self.files:
raise Exception("")
fp = self.files[name][1]
fp.seek(0)
... | code_fim | hard | {
"lang": "python",
"repo": "mapix/WebHello",
"path": "/WebHello/request.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mapix/WebHello path: /WebHello/request.py
# -*- coding:utf-8 -*-
import cgi
import cgitb
import Cookie
from collections import defaultdict
from tempfile import TemporaryFile
cgitb.enable()
__all__ = ['Request']
class Request(object):
def __init__(self, environ, **config):
self.e... | code_fim | medium | {
"lang": "python",
"repo": "mapix/WebHello",
"path": "/WebHello/request.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> item = base.loader.loadModel(ModelPath + "model_" + buffItem.itemName)
texture = item.findAllTextures()
if isinstance(buffItem, (RayItem, ShotgunItem)):
if self.buff.has_key("attackStyleFrame"):
self.buff["attackStyleFrame"][1].destroy()
... | code_fim | hard | {
"lang": "python",
"repo": "quopple/Game",
"path": "/Arrival/development/src/main/BuffState.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.heroPic.hide()
for frame in self.buff.itervalues():
if isinstance( frame,tuple):
frame[1].hide()
else:
frame.hide()
def addBuff(self,entry):
buffItem = entry.getIntoNodePath().getPythonTag("Item")
se... | code_fim | hard | {
"lang": "python",
"repo": "quopple/Game",
"path": "/Arrival/development/src/main/BuffState.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quopple/Game path: /Arrival/development/src/main/BuffState.py
from direct.gui.DirectButton import DirectFrame
from direct.showbase.DirectObject import DirectObject
import logging
from Item import *
attackStyleFramePos = -1
class BuffState(DirectObject):
buff = {}
num = 0
... | code_fim | hard | {
"lang": "python",
"repo": "quopple/Game",
"path": "/Arrival/development/src/main/BuffState.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dzynin/TopicalChange path: /baselines/02_generate_training_data_graphseg.py
"""
Converts the document to a "paragraph-per-line" format for GraphSeq
"""
import argparse
from tqdm import tqdm
import json
import os
if __name__ == "__main__":
parser = argparse.ArgumentParser(
descripti... | code_fim | hard | {
"lang": "python",
"repo": "dzynin/TopicalChange",
"path": "/baselines/02_generate_training_data_graphseg.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> os.makedirs(output_folder, exist_ok=True)
for filename in tqdm(sorted(os.listdir(input_folder))):
fp = os.path.join(input_folder, filename)
with open(fp) as f:
json_dict = json.load(f)
graphseg_content = ""
if len(json_dict["level1_headings"]) < 3:
... | code_fim | hard | {
"lang": "python",
"repo": "dzynin/TopicalChange",
"path": "/baselines/02_generate_training_data_graphseg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: geertj/draco2 path: /draco2/database/exception.py
# vi: ts=8 sts=4 sw=4 et
#
# exception.py: draco.database exceptions
#
# This file is part of Draco2. Draco2 is free software and is made available
# under the MIT license. Consult the file "LICENSE" that is distributed
# together with this file f... | code_fim | medium | {
"lang": "python",
"repo": "geertj/draco2",
"path": "/draco2/database/exception.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class DatabaseInternalError(DatabaseError):
"""Raised when an internal error has occurred."""
class DatabaseDBAPIError(DatabaseError):
"""Raised when an unexpected DB-API error has occurred."""<|fim_prefix|># repo: geertj/draco2 path: /draco2/database/exception.py
# vi: ts=8 sts=4 sw=4 et
#
# e... | code_fim | medium | {
"lang": "python",
"repo": "geertj/draco2",
"path": "/draco2/database/exception.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_to_dict():
message_dict = dict(
type=MessageType.URL,
tracking_data=SAMPLE_TRACKING_DATA,
keyboard=SAMPLE_KEYBOARD,
media=SAMPLE_URL
)
url_message_dict = URLMessage(
tracking_data=SAMPLE_TRACKING_DATA,
keyboard=SAMPLE_KEYBOARD,
media=SAMPLE_URL
).to_dict()
assert message_dic... | code_fim | hard | {
"lang": "python",
"repo": "vorlov-bash/viber-bot-python",
"path": "/tests/api/messages/test_url_message.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_validate_success():
url_message = URLMessage(
tracking_data=SAMPLE_TRACKING_DATA,
keyboard=SAMPLE_KEYBOARD,
media=SAMPLE_URL
)
assert url_message.validate()
def test_validate_failure():
url_message = URLMessage(
tracking_data=SAMPLE_TRACKING_DATA,
keyboard=SAMPLE_KEYBOARD
)
as... | code_fim | hard | {
"lang": "python",
"repo": "vorlov-bash/viber-bot-python",
"path": "/tests/api/messages/test_url_message.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vorlov-bash/viber-bot-python path: /tests/api/messages/test_url_message.py
from viberbot.api.messages import MessageType
from viberbot.api.messages import URLMessage
SAMPLE_TRACKING_DATA = "some tracking data"
SAMPLE_KEYBOARD = """{
"Type": "keyboard",
"DefaultHeight": true,
"BgColor": "#F... | code_fim | hard | {
"lang": "python",
"repo": "vorlov-bash/viber-bot-python",
"path": "/tests/api/messages/test_url_message.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> verbose=True, datetime_index=False, column_names=None):
"""
Returns a dataframe from a QuerySet
Optionally specify the field names/columns to utilize and
a field as the index
Parameters
----------
qs: The Django QuerySet.
fieldnames: The model field names ... | code_fim | hard | {
"lang": "python",
"repo": "chrisdev/django-pandas",
"path": "/django_pandas/io.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chrisdev/django-pandas path: /django_pandas/io.py
import django
import pandas as pd
from .utils import update_with_verbose, get_related_model
FieldDoesNotExist = (
django.db.models.fields.FieldDoesNotExist
if django.VERSION < (1, 8)
else django.core.exceptions.FieldDoesNotExist
)
... | code_fim | hard | {
"lang": "python",
"repo": "chrisdev/django-pandas",
"path": "/django_pandas/io.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_show_mem(self):
args = ['mem']
res = CommandShow().execute(args)
self.assertTrue(res)
def test_show_nodes(self):
# query nodes with no NodeLeader.Instance()
with patch('neo.Network.NodeLeader.NodeLeader.Instance'):
args = ['nodes']
... | code_fim | hard | {
"lang": "python",
"repo": "jseagrave21/neo-python",
"path": "/neo/Prompt/Commands/tests/test_show_commands.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jseagrave21/neo-python path: /neo/Prompt/Commands/tests/test_show_commands.py
import os
from neo.Settings import settings
from neo.Utils.BlockchainFixtureTestCase import BlockchainFixtureTestCase
from neo.Prompt.Commands.Show import CommandShow
from neo.Prompt.Commands.Wallet import CommandWallet... | code_fim | hard | {
"lang": "python",
"repo": "jseagrave21/neo-python",
"path": "/neo/Prompt/Commands/tests/test_show_commands.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # query with bad asset
args = ['asset', 'c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9e']
res = CommandShow().execute(args)
self.assertFalse(res)
# query with bad input
args = ['asset', 'blah']
res = CommandShow().execute(args)
... | code_fim | hard | {
"lang": "python",
"repo": "jseagrave21/neo-python",
"path": "/neo/Prompt/Commands/tests/test_show_commands.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sciapp/sampledb path: /sampledb/models/migrations/files_add_data.py
# coding: utf-8
"""
Add data column to files table.
"""
import os
import flask_sqlalchemy
import sqlalchemy
from .utils import table_has_column
MIGRATION_INDEX = 8
MIGRATION_NAME, _ = os.path.splitext(os.path.basename(__file_... | code_fim | medium | {
"lang": "python",
"repo": "sciapp/sampledb",
"path": "/sampledb/models/migrations/files_add_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Skip migration by condition
if table_has_column('files', 'data'):
return False
# Perform migration
db.session.execute(db.text("""
ALTER TABLE files
ADD data JSON
"""))
files_to_update = []
for id, object_id, original_file_name in db.session.execute(d... | code_fim | medium | {
"lang": "python",
"repo": "sciapp/sampledb",
"path": "/sampledb/models/migrations/files_add_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: issuequality/issuequality path: /GithubRepoClient.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime
from github import Github
import configparser
class GithubRepoClient(object):
"""Classe que representa um cliente para um respositório do Github"""
def __... | code_fim | hard | {
"lang": "python",
"repo": "issuequality/issuequality",
"path": "/GithubRepoClient.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def set_last_issue(self, issue_number):
"""TODO: Docstring for set_last_issue.
:issue_number: TODO
:returns: TODO
"""
if issue_number > self._last_issue:
self._last_issue = issue_number
def get_last_issue(self):
"""TODO: Docstring for... | code_fim | hard | {
"lang": "python",
"repo": "issuequality/issuequality",
"path": "/GithubRepoClient.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> logging.info("Generating Files")
x = range(0, iter)
for n in x:
new_file_name = 'test_' + str(n)
generate_random_bin_file(new_file_name, size)
def get_size(file_size):
unit = file_size[-1].lower()
significand = int(file_size[:-1])
return [significand, unit]
def lo... | code_fim | hard | {
"lang": "python",
"repo": "RCL-Loren/s3-upload-speedtest",
"path": "/s3-upload-speed.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RCL-Loren/s3-upload-speedtest path: /s3-upload-speed.py
import os
import sys
import csv
import time
import boto3
import click
import logging
import threading
import statistics
from dotenv import load_dotenv
from botocore.config import Config
from botocore.exceptions import ClientError
units_dic... | code_fim | hard | {
"lang": "python",
"repo": "RCL-Loren/s3-upload-speedtest",
"path": "/s3-upload-speed.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> logging.info('Generated file %s with %f bytes', filename, size)
class ProgressPercentage(object):
def __init__(self, filename):
self._filename = filename
self._size = float(os.path.getsize(filename))
self._seen_so_far = 0
self._lock = threading.Lock()
def __c... | code_fim | hard | {
"lang": "python",
"repo": "RCL-Loren/s3-upload-speedtest",
"path": "/s3-upload-speed.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>e_dir, filename=u'host_config.json')
endpoint_config = u'{base}{filename}'.format(base=base_dir, filename=u'endpoint_config.json')<|fim_prefix|># repo: avim2809/CameraSiteBlocker path: /venv/Lib/site-packages/apiutil/resources/schema/__init__.py
# encoding: utf-8
import os
base_dir = u'{dir}{sep}'.form... | code_fim | hard | {
"lang": "python",
"repo": "avim2809/CameraSiteBlocker",
"path": "/venv/Lib/site-packages/apiutil/resources/schema/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: avim2809/CameraSiteBlocker path: /venv/Lib/site-packages/apiutil/resources/schema/__init__.py
# encoding: utf-8
import os
base_dir = u'{dir}{sep}'.format(dir=os.path.dirname(os.path.realpath(__file__)),
sep=os.sep)
api_config = u'{base}{filename}'.format(base=ba... | code_fim | medium | {
"lang": "python",
"repo": "avim2809/CameraSiteBlocker",
"path": "/venv/Lib/site-packages/apiutil/resources/schema/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def BSC_metric_increment(n, p):
def metric_increment(bias, received, codeword):
# Binary codewords
assert all(z in [0,1] for z in received.flatten())
d = hamming_distance(received, codeword)
return d * np.log2(p) + (n - d) * np.log2(1 - p) \
+ (1 - bias)... | code_fim | hard | {
"lang": "python",
"repo": "eliasrg/SURF2017",
"path": "/code/separate/coding/convolutional/stack.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.