text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>eturn render_template("bmi_calc.html", bmi=bmi, condition = "You are Underweight")
elif 18.5 <= bmi <25:
return render_template("bmi_calc.html", bmi=bmi, condition = "You are Normal")
elif 25 <= bmi <30:
return render_template("bmi_calc.html", bmi=bmi, condition =... | code_fim | hard | {
"lang": "python",
"repo": "levuhachi/levuhachi-web-c4e23",
"path": "/Web1/homework/EX1-bmi-calculator-master/upgraded_ex1_bmi.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> obj = ElasticObj("bupt", "novel")
# obj.create_index()
spider = DdSpider('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0')
spider1 = DdSpider('Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36')
page ... | code_fim | medium | {
"lang": "python",
"repo": "qqxhb/ZNovel",
"path": "/owllook/spiders/spider_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qqxhb/ZNovel path: /owllook/spiders/spider_test.py
# !/usr/bin/env python
import os
import sys
import time
from owllook.database.es import ElasticObj
from owllook.spiders import DdSpider
# from owllook.spiders import QidianNovelSpider
os.environ['MODE'] = 'PRO'
sys.path.append('../../')
<|fim_su... | code_fim | hard | {
"lang": "python",
"repo": "qqxhb/ZNovel",
"path": "/owllook/spiders/spider_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# def qidian_spider():
# obj = ElasticObj("bupt", "novel")
# obj.create_index()
# spider = QidianNovelSpider('qidian_novel')
# for data in spider.parse():
# if data:
# obj.Index_Item(data)
# else:
# break
def main():
print("start============")
... | code_fim | hard | {
"lang": "python",
"repo": "qqxhb/ZNovel",
"path": "/owllook/spiders/spider_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DiegoCacau/pythonTests path: /PyQt/gauge.py
#Based on:
#https://wiki.python.org/moin/PyQt/Compass%20widget
#https://stackoverflow.com/questions/12011147/how-to-create-a-3-color-gradient-dial-indicator-the-one-that-shows-green-yellow
import sys
from PyQt4.QtGui import QVBoxLayout, QSlider, QSizeP... | code_fim | hard | {
"lang": "python",
"repo": "DiegoCacau/pythonTests",
"path": "/PyQt/gauge.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> gauge_rect = QRect(rect)
size = gauge_rect.size()
pos = gauge_rect.center()
gauge_rect.moveCenter( QPoint(pos.x()-size.width(), pos.y()-size.height()) )
gauge_rect.setSize(size*.9)
gauge_rect.moveCenter(pos)
painter.save()
painter.setBrush(Q... | code_fim | hard | {
"lang": "python",
"repo": "DiegoCacau/pythonTests",
"path": "/PyQt/gauge.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mattlangford/software-common-depricated path: /uf_common/scripts/interactive_marker_moveto
#!/usr/bin/env python
import roslib; roslib.load_manifest('c3_trajectory_generator')
import rospy
import actionlib
import tf
from tf import transformations
from std_msgs.msg import Header
from visualizati... | code_fim | hard | {
"lang": "python",
"repo": "mattlangford/software-common-depricated",
"path": "/uf_common/scripts/interactive_marker_moveto",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setup_markers(self):
while not rospy.is_shutdown():
try:
self._tf_listener.waitForTransform('map', 'base_link',
rospy.Time(0), rospy.Duration(1))
trans, rot = self._tf_listener.lookupTransform('m... | code_fim | hard | {
"lang": "python",
"repo": "mattlangford/software-common-depricated",
"path": "/uf_common/scripts/interactive_marker_moveto",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_handler(self):
self.resource.offering.type = PLUGIN_NAME
self.resource.offering.save()
# add usage-based component to the offering and plan
COMPONENT_TYPE = 'storage'
new_component = factories.OfferingComponentFactory(
offering=self.resourc... | code_fim | hard | {
"lang": "python",
"repo": "virtengine/ve-waldur-v2",
"path": "/src/waldur_mastermind/marketplace/tests/test_stats.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: virtengine/ve-waldur-v2 path: /src/waldur_mastermind/marketplace/tests/test_stats.py
ts import fixtures as structure_fixtures
from waldur_mastermind.common.mixins import UnitPriceMixin
from waldur_mastermind.common.utils import parse_date, parse_datetime
from waldur_mastermind.invoices import mod... | code_fim | hard | {
"lang": "python",
"repo": "virtengine/ve-waldur-v2",
"path": "/src/waldur_mastermind/marketplace/tests/test_stats.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: virtengine/ve-waldur-v2 path: /src/waldur_mastermind/marketplace/tests/test_stats.py
ertEqual(result.status_code, status.HTTP_401_UNAUTHORIZED)
@freeze_time('2020-03-01')
class ComponentStatsTest(StatsBaseTest):
def setUp(self):
super().setUp()
self.url = factories.OfferingF... | code_fim | hard | {
"lang": "python",
"repo": "virtengine/ve-waldur-v2",
"path": "/src/waldur_mastermind/marketplace/tests/test_stats.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def addReplicas(self, replicas):
"Add replicas to current analysis"
if not isinstance(replicas, list): replicas = [replicas]
# Check al memebers are replicas
for i in replicas:
if not isinstance(i, Replica):
raise ActionsManagerError, "Expec... | code_fim | hard | {
"lang": "python",
"repo": "CBDD/pyMDmix",
"path": "/pyMDMix/Analysis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def addActions(self, analysis):
"Add analysis actions to run on each replica"
if not isinstance(analysis, list): analysis = [analysis]
# Check all memebers are Actions
actions = []
for act in analysis:
if isinstance(act, str):
a = gl... | code_fim | hard | {
"lang": "python",
"repo": "CBDD/pyMDmix",
"path": "/pyMDMix/Analysis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CBDD/pyMDmix path: /pyMDMix/Analysis.py
## ------------------------ pyMDMix -----------------------------------
## http://mdmix.sourceforge.net
## --------------------------------------------------------------------
##
## Software for preparation, analysis and quality control... | code_fim | hard | {
"lang": "python",
"repo": "CBDD/pyMDmix",
"path": "/pyMDMix/Analysis.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> success = is_growing(timestamp_series)
maybe_red_print('timestamp series is%s growing' % ('' if success else ' not'), success)
if not success: result = False
success = is_interval(timestamp_series, 60)
maybe_red_print('timestamp series is%s on an interval of 60 seconds' % ('' if success else ' ... | code_fim | hard | {
"lang": "python",
"repo": "seetherrr/coin-crap",
"path": "/check.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = True
for row_index, x in enumerate(xs):
try:
float(x)
except ValueError:
red_print('series contains non-floatish string "%s" at row %d' % (x, row_index))
result = False
return result
def handle_filename(filename):
result = True
candles_df = pd.read_csv(filenam... | code_fim | medium | {
"lang": "python",
"repo": "seetherrr/coin-crap",
"path": "/check.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seetherrr/coin-crap path: /check.py
import pandas as pd
from functools import partial
import colorama
import sys, math
filenames = sys.argv[1:]
if len(filenames) == 0:
print('please specify some CSVs')
raise SystemExit
def red_print(s):
print('%s%s%s' % (colorama.Fore.RED, s, colorama.Fo... | code_fim | medium | {
"lang": "python",
"repo": "seetherrr/coin-crap",
"path": "/check.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'type': 'VisibleString'},
None,
{'name': 'serialNumber',
'type': 'INTEGER'},
... | code_fim | hard | {
"lang": "python",
"repo": "eerimoq/asn1tools",
"path": "/tests/files/x680.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lue': 'unidentified'},
'firstDay-E-2-3': {'type': 'DayOfTheWeek-E-2-3',
'value': 'sunday'},
'firstTwo-E-2-10': {'type': 'NamesOfMemberNations-E-2-10',
'value': '{'},
... | code_fim | hard | {
"lang": "python",
"repo": "eerimoq/asn1tools",
"path": "/tests/files/x680.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eerimoq/asn1tools path: /tests/files/x680.py
: 'VisibleString'},
{'name': 'initial',
'type': 'VisibleString'},
{'name': 'familyName',
... | code_fim | hard | {
"lang": "python",
"repo": "eerimoq/asn1tools",
"path": "/tests/files/x680.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def show_frame_opencv(self, img):
cv2.imshow('image',img)
cv2.waitKey(1)<|fim_prefix|># repo: SikanderBinMukaram/SimpleSlam path: /Display.py
import pygame
from pygame.locals import DOUBLEBUF as DB
import cv2
<|fim_middle|>class DisplayImage(object):
def __init__(self, W,H):
pygame.init()
sel... | code_fim | hard | {
"lang": "python",
"repo": "SikanderBinMukaram/SimpleSlam",
"path": "/Display.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SikanderBinMukaram/SimpleSlam path: /Display.py
import pygame
from pygame.locals import DOUBLEBUF as DB
import cv2
<|fim_suffix|> def __init__(self, W,H):
pygame.init()
self.screen = pygame.display.set_mode((W,H),DB)
self.surface = pygame.Surface(self.screen.get_size()).convert()
def ... | code_fim | medium | {
"lang": "python",
"repo": "SikanderBinMukaram/SimpleSlam",
"path": "/Display.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mandrewcito/GEI-DLP path: /p1/haskell/crea_grafo.py
#/usr/bin/env python
# -*- cofing: utf-8 -*-
import os
f=open("config.txt")
fichero=f.read()
lineas=fichero.split("\n")
estados=lineas[0][1:len(lineas[0])-1]
estados=estados.split(",")
nuevos=[]
for e in estados:
nuevos.append(e.replace("\"","... | code_fim | hard | {
"lang": "python",
"repo": "mandrewcito/GEI-DLP",
"path": "/p1/haskell/crea_grafo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>="\""+png+"-"+trans[0]+"\"->\""+png+"-"+trans[1]+"\"[label=\""+trans[2]+"\"]"+";\n"
finales=""
for e in estadosFinales:
finales+="\""+png+"-"+e+"\"[peripheries=2];\n"
inicial="node [style=invis]; \""+png+"-00\";\n \""+png+"-00\"->\""+png+"-"+estadoInicial+"\";"
f = open (png+"-conf.txt", "w")
f.write(in... | code_fim | hard | {
"lang": "python",
"repo": "mandrewcito/GEI-DLP",
"path": "/p1/haskell/crea_grafo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hack340/projeto-py path: /excel_reader.py
# -*- coding: utf-8 -*-
"""
Este módulo contem funções para extrair dados das empresas a partir de planilhas em excell.
"""
#imports diversos
import openpyxl
from datetime import date
#Função principal, chamando funções especificas de linha e coluna
d... | code_fim | hard | {
"lang": "python",
"repo": "hack340/projeto-py",
"path": "/excel_reader.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Usado HardCode devido keys iguais usando dicionario
dic_value['CAIXA'] = sheet.cell(25,col).value
dic_value['APLICAÇÕES FINANCEIRAS'] = sheet.cell(26,col).value
dic_value['CONTAS A RECEBER'] = sheet.cell(27,col).value
dic_value['PDD'] = sheet.cell(28,col).value
dic_value['ESTOQUE'... | code_fim | hard | {
"lang": "python",
"repo": "hack340/projeto-py",
"path": "/excel_reader.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Função que varre as linhas para obter dados
def get_rows_data(sheet, col):
dic_value = {}
#Usado HardCode devido keys iguais usando dicionario
dic_value['CAIXA'] = sheet.cell(25,col).value
dic_value['APLICAÇÕES FINANCEIRAS'] = sheet.cell(26,col).value
dic_value['CONTAS A RECEBER'... | code_fim | hard | {
"lang": "python",
"repo": "hack340/projeto-py",
"path": "/excel_reader.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for n in range(num_curves):
y[:,n] = np.sin((n+1) * x * 2 * np.pi)
plt.plot(x,y)
# open and close any extra figures with the below code
plt.figure('Jack')
plt.close('Jack')
# legend embellishment
ax = plt.gca()
ax.legend((r"$\sin(2 \pi x)$",r"$\sin(4 \pi x)$",r"$\sin(6 \pi x)$"))<|fim_prefix|># repo... | code_fim | medium | {
"lang": "python",
"repo": "fkebur/ASGToPython",
"path": "/Chapter4/PlotExamples/YourTurnFourB.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fkebur/ASGToPython path: /Chapter4/PlotExamples/YourTurnFourB.py
# -*- coding: utf-8 -*-
# Python 3.6
# YourTurnFourB.py
"""
Author: Kebur Fantahun
Created: Tue Aug 14 22:12:40 2018
Modified: Tue Aug 14 22:12:40 2018
<|fim_suffix|># open and close any extra figures with the below code
plt.figur... | code_fim | hard | {
"lang": "python",
"repo": "fkebur/ASGToPython",
"path": "/Chapter4/PlotExamples/YourTurnFourB.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mguarascio/best-laid-meal-plans path: /recipes/models.py
from __future__ import unicode_literals
from django.db import models
#from django.contrib.auth.models import User
# class PinUser(models.Model):
# user = models.OneToOneField(User, on_delete=models.CASCADE)
# token = models.CharFi... | code_fim | medium | {
"lang": "python",
"repo": "mguarascio/best-laid-meal-plans",
"path": "/recipes/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class MealDay(models.Model):
date = models.CharField(max_length=20)
def __str__(self):
return self.date
class Meal(models.Model):
url = models.CharField(max_length=200)
image = models.CharField(max_length=200)
title = models.CharField(max_length=200)
meal_day = models.Fo... | code_fim | medium | {
"lang": "python",
"repo": "mguarascio/best-laid-meal-plans",
"path": "/recipes/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thiagovas/Ultimate-Tic-Tac-Toe path: /src/engine/game.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is the main file of the engine of the game.
# In here, the commands are received and the response are sent back
# to whoever sent the command.
from board import Board
class Game:
... | code_fim | hard | {
"lang": "python",
"repo": "thiagovas/Ultimate-Tic-Tac-Toe",
"path": "/src/engine/game.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Making sure the move made by the other player is updated in this instance.
if last_move[0] != -1:
if self.bot_id == 0:
self.small_boards[last_move[0]][last_move[1]].fill(last_move[2],
last_move[3], 'O')
else:
... | code_fim | hard | {
"lang": "python",
"repo": "thiagovas/Ultimate-Tic-Tac-Toe",
"path": "/src/engine/game.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jim-CTChen/block_chain path: /utils.py
import hashlib
import pickle
def encode(str, code='utf-8'):
'''
encode string into bytes by utf-8
'''
return str.encode(code)
def decode(str, code='utf-8'):
<|fim_suffix|> return pickle.dumps(obj)
def deserialize(obj):
return pickle.loads(obj... | code_fim | hard | {
"lang": "python",
"repo": "Jim-CTChen/block_chain",
"path": "/utils.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return pickle.dumps(obj)
def deserialize(obj):
return pickle.loads(obj)
class ContinueIt(Exception):
pass<|fim_prefix|># repo: Jim-CTChen/block_chain path: /utils.py
import hashlib
import pickle
def encode(str, code='utf-8'):
'''
encode string into bytes by utf-8
'''
return str.enco... | code_fim | hard | {
"lang": "python",
"repo": "Jim-CTChen/block_chain",
"path": "/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ando-huang/algorithms path: /summer2020/progAssign2/Solution.py
n = int(input())
pairs = []
for i in range(n):
l = input().strip().split()
if l[0] == "1":
pairs.append(<|fim_suffix|>= -1
for i, x in enumerate(pairs):
if x[0] == l[1]:
answer = ... | code_fim | hard | {
"lang": "python",
"repo": "ando-huang/algorithms",
"path": "/summer2020/progAssign2/Solution.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>(pairs)):
if pairs[i][0] >= a and pairs[i][0] <= b:
pairs[i][1] *= -1
else:
answer = -1
for i, x in enumerate(pairs):
if x[0] == l[1]:
answer = x[1]
print(answer)<|fim_prefix|># repo: ando-huang/algorithms path: /summer20... | code_fim | medium | {
"lang": "python",
"repo": "ando-huang/algorithms",
"path": "/summer2020/progAssign2/Solution.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># pdb.set_trace()
_logger.warning("VOUCHER CREATE: {0}".format(vals))
return super(account_voucher, self).create(vals)
class account_move(models.Model):
_inherit = 'account.move'
@api.model
def create(self, vals):
# pdb.set_trace()
_logger.warning("VOUC... | code_fim | medium | {
"lang": "python",
"repo": "LFer/dtm_pos_classic",
"path": "/models/account_voucher.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LFer/dtm_pos_classic path: /models/account_voucher.py
from openerp import models, fields, _, api
import logging
import ipdb as pdb
_logger = logging.getLogger(__name__)
class account_voucher(models.Model):
_inherit = 'account.voucher'
<|fim_suffix|> _inherit = 'account.move'
@api.... | code_fim | hard | {
"lang": "python",
"repo": "LFer/dtm_pos_classic",
"path": "/models/account_voucher.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ajaysinha26/moviesentimentanalyser path: /src/main/py/movieAnalyser.py
import sys
import tweepy
from textblob import TextBlob
consumer_key = sys.argv[1]
consumer_secret = sys.argv[2]
<|fim_suffix|>movie = sys.argv[5]
public_tweets = api.search(q=movie, count=100)
verdict = 0
count = 0
for tweet... | code_fim | hard | {
"lang": "python",
"repo": "ajaysinha26/moviesentimentanalyser",
"path": "/src/main/py/movieAnalyser.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('***Sentiment of movie is: ', verdict)
print('***No. of tweets analysed: ', count)<|fim_prefix|># repo: ajaysinha26/moviesentimentanalyser path: /src/main/py/movieAnalyser.py
import sys
import tweepy
from textblob import TextBlob
consumer_key = sys.argv[1]
consumer_secret = sys.argv[2]
access_tok... | code_fim | hard | {
"lang": "python",
"repo": "ajaysinha26/moviesentimentanalyser",
"path": "/src/main/py/movieAnalyser.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: opencord/voltha-openonu-adapter path: /python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
new_downstream_gems = self._create_gemports(uni_id, downstream_gems, alloc_id, "DOWNSTREAM")
new_gems = []
new_gems.extend(new_upstream_gems)
... | code_fim | hard | {
"lang": "python",
"repo": "opencord/voltha-openonu-adapter",
"path": "/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.log.debug('loading-device-data-from-mib', device_id=device.id)
omci_dev = self._onu_omci_device
config = omci_dev.configuration
try:
# sort the lists so we get consistent port ordering.
ani_list = sorted(config.ani_g_entities) if config.ani_g_... | code_fim | hard | {
"lang": "python",
"repo": "opencord/voltha-openonu-adapter",
"path": "/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.log.info('setting-vlan-tag', uni_port=uni_port, uni_id=uni_id, tp_id=tp_id, match_vlan=match_vlan,
vlan=_set_vlan_vid, vlan_pcp=_set_vlan_pcp)
vlan_filter_add_task = BrcmVlanFilterTask(self.omci_agent, self, uni_port, _set_vlan_vid,
... | code_fim | hard | {
"lang": "python",
"repo": "opencord/voltha-openonu-adapter",
"path": "/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kcpedrosa/Python-exercises path: /aula019.py
pessoa = {'nome':'Ishsan', 'idade':'600', 'sexo':'M'}
print(pessoa)
print(pessoa['idade'])
print(f'O {pessoa["nome"]} tem {pessoa["idade"]} anos')
print(pessoa.keys())
print(pessoa.val<|fim_suffix|>de Ishsan para Sengir
pessoa['peso']=200
for k, v in p... | code_fim | medium | {
"lang": "python",
"repo": "kcpedrosa/Python-exercises",
"path": "/aula019.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>de Ishsan para Sengir
pessoa['peso']=200
for k, v in pessoa.items():
print(f'{k} = {v}')<|fim_prefix|># repo: kcpedrosa/Python-exercises path: /aula019.py
pessoa = {'nome':'Ishsan', 'idade':'600', 'sexo':'M'}
print(pessoa)
print(pessoa['idade'])
print(f'O {pessoa["nome"]} tem {pessoa["idade"]} anos')... | code_fim | medium | {
"lang": "python",
"repo": "kcpedrosa/Python-exercises",
"path": "/aula019.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('receipts', '0004_auto_20210717_1816'),
('receipts', '0004_auto_20210717_1925'),
]
operations = [
]<|fim_prefix|># repo: Ayazadeh/django_coffee_shop path: /receipts/migrations/0005_merge_0004_auto_20210717_1816_0004_auto_20210717_1925.py
# Generated by ... | code_fim | easy | {
"lang": "python",
"repo": "Ayazadeh/django_coffee_shop",
"path": "/receipts/migrations/0005_merge_0004_auto_20210717_1816_0004_auto_20210717_1925.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ayazadeh/django_coffee_shop path: /receipts/migrations/0005_merge_0004_auto_20210717_1816_0004_auto_20210717_1925.py
# Generated by Django 3.2.5 on 2021-07-22 08:13
from django.db import migrations
<|fim_suffix|> dependencies = [
('receipts', '0004_auto_20210717_1816'),
('rec... | code_fim | easy | {
"lang": "python",
"repo": "Ayazadeh/django_coffee_shop",
"path": "/receipts/migrations/0005_merge_0004_auto_20210717_1816_0004_auto_20210717_1925.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('receipts', '0004_auto_20210717_1816'),
('receipts', '0004_auto_20210717_1925'),
]
operations = [
]<|fim_prefix|># repo: Ayazadeh/django_coffee_shop path: /receipts/migrations/0005_merge_0004_auto_20210717_1816_0004_auto_20210717_1925.py
# Generated by D... | code_fim | easy | {
"lang": "python",
"repo": "Ayazadeh/django_coffee_shop",
"path": "/receipts/migrations/0005_merge_0004_auto_20210717_1816_0004_auto_20210717_1925.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TrellixVulnTeam/Python3_33D8 path: /chainer/image_generator/dataset/bird.py
import glob
import os
import pickle
import random
from collections import Counter
import numpy as np
from dataset.dataset_base import Dataset_Base
from utils.data_downloader import download_file_from_google_drive, downl... | code_fim | hard | {
"lang": "python",
"repo": "TrellixVulnTeam/Python3_33D8",
"path": "/chainer/image_generator/dataset/bird.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not os.path.exists(self.data_path + "/captions"):
print("Info:Extracting caption data from tar file")
import tarfile
with tarfile.open(self.data_path + f"/{file_name}", 'r') as tar_fp:
tar_fp.extractall(self.data_path)
... | code_fim | hard | {
"lang": "python",
"repo": "TrellixVulnTeam/Python3_33D8",
"path": "/chainer/image_generator/dataset/bird.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if os.path.exists(self.data_path + f"/image_data_{img_size}.plk"):
with open(self.data_path + f"/image_data_{img_size}.plk", "rb") as fp:
data = pickle.load(fp)
else:
file_name = "CUB_200_2011.tgz"
url = "http://www.vision.caltech.edu.s3-... | code_fim | hard | {
"lang": "python",
"repo": "TrellixVulnTeam/Python3_33D8",
"path": "/chainer/image_generator/dataset/bird.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gocept/schaukasten path: /backend/schaukasten/db.py
# encoding=utf-8
from sqlalchemy import Column, Integer
from sqlalchemy.types import TypeDecorator, CHAR
from sqlalchemy.dialects.postgresql import UUID
import risclog.sqlalchemy.model
import uuid
ENGINE_NAME = 'schaukasten'
class ObjectBase(... | code_fim | hard | {
"lang": "python",
"repo": "gocept/schaukasten",
"path": "/backend/schaukasten/db.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
impl = CHAR
def load_dialect_impl(self, dialect):
if dialect.name == 'postgresql':
return dialect.type_descriptor(UUID())
else:
return dialect.type_descriptor(CHAR(32))
def process_bind_param(self, value, dialect):
if value is None:
... | code_fim | hard | {
"lang": "python",
"repo": "gocept/schaukasten",
"path": "/backend/schaukasten/db.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def from_std_units_factor(unit_type, unit_from):
return 1.0/UNITS[unit_type][unit_from]<|fim_prefix|># repo: alanquits/awfm_py path: /awfm/core/units.py
UNITS = {
"length": {
"meters": 1.0,
"feet": 0.3048
},
"time": {
"days": 1.0,
"hours": 1/24.0,
"... | code_fim | medium | {
"lang": "python",
"repo": "alanquits/awfm_py",
"path": "/awfm/core/units.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alanquits/awfm_py path: /awfm/core/units.py
UNITS = {
"length": {
"meters": 1.0,
"feet": 0.3048
},
"time": {
"days": 1.0,
"hours": 1/24.0,
"minutes": 1/(24.0*60.0)
},
"discharge": {
"m3/day": 1.0,
"gal/min": 5.451,
... | code_fim | medium | {
"lang": "python",
"repo": "alanquits/awfm_py",
"path": "/awfm/core/units.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: imyzx2017/iCaRL_Experiments path: /draw_average_accuracy_dataset.py
# str_line = line
# writer.writerow(str(str_line))
############################################
for i in range(avg_array_dropout.shape[0]):
avg_array_dropout[i] = np.mean(acc_arr... | code_fim | hard | {
"lang": "python",
"repo": "imyzx2017/iCaRL_Experiments",
"path": "/draw_average_accuracy_dataset.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ######### plotting 1 layers result ##################
elif int(current_model_structure.split('-')[1])==hidden_num and int(current_model_structure.split('-')[-1])==task_num:
input_dim, output_dim = current_model_structure.split('-')[0], current_model_structure.sp... | code_fim | hard | {
"lang": "python",
"repo": "imyzx2017/iCaRL_Experiments",
"path": "/draw_average_accuracy_dataset.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: imyzx2017/iCaRL_Experiments path: /draw_average_accuracy_dataset.py
for idx, each_model_dir in enumerate(os.listdir(dir)):
if 'MLP' in each_model_dir:
current_model_dir = dir + each_model_dir + '/'
current_model_structure = each_model_dir[each_model_dir.fin... | code_fim | hard | {
"lang": "python",
"repo": "imyzx2017/iCaRL_Experiments",
"path": "/draw_average_accuracy_dataset.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#removes the API directory now relavent contents have been removed
os.system("rm -r -f /home/pi/Temperature/Data-Logging")<|fim_prefix|># repo: gw97/Data-Logging path: /updateAPI.py
#script to install latest version from API repository from GitHub
import os
import time
<|fim_middle|>#deletes old prog... | code_fim | hard | {
"lang": "python",
"repo": "gw97/Data-Logging",
"path": "/updateAPI.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gw97/Data-Logging path: /updateAPI.py
#script to install latest version from API repository from GitHub
import os
import time
#deletes old programs
os.system("rm TGpub.py")
os.system("rm VOCGpub.py")
os.system("rm updateAPI.py")
<|fim_suffix|>
#removes the API directory now relavent contents... | code_fim | hard | {
"lang": "python",
"repo": "gw97/Data-Logging",
"path": "/updateAPI.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># add some text for labels, title and axes ticks
X3 = np.arange(8)
xshift = [.3, -.1, .1, -.3, .1, -.1, +.1, -.3]
X3 = [x + xshift[x] for x in X3]
#fst = [x + .1 for x in X[0:4]]
#scd = [x - .3 for x in X[4:8]]
#X = fst + scd
#0 add .1 add .05 equals + .30
#1 add .1 subtract .05 equals + .1
#2 subtra... | code_fim | hard | {
"lang": "python",
"repo": "nyspisoccog/ks_scripts",
"path": "/python_scripts/practicingplotting.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nyspisoccog/ks_scripts path: /python_scripts/practicingplotting.py
__author__ = 'katie'
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.lines as lines
from matplotlib.collections import PatchCollection
import matplotlib.patches as mpatches
#data = [[5., 25., 50., 20.],
... | code_fim | hard | {
"lang": "python",
"repo": "nyspisoccog/ks_scripts",
"path": "/python_scripts/practicingplotting.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
fig, (ax1, ax2, ax3) = plt.subplots(ncols=1, nrows=3)
betastr = u"\u03B2"
# add some text for labels, title and axes ticks
X3 = np.arange(8)
xshift = [.3, -.1, .1, -.3, .1, -.1, +.1, -.3]
X3 = [x + xshift[x] for x in X3]
#fst = [x + .1 for x in X[0:4]]
#scd = [x - .3 for x in X[4:8]]
#X = fst + scd
... | code_fim | hard | {
"lang": "python",
"repo": "nyspisoccog/ks_scripts",
"path": "/python_scripts/practicingplotting.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> mc1 = MC4000()
mc2 = MC6000()
mc1.p0.link(mc2.p1) # Link the ports.
self.assertEqual(0, mc1.p0.read())
self.assertEqual(0, mc2.p1.read())
mc1.p0.write(100)
self.assertEqual(100, mc2.p1.read())
mc1 = MC4000()
mc2 = MC6000()
... | code_fim | medium | {
"lang": "python",
"repo": "Yuffster/mcx4",
"path": "/tests/test_microcontroller.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_get_invalid_port(self):
bad_ports = ['lawl', 'l0', 'python']
for p in bad_ports:
with self.assertRaises(x.PortException):
self.mc.get_port(p)
def test_link_nonport(self):
with self.assertRaises(TypeError):
self.mc.p0.link(se... | code_fim | hard | {
"lang": "python",
"repo": "Yuffster/mcx4",
"path": "/tests/test_microcontroller.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yuffster/mcx4 path: /tests/test_microcontroller.py
import unittest
from mcx4.microcontrollers import Microcontroller, MC4000, MC6000
from mcx4.interfaces import GPIO, XBUS, Register, Interface
import mcx4.exceptions as x
class MicrocontrollerTestCase(unittest.TestCase):
def setUp(self):
... | code_fim | hard | {
"lang": "python",
"repo": "Yuffster/mcx4",
"path": "/tests/test_microcontroller.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xcginkgo/python_file path: /20190902_01.py
if True:
_str1 = "string"
print(_str1)
#错误2
_1024 = 1024
print(_1024)
<|fim_suffix|> #错误3
False_define_by_myself = False
print(False_define_by_myself)
#在此处输出保留关键字
print("['False', 'None', 'True', 'and', 'as', 'a... | code_fim | medium | {
"lang": "python",
"repo": "xcginkgo/python_file",
"path": "/20190902_01.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #错误3
False_define_by_myself = False
print(False_define_by_myself)
#在此处输出保留关键字
print("['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlo... | code_fim | medium | {
"lang": "python",
"repo": "xcginkgo/python_file",
"path": "/20190902_01.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#在此处输出保留关键字
print("['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']"... | code_fim | medium | {
"lang": "python",
"repo": "xcginkgo/python_file",
"path": "/20190902_01.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chavicoski/Sentiment_Analysis_at_Tweet_level path: /train.py
import sys
import numpy as np
from nltk.tokenize import TweetTokenizer
from utils.my_functions import parse_xml_data, get_polarity_lexicon, get_polarity_counts, get_one_hot_labels
from utils.models import get_dnn_model
from sklearn.feat... | code_fim | hard | {
"lang": "python",
"repo": "chavicoski/Sentiment_Analysis_at_Tweet_level",
"path": "/train.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Show stats
if classifier_type == "dnn":
print(f"\nResults of vectorizer {vectorizer_name} using a dnn:")
else:
print(f"\nResults of vectorizer {vectorizer_name} using a SVM with kernel type {classifier_type}:")
print(f"acc = {accuracy}")
... | code_fim | hard | {
"lang": "python",
"repo": "chavicoski/Sentiment_Analysis_at_Tweet_level",
"path": "/train.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
@params(api='gl', prms=['program', 'uniformBlockIndex', 'pname', 'params'])
def glGetActiveUniformBlockiv(program, uniformBlockIndex, pname, params):
pass
@params(api='gl', prms=['program', 'uniformBlockIndex', 'bufSize', 'length', 'uniformBlockName'])
def glGetActiveUniformBlockName(program, u... | code_fim | hard | {
"lang": "python",
"repo": "cydenix/OpenGLCffi",
"path": "/OpenGLCffi/GL/EXT/ARB/uniform_buffer_object.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cydenix/OpenGLCffi path: /OpenGLCffi/GL/EXT/ARB/uniform_buffer_object.py
from OpenGLCffi.GL import params
@params(api='gl', prms=['program', 'uniformCount', 'constuniformNames', 'uniformIndices'])
def glGetUniformIndices(program, uniformCount, constuniformNames, uniformIndices):
pass
@params(a... | code_fim | hard | {
"lang": "python",
"repo": "cydenix/OpenGLCffi",
"path": "/OpenGLCffi/GL/EXT/ARB/uniform_buffer_object.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
@params(api='gl', prms=['program', 'uniformIndex', 'bufSize', 'length', 'uniformName'])
def glGetActiveUniformName(program, uniformIndex, bufSize, length, uniformName):
pass
@params(api='gl', prms=['program', 'uniformBlockName'])
def glGetUniformBlockIndex(program, uniformBlockName):
pass
@p... | code_fim | medium | {
"lang": "python",
"repo": "cydenix/OpenGLCffi",
"path": "/OpenGLCffi/GL/EXT/ARB/uniform_buffer_object.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>s = Solution()
print(s.groupAnagrams(["eat", "tea", "tan", "ate", "nat", "bat"]))<|fim_prefix|># repo: Mar-Li/LeetCode path: /Fengshuang/python/_49_Group_Anagrams.py
class Solution(object):
def groupAnagrams(self, strs):
<|fim_middle|> """
:type strs: List[str]
:rtype: List[Lis... | code_fim | hard | {
"lang": "python",
"repo": "Mar-Li/LeetCode",
"path": "/Fengshuang/python/_49_Group_Anagrams.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mar-Li/LeetCode path: /Fengshuang/python/_49_Group_Anagrams.py
class Solution(object):
def groupAnagrams(self, strs):
<|fim_suffix|>s = Solution()
print(s.groupAnagrams(["eat", "tea", "tan", "ate", "nat", "bat"]))<|fim_middle|> """
:type strs: List[str]
:rtype: List[Lis... | code_fim | hard | {
"lang": "python",
"repo": "Mar-Li/LeetCode",
"path": "/Fengshuang/python/_49_Group_Anagrams.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ChoiceParam.__init__(
self,
name="Activation",
choices=[Sigmoid(), Tanh(), ReLU(), SELU()],
cprobs=[i / 4 for i in range(1, 5)],
is_random=False,
)<|fim_prefix|># repo: ahgamut/randonet path: /src/randonet/network/activation.py
#... | code_fim | hard | {
"lang": "python",
"repo": "ahgamut/randonet",
"path": "/src/randonet/network/activation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Reda-BELHAJ/CryptoReda path: /Utilities/decryption.py
from .encryption import *
def getED(inputStr):
return inputStr[:int(len(inputStr)/2)], inputStr[int(len(inputStr)/2):]
def transformOut(inputStr):
str1, str2 = getED(inputStr)
result = ""
i = 0
while (i < len(str1)) or (... | code_fim | medium | {
"lang": "python",
"repo": "Reda-BELHAJ/CryptoReda",
"path": "/Utilities/decryption.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> i += 1
return result
def decrypt(input: str, key: str):
hash_str = ""
if hasNumbers(key):
res_str = transformnumbers(key, getNumbers)
hash_str += transformIn(res_str, "")
else:
res_str = transformnumbers(key, lenList)
hash_str += transformI... | code_fim | hard | {
"lang": "python",
"repo": "Reda-BELHAJ/CryptoReda",
"path": "/Utilities/decryption.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: S1GGEN/AoC path: /AoC_2016/Day09_0_alternative.py
f = open("Day09_input.txt", 'r')
aoc_inp = f.read()
aoc_inp = "".join(aoc_inp.split())
f.close()
def marker_start(s):
if s == "(":
return True
def get_marker(s):
return s[1:s.find(')')]
# print(get_marker("2x2)dsdsdsd"))
de... | code_fim | medium | {
"lang": "python",
"repo": "S1GGEN/AoC",
"path": "/AoC_2016/Day09_0_alternative.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> i = 0
# print(len(s))
print("-----------------------------------------------------------------------------------------------------------")
while len(s) > 0:
#print("bokstav:", s[i])
if marker_start(s[0]):
print("--------------------------------------------------... | code_fim | medium | {
"lang": "python",
"repo": "S1GGEN/AoC",
"path": "/AoC_2016/Day09_0_alternative.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> intervals[-1][1] = num
for i in range(len(intervals)):
if intervals[i][0] == intervals[i][1]:
intervals[i] = str(intervals[i][0])
else:
intervals[i] = str(intervals[i][0]) + "->" + str(intervals[i][1])
return intervals<|fim_prefix|># repo: MaxPoon/Leetcode path: /python/228.SummaryRan... | code_fim | medium | {
"lang": "python",
"repo": "MaxPoon/Leetcode",
"path": "/python/228.SummaryRanges.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> str(intervals[i][0])
else:
intervals[i] = str(intervals[i][0]) + "->" + str(intervals[i][1])
return intervals<|fim_prefix|># repo: MaxPoon/Leetcode path: /python/228.SummaryRanges.py
class Solution(object):
def summaryRanges(self, nums):
"""
:type nums: List[int]
:rtype: List[str]
"""
... | code_fim | hard | {
"lang": "python",
"repo": "MaxPoon/Leetcode",
"path": "/python/228.SummaryRanges.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MaxPoon/Leetcode path: /python/228.SummaryRanges.py
class Solution(object):
def summaryRanges(self, nums):
"""
:type nums: List[int]
:rtype: List[str]
"""
inter<|fim_suffix|> intervals[-1][1] = num
for i in range(len(intervals)):
if intervals[i][0] == intervals[i][1]:
interva... | code_fim | medium | {
"lang": "python",
"repo": "MaxPoon/Leetcode",
"path": "/python/228.SummaryRanges.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @pytest.fixture
def missing_data(self, data):
df = data.copy(deep=True)
for col in df.columns:
df.loc[df.sample(frac=0.1).index, col] = pd.np.nan
yield df
@pytest.fixture
def sparse_df(self):
yield pd.DataFrame.sparse.from_spmatrix(scipy.sparse.... | code_fim | hard | {
"lang": "python",
"repo": "HarikaMGR/datarobot-user-models",
"path": "/tests/drum/test_units.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HarikaMGR/datarobot-user-models path: /tests/drum/test_units.py
],
)
def test_instantiating_validator_raises_error_for_too_many_values(
self, single_value_condition, iris_binary
):
yaml_str = input_requirements_yaml(Fields.NUMBER_OF_COLUMNS, single_value_condition, ... | code_fim | hard | {
"lang": "python",
"repo": "HarikaMGR/datarobot-user-models",
"path": "/tests/drum/test_units.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HarikaMGR/datarobot-user-models path: /tests/drum/test_units.py
range
df = pd.DataFrame({"col_int": [1, np.nan, None], "col_obj": ["a", np.nan, None]})
csv_filename = os.path.join(tmp_path, "X.csv")
with open(csv_filename, "w") as f:
f.write(df.to_csv(index=False))
arrow... | code_fim | hard | {
"lang": "python",
"repo": "HarikaMGR/datarobot-user-models",
"path": "/tests/drum/test_units.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neurord/waves path: /ephys_feature_extract.py
import numpy as np
import ajustador as aju
from ephys_feature_extract_func import data_lists,data_extract, stat, plot, cv_plot,parse_args
import matplotlib.pyplot as plt
import importlib
import sys
#usage: python3 ephys_feature_extrat.py -n list of ... | code_fim | hard | {
"lang": "python",
"repo": "neurord/waves",
"path": "/ephys_feature_extract.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
##This uses the function plot to plot the data for parameters listed in the desired_params. Each graph will contain the parameter vs. trace injection and include each of the specific neuron type. For example, the first graph will produce a graph of baseline vs. trace_inj for all arky neurons.
for ntype ... | code_fim | hard | {
"lang": "python",
"repo": "neurord/waves",
"path": "/ephys_feature_extract.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>##This uses the function plot to plot the data for parameters listed in the desired_params. Each graph will contain the parameter vs. trace injection and include each of the specific neuron type. For example, the first graph will produce a graph of baseline vs. trace_inj for all arky neurons.
for ntype i... | code_fim | hard | {
"lang": "python",
"repo": "neurord/waves",
"path": "/ephys_feature_extract.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: clokep/to-rss path: /to_rss/patreon.py
from contextlib import contextmanager
from datetime import datetime
from os import environ
import feedgenerator
import selenium
from selenium import webdriver
# This is lame.
if "Apple" not in environ.get("TERM_PROGRAM", ""):
from pyvirtualdisplay impo... | code_fim | hard | {
"lang": "python",
"repo": "clokep/to-rss",
"path": "/to_rss/patreon.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for post in posts:
print(post)
element = post.find_element_by_css_selector(
'a[data-tag="post-published-at"'
)
link = element.get_attribute("href")
date = datetime.strptime(element.text, "%b %d,... | code_fim | hard | {
"lang": "python",
"repo": "clokep/to-rss",
"path": "/to_rss/patreon.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setUp(self):
super(TestPublicHolidays, self).setUp()
self.holiday_obj = self.env['hr.holidays.public']
self.holiday_obj.create({
'name': 'Aid',
'date_start': '1999-05-11',
'date_end': '1999-05-17',
})
def test_count_days(self... | code_fim | medium | {
"lang": "python",
"repo": "FIDINGSARL/kzm_hr",
"path": "/l10n_ma_hr_payroll/tests/test_public_holidays.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_count_days(self):
days = self.holiday_obj.count_days("1999-05-14", "1999-05-20")
self.assertEqual(days, 4, 'Error, I get %s instead of 6' % days)
days = self.holiday_obj.count_days(
datetime(year=1999, month=5, day=14), "1999-05-20")
self.assertEqua... | code_fim | hard | {
"lang": "python",
"repo": "FIDINGSARL/kzm_hr",
"path": "/l10n_ma_hr_payroll/tests/test_public_holidays.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FIDINGSARL/kzm_hr path: /l10n_ma_hr_payroll/tests/test_public_holidays.py
# -*- coding: utf-8 -*-
from openerp.tests.common import TransactionCase
from datetime import datetime
class TestPublicHolidays(TransactionCase):
"""
Test Holidays count
"""
def setUp(self):
sup... | code_fim | hard | {
"lang": "python",
"repo": "FIDINGSARL/kzm_hr",
"path": "/l10n_ma_hr_payroll/tests/test_public_holidays.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JiaweiLian/Improved-faster-rcnn path: /TTA.py
#!/usr/bin/env python
# _*_coding:utf-8 _*_
# @Time :2021/6/19 15:58
# @Author :Jiawei Lian
# @FileName: defect_detector
# @Software: PyCharm
from copy import deepcopy
import cv2
import ensemble_boxes
import matplotlib.pyplot as plt
import numpy ... | code_fim | hard | {
"lang": "python",
"repo": "JiaweiLian/Improved-faster-rcnn",
"path": "/TTA.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> idxes = []
for idx in range(len(result[0]['scores'])):
if result[0]['scores'][idx] < threshold:
idxes.append(idx)
for i in idxes:
result[0]['scores'] = del_tensor_ele(result[0]['scores'], len(result[0]['scores']) - 1)
result[0]['labels'] = del_tensor_ele(res... | code_fim | hard | {
"lang": "python",
"repo": "JiaweiLian/Improved-faster-rcnn",
"path": "/TTA.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># temp_all_boxes = torch.cat((boxes2, boxes1), 0)
# all_labels = torch.cat((labels2, labels1), 0)
# all_scores = torch.cat((scores2, scores1), 0)
# print(boxes1, scores1, labels1)
#
# for box in boxes1:
# cv2.rectangle(image_numpy2, (int(box[0]), int(box[1])), (int(box[2]), int(box[3])), (255, 255, 0... | code_fim | hard | {
"lang": "python",
"repo": "JiaweiLian/Improved-faster-rcnn",
"path": "/TTA.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pharnoux/columbia-aiops-glue-helper path: /word-count-etl.py
import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job
from awsglue.dynamicframe import Dynam... | code_fim | hard | {
"lang": "python",
"repo": "pharnoux/columbia-aiops-glue-helper",
"path": "/word-count-etl.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.