text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: AdamRJonesHPD/SManager_Tools path: /s300/s300.py
ept IndexError:
# return 0
#
# def flt(self):
# try:
# if self.version == 4:
# index = constants.KPRO4_FLT
# else:
# return {'celsius': 0, 'fahrenheit': 0}
# flt_ce... | code_fim | hard | {
"lang": "python",
"repo": "AdamRJonesHPD/SManager_Tools",
"path": "/s300/s300.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def a10(self):
mask = 0x10
try:
if self.version == 3:
return bool(self.data0[constants.S300V3_A10] & mask)
else:
return {'a10', False}
except IndexError:
return False
def cl(self):
mask = 0... | code_fim | hard | {
"lang": "python",
"repo": "AdamRJonesHPD/SManager_Tools",
"path": "/s300/s300.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anggeralmasih/Pemrograman-dan-Praktikum-GUI_19104073_Anggeralmasih-WR_S1SE03B path: /UTS/No_1/Code/DemoNo_1.py
import sys
from No_1 import*
from PyQt5.QtCore import*
from PyQt5.QtWidgets import*
class DemoNo1(QDialog):
def __init__(self,parent = None):
<|fim_suffix|> QMessageBox.... | code_fim | hard | {
"lang": "python",
"repo": "anggeralmasih/Pemrograman-dan-Praktikum-GUI_19104073_Anggeralmasih-WR_S1SE03B",
"path": "/UTS/No_1/Code/DemoNo_1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> QMessageBox.information(self, 'Clear', 'Data %s telah diclear!' %self.ui.lineEdit.text())
if __name__ == "__main__":
a = QApplication(sys.argv)
form = DemoNo1()
form.show()
a.exec_()<|fim_prefix|># repo: anggeralmasih/Pemrograman-dan-Praktikum-GUI_19104073_Anggeralmasih-WR_S1... | code_fim | hard | {
"lang": "python",
"repo": "anggeralmasih/Pemrograman-dan-Praktikum-GUI_19104073_Anggeralmasih-WR_S1SE03B",
"path": "/UTS/No_1/Code/DemoNo_1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BOUALILILila/NeuralTweetSummarization path: /Embeddings/PATHS.py
import os
config=1
base_dir='/data'
TRAIN_DATA_FOLDER_PATH = '/CORPUS/collection_2018/*.txt'
TOPICS_FOLDER_PATH='/CORPUS/topics/'
TRAIN_TWEETS_2018='/CORPUS/training_data_embeddings/train_data_2018.json'
STATS_SKIP_GRAM='/CORPUS/em... | code_fim | hard | {
"lang": "python",
"repo": "BOUALILILila/NeuralTweetSummarization",
"path": "/Embeddings/PATHS.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ectors.txt'
CBOW_STATS_FULL='/CORPUS/embeddings/full/CBOW/stats.txt'
TRAIN_TWEETS='/CORPUS/training_data_embeddings'
if(config):
TRAIN_DATA_FOLDER_PATH = base_dir+ TRAIN_DATA_FOLDER_PATH
TOPICS_FOLDER_PATH=base_dir+TOPICS_FOLDER_PATH
TRAIN_TWEETS_2018=base_dir+TRAIN_TWEETS_2018
STATS_SKIP_... | code_fim | hard | {
"lang": "python",
"repo": "BOUALILILila/NeuralTweetSummarization",
"path": "/Embeddings/PATHS.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> event = serializers.CharField()
date = serializers.DateField()
class Meta:
model = GeneratedCycle
fields = ['event','date']<|fim_prefix|># repo: dewale005/women-s-health-estimator path: /womens_health/serializers.py
from rest_framework import serializers
from rest_framework.r... | code_fim | hard | {
"lang": "python",
"repo": "dewale005/women-s-health-estimator",
"path": "/womens_health/serializers.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dewale005/women-s-health-estimator path: /womens_health/serializers.py
from rest_framework import serializers
from rest_framework.response import Response
from .models import WomenCycle, GeneratedCycle
class WomenCycleSerializers(serializers.ModelSerializer):
last_period_date = serializers.D... | code_fim | hard | {
"lang": "python",
"repo": "dewale005/women-s-health-estimator",
"path": "/womens_health/serializers.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vaijyant/PythonPlayground path: /02_01_collections_lists.py
# Four collection types in Python
# 1) List
# 2) Tuple
# 3) Set
# 4) Dictionary
list = ["James", "Harry", "Albus"]
print("List:", list)
print("List item at 2:", list[2])
<|fim_suffix|>print("List length:", len(list))
list.append("Gin... | code_fim | medium | {
"lang": "python",
"repo": "Vaijyant/PythonPlayground",
"path": "/02_01_collections_lists.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>list.remove("Percevel")
print("List:", list)
print(list.pop())
print(list)
del list[2]
print(list)
list.clear()
print(list)<|fim_prefix|># repo: Vaijyant/PythonPlayground path: /02_01_collections_lists.py
# Four collection types in Python
# 1) List
# 2) Tuple
# 3) Set
# 4) Dictionary
list = ["James",... | code_fim | hard | {
"lang": "python",
"repo": "Vaijyant/PythonPlayground",
"path": "/02_01_collections_lists.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(list.pop())
print(list)
del list[2]
print(list)
list.clear()
print(list)<|fim_prefix|># repo: Vaijyant/PythonPlayground path: /02_01_collections_lists.py
# Four collection types in Python
# 1) List
# 2) Tuple
# 3) Set
# 4) Dictionary
list = ["James", "Harry", "Albus"]
print("List:", list)
print... | code_fim | medium | {
"lang": "python",
"repo": "Vaijyant/PythonPlayground",
"path": "/02_01_collections_lists.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bartosz69/PYTHON path: /zadania1/zad2.py
sys imports
x = "Podaj dwie liczby do m<|fim_suffix|>t(a)
b = sys.stdin.readline()
b = int(b)
c = a*b
c = str(c)
sys.stdout.write(c)<|fim_middle|>nozenia:
a = sys.stdin.readline()
a = in | code_fim | easy | {
"lang": "python",
"repo": "Bartosz69/PYTHON",
"path": "/zadania1/zad2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bartosz69/PYTHON path: /zadania1/zad2.py
sys imports
x = "Podaj dwie liczby do m<|fim_suffix|>)
c = a*b
c = str(c)
sys.stdout.write(c)<|fim_middle|>nozenia:
a = sys.stdin.readline()
a = int(a)
b = sys.stdin.readline()
b = int(b | code_fim | medium | {
"lang": "python",
"repo": "Bartosz69/PYTHON",
"path": "/zadania1/zad2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>)
c = a*b
c = str(c)
sys.stdout.write(c)<|fim_prefix|># repo: Bartosz69/PYTHON path: /zadania1/zad2.py
sys imports
x = "Podaj dwie liczby do mnozenia:
a = sys.stdin.readline()
a = in<|fim_middle|>t(a)
b = sys.stdin.readline()
b = int(b | code_fim | easy | {
"lang": "python",
"repo": "Bartosz69/PYTHON",
"path": "/zadania1/zad2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Want to plot the three on top of each other
# Normalise for convenience of comparing
hist_narrow.Scale(1.0/hist_narrow.Integral())
hist_broad.Scale(1.0/hist_broad.Integral())
hist_target.Scale(1.0/hist_target.Integral())
c = ROOT.TCanvas("c_{0}".format(mass),'',0,0,800,600)
hist_narrow.Se... | code_fim | hard | {
"lang": "python",
"repo": "kpachal/DMSP-interpolation-checks",
"path": "/CheckOldMethodVariability/plotWidths.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kpachal/DMSP-interpolation-checks path: /CheckOldMethodVariability/plotWidths.py
import ROOT
import sys
sys.path.insert(0, '/afs/cern.ch/work/k/kpachal/PythonModules/art/')
import AtlasStyle
AtlasStyle.SetAtlasStyle()
ROOT.gROOT.ForceStyle()
# Want to compare 3 things:
# - points in the nose w... | code_fim | hard | {
"lang": "python",
"repo": "kpachal/DMSP-interpolation-checks",
"path": "/CheckOldMethodVariability/plotWidths.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nniconn/nn-snippets-app-py path: /snippets.py
import logging
import argparse
import psycopg2
logging.basicConfig(format='%(asctime)s %(message)s', filename="snippets.log", level=logging.DEBUG)
logging.debug('Debug message for the log file')
logging.info('Info message for the log file')
logging.w... | code_fim | hard | {
"lang": "python",
"repo": "nniconn/nn-snippets-app-py",
"path": "/snippets.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
"""Main function"""
logging.info("Constructing parser")
parser = argparse.ArgumentParser(description="Store and retrieve snippets of text")
subparsers = parser.add_subparsers(dest="command", help="Available commands")
# put | get | anycommand | some take more arguments... | code_fim | hard | {
"lang": "python",
"repo": "nniconn/nn-snippets-app-py",
"path": "/snippets.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nasirshah65/mycode path: /listmethods/listmeth02.py
#!/usr/bin/env/ python3
proto = ["ssh", "http", "https"]
protoa = ["ssh", "http", "https"]
print(proto)
proto.append("dns") #this line will add "dns" to the end of the list
protoa.append("dns") #this line will add <|fim_suffix|>argument
print(pr... | code_fim | medium | {
"lang": "python",
"repo": "nasirshah65/mycode",
"path": "/listmethods/listmeth02.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>argument
print(proto)
protoa.append(proto2) # pass proot2 as an argument to the append method
print(protoa)<|fim_prefix|># repo: nasirshah65/mycode path: /listmethods/listmeth02.py
#!/usr/bin/env/ python3
proto = ["ssh", "http", "https"]
protoa = ["ssh", "http", "https"]
print(proto)
proto.append("dns") ... | code_fim | medium | {
"lang": "python",
"repo": "nasirshah65/mycode",
"path": "/listmethods/listmeth02.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: demarco-cmj/Cyber-Range-Senior-Project path: /Exercises/E2_Broken_Authentication/pw_generator.py
import random
import string
import os.path
import sys
from os import path
import settings
""" Creates a list of potential passwords equal to num_words
that contains a random combination of lower... | code_fim | hard | {
"lang": "python",
"repo": "demarco-cmj/Cyber-Range-Senior-Project",
"path": "/Exercises/E2_Broken_Authentication/pw_generator.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def create_pw():
file = open(settings.poss_pw_file, "r")
output = file.read()
words = output.split()
pw = random.choice(words)
file2 = open(settings.pw_file, "w")
file2.write(pw)
file2.close()
file.close()
create_pw_list()<|fim_prefix|># repo: demarco-cmj/Cyber-Range-Senior-Project path: /Exerc... | code_fim | hard | {
"lang": "python",
"repo": "demarco-cmj/Cyber-Range-Senior-Project",
"path": "/Exercises/E2_Broken_Authentication/pw_generator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qutech/qupulse path: /tests/pulses/pulse_template_tests.py
self, serializer: Optional['Serializer']=None) -> Dict[str, Any]:
raise NotImplementedError()
@property
def measurement_names(self):
raise NotImplementedError()
@classmethod
def deserialize(cls, serialize... | code_fim | hard | {
"lang": "python",
"repo": "qutech/qupulse",
"path": "/tests/pulses/pulse_template_tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> from qupulse.pulses.sequence_pulse_template import SequencePulseTemplate
with mock.patch.object(SequencePulseTemplate, 'concatenate', return_value='concat') as mock_concatenate:
self.assertEqual(b @ a, 'concat')
mock_concatenate.assert_called_once_with(b, a)
de... | code_fim | hard | {
"lang": "python",
"repo": "qutech/qupulse",
"path": "/tests/pulses/pulse_template_tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> expected = AtomicMultiChannelPT(self.fpt, self.cpt)
actual = self.fpt.with_parallel_atomic(self.cpt)
self.assertEqual(expected, actual)
class AtomicPulseTemplateTests(unittest.TestCase):
def test_internal_create_program(self) -> None:
measurement_windows = [('M', 0, ... | code_fim | hard | {
"lang": "python",
"repo": "qutech/qupulse",
"path": "/tests/pulses/pulse_template_tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Visualising the Training set results
from matplotlib.colors import ListedColormap
X_set, y_set = X_train, y_train
# подготавливаем матрицу для нашего поля данных с шагом сетки 0.01
X1, X2 = np.meshgrid(np.arange(start = X_set[:, 0].min() - 1, stop = X_set[:, 0].max() + 1, step = 0.01),
... | code_fim | hard | {
"lang": "python",
"repo": "xxrom/mashine_leanring_a-z_data_preprocessing_part3_section12_logistic_regression",
"path": "/logistic_regression.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Predicting the Test set results
y_pred = classifier.predict(X_test) # предсказываем данные из X_test
# Making the Confusion Matrix # узнаем насколько правильная модель
from sklearn.metrics import confusion_matrix
cm = confusion_matrix(y_test, y_pred) # закиыдваем тестовые и предсказанные данные
# данны... | code_fim | hard | {
"lang": "python",
"repo": "xxrom/mashine_leanring_a-z_data_preprocessing_part3_section12_logistic_regression",
"path": "/logistic_regression.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xxrom/mashine_leanring_a-z_data_preprocessing_part3_section12_logistic_regression path: /logistic_regression.py
# Logistic Regression
# по факту, алгоритм просто рисует линейную регрессию для 0, 1 элементов
# все что выходит за границы между 0 и 1 будет равно 0 или 1 соответсвенно
# и потом по эт... | code_fim | hard | {
"lang": "python",
"repo": "xxrom/mashine_leanring_a-z_data_preprocessing_part3_section12_logistic_regression",
"path": "/logistic_regression.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fwin-dev/py.Lang path: /src/Lang/Events/Proxy.py
from Lang.Struct import OrderedSet
import sys
class EventReceiver(object):
"""
Feel free to use this class as a mixin for receiving specific events.
However, strict use of this class is not necessary. If your class is subscribed to an EventPr... | code_fim | hard | {
"lang": "python",
"repo": "fwin-dev/py.Lang",
"path": "/src/Lang/Events/Proxy.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _tieInExceptHook(self):
oldFunc = sys.excepthook
def branchHook(exceptionClass, exceptionInstance, tracebackInstance):
oldFunc(exceptionClass, exceptionInstance, tracebackInstance)
self.notifyException(exceptionInstance, tracebackInstance)
sys.excepthook = branchHook
def __getattr__(se... | code_fim | hard | {
"lang": "python",
"repo": "fwin-dev/py.Lang",
"path": "/src/Lang/Events/Proxy.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> text = "모르겠 습니 다"
self.assertRaises(NotImplementedError, pos_tag, word_tokenize(text), lang="kor")
# Test for default kwarg, `lang=None`
self.assertRaises(NotImplementedError, pos_tag, word_tokenize(text), lang=None)
def test_unspecified_lang(self):
# Tries to ... | code_fim | hard | {
"lang": "python",
"repo": "nltk/nltk",
"path": "/nltk/test/unit/test_pos_tag.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nltk/nltk path: /nltk/test/unit/test_pos_tag.py
"""
Tests for nltk.pos_tag
"""
import unittest
from nltk import pos_tag, word_tokenize
class TestPosTag(unittest.TestCase):
def test_pos_tag_eng(self):
text = "John's big idea isn't all that bad."
expected_tagged = [
... | code_fim | hard | {
"lang": "python",
"repo": "nltk/nltk",
"path": "/nltk/test/unit/test_pos_tag.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ge")
else:
t.color("yellow")
t.forward(50)
t.right(360/12)<|fim_prefix|># repo: Armastus/UdacityPythonIntro path: /Dodecagon_LoopConditionalModulo.py
import turtle
# Example 3
t = turtle.Turtle()
t.width(5)
for n in range(12)<|fim_middle|>:
t.color("gray")
# Add some if stat... | code_fim | medium | {
"lang": "python",
"repo": "Armastus/UdacityPythonIntro",
"path": "/Dodecagon_LoopConditionalModulo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Armastus/UdacityPythonIntro path: /Dodecagon_LoopConditionalModulo.py
import turtle
# Example 3
t = turtle.Turtle()
t.width(5)
for n in range(12)<|fim_suffix|>n % 3 == 0:
t.color("red")
elif n % 3 == 1:
t.color("orange")
else:
t.color("yellow")
t.forward(50)
... | code_fim | medium | {
"lang": "python",
"repo": "Armastus/UdacityPythonIntro",
"path": "/Dodecagon_LoopConditionalModulo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert self._updated
context = aq_inner(self.context)
portal_state = getMultiAdapter((context, self.request),
name=u'plone_portal_state')
bc_view = context.restrictedTraverse('@@breadcrumbs_view')
crumbs = bc_view.breadcrumbs()... | code_fim | hard | {
"lang": "python",
"repo": "RBINS/mars",
"path": "/src/marsapp/categories/browser/view.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RBINS/mars path: /src/marsapp/categories/browser/view.py
# -*- coding: utf-8 -*-
from Acquisition import aq_inner
from Products.CMFPlone.PloneBatch import Batch
from zope.component import getMultiAdapter
from archetypes.referencebrowserwidget.interfaces import IReferenceBrowserHelperView
from arc... | code_fim | hard | {
"lang": "python",
"repo": "RBINS/mars",
"path": "/src/marsapp/categories/browser/view.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>m
print("O valor a pagar por dias locado fica R$%5.2f e o valor pela quantidade de Km rodados fica R$%5.2f"%(aluguel,valor_km))
print("O total a pagar pelo aluguel do carro fica R$%5.2f" %total_aluguel)
print("Obrigada")<|fim_prefix|># repo: Mariliacaps/teste-python path: /CAP03/EXERCICIO3-14.py
km_perco... | code_fim | medium | {
"lang": "python",
"repo": "Mariliacaps/teste-python",
"path": "/CAP03/EXERCICIO3-14.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>luguel,valor_km))
print("O total a pagar pelo aluguel do carro fica R$%5.2f" %total_aluguel)
print("Obrigada")<|fim_prefix|># repo: Mariliacaps/teste-python path: /CAP03/EXERCICIO3-14.py
km_percorridos=float(input("Digite os kilometros percorridos: "))
dias_alugado=int(input("Quantidade de dias q<|fim_mi... | code_fim | hard | {
"lang": "python",
"repo": "Mariliacaps/teste-python",
"path": "/CAP03/EXERCICIO3-14.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mariliacaps/teste-python path: /CAP03/EXERCICIO3-14.py
km_percorridos=float(input("Digite os kilometros percorridos: "))
dias_alugado=int(input("Quantidade de dias q<|fim_suffix|>m
print("O valor a pagar por dias locado fica R$%5.2f e o valor pela quantidade de Km rodados fica R$%5.2f"%(aluguel,v... | code_fim | medium | {
"lang": "python",
"repo": "Mariliacaps/teste-python",
"path": "/CAP03/EXERCICIO3-14.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print ("Scaling cluster at address %s now."%cluster.scheduler_address)
cluster.scale(25)
with open('scheduler_address.txt', 'w') as f:
f.write(str(cluster.scheduler_address))
c = Client(cluster)<|fim_prefix|># repo: tuongphung/tW_scattering path: /start_cluster.py
import os
from dask.distributed ... | code_fim | hard | {
"lang": "python",
"repo": "tuongphung/tW_scattering",
"path": "/start_cluster.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> logs = client.get_worker_logs()
return list(logs.keys())
def getAllWarnings( client ):
logs = client.get_worker_logs()
workers = getWorkers( client )
for worker in workers:
for log in logs[worker]:
if log[0] == 'WARNING' or log[0] == 'ERROR':
print ... | code_fim | medium | {
"lang": "python",
"repo": "tuongphung/tW_scattering",
"path": "/start_cluster.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tuongphung/tW_scattering path: /start_cluster.py
import os
from dask.distributed import Client
import distributed
from Tools.condor_utils import make_htcondor_cluster
from dask.distributed import Client, progress
def getWorkers( client ):
logs = client.get_worker_logs()
return list(lo... | code_fim | hard | {
"lang": "python",
"repo": "tuongphung/tW_scattering",
"path": "/start_cluster.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Strideradu/PacbioDownsample path: /downsample.py
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 29 21:28:10 2016
downsample pacbio data by assign each read a probablity based on the read length
@author: Nan
"""
from Bio import SeqIO
import numpy as np
from scipy.stats import lognorm
import matp... | code_fim | hard | {
"lang": "python",
"repo": "Strideradu/PacbioDownsample",
"path": "/downsample.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> i += 1
SeqIO.write(target_seq, "D:/Data/20161229/target.fastq", "fastq")
"""
x_fit = np.linspace(data.min(),data.max(),100)
pdf_fitted = lognorm.pdf(x_fit, sigma, loc, scale)
print lognorm.pdf(10000, sigma, loc, scale)
plt.plot(x_fit, pdf_fitted)
plt.show()
"""<|fim_prefix|>... | code_fim | hard | {
"lang": "python",
"repo": "Strideradu/PacbioDownsample",
"path": "/downsample.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SS4G/JP2020 path: /algo/257.py
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def binaryTreePaths(self, root):
<|fim... | code_fim | hard | {
"lang": "python",
"repo": "SS4G/JP2020",
"path": "/algo/257.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if root is None:
return
elif root.left is None and root.right is None:
path_stack.append(str(root.val))
paths.append("->".join(path_stack))
path_stack.pop()
else:
path_stack.append(str(root.val))
self.helper(ro... | code_fim | medium | {
"lang": "python",
"repo": "SS4G/JP2020",
"path": "/algo/257.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>columnlist = ['current', 'old']
df.columns = columnlist
print(df)
df.to_sql('match1719', engine)
print('Success')
#if key == dict1718[value]:
# newline = [key, value]
# print(newline)
"""
outputtable = []
for row in inserttable[1:]:
specelements = []
for element in row[... | code_fim | hard | {
"lang": "python",
"repo": "michielsd/hoodassembly",
"path": "/Uitvoer_shape/jaaroverslaan.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> newline = [code19, ";".join(code17)]
comp1719.append(newline)
df = pd.DataFrame(comp1719)
columnlist = ['current', 'old']
df.columns = columnlist
print(df)
df.to_sql('match1719', engine)
print('Success')
#if key == dict1718[value]:
# newline = [key, value]
# print... | code_fim | hard | {
"lang": "python",
"repo": "michielsd/hoodassembly",
"path": "/Uitvoer_shape/jaaroverslaan.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michielsd/hoodassembly path: /Uitvoer_shape/jaaroverslaan.py
from sqlalchemy import create_engine
import pandas as pd
import csv
import psycopg2
# setup psycopg2 and engine
try:
conn = psycopg2.connect("dbname='dbbuurt' user='buurtuser' host='localhost' password='123456'")
print("Databas... | code_fim | hard | {
"lang": "python",
"repo": "michielsd/hoodassembly",
"path": "/Uitvoer_shape/jaaroverslaan.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> classes = [NoMetaSpider, NoStartSpider]
for cls in classes:
with self.assertRaises(AttributeError):
spider = cls()
try:
spider = GoodSpider()
except AttributeError:
self.fail("GoodSpider raised SWOSpiderValidationError whe... | code_fim | hard | {
"lang": "python",
"repo": "gh0std4ncer/scrapyz",
"path": "/scrapyz/test/test_generic_spider.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gh0std4ncer/scrapyz path: /scrapyz/test/test_generic_spider.py
import unittest
from scrapyz.util import JsonSelector
from util import fake_response
from spiders import *
class TestGenericSpiders(unittest.TestCase):
"""
Tests the basic functionality of GenericSpider.
"""
expe... | code_fim | hard | {
"lang": "python",
"repo": "gh0std4ncer/scrapyz",
"path": "/scrapyz/test/test_generic_spider.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wyljpn/LeetCodeTest path: /雅虎编程202020505/第二题.py
# ベストセラー2
# 编程挑战说明:
# 一週間にN個の購買履歴データがあります。
# それぞれの購買履歴データは購入日、商品名、単価、個数からなり、購入日が古いものから順番に並んでいます。
# 1日ごとに合計の購入個数が一番おおい商品を、日付と個数とともに表示してください。
# 結果は日付の昇順で表示してください。
# ただし1日の購入個数が等しい商品が複数ある場合は、そのすべての商品を商品名の昇順で表示してください。
# ある1日に1個も商品が売れなかった場合は、その日の結果を表示する必... | code_fim | hard | {
"lang": "python",
"repo": "wyljpn/LeetCodeTest",
"path": "/雅虎编程202020505/第二题.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> map_r = {}
local_max = 0
pre_date = date
price, num = int(price), int(num)
if (date, item) not in map_r:
map_r[(date, item)] = num
count += 1
else:
map_r[(date, item)] += num
local_max = max(map_r[(date, ... | code_fim | hard | {
"lang": "python",
"repo": "wyljpn/LeetCodeTest",
"path": "/雅虎编程202020505/第二题.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LazyNeko1/nbapi-py path: /versions/raw/nbapi-1.9.0.1.3/lib/nbapi/__init__.py
import rimg as RIMG
import apil as APIL
import simg as SIMG
from random import randint
class random:
def anime(source=False, min="1", max=False, check=True):
out = RIMG.random.anime(source=source,min=mi... | code_fim | hard | {
"lang": "python",
"repo": "LazyNeko1/nbapi-py",
"path": "/versions/raw/nbapi-1.9.0.1.3/lib/nbapi/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#print(search.neko(randint(1,10),True)) #DEBUG 2 (SEARCH WITH SOURCE)
#print(random.anime()) #CHECK FOR SOURCE-ONLY!
def version():
return str(open("version.txt", "r").read())<|fim_prefix|># repo: LazyNeko1/nbapi-py path: /versions/raw/nbapi-1.9.0.1.3/lib/nbapi/__init__.py
import rimg as RIM... | code_fim | hard | {
"lang": "python",
"repo": "LazyNeko1/nbapi-py",
"path": "/versions/raw/nbapi-1.9.0.1.3/lib/nbapi/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class PrivateEventAdmin(EventChildAdmin):
base_model = PrivateEvent
show_in_index = True
list_display = ('name','category','nextOccurrenceTime','firstOccurrenceTime','location_given','displayToGroup')
list_filter = ('category','displayToGroup','location','locationString')
search_fiel... | code_fim | hard | {
"lang": "python",
"repo": "NorthIsUp/django-danceschool",
"path": "/danceschool/private_events/admin.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: emmanguyen102/CS100 path: /Week6/nimet.py
def reverse_name(str):
"""
Return a string that does not have a comma in between names
and in order: First_name Last_name
:param st<|fim_suffix|>f str[0] == "" and str[1] == "":
return ""
else:
str = ... | code_fim | hard | {
"lang": "python",
"repo": "emmanguyen102/CS100",
"path": "/Week6/nimet.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>e:
str=str.split(",")
if str[0] == "":
return str[1]
elif str[1] == "":
return str[0]
elif str[0] == "" and str[1] == "":
return ""
else:
str = str[1].strip() + " " + str[0].strip()
return(str)<|f... | code_fim | medium | {
"lang": "python",
"repo": "emmanguyen102/CS100",
"path": "/Week6/nimet.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Flete',
fields=[
('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)),
],
),
migrations.CreateModel(
name='TipoRenta',
... | code_fim | hard | {
"lang": "python",
"repo": "solidfounds/SRTodo001",
"path": "/vistas/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: solidfounds/SRTodo001 path: /vistas/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Fle... | code_fim | hard | {
"lang": "python",
"repo": "solidfounds/SRTodo001",
"path": "/vistas/migrations/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RYUHYEONGSEOK/RHS path: /CrazyArcade_Packaging/Object_Player.py
# coding: cp949
from pico2d import *
import time
import Scene_NormalStage
import Scene_BossStage
import Manager_Collision
import Manager_Sound
import Object
import Object_Bubble
import Object_Item
class Player(Object.GameObject):... | code_fim | hard | {
"lang": "python",
"repo": "RYUHYEONGSEOK/RHS",
"path": "/CrazyArcade_Packaging/Object_Player.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def draw(self):
if self.isBushCheck == True:
pass
#�������� �����ϴ� �������� X��ǥ, Y��ǥ(Y��ǥ�� �Ʒ������� 1) => ���� �Ʒ����� ������ ������ �ϳ��� ��
else:
self.player_image.clip_draw((self.frame * self.image_size), 560 - ((self.frameScene + 1) * self.ima... | code_fim | hard | {
"lang": "python",
"repo": "RYUHYEONGSEOK/RHS",
"path": "/CrazyArcade_Packaging/Object_Player.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_variables(self):
"""Return vector with compartment values"""
return [self.g_t, self.m_t]
def set_variables(self, g_t, m_t):
"""Given vector with compartment values - Set model variables"""
self.g_t, self.m_t = g_t, m_t
return
def glucose_c1(self, g_t, t_G, a_G, d_g_t=... | code_fim | hard | {
"lang": "python",
"repo": "ThonyPrice/Master_Thesis",
"path": "/src/HvorkaGlucoseModel.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ThonyPrice/Master_Thesis path: /src/HvorkaGlucoseModel.py
class HvorkaGlucoseModel(object):
"""Two compartment insulin model
Source and parameters: https://iopscience-iop-org.focus.lib.kth.se/
article/10.1088/0967-3334/25/4/010/meta
"""
def __init__(self)... | code_fim | hard | {
"lang": "python",
"repo": "ThonyPrice/Master_Thesis",
"path": "/src/HvorkaGlucoseModel.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EDjur/yelp_marketing_science path: /analysis/regression.py
import matplotlib.pyplot as plt
import datetime
from sklearn.svm import SVR
from util.data_io import load_csv
def svr(df):
# Use only one feature
df_X = df.distance_from_central.values
df_X = df_X.reshape(len(df_X), 1)
... | code_fim | hard | {
"lang": "python",
"repo": "EDjur/yelp_marketing_science",
"path": "/analysis/regression.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def group_by_distance(df):
"""
Ugly way of filtering and grouping by distance.
Pandas doesnt seem to allow returning a groupby object from a filter operation, therefore code makes the call twice
"""
grouped_df = df.groupby('distance_from_central', as_index=False)
grouped_df = group... | code_fim | medium | {
"lang": "python",
"repo": "EDjur/yelp_marketing_science",
"path": "/analysis/regression.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>start_time = time.time()
while True:
server.serveonce()<|fim_prefix|># repo: AlexVestin/GameJam path: /server/main.py
from server import SimpleServer
from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket
import time
<|fim_middle|>server = SimpleWebSocketServer('0.0.0.0', 8000, SimpleSer... | code_fim | medium | {
"lang": "python",
"repo": "AlexVestin/GameJam",
"path": "/server/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlexVestin/GameJam path: /server/main.py
from server import SimpleServer
from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket
import time
<|fim_suffix|>start_time = time.time()
while True:
server.serveonce()<|fim_middle|>server = SimpleWebSocketServer('0.0.0.0', 8000, SimpleSer... | code_fim | medium | {
"lang": "python",
"repo": "AlexVestin/GameJam",
"path": "/server/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
n = 5
x = 3
y = 4
print(findWinner(x, y, n))
n = 2
x = 3
y = 4
print(findWinner(x, y, n))<|fim_prefix|># repo: Snehal2605/Technical-Interview-Preparation path: /ProblemSolving/450DSA/Python/src/dynamicprogramming/CoinGameWinner.py
"""
@author A... | code_fim | hard | {
"lang": "python",
"repo": "Snehal2605/Technical-Interview-Preparation",
"path": "/ProblemSolving/450DSA/Python/src/dynamicprogramming/CoinGameWinner.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Snehal2605/Technical-Interview-Preparation path: /ProblemSolving/450DSA/Python/src/dynamicprogramming/CoinGameWinner.py
"""
@author Anirudh Sharma
A and B are playing a game. At the beginning there are n coins. Given two more numbers x and y.
In each move a player can pick x or y or 1 coins. A al... | code_fim | hard | {
"lang": "python",
"repo": "Snehal2605/Technical-Interview-Preparation",
"path": "/ProblemSolving/450DSA/Python/src/dynamicprogramming/CoinGameWinner.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: smilu97/simple-snake path: /snake/core_serializer.py
# author: smilu97
# description: serialize states in core
import numpy as np
state_code = ['blank', 'tails', 'head', 'food']
def serialize(core):
<|fim_suffix|> return x + y * w
for pos in core.trails:
state[pos] = 1
... | code_fim | medium | {
"lang": "python",
"repo": "smilu97/simple-snake",
"path": "/snake/core_serializer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def serialize(core):
w = core.max_x + 1
h = core.max_y + 1
state = np.zeros((w, h), np.int32)
def getidx(x, y):
return x + y * w
for pos in core.trails:
state[pos] = 1
state[core.x, core.y] = 2
state[core.fx, core.fy] = 3
return state<|fim_prefix|># r... | code_fim | easy | {
"lang": "python",
"repo": "smilu97/simple-snake",
"path": "/snake/core_serializer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>event = api.model('Event', {
'type': fields.String(required=True, example="singleton"),
'name': fields.String(required=True, example="test"),
'workers': fields.List(fields.String(example="selenium"))
})
config = api.model('Config', {
'fieldname': fields.String(required=True, example="webs... | code_fim | hard | {
"lang": "python",
"repo": "Yaleesa/project-Monarch",
"path": "/services/workers-app/app/api/api_orchestrator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yaleesa/project-Monarch path: /services/workers-app/app/api/api_orchestrator.py
from app.worker_pool.wo_selenium import SeleniumTaskHandler, SeleniumWorkerSession
from app.core.core_orchestrator import RequestWorkers, WorkerAvailability
from flask import Flask, jsonify, abort, request, make_respo... | code_fim | hard | {
"lang": "python",
"repo": "Yaleesa/project-Monarch",
"path": "/services/workers-app/app/api/api_orchestrator.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>parser = api.parser()
parser.add_argument(
'post body',
type=dict,
location='json',
help='post body JSON',
required=True
)
#@api.doc(parser=parser)
@api.doc(model=payload)
@api.route('/', methods=["POST"])
class OrchestratorAPI(Resource):
@api.expect(payload)
def post(self):
... | code_fim | hard | {
"lang": "python",
"repo": "Yaleesa/project-Monarch",
"path": "/services/workers-app/app/api/api_orchestrator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andresmao/pandasglue path: /pandasglue/__init__.py
from .read import read
from .write import write
def read_glue(
query, database, s3_output, region=None, key=None, secret=None, profile_name=None
):
return read(
query=query,
database=database,
s3_output=s3_output... | code_fim | medium | {
"lang": "python",
"repo": "andresmao/pandasglue",
"path": "/pandasglue/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> df,
database,
table,
path,
partition_cols=[],
preserve_index=True,
region=None,
key=None,
secret=None,
profile_name=None,
):
return write(
df=df,
database=database,
table=table,
path=path,
partition_cols=partition_cols,
... | code_fim | medium | {
"lang": "python",
"repo": "andresmao/pandasglue",
"path": "/pandasglue/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> __metaclass__ = ABCMeta
@abstractmethod
def interpolate(self, image):
""" gets the value of the signal at the specific point,
as the signal is discrete it will be interpolated
"""
return<|fim_prefix|># repo: neurokernel/retina path: /retina/screen/transfor... | code_fim | easy | {
"lang": "python",
"repo": "neurokernel/retina",
"path": "/retina/screen/transform/signaltransform.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __start_search(self):
""" Нажатие на кнопку запуска поиска """
self.click_on_element(*HeaderPageLocators.SEARCH_BUTTON)<|fim_prefix|># repo: LesyaLesya/python_qa_otus path: /lesson18/pages/header_page.py
from lesson18.pages.base_page import BasePage
from lesson18.pages.locators im... | code_fim | hard | {
"lang": "python",
"repo": "LesyaLesya/python_qa_otus",
"path": "/lesson18/pages/header_page.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LesyaLesya/python_qa_otus path: /lesson18/pages/header_page.py
from lesson18.pages.base_page import BasePage
from lesson18.pages.locators import HeaderPageLocators
class HeaderPage(BasePage):
def search(self, txt):
""" Поиск по сайту """
self.__should_be_search_input()
... | code_fim | medium | {
"lang": "python",
"repo": "LesyaLesya/python_qa_otus",
"path": "/lesson18/pages/header_page.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
归并排序,先拆分再合并
拆分过程
递归
:param ls:
:return:
"""
if len(ls) <= 1:
return ls
middle = int(len(ls) / 2)
left = merge_sort(ls[:middle])
right = merge_sort(ls[middle:])
return merge(left, right)
if __name__ == "__main__":
a = [4, 7, 8, 3, 5, 9]
... | code_fim | medium | {
"lang": "python",
"repo": "liying123456/python_leetcode",
"path": "/sort/mergeSort.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liying123456/python_leetcode path: /sort/mergeSort.py
# 合并排序
# 时间复杂度, 最坏情况, 最好情况, 空间复杂度
# O(nlogn), O(nlogn), O(nlogn), O(n)
def merge(l, r):
"""
合并的过程
:param l:
:param r:
:return:
"""
new_list = []
tag_l = 0
tag_r = 0
while tag_l < len(l) and tag_r... | code_fim | medium | {
"lang": "python",
"repo": "liying123456/python_leetcode",
"path": "/sort/mergeSort.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if avg is not None:
r_avg = result_dict(avg)
r_sum = sum_dict(avg, count)
return r_count, r_avg, r_sum
def avg_errors(baseline, pred, ground_truth):
avg_improvement = None
sum_improvement = None
if isinstance(pred[0], list):
b_count, b_avg, b_sum = result_di... | code_fim | hard | {
"lang": "python",
"repo": "DataManagementLab/restore",
"path": "/evaluation/notebook_utils/evaluation_columns.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if evaluation_method == 'relative_error':
fp_opt, removal_method, removal_attr, _pred_baseline, _pred_mean, _actual_mean, _actual_no_tuples, _baseline_no_tuples, _sum_tuples = eval_list
if metric == Metric.RERR_RED:
return rel_err_reduction(_pred_baseline, _pred_mean, _actu... | code_fim | hard | {
"lang": "python",
"repo": "DataManagementLab/restore",
"path": "/evaluation/notebook_utils/evaluation_columns.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DataManagementLab/restore path: /evaluation/notebook_utils/evaluation_columns.py
from ast import literal_eval
from enum import Enum
import numpy as np
from evaluation.relative_error.rerr_reduction import rel_err_reduction
class Metric(Enum):
# Relative Error Reduction
RERR_RED = 'nae_... | code_fim | hard | {
"lang": "python",
"repo": "DataManagementLab/restore",
"path": "/evaluation/notebook_utils/evaluation_columns.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hamid-Sarraf/spectrum-filter path: /build/lib/tomopy_cli/prep.py
import os
import json
import tomopy
import dxchange
import numpy as np
from tomopy_cli import log
from tomopy_cli import file_io
from tomopy_cli import prep
from tomopy_cli import beamhardening
def all(proj, flat, dark, params, si... | code_fim | hard | {
"lang": "python",
"repo": "Hamid-Sarraf/spectrum-filter",
"path": "/build/lib/tomopy_cli/prep.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def minus_log(data, params):
log.info(" *** minus log")
if(params.minus_log):
log.info(' *** *** ON')
data = tomopy.minus_log(data)
else:
log.warning(' *** *** OFF')
return data
def beamhardening_correct(data, params, sino):
"""
Performs beam hardening... | code_fim | hard | {
"lang": "python",
"repo": "Hamid-Sarraf/spectrum-filter",
"path": "/build/lib/tomopy_cli/prep.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> res_file_name = res_file_prefix + abq_name + ".json"
with open(self.json_path + "/" + res_file_name, "r") as f:
d = json.load(f)
print("bound_stderr=", d['bound_stderr'])
# factor = self.step_factor * random() + 0.05
factor =... | code_fim | hard | {
"lang": "python",
"repo": "aweffr/auto-grid",
"path": "/src/auto_iter.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aweffr/auto-grid path: /src/auto_iter.py
from .utils import *
class Project(object):
# json_path = "E:/AbaqusDir/auto/output"
# abaqus_dir = "E:/AbaqusDir/sym-40/abaqus-files"
abaqus_exe_path = "C:/SIMULIA/Abaqus/6.14-2/code/bin/abq6142.exe"
script_path = "E:/AbaqusDir/auto/abaq... | code_fim | hard | {
"lang": "python",
"repo": "aweffr/auto-grid",
"path": "/src/auto_iter.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: athiullah007/Python-for-beginners path: /hangman.py
import time
name=input (print("What's your name?"))
print("Hello "+name,"Time to play hangman!")
time.sleep(1)
print ("Start guessing...")
time.sleep(0.5)
word= str (input(print("Enter any word: ")))
print ("The length of the word is: ")
print (... | code_fim | hard | {
"lang": "python",
"repo": "athiullah007/Python-for-beginners",
"path": "/hangman.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tvorogme/printer path: /config.py
buttons = [
'й', 'ц', 'у', 'к', 'е', 'н', 'г', 'ш', 'щ', 'з', 'х', 'ъ',
'ф', 'ы', 'в', 'а', 'п', 'р', 'о', 'л', 'д', 'ж', 'э',
'я', 'ч', 'с', 'м', 'и', 'т', 'ь', 'б', 'ю', '-', 'ё',
'ПРОБЕЛ', 'СТЕРЕТЬ', 'ЗАГЛАВН', 'ПЕЧАТЬ'
]
<|fim_suffix|>button_... | code_fim | medium | {
"lang": "python",
"repo": "tvorogme/printer",
"path": "/config.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>button_size = 3
button_height = 3
big_button_size = 8
padx = 3
pady = 1 # on css words = margin
bd = 1 # ???
x_padding = (20, 0)
default = 'Фамилия Имя'<|fim_prefix|># repo: tvorogme/printer path: /config.py
buttons = [
'й', 'ц', 'у', 'к', 'е', 'н', 'г', 'ш', 'щ', 'з', 'х', 'ъ',
'ф', 'ы', 'в'... | code_fim | medium | {
"lang": "python",
"repo": "tvorogme/printer",
"path": "/config.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ThinkEE/Kameleon path: /kameleon/model/base.py
################################################################################
# MIT License
#
# Copyright (c) 2017 Jean-Charles Fosse & Johann Bigler
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softwa... | code_fim | hard | {
"lang": "python",
"repo": "ThinkEE/Kameleon",
"path": "/kameleon/model/base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
@inlineCallbacks
def delete_table(cls, *args, **kwargs):
"""
Deletes table from database
"""
operation = cls._meta.database.delete_table(cls._meta.table_name)
yield cls._meta.database.runOperation(operation)
@classmethod
@inlineCall... | code_fim | hard | {
"lang": "python",
"repo": "ThinkEE/Kameleon",
"path": "/kameleon/model/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LucasSteffens5/Classificacao-de-lesoes-de-pele-em-possiveis-canceres path: /tranferenciaAprendizadoSVMLesoesDePele.py
import numpy as np
import matplotlib.pyplot as plt
from sklearn.svm import SVC, LinearSVC
from sklearn.model_selection import learning_curve
from sklearn.model_selection impor... | code_fim | hard | {
"lang": "python",
"repo": "LucasSteffens5/Classificacao-de-lesoes-de-pele-em-possiveis-canceres",
"path": "/tranferenciaAprendizadoSVMLesoesDePele.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>fig, eixos = plt.subplots(3, 2, figsize=(10, 15))
# Carrega CNN utilizada para transferência de aprendizado, removendo a camada totalmente conectada
base_modelo = Xception(weights='imagenet') # Para utilizar a Xception basta alterar o nome do modelo
base_modelo.summary()
modelo = Model(inputs = base... | code_fim | hard | {
"lang": "python",
"repo": "LucasSteffens5/Classificacao-de-lesoes-de-pele-em-possiveis-canceres",
"path": "/tranferenciaAprendizadoSVMLesoesDePele.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#Concatena os dados de treinamento e validação para realizar a validação cruzada
vetoresCaracteristicaSVM = np.concatenate((vetoresCaracteristicaTreinamento, vetoresCaracteristicaValidacao))
rotulosSVM = np.concatenate((rotulosTreinamento, rotulosValidacao))
#Realiza o particionamento para valida... | code_fim | hard | {
"lang": "python",
"repo": "LucasSteffens5/Classificacao-de-lesoes-de-pele-em-possiveis-canceres",
"path": "/tranferenciaAprendizadoSVMLesoesDePele.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: petro-rudenko/hue path: /desktop/libs/libsentry/src/libsentry/api.py
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc.... | code_fim | hard | {
"lang": "python",
"repo": "petro-rudenko/hue",
"path": "/desktop/libs/libsentry/src/libsentry/api.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def drop_sentry_privileges(self, authorizableHierarchy):
response = self.client.drop_sentry_privilege(authorizableHierarchy)
if response.status.value == 0:
return response
else:
raise SentryException(response)
def rename_sentry_privileges(self, oldAuthorizable, newAuthoriza... | code_fim | hard | {
"lang": "python",
"repo": "petro-rudenko/hue",
"path": "/desktop/libs/libsentry/src/libsentry/api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TheZenMind07/Algo-Trader path: /app/algos/kc_pattern_scanner.py
/code/Projects/Django-Dashboard/boilerplate-code-django-dashboard/app/algos")
#generate trading session
access_token = open("access_token.txt",'r').read()
key_secret = open("api_key.txt",'r').read().split()
kite = KiteConnect(a... | code_fim | hard | {
"lang": "python",
"repo": "TheZenMind07/Algo-Trader",
"path": "/app/algos/kc_pattern_scanner.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.