text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: jimbunny/cartoonVideo path: /combineVideo/read_video_info.py
import cv2
def read_video_info(file):
cap = cv2.VideoCapture(file)
<|fim_suffix|> # 输出文件编码,Linux下可选X264
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
# 视频帧率
fps = cap.get(cv2.CAP_PROP_FPS)
print("视频size:" + str(siz... | code_fim | medium | {
"lang": "python",
"repo": "jimbunny/cartoonVideo",
"path": "/combineVideo/read_video_info.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: s-index/dora path: /dora/main.py
# coding: utf-8
import fire
import requests
from requests import Response
from bs4 import BeautifulSoup
from urllib.parse import urljoin
from urllib.parse import urlparse
from urllib.parse import urldefrag
import pprint
import re
import sys
import json
class Dor... | code_fim | hard | {
"lang": "python",
"repo": "s-index/dora",
"path": "/dora/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = set()
compile = re.compile('('+search_word+')')
for word in soup.find_all(text=compile):
result.add(re.search(compile,word).group())
return result
def main():
fire.Fire(Dora)<|fim_prefix|># repo: s-index/dora path: /dora/main.py
# coding: utf-8
im... | code_fim | hard | {
"lang": "python",
"repo": "s-index/dora",
"path": "/dora/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@ex.capture
def cifar10_experiment(dataset, model, args, optimizer, use_hyperband, lr, lr_decay, weight_decay, ntrials, nmaxepochs, batch, resume_pth, result_dir, cuda, smoke_test):
assert optimizer in ['Adam', 'SGD'], 'Only Adam and SGD are supported'
if lr_decay is None:
lr_decay = {'fac... | code_fim | hard | {
"lang": "python",
"repo": "bytesnake/butterfly",
"path": "/cnn/cifar_experiment.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bytesnake/butterfly path: /cnn/cifar_experiment.py
import os, sys, subprocess
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, project_root)
# Add to $PYTHONPATH in addition to sys.path so that ray workers can see
os.environ['PYTHONPATH'] = project_roo... | code_fim | hard | {
"lang": "python",
"repo": "bytesnake/butterfly",
"path": "/cnn/cifar_experiment.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert optimizer in ['Adam', 'SGD'], 'Only Adam and SGD are supported'
if lr_decay is None:
lr_decay = {'factor': 1.0, 'period': 1000, 'milestones': None}
config={
'optimizer': optimizer,
'switch_ams': int(0.5 * nmaxepochs) if optimizer == 'Adam' else None,
'lr'... | code_fim | hard | {
"lang": "python",
"repo": "bytesnake/butterfly",
"path": "/cnn/cifar_experiment.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: grey-area/qcircuits path: /qcircuits/operators.py
else:
d = arg.rank
arg_indices = list(range(d))
op_indices = list(range(1, self.rank, 2))
if len(op_indices) > d:
raise ValueError('An operator for a d-rank state space can only be applied... | code_fim | hard | {
"lang": "python",
"repo": "grey-area/qcircuits",
"path": "/qcircuits/operators.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: grey-area/qcircuits path: /qcircuits/operators.py
d__(self, arg):
return Operator(self._t + arg._t)
def __sub__(self, arg):
return self + (-1) * arg
def __mul__(self, scalar):
if isinstance(scalar, (float, int, complex)):
return Operator(scalar * self... | code_fim | hard | {
"lang": "python",
"repo": "grey-area/qcircuits",
"path": "/qcircuits/operators.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> arg_t = arg._permuted_tensor(application_permutation)
arg_indices = arg_indices[:len(qubit_indices)]
result = np.tensordot(self._t, arg_t, (op_indices, arg_indices))
# Our convention is to have lower and upper indices of operators interleaved.
# Using tensordot on ... | code_fim | hard | {
"lang": "python",
"repo": "grey-area/qcircuits",
"path": "/qcircuits/operators.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
print(cmptime('2019-02-05T12:00:00.000Z','2018-02-05T12:00:00.000Z'))
print(cmptime('2018-02-05T12:00:00.000Z','2019-02-05T12:00:00.000Z'))
print(cmptime('2018-03-05T12:00:00.000Z','2018-02-05T12:00:00.000Z'))
print(cmptime('2018-02-05T12:00:00.000Z','2018-03-05T12:00:00.000... | code_fim | hard | {
"lang": "python",
"repo": "nmrossomando/marsrover-pipeline",
"path": "/metadata/util.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # If anything else, equal:
return False
if __name__ == '__main__':
print(cmptime('2019-02-05T12:00:00.000Z','2018-02-05T12:00:00.000Z'))
print(cmptime('2018-02-05T12:00:00.000Z','2019-02-05T12:00:00.000Z'))
print(cmptime('2018-03-05T12:00:00.000Z','2018-02-05T12:00:00.000Z'))
print(cmptime('2018-02... | code_fim | hard | {
"lang": "python",
"repo": "nmrossomando/marsrover-pipeline",
"path": "/metadata/util.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nmrossomando/marsrover-pipeline path: /metadata/util.py
#!/usr/bin/python3
#
# Some handy utilities that could (will) be useful.
#
# I hate datetime enough to implement this myself.
# Returns True if lhs > rhs, Returns False if lhs <= rhs
# Since timestamps are in uniform format in the manifests... | code_fim | medium | {
"lang": "python",
"repo": "nmrossomando/marsrover-pipeline",
"path": "/metadata/util.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xlztongxue/meiduoshangcheng path: /meiduo_project/meiduo_mall/meiduo_mall/apps/meiduo_admin/views/options.py
from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from goods.models import SpecificationOpti... | code_fim | hard | {
"lang": "python",
"repo": "xlztongxue/meiduoshangcheng",
"path": "/meiduo_project/meiduo_mall/meiduo_mall/apps/meiduo_admin/views/options.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def simple(self, requset):
"""查询规格选项"""
# 查询规格选项商品
spus = SPUSpecification.objects.all()
# 序列化返回数据
ser = SpuSpecificationSerializer(spus, many=True)
# 返回结果
return Response(ser.data)<|fim_prefix|># repo: xlztongxue/meiduoshangcheng path: /meiduo... | code_fim | hard | {
"lang": "python",
"repo": "xlztongxue/meiduoshangcheng",
"path": "/meiduo_project/meiduo_mall/meiduo_mall/apps/meiduo_admin/views/options.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adrianhindes/cavity-sml path: /createData.py
# Running Finesse
import subprocess
# Editing kat file
import fileinput
# Copying files
import shutil
# Adding Gaussian noise
from skimage import io, util
# Navigating directories
import os
# Cropping raw images
from PIL import Image
# Nice... | code_fim | hard | {
"lang": "python",
"repo": "adrianhindes/cavity-sml",
"path": "/createData.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # crop generated image
# GNUplot generates a margin for some reason
# assume square image
image = Image.open(current+ext)
width = image.size[0]
height = width
offset = height-1
... | code_fim | hard | {
"lang": "python",
"repo": "adrianhindes/cavity-sml",
"path": "/createData.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for name in names:
fig, (ax1, ax2, ax3) = plt.subplots(nrows=3, ncols=1, figsize=(15, 10))
tup = (ax1, ax2, ax3)
for p, ax in zip(positions, tup):
box = []
for n in ntrials:
file_path = "../../data/Groupe_1_codas/%s_%s_coda000%d.txt" % (name, p, n)
if no... | code_fim | medium | {
"lang": "python",
"repo": "gdeside/LEPL1506_Projet4",
"path": "/codepython/Yplot/analysey.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gdeside/LEPL1506_Projet4 path: /codepython/Yplot/analysey.py
import numpy as np
import matplotlib.pyplot as plt
import math
from scipy import signal
import glm_data_processing as glm
import get_mu_points as gmp
import get_mu_fit as gmf
from os import path
import coda_tools as coda
import proce... | code_fim | medium | {
"lang": "python",
"repo": "gdeside/LEPL1506_Projet4",
"path": "/codepython/Yplot/analysey.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not osp.exists(aug_save_path):
os.makedirs(aug_save_path)
transformer = Transformer()
aug_json_list = []
for cla_name, bboxes_list in self.cla_instance.items(): # str '1': [edict()]
cla_num = len(bboxes_list)
if cla_num >= add_num:... | code_fim | hard | {
"lang": "python",
"repo": "La-fe/cloth_mmdet",
"path": "/my_util/vis_gt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: La-fe/cloth_mmdet path: /my_util/vis_gt.py
er = doc.createTextNode('VOC2012')
folder_node.appendChild(folder)
anno_root.appendChild(folder_node)
# filename
filename_node = doc.createElement("filename")
# filename = doc.createTextNode(anno['image_path'].split('/')[1])
file... | code_fim | hard | {
"lang": "python",
"repo": "La-fe/cloth_mmdet",
"path": "/my_util/vis_gt.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
self.json_paths = ['']
self.allimg_path = ''
class MyEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.integer):
return int(obj)
elif isinstance(obj, np.floating):
return float(obj)
elif isi... | code_fim | hard | {
"lang": "python",
"repo": "La-fe/cloth_mmdet",
"path": "/my_util/vis_gt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spring-haru/pwtdata path: /pwtdata/pwtdata.py
"""Module for downloading the Penn World Tables (PWT) data.
Module contains a set of functions that download the PWT data set.
"""
from os.path import abspath, join, split
import pandas as pd
def get_path(f):
return split(abspath(f))[0]
var_de... | code_fim | hard | {
"lang": "python",
"repo": "spring-haru/pwtdata",
"path": "/pwtdata/pwtdata.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>----- Price levels, expenditure categories and capital -----
pl_c: Price level of household consumption, price level of USA GDPo in 2017=1
pl_i: Price level of capital formation, price level of USA GDPo in 2017=1
pl_g: Price level of government consumption, price level of USA GDPo in 2017=1
pl_x:... | code_fim | hard | {
"lang": "python",
"repo": "spring-haru/pwtdata",
"path": "/pwtdata/pwtdata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ThomasPosen/Taking-Form path: /markup/Annotation.py
import re
from ParseError import ParseError
class Annotation:
def __init__(self, text : str, measure : int, beat : float):
self.measure = measure
self.beat = beat
text = text.replace("$", "")
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "ThomasPosen/Taking-Form",
"path": "/markup/Annotation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return f'{self.id}({self.measure},{round(self.beat, 2)})'
def __eq__(self, other):
if isinstance(other, Annotation):
return self.measure == other.measure and self.beat == other.beat and self.id == other.id
return False<|fim_prefix|># repo: ThomasPosen/Taking-Form ... | code_fim | hard | {
"lang": "python",
"repo": "ThomasPosen/Taking-Form",
"path": "/markup/Annotation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # sub-command: get
get_group_parser = self.add_action("get", help='get specified group')
get_group_parser.add_argument('--group_id', dest="group_id", type=str, required=True)
get_group_parser.set_defaults(func=self._get_group)
def _get_all_groups(self, args):
c... | code_fim | hard | {
"lang": "python",
"repo": "Dataman-Cloud/python-borgcli",
"path": "/borgapicli/plugins/group.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dataman-Cloud/python-borgcli path: /borgapicli/plugins/group.py
import argparse
from borgapicli.plugin_helpers import BORGClientPlugin
import borgclient
class GroupPlugin(BORGClientPlugin):
def register(self):
<|fim_suffix|> # sub-command: all
group_all_parser = self.add_acti... | code_fim | medium | {
"lang": "python",
"repo": "Dataman-Cloud/python-borgcli",
"path": "/borgapicli/plugins/group.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _get_all_groups(self, args):
configs = self._get_config()
borg_client = borgclient.BorgClient(configs['host'], token=configs['token'])
return borg_client.get_all_groups()
def _get_group(self, args):
configs = self._get_config()
group_id = args.group_id
... | code_fim | hard | {
"lang": "python",
"repo": "Dataman-Cloud/python-borgcli",
"path": "/borgapicli/plugins/group.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.human_readable_labels = loadmat(self.path_human_readable_labels)['class_names']
def get_label_unique_count(self):
return np.unique(self.data_matrix['class'], return_counts=True)
def get_class_distribution(self):
return self.get_label_unique_count()[1]/len(self.data_m... | code_fim | hard | {
"lang": "python",
"repo": "sigopt/sigopt-examples",
"path": "/stanford-car-classification/stanford_cars.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sigopt/sigopt-examples path: /stanford-car-classification/stanford_cars.py
from scipy.io import loadmat
import numpy as np
from torch.utils.data import Dataset
import torchvision
from enum import Enum
import os
from PIL import Image
import math
import logging
logging.basicConfig(format='%(asctime... | code_fim | hard | {
"lang": "python",
"repo": "sigopt/sigopt-examples",
"path": "/stanford-car-classification/stanford_cars.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if instance_id in self.status_map:
status = self.status_map.get(instance_id)
return status
logger.debug("query status, can not find instance record, instance_id = %s." % instance_id)
return None<|fim_prefix|># repo: back1860/jacket-status-cache path: /jac... | code_fim | hard | {
"lang": "python",
"repo": "back1860/jacket-status-cache",
"path": "/jacketstatuscache/jacketcache.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: back1860/jacket-status-cache path: /jacketstatuscache/jacketcache.py
# -*- coding:utf-8 -*-
import log as logger
import threading
import time
EXP_TIME = 50
logger.init("jacket-cache", output=False)
<|fim_suffix|> logger.info("init jacket status cache.")
self.synchronizer = s... | code_fim | medium | {
"lang": "python",
"repo": "back1860/jacket-status-cache",
"path": "/jacketstatuscache/jacketcache.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __repr__(self):
return str(self.__dict__)
def __str__(self):
return str(self.__dict__)
def __iter__(self):
for k, v in self.__dict__.items():
yield k, v<|fim_prefix|># repo: windschord/airport_weather path: /app/model/taf_forecast.py
# -*- coding:utf-... | code_fim | hard | {
"lang": "python",
"repo": "windschord/airport_weather",
"path": "/app/model/taf_forecast.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: windschord/airport_weather path: /app/model/taf_forecast.py
# -*- coding:utf-8 -*-
from sqlalchemy import Column, Float, String, Integer, DateTime, ForeignKey
from sqlalchemy.orm import relation
from app.model import DB_BASE
from app.model.taf_sky_condition import TafSkyCondition
__author__ =... | code_fim | medium | {
"lang": "python",
"repo": "windschord/airport_weather",
"path": "/app/model/taf_forecast.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Christy538/Hacktoberfest-2021 path: /PYTHON/Pascals Triangle.py
n =int(input("Enter a number: "))
for i in range(1, n+1)<|fim_suffix|>k, sep='', end='')
k = k * (i - j) // j
print()<|fim_middle|>:
for j in range(0, n-i+1):
print(' ', end='')
k = 1
for j in range(... | code_fim | medium | {
"lang": "python",
"repo": "Christy538/Hacktoberfest-2021",
"path": "/PYTHON/Pascals Triangle.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>k, sep='', end='')
k = k * (i - j) // j
print()<|fim_prefix|># repo: Christy538/Hacktoberfest-2021 path: /PYTHON/Pascals Triangle.py
n =int(input("Enter a number: "))
for i in range(1, n+1)<|fim_middle|>:
for j in range(0, n-i+1):
print(' ', end='')
k = 1
for j in range(... | code_fim | medium | {
"lang": "python",
"repo": "Christy538/Hacktoberfest-2021",
"path": "/PYTHON/Pascals Triangle.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frappe/frappe path: /frappe/geo/utils.py
# Copyright (c) 2020, Frappe Technologies and contributors
# License: MIT. See LICENSE
import frappe
@frappe.whitelist()
def get_coords(doctype, filters, type):
"""Get a geojson dict representing a doctype."""
filters_sql = get_coords_conditions(docty... | code_fim | hard | {
"lang": "python",
"repo": "frappe/frappe",
"path": "/frappe/geo/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def return_coordinates(doctype, filters_sql):
"""Get name, latitude and longitude fields for Doctype."""
if filters_sql:
try:
coords = frappe.db.sql(
f"""SELECT name, latitude, longitude FROM `tab{doctype}` WHERE {filters_sql}""",
as_dict=True,
)
except frappe.db.InternalError:
fra... | code_fim | hard | {
"lang": "python",
"repo": "frappe/frappe",
"path": "/frappe/geo/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robinmitra/taxman path: /taxman/national_insurance/employers.py
from taxman.income.employment import Employment
class Employers:
def __init__(self, incomes):
self._incomes = incomes
<|fim_suffix|> Returns:
float: The total contribution.
"""
salary... | code_fim | medium | {
"lang": "python",
"repo": "robinmitra/taxman",
"path": "/taxman/national_insurance/employers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
float: The total contribution.
"""
salary = self._get_salary()
if not salary:
return 0
# Class 1 NIC.
contribution = 0
st = 702
if salary > st:
contribution = (salary - st) * 0.138
return c... | code_fim | medium | {
"lang": "python",
"repo": "robinmitra/taxman",
"path": "/taxman/national_insurance/employers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_includes():
'''
Return directories containing the Arduino header files.
Notes
=====
For example:
import arduino_rpc
...
print ' '.join(['-I%s' % i for i in arduino_rpc.get_includes()])
...
'''
import base_node_rpc
import arduino_... | code_fim | hard | {
"lang": "python",
"repo": "sci-bots/stepper-motor-controller",
"path": "/stepper_motor_controller/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_sources():
'''
Return Arduino source file paths. This includes any supplementary source
files that are not contained in Arduino libraries.
'''
import base_node_rpc
import arduino_timer_one
return (get_sketch_directory().files('*.c*') +
list(get_lib_direct... | code_fim | hard | {
"lang": "python",
"repo": "sci-bots/stepper-motor-controller",
"path": "/stepper_motor_controller/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sci-bots/stepper-motor-controller path: /stepper_motor_controller/__init__.py
from collections import OrderedDict
from path_helpers import path
try:
from .config import Config, State
except (ImportError, TypeError):
pass
from .proxy import Proxy, I2cProxy, SerialProxy
def package_path(... | code_fim | hard | {
"lang": "python",
"repo": "sci-bots/stepper-motor-controller",
"path": "/stepper_motor_controller/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hercules261188/process-monitor path: /ps_monitor/main.py
import argparse
import os
from ps_monitor.process import ProcessNotification
parser = argparse.ArgumentParser(description="Process some integers.")
parser.add_argument(
"pid", type=int, help="Process ID of the process to monitor. os.g... | code_fim | medium | {
"lang": "python",
"repo": "hercules261188/process-monitor",
"path": "/ps_monitor/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = parser.parse_args()
print(f"selected pid={args.pid}, {type(args.pid)} with delay = {args.delay}")
ProcessNotification(pid=args.pid).schedule(args.delay)
if __name__ == "__main__":
main()<|fim_prefix|># repo: hercules261188/process-monitor path: /ps_monitor/main.py
import argparse... | code_fim | medium | {
"lang": "python",
"repo": "hercules261188/process-monitor",
"path": "/ps_monitor/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> current_state = GPIO.input(ch)
if current_state:
print('OFF')
else:
print('Pushed')
GPIO.add_event_detect(SWITCH_PORT, GPIO.BOTH, callback=cb_switch)
time.sleep(10)<|fim_prefix|># repo: kioto/raspi_gpio_sample path: /01_switch_inter.py
#
# 01_switch_inter.py
#
import RPi.G... | code_fim | medium | {
"lang": "python",
"repo": "kioto/raspi_gpio_sample",
"path": "/01_switch_inter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kioto/raspi_gpio_sample path: /01_switch_inter.py
#
# 01_switch_inter.py
#
import RPi.GPIO as GPIO
import time
SWITCH_PORT = 23
<|fim_suffix|> current_state = GPIO.input(ch)
if current_state:
print('OFF')
else:
print('Pushed')
GPIO.add_event_detect(SWITCH_PORT, GPI... | code_fim | medium | {
"lang": "python",
"repo": "kioto/raspi_gpio_sample",
"path": "/01_switch_inter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def cb_switch(ch):
current_state = GPIO.input(ch)
if current_state:
print('OFF')
else:
print('Pushed')
GPIO.add_event_detect(SWITCH_PORT, GPIO.BOTH, callback=cb_switch)
time.sleep(10)<|fim_prefix|># repo: kioto/raspi_gpio_sample path: /01_switch_inter.py
#
# 01_switch_inter... | code_fim | medium | {
"lang": "python",
"repo": "kioto/raspi_gpio_sample",
"path": "/01_switch_inter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_quadrant(self):
'''Returns the quadrant of a cell.'''
cell = self.generic_name.lower()
if cell == 'ab' or cell == 'cd':
return ''
elif 'da' in cell:
return 'D'
elif 'a' in cell:
return 'A'
elif 'b' in cell:
... | code_fim | hard | {
"lang": "python",
"repo": "bruvellu/simi.py",
"path": "/simi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bruvellu/simi.py path: /simi.py
# import pdb; pdb.set_trace()
# Define parent cell.
if has_parent:
cell.parent = parent_cell
cell.parent.daughters.append(cell)
else:
... | code_fim | hard | {
"lang": "python",
"repo": "bruvellu/simi.py",
"path": "/simi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bruvellu/simi.py path: /simi.py
cells.keys():
# TODO Sometimes this fails. The generation birth is not correct. See 4CA cell and its false 3d1 parent in embryo wt2.
# Get common parent of sibling cells.
common_par... | code_fim | hard | {
"lang": "python",
"repo": "bruvellu/simi.py",
"path": "/simi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ScalABLE40/scxml_interpreter path: /src/scxml_interpreter/dummy_states.py
#!/usr/bin/env python
import rospy
import smach
class dummy_print(smach.State):
def __init__(self, outcomes=["succeeded"], io_keys=["print_text"]):
smach.State.__init__(self, outcomes, io_keys=io_keys)
d... | code_fim | hard | {
"lang": "python",
"repo": "ScalABLE40/scxml_interpreter",
"path": "/src/scxml_interpreter/dummy_states.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def execute(self, ud):
rospy.sleep(1.0)
if not(ud.outcome):
rospy.loginfo("My outcome is not defined. I will move to out0 !")
return "out0"
if(ud.outcome == "out1"):
rospy.loginfo("My outcome is defined to %s" % (str(ud.outcome)))
... | code_fim | medium | {
"lang": "python",
"repo": "ScalABLE40/scxml_interpreter",
"path": "/src/scxml_interpreter/dummy_states.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(ud._ud)
if ud.print_text == '':
text_ = "Hello World ! I'm a dummy printing state"
else:
text_ = ud.print_text
rospy.loginfo(text_)
rospy.sleep(1.0)
return "succeeded"
class dummy_outcome(smach.State):
def __init__(self, o... | code_fim | medium | {
"lang": "python",
"repo": "ScalABLE40/scxml_interpreter",
"path": "/src/scxml_interpreter/dummy_states.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: apple/coremltools path: /coremltools/converters/mil/frontend/torch/test/test_custom_ops.py
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/B... | code_fim | hard | {
"lang": "python",
"repo": "apple/coremltools",
"path": "/coremltools/converters/mil/frontend/torch/test/test_custom_ops.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, x, y):
x = torch.sparse.mm(x, y)
return x
model = TestLayer()
input_data_x = torch.ones(input_shape)
input_data_y = torch.ones(input_shape)
input_data = [input_data_x, input_data_y]
model.eval()
... | code_fim | hard | {
"lang": "python",
"repo": "apple/coremltools",
"path": "/coremltools/converters/mil/frontend/torch/test/test_custom_ops.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: winkidney/PickTrue path: /src/picktrue/rpc/taskserver.py
import json
import logging
from threading import Thread
from flask import Flask, jsonify
from flask import request
from picktrue.rpc.channel import BrowserRequester
app = Flask(__name__)
__all__ = [
"server",
]
class TaskServer:
... | code_fim | hard | {
"lang": "python",
"repo": "winkidney/PickTrue",
"path": "/src/picktrue/rpc/taskserver.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def request(self, url):
return self.requester.send_and_wait(url)
def log_received(self):
while True:
resp = self.request("https://www.artstation.com/users/braveking/projects.json?page=1")
print("resp received", resp)
def start_debug_task(self):
... | code_fim | hard | {
"lang": "python",
"repo": "winkidney/PickTrue",
"path": "/src/picktrue/rpc/taskserver.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adieu/django-mediagenerator path: /mediagenerator/api.py
from . import settings, utils
from .settings import (GENERATED_MEDIA_DIR, GENERATED_MEDIA_NAMES_FILE,
MEDIA_GENERATORS)
from .utils import load_backend
from django.utils.http import urlquote
import os
import shutil
d... | code_fim | medium | {
"lang": "python",
"repo": "adieu/django-mediagenerator",
"path": "/mediagenerator/api.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Generate a module with media file name mappings
fp = open(GENERATED_MEDIA_NAMES_FILE, 'w')
fp.write('NAMES = %r' % utils.NAMES)
fp.close()<|fim_prefix|># repo: adieu/django-mediagenerator path: /mediagenerator/api.py
from . import settings, utils
from .settings import (GENERATED_MEDIA_D... | code_fim | hard | {
"lang": "python",
"repo": "adieu/django-mediagenerator",
"path": "/mediagenerator/api.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> optimizer = tf.train.AdamOptimizer(0.001)
train_op = optimizer.minimize(loss, global_step=tf.train.get_global_step())
return tf.estimator.EstimatorSpec(mode, loss=loss, train_op=train_op)<|fim_prefix|># repo: Davidnet/CarND-Traffic-Sign-Classifier-Project path: /traffic_sign_classifier/germa... | code_fim | hard | {
"lang": "python",
"repo": "Davidnet/CarND-Traffic-Sign-Classifier-Project",
"path": "/traffic_sign_classifier/german_traffic_main_convnet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Davidnet/CarND-Traffic-Sign-Classifier-Project path: /traffic_sign_classifier/german_traffic_main_convnet.py
import pickle
import tensorflow as tf
def model_fn(features, labels, mode):
# tf.keras.layers.InputLayer(input_shape=[32, 32, 3])(features)
net = tf.keras.layers.Conv2D(16, [3,3],... | code_fim | hard | {
"lang": "python",
"repo": "Davidnet/CarND-Traffic-Sign-Classifier-Project",
"path": "/traffic_sign_classifier/german_traffic_main_convnet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> predicted_classes = tf.argmax(net, 1)
if mode == tf.estimator.ModeKeys.PREDICT:
predictions = {
'class_ids': predicted_classes[:, tf.newaxis],
'probabilities': tf.nn.softmax(net),
'logits': net,
}
return tf.estimator.EstimatorSpec(mode, ... | code_fim | hard | {
"lang": "python",
"repo": "Davidnet/CarND-Traffic-Sign-Classifier-Project",
"path": "/traffic_sign_classifier/german_traffic_main_convnet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: darkless456/Python path: /match_dna.py
# match_dna.py
def match_dna(query, sequence):
<|fim_suffix|>mydna = 'gaaacctta'
myquery = 'aacc'
if match_dna(myquery, mydna):
print('Yay it matches')
else:
print("No it doesn't match")
# 匹配字符串 返回逻辑值<|fim_middle|> if query in sequence:
... | code_fim | medium | {
"lang": "python",
"repo": "darkless456/Python",
"path": "/match_dna.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: darkless456/Python path: /match_dna.py
# match_dna.py
def match_dna(query, sequence):
if query in sequence:
return True
else:
return False
<|fim_suffix|>if match_dna(myquery, mydna):
print('Yay it matches')
else:
print("No it doesn't match")
# 匹配字符串 返回逻辑值<|fim_m... | code_fim | easy | {
"lang": "python",
"repo": "darkless456/Python",
"path": "/match_dna.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>mydna = 'gaaacctta'
myquery = 'aacc'
if match_dna(myquery, mydna):
print('Yay it matches')
else:
print("No it doesn't match")
# 匹配字符串 返回逻辑值<|fim_prefix|># repo: darkless456/Python path: /match_dna.py
# match_dna.py
def match_dna(query, sequence):
<|fim_middle|> if query in sequence:
... | code_fim | medium | {
"lang": "python",
"repo": "darkless456/Python",
"path": "/match_dna.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pred_label = np.sign(pred_val)
pred_label[pred_label == 0] = 1
return pred_label
@staticmethod
def _loss(pred_val: np.ndarray, true_label: np.ndarray) -> float:
loss = -float(np.sum(pred_val * true_label)) / true_label.shape[0]
return loss
def _grad(se... | code_fim | hard | {
"lang": "python",
"repo": "Riroaki/LemonML",
"path": "/supervised/linear/_perceptron.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Riroaki/LemonML path: /supervised/linear/_perceptron.py
import numpy as np
from ._base import LinearModel
from utils import batch
class Perceptron(LinearModel):
"""Perceptron model, binary classifier."""
def __init__(self):
super().__init__()
def fit(self, x: np.ndarray, l... | code_fim | hard | {
"lang": "python",
"repo": "Riroaki/LemonML",
"path": "/supervised/linear/_perceptron.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _grad(self, x: np.ndarray, pred_label: np.ndarray,
true_label: np.ndarray) -> tuple:
grad_w = -(true_label.reshape((-1, 1)) * x)[pred_label != true_label]
grad_b = -true_label[pred_label != true_label]
grad_w = grad_w.sum(axis=0) / x.shape[0]
grad_b = ... | code_fim | hard | {
"lang": "python",
"repo": "Riroaki/LemonML",
"path": "/supervised/linear/_perceptron.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pavloivanets/mk-post-deployment-checks path: /mk_verificator/tests/system/packet_checker.py
#!/usr/bin/env python
import salt.client as client
import texttable as tt
local = client.LocalClient()
pkgs_info = local.cmd('*', 'lowpkg.list_pkgs')
nodes = pkgs_info.keys()
mask_minor_pkgs = []
group... | code_fim | hard | {
"lang": "python",
"repo": "pavloivanets/mk-post-deployment-checks",
"path": "/mk_verificator/tests/system/packet_checker.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> missed_packets, version_conflicts = [], []
for pkg_name in node_i_pkgs:
if pkg_name in packets_to_skip:
continue
if pkg_name in node_j_pkgs:
i_packet_version = node_i_pkgs[pkg_name]
... | code_fim | hard | {
"lang": "python",
"repo": "pavloivanets/mk-post-deployment-checks",
"path": "/mk_verificator/tests/system/packet_checker.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> node_i_name, node_j_name = node_i[0], node_j[0]
node_i_pkgs, node_j_pkgs = node_i[1], node_j[1]
missed_packets, version_conflicts = [], []
for pkg_name in node_i_pkgs:
if pkg_name in packets_to_skip:
... | code_fim | hard | {
"lang": "python",
"repo": "pavloivanets/mk-post-deployment-checks",
"path": "/mk_verificator/tests/system/packet_checker.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: polysimtools/pysimm path: /pysimm/calc.py
# ******************************************************************************
# pysimm.calc module
# ******************************************************************************
#
# ********************************************************************... | code_fim | hard | {
"lang": "python",
"repo": "polysimtools/pysimm",
"path": "/pysimm/calc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 4 * pt.epsilon * (pow(pt.sigma / d, 12) - pow(pt.sigma / d, 6))
def LJ_9_6(pt, d):
return pt.epsilon * (2 * pow(pt.sigma / d, 12) - 3 * pow(pt.sigma / d, 6))
def buckingham(pt, d):
return pt.a * np.exp(-d / pt.rho) - (pt.c / pow(d, 6))
def harmonic_bond(bt, d):
return bt.k * p... | code_fim | hard | {
"lang": "python",
"repo": "polysimtools/pysimm",
"path": "/pysimm/calc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if offset is None:
error_print('offset for tags in each monomer is required, i.e. - number of particles in each monomer')
if unwrap:
s.unwrap()
a_ = [s.particles[i] for i in range(a_tag, s.particles.count, offset)]
b_ = [s.particles[i] for i in range(b_tag, s.particles.co... | code_fim | hard | {
"lang": "python",
"repo": "polysimtools/pysimm",
"path": "/pysimm/calc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: olgaiv39/3davatars path: /data_prepare/detect_3D_landmark.py
import cv2, os, importlib, math
import os.path as osp
import numpy as np
import scipy.io as scio
import tensorflow as tf
from numpy.linalg import inv, norm, lstsq
from numpy.linalg import matrix_rank as rank
from data_prepare_utils impo... | code_fim | hard | {
"lang": "python",
"repo": "olgaiv39/3davatars",
"path": "/data_prepare/detect_3D_landmark.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> count = 0
for img_name in names_list:
mtcnn_infor = scio.loadmat(
os.path.join(mtcnn_dir, img_name[:-4] + ".mat")
)
img = cv2.imread(os.path.join(origin_images_dir, img_name))
batch_imgs = [img]
... | code_fim | hard | {
"lang": "python",
"repo": "olgaiv39/3davatars",
"path": "/data_prepare/detect_3D_landmark.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return_lms = []
for img_index in range(len(batch_bboxes)):
img = batch_imgs[img_index]
# concat warped faces
batch_faces = []
trans_invs = []
for face_index in range(len(bat... | code_fim | hard | {
"lang": "python",
"repo": "olgaiv39/3davatars",
"path": "/data_prepare/detect_3D_landmark.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># product name (sentinel-2 data)
platformFilter = "platformname:Sentinel-2"
#print(baseURL)
#print(timeCriteria)
#print("working directory is " + os.getcwd())<|fim_prefix|># repo: enrjon/sentinelGet path: /sentinelGet.py
import os
import requests
import configparser
import HTTPDigestAuth
# directories
... | code_fim | hard | {
"lang": "python",
"repo": "enrjon/sentinelGet",
"path": "/sentinelGet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: enrjon/sentinelGet path: /sentinelGet.py
import os
import requests
import configparser
import HTTPDigestAuth
# directories
workingDir = "sentinelGet"
rawDir = "raw"
tiffDir = "tiff"
os.chdir(workingDir)
<|fim_suffix|>#inital request to verify credentials
from requests.auth import HTTPBasicAuth... | code_fim | hard | {
"lang": "python",
"repo": "enrjon/sentinelGet",
"path": "/sentinelGet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Magnusnolsoe/xlnet-proteins path: /test_gpu.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import tensorboard_utils as tb
import os
import numpy as np
import math
from absl import flags
import absl.logging ... | code_fim | hard | {
"lang": "python",
"repo": "Magnusnolsoe/xlnet-proteins",
"path": "/test_gpu.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #### Get loss from inputs
total_loss, new_mems = function_builder.get_loss(
FLAGS, features, labels, mems, False)
#### Check model parameters
num_params = sum([np.prod(v.shape) for v in tf.trainable_variables()])
tf.logging.info('#params: {}'.format(num_params))
# GPU
... | code_fim | hard | {
"lang": "python",
"repo": "Magnusnolsoe/xlnet-proteins",
"path": "/test_gpu.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def create_mems_tf(bsz_per_core):
mems = [tf.placeholder(dtype=tf.float32,
shape=[FLAGS.mem_len, bsz_per_core, FLAGS.d_model])
for layer in range(FLAGS.n_layer)]
return mems
def initialize_mems_np(bsz_per_core):
mems_np = [np.zeros(shape=[FLAGS.mem_len, bsz_per... | code_fim | hard | {
"lang": "python",
"repo": "Magnusnolsoe/xlnet-proteins",
"path": "/test_gpu.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: basilfx/Photod path: /photod-backend/photod/web/urls.py
from django.conf.urls import url
from photod.web.views import index, login, logout, media, thumbnail, \
filmstrip, share
<|fim_suffix|> url(r'^$', index),
url(r'^(?:.*)/?$', index),
]<|fim_middle|>
urlpatterns = [
url(r'^med... | code_fim | hard | {
"lang": "python",
"repo": "basilfx/Photod",
"path": "/photod-backend/photod/web/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> url(r'^$', index),
url(r'^(?:.*)/?$', index),
]<|fim_prefix|># repo: basilfx/Photod path: /photod-backend/photod/web/urls.py
from django.conf.urls import url
from photod.web.views import index, login, logout, media, thumbnail, \
filmstrip, share
<|fim_middle|>urlpatterns = [
url(r'^med... | code_fim | hard | {
"lang": "python",
"repo": "basilfx/Photod",
"path": "/photod-backend/photod/web/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> yaml = YAML(typ='safe')
yaml.indent(mapping=2, sequence=4, offset=2)
root_dir = Path(__cfg_root__)
root_dir.mkdir(parents=True, exist_ok=True)
user_cfg_file = root_dir / 'conf.yml'
if force:
rmtree(str(root_dir))
# copy default conf.yml to ~/.xenonpy
if not user_c... | code_fim | hard | {
"lang": "python",
"repo": "yoshida-lab/XenonPy",
"path": "/xenonpy/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if force:
rmtree(str(root_dir))
# copy default conf.yml to ~/.xenonpy
if not user_cfg_file.exists() or force:
copyfile(str(Path(__file__).parent / 'conf.yml'), str(user_cfg_file))
else:
user_cfg = yaml.load(user_cfg_file)
if 'version' not in user_cfg or use... | code_fim | hard | {
"lang": "python",
"repo": "yoshida-lab/XenonPy",
"path": "/xenonpy/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yoshida-lab/XenonPy path: /xenonpy/__init__.py
# Copyright (c) 2021. yoshida-lab. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# change version in there, conf.yml, setup.py
from ._conf import *
def __init(force=F... | code_fim | medium | {
"lang": "python",
"repo": "yoshida-lab/XenonPy",
"path": "/xenonpy/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>config_file = '/Users/amit/hg/webapp/bin/err/config.utk.dev2.json'
conf = json.load(open(config_file))
bp = basepair.connect(conf, verbose=True)
bp.update_project(2, {'name': 'proj 4'})<|fim_prefix|># repo: basepair/basepair-python path: /tests/update-project.py
#!/usr/bin/env python
import json
<|fim... | code_fim | easy | {
"lang": "python",
"repo": "basepair/basepair-python",
"path": "/tests/update-project.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: basepair/basepair-python path: /tests/update-project.py
#!/usr/bin/env python
import json
<|fim_suffix|>bp.update_project(2, {'name': 'proj 4'})<|fim_middle|>import basepair
config_file = '/Users/amit/hg/webapp/bin/err/config.utk.dev2.json'
conf = json.load(open(config_file))
bp = basepair.con... | code_fim | medium | {
"lang": "python",
"repo": "basepair/basepair-python",
"path": "/tests/update-project.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Calvibert/machine-learning-exercises path: /src/pandas/pandas_exercises.py
import pandas as pd
data = pd.read_csv('Salaries.csv')
#average
print(data['BasePay'].sum() / data['BasePay'].count())
<|fim_suffix|>#How much does JOSEPH DRISCOLL make (including benefits)?
print(data[data['EmployeeNam... | code_fim | medium | {
"lang": "python",
"repo": "Calvibert/machine-learning-exercises",
"path": "/src/pandas/pandas_exercises.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># What was the average (mean) BasePay of all employees per year? (2011-2014) ?
avgBasePay = data['BasePay'].mean()
print(avgBasePay)<|fim_prefix|># repo: Calvibert/machine-learning-exercises path: /src/pandas/pandas_exercises.py
import pandas as pd
data = pd.read_csv('Salaries.csv')
#average
print(data... | code_fim | medium | {
"lang": "python",
"repo": "Calvibert/machine-learning-exercises",
"path": "/src/pandas/pandas_exercises.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#How much does JOSEPH DRISCOLL make (including benefits)?
print(data[data['EmployeeName'] == 'JOSEPH DRISCOLL'])
print(data[data['EmployeeName'] == 'JOSEPH DRISCOLL']['TotalPayBenefits'])
#What is the name of highest paid person (including benefits)?
max = data['TotalPayBenefits'].max()
print(data[data['... | code_fim | medium | {
"lang": "python",
"repo": "Calvibert/machine-learning-exercises",
"path": "/src/pandas/pandas_exercises.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Informasjonsforvaltning/altinn-model-publisher path: /src/altinn_model_publisher/organizations/shortname_orgs.py
",
"orgnr": "944439838"
},
"ha": {
"name": "H\u00e5 kommune",
"orgnr": "964969590"
},
"ibestad": {
"name": "Ibestad kommune",
"orgnr": "959469792"
},
"i... | code_fim | hard | {
"lang": "python",
"repo": "Informasjonsforvaltning/altinn-model-publisher",
"path": "/src/altinn_model_publisher/organizations/shortname_orgs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>lv kommune",
"orgnr": "972418005"
},
"namdalseid": {
"name": "Namdalseid kommune",
"orgnr": "940015456"
},
"namsos": {
"name": "Namsos kommune",
"orgnr": "942875967"
},
"nannestad": {
"name": "Nannestad kommune",
"orgnr": "964950202"
},
"narvik": {
"name": "... | code_fim | hard | {
"lang": "python",
"repo": "Informasjonsforvaltning/altinn-model-publisher",
"path": "/src/altinn_model_publisher/organizations/shortname_orgs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>assword==pass2:
import Content2
if usertype==user3 and password==pass3:
import Content3
if usertype==user4 and password==pass4:
import Content4
else:
print("WRONG PASSWORD OR USER. GET OUT!!!!")<|fim_prefix|># repo: Dfmaaa/transferfile path: /Python31/TSMA.py
print("Hello, this is t... | code_fim | hard | {
"lang": "python",
"repo": "Dfmaaa/transferfile",
"path": "/Python31/TSMA.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dfmaaa/transferfile path: /Python31/TSMA.py
print("Hello, this is the TSMA(Test Social Media App")
print("Options:")
print("Type login to view your content.")
print("Type users to see all the users.")
user1=("Sameer Achhab")
user2=("Fariya Achhab")
user<|fim_suffix|>,',',user2,',',user3,','... | code_fim | hard | {
"lang": "python",
"repo": "Dfmaaa/transferfile",
"path": "/Python31/TSMA.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>task.execute()
task.download()
task.delete_current_task()<|fim_prefix|># repo: rocketbot-cl/PDF2XLSX path: /libs/pylovepdf/samples/compress_alternative.py
from pylovepdf.ilovepdf import ILovePdf
<|fim_middle|>ilovepdf = ILovePdf('public_key', verify_ssl=True)
task = ilovepdf.new_task('compress')
task.ad... | code_fim | hard | {
"lang": "python",
"repo": "rocketbot-cl/PDF2XLSX",
"path": "/libs/pylovepdf/samples/compress_alternative.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rocketbot-cl/PDF2XLSX path: /libs/pylovepdf/samples/compress_alternative.py
from pylovepdf.ilovepdf import ILovePdf
<|fim_suffix|>task.execute()
task.download()
task.delete_current_task()<|fim_middle|>ilovepdf = ILovePdf('public_key', verify_ssl=True)
task = ilovepdf.new_task('compress')
task.ad... | code_fim | hard | {
"lang": "python",
"repo": "rocketbot-cl/PDF2XLSX",
"path": "/libs/pylovepdf/samples/compress_alternative.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sun-peach/x-vector-kaldi-tf path: /local/tf/tf_block.py
import tensorflow as tf
from tensorflow.python.framework import ops
def __get_variable(name, shape, initializer, trainable=True):
return tf.get_variable(name, shape, initializer=initializer, dtype=tf.float32, trainable=trainable)
def... | code_fim | hard | {
"lang": "python",
"repo": "sun-peach/x-vector-kaldi-tf",
"path": "/local/tf/tf_block.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.