text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: psteinb/deeprace path: /src/deeprace/models/keras_details/callbacks.py
import keras
from keras.callbacks import Callback
import datetime as dt
class stopwatch(keras.callbacks.Callback):
def on_train_begin(self, logs={}):
self.train_begin = dt.datetime.now()
self.train_end = ... | code_fim | hard | {
"lang": "python",
"repo": "psteinb/deeprace",
"path": "/src/deeprace/models/keras_details/callbacks.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # create a model object
rf_model = RandomForestRegressor(n_estimators = 250, criterion = 'mse')
# variable distributions we want to sample from
variable_sampling = {"max_depth": randint(1,1000),
"min_samples_split": randint(2,10),
"min_samples_le... | code_fim | hard | {
"lang": "python",
"repo": "tejasph/house_price_prediction",
"path": "/src/optimize_rf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tejasph/house_price_prediction path: /src/optimize_rf.py
# search_params.py
# Tejas Phaterpekar; Jan 4th 2021
import pandas as pd
import pickle
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import RandomizedSearchC... | code_fim | hard | {
"lang": "python",
"repo": "tejasph/house_price_prediction",
"path": "/src/optimize_rf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> angles = mpmath.linspace(0,2*mpmath.pi,100)
An_51khz, beamshape_51khz = beamshapes.piston_in_sphere_directivity(angles, paramv)
#%%
# Let's also run the same for the next harmonic t 102 kHz - by doubling the `k` value.
k_2ndharmonic = k*2
paramv['k'] = k_2ndharmonic
An_102khz, ... | code_fim | hard | {
"lang": "python",
"repo": "thejasvibr/bat_beamshapes",
"path": "/examples/1_piston_sphere_eg1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thejasvibr/bat_beamshapes path: /examples/1_piston_sphere_eg1.py
"""
Piston in a rigid sphere: the bat version
=========================================
"""
# sphinx_gallery_thumbnail_path = '_static/peak_and_higher_harmonic.png'
import beamshapes
import matplotlib.pyplot as plt
import mpmath
i... | code_fim | hard | {
"lang": "python",
"repo": "thejasvibr/bat_beamshapes",
"path": "/examples/1_piston_sphere_eg1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.log.debug(
"Package Initialization",
package=self.__package,
log_level=self.settings.LOG_LEVEL.value,
log_dest=self.settings.LOG_DEST.value,
log_fmt=self.settings.LOG_FORMAT.value,
log_storage=str(self.settings.LOG_STORAG... | code_fim | hard | {
"lang": "python",
"repo": "pwoolvett/petri",
"path": "/petri/__init__.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pwoolvett/petri path: /petri/__init__.py
# -*- coding: utf-8 -*-
"""Petri: 12-factor boilerplate in your python code."""
from pathlib import Path
from typing import Optional
from petri.dot_env import init_dotenv
from petri.loggin import configure_logging
from petri.metadata import Metadata
from... | code_fim | medium | {
"lang": "python",
"repo": "pwoolvett/petri",
"path": "/petri/__init__.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>class FoodForm(forms.ModelForm):
class Meta:
model = Food
fields = ('name', 'description', 'calories')<|fim_prefix|># repo: neewy/InStoKiloGram path: /Food/forms.py
from django import forms
<|fim_middle|>from Food.models import Food
| code_fim | easy | {
"lang": "python",
"repo": "neewy/InStoKiloGram",
"path": "/Food/forms.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neewy/InStoKiloGram path: /Food/forms.py
from django import forms
<|fim_suffix|>class FoodForm(forms.ModelForm):
class Meta:
model = Food
fields = ('name', 'description', 'calories')<|fim_middle|>from Food.models import Food
| code_fim | easy | {
"lang": "python",
"repo": "neewy/InStoKiloGram",
"path": "/Food/forms.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neewy/InStoKiloGram path: /Food/forms.py
from django import forms
from Food.models import Food
<|fim_suffix|> class Meta:
model = Food
fields = ('name', 'description', 'calories')<|fim_middle|>class FoodForm(forms.ModelForm):
| code_fim | easy | {
"lang": "python",
"repo": "neewy/InStoKiloGram",
"path": "/Food/forms.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Display tax amount with two digits after decimal point
print("Sales tax is", int(tax * 100) / 100.0)<|fim_prefix|># repo: timmy61109/Introduction-to-Programming-Using-Python path: /examples/SalesTax.py
# Prompt the user for input
purchaseAmount = eval(input("Enter purchase amount: "))
<|fim_middle|># ... | code_fim | easy | {
"lang": "python",
"repo": "timmy61109/Introduction-to-Programming-Using-Python",
"path": "/examples/SalesTax.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timmy61109/Introduction-to-Programming-Using-Python path: /examples/SalesTax.py
# Prompt the user for input
purchaseAmount = eval(input("Enter purchase amount: "))
<|fim_suffix|># Display tax amount with two digits after decimal point
print("Sales tax is", int(tax * 100) / 100.0)<|fim_middle|># ... | code_fim | easy | {
"lang": "python",
"repo": "timmy61109/Introduction-to-Programming-Using-Python",
"path": "/examples/SalesTax.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nico-MC/sift-visualization path: /backend/my_blueprints/sift_cli/execute.py
#!/usr/bin/env python3
import os, subprocess, shutil, re
from flask import request, Blueprint, current_app as app, abort
from werkzeug.utils import secure_filename
from .handle_keypoints import handle_keypoints
execute =... | code_fim | hard | {
"lang": "python",
"repo": "Nico-MC/sift-visualization",
"path": "/backend/my_blueprints/sift_cli/execute.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def check_output_directory():
try:
shutil.rmtree('static/scalespace', ignore_errors = True, onerror = None)
shutil.rmtree('static/dog', ignore_errors = True, onerror = None)
shutil.rmtree('static/keypoints', ignore_errors = True, onerror = None)
os.makedirs('static/scal... | code_fim | hard | {
"lang": "python",
"repo": "Nico-MC/sift-visualization",
"path": "/backend/my_blueprints/sift_cli/execute.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> process = subprocess.Popen(["./demo_SIFT/bin/anatomy2lowe", "static/keypoints/features.txt"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
if(stderr.decode("utf-8") != ''):
return stderr
elif(stdout.decode("utf-8") != ''... | code_fim | hard | {
"lang": "python",
"repo": "Nico-MC/sift-visualization",
"path": "/backend/my_blueprints/sift_cli/execute.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Wordcloud of the topics I read about
from wordcloud import WordCloud, STOPWORDS
stopwords = set(STOPWORDS)
wordcloud = WordCloud(background_color='white',
stopwords=stopwords,
max_words=300,
max_font_size=40,
rando... | code_fim | hard | {
"lang": "python",
"repo": "DevZenPro/blog-everydayplots-analysis-codes-2018",
"path": "/1807 - Reading Habit Analysis Using Pocket API And Python/Pocket API Analysis.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DevZenPro/blog-everydayplots-analysis-codes-2018 path: /1807 - Reading Habit Analysis Using Pocket API And Python/Pocket API Analysis.py
import requests
import pandas as pd
from pandas.io.json import json_normalize
import json
import datetime
import matplotlib.pyplot as plt
# STEP 1: Get a cons... | code_fim | hard | {
"lang": "python",
"repo": "DevZenPro/blog-everydayplots-analysis-codes-2018",
"path": "/1807 - Reading Habit Analysis Using Pocket API And Python/Pocket API Analysis.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> :type resource: dict
:param resource: project resource representation returned from the API
:type client: :class:`gcloud.resource_manager.client.Client`
:param client: The Client used with this project.
:rtype: :class:`gcloud.resource_manager.project.Project`
... | code_fim | hard | {
"lang": "python",
"repo": "thonkify/thonkify",
"path": "/src/lib/gcloud/resource_manager/project.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :type client: :class:`gcloud.resource_manager.client.Client` or
``NoneType``
:param client: the client to use. If not passed, falls back to the
``client`` stored on the current project.
:rtype: :class:`gcloud.resource_manager.client.Cl... | code_fim | hard | {
"lang": "python",
"repo": "thonkify/thonkify",
"path": "/src/lib/gcloud/resource_manager/project.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thonkify/thonkify path: /src/lib/gcloud/resource_manager/project.py
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
... | code_fim | hard | {
"lang": "python",
"repo": "thonkify/thonkify",
"path": "/src/lib/gcloud/resource_manager/project.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # We need to create the directory if needed
test_path.parent.mkdir(parents=True, exist_ok=True)
test_path.write_text(test_code, encoding="utf-8")
black_format(test_path)
print(f"{nb_path}: tests to {test_path.relative_to(root)} => EXTRACTED")
if __name__ == "__main__":
root = Pa... | code_fim | hard | {
"lang": "python",
"repo": "AlbertLamSz/unpackai",
"path": "/test/test_extractor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlbertLamSz/unpackai path: /test/test_extractor.py
import logging
import re
from pathlib import Path
from typing import Any, Dict, Union
import nbformat
from black import Mode, Report, TargetVersion, WriteBack, reformat_one, reformat_code
from nbdev.export import find_default_export, get_config
... | code_fim | hard | {
"lang": "python",
"repo": "AlbertLamSz/unpackai",
"path": "/test/test_extractor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(pathList) > 2:
expireStrings.append(
cookie
+ "="
+ "EXPIRED;Path=/"
+ pathList[1]
+ ";Domain="
+ domain
+ ";Expires=Mon, 01-Jan-1990 00:00:00 GMT\r\n"
)
... | code_fim | hard | {
"lang": "python",
"repo": "P0cL4bs/wifipumpkin3",
"path": "/wifipumpkin3/plugins/external/sslstrip/CookieCleaner.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: P0cL4bs/wifipumpkin3 path: /wifipumpkin3/plugins/external/sslstrip/CookieCleaner.py
# Copyright (c) 2004-2011 Moxie Marlinspike
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Found... | code_fim | hard | {
"lang": "python",
"repo": "P0cL4bs/wifipumpkin3",
"path": "/wifipumpkin3/plugins/external/sslstrip/CookieCleaner.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "cookie" in headers
def getDomainFor(self, host):
hostParts = host.split(".")
return "." + hostParts[-2] + "." + hostParts[-1]
def getExpireCookieStringFor(self, cookie, host, domain, path):
pathList = path.split("/")
expireStrings = list()
... | code_fim | hard | {
"lang": "python",
"repo": "P0cL4bs/wifipumpkin3",
"path": "/wifipumpkin3/plugins/external/sslstrip/CookieCleaner.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> await self.get_destination().send(embed=embed)
async def send_cog_help(self, cog):
embed = discord.Embed(
title=cog.qualified_name,
description=cog.description,
color=discord.Color(0x007fff))
for command in cog.get_commands():
e... | code_fim | hard | {
"lang": "python",
"repo": "object-Object/GuildBot",
"path": "/utils/help.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: object-Object/GuildBot path: /utils/help.py
import discord
from discord.ext import commands
class GuildBotHelp(commands.HelpCommand):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
async def send_bot_help(self, mapping):
embed = discord.Embed(
... | code_fim | hard | {
"lang": "python",
"repo": "object-Object/GuildBot",
"path": "/utils/help.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for command in cog.get_commands():
embed.add_field(name=command.name, value=command.brief)
await self.get_destination().send(embed=embed)
async def send_group_help(self, group):
embed = discord.Embed(
title=group.name,
description="`{0}`{1}... | code_fim | hard | {
"lang": "python",
"repo": "object-Object/GuildBot",
"path": "/utils/help.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>first_name = input("Whats your name? ")
print_date()
first_name_initials = get_inicials(first_name)
last_name = input("Whats your last name? ")
print_date()
last_name_initials = get_inicials(last_name)
for x in range(1,10):
print(x)
print_date()
print(f"Hi {first_name} {last_name}! \
Your ini... | code_fim | medium | {
"lang": "python",
"repo": "belarminobrunoz/BYUI-CSE-110",
"path": "/week 13/w13_functions_intro.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: belarminobrunoz/BYUI-CSE-110 path: /week 13/w13_functions_intro.py
# INTRODUCTION: https://byui-cse.github.io/cse110-course/lesson13/prepare.html
import datetime
def print_date():
print("Task Completed")
print(datetime.datetime.now())
print()
def get_inicials(name):
inicials = ... | code_fim | medium | {
"lang": "python",
"repo": "belarminobrunoz/BYUI-CSE-110",
"path": "/week 13/w13_functions_intro.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif status == 3:
#media = api.upload_chunked(filename)
message = "The Fly Matrix is ready to serve."
api.update_status(message)
except ValueError:
print(ValueError)<|fim_prefix|># repo: bianca-schell/fly-matrix path: /flyVR/email... | code_fim | hard | {
"lang": "python",
"repo": "bianca-schell/fly-matrix",
"path": "/flyVR/emailer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
api = twitter_api()
if status ==0:
now = datetime.datetime.now()
endTime = now + datetime.timedelta(minutes = int(t))
message = "the experiment " + str(expId) + " has started. Should end at "+str(endTime.strftime("%H:%M"))
... | code_fim | medium | {
"lang": "python",
"repo": "bianca-schell/fly-matrix",
"path": "/flyVR/emailer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bianca-schell/fly-matrix path: /flyVR/emailer.py
import tweepy
import datetime
import keys
def twitter_api():
auth = tweepy.OAuthHandler(keys.CONSUMER_KEY, keys.CONSUMER_SECRET)
auth.set_access_token(keys.ACCESS_KEY, keys.ACCESS_SECRET)
api = tweepy.API(auth)
return... | code_fim | medium | {
"lang": "python",
"repo": "bianca-schell/fly-matrix",
"path": "/flyVR/emailer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zimmerrol/data-viewer path: /windows/mainwindow.py
# Copyright (c) 2018 Roland Zimmermann
#
# 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 restriction, includi... | code_fim | hard | {
"lang": "python",
"repo": "zimmerrol/data-viewer",
"path": "/windows/mainwindow.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _actionOpen_triggered(self):
self._open_file()
def _actionClose_triggered(self):
self._close_file()
def _actionExit_triggered(self):
if self._close_file():
sys.exit()
def _update_groups(self, items):
self.groups_treeWidget.clear()
... | code_fim | hard | {
"lang": "python",
"repo": "zimmerrol/data-viewer",
"path": "/windows/mainwindow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> child.deleteLater()
if not self._current_parser.show_settings(self.parserSettingsGroupBox):
self.parserSettingsGroupBox.setVisible(False)
else:
self.parserSettingsGroupBox.setVisible(True)
current_item = self.groups_treeWidget.currentItem()
... | code_fim | hard | {
"lang": "python",
"repo": "zimmerrol/data-viewer",
"path": "/windows/mainwindow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: killvxk/etl-parser path: /etl/parsers/etw/Microsoft_Windows_DVD.py
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-DVD
GUID : e18d0fca-9515-4232-98e4-89e456d8551b
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl... | code_fim | hard | {
"lang": "python",
"repo": "killvxk/etl-parser",
"path": "/etl/parsers/etw/Microsoft_Windows_DVD.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pattern = Struct(
"Object" / Int64ul
)
@declare(guid=guid("e18d0fca-9515-4232-98e4-89e456d8551b"), event_id=5, version=0)
class Microsoft_Windows_DVD_5_0(Etw):
pattern = Struct(
"Object" / Int64ul,
"Duration" / Int32sl
)
@declare(guid=guid("e18d0fca-9515-4232-98... | code_fim | hard | {
"lang": "python",
"repo": "killvxk/etl-parser",
"path": "/etl/parsers/etw/Microsoft_Windows_DVD.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: home-assistant/core path: /homeassistant/components/esphome/climate.py
"""Support for ESPHome climate devices."""
from __future__ import annotations
from typing import Any, cast
from aioesphomeapi import (
ClimateAction,
ClimateFanMode,
ClimateInfo,
ClimateMode,
ClimatePrese... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/homeassistant/components/esphome/climate.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
@esphome_state_property
def target_temperature_low(self) -> float | None:
"""Return the lowbound target temperature we try to reach."""
return self._state.target_temperature_low
@property
@esphome_state_property
def target_temperature_high(self) -> float ... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/homeassistant/components/esphome/climate.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
import sys
parser = ArgumentParser()
parser.add_argument('-t', '--type', help='Type of datastore', choices=('memory', 'database'), default='memory')
parser.add_argument('-d', '--database', help='Name of the database', default='default')
parser.add_argument('-... | code_fim | medium | {
"lang": "python",
"repo": "shrinivdeshmukh/simpleRAFT",
"path": "/raft/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shrinivdeshmukh/simpleRAFT path: /raft/main.py
# from raft.transport import Transport, Thread
# if __name__ == '__main__':
# import sys
# my_ip = sys.argv[1]
# peers = list()
# try:
# peers = (sys.argv[2]).split(',')
# except Exception:
# pass
# t = Transp... | code_fim | medium | {
"lang": "python",
"repo": "shrinivdeshmukh/simpleRAFT",
"path": "/raft/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> value_source_resolver = ValueSourceResolver(
answer_store=answer_store,
list_store=list_store,
metadata=metadata,
response_metadata=response_metadata,
schema=schema,
location=None,
list_item_id=None,
escape_answer_values=False,
pr... | code_fim | hard | {
"lang": "python",
"repo": "ONSdigital/eq-questionnaire-runner",
"path": "/tests/app/forms/test_field_factory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> rule_evaluator = RuleEvaluator(
answer_store=answer_store,
list_store=list_store,
metadata=metadata,
response_metadata=response_metadata,
schema=schema,
location=None,
progress_store=ProgressStore(),
supplementary_data_store=Supplementary... | code_fim | hard | {
"lang": "python",
"repo": "ONSdigital/eq-questionnaire-runner",
"path": "/tests/app/forms/test_field_factory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ONSdigital/eq-questionnaire-runner path: /tests/app/forms/test_field_factory.py
import pytest
from app.data_models import ProgressStore, SupplementaryDataStore
from app.forms import error_messages
from app.forms.field_handlers import get_field_handler
from app.questionnaire import QuestionnaireS... | code_fim | hard | {
"lang": "python",
"repo": "ONSdigital/eq-questionnaire-runner",
"path": "/tests/app/forms/test_field_factory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def indexSearchDir(dir):
import os
for fn in os.listdir(dir):
fullfn = dir + "/" + fn
if os.path.isfile(fullfn):
ext = os.path.splitext(fn)[1].lower()
if ext[:1] == ".": ext = ext[1:]
if ext in appinfo.formats:
song = Song(url=fullfn)
assert song
assert song.id
songdb.insert... | code_fim | medium | {
"lang": "python",
"repo": "pvinis/music-player",
"path": "/test_indexallmusic.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pvinis/music-player path: /test_indexallmusic.py
# MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2012, Albert Zeyer, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.
from Song import S... | code_fim | medium | {
"lang": "python",
"repo": "pvinis/music-player",
"path": "/test_indexallmusic.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> import os
for fn in os.listdir(dir):
fullfn = dir + "/" + fn
if os.path.isfile(fullfn):
ext = os.path.splitext(fn)[1].lower()
if ext[:1] == ".": ext = ext[1:]
if ext in appinfo.formats:
song = Song(url=fullfn)
assert song
assert song.id
songdb.insertSearchEntry(song)
pri... | code_fim | medium | {
"lang": "python",
"repo": "pvinis/music-player",
"path": "/test_indexallmusic.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: a-n-rose/workshops path: /speech_recognition/train_model_run.py
'''
Script outline
1) load data
expects title of table to contain:
- 'mfcc' or fbank
- the number of features
- optionaly: 'pitch' or 'delta' if the table has those features
2) prep data --> zeropad, encode categorical data, di... | code_fim | hard | {
"lang": "python",
"repo": "a-n-rose/workshops",
"path": "/speech_recognition/train_model_run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #set loss:
#binary = "binary_crossentropy", multiple (one-hot-encoded) = "categorical_crossentropy"; multiple (integer encoded) = "sparse_categorical_crossentropy"
loss = "sparse_categorical_crossentropy"
logging.info("Loss set at: '{}'".format(loss))
#com... | code_fim | hard | {
"lang": "python",
"repo": "a-n-rose/workshops",
"path": "/speech_recognition/train_model_run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.tk.update_idletasks()
self.tk.update()
self.view.view_first()
self.tk.update_idletasks()
self.tk.update()
# when user close window
def on_closing(self):
self.running = False<|fim_prefix|># repo: copycat1024/sick_lidar_sensor_visualization path... | code_fim | hard | {
"lang": "python",
"repo": "copycat1024/sick_lidar_sensor_visualization",
"path": "/gfx.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.last_scan < result.scan_counter:
self.model.process_result(result)
self.view.view_scan()
self.tk.update_idletasks()
self.tk.update()
def draw_first(self):
self.tk.update_idletasks()
self.tk.update()
self.view.view_first()... | code_fim | hard | {
"lang": "python",
"repo": "copycat1024/sick_lidar_sensor_visualization",
"path": "/gfx.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: copycat1024/sick_lidar_sensor_visualization path: /gfx.py
from tkinter import Tk, Canvas, Frame, BOTH, ARC
from math import sin, cos, pi
from gfx_view import gfxView
from gfx_model import gfxModel
class gfxControl():
def __init__(self, config):
self.tk = Tk()
self.tk.protocol... | code_fim | hard | {
"lang": "python",
"repo": "copycat1024/sick_lidar_sensor_visualization",
"path": "/gfx.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def to_alipay_dict(self):
params = dict()
if self.apply_amount:
if hasattr(self.apply_amount, 'to_alipay_dict'):
params['apply_amount'] = self.apply_amount.to_alipay_dict()
else:
params['apply_amount'] = self.apply_amount
... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/DeviceApplyOrderItemModel.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/domain/DeviceApplyOrderItemModel.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class DeviceApplyOrderItemModel(object):
def __init__(self):
self._apply_amount = N... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/DeviceApplyOrderItemModel.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: harvard-acc/gem5-aladdin path: /sweeps/benchmarks/machsuite.py
# MachSuite benchmark definitions.
from benchmarks.datatypes import *
from benchmarks.params import *
aes_aes = Benchmark("aes_aes", "aes/aes")
aes_aes.set_kernels(["aes256_encrypt_ecb"])
aes_aes.set_main_id(0x00000010)
aes_aes.add_... | code_fim | hard | {
"lang": "python",
"repo": "harvard-acc/gem5-aladdin",
"path": "/sweeps/benchmarks/machsuite.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>spmv_crs = Benchmark("spmv_crs", "spmv/crs")
spmv_crs.set_kernels(["spmv"])
spmv_crs.set_main_id(0x000000F0)
spmv_crs.add_array("val", 1666, 8)
spmv_crs.add_array("cols", 1666, 4)
spmv_crs.add_array("rowDelimiters", 495, 4)
spmv_crs.add_array("vec", 494, 8)
spmv_crs.add_array("out", 494, 8)
spmv_crs.add_h... | code_fim | hard | {
"lang": "python",
"repo": "harvard-acc/gem5-aladdin",
"path": "/sweeps/benchmarks/machsuite.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>kmp_kmp = Benchmark("kmp_kmp", "kmp/kmp")
kmp_kmp.set_kernels(["kmp"])
kmp_kmp.set_main_id(0x00000090)
kmp_kmp.add_array("pattern", 4, 1)
kmp_kmp.add_array("input", 32411, 1)
kmp_kmp.add_array("kmpNext", 4, 4)
kmp_kmp.add_array("n_matches", 1, 4)
kmp_kmp.add_host_array("host_input", 32411, 1)
kmp_kmp.add_... | code_fim | hard | {
"lang": "python",
"repo": "harvard-acc/gem5-aladdin",
"path": "/sweeps/benchmarks/machsuite.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dlario/PyFlow path: /PyFlow/Packages/PyFlowBase/UI/UIImageDisplayNode.py
## Copyright 2015-2019 Ilgar Lunin, Pedro Cabrera
## 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 Licens... | code_fim | medium | {
"lang": "python",
"repo": "dlario/PyFlow",
"path": "/PyFlow/Packages/PyFlowBase/UI/UIImageDisplayNode.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def onLoadImage(self, imagePath):
self.pixmap = QtGui.QPixmap(imagePath)
self.updateSize()
def paint(self, painter, option, widget):
self.updateSize()
super(UIImageDisplayNode, self).paint(painter, option, widget)
def updateSize(self):
scaledPixmap = s... | code_fim | hard | {
"lang": "python",
"repo": "dlario/PyFlow",
"path": "/PyFlow/Packages/PyFlowBase/UI/UIImageDisplayNode.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(UIImageDisplayNode, self).__init__(raw_node)
self.resizable = True
self.Imagelabel = QLabel("test3")
self.pixmap = QtGui.QPixmap(RESOURCES_DIR + "/wizard-cat.png")
self.addWidget(self.Imagelabel)
self.updateSize()
self._rawNode.loadImage.connec... | code_fim | medium | {
"lang": "python",
"repo": "dlario/PyFlow",
"path": "/PyFlow/Packages/PyFlowBase/UI/UIImageDisplayNode.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JRetza/amazon-dsstne path: /python/encoder/encoder.py
'''
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is locat... | code_fim | hard | {
"lang": "python",
"repo": "JRetza/amazon-dsstne",
"path": "/python/encoder/encoder.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Find output dataset
outputIndex = 0
print "**** DataSetList size =", len(DataSetList)
while (outputIndex < len(DataSetList) and dn.GetDataSetName(DataSetList[outputIndex]) != "target"):
outputIndex = outputIndex + 1
print "**** outputIndex =", outputIndex
# Calculate MRR
MRR = dn.CalculateMRR(Netwo... | code_fim | hard | {
"lang": "python",
"repo": "JRetza/amazon-dsstne",
"path": "/python/encoder/encoder.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tk0miya/schediag path: /src/schediag/elements.py
# -*- coding: utf-8 -*-
# Copyright 2011 Takeshi KOMIYA
#
# 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
#
# ht... | code_fim | hard | {
"lang": "python",
"repo": "tk0miya/schediag",
"path": "/src/schediag/elements.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class DiagramNode(blockdiag.elements.DiagramNode):
def __init__(self, id):
super(DiagramNode, self).__init__(id)
self._from = None
self._to = None
self.milestone = False
def set_term(self, term):
if isinstance(term, (str, unicode)):
self._from =... | code_fim | hard | {
"lang": "python",
"repo": "tk0miya/schediag",
"path": "/src/schediag/elements.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhuxiyulu/sugar path: /controller/followController.py
from dao import followDao
from dao import usersDao
from dao.sessionDao import redisCon
# 关注
def createFollow(session_id, followId):
if session_id == '':
data = {'code': 1, 'msg': 'session_id不能为空'}
return data
... | code_fim | hard | {
"lang": "python",
"repo": "zhuxiyulu/sugar",
"path": "/controller/followController.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># 用户查看自己关注的列表
def retrieveFollowList(session_id, x, n):
if session_id == '':
data = {'code': 1, 'msg': 'session_id不能为空'}
return data
userId = redisCon.get(session_id)
if userId is None:
data = {'code': 1, 'msg': '请先登录'}
return data
userId = int(us... | code_fim | hard | {
"lang": "python",
"repo": "zhuxiyulu/sugar",
"path": "/controller/followController.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> userId = int(userId)
x = int(x)
n = int(n)
if x < 0 or n <= 0:
data = {'code': 1, 'msg': '关注获取失败'}
return data
result = followDao.selectFollowMeList(userId, x, n)
if result is None:
data = {'code': 1, 'msg': '请先登录'}
else:
data = []
... | code_fim | hard | {
"lang": "python",
"repo": "zhuxiyulu/sugar",
"path": "/controller/followController.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dexter1691/datmo path: /datmo/core/storage/driver/blitzdb_dal_driver.py
from blitzdb import Document, queryset
from datetime import datetime
from datmo.core.util.exceptions import (
EntityNotFound, EntityCollectionNotFound, IncorrectType,
InvalidArgumentType, RequiredArgumentMissing, Mor... | code_fim | hard | {
"lang": "python",
"repo": "dexter1691/datmo",
"path": "/datmo/core/storage/driver/blitzdb_dal_driver.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.__reload()
try:
results = self.backend.filter(collection, {'pk': entity_id})
if len(results) == 1:
item_dict = results[0].attributes
return normalize_entity(item_dict)
else:
raise EntityNotFound()
... | code_fim | hard | {
"lang": "python",
"repo": "dexter1691/datmo",
"path": "/datmo/core/storage/driver/blitzdb_dal_driver.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta(Document.Meta):
collection = 'snapshot'
class UserDocument(Document):
class Meta(Document.Meta):
collection = 'user'
def __reload(self):
if hasattr(self.backend, "indexes"):
for _, nested_index in self.backend.indexes.items()... | code_fim | hard | {
"lang": "python",
"repo": "dexter1691/datmo",
"path": "/datmo/core/storage/driver/blitzdb_dal_driver.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: satoshun/commands path: /pull_request
#!/usr/bin/python
import os
import subprocess
import sys
GITHUB_PATH = "/pull/%(branch_name)s"
BITBUCKET_PATH = "/branch/%(branch_name)s"
<|fim_suffix|>
if __name__ == '__main__':
target_path = ''
if 'github.com' in get_git_remote_httpurl():
... | code_fim | hard | {
"lang": "python",
"repo": "satoshun/commands",
"path": "/pull_request",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
target_path = ''
if 'github.com' in get_git_remote_httpurl():
target_path = GITHUB_PATH
elif 'bitbucket.org' in get_git_remote_httpurl():
target_path = BITBUCKET_PATH
else:
print('dont github or bitbucket')
sys.exit(1)
BASE_P... | code_fim | medium | {
"lang": "python",
"repo": "satoshun/commands",
"path": "/pull_request",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gnbpdx/AI-ML path: /features.py
#!/usr/bin/python3
import os
import math
import nltk
import collections
class Authorship_Classifier():
#Given a book located at filename, this outputs a list of paragraphs
def convert_text_to_paragraphs(self, filename):
paragraphs = list()
w... | code_fim | hard | {
"lang": "python",
"repo": "gnbpdx/AI-ML",
"path": "/features.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_all_features(self, text, shelley_paragraphs, other_paragraphs):
return self.words_in_paragraph(text)
class Word_Strip_Classifier(Authorship_Classifier):
def __init__(self, n):
self.strip_num = n
def get_features_in_paragraph(self, paragraph):
return set([word f... | code_fim | hard | {
"lang": "python",
"repo": "gnbpdx/AI-ML",
"path": "/features.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RiccardoGrieco/touch_the_color path: /src/util/Colors.py
#!/usr/bin/env python
import numpy as np
class Colors:
colorNames = []
kinectValues = []
colorNames.append('BLUE')
colorNames.append('MAGENTA')
colorNames.append('LIGHT BLUE')
colorNames.append('LIGHT GREEN')
... | code_fim | medium | {
"lang": "python",
"repo": "RiccardoGrieco/touch_the_color",
"path": "/src/util/Colors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def getColor(colorName):
colorID = Colors.colorNames.index(colorName)
return Colors.kinectValues[colorID]<|fim_prefix|># repo: RiccardoGrieco/touch_the_color path: /src/util/Colors.py
#!/usr/bin/env python
import numpy as np
class Colors:
colorNames = []
kinectValues = []
<|fim_middle... | code_fim | hard | {
"lang": "python",
"repo": "RiccardoGrieco/touch_the_color",
"path": "/src/util/Colors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> kinectValues.append((np.array([115,50,50]),np.array([125,255,255])))
kinectValues.append((np.array([145,50,50]),np.array([160,255,255])))
kinectValues.append((np.array([70, 50, 50]), np.array([110, 255, 255])))
kinectValues.append((np.array([38, 50, 50]), np.array([48, 255, 255])))
def ge... | code_fim | medium | {
"lang": "python",
"repo": "RiccardoGrieco/touch_the_color",
"path": "/src/util/Colors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>dataset = mldb.create_dataset({
'type': 'sparse.mutable',
'id': 'example_large'
})
for i in range(20000):
dataset.record_row("u%d" % i, [['x', "whatever", 0]])
dataset.commit();
expected = [["_rowName","x"], ["u1","whatever"],["u12","whatever"],["u123","whatever"],["u1234","whatever... | code_fim | medium | {
"lang": "python",
"repo": "mldbai/mldb",
"path": "/testing/MLDB-1165-where-rowname-in-optim.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>mldb.log(delta.seconds)
mldb.log(delta.microseconds)
# disabled so as not to cause spurious failures
# assert delta.microseconds < 15000 # should take ~1k us with optim, +20k without
assert result == expected
#MLDB-1615
dataset = mldb.create_dataset({
'type': 'sparse.mutable',
'id': 'e... | code_fim | hard | {
"lang": "python",
"repo": "mldbai/mldb",
"path": "/testing/MLDB-1165-where-rowname-in-optim.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mldbai/mldb path: /testing/MLDB-1165-where-rowname-in-optim.py
#
# MLDB-1165-where-rowname-in-optim.py
# mldb.ai inc, 2015
# This file is part of MLDB. Copyright 2015 mldb.ai inc. All rights reserved.
#
import datetime
from mldb import mldb
dataset = mldb.create_dataset({
'type': 'spars... | code_fim | hard | {
"lang": "python",
"repo": "mldbai/mldb",
"path": "/testing/MLDB-1165-where-rowname-in-optim.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: team172011/ps_cagebot path: /programm/skype.py
"""
Script to start video chat by calling a skype contact
@author: wimmer, simon-justus
"""
<|fim_suffix|> command = "C:\Users\ITM2\Surrogate\ps_cagebot\programm\callsimelton91.cmd {}".format(username)
subprocess.call(command, shell=False)<|f... | code_fim | easy | {
"lang": "python",
"repo": "team172011/ps_cagebot",
"path": "/programm/skype.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> command = "C:\Users\ITM2\Surrogate\ps_cagebot\programm\callsimelton91.cmd {}".format(username)
subprocess.call(command, shell=False)<|fim_prefix|># repo: team172011/ps_cagebot path: /programm/skype.py
"""
Script to start video chat by calling a skype contact
@author: wimmer, simon-justus
"""
<|f... | code_fim | easy | {
"lang": "python",
"repo": "team172011/ps_cagebot",
"path": "/programm/skype.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Outra forma de achar o maior e o menor valor da segunda linda
'''
for c in range(0, 3):
if c == 0:
maior = menor = matriz[1][c]
else:
if matriz[1][c] > maior:
maior = matriz[1][c]
if matriz[1][c] < menor:
menor = matriz[1][c]
'''<|fim_prefix|># rep... | code_fim | hard | {
"lang": "python",
"repo": "brenolemes/exercicios-python",
"path": "/exercicios/CursoemVídeo/ex087.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brenolemes/exercicios-python path: /exercicios/CursoemVídeo/ex087.py
'''
Aprimore o desafio anterior, mostrando no final:
A) A soma de todos os valores pares digitados.
B) A soma dos valores da terceira coluna.
C) O maior valor da segunda linha.
'''
<|fim_suffix|># Outra forma de achar o maior e... | code_fim | hard | {
"lang": "python",
"repo": "brenolemes/exercicios-python",
"path": "/exercicios/CursoemVídeo/ex087.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Outra forma de achar a soma da terceira coluna
'''
for l in range(0, 3):
soma_coluna3 += matriz[l][2]
'''
# Outra forma de achar o maior e o menor valor da segunda linda
'''
for c in range(0, 3):
if c == 0:
maior = menor = matriz[1][c]
else:
if matriz[1][c] > maior:
... | code_fim | hard | {
"lang": "python",
"repo": "brenolemes/exercicios-python",
"path": "/exercicios/CursoemVídeo/ex087.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
"""
fig_name = fig_name or 'latent_samples.png'
if not fig_name.endswith('.png'):
fig_name += '.png'
logger.info("Plotting 2D latent space.")
plt.figure(figsize=(6, 6))
cmap = plt.get_cmap('viridis')
if target is not None:
if target.dtype.type is n... | code_fim | hard | {
"lang": "python",
"repo": "gdikov/vae-playground",
"path": "/playground/utils/visualisation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gdikov/vae-playground path: /playground/utils/visualisation.py
from builtins import range
import logging
import numpy as np
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.colors as mcolors
logger = logging.getLogger... | code_fim | hard | {
"lang": "python",
"repo": "gdikov/vae-playground",
"path": "/playground/utils/visualisation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: killsking/dti-sprites path: /src/scheduler/__init__.py
from bisect import bisect_right
from collections import Counter
import warnings
from torch.optim.lr_scheduler import CosineAnnealingLR, ExponentialLR, _LRScheduler
def get_scheduler(name):
if name is None:
name = 'constant_lr'
... | code_fim | hard | {
"lang": "python",
"repo": "killsking/dti-sprites",
"path": "/src/scheduler/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _get_closed_form_lr(self):
if self.warmup > self.last_epoch:
return [lr / self.warmup * (self.last_epoch + 1) for lr in self.base_lrs]
else:
milestones = list(sorted(self.milestones.elements()))
return [base_lr * gamma ** bisect_right(milestones,... | code_fim | hard | {
"lang": "python",
"repo": "killsking/dti-sprites",
"path": "/src/scheduler/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> author='nored',
packages=find_packages(),
scripts=['scripts/mocker'],
)<|fim_prefix|># repo: trustyred/mocker path: /setup.py
#!/usr/bin/env python
from setuptools import setup, find_packages
import mocker
<|fim_middle|>setup(
name='mocker',
version=mocker.__version__,
d... | code_fim | medium | {
"lang": "python",
"repo": "trustyred/mocker",
"path": "/setup.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: trustyred/mocker path: /setup.py
#!/usr/bin/env python
from setuptools import setup, find_packages
import mocker
<|fim_suffix|> author='nored',
packages=find_packages(),
scripts=['scripts/mocker'],
)<|fim_middle|>setup(
name='mocker',
version=mocker.__version__,
d... | code_fim | medium | {
"lang": "python",
"repo": "trustyred/mocker",
"path": "/setup.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_knelling.py
from xai.brain.wordbase.nouns._knell import _KNELL
<|fim_suffix|> def __init__(self,):
_KNELL.__init__(self)
self.name = "KNELLING"
self.specie = 'nouns'
self.basic = "knell"
self.jsondata = {}<|fim_middle|>#calss header
clas... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_knelling.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self,):
_KNELL.__init__(self)
self.name = "KNELLING"
self.specie = 'nouns'
self.basic = "knell"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_knelling.py
from xai.brain.wordbase.nouns._knell import _KNELL
<|fim_middle|>#calss header
clas... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_knelling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cablelabs/transparent-security path: /bin/sdn_controller.py
#!/usr/bin/env python
# Copyright (c) 2019 Cable Television Laboratories, Inc.
# 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 ... | code_fim | hard | {
"lang": "python",
"repo": "cablelabs/transparent-security",
"path": "/bin/sdn_controller.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = get_args()
# Setup remote debugging
if args.debug_host:
pydevd.settrace(host=args.debug_host, port=int(args.debug_port),
stdoutToServer=True, stderrToServer=True)
numeric_level = getattr(logging, args.loglevel.upper(), None)
if args.logfile:
... | code_fim | hard | {
"lang": "python",
"repo": "cablelabs/transparent-security",
"path": "/bin/sdn_controller.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fenggen2016/epitopepredict path: /setup.py
from setuptools import setup
import sys,os
with open('epitopepredict/description.txt') as f:
long_description = f.read()
setup(
name = 'epitopepredict',
version = '0.2.0',
description = 'Python package for epitope prediction',
long_... | code_fim | hard | {
"lang": "python",
"repo": "fenggen2016/epitopepredict",
"path": "/setup.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>=0.12',
'wtforms>=2.1',
'wtforms_tornado',
'future'],
entry_points = {
'console_scripts': [
'epitopepredict=epitopepredict.app:main']
},
classifiers = ['Operating System :: OS Independent',
... | code_fim | hard | {
"lang": "python",
"repo": "fenggen2016/epitopepredict",
"path": "/setup.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")<|fim_prefix|># repo: JADSN/ReactCodes path: /00_TrackerApp/backend/dependencies.py
from database import get_db
from fastapi import APIRouter, Depends, APIRouter, FastAPI, HTTPException, status
from fastapi.security import OAuth2PasswordBearer, OAuth... | code_fim | easy | {
"lang": "python",
"repo": "JADSN/ReactCodes",
"path": "/00_TrackerApp/backend/dependencies.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JADSN/ReactCodes path: /00_TrackerApp/backend/dependencies.py
from database import get_db
from fastapi import APIRouter, Depends, APIRouter, FastAPI, HTTPException, status
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
<|fim_suffix|>oauth2_scheme = OAuth2PasswordBe... | code_fim | easy | {
"lang": "python",
"repo": "JADSN/ReactCodes",
"path": "/00_TrackerApp/backend/dependencies.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.