text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: nafonels/mad_for_shoes path: /tools/fix_insta_media.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from glob import glob
from urllib import parse
from setting import data_path
from util.data import extract_field, extract_fields
search_pattern = '*insta_post_*.json'
file_list = g... | code_fim | hard | {
"lang": "python",
"repo": "nafonels/mad_for_shoes",
"path": "/tools/fix_insta_media.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> rets = []
extract_spec = {
'video_url': ('video_url', str),
}
_dup_check = []
for media in (x['node'] for x in list_media):
custom_media = extract_fields(media, extract_spec)
custom_media['file_url'] = media['display_resources']... | code_fim | hard | {
"lang": "python",
"repo": "nafonels/mad_for_shoes",
"path": "/tools/fix_insta_media.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vpiserchia/CTI-Toolbox path: /xfexchange.py
#!/usr/bin/python
import urllib
import urllib2
from optparse import OptionParser
import json
import os.path
import time
import re
import base64
from datetime import datetime, timedelta
import sys
BASEurl = "https://api.xforce.ibmcloud.c... | code_fim | hard | {
"lang": "python",
"repo": "vpiserchia/CTI-Toolbox",
"path": "/xfexchange.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> furl = BASEurl + "vulnerabilities/msid/%s" % msid
request = urllib2.Request(furl, None, headers)
data = urllib2.urlopen(request)
data2 = json.loads(data.read())
return data2
def getmsid(msid):
try:
furl = BASEurl + "vulnerabilities/msid/%s" % msid
request = urllib2.Request(furl, ... | code_fim | hard | {
"lang": "python",
"repo": "vpiserchia/CTI-Toolbox",
"path": "/xfexchange.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
furl = BASEurl + "malware/%s" % hash
request = urllib2.Request(furl, None, headers)
data = urllib2.urlopen(request)
data2 = json.loads(data.read())
return data2
except:
return {"IBM XForce Exchange" : "No Data"}
def getDAMN(id):
try:
furl = BASEurl + "casefiles/%s/atta... | code_fim | hard | {
"lang": "python",
"repo": "vpiserchia/CTI-Toolbox",
"path": "/xfexchange.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: itcrab/contributions-graph path: /contributions_graph/__init__.py
from datetime import datetime
from typing import Optional, List
from contributions_graph.git import Git
from contributions_graph.obfuscate import Obfuscate
from contributions_graph.repository_list import RepositoryList
class Con... | code_fim | hard | {
"lang": "python",
"repo": "itcrab/contributions-graph",
"path": "/contributions_graph/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return all_commits
def get_subtraction_commits(self, all_commits: List[datetime]) -> List[datetime]:
exists_commits = self.git.get_commits_exists()
exists_commits = self.sort_commits(exists_commits)
if self.obfuscate:
all_commits = self.obfuscate.run(all_c... | code_fim | hard | {
"lang": "python",
"repo": "itcrab/contributions-graph",
"path": "/contributions_graph/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> list_display = ("name", "place")<|fim_prefix|># repo: leprikon-cz/leprikon path: /leprikon/admin/place.py
from django.contrib import admin
from ..models.place import Place
<|fim_middle|>@admin.register(Place)
class PlaceAdmin(admin.ModelAdmin):
| code_fim | easy | {
"lang": "python",
"repo": "leprikon-cz/leprikon",
"path": "/leprikon/admin/place.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leprikon-cz/leprikon path: /leprikon/admin/place.py
from django.contrib import admin
from ..models.place import Place
<|fim_suffix|> list_display = ("name", "place")<|fim_middle|>@admin.register(Place)
class PlaceAdmin(admin.ModelAdmin):
| code_fim | easy | {
"lang": "python",
"repo": "leprikon-cz/leprikon",
"path": "/leprikon/admin/place.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: teotoplak/trinity path: /p2p/aurora/aurora_dicovery_protocol.py
import random
from typing import Sequence, Set, Tuple, Dict, List
from cancel_token import CancelToken
from eth_keys import datatypes
from p2p import constants
from p2p.abc import AddressAPI, NodeAPI
from p2p.aurora.util import cal... | code_fim | hard | {
"lang": "python",
"repo": "teotoplak/trinity",
"path": "/p2p/aurora/aurora_dicovery_protocol.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> entry_node: NodeAPI,
standard_mistakes_threshold: int,
network_size: int,
neighbours_response_size: int,
num_of_walks: int):
correctness_dict: Dict[any, List[float]] = {}
correctness_in... | code_fim | hard | {
"lang": "python",
"repo": "teotoplak/trinity",
"path": "/p2p/aurora/aurora_dicovery_protocol.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def aurora_tally(self,
entry_node: NodeAPI,
standard_mistakes_threshold: int,
network_size: int,
neighbours_response_size: int,
num_of_walks: int):
correctness_dict: Dict[any, List[float]] ... | code_fim | hard | {
"lang": "python",
"repo": "teotoplak/trinity",
"path": "/p2p/aurora/aurora_dicovery_protocol.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: facebookresearch/detectron2 path: /projects/ViTDet/configs/COCO/mask_rcnn_vitdet_l_100ep.py
from functools import partial
from .mask_rcnn_vitdet_b_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
get_vit_lr_decay_rate,
)
<|fim_suffix|>model.backbone.net... | code_fim | medium | {
"lang": "python",
"repo": "facebookresearch/detectron2",
"path": "/projects/ViTDet/configs/COCO/mask_rcnn_vitdet_l_100ep.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>optimizer.params.lr_factor_func = partial(get_vit_lr_decay_rate, lr_decay_rate=0.8, num_layers=24)<|fim_prefix|># repo: facebookresearch/detectron2 path: /projects/ViTDet/configs/COCO/mask_rcnn_vitdet_l_100ep.py
from functools import partial
from .mask_rcnn_vitdet_b_100ep import (
dataloader,
lr... | code_fim | hard | {
"lang": "python",
"repo": "facebookresearch/detectron2",
"path": "/projects/ViTDet/configs/COCO/mask_rcnn_vitdet_l_100ep.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Get an RA and covert to degrees
a = Angle(RA)
ra = a.degree
# Get a sidereal time and convert to degrees
st = Angle(siderealtime)
st = st.degree
hourangle = st-ra
hourangle = Angle(str(hourangle)+'degree').hms
print(hourangle)<|fim_prefix|># repo: Nat1405/pops path: ... | code_fim | easy | {
"lang": "python",
"repo": "Nat1405/pops",
"path": "/pops/telescope.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nat1405/pops path: /pops/telescope.py
import astropy
import numpy as np
from astropy import units as u
from astropy.coordinates import Angle
from astropy.coordinates import SkyCoord
<|fim_suffix|> # Get an RA and covert to degrees
a = Angle(RA)
ra = a.degree
# Get a sidereal time ... | code_fim | easy | {
"lang": "python",
"repo": "Nat1405/pops",
"path": "/pops/telescope.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @master_client
def cbbackupmgr_backup(self, master_node: str, cluster_spec: ClusterSpec,
threads: int, mode: str, compression: bool,
storage_type: str, sink_type: str, shards: int,
worker_home: str, obj_staging_dir: s... | code_fim | hard | {
"lang": "python",
"repo": "d-nagy/perfrunner",
"path": "/perfrunner/remote/linux.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @servers_by_role(roles=['index'])
def kill_process_on_index_node(self, process):
logger.info('Killing following process on index node: {}'.format(process))
run("killall {}".format(process), warn_only=True)
def change_owner(self, host, path, owner='couchbase'):
with set... | code_fim | hard | {
"lang": "python",
"repo": "d-nagy/perfrunner",
"path": "/perfrunner/remote/linux.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: d-nagy/perfrunner path: /perfrunner/remote/linux.py
e))
run('rm -f {}'.format(fname))
@all_servers
def collect_index_datafiles(self):
logger.info('Archiving Index Data Files')
fname = '/data/@2i'
cmd_zip = 'zip -rq @2i.zip /data/@2i'
r = run('... | code_fim | hard | {
"lang": "python",
"repo": "d-nagy/perfrunner",
"path": "/perfrunner/remote/linux.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # set params
selector.set_params(key='a', regex=None, predicate=None, items=None, like=None)
expected_params = {'regex': None, 'key': 'a', 'predicate': None, 'items': None, 'like': None}
received_params = selector.get_params()
self.assertDictEqual(expected_params, ... | code_fim | hard | {
"lang": "python",
"repo": "microvn/learnhtml",
"path": "/tests/test_itemSelector.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_predicate(self):
"""Test predicate filtering"""
data = pd.DataFrame({'a': [1, 2, 3], 'ab': ['a', 'ab', 4], 'c2': [1, 0, 1]})
# name predicate
selector = ItemSelector(predicate=lambda x: x[0] == 'a')
selected_data = selector.transform(data)
expe... | code_fim | hard | {
"lang": "python",
"repo": "microvn/learnhtml",
"path": "/tests/test_itemSelector.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: microvn/learnhtml path: /tests/test_itemSelector.py
from unittest import TestCase
import pandas as pd
from sklearn import clone
from learnhtml.utils.sklearn import ItemSelector
class TestItemSelector(TestCase):
"""Test case for ItemSelector"""
def test_dataframe(self):
"""Tes... | code_fim | hard | {
"lang": "python",
"repo": "microvn/learnhtml",
"path": "/tests/test_itemSelector.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: heidi666/WorldsAtWar path: /wawmembers/outcomes_policies.py
return message
def buildfuelrefinery(result):
imgloc = static('wawmembers/warpfuel.gif')
if result == 'TooMany':
message = "Your fleet engineers cannot build so many fuel refineries in one day!"
elif result == 'Fail... | code_fim | hard | {
"lang": "python",
"repo": "heidi666/WorldsAtWar",
"path": "/wawmembers/outcomes_policies.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def free(result):
imgloc = static('wawmembers/free.gif')
if 80 < result <= 100:
message = """<img src="%s" alt="free"><br> \
Some of the dissidents you free go on to join<br>the rebels. Their strength has increased!""" % imgloc
elif 1 <= result <= 80:
message = """... | code_fim | hard | {
"lang": "python",
"repo": "heidi666/WorldsAtWar",
"path": "/wawmembers/outcomes_policies.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: heidi666/WorldsAtWar path: /wawmembers/outcomes_policies.py
pedition found a suitable duranium-rich asteroid! \
<br> You gain 3 duranium per turn.""" % imgloc
return message
def prospecttritanium(result):
imgloc = static('wawmembers/tritanium.gif')
if result == 'TooMany'... | code_fim | hard | {
"lang": "python",
"repo": "heidi666/WorldsAtWar",
"path": "/wawmembers/outcomes_policies.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Turn device power on
print('Turn device power on (pin={})'.format(args.gpio_pin))
GPIO.output(args.gpio_pin, GPIO.HIGH)
# Allow warm-up time
time.sleep(1.0)
try:
while True:
# Take sensor reading
raw_value = mcp.read_adc(args.channel)
... | code_fim | hard | {
"lang": "python",
"repo": "masterhui/GreenPiThumb",
"path": "/tests/test_vh400.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: masterhui/GreenPiThumb path: /tests/test_vh400.py
#!/usr/bin/env python
import argparse
import time
import Adafruit_MCP3008
import RPi.GPIO as GPIO
CLK = 18
MISO = 23
MOSI = 24
CS = 25
def calc_vwc(V):
"""Returns the Volumetric Water Content (VWC)
Most curves can be approximated w... | code_fim | hard | {
"lang": "python",
"repo": "masterhui/GreenPiThumb",
"path": "/tests/test_vh400.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main(args):
GPIO.setmode(GPIO.BCM)
GPIO.setup(args.gpio_pin, GPIO.OUT)
mcp = Adafruit_MCP3008.MCP3008(clk=CLK, cs=CS, miso=MISO, mosi=MOSI)
# Turn device power on
print('Turn device power on (pin={})'.format(args.gpio_pin))
GPIO.output(args.gpio_pin, GPIO.HIGH)
# Al... | code_fim | hard | {
"lang": "python",
"repo": "masterhui/GreenPiThumb",
"path": "/tests/test_vh400.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DevLoL/devlol.at path: /diary/views.py
from django.shortcuts import render_to_response
def calendar(request):
return render_to_response("calendar.html")
<|fim_suffix|>def day(request, item_id):
return render_to_response("item.html")<|fim_middle|>def item(request, item_id):
return re... | code_fim | medium | {
"lang": "python",
"repo": "DevLoL/devlol.at",
"path": "/diary/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DevLoL/devlol.at path: /diary/views.py
from django.shortcuts import render_to_response
<|fim_suffix|> return render_to_response("calendar.html")
def item(request, item_id):
return render_to_response("item.html")
def day(request, item_id):
return render_to_response("item.html")<|fim_... | code_fim | easy | {
"lang": "python",
"repo": "DevLoL/devlol.at",
"path": "/diary/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render_to_response("item.html")<|fim_prefix|># repo: DevLoL/devlol.at path: /diary/views.py
from django.shortcuts import render_to_response
def calendar(request):
<|fim_middle|> return render_to_response("calendar.html")
def item(request, item_id):
return render_to_response("item.html... | code_fim | medium | {
"lang": "python",
"repo": "DevLoL/devlol.at",
"path": "/diary/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def load_estimator(path: str) -> BaseEstimator:
""" Load estimator (model, transformers) from pickle-file. """
with open(path, "rb") as pickle_file:
estimator = pickle.load(pickle_file)
return estimator
def load_features(path: str) -> FeatureParams:
""" Load features from YAML-f... | code_fim | medium | {
"lang": "python",
"repo": "made-ml-in-prod-2021/andyst75",
"path": "/ml_project/src/predict/predict_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: made-ml-in-prod-2021/andyst75 path: /ml_project/src/predict/predict_utils.py
"""
Utilities for predict
"""
import pickle
import yaml
from sklearn.base import BaseEstimator
from ..classes import PredictParams, FeatureParams, TransformPath
<|fim_suffix|> if isinstance(config.transform_path,... | code_fim | hard | {
"lang": "python",
"repo": "made-ml-in-prod-2021/andyst75",
"path": "/ml_project/src/predict/predict_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KanayBhandari/discord_bot_project path: /html_email_template.py
import discord
from jinja2 import Environment, FileSystemLoader
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib, ssl
from smtplib import SMTP
# Manual Import
import crede... | code_fim | hard | {
"lang": "python",
"repo": "KanayBhandari/discord_bot_project",
"path": "/html_email_template.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>async def Email_New_Functionalities(reciever_email, name):
subject = "New Functionalities"
message = MIMEMultipart()
message["Subject"] = subject
message["From"] = CREDENTIALS.sender_email
message["To"] = reciever_email
template = env.get_template('new_functionalities.txt')
text = te... | code_fim | hard | {
"lang": "python",
"repo": "KanayBhandari/discord_bot_project",
"path": "/html_email_template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
async def Email_New_Functionalities(reciever_email, name):
subject = "New Functionalities"
message = MIMEMultipart()
message["Subject"] = subject
message["From"] = CREDENTIALS.sender_email
message["To"] = reciever_email
template = env.get_template('new_functionalities.txt')
text = ... | code_fim | hard | {
"lang": "python",
"repo": "KanayBhandari/discord_bot_project",
"path": "/html_email_template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AllenYZB/homework path: /MA305/6.1.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/11/09 19:02
# @Author : Iydon
# @File : 6.1.py
import numpy as np
def gauss_jordan_method(A, b, num_dig:int):
<|fim_suffix|>
A = np.matrix([[4.,-1,1],[2,5,2],[1,2,4]])
b = np.matrix([[... | code_fim | hard | {
"lang": "python",
"repo": "AllenYZB/homework",
"path": "/MA305/6.1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def gauss_jordan_method(A, b, num_dig:int):
np_result = A**-1 * b
print(np_result.T)
n = A.shape[0]
x = np.zeros((n,1))
for k in range(n):
for i in range(n):
if k == i:
continue
m = A[i,k] / A[k,k]
A[i,:] = np.round( A[i,:] -... | code_fim | medium | {
"lang": "python",
"repo": "AllenYZB/homework",
"path": "/MA305/6.1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> both = state.view(
-1,
self.input_channels,
self.stack_depth,
(self.size + 1),
(self.size + 1),
) # convolve both
if self.network_size in NETWORK_SIZES:
both = F.relu(self.conv1(both))
both = F.re... | code_fim | hard | {
"lang": "python",
"repo": "mbecker12/surface-rl-decoder",
"path": "/src/agents/old_conv_3d_agent.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mbecker12/surface-rl-decoder path: /src/agents/old_conv_3d_agent.py
"""
Old implementation of the 3D Convolutional network.
It is needed for evaluation of trained networks which were trained using
this version of the implementation.
Implementation of an agent containing 3D convolutional layers
f... | code_fim | hard | {
"lang": "python",
"repo": "mbecker12/surface-rl-decoder",
"path": "/src/agents/old_conv_3d_agent.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, matrix_string: str):
self.__matrix = tuple([tuple([int(x) for x in row.split()]) for row in matrix_string.splitlines()])
def row(self, index: int) -> List[int]:
return list(self.__matrix[index - 1])
def column(self, index: int) -> List[int]:
return ... | code_fim | medium | {
"lang": "python",
"repo": "ederst/exercism-python",
"path": "/matrix/honorable_mentions/immutable_matrix.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ederst/exercism-python path: /matrix/honorable_mentions/immutable_matrix.py
from typing import List, Tuple
# From mentor:
# Fun fact. If someone does: matrix.row(3)[0] = 5, this will alter the data stored in the matrix.
# Conversely, if they did matrix.column(3)[0] = 5, this would not update the... | code_fim | medium | {
"lang": "python",
"repo": "ederst/exercism-python",
"path": "/matrix/honorable_mentions/immutable_matrix.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pvicky/reedsolomon path: /setup.py
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy
<|fim_suffix|>setup(
name = "RSEncoderDecoder",
ext_modules = cythonize(extensions),
include_dirs=[numpy.get_include()]
)<|fim... | code_fim | medium | {
"lang": "python",
"repo": "pvicky/reedsolomon",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>setup(
name = "RSEncoderDecoder",
ext_modules = cythonize(extensions),
include_dirs=[numpy.get_include()]
)<|fim_prefix|># repo: pvicky/reedsolomon path: /setup.py
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy
<|fim... | code_fim | medium | {
"lang": "python",
"repo": "pvicky/reedsolomon",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.parametrize("target,header_text,end_locator_for_zones,start_page",
test_data_for_checking_sorting)
def test_dda_geozones(driver,
target,
header_text,
end_locator_for_zones,
start_page):
'''
... | code_fim | hard | {
"lang": "python",
"repo": "MASQA/seleniumtrainingPython",
"path": "/test5_9.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MASQA/seleniumtrainingPython path: /test5_9.py
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
@pytest.fixture
def driver():
wd... | code_fim | hard | {
"lang": "python",
"repo": "MASQA/seleniumtrainingPython",
"path": "/test5_9.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
test_data_for_checking_sorting = [
('countries&doc=countries',
'Name',
') :not([value=""])',
'countries'
),
('geo_zones&doc=geo_zones',
'Zone',
') option[selected]',
'geo_zone'
)
]
@pytest.mark.parametrize("target,header_text,end_locator_for_zones,sta... | code_fim | hard | {
"lang": "python",
"repo": "MASQA/seleniumtrainingPython",
"path": "/test5_9.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: d0ugal/tripleo-common path: /tripleo_common/tests/actions/test_package_update.py
# Copyright 2016 Red Hat, 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 ... | code_fim | hard | {
"lang": "python",
"repo": "d0ugal/tripleo-common",
"path": "/tripleo_common/tests/actions/test_package_update.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> mock_getenv.return_value = env
mock_swift.get_object.return_value = ({}, env)
mock_get_object_client.return_value = mock_swift
action = package_update.UpdateStackAction(self.timeout,
container=self.container)
action... | code_fim | hard | {
"lang": "python",
"repo": "d0ugal/tripleo-common",
"path": "/tripleo_common/tests/actions/test_package_update.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NuwanCW/mlopsworld path: /kubeflowpipeline/2_HPO_train/train.py
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import click
import dill
import json
import uuid
import random
import shutil
import os.path
import logging
import numpy as np
import pandas ... | code_fim | hard | {
"lang": "python",
"repo": "NuwanCW/mlopsworld",
"path": "/kubeflowpipeline/2_HPO_train/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open("/mnt/validationtarget.data", 'rb') as in_f:
y_test= dill.load(in_f)
metrics = [
keras.metrics.BinaryAccuracy(name='accuracy'),
]
OUTPUT_CLASSES = 1
HP_NUM_UNITS = hp.HParam('num_units', hp.Discrete([8,... | code_fim | hard | {
"lang": "python",
"repo": "NuwanCW/mlopsworld",
"path": "/kubeflowpipeline/2_HPO_train/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>grid_bounds = (-1,1) if args.grid_bounds == -1 else (0,1)
hyper_params = {'nn_lr':args.nn_lr,
'lh_lr':args.lh_lr,
'batch_size':args.batch_size,
'epochs':args.epochs,
'grid_size':args.grid_size,
'grid_bounds':grid_bounds,
... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/MLOps",
"path": "/examples/customer_churn/code/train/svdkl_entry.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('Training set loaded',X_train.size(),y_train.size())
print('Test set loaded',X_test.size(),y_test.size())
grid_bounds = (-1,1) if args.grid_bounds == -1 else (0,1)
hyper_params = {'nn_lr':args.nn_lr,
'lh_lr':args.lh_lr,
'batch_size':args.batch_size,
'epo... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/MLOps",
"path": "/examples/customer_churn/code/train/svdkl_entry.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: microsoft/MLOps path: /examples/customer_churn/code/train/svdkl_entry.py
import numpy as np
import argparse
import os
import torch
from torch.utils.data import TensorDataset,DataLoader
from trainer import SvDklTrainer
from azureml.core import Run
parser = argparse.ArgumentParser()
parser.add_a... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/MLOps",
"path": "/examples/customer_churn/code/train/svdkl_entry.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> temp = nums[j]
nums[j] = nums[i - 1]
nums[i - 1] = temp
nums[i:] = reversed(nums[i:])<|fim_prefix|># repo: BigEggStudy/LeetCode-Py path: /LeetCode/_0001_0050/_031_NextPermutation.py
#-----------------------------------------------------------------------------
# Runtime: ... | code_fim | medium | {
"lang": "python",
"repo": "BigEggStudy/LeetCode-Py",
"path": "/LeetCode/_0001_0050/_031_NextPermutation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BigEggStudy/LeetCode-Py path: /LeetCode/_0001_0050/_031_NextPermutation.py
#-----------------------------------------------------------------------------
# Runtime: 36ms
# Memory Usage:
# Link:
#-----------------------------------------------------------------------------
class Solution:
<|fim... | code_fim | medium | {
"lang": "python",
"repo": "BigEggStudy/LeetCode-Py",
"path": "/LeetCode/_0001_0050/_031_NextPermutation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert not subset_minus_sum_vht[subsetsize].has_key(subset)
subset_minus_sum_vht[subsetsize][subset] = (
subset_deltavht_dict[subset] - smallersubsetsum )
outfh = sys.stdout
outfh.write('% Generated by: ' + ' '.join(sys.argv) + '\n')
... | code_fim | hard | {
"lang": "python",
"repo": "stivalaa/traffic_assignment",
"path": "/trunk/scripts/flowoutput2dzn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stivalaa/traffic_assignment path: /trunk/scripts/flowoutput2dzn.py
rate .dzn file for input to Zinc model
# to compute optimal upgrde subbset
#
# File: flowoutput2dzn.py
# Author: Alex Stivala
# Created: May 2011
#
# $Id: flowoutput2dzn.py 706 2011-09-15 06:40:01Z astivala $... | code_fim | hard | {
"lang": "python",
"repo": "stivalaa/traffic_assignment",
"path": "/trunk/scripts/flowoutput2dzn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stivalaa/traffic_assignment path: /trunk/scripts/flowoutput2dzn.py
ods file and VHT from tap_frankwolfe_mpi stderr
# and generate .dzn file for input to Zinc model
# to compute optimal upgrde subbset
#
# File: flowoutput2dzn.py
# Author: Alex Stivala
# Crea... | code_fim | hard | {
"lang": "python",
"repo": "stivalaa/traffic_assignment",
"path": "/trunk/scripts/flowoutput2dzn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param document_id: ID of the file
:param session: Session to connect to the server
:return: hOCR data of the document.
"""
url = get_document_api_details_url(document_id, extra_fields='bbox,hocr')
r = retry_get(session, url)
hocr = r.json()['hocr']
if hocr is None:
... | code_fim | hard | {
"lang": "python",
"repo": "bobycv06fpm/document-ai-python-sdk",
"path": "/konfuzio_sdk/api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bobycv06fpm/document-ai-python-sdk path: /konfuzio_sdk/api.py
cument_api_details_url,
get_project_url,
get_document_ocr_file_url,
get_document_original_file_url,
get_documents_meta_url,
post_project_api_document_annotations_url,
delete_project_api_document_annotations_url,... | code_fim | hard | {
"lang": "python",
"repo": "bobycv06fpm/document-ai-python-sdk",
"path": "/konfuzio_sdk/api.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def delete_document_annotation(document_id: int, annotation_id: int, session=konfuzio_session()):
"""
Delete a given annotation of the given document.
:param document_id: ID of the document
:param annotation_id: ID of the annotation
:param session: Session to connect to the server.
... | code_fim | hard | {
"lang": "python",
"repo": "bobycv06fpm/document-ai-python-sdk",
"path": "/konfuzio_sdk/api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Error:
print("PLease Enter an appropriate Link 🙂")<|fim_prefix|># repo: kaartik2611/youtube-downloader-cli path: /app.py
import pafy
link = input("Enter Link of The YT Video: ")
try:
data = pafy.new(link).streams[0].download(<|fim_middle|>)
print("Your Video is downloaded 🎉")
except Value | code_fim | easy | {
"lang": "python",
"repo": "kaartik2611/youtube-downloader-cli",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kaartik2611/youtube-downloader-cli path: /app.py
import pafy
link = input("Enter Link of The YT Video: ")
try:
data = pafy.new(link).streams[0].download(<|fim_suffix|>Error:
print("PLease Enter an appropriate Link 🙂")<|fim_middle|>)
print("Your Video is downloaded 🎉")
except Value | code_fim | easy | {
"lang": "python",
"repo": "kaartik2611/youtube-downloader-cli",
"path": "/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># def match(from, to):
# from_ts = from.get('target'), from.get('source')
# to_ts = to.get('target'), to.get('source')
# return from_ts, to_ts<|fim_prefix|># repo: silky/echomesh path: /code/python/echomesh/event/Address.py
# from __future__ import absolute_import, division, print_function, unicode... | code_fim | medium | {
"lang": "python",
"repo": "silky/echomesh",
"path": "/code/python/echomesh/event/Address.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># def match_one(them, us):
# return (not us) or them
# def match(from, to):
# from_ts = from.get('target'), from.get('source')
# to_ts = to.get('target'), to.get('source')
# return from_ts, to_ts<|fim_prefix|># repo: silky/echomesh path: /code/python/echomesh/event/Address.py
# from __future__ i... | code_fim | hard | {
"lang": "python",
"repo": "silky/echomesh",
"path": "/code/python/echomesh/event/Address.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: silky/echomesh path: /code/python/echomesh/event/Address.py
# from __future__ import absolute_import, division, print_function, unicode_literals
# # TODO: needs to be finished and integrated into the code.
# """
# Format for an address!
<|fim_suffix|># def match_one(them, us):
# return (not... | code_fim | medium | {
"lang": "python",
"repo": "silky/echomesh",
"path": "/code/python/echomesh/event/Address.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thoongnv/yosim path: /yosim/signatures/views.py
# -*- coding: utf-8 -*-
from django.views.generic import ListView, DetailView
from .models import Signature, SignatureCategoryMapping
<|fim_suffix|>
class SigCatMappingListView(ListView):
model = SignatureCategoryMapping
template_name = 's... | code_fim | hard | {
"lang": "python",
"repo": "thoongnv/yosim",
"path": "/yosim/signatures/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = SignatureCategoryMapping
template_name = 'signatures/sig_cat_mapping_detail.html'
context_object_name = 'sig_cat_mapping'
def get_object(self):
return SignatureCategoryMapping.objects.select_related().get(
id=self.kwargs.get("sig_cat_map_id"))<|fim_prefix|># re... | code_fim | hard | {
"lang": "python",
"repo": "thoongnv/yosim",
"path": "/yosim/signatures/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = SignatureCategoryMapping
template_name = 'signatures/signature_detail.html'
context_object_name = 'signature'
def get_object(self):
return Signature.objects.select_related().get(
id=self.kwargs.get("signature_id"))
class SigCatMappingListView(ListView):
m... | code_fim | medium | {
"lang": "python",
"repo": "thoongnv/yosim",
"path": "/yosim/signatures/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># r=0
# for b in list1:
# if j==b:
# r+=1
# # print(j,r)
# l.append([(j,r)])
# print(l)
# ###############################################
# for row in range(6):
# for col in range(7):
# if (row==0 and col%3!=0) or (row==1 and col%3==0) or (row - col==2) or (row + col==8):
# print("*",end="... | code_fim | hard | {
"lang": "python",
"repo": "ajith1717/basic-of-python",
"path": "/ajithextra.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ajith1717/basic-of-python path: /ajithextra.py
# a=1
# while a<=100:
# if a%5==0 and a%6==0:
# print ("ajith subramaniam")
# elif a%5==0:
# print ("ajith")
# elif a%6==0:
# print ("subramaniam")
# else:
# print(a)
# a=a+1
# a=1
# while a<100:
# if a%5!=0:
# print("ajith")
# ... | code_fim | hard | {
"lang": "python",
"repo": "ajith1717/basic-of-python",
"path": "/ajithextra.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># def lose():
# print 'You lose!'
# while True:
# player_choice = raw_input('What do you pick? (rock, paper, scissors)')
# random_move = randint(0, 2)
# option = ['rock', 'paper', 'scissors']
# computer_choice = option[random_move]
# if player_choice == computer_choice:
# ... | code_fim | hard | {
"lang": "python",
"repo": "ajith1717/basic-of-python",
"path": "/ajithextra.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: meadow163/SpEx path: /src/dataset/train_fixed_length_waveform_pre_mix_no_preprocessed.py
import os
import random
import librosa
import numpy as np
import torchaudio as torchaudio
from joblib import Parallel, delayed
from torch.utils import data
from util.utils import sample_fixed_lengt... | code_fim | hard | {
"lang": "python",
"repo": "meadow163/SpEx",
"path": "/src/dataset/train_fixed_length_waveform_pre_mix_no_preprocessed.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __len__(self):
return self.length
def load_wav(self, file_path):
return librosa.load(os.path.abspath(os.path.expanduser(file_path)), sr=self.sr)[0]
def __getitem__(self, item):
mixture_path, target_path = self.dataset_list[item].split(" ")
target... | code_fim | hard | {
"lang": "python",
"repo": "meadow163/SpEx",
"path": "/src/dataset/train_fixed_length_waveform_pre_mix_no_preprocessed.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hangwudy/Mask_RCNN path: /dataset_tools/num_pic.py
import os
def loadim(image_path = '', ext = 'png', key_word = 'car_door'):
image_list = []
for filename in os.listdir(image_path):
if filename.endswith(ext) and filename.find(key_word) != -1:
current_path = os.path.ab... | code_fim | medium | {
"lang": "python",
"repo": "hangwudy/Mask_RCNN",
"path": "/dataset_tools/num_pic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># for i in [50,55,62,69,78,87]:
# kw = "car_door_{}".format(i)
# for j in range(1,361):
# kw_2 = "{}_{}".format(kw,j)
# if len(loadim("/home/hangwu/Repositories/Dataset/dataset/car_door_all","jpg",kw_2)) == 0:
# print(i,j)<|fim_prefix|># repo: hangwudy/Mask_RCNN path: ... | code_fim | medium | {
"lang": "python",
"repo": "hangwudy/Mask_RCNN",
"path": "/dataset_tools/num_pic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LeeBergstrand/Bioinformatics_scripts path: /Barcode_Preparation_Toolbox/countAllBarcodes-RAW.py
#! /usr/bin/env python
#Comai Lab, Ucdavis Genome Center
#Meric Lieberman, 2011
# This work is the property of UC Davis Genome Center - Comai Lab
# Use at your own risk.
# We cannot provide support.... | code_fim | medium | {
"lang": "python",
"repo": "LeeBergstrand/Bioinformatics_scripts",
"path": "/Barcode_Preparation_Toolbox/countAllBarcodes-RAW.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>#--------------------------------------------------------------------------
#for reverse complement
def comp(seq):
complement = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A', 'N': 'N', 'R': 'R', 'Y': 'Y', 'S': 'S', 'W': 'W', 'M': 'M', 'K': 'K'}
complseq = [complement[base] for base in seq]
return ... | code_fim | hard | {
"lang": "python",
"repo": "LeeBergstrand/Bioinformatics_scripts",
"path": "/Barcode_Preparation_Toolbox/countAllBarcodes-RAW.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> seq = list(seq)
seq.reverse()
return ''.join(comp(seq))
f = open(sys.argv[1])
bar = {}
#read in 4 lines(one read) at a time, adding each barcode
#to the result dictionary
while True:
n1 = f.readline()
if n1 == "":
break
seq = f.readline()
n2 = f.readline()
seqq = f.read... | code_fim | hard | {
"lang": "python",
"repo": "LeeBergstrand/Bioinformatics_scripts",
"path": "/Barcode_Preparation_Toolbox/countAllBarcodes-RAW.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>class PinnedStudent(models.Model):
student = models.ForeignKey(SeatingStudent)
table = models.ForeignKey(Table)
meal_time = models.ForeignKey(MealTime)
history = HistoricalRecords()
class Meta:
unique_together = (('student', 'meal_time'), )
def __str__(self):... | code_fim | hard | {
"lang": "python",
"repo": "rectory-school/rectory-apps-legacy",
"path": "/seating_charts/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rectory-school/rectory-apps-legacy path: /seating_charts/models.py
from django.db import models
from simple_history.models import HistoricalRecords
from django.core.exceptions import ValidationError
from adminsortable.models import SortableMixin
from academics.models import Enrollment, Grade
#... | code_fim | hard | {
"lang": "python",
"repo": "rectory-school/rectory-apps-legacy",
"path": "/seating_charts/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> description = models.CharField(max_length=200)
for_meals = models.ManyToManyField(MealTime)
capacity = models.IntegerField()
history = HistoricalRecords()
def __str__(self):
return "Table %s (%s)" % (self.description, ", ".join(map(str, self.for_meals.all())))
class... | code_fim | hard | {
"lang": "python",
"repo": "rectory-school/rectory-apps-legacy",
"path": "/seating_charts/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LoansBot/database path: /tests/migrations/002_create_logging_tbls_up.py
import unittest
from pypika import PostgreSQLQuery as Query, Table, Parameter
import helper
class UpTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.connection = helper.setup_connection... | code_fim | hard | {
"lang": "python",
"repo": "LoansBot/database",
"path": "/tests/migrations/002_create_logging_tbls_up.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> q_str = Query.into(self.idens).columns(self.idens.identifier).insert(Parameter('%s')).get_sql()
q_args = ('iden',)
self.cursor.execute(q_str, q_args)
helper.assert_fails_with_pgcode(self, '23505', self.cursor, q_str, q_args)
def test_event_defaults(self):
... | code_fim | hard | {
"lang": "python",
"repo": "LoansBot/database",
"path": "/tests/migrations/002_create_logging_tbls_up.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: diogo149/tfu path: /tfu/tests/inits_test.py
import numpy as np
import tensorflow as tf
import nose.tools as nt
import tfu
<|fim_suffix|> with tf.Graph().as_default():
with tf.Session() as sess:
with tfu.temporary_hook(tfu.inits.scale_inits(3.0)):
b = tfu.ge... | code_fim | easy | {
"lang": "python",
"repo": "diogo149/tfu",
"path": "/tfu/tests/inits_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with tf.Graph().as_default():
with tf.Session() as sess:
with tfu.temporary_hook(tfu.inits.scale_inits(3.0)):
b = tfu.get_variable("b",
shape=(),
initial_value=2.0)
sess.run(tf.glo... | code_fim | easy | {
"lang": "python",
"repo": "diogo149/tfu",
"path": "/tfu/tests/inits_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Open-E-WEB/django-powerpages path: /powerpages/management/commands/website_base.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
class BaseDumpLoadCommand(BaseCommand):
""... | code_fim | hard | {
"lang": "python",
"repo": "Open-E-WEB/django-powerpages",
"path": "/powerpages/management/commands/website_base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Performs the operation"""
operation = self.operation_class(
root_url=root_url, error_class=CommandError,
stdout=self.stdout, stderr=self.stderr, **options
)
return operation.run()<|fim_prefix|># repo: Open-E-WEB/django-powerpages path: /powerpage... | code_fim | hard | {
"lang": "python",
"repo": "Open-E-WEB/django-powerpages",
"path": "/powerpages/management/commands/website_base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def reparameterize(self, mu, log_sigma):
"""
Using the reparameterization trick to sample from the latent space
Inputs: mu - the encoded data's mean and location in the latent space
log_sigma - A standard deviation to alter the the encoded data to represent a ne... | code_fim | hard | {
"lang": "python",
"repo": "danielMonas/VAEriation",
"path": "/vae.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: danielMonas/VAEriation path: /vae.py
# Disable TensorFlow warnings
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
from tensorflow.keras.layers import Dense, Flatten, Conv2D, MaxPool2D, UpSampling2D, Reshape, Conv2DTranspose
from tensorflow.keras.backend import flatten... | code_fim | hard | {
"lang": "python",
"repo": "danielMonas/VAEriation",
"path": "/vae.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hanzhichao/tdl path: /tdl/libs/http_libaray.py
import requests
from tdl.context import library
@library
class Http:
def __init__(self, base_url=None, params: dict=None, headers: dict=None, auth: tuple=None):
<|fim_suffix|> return self.request('GET', url, **kwargs)
def post(self... | code_fim | hard | {
"lang": "python",
"repo": "hanzhichao/tdl",
"path": "/tdl/libs/http_libaray.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def post(self, url, **kwargs):
return self.request('POST', url, **kwargs)<|fim_prefix|># repo: hanzhichao/tdl path: /tdl/libs/http_libaray.py
import requests
from tdl.context import library
@library
class Http:
def __init__(self, base_url=None, params: dict=None, headers: dict=None, au... | code_fim | hard | {
"lang": "python",
"repo": "hanzhichao/tdl",
"path": "/tdl/libs/http_libaray.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.request('GET', url, **kwargs)
def post(self, url, **kwargs):
return self.request('POST', url, **kwargs)<|fim_prefix|># repo: hanzhichao/tdl path: /tdl/libs/http_libaray.py
import requests
from tdl.context import library
@library
class Http:
def __init__(self, base_... | code_fim | hard | {
"lang": "python",
"repo": "hanzhichao/tdl",
"path": "/tdl/libs/http_libaray.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data returned will be a JSON object that looks like:
{
"badd": [
["bad", 0.47987616099071206], ["bald", 0.25386996904024767],
["band", 0.16718266253869968], ["add", 0.08359133126934984],
["bade", 0.015479876160990712]
],
... | code_fim | hard | {
"lang": "python",
"repo": "paddycarey/speelchecker",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paddycarey/speelchecker path: /app.py
"""A trivial spell checking API using Flask and TextBlob.
This app wraps a very simple JSON interface around TextBlob and provides very
basic spell checking and correction support (english only for now).
"""
# third-party imports
from flask import Flask
from... | code_fim | hard | {
"lang": "python",
"repo": "paddycarey/speelchecker",
"path": "/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/correction')
def correction():
"""Simple handler that parses a query parameter and returns a best-guess
spelling correction using the TextBlob library.
urls should take the form '/correction?text=some%20textt%20to%20corect'
data returned will be a JSON object that looks like... | code_fim | medium | {
"lang": "python",
"repo": "paddycarey/speelchecker",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Test_speedCurve(unittest.TestCase):
def setUp(self):
points = [Vector3(0, 0, 0), Vector3(1, 0, 0), Vector3(2, 0, 0), Vector3(3, 0, 0)]
maxSpeed = MAX_SPEED
minSpeed = MIN_CRUISE_SPEED
tanAccelLim = TANGENT_ACCEL_LIMIT
normAccelLim = NORM_ACCEL_LIMIT
... | code_fim | hard | {
"lang": "python",
"repo": "webbbn/OpenSolo",
"path": "/shotmanager/Test/TestCableController.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Test_speedCurve(unittest.TestCase):
def setUp(self):
points = [Vector3(0, 0, 0), Vector3(1, 0, 0), Vector3(2, 0, 0), Vector3(3, 0, 0)]
maxSpeed = MAX_SPEED
minSpeed = MIN_CRUISE_SPEED
tanAccelLim = TANGENT_ACCEL_LIMIT
normAccelLim = NORM_ACCEL_LIMIT
... | code_fim | hard | {
"lang": "python",
"repo": "webbbn/OpenSolo",
"path": "/shotmanager/Test/TestCableController.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: webbbn/OpenSolo path: /shotmanager/Test/TestCableController.py
ontroller.
#
# Created by Will Silva on 1/22/2015.
# Copyright (c) 2016 3D Robotics.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may o... | code_fim | hard | {
"lang": "python",
"repo": "webbbn/OpenSolo",
"path": "/shotmanager/Test/TestCableController.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.