text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: damonchen/onion path: /onion/template_files/project/wsgi_handler.py
#coding=utf-8
import sys, os
<|fim_suffix|>from onion.manage import make_application
application = make_application(project_path=path)<|fim_middle|>path = os.path.dirname(os.path.abspath(__file__))
if path not in sys.path:
... | code_fim | medium | {
"lang": "python",
"repo": "damonchen/onion",
"path": "/onion/template_files/project/wsgi_handler.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> im = util.fill((4, 4), [174, 56, 3])
im2 = im.convert("HSV")
sepiaed_im = css.sepia(im)
sepiaed_im2 = css.sepia(im2)
sepiaed_im2_rgb = sepiaed_im2.convert("RGB")
assert list(sepiaed_im.getdata()) == list(sepiaed_im2_rgb.getdata())
assert sepiaed_im2.size == im2.size
assert... | code_fim | hard | {
"lang": "python",
"repo": "akiomik/pilgram",
"path": "/pilgram/css/tests/test_sepia.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akiomik/pilgram path: /pilgram/css/tests/test_sepia.py
# Copyright 2019 Akiomi Kamakura
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/li... | code_fim | hard | {
"lang": "python",
"repo": "akiomik/pilgram",
"path": "/pilgram/css/tests/test_sepia.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> im = util.fill((4, 4), [174, 56, 3])
sepiaed_im = css.sepia(im, 1)
sepiaed_im2 = css.sepia(im)
assert list(sepiaed_im.getdata()) == list(sepiaed_im2.getdata())
assert sepiaed_im.size == im.size
assert sepiaed_im.mode == im.mode
def test_sepia_greater_than_1():
im = util.fill... | code_fim | hard | {
"lang": "python",
"repo": "akiomik/pilgram",
"path": "/pilgram/css/tests/test_sepia.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for model in models:
if os.path.isdir(os.path.join(PATH,model)):
jsonFile = os.path.join(PATH,model,'%s.json' % model)
print jsonFile
with open(jsonFile) as data_file:
data = json.load(data_file)
... | code_fim | medium | {
"lang": "python",
"repo": "neuroailab/stansim",
"path": "/parsers/extract_metadata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
with open('CGTrader_subset.json','r') as outfile:
data = json.load(outfile)
print data[2]
if __name__ == '__main__':
read_metadata(PATH)<|fim_prefix|># repo: neuroailab/stansim path: /parsers/extract_metadata.py
import os
import subprocess
import hashlib
import shutil
import js... | code_fim | hard | {
"lang": "python",
"repo": "neuroailab/stansim",
"path": "/parsers/extract_metadata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neuroailab/stansim path: /parsers/extract_metadata.py
import os
import subprocess
import hashlib
import shutil
import json
PATH = '/Volumes/MyPassport/CGTrader'
# There is a separate function to consolidate each database,
# beacuse each one is different ...
def read_metadata(path):
mod... | code_fim | medium | {
"lang": "python",
"repo": "neuroailab/stansim",
"path": "/parsers/extract_metadata.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frodsan/chappie path: /chappie/machine.py
class Machine:
def __init__(self, initialState):
self.state = initialState
self.events = {}
self.callbacks = {}
<|fim_suffix|> self.callbacks[state] = fn
def trigger(self, event):
if event not in self.event... | code_fim | medium | {
"lang": "python",
"repo": "frodsan/chappie",
"path": "/chappie/machine.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.state not in transitions:
return False
self.state = transitions[self.state]
for state in [self.state, "any"]:
if state in self.callbacks:
self.callbacks[state]()
return True<|fim_prefix|># repo: frodsan/chappie path: /chap... | code_fim | medium | {
"lang": "python",
"repo": "frodsan/chappie",
"path": "/chappie/machine.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
metric("Defensive Interval")
.calc_by_div(sum([data['Cash & Cash Equivalents'],
data['Accounts Receivable']]),
mean([data['{daily expenditures}'],
data_last_year['{daily expenditures}']]))
metric("Cash Conve... | code_fim | hard | {
"lang": "python",
"repo": "FrankVolpe/Financial-Statement-Analysis-Toolkit",
"path": "/Deprecated/projections/modelling_temp.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
days_measures = []
metric("Days of Sales Outstanding")
.calc_by_div(365,
{Receivables Turnover})
days_measures.append()
metric("Days of Inventory Outstanding")
.calc_by_div(365,
{Inventory Turnover})
days_... | code_fim | hard | {
"lang": "python",
"repo": "FrankVolpe/Financial-Statement-Analysis-Toolkit",
"path": "/Deprecated/projections/modelling_temp.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FrankVolpe/Financial-Statement-Analysis-Toolkit path: /Deprecated/projections/modelling_temp.py
## Need to finish KPIs first
def fs_profitability(self):
profitability_df = pd.DataFrame()
profitability = []
for x in range(len(self.new_range)):
r_o_a = met... | code_fim | hard | {
"lang": "python",
"repo": "FrankVolpe/Financial-Statement-Analysis-Toolkit",
"path": "/Deprecated/projections/modelling_temp.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AdrienBlassiau/RODD path: /tp7/Projet_7/julia/others/plot.py
import matplotlib.pyplot as plt
import numpy as np
from statistics import mean, variance, stdev, pstdev
r = np.arange(1., 13.,1)
cout_total_2 = [779.0,746.8333333333334,706.6333333333333,694.0,678.4333333333333,667.7999999999998,629.9... | code_fim | hard | {
"lang": "python",
"repo": "AdrienBlassiau/RODD",
"path": "/tp7/Projet_7/julia/others/plot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>cout_total_18 = [1214.0,1176.2266666666665,1081.4666666666667,1056.3333333333335,1049.5333333333333,1035.6000000000001,1017.7111111111113,990.0,1015.3333333333331,1005.0000000000002,970.0,956.0,930.0,931.3333333333337,917.0000000000026,937.6666666666665,958.6666666666665,951.0000000000001,np.nan,np.nan]
e... | code_fim | hard | {
"lang": "python",
"repo": "AdrienBlassiau/RODD",
"path": "/tp7/Projet_7/julia/others/plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>r = np.arange(1., 13.,1)
cout_total_4 = [778.9999999999999,778.9999999999999,778.9999999999999,778.9999999999999,778.9999999999999,778.9999999999999,778.9999999999999,778.9999999999999,778.9999999999999,778.9999999999999,778.9999999999999,778.9999999999999]
emission_moyenne_4 = [5.0,5.0,5.0,5.0,5.0,5.0,5... | code_fim | hard | {
"lang": "python",
"repo": "AdrienBlassiau/RODD",
"path": "/tp7/Projet_7/julia/others/plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: darrensapalo/yt2mp3 path: /yt2mp3/util.py
#!/usr/bin/env python3
"""
yt2mp3
A program that simplifies the process of searching, downloading and
converting Youtube videos to MP3 files with embedded metadata via the
iTunes API.
yt2mp3/util.py
Brett Stevenson (c) 2018
"""
import sys, os, re, pytu... | code_fim | hard | {
"lang": "python",
"repo": "darrensapalo/yt2mp3",
"path": "/yt2mp3/util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> youtube = pytube.Playlist(url)
video_list = ['https://www.youtube.com'+i for i in youtube.parse_links()]
return video_list
# Displays a download progress bar
def showProgressBar(stream, _chunk, _file_handle, bytes_remaining):
total = stream.filesize
current = ((total-bytes_remaining)/total)
p... | code_fim | hard | {
"lang": "python",
"repo": "darrensapalo/yt2mp3",
"path": "/yt2mp3/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'hivemq.persistence.payload_entries.count',
'hivemq.persistence.removable_entries.count',
'hivemq.persistence_scheduled_executor.running',
'hivemq.persistence_scheduled_executor.scheduled.overrun',
'hivemq.persistence_scheduled_executor.scheduled.percent_of_period.50th_percentile',
'... | code_fim | hard | {
"lang": "python",
"repo": "DataDog/integrations-core",
"path": "/hivemq/tests/test_e2e.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DataDog/integrations-core path: /hivemq/tests/test_e2e.py
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from datadog_checks.dev.jmx import JVM_E2E_METRICS_NEW
pytestmark = [pytest.mark.e2e]
METRICS = [
'hive... | code_fim | hard | {
"lang": "python",
"repo": "DataDog/integrations-core",
"path": "/hivemq/tests/test_e2e.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>current',
'hivemq.networking.bytes.write.total',
'hivemq.networking.connections.current',
'hivemq.networking.connections.mean.50th_percentile',
'hivemq.networking.connections.mean.75th_percentile',
'hivemq.networking.connections.mean.95th_percentile',
'hivemq.networking.connections... | code_fim | hard | {
"lang": "python",
"repo": "DataDog/integrations-core",
"path": "/hivemq/tests/test_e2e.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wenxuan-xia/IE533_App path: /IE533/DataCollectApp/admin.py
from django.contrib import admin
from .models import DataCollector
# Register your models here.
class DataCollectorAdmin(admin.ModelAdmin):
<|fim_suffix|>admin.site.register(DataCollector, DataCollectorAdmin)<|fim_middle|> list_displa... | code_fim | medium | {
"lang": "python",
"repo": "wenxuan-xia/IE533_App",
"path": "/IE533/DataCollectApp/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>admin.site.register(DataCollector, DataCollectorAdmin)<|fim_prefix|># repo: wenxuan-xia/IE533_App path: /IE533/DataCollectApp/admin.py
from django.contrib import admin
from .models import DataCollector
# Register your models here.
class DataCollectorAdmin(admin.ModelAdmin):
<|fim_middle|> list_displa... | code_fim | medium | {
"lang": "python",
"repo": "wenxuan-xia/IE533_App",
"path": "/IE533/DataCollectApp/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Pick first relation as current adn reset location for the remaining located way relations
current = active_way_relations[0]
if len(active_way_relations) > 1:
for wr in active_way_relations[1:]:
wr.reset_location_variables()
return Route(current, self.way_relations, self.id... | code_fim | hard | {
"lang": "python",
"repo": "arneschwarck/openpilot",
"path": "/selfdrive/mapd/lib/WayCollection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arneschwarck/openpilot path: /selfdrive/mapd/lib/WayCollection.py
from selfdrive.mapd.lib.WayRelation import WayRelation
from selfdrive.mapd.lib.Route import Route
import uuid
class WayCollection():
"""A collection of WayRelations to use for maps data analysis.
"""
def __init__(self, ways... | code_fim | medium | {
"lang": "python",
"repo": "arneschwarck/openpilot",
"path": "/selfdrive/mapd/lib/WayCollection.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Update all way relations in collection to the provided location and bearing.
for wr in self.way_relations:
wr.update(location, bearing)
# From those matching (i.e. active), select the one with minimum bearing delta between
# route segment and provided bearing
active_way_relati... | code_fim | hard | {
"lang": "python",
"repo": "arneschwarck/openpilot",
"path": "/selfdrive/mapd/lib/WayCollection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ''' Test the PhGFilterMultiplicates function
Import and instantiate the functions to be tested
The local test will generate data instead of using server data.
By default it will assume that the input data items are numeric.
Required data items will be inferred from the function inpu... | code_fim | hard | {
"lang": "python",
"repo": "philippe-gregoire/mas_iotfuncs",
"path": "/scripts/test_Filter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> db,db_schema=script_utils.setup_iotfunc(args.creds_file,args.echo_sql)
# pprint.pprint(db.credentials)
import phg_iotfuncs.func_base
iotFunc=phg_iotfuncs.func_base.PhGFilterMultiplicates
if args.operation=='test':
test(db,db_schema,iotFunc,args.drop_if_NaN,args.timestamp_col, ... | code_fim | hard | {
"lang": "python",
"repo": "philippe-gregoire/mas_iotfuncs",
"path": "/scripts/test_Filter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: philippe-gregoire/mas_iotfuncs path: /scripts/test_Filter.py
# *****************************************************************************
# # © Copyright IBM Corp. 2021. All Rights Reserved.
#
# This program and the accompanying materials
# are made available under the terms of the Apache V2.... | code_fim | hard | {
"lang": "python",
"repo": "philippe-gregoire/mas_iotfuncs",
"path": "/scripts/test_Filter.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>NNHH ÃÃÃÃNN ÕÕÕÕÕH ÕÕÃÃÃNNHH ÃÃÃÃÃN ÕNNNHH AAÃÃÃNN ÕÕÕH ÃÃÃÃÃN ONNNH '
'ONNNHH ÃÃÃÃNN ÕÕÕÕÕH ÕÕÃÃÃNNHH ÃÃÃÃÃN ÕNNNHH AAÃÃÃNH')<|fim_prefix|># repo: yWolfBR/Python-CursoEmVideo path: /Mundo 2/Exercicios/Desafio046.py
from time import sleep
for c in range(10, 0, -1):
print(c)
sleep(1)
print(... | code_fim | hard | {
"lang": "python",
"repo": "yWolfBR/Python-CursoEmVideo",
"path": "/Mundo 2/Exercicios/Desafio046.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yWolfBR/Python-CursoEmVideo path: /Mundo 2/Exercicios/Desafio046.py
from time import sleep
for c in range(10, 0, -1):
print(c)
sleep(1)
print('FIIIIIIIIIIIIIIIIUUUUUUUUUUUUUUUUU')
sleep(1)
print('TRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATRATR... | code_fim | medium | {
"lang": "python",
"repo": "yWolfBR/Python-CursoEmVideo",
"path": "/Mundo 2/Exercicios/Desafio046.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Display Name: Configuration digest
Default Value: 0
Value Format: hex
"""
from ixnetwork_restpy.multivalue import Multivalue
return Multivalue(
self,
self._get_attribute(
self._SDM_ATT_MAP["MstiConfigurati... | code_fim | hard | {
"lang": "python",
"repo": "OpenIxia/ixnetwork_restpy",
"path": "/ixnetwork_restpy/testplatform/sessions/ixnetwork/traffic/trafficitem/configelement/stack/mstpBPDU_template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Display Name: Hello time(in msecs)
Default Value: 512
Value Format: decimal
"""
from ixnetwork_restpy.multivalue import Multivalue
return Multivalue(
self, self._get_attribute(self._SDM_ATT_MAP["HeaderHelloTimeinMsecs"])
)
... | code_fim | hard | {
"lang": "python",
"repo": "OpenIxia/ixnetwork_restpy",
"path": "/ixnetwork_restpy/testplatform/sessions/ixnetwork/traffic/trafficitem/configelement/stack/mstpBPDU_template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OpenIxia/ixnetwork_restpy path: /ixnetwork_restpy/testplatform/sessions/ixnetwork/traffic/trafficitem/configelement/stack/mstpBPDU_template.py
el-23",
"MstiConfigurationIdentifierConfigurationDigest": "mstpBPDU.header.mstiConfigurationIdentifier.configurationDigest-24",
"HeaderCis... | code_fim | hard | {
"lang": "python",
"repo": "OpenIxia/ixnetwork_restpy",
"path": "/ixnetwork_restpy/testplatform/sessions/ixnetwork/traffic/trafficitem/configelement/stack/mstpBPDU_template.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> invites[invite.id] = {
"uses": 0,
"url": invite.url,
"max_uses": 1,
"code": invite.code,
}
with open("data/invites.json", "w") as f:
f.write(json.dumps(invites))
await ctx.message.add_reaction("🆗")
try:
... | code_fim | hard | {
"lang": "python",
"repo": "reswitched/robocop-ng",
"path": "/robocop_ng/cogs/invites.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: reswitched/robocop-ng path: /robocop_ng/cogs/invites.py
from discord.ext import commands
from discord.ext.commands import Cog
from helpers.checks import check_if_collaborator
import config
import json
class Invites(Cog):
<|fim_suffix|> self.bot = bot
@commands.command()
@command... | code_fim | medium | {
"lang": "python",
"repo": "reswitched/robocop-ng",
"path": "/robocop_ng/cogs/invites.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open("data/invites.json", "r") as f:
invites = json.load(f)
invites[invite.id] = {
"uses": 0,
"url": invite.url,
"max_uses": 1,
"code": invite.code,
}
with open("data/invites.json", "w") as f:
f.... | code_fim | hard | {
"lang": "python",
"repo": "reswitched/robocop-ng",
"path": "/robocop_ng/cogs/invites.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> output_frame['p_score_8'] = np.where(gross_margin[0] > gross_margin[1], 1, 0)
return output_frame
def asset_turn_compar(asset_turn):
output_frame['p_score_9'] = np.where(asset_turn[0] > asset_turn[1], 1, 0)
return output_frame
def cal_score():
score = np.sum(
[output_frame[... | code_fim | hard | {
"lang": "python",
"repo": "webclinic017/TradingEvolved",
"path": "/examples/old/screener.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: webclinic017/TradingEvolved path: /examples/old/screener.py
import os
import quandl
import numpy as np
import pandas as pd
# Replace <your_key> with you api key
quandl.ApiConfig.api_key = '<your_key>'
def data_tackle():
ticker = ['AAPL', 'AXP', 'CAT', 'CSCO', 'CVX', 'DD', 'DIS', 'GE', 'GS',... | code_fim | hard | {
"lang": "python",
"repo": "webclinic017/TradingEvolved",
"path": "/examples/old/screener.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> output_frame['p_score_9'] = np.where(asset_turn[0] > asset_turn[1], 1, 0)
return output_frame
def cal_score():
score = np.sum(
[output_frame['p_score_1'], output_frame['p_score_2'], output_frame['p_score_3'], output_frame['p_score_4'],
output_frame['p_score_5'], output_frame... | code_fim | hard | {
"lang": "python",
"repo": "webclinic017/TradingEvolved",
"path": "/examples/old/screener.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Args:
predict:(n, c, h, w)
target:(n, h, w)
weight (Tensor, optional): a manual rescaling weight given to each class.
If given, has to be a Tensor of size "nclasses"
"""
... | code_fim | hard | {
"lang": "python",
"repo": "jtpils/structure_knowledge_distillation",
"path": "/utils/loss.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jtpils/structure_knowledge_distillation path: /utils/loss.py
o be a Tensor of size "nclasses"
"""
assert not target.requires_grad
assert predict.dim() == 4
assert target.dim() == 3
assert predict.size(0) == target.size(0), "{0} vs {1} ".format(predict.... | code_fim | hard | {
"lang": "python",
"repo": "jtpils/structure_knowledge_distillation",
"path": "/utils/loss.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, predict, target):
"""
Args:
predict:(n, c, h, w)
target:(n, h, w)
weight (Tensor, optional): a manual rescaling weight given to each class.
If given, has to be a Tenso... | code_fim | hard | {
"lang": "python",
"repo": "jtpils/structure_knowledge_distillation",
"path": "/utils/loss.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>locations = face_recognition.face_locations(img1)
i = 0
for t in result:
if t:
break
i += 1
if i < len(locations):
top, right, bottom, left = locations[i]
draw_img.rectangle([(left, top), (right, bottom)], None, (0, 255, 0), 2)
pil_img.show()
else:
print('It\'s n... | code_fim | medium | {
"lang": "python",
"repo": "janewen134/entrance-guard",
"path": "/fifth_compare_face.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: janewen134/entrance-guard path: /fifth_compare_face.py
import face_recognition
from PIL import Image, ImageDraw
img1 = face_recognition.load_image_file('./imgs/chenrancrowd.jpg')
img2 = face_recognition.load_image_file('./imgs/ymsingle.jpg')
encoding1 = face_recognition.face_encodings(i... | code_fim | medium | {
"lang": "python",
"repo": "janewen134/entrance-guard",
"path": "/fifth_compare_face.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # unpad last block
decrypted_array[-1] = unpad(decrypted_array[-1])
FileTools.write_file(decrypted_file_name, decrypted_array)
class CTR:
def __init__(self, block_cipher_alg):
self.block_cipher_alg = block_cipher_alg
self.ctr = generate_random_ctr()
... | code_fim | hard | {
"lang": "python",
"repo": "101guptaji/Cryptography",
"path": "/AES.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 101guptaji/Cryptography path: /AES.py
import os
from tqdm import tqdm
def random_key_generator(key_length):
return bytes.hex(os.urandom(key_length // 8))
class AES:
Nb = 4
Nk = 4
Nr = 10
Sbox = (
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, ... | code_fim | hard | {
"lang": "python",
"repo": "101guptaji/Cryptography",
"path": "/AES.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def rotate_word(self, w):
w[0], w[1], w[2], w[3] = w[1], w[2], w[3], w[0]
def key_expansion(self, key):
self.round_keys = self.key
for i in range(self.Nk, self.Nb * (self.Nr + 1)):
self.round_keys.append([0, 0, 0, 0])
temp = self.round_keys... | code_fim | hard | {
"lang": "python",
"repo": "101guptaji/Cryptography",
"path": "/AES.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: veltri/DLV2 path: /tests/parser/bug.11.test.py
input = """
true.
pos(0,1,b1):- true.
pos(0,2,b2):- true.
pos(0,3,x):- true.
pos(0,4,x):- true.
pos(0,5,x):- true.
pos(0,6,x):- true.
pos(0,7,y):- true.
pos(0,8,y):- true.
pos(0,9,y):- true.
pos(0,10,y):- true.
goal(1,x).
goal(2,y).
goal... | code_fim | hard | {
"lang": "python",
"repo": "veltri/DLV2",
"path": "/tests/parser/bug.11.test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>mv(N,7) :- move_number(N), not forced_move(N), not mv(N,2), not mv(N,3), not mv(N,4), not mv(N,5), not mv(N,6), not mv(N,1), not mv(N,8), not mv(N,9).
mv(N,8) :- move_number(N), not forced_move(N), not mv(N,2), not mv(N,3), not mv(N,4), not mv(N,5), not mv(N,6), not mv(N,7), not mv(N,1), not mv(N,9).
... | code_fim | hard | {
"lang": "python",
"repo": "veltri/DLV2",
"path": "/tests/parser/bug.11.test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
pos(N,P,b1):- mv(N,P).
pos(N,P,b2):- mv(N,Q), succ(Q,P).
pos(N,P,X) :- succ(M,N), pos(M,P,b1), mv(N,Q), pos(M,Q,X).
pos(N,P,X) :- succ(M,N), pos(M,P,b2), mv(N,R), succ(R,Q), pos(M,Q,X).
pos(N,P,X) :- move_number(N), succ(M,N), pos(M,P,X), not changed(N,P).
changed(N,P) :- succ(M,N), pos(M,P,b1).
... | code_fim | hard | {
"lang": "python",
"repo": "veltri/DLV2",
"path": "/tests/parser/bug.11.test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vincent0700/ws_mpu6050 path: /app/__init__.py
import logging
from flask import Flask, request, render_template
from flask_socketio import SocketIO, emit
from app.mpu6050 import mpu6050
app = Flask(__name__)
socketio = SocketIO(app)
sensor = mpu6050(address=0x68, bus=0)
log = logging.getLogger('w... | code_fim | hard | {
"lang": "python",
"repo": "Vincent0700/ws_mpu6050",
"path": "/app/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@socketio.on('connect', namespace='/mpu6050')
def on_mpu6050_connect():
print(f'Client {request.remote_addr} connected')
@socketio.on('get_data', namespace='/mpu6050')
def on_mpu6050_get_data():
accel_data = sensor.get_accel_data()
gyro_data = sensor.get_gyro_data()
temp = sensor.get_tem... | code_fim | medium | {
"lang": "python",
"repo": "Vincent0700/ws_mpu6050",
"path": "/app/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(UninstallProgressPage, self).__init__(parent)
self.setTitle('Uninstall {}'.format(APPLICATION_NAME))
self.info = QLabel()
self.progress = QProgressBar()
vbox = QVBoxLayout()
vbox.addWidget(self.info)
vbox.addWidget(self.progress)
vbox.a... | code_fim | hard | {
"lang": "python",
"repo": "east825/youtube-dl-gui",
"path": "/src/installer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, parent=None):
super(UninstallProgressPage, self).__init__(parent)
self.setTitle('Uninstall {}'.format(APPLICATION_NAME))
self.info = QLabel()
self.progress = QProgressBar()
vbox = QVBoxLayout()
vbox.addWidget(self.info)
vbox.ad... | code_fim | hard | {
"lang": "python",
"repo": "east825/youtube-dl-gui",
"path": "/src/installer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: east825/youtube-dl-gui path: /src/installer.py
# vim: fileencoding=utf-8
from __future__ import unicode_literals
from __future__ import print_function
import subprocess
import sys
import site
import os
import platform
import shutil
import urllib2
from urllib2 import URLError
from urlparse impo... | code_fim | hard | {
"lang": "python",
"repo": "east825/youtube-dl-gui",
"path": "/src/installer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wbdana/chief_api path: /records/views.py
from rest_framework import renderers, viewsets
from rest_framework.decorators import action, api_view
from rest_framework import permissions
from rest_framework.response import Response
from rest_framework.reverse import reverse
<|fim_suffix|> def perf... | code_fim | hard | {
"lang": "python",
"repo": "wbdana/chief_api",
"path": "/records/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def perform_create(self, serializer):
serializer.save(owner=self.request.user)<|fim_prefix|># repo: wbdana/chief_api path: /records/views.py
from rest_framework import renderers, viewsets
from rest_framework.decorators import action, api_view
from rest_framework import permissions
from rest_f... | code_fim | hard | {
"lang": "python",
"repo": "wbdana/chief_api",
"path": "/records/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
evaluation_measures = [
PrecisionRecallAtN(n),
MeanReciprocalRankAtN(n, single_next_item_only=True),
PrecisionRecallUpToN(n),
MeanReciprocalRankUpToN(n, single_next_item_only=True),
HitRateAtN(n, single_next_item_only=True),
MeanAveragePrecisionAtN(n)
]
# splitter = RandomSession... | code_fim | hard | {
"lang": "python",
"repo": "undarmaa/dml4rec",
"path": "/experiments/common.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> yield Dataset(dataset_name).load_from_file(
sessions_data_file, items_data_file, load_only_clicked_items=load_only_clicked_items
)
evaluation_measures = [
PrecisionRecallAtN(n),
MeanReciprocalRankAtN(n, single_next_item_only=True),
Precisio... | code_fim | hard | {
"lang": "python",
"repo": "undarmaa/dml4rec",
"path": "/experiments/common.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: undarmaa/dml4rec path: /experiments/common.py
import os
from rec.dataset.dataset import Dataset
from rec.dataset.split import LastNPercentOfSessionsInDataset, RandomSessionSplitter
from rec.eval import PrecisionRecallAtN, PrecisionRecallUpToN, \
MeanReciprocalRankUpToN, HitRateAtN, MeanRecip... | code_fim | hard | {
"lang": "python",
"repo": "undarmaa/dml4rec",
"path": "/experiments/common.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cpr2829/SilverLining-SSO path: /django-mama-cas/mama_cas/tests/test_models.py
sertTrue(re.search('^ST-[0-9]{10,}-[a-zA-Z0-9]{32}$', str))
def test_create_ticket_str_prefix(self):
"""
A ticket string should be created with the provided prefix
string and format.
... | code_fim | hard | {
"lang": "python",
"repo": "cpr2829/SilverLining-SSO",
"path": "/django-mama-cas/mama_cas/tests/test_models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_create_ticket_invalid_pgturl(self):
"""
If callback validation fails, ``None`` should be returned
instead of a ``ProxyGrantingTicket``.
"""
with patch('requests.get') as mock:
mock.side_effect = requests.exceptions.ConnectionError
... | code_fim | hard | {
"lang": "python",
"repo": "cpr2829/SilverLining-SSO",
"path": "/django-mama-cas/mama_cas/tests/test_models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cpr2829/SilverLining-SSO path: /django-mama-cas/mama_cas/tests/test_models.py
com/test?test3=blue#green'
st = ServiceTicket.objects.create_ticket(service=service, user=self.user)
self.assertEqual(st.service, 'http://www.example.com/test')
def test_create_ticket_no_expires(sel... | code_fim | hard | {
"lang": "python",
"repo": "cpr2829/SilverLining-SSO",
"path": "/django-mama-cas/mama_cas/tests/test_models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: will64185/haha path: /page_object/LoginPage.py
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from page.webpage import WebPage, sleep
from common.readelement import Element
login = Element('login')
class Loginpage(WebPage):
"""登录页面"""
def input_username(self, content):
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "will64185/haha",
"path": "/page_object/LoginPage.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def click_selectShop(self):
"""选择门店"""
self.is_click(login['选择门店'])
sleep()
def click_shopSure(self):
"""点击确定"""
self.is_click(login['点击确定'])
sleep(3)
def input_shopName1(self, content):
"""输入门店名称"""
self.input_text(login['输入门店名... | code_fim | hard | {
"lang": "python",
"repo": "will64185/haha",
"path": "/page_object/LoginPage.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Xeralux/autobuilder path: /autobuilder/utils/logutils.py
"""
logutils
Simplified logging interface, implementing a Log class with
methods similar to those used in bitbake. Supports StreamHandler
output only.
Note that setting a debug level implies verbose as well.
To use:
from logutils import... | code_fim | hard | {
"lang": "python",
"repo": "Xeralux/autobuilder",
"path": "/autobuilder/utils/logutils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def note(self, *args):
"""
Plain output, prefixed by Note:, not subject
to verbosity or debug settings.
"""
self.mylog.info(*args)
def verbose(self, *args):
"""
Logs output only when verbosity is enabled.
"""
self.mylog.log(l... | code_fim | hard | {
"lang": "python",
"repo": "Xeralux/autobuilder",
"path": "/autobuilder/utils/logutils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: carlosasj/colbybot path: /bot/models/Update.py
import json
from . import Message
from functools import lru_cache
<|fim_suffix|> def __init__(self, body):
data = json.loads(body)
self.json = data
print(data)
self.update_id = data['update_id']
self.is_ed... | code_fim | easy | {
"lang": "python",
"repo": "carlosasj/colbybot",
"path": "/bot/models/Update.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
@lru_cache()
def is_valid_request(self):
return hasattr(self, 'message')<|fim_prefix|># repo: carlosasj/colbybot path: /bot/models/Update.py
import json
from . import Message
from functools import lru_cache
class Update:
<|fim_middle|> def __init__(self, body):
... | code_fim | hard | {
"lang": "python",
"repo": "carlosasj/colbybot",
"path": "/bot/models/Update.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = json.loads(body)
self.json = data
print(data)
self.update_id = data['update_id']
self.is_edited = 'edited_message' in 'data'
if 'message' in data:
self.message = Message(data['message'])
@property
@lru_cache()
def is_valid_req... | code_fim | easy | {
"lang": "python",
"repo": "carlosasj/colbybot",
"path": "/bot/models/Update.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rodffer/Python3 path: /Atividade03.py
#Exercício 1.3. As Organizações Tabajara resolveram dar um aumento de salário aos
# seus colaboradores e lhe contraram para desenvolver o programa que calculará os reajustes.
# Faça um programa que recebe o salário de um colaborador e o reajuste segundo o... | code_fim | medium | {
"lang": "python",
"repo": "Rodffer/Python3",
"path": "/Atividade03.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if salario_colaborador < 280.00:
salario_reajuste = salario_colaborador + 0.20*salario_colaborador
valor_aumentado = 0.20*salario_colaborador
print(f"Salario antes do reajuste : {salario_colaborador}")
print("Percentual de aumento: 20%")
print(f"Valor aumentado... | code_fim | medium | {
"lang": "python",
"repo": "Rodffer/Python3",
"path": "/Atividade03.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: codelieche/erp path: /backend/apps/cmdb/serializers/model.py
# -*- coding:utf-8 -*-
from rest_framework import serializers
from account.models import User
from cmdb.models import Model
from cmdb.serializers.field import FieldModelSerializer
class ModelSerializer(serializers.ModelSerializer):
... | code_fim | hard | {
"lang": "python",
"repo": "codelieche/erp",
"path": "/backend/apps/cmdb/serializers/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
资产模型 Info Serializer
"""
fields = FieldModelSerializer(many=True, required=False, read_only=True)
user = serializers.SlugRelatedField(slug_field='username', queryset=User.objects.all(),
required=False, allow_null=True, )
def create(self... | code_fim | hard | {
"lang": "python",
"repo": "codelieche/erp",
"path": "/backend/apps/cmdb/serializers/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: clean-code-craft-tcq-1/add-variety-python-wanderer-soul92 path: /typewise_alert.test.py
import unittest
import typewise_alert
class TypewiseTest(unittest.TestCase):
<|fim_suffix|> self.assertTrue(typewise_alert.infer_breach(20, 50, 100) == 'TOO_LOW')
self.assertTrue(typewise_alert.check_... | code_fim | medium | {
"lang": "python",
"repo": "clean-code-craft-tcq-1/add-variety-python-wanderer-soul92",
"path": "/typewise_alert.test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertTrue(typewise_alert.infer_breach(20, 50, 100) == 'TOO_LOW')
self.assertTrue(typewise_alert.check_and_alert('TO_CONTROLLER', 'PASSIVE_COOLING', 20) == 'NORMAL')
self.assertTrue(typewise_alert.check_and_alert('TO_EMAIL', 'PASSIVE_COOLING', 60) == 'TOO_HIGH')
self.assertTrue(typewi... | code_fim | medium | {
"lang": "python",
"repo": "clean-code-craft-tcq-1/add-variety-python-wanderer-soul92",
"path": "/typewise_alert.test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>check_voter("tom")
check_voter("mike")
check_voter("mike")<|fim_prefix|># repo: bgoonz/UsefulResourceRepo2.0 path: /MY_REPOS/INTERVIEW-PREP-COMPLETE/notes-n-resources/Data-Structures-N-Algo/_DS-n-Algos/__MY_OPRIGINAL_DS/_Extra-Practice/05_hash_tables/python/02_check_voter.py
voted = {}
def check_voter(... | code_fim | medium | {
"lang": "python",
"repo": "bgoonz/UsefulResourceRepo2.0",
"path": "/MY_REPOS/INTERVIEW-PREP-COMPLETE/notes-n-resources/Data-Structures-N-Algo/_DS-n-Algos/__MY_OPRIGINAL_DS/_Extra-Practice/05_hash_tables/python/02_check_voter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rsamit26/InterviewBit path: /Python/TwoPointers/InplaceUpdate/Sort by Color.py
"""
Given an array with n objects colored red, white or blue,
sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Here, we will use the integers 0, 1, and 2 to r... | code_fim | medium | {
"lang": "python",
"repo": "rsamit26/InterviewBit",
"path": "/Python/TwoPointers/InplaceUpdate/Sort by Color.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in arr:
if i == 0:
redA.append(i)
elif i == 1:
whiteA.append(i)
else:
blueA.append(i)
return redA + whiteA + blueA
s = Solution()
a = [0, 1, 2, 0, 1, 2]
print(s.sort_by_color(a))<|fim_prefix|># repo... | code_fim | hard | {
"lang": "python",
"repo": "rsamit26/InterviewBit",
"path": "/Python/TwoPointers/InplaceUpdate/Sort by Color.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> redA = []
whiteA = []
blueA = []
for i in arr:
if i == 0:
redA.append(i)
elif i == 1:
whiteA.append(i)
else:
blueA.append(i)
return redA + whiteA + blueA
s = Solution()
a = [0, 1,... | code_fim | medium | {
"lang": "python",
"repo": "rsamit26/InterviewBit",
"path": "/Python/TwoPointers/InplaceUpdate/Sort by Color.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cyrilwelschen/reservationen_package path: /reservationen_package/dbf2csv.py
#!/usr/bin/python2
import csv
from dbfpy import dbf
import sys
filename = sys.argv[1]
if filename.endswith('.dbf'):
csv_fn = filename[:-4] + ".csv"
with <|fim_suffix|>s:
names.append(field.name)
... | code_fim | medium | {
"lang": "python",
"repo": "cyrilwelschen/reservationen_package",
"path": "/reservationen_package/dbf2csv.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> except ValueError:
raise ValueError("caught error")
in_db.close()
else:
raise TypeError("Wrong file type, not a dbf file received")<|fim_prefix|># repo: cyrilwelschen/reservationen_package path: /reservationen_package/dbf2csv.py
#!/usr/bin/python2
import csv
from dbfpy im... | code_fim | medium | {
"lang": "python",
"repo": "cyrilwelschen/reservationen_package",
"path": "/reservationen_package/dbf2csv.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.user_config.data is None:
self.user_config.data = dict()
return False
def on_chat_message(self, msg):
self.save_message(msg, skip_reply=True)
self.stage().on_chat_message(msg, u.get_text(msg))
def on_callback_query(sel... | code_fim | hard | {
"lang": "python",
"repo": "ufian/CalcCalories",
"path": "/ccal.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ufian/CalcCalories path: /ccal.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
__author__ = 'ufian'
import config
import telepot
import time
import mongoengine as me
import datetime
from telepot.loop import MessageLoop
from telepot.delegate import per_chat_i... | code_fim | hard | {
"lang": "python",
"repo": "ufian/CalcCalories",
"path": "/ccal.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def on_close(self, ex):
# st.DEFAULT -> fix message
stage = self.stage(st.DEFAULT)
if 'last_message' in self.context:
stage.base_message('Finish', update_msg=self.context['last_message'])
if 'cb_message' in self.context and self.context['cb_mess... | code_fim | hard | {
"lang": "python",
"repo": "ufian/CalcCalories",
"path": "/ccal.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: streamlink/streamlink path: /tests/stream/test_hls_playlist.py
", (None, None)),
("invalid", (None, None)),
("#TAG", ("TAG", "")),
("#TAG:ATTRIBUTES", ("TAG", "ATTRIBUTES")),
("#TAG: ATTRIBUTES ", ("TAG", "ATTRIBUTES")),
])
def test_split_tag(string: str, expected: Union[Tup... | code_fim | hard | {
"lang": "python",
"repo": "streamlink/streamlink",
"path": "/tests/stream/test_hls_playlist.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: streamlink/streamlink path: /tests/stream/test_hls_playlist.py
alid quoted string (carriage return)"),
pytest.param("KEY=\"foo\nbar\"", True, {}, id="invalid quoted string (new line)"),
pytest.param("KEY=VALUE", False, {"KEY": "VALUE"}, id="enumerated string"),
pytest.param("KEY=<@_@>... | code_fim | hard | {
"lang": "python",
"repo": "streamlink/streamlink",
"path": "/tests/stream/test_hls_playlist.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class TestHLSPlaylist:
def test_load(self):
with text("hls/test_1.m3u8") as m3u8_fh:
playlist = load(m3u8_fh.read(), "http://test.se/")
assert playlist.media == [
Media(
uri="http://test.se/audio/stereo/en/128kbit.m3u8",
type="AU... | code_fim | hard | {
"lang": "python",
"repo": "streamlink/streamlink",
"path": "/tests/stream/test_hls_playlist.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'vali',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.mess... | code_fim | hard | {
"lang": "python",
"repo": "kxy-web/ThreeCoolCat",
"path": "/ThreeCoolCat/settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kxy-web/ThreeCoolCat path: /ThreeCoolCat/settings.py
"""
Django settings for ThreeCoolCat project.
Generated by 'django-admin startproject' using Django 3.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their ... | code_fim | hard | {
"lang": "python",
"repo": "kxy-web/ThreeCoolCat",
"path": "/ThreeCoolCat/settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
link_list=list(set(link_list))
with open('maclar.txt', 'w') as f:
for item in link_list:
f.write("%s\n" % item)
driver.close()
return link_list<|fim_prefix|># repo: furkanalpereny/mackolikData path: /app/get_links.py
from selenium import webdriver
import time
def g... | code_fim | hard | {
"lang": "python",
"repo": "furkanalpereny/mackolikData",
"path": "/app/get_links.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: furkanalpereny/mackolikData path: /app/get_links.py
from selenium import webdriver
import time
def get_links(link, season_xpath):
firefox_path = "/home/muschkulpesend/Documents/Projects/mackolikData/geckodriver"
driver = webdriver.Firefox(executable_path=firefox_path)
driver.get(link... | code_fim | hard | {
"lang": "python",
"repo": "furkanalpereny/mackolikData",
"path": "/app/get_links.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: avantoss/loop path: /models.py
# The MIT License (MIT)
#
# Copyright (c) 2014-2017 Avant, Kirill Sevastyanenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without... | code_fim | hard | {
"lang": "python",
"repo": "avantoss/loop",
"path": "/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> __tablename__ = 'submissions'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
model_id = db.Column(db.String(), ForeignKey('model_grids.id'), index=True)
loop_id = db.Column(db.Integer())
value = db.Column(db.Float())
created_at = db.Column(DateTime, default=date... | code_fim | hard | {
"lang": "python",
"repo": "avantoss/loop",
"path": "/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: webdeveloppro/aiohttp_boilerplate path: /aiohttp_boilerplate/sql/__init__.py
import re
from aiohttp_boilerplate.config import config
from aiohttp_boilerplate.logging import sql_logger
from aiohttp_boilerplate.sql import consts
class SQLException(Exception):
pass
class SQL(object):
d... | code_fim | hard | {
"lang": "python",
"repo": "webdeveloppro/aiohttp_boilerplate",
"path": "/aiohttp_boilerplate/sql/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.params = params
await self.get_connection()
self.logger.debug(f'query: %s, values: %s', self.query, self.params.values())
try:
result = await self.conn.execute(self.query, *params.values())
finally:
await self.release()
retur... | code_fim | hard | {
"lang": "python",
"repo": "webdeveloppro/aiohttp_boilerplate",
"path": "/aiohttp_boilerplate/sql/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.SetStartDate(2013,10,1)
self.SetEndDate(2013,10,31)
self.SetCash(100000)
self.changes = None
self.UniverseSettings.Resolution = Resolution.Hour
# select IBM once a week, empty universe the other days
self.AddUniverseSelection(CustomUniverseSel... | code_fim | medium | {
"lang": "python",
"repo": "Capnode/Algoloop",
"path": "/Algorithm.Python/InceptionDateSelectionRegressionAlgorithm.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def OnSecuritiesChanged(self, changes):
# liquidate removed securities
for security in changes.RemovedSecurities:
self.Liquidate(security.Symbol, "Removed from Universe")
self.changes = changes<|fim_prefix|># repo: Capnode/Algoloop path: /Algorithm.Python/Inceptio... | code_fim | hard | {
"lang": "python",
"repo": "Capnode/Algoloop",
"path": "/Algorithm.Python/InceptionDateSelectionRegressionAlgorithm.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Capnode/Algoloop path: /Algorithm.Python/InceptionDateSelectionRegressionAlgorithm.py
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "Licen... | code_fim | hard | {
"lang": "python",
"repo": "Capnode/Algoloop",
"path": "/Algorithm.Python/InceptionDateSelectionRegressionAlgorithm.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: drlamb/hotbox path: /facerec.py
import numpy as np
from picamera.array import PiRGBArray
from picamera import PiCamera
import cv2
import time
from PIL import Image
#from bob.ip.base.Flandmark import Flandmark
# Initializes the Camera
camera = PiCamera()
camera.resolution = (1296,736) # Reduces t... | code_fim | hard | {
"lang": "python",
"repo": "drlamb/hotbox",
"path": "/facerec.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.