text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: furutuki/LeetCodeSolution path: /0097. Interleaving String/Solution_dp.py
class Solution:
def isInterleave(self, s1: str, s2: str, s3: str) -> bool:
<|fim_suffix|> f = [[False for i in range(n + 1)] for _ in range(m + 1)]
f[0][0] = True
for i in range(m + 1):
... | code_fim | hard | {
"lang": "python",
"repo": "furutuki/LeetCodeSolution",
"path": "/0097. Interleaving String/Solution_dp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return f[m][n]
s = Solution()
print(s.isInterleave("aabcc", "dbbca", "aadbbcbcac"))<|fim_prefix|># repo: furutuki/LeetCodeSolution path: /0097. Interleaving String/Solution_dp.py
class Solution:
def isInterleave(self, s1: str, s2: str, s3: str) -> bool:
m = len(s1)
n = len(s... | code_fim | hard | {
"lang": "python",
"repo": "furutuki/LeetCodeSolution",
"path": "/0097. Interleaving String/Solution_dp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Change a light color."""
light_kwargs = { "rgb_color": color }
if not self.use_current_brightness:
light_kwargs["brightness"] = 255
self.turn_on(light, **light_kwargs)
def get_colors(self, url):
"""Get the palette of colors from url."""
fd = urlopen(url)
f = io.By... | code_fim | medium | {
"lang": "python",
"repo": "darylosu/ad-media-lights-sync",
"path": "/apps/media_lights_sync/media_lights_sync.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def format_ha_url(self, url):
"""Append ha_url if this is a relative url"""
is_relative = not url.startswith("http")
if not is_relative:
return url
elif is_relative and self.ha_url is None:
raise ValueError("ha_url must be specified when using relative url for photo_attribute... | code_fim | hard | {
"lang": "python",
"repo": "darylosu/ad-media-lights-sync",
"path": "/apps/media_lights_sync/media_lights_sync.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: darylosu/ad-media-lights-sync path: /apps/media_lights_sync/media_lights_sync.py
"""Synchronize RGB lights with media player thumbnail"""
import appdaemon.plugins.hass.hassapi as hass
import sys
import threading
import io
from PIL import Image
if sys.version_info < (3, 0):
from urllib2 impor... | code_fim | medium | {
"lang": "python",
"repo": "darylosu/ad-media-lights-sync",
"path": "/apps/media_lights_sync/media_lights_sync.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Exopy/exopy path: /exopy/tasks/utils/building.py
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by Exopy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license i... | code_fim | hard | {
"lang": "python",
"repo": "Exopy/exopy",
"path": "/exopy/tasks/utils/building.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif mode == 'from template':
manager = event.workbench.get_plugin('exopy.tasks')
view = TemplateSelector(event.parameters.get('widget'),
manager=manager)
result = view.exec_()
if result:
path = view.path
config, _ = l... | code_fim | hard | {
"lang": "python",
"repo": "Exopy/exopy",
"path": "/exopy/tasks/utils/building.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Flomastruk/ParametricModels path: /setup.py
from setuptools import setup, find_packages
<|fim_suffix|>print("Installed: ", find_packages())<|fim_middle|>setup(name='parametricmodels',
packages=['parametricmodels'])
| code_fim | medium | {
"lang": "python",
"repo": "Flomastruk/ParametricModels",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("Installed: ", find_packages())<|fim_prefix|># repo: Flomastruk/ParametricModels path: /setup.py
from setuptools import setup, find_packages
<|fim_middle|>setup(name='parametricmodels',
packages=['parametricmodels'])
| code_fim | medium | {
"lang": "python",
"repo": "Flomastruk/ParametricModels",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># All declaration
__all__ = ['base', 'core', 'dialog', 'general', 'manager']
__all__.extend(base.__all__)
__all__.extend(core.__all__)
__all__.extend(dialog.__all__)
__all__.extend(general.__all__)
__all__.extend(manager.__all__)
# Author declaration
__author__ = "Ellert van der Velden (@1313e)"<|fim_pre... | code_fim | hard | {
"lang": "python",
"repo": "ra2003/GuiPy-1",
"path": "/guipy/config/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ra2003/GuiPy-1 path: /guipy/config/__init__.py
# -*- coding: utf-8 -*-
"""
Configuration
=============
Contains all the configuration files and functions of *GuiPy*.
<|fim_suffix|># All declaration
__all__ = ['base', 'core', 'dialog', 'general', 'manager']
__all__.extend(base.__all__)
__all__.e... | code_fim | hard | {
"lang": "python",
"repo": "ra2003/GuiPy-1",
"path": "/guipy/config/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Import config pages
from . import general
from .general import *
# All declaration
__all__ = ['base', 'core', 'dialog', 'general', 'manager']
__all__.extend(base.__all__)
__all__.extend(core.__all__)
__all__.extend(dialog.__all__)
__all__.extend(general.__all__)
__all__.extend(manager.__all__)
# Autho... | code_fim | medium | {
"lang": "python",
"repo": "ra2003/GuiPy-1",
"path": "/guipy/config/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pokotsun/kyutechAppServer2018 path: /api/migrations/0002_auto_20180412_0051.py
# Generated by Django 2.0.4 on 2018-04-11 15:51
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AlterModelOpti... | code_fim | medium | {
"lang": "python",
"repo": "pokotsun/kyutechAppServer2018",
"path": "/api/migrations/0002_auto_20180412_0051.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='news',
options={'verbose_name_plural': 'News'},
),
migrations.AlterModelOptions(
name='newsheading',
options={'verbose... | code_fim | medium | {
"lang": "python",
"repo": "pokotsun/kyutechAppServer2018",
"path": "/api/migrations/0002_auto_20180412_0051.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>names.append({
"text": name,
"value": name
})
school_names = [school_names.pop(school_names.index({
"text": "Menlo School",
"value": "Menlo School"}))] + school_names
print(school_names)
json.dump(school_names, open("static/school_names.json", "w"))... | code_fim | hard | {
"lang": "python",
"repo": "MenloHacks/StudentApplication",
"path": "/scrape_schools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MenloHacks/StudentApplication path: /scrape_schools.py
import requests
from bs4 import BeautifulSoup
import json
address = "https://en.wikipedia.org/wiki/List_of_high_schools_in_California?oldformat=true"
page = requests.get(address)
soup = BeautifulSoup(page.text)
items = soup.select("#mw-conte... | code_fim | hard | {
"lang": "python",
"repo": "MenloHacks/StudentApplication",
"path": "/scrape_schools.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jasdumas/jasdumas.github.io path: /tech-short-papers/system_info.py
## Acquried from: https://gist.github.com/jasdumas/53b0cbfbb8af3e435dafb833357fd67f
try:
from html import escape
except ImportError:
from cgi import escape
import os
from string import Template
import sys
import platform... | code_fim | hard | {
"lang": "python",
"repo": "jasdumas/jasdumas.github.io",
"path": "/tech-short-papers/system_info.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
if allow_import:
import ldap
else:
ldap = sys.modules['ldap']
except (KeyError, ImportError):
return ''
return ('LDAP support', [
('Python-LDAP Version', ldap.__version__),
('API Version', ldap.API_VERSION),
('Default... | code_fim | hard | {
"lang": "python",
"repo": "jasdumas/jasdumas.github.io",
"path": "/tech-short-papers/system_info.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: girder/dkc-next path: /dkc/core/tasks.py
from celery import shared_task
from dkc.core.models import File, Folder
@shared_task()
def file_compute_sha512(file_id: int):
file = File.objects.get(pk=file_id)
file.compute_sha512()
file.save()
<|fim_suffix|> Folder.objects.get(pk=fol... | code_fim | easy | {
"lang": "python",
"repo": "girder/dkc-next",
"path": "/dkc/core/tasks.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@shared_task()
def delete_folder(folder_id: int):
Folder.objects.get(pk=folder_id).delete()<|fim_prefix|># repo: girder/dkc-next path: /dkc/core/tasks.py
from celery import shared_task
from dkc.core.models import File, Folder
<|fim_middle|>
@shared_task()
def file_compute_sha512(file_id: int):
... | code_fim | medium | {
"lang": "python",
"repo": "girder/dkc-next",
"path": "/dkc/core/tasks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: helight/helight_code path: /dev_code/thrift_httpd/rpc/SConstruct
import os
env = Environment() # Initialize the environment
env.Append(CCFLAGS = ['-g','-DHAVE_NETINET_IN_H', '-DHAVE_INTTYPES_H'])
env.Append(LIBS = ['boost_system','boost_filesystem', 'boost_thread'])
env.Append(CPPPATH = ['../.... | code_fim | medium | {
"lang": "python",
"repo": "helight/helight_code",
"path": "/dev_code/thrift_httpd/rpc/SConstruct",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>env.StaticLibrary(
target = "rpc_server_status",
source = Glob('*.cpp')
)<|fim_prefix|># repo: helight/helight_code path: /dev_code/thrift_httpd/rpc/SConstruct
import os
env = Environment() # Initialize the environment
env.Append(CCFLAGS = ['-g','-DHAVE_NETINET_IN_H', '-DHAVE_INTTYPES_H'])... | code_fim | medium | {
"lang": "python",
"repo": "helight/helight_code",
"path": "/dev_code/thrift_httpd/rpc/SConstruct",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Help document
# streamlit_player.st_player(url, height=None, playing=None, loop=None, controls=True, light=None, volume=None, muted=None, playback_rate=None, progress_interval=None, play_inline=None, events=None, config=None, key=None)
# Embed a video or music player.
# Parameters
# ----------
# url : ... | code_fim | hard | {
"lang": "python",
"repo": "TheMusicMasters/TheMusicMastersFanPage",
"path": "/TMM_fanpage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TheMusicMasters/TheMusicMastersFanPage path: /TMM_fanpage.py
import streamlit as st
from streamlit_player import st_player, _SUPPORTED_EVENTS
#st.set_page_config(layout='wide')
st.title('The Music Masters Fan Page')
st.markdown("""
**The Music Masters**
* [Twitter](https://twitter.com/themusic... | code_fim | hard | {
"lang": "python",
"repo": "TheMusicMasters/TheMusicMastersFanPage",
"path": "/TMM_fanpage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>e(newQc, backend, shots=shots)
result = job.result()
print("\n The results are: " + str(result.get_counts(newQc)) + "\n")
except Exception as inst:
d = inst
print(d)
if __name__ == "__main__":
main()<|fim_prefix|># repo: mentesniker/OpenQasmInterpreter path: /oqi/o... | code_fim | hard | {
"lang": "python",
"repo": "mentesniker/OpenQasmInterpreter",
"path": "/oqi/oqi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mentesniker/OpenQasmInterpreter path: /oqi/oqi.py
def main():
from qiskit import QuantumCircuit,execute,BasicAer
import sys
try:
if(len(sys.argv) > 1):
filename = str(sys.argv[1])
else:
raise FileNotFoundError("\n File name must be specified on... | code_fim | hard | {
"lang": "python",
"repo": "mentesniker/OpenQasmInterpreter",
"path": "/oqi/oqi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _parse_calendar(self, response):
"""Parse dates and details from schedule PDF"""
lp = LAParams(line_margin=0.1)
out_str = StringIO()
extract_text_to_fp(BytesIO(response.body), out_str, laparams=lp)
pdf_text = re.sub(r"\s+", " ", out_str.getvalue()).replace("... | code_fim | hard | {
"lang": "python",
"repo": "City-Bureau/city-scrapers-akr",
"path": "/city_scrapers/spiders/akr_urban_design_historic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: City-Bureau/city-scrapers-akr path: /city_scrapers/spiders/akr_urban_design_historic.py
import re
from datetime import datetime
from io import BytesIO, StringIO
from city_scrapers_core.constants import COMMISSION
from city_scrapers_core.items import Meeting
from city_scrapers_core.spiders import... | code_fim | hard | {
"lang": "python",
"repo": "City-Bureau/city-scrapers-akr",
"path": "/city_scrapers/spiders/akr_urban_design_historic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.bot.send_message(self.chat_id, text, **options)
def reply(self, text):
return self.send_msg(text, reply_to_message_id=self.message['message_id'])
def send_pic(self):
pass<|fim_prefix|># repo: kashtan404/zbx_telegram_bot path: /zbxtelebot/telegram_api.py
impor... | code_fim | medium | {
"lang": "python",
"repo": "kashtan404/zbx_telegram_bot",
"path": "/zbxtelebot/telegram_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.send_msg(text, reply_to_message_id=self.message['message_id'])
def send_pic(self):
pass<|fim_prefix|># repo: kashtan404/zbx_telegram_bot path: /zbxtelebot/telegram_api.py
import json
import asyncio
import aiohttp
MESSAGE_UPDATES = ['message', 'edited_message', 'channel_p... | code_fim | medium | {
"lang": "python",
"repo": "kashtan404/zbx_telegram_bot",
"path": "/zbxtelebot/telegram_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kashtan404/zbx_telegram_bot path: /zbxtelebot/telegram_api.py
import json
import asyncio
import aiohttp
MESSAGE_UPDATES = ['message', 'edited_message', 'channel_post', 'edited_channel_post']
RETRY_TIMEOUT = 30
API_TIMEOUT = 60
RETRY_CODES = [429, 500, 502, 503, 504]
class Telegram(object):
... | code_fim | medium | {
"lang": "python",
"repo": "kashtan404/zbx_telegram_bot",
"path": "/zbxtelebot/telegram_api.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: larribas/dagger-contrib path: /tests/serializer/path/test_as_zip.py
import io
import os
import tempfile
import pytest
from dagger import DeserializationError, Serializer
from dagger_contrib.serializer.path.as_zip import AsZip, _find_base_dir
SUPPORTED_COMPRESSION_MODES = [
"stored",
"d... | code_fim | hard | {
"lang": "python",
"repo": "larribas/dagger-contrib",
"path": "/tests/serializer/path/test_as_zip.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with pytest.raises(AssertionError):
with tempfile.TemporaryDirectory() as tmp:
AsZip(output_dir=tmp, compression="unsupported")
def test_find_base_dir():
cases = [
{
"paths": ["a"],
"expected_result": "a",
},
{
"path... | code_fim | hard | {
"lang": "python",
"repo": "larribas/dagger-contrib",
"path": "/tests/serializer/path/test_as_zip.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gamaievsky/DescripteursHarmoniquesAudio path: /cluster_rotate.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
======================================
Clustering by rotation of eigenvectors
======================================
cluster by rotating eigenvectors to align with the canonical coordi... | code_fim | hard | {
"lang": "python",
"repo": "gamaievsky/DescripteursHarmoniquesAudio",
"path": "/cluster_rotate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> theta_new = np.array([td - alpha * dQ if k == d else t for k,t in enumerate(theta) ])
if theta_new[d]-theta[d] == 0:
print('(it, d)', it, d, theta_new[d]-theta[d])
sys.exit()
evecsRot = rotate_givens(evecs, theta_new, ik, jk, angle_num, dim)
Q_new = evqual(evecsRot, ik, jk, dim, ... | code_fim | hard | {
"lang": "python",
"repo": "gamaievsky/DescripteursHarmoniquesAudio",
"path": "/cluster_rotate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Invoke the Controller"""
# WSGIController.__call__ dispatches to the Controller method
# the request is routed to. This routing information is
# available in environ['pylons.routes_dict']
try:
id = ''
if 'type' in request.params:
... | code_fim | hard | {
"lang": "python",
"repo": "andreagia/WEBNMR",
"path": "/webenmr/lib/base.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders
to = submit_to
cc = submit_cc
msg = MIMEMultipart()
m... | code_fim | hard | {
"lang": "python",
"repo": "andreagia/WEBNMR",
"path": "/webenmr/lib/base.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andreagia/WEBNMR path: /webenmr/lib/base.py
"""The base Controller API
Provides the BaseController class for subclassing.
"""
import logging
from decorator import decorator
from paste.request import construct_url
from paste.httpexceptions import HTTPMovedPermanently
from pylons import request, s... | code_fim | hard | {
"lang": "python",
"repo": "andreagia/WEBNMR",
"path": "/webenmr/lib/base.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>u00a0]+-[ \f\v\u202f\u00a0]+(.+?)[ \f\v\u202f\u00a0]+-[ \f\v\u202f\u00a0]',
r' – \1 – ', text)
text = re.sub(
r'[ \f\v\u202f\u00a0]+-[ \f\v\u202f\u00a0]+',
' – ', text)
text = re.sub(
r'[ \f\v\u202f\u00a0]+"(.+?)"([ \f\v\u202f\u00a0]?)',
r' “\1”\2', text)
... | code_fim | hard | {
"lang": "python",
"repo": "Esukhia/karmasataka",
"path": "/text_formatting.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Esukhia/karmasataka path: /text_formatting.py
import re
def format_fr(text):
if 'est étonnant' in text:
print('')
# see http://unicode.org/udhr/n/notes_fra.html
text = re.sub(r'([ \f\v\u202f\u00a0])+', r'\1', text)
text = re.sub(r'[ \f\v\u202f\u00a0]+,', r',', text)
... | code_fim | hard | {
"lang": "python",
"repo": "Esukhia/karmasataka",
"path": "/text_formatting.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __repr__(self):
return "<{class_name} velocity={velocity}>".format(**{
"class_name": self.__class__.__name__,
"velocity": self.velocity,
})<|fim_prefix|># repo: sawich/havok-reflection path: /havok_classes/hkpMovingSurfaceModifierConstraintAtom.py
from .hkp... | code_fim | hard | {
"lang": "python",
"repo": "sawich/havok-reflection",
"path": "/havok_classes/hkpMovingSurfaceModifierConstraintAtom.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, infile):
self.velocity = struct.unpack('>4f', infile.read(16)) # TYPE_VECTOR4:TYPE_VOID
def __repr__(self):
return "<{class_name} velocity={velocity}>".format(**{
"class_name": self.__class__.__name__,
"velocity": self.velocity,
... | code_fim | easy | {
"lang": "python",
"repo": "sawich/havok-reflection",
"path": "/havok_classes/hkpMovingSurfaceModifierConstraintAtom.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sawich/havok-reflection path: /havok_classes/hkpMovingSurfaceModifierConstraintAtom.py
from .hkpModifierConstraintAtom import hkpModifierConstraintAtom
import struct
class hkpMovingSurfaceModifierConstraintAtom(hkpModifierConstraintAtom):
velocity: vector4
def __init__(self, infile):
<... | code_fim | medium | {
"lang": "python",
"repo": "sawich/havok-reflection",
"path": "/havok_classes/hkpMovingSurfaceModifierConstraintAtom.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>penumpang': 'Dimitri', 'naikDari': 'B', 'tujuan': 'F', 'bayar': 8000},
{'penumpang': 'Icha', 'naikDari': 'A', 'tujuan': 'B', 'bayar': 2000}
]
'''
print(naikAngkot([]))
'''
[]
'''<|fim_prefix|># repo: SyamsulAlterra/Alta path: /StrukturData/Problem3/2-Naik-Angkot.py
def naikAngkot(arg):
rute=["a","b... | code_fim | medium | {
"lang": "python",
"repo": "SyamsulAlterra/Alta",
"path": "/StrukturData/Problem3/2-Naik-Angkot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SyamsulAlterra/Alta path: /StrukturData/Problem3/2-Naik-Angkot.py
def naikAngkot(arg):
rute=["a","b","c","d","e","f"]
hasilNarik=[]
for penumpang in arg:
dataPenumpang={}
dataPenumpang["penumpang"]=penumpang[0]
<|fim_suffix|> dataPenumpang["bayar"]=2000*totalRute
... | code_fim | medium | {
"lang": "python",
"repo": "SyamsulAlterra/Alta",
"path": "/StrukturData/Problem3/2-Naik-Angkot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def cleanup(self, storage):
_files = []
paginator = self.aws_s3_client.get_paginator('list_objects')
page_iterator = paginator.paginate(Bucket=storage.storage)
for page in page_iterator:
if 'Contents' in page:
for obj in page['Contents']:
... | code_fim | hard | {
"lang": "python",
"repo": "epam/cloud-pipeline",
"path": "/storage-lifecycle-service/integrational_tests/processor/environment_preparation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, aws_region, mode=SETUP_MODE):
self.aws_region = aws_region
self.mode = mode
self.cloud_preparators = {
"S3": AWSStorageTestCasePreparator(aws_region)
}
def process(self, testcase):
for storage in testcase.cloud.storages if tes... | code_fim | hard | {
"lang": "python",
"repo": "epam/cloud-pipeline",
"path": "/storage-lifecycle-service/integrational_tests/processor/environment_preparation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: epam/cloud-pipeline path: /storage-lifecycle-service/integrational_tests/processor/environment_preparation.py
# Copyright 2022 EPAM Systems, Inc. (https://www.epam.com/)
# #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with... | code_fim | hard | {
"lang": "python",
"repo": "epam/cloud-pipeline",
"path": "/storage-lifecycle-service/integrational_tests/processor/environment_preparation.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RobPethick/Favrobot path: /tests/app/test_widgetService.py
import unittest
from testHelpers.mockRequester import MockRequester
from testHelpers.jsonHelper import JsonHelper
from lib.app.widgetService import WidgetService
from lib.models.collection import Collection
class TestWidgetService(unitte... | code_fim | hard | {
"lang": "python",
"repo": "RobPethick/Favrobot",
"path": "/tests/app/test_widgetService.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.requester.widgets = {'entities': [widgetA, widgetB, widgetC, widgetD]}
# Act
result = self.widgetService.getWidgets("1234567")
# Assert
self.assertTrue(self.requester.hasGetWidgetsBeenCalled)
self.assertEqual(len(result), 4)
self.assertEqual(r... | code_fim | hard | {
"lang": "python",
"repo": "RobPethick/Favrobot",
"path": "/tests/app/test_widgetService.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Act
self.widgetService.addWeeklyBoard(Collection(JsonHelper.getBasicCollectionJsonWithNameAndId("Daily Goals", 123456)), "Daily Goals 01-01-2017")
# Assert
self.assertTrue(self.requester.hasCreateBoardBeenCalled)
self.assertEqual(self.requester.columnsAdded, ['Do... | code_fim | hard | {
"lang": "python",
"repo": "RobPethick/Favrobot",
"path": "/tests/app/test_widgetService.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, master, **kw):
'''This frame should be packed to fill x direction.
If default=True (and it is initially True) the yes or ok button will be marked as the default button (unless the keyword arguments for the buttons suggest otherwise).
If a button is ma... | code_fim | hard | {
"lang": "python",
"repo": "j-kun/Irre-Katze-Level-Editor",
"path": "/py/tkinter_extensions.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: j-kun/Irre-Katze-Level-Editor path: /py/tkinter_extensions.py
self.button_no.pack(side=tk.RIGHT)
if self.button_cancel!=None:
self.button_cancel.pack(side=tk.LEFT)
else:
if self.button_cancel!=None:
self.... | code_fim | hard | {
"lang": "python",
"repo": "j-kun/Irre-Katze-Level-Editor",
"path": "/py/tkinter_extensions.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: j-kun/Irre-Katze-Level-Editor path: /py/tkinter_extensions.py
if text == "" or text == None:
state = tkc.STATE_DISABLED
else:
state = tkc.STATE_NORMAL
widget.configure(text = text, state = state)
else:
log.error("set_text is not implemen... | code_fim | hard | {
"lang": "python",
"repo": "j-kun/Irre-Katze-Level-Editor",
"path": "/py/tkinter_extensions.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|># If base_models contains models instead of ids, replace with model id
for (i in 1:length(base_models)) {
if (inherits(base_models[[i]], 'H2OModel')) {
base_models[[i]] <- base_models[[i]]@model_id
}
}
""",
set_required_params="""
parms$training_frame <- training_frame
args <- .verify_dataxy(t... | code_fim | hard | {
"lang": "python",
"repo": "Max-Edelson/h2o-3",
"path": "/h2o-bindings/bin/custom/R/gen_stackedensemble.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Max-Edelson/h2o-3 path: /h2o-bindings/bin/custom/R/gen_stackedensemble.py
rest_api_version = 99
def update_param(name, param):
if name == 'metalearner_params':
param['default_value'] = None
return param
if name == 'base_models':
param['type'] = 'list'
par... | code_fim | hard | {
"lang": "python",
"repo": "Max-Edelson/h2o-3",
"path": "/h2o-bindings/bin/custom/R/gen_stackedensemble.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CiscoTestAutomation/genieparser path: /src/genie/libs/parser/iosxr/tests/ShowProtocolsAfiAllAll/cli/equal/golden_output_2_expected.py
expected_output = {
"protocols": {
"ospf": {
"vrf": {
"default": {
"address_family": {
... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genieparser",
"path": "/src/genie/libs/parser/iosxr/tests/ShowProtocolsAfiAllAll/cli/equal/golden_output_2_expected.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
}
}
}
}
},
"bgp": {
"bgp_pid": 100,
"nsr": {
"enable": True,
"current_state": "tcp initial sync"
},
... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genieparser",
"path": "/src/genie/libs/parser/iosxr/tests/ShowProtocolsAfiAllAll/cli/equal/golden_output_2_expected.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ashritha28/Hospital-Home path: /my_proj/src/healthtips/urls.py
from django.conf.urls import url
from django.views.gene<|fim_suffix|> = [
url(r'^', TemplateView.as_view(template_name= "healthtips/healthtips.html"), name="healthtips"),
]<|fim_middle|>ric import TemplateView
from . import vi... | code_fim | easy | {
"lang": "python",
"repo": "Ashritha28/Hospital-Home",
"path": "/my_proj/src/healthtips/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> = [
url(r'^', TemplateView.as_view(template_name= "healthtips/healthtips.html"), name="healthtips"),
]<|fim_prefix|># repo: Ashritha28/Hospital-Home path: /my_proj/src/healthtips/urls.py
from django.conf.urls import url
from django.views.gene<|fim_middle|>ric import TemplateView
from . import vi... | code_fim | easy | {
"lang": "python",
"repo": "Ashritha28/Hospital-Home",
"path": "/my_proj/src/healthtips/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: safkatarefinba/django-docker-template path: /src/tweet/tests.py
from django.test import TestCase
from django.core.urlresolvers import reverse
from tweet.models import Tweet
class TweetTest(TestCase):
def setUp(self):
<|fim_suffix|> url = reverse('list_tweets')
response = sel... | code_fim | medium | {
"lang": "python",
"repo": "safkatarefinba/django-docker-template",
"path": "/src/tweet/tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> url = reverse('get_tweet', kwargs={'pk': 12345})
response = self.client.get(url)
assert response.status_code == 404<|fim_prefix|># repo: safkatarefinba/django-docker-template path: /src/tweet/tests.py
from django.test import TestCase
from django.core.urlresolvers import reverse
fr... | code_fim | hard | {
"lang": "python",
"repo": "safkatarefinba/django-docker-template",
"path": "/src/tweet/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.tweet = Tweet.objects.create(text='Test tweet')
Tweet.objects.create(text='Another tweet')
def test_list_tweets(self):
url = reverse('list_tweets')
response = self.client.get(url)
assert response.status_code == 200
result = response.json()
... | code_fim | medium | {
"lang": "python",
"repo": "safkatarefinba/django-docker-template",
"path": "/src/tweet/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def build_backend(self) -> Optional[str]:
return self._build_system.backend
@property
def build_backend_base(self) -> Optional[str]:
if self.build_backend is None:
return None
at = self.build_backend.find(':')
if at == -1:
... | code_fim | hard | {
"lang": "python",
"repo": "gaborbernat/toxn",
"path": "/src/toxn/config/models/task/build.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gaborbernat/toxn path: /src/toxn/config/models/task/build.py
import argparse
from pathlib import Path
from types import SimpleNamespace
from typing import List, Optional, Type, Union, cast
from toxn.config.project import BuildSystem, ConfDict
from .base import TaskConfig
class BuildTaskConfig(... | code_fim | hard | {
"lang": "python",
"repo": "gaborbernat/toxn",
"path": "/src/toxn/config/models/task/build.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> decoder = load_decoder(
labels=model.labels,
cfg=cfg.lm
)
target_decoder = GreedyDecoder(
labels=model.labels,
blank_index=model.labels.index('_')
)
test_dataset = SpectrogramDataset(
plot = cfg.plot,
attack = cfg.attack,
input_wo... | code_fim | hard | {
"lang": "python",
"repo": "zhuzhui-2000/Audio-Attack",
"path": "/deepspeech.pytorch/deepspeech_pytorch/testing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhuzhui-2000/Audio-Attack path: /deepspeech.pytorch/deepspeech_pytorch/testing.py
import hydra
import torch
import numpy
import torch.optim as optim
from deepspeech_pytorch.configs.inference_config import EvalConfig
from deepspeech_pytorch.decoder import GreedyDecoder
from deepspeech_pytorch.loa... | code_fim | hard | {
"lang": "python",
"repo": "zhuzhui-2000/Audio-Attack",
"path": "/deepspeech.pytorch/deepspeech_pytorch/testing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return vocab
special_tokens = {"init_token": "<start>", "eos_token": "<end>",
"pad_token": "<pad>", "unk_token": "<unk>"}<|fim_prefix|># repo: pensieves/accio path: /deep_learn/dataset/text/utils.py
from torchtext.vocab import Vocab, Vectors
from collections import Counter
from cop... | code_fim | hard | {
"lang": "python",
"repo": "pensieves/accio",
"path": "/deep_learn/dataset/text/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pensieves/accio path: /deep_learn/dataset/text/utils.py
from torchtext.vocab import Vocab, Vectors
from collections import Counter
from copy import deepcopy
def vocab_from_vectors(vector_kwargs_list, vocab_kwargs):
r"""Get Vocab object encompassing all the words in each vector list items.
... | code_fim | hard | {
"lang": "python",
"repo": "pensieves/accio",
"path": "/deep_learn/dataset/text/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> vocab_kwargs["vectors"] = vectors
vocab = Vocab(**vocab_kwargs)
return vocab
special_tokens = {"init_token": "<start>", "eos_token": "<end>",
"pad_token": "<pad>", "unk_token": "<unk>"}<|fim_prefix|># repo: pensieves/accio path: /deep_learn/dataset/text/utils.py
from torch... | code_fim | hard | {
"lang": "python",
"repo": "pensieves/accio",
"path": "/deep_learn/dataset/text/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def summarized_reviews(self, aspect_details):
for aspect, detail in aspect_details.items():
for rev in detail.review_list.keys():
summarized_review = self.generate_summary(rev)
rating = detail.review_list[rev]
detail.review_summary[s... | code_fim | hard | {
"lang": "python",
"repo": "AchiraFernando/Hotel-Comparator",
"path": "/source/review_summarizer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AchiraFernando/Hotel-Comparator path: /source/review_summarizer.py
from nltk.corpus import stopwords
from nltk import sent_tokenize, word_tokenize
import heapq
from preprocessor import PreProcessor
class ReviewSummarizer:
def generate_summary(self, review):
pp = PreProcessor()
... | code_fim | hard | {
"lang": "python",
"repo": "AchiraFernando/Hotel-Comparator",
"path": "/source/review_summarizer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return summarized
def summarized_reviews(self, aspect_details):
for aspect, detail in aspect_details.items():
for rev in detail.review_list.keys():
summarized_review = self.generate_summary(rev)
rating = detail.review_list[rev]
... | code_fim | hard | {
"lang": "python",
"repo": "AchiraFernando/Hotel-Comparator",
"path": "/source/review_summarizer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chromium/chromium path: /gpu/config/build_workaround_header.py
#!/usr/bin/env python3
# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""code generator for gpu workaround definitions"""
import argparse
im... | code_fim | hard | {
"lang": "python",
"repo": "chromium/chromium",
"path": "/gpu/config/build_workaround_header.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
parser = argparse.ArgumentParser(
description='Generate GPU workaround definitions')
parser.add_argument(
"--output-file",
default="gpu_driver_bug_workaround_autogen.h",
help="the name of the header file to write")
parser.add_argument(
'files',
nargs=... | code_fim | hard | {
"lang": "python",
"repo": "chromium/chromium",
"path": "/gpu/config/build_workaround_header.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>_LICENSE = """// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
"""
_DO_NOT_EDIT_WARNING = ("// This file is auto-generated from\n" +
"// //gpu/config/build_workaround_header.py\n" +
"// DO NOT EDIT!\n\n"... | code_fim | medium | {
"lang": "python",
"repo": "chromium/chromium",
"path": "/gpu/config/build_workaround_header.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sinotradition/meridian path: /meridian/acupoints/dachangshu424.py
#!/usr/bin/python
#coding=utf-8
<|fim_suffix|>
SPELL=u'dàchángshù'
CN=u'大肠俞'
NAME=u'dachangshu424'
CHANNEL='bladder'
CHANNEL_FULLNAME='BladderChannelofFoot-Taiyang'
SEQ='BL25'
if __name__ == '__main__':
pass<|fim_middle|>
''... | code_fim | easy | {
"lang": "python",
"repo": "sinotradition/meridian",
"path": "/meridian/acupoints/dachangshu424.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
pass<|fim_prefix|># repo: sinotradition/meridian path: /meridian/acupoints/dachangshu424.py
#!/usr/bin/python
#coding=utf-8
<|fim_middle|>
'''
@author: sheng
@license:
'''
SPELL=u'dàchángshù'
CN=u'大肠俞'
NAME=u'dachangshu424'
CHANNEL='bladder'
CHANNEL_FULLNAME='BladderCha... | code_fim | medium | {
"lang": "python",
"repo": "sinotradition/meridian",
"path": "/meridian/acupoints/dachangshu424.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>SPELL=u'dàchángshù'
CN=u'大肠俞'
NAME=u'dachangshu424'
CHANNEL='bladder'
CHANNEL_FULLNAME='BladderChannelofFoot-Taiyang'
SEQ='BL25'
if __name__ == '__main__':
pass<|fim_prefix|># repo: sinotradition/meridian path: /meridian/acupoints/dachangshu424.py
#!/usr/bin/python
#coding=utf-8
<|fim_middle|>'''... | code_fim | easy | {
"lang": "python",
"repo": "sinotradition/meridian",
"path": "/meridian/acupoints/dachangshu424.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for url in ['', 'by_repo/', 'by_arch/']:
response = self.client.get('/visualize/{}'.format(url))
self.assertEqual(response.status_code, 200)<|fim_prefix|># repo: VanirLab/VOS path: /visualize/tests.py
from django.test import TestCase
class VisualeTest(TestCase):
<|... | code_fim | medium | {
"lang": "python",
"repo": "VanirLab/VOS",
"path": "/visualize/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VanirLab/VOS path: /visualize/tests.py
from django.test import TestCase
class VisualeTest(TestCase):
<|fim_suffix|> for url in ['', 'by_repo/', 'by_arch/']:
response = self.client.get('/visualize/{}'.format(url))
self.assertEqual(response.status_code, 200)<|... | code_fim | medium | {
"lang": "python",
"repo": "VanirLab/VOS",
"path": "/visualize/tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bmaltais/kohya_ss path: /finetune/make_captions_by_git.py
import argparse
import os
import re
from pathlib import Path
from PIL import Image
from tqdm import tqdm
import torch
from transformers import AutoProcessor, AutoModelForCausalLM
from transformers.generation.utils import GenerationMixin
... | code_fim | hard | {
"lang": "python",
"repo": "bmaltais/kohya_ss",
"path": "/finetune/make_captions_by_git.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def setup_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser()
parser.add_argument("train_data_dir", type=str, help="directory for train images / 学習画像データのディレクトリ")
parser.add_argument("--caption_extension", type=str, default=".caption", help="extension of caption file / 出力され... | code_fim | hard | {
"lang": "python",
"repo": "bmaltais/kohya_ss",
"path": "/finetune/make_captions_by_git.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> curr_batch_size[0] = len(path_imgs)
inputs = git_processor(images=imgs, return_tensors="pt").to(DEVICE) # 画像はpil形式
generated_ids = git_model.generate(pixel_values=inputs.pixel_values, max_length=args.max_length)
captions = git_processor.batch_decode(generated_ids, skip_spe... | code_fim | hard | {
"lang": "python",
"repo": "bmaltais/kohya_ss",
"path": "/finetune/make_captions_by_git.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Azure-Samples/azure-intelligent-edge-patterns path: /factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/locations/models.py
"""App models.
"""
from django.db import models
<|fim_suffix|> name = models.CharField(max_length=200)
description = models.CharField(max_leng... | code_fim | easy | {
"lang": "python",
"repo": "Azure-Samples/azure-intelligent-edge-patterns",
"path": "/factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/locations/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = models.CharField(max_length=200)
description = models.CharField(max_length=1000, blank=True, default="")
is_demo = models.BooleanField(default=False)
def __str__(self):
return self.name<|fim_prefix|># repo: Azure-Samples/azure-intelligent-edge-patterns path: /factory-ai-vi... | code_fim | easy | {
"lang": "python",
"repo": "Azure-Samples/azure-intelligent-edge-patterns",
"path": "/factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/locations/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> subplot_row += 1
fig.add_scatter(
name="Aroon Oscillator",
mode="lines",
line=dict(width=1.5, color="#e0b700"),
x=df_ta.index,
y=df_ta[aroon_osc_col].values,
connectgaps=True,
opacity=0.9,
row=... | code_fim | hard | {
"lang": "python",
"repo": "conrad-strughold/GamestonkTerminal",
"path": "/openbb_terminal/core/plots/plotly_ta/plugins/trend_indicators_plugin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: conrad-strughold/GamestonkTerminal path: /openbb_terminal/core/plots/plotly_ta/plugins/trend_indicators_plugin.py
import pandas as pd
from openbb_terminal import OpenBBFigure, theme
from openbb_terminal.core.plots.plotly_ta.base import PltTA, indicator
from openbb_terminal.core.plots.plotly_ta.d... | code_fim | hard | {
"lang": "python",
"repo": "conrad-strughold/GamestonkTerminal",
"path": "/openbb_terminal/core/plots/plotly_ta/plugins/trend_indicators_plugin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fig.add_annotation(
xref=f"x{subplot_row} domain",
yref=f"y{subplot_row + 1} domain",
text="<b>Aroon</b>",
x=0,
xanchor="right",
xshift=-6,
y=1,
font_size=14,
font_color="#e0b700",
)... | code_fim | hard | {
"lang": "python",
"repo": "conrad-strughold/GamestonkTerminal",
"path": "/openbb_terminal/core/plots/plotly_ta/plugins/trend_indicators_plugin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data_0 = np.array([3, 0, 2]).astype(np.float32)
data_1 = np.array([1, 3, 4]).astype(np.float32)
data_2 = np.array([2, 6, 6]).astype(np.float32)
result = np.array([2, 3, 4]).astype(np.float32)
node = onnx.helper.make_node(
"Mean",
inputs=["dat... | code_fim | medium | {
"lang": "python",
"repo": "onnx/onnx",
"path": "/onnx/backend/test/case/node/mean.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> node = onnx.helper.make_node(
"Mean",
inputs=["data_0"],
outputs=["result"],
)
expect(node, inputs=[data_0], outputs=[data_0], name="test_mean_one_input")
result = np.divide(np.add(data_0, data_1), 2.0)
node = onnx.helper.make_no... | code_fim | hard | {
"lang": "python",
"repo": "onnx/onnx",
"path": "/onnx/backend/test/case/node/mean.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: onnx/onnx path: /onnx/backend/test/case/node/mean.py
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
<|fim_suffix|> result = np.di... | code_fim | hard | {
"lang": "python",
"repo": "onnx/onnx",
"path": "/onnx/backend/test/case/node/mean.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dfinity-lab/Kollaps path: /kollaps/TCAL/test.py
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You ... | code_fim | hard | {
"lang": "python",
"repo": "dfinity-lab/Kollaps",
"path": "/kollaps/TCAL/test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> TCAL = CDLL("./libTCAL.so")
TCAL.init(55, 1000)
TCAL.registerUsageCallback(c_callback)
TCAL.initDestination(ip2int("10.0.0.8"),50000, 0, c_float(0.0), c_float(0.0))
TCAL.initDestination(ip2int("10.0.0.1"),10000, 5, c_float(0.0), c_float(0.0))
TCAL.initDestination(ip2int("10.0.... | code_fim | hard | {
"lang": "python",
"repo": "dfinity-lab/Kollaps",
"path": "/kollaps/TCAL/test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.stdout.write('Copy ' + app)
if exclude is None:
exclude = []
file_name = os.path.join(self.data_dir, 'matmat-{}.json'.format(app))
with open(file_name, 'w') as output:
self.stdout.write(' - dumping')
call_command('dumpdata', app,
... | code_fim | hard | {
"lang": "python",
"repo": "jwcen/matmat-web",
"path": "/matmat/management/commands/migrate_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> a = TaskAnswer(
user_id=user,
item_id=task_instance.item_id,
item_asked_id=task_instance.item_id,
item_answered_id=task_instance.item_id if answer['correctly_solved'] else None,
response_tim... | code_fim | hard | {
"lang": "python",
"repo": "jwcen/matmat-web",
"path": "/matmat/management/commands/migrate_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jwcen/matmat-web path: /matmat/management/commands/migrate_data.py
import json
from collections import defaultdict
import os
from django.core.cache import cache
from clint.textui import progress
from datetime import timedelta
from django.contrib.auth.models import User
from django.core.management... | code_fim | hard | {
"lang": "python",
"repo": "jwcen/matmat-web",
"path": "/matmat/management/commands/migrate_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mahimaraghu/Hackerrank-Practice-Code path: /StringFormatting.py
def print_formatted(number):
for i in range (1,number+1):
decimal=str(i)
octal=oct(i).lstrip("0o")
hexadecimal=hex(i).lstrip("0x").upper()
binary=bin(i).lstrip("0b")
print(decimal.rjust(len(... | code_fim | medium | {
"lang": "python",
"repo": "mahimaraghu/Hackerrank-Practice-Code",
"path": "/StringFormatting.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>inary.rjust(len(bin(number).lstrip("0b"))," "))
if __name__ == '__main__':
n = int(input())
print_formatted(n)<|fim_prefix|># repo: mahimaraghu/Hackerrank-Practice-Code path: /StringFormatting.py
def print_formatted(number):
for i in range (1,number+1):
decimal=str(i)
... | code_fim | medium | {
"lang": "python",
"repo": "mahimaraghu/Hackerrank-Practice-Code",
"path": "/StringFormatting.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nayantara289/Code-Innovation-Series-ModelEngineeringCollege path: /Kinglet/proj dir/views (calc).py
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def home(request):
<|fim_suffix|> val1 = float(request.POST["num2"])
val2 = float(request.P... | code_fim | medium | {
"lang": "python",
"repo": "Nayantara289/Code-Innovation-Series-ModelEngineeringCollege",
"path": "/Kinglet/proj dir/views (calc).py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.