text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: tcolb/proj4-brevets path: /brevets/acp_times.py
"""
Open and close time calculations
for ACP-sanctioned brevets
following rules described at https://rusa.org/octime_alg.html
and https://rusa.org/pages/rulesForRiders
"""
import arrow
import math
# Note for CIS 322 Fall 2016:
# You MUST provide ... | code_fim | hard | {
"lang": "python",
"repo": "tcolb/proj4-brevets",
"path": "/brevets/acp_times.py",
"mode": "psm",
"license": "Artistic-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: steven-j-wren/PISA-Analysis path: /sample_checks/plot_total_resolution.py
import os, sys, math, pickle, numpy, matplotlib, glob
numpy.set_printoptions(threshold=numpy.nan)
matplotlib.use('Agg')
from matplotlib import pyplot
pyplot.rcParams['text.usetex'] = True
def do_total_resolution_plot(all... | code_fim | hard | {
"lang": "python",
"repo": "steven-j-wren/PISA-Analysis",
"path": "/sample_checks/plot_total_resolution.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pyplot.grid()
pyplot.xscale("log")
pyplot.xlabel("Truth Energy (GeV)")
pyplot.ylabel(ylabel)
pyplot.ylim(0.0,1.1*ymax)
pyplot.subplots_adjust(bottom=0.12,top=0.8)
pyplot.title(title,size='x-large',x=0.5,y=1.20)
pyplot.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
... | code_fim | hard | {
"lang": "python",
"repo": "steven-j-wren/PISA-Analysis",
"path": "/sample_checks/plot_total_resolution.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> evals = numpy.logspace(0,3,21)
print 'Doing %s total energy resolution plot'%(selection)
do_total_resolution_plot(all_truth_data = energy[selection],
all_reco_data = reco_energy[selection],
all_weights = osc_weight[... | code_fim | hard | {
"lang": "python",
"repo": "steven-j-wren/PISA-Analysis",
"path": "/sample_checks/plot_total_resolution.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kirillgrebenyuk/metall_invest_dashboard path: /AppProject/navbar.py
from dash.dependencies import Input, Output, State
import dash_html_components as html
import dash_core_components as dcc
import dash_bootstrap_components as dbc
METALLINVEST_LOGO = "https://www.metalloinvest.com/_v/_i/152.png"... | code_fim | hard | {
"lang": "python",
"repo": "kirillgrebenyuk/metall_invest_dashboard",
"path": "/AppProject/navbar.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> sidebar = html.Div(
[
#html.H2("Sidebar", className="display-4"),
#html.Hr(),
#html.P(
# "A simple sidebar layout with navigation links", className="lead"
#),
dbc.Nav(
[
dbc.NavLink("... | code_fim | hard | {
"lang": "python",
"repo": "kirillgrebenyuk/metall_invest_dashboard",
"path": "/AppProject/navbar.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>Guaranteed constraints:
0 ≤ tree size ≤ 6 · 104,
-1000 ≤ node value ≤ 1000.
[input] tree.integer t2
Another binary tree of integers.
Guaranteed constraints:
0 ≤ tree size ≤ 6 · 104,
-1000 ≤ node value ≤ 1000.
[output] boolean
Return true if t2 is a subtree of t1, otherwise return false.
''''
#
# Def... | code_fim | hard | {
"lang": "python",
"repo": "netor27/codefights-solutions",
"path": "/interviewPractice/python/04_trees/05_isSubtree.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>t2 = {
"value": 10,
"left": {
"value": 4,
"left": {
"value": 1,
"left": null,
"right": null
},
"right": {
"value": 2,
"left": null,
"right": null
}
},
"right": {
"value":... | code_fim | hard | {
"lang": "python",
"repo": "netor27/codefights-solutions",
"path": "/interviewPractice/python/04_trees/05_isSubtree.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: netor27/codefights-solutions path: /interviewPractice/python/04_trees/05_isSubtree.py
''''
Given two binary trees t1 and t2, determine whether the second tree is a subtree of the first tree. A subtree for vertex v in a binary tree t is a tree consisting of v and all its descendants in t. Determin... | code_fim | hard | {
"lang": "python",
"repo": "netor27/codefights-solutions",
"path": "/interviewPractice/python/04_trees/05_isSubtree.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
plt.figure(2)
# plt.errorbar(costs, [row[1] for row in logit_unshuff_train_metrics], yerr=[row[1] for row in logit_unshuff_train_variances], color='r', ecolor='k', label="Unshuffled - train")
plt.errorbar(costs, [row[1] for row in logit_shuff_train_metrics], yerr=[row[1] for row in logit_shuff_train_vari... | code_fim | hard | {
"lang": "python",
"repo": "boconne3/NLPSteamReviews",
"path": "/final_ass.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> logit_train_metrics = [np.mean([row[0] for row in temp_train_metrics]), np.mean([row[1] for row in temp_train_metrics])]
logit_test_metrics = [np.mean([row[0] for row in temp_test_metrics]), np.mean([row[1] for row in temp_test_metrics])]
logit_train_variance = [np.var([row[0] for ... | code_fim | hard | {
"lang": "python",
"repo": "boconne3/NLPSteamReviews",
"path": "/final_ass.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: boconne3/NLPSteamReviews path: /final_ass.py
return tp, tn, fp, fn
def accuracy_calc(conf_tuple):
tp = conf_tuple[0]
tn = conf_tuple[1]
fp = conf_tuple[2]
fn = conf_tuple[3]
return (tp+tn)/(tp+tn+fp+fn)
def calc_shuffle_order(length):
shuffle_order = np.arange(length)
... | code_fim | hard | {
"lang": "python",
"repo": "boconne3/NLPSteamReviews",
"path": "/final_ass.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if in53 == "yes":
in54 = str(
input("Set in future or present day ? type future or present"))
if in54 == "now":
print("Shooter")
else:
... | code_fim | hard | {
"lang": "python",
"repo": "narender2999/Netflic-movie-suggetions",
"path": "/movie-tv suggetion netflix.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: narender2999/Netflic-movie-suggetions path: /movie-tv suggetion netflix.py
print("The Lorax")
else:
in5 = str(input("are the kiids frightend easily? yes/y or no/n"))
if in5 == "yes":
print("Rango")
else:
in6... | code_fim | hard | {
"lang": "python",
"repo": "narender2999/Netflic-movie-suggetions",
"path": "/movie-tv suggetion netflix.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: narender2999/Netflic-movie-suggetions path: /movie-tv suggetion netflix.py
f in14 == "yes":
print("Breaking Bad")
else:
in15 = str(
input("focus on gud guys or bad guys? type gud or bad... | code_fim | hard | {
"lang": "python",
"repo": "narender2999/Netflic-movie-suggetions",
"path": "/movie-tv suggetion netflix.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skbharti/Chit-Chat path: /extras/client_helper.py
import socket
import json
msg_token = '<m>'
<|fim_suffix|> message = {}
message['Token'] = msg_token
data = {}
data['SenderID'] = senderid
data['ReceiverID'] = receiverid
data['Message'] = msg
message['Data'] = data
msg_json =... | code_fim | medium | {
"lang": "python",
"repo": "skbharti/Chit-Chat",
"path": "/extras/client_helper.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> message = {}
message['Token'] = msg_token
data = {}
data['SenderID'] = senderid
data['ReceiverID'] = receiverid
data['Message'] = msg
message['Data'] = data
msg_json = json.dumps(message)
client_socket.send(msg_json.encode())<|fim_prefix|># repo: skbharti/Chit-Chat path: /extras/client_h... | code_fim | medium | {
"lang": "python",
"repo": "skbharti/Chit-Chat",
"path": "/extras/client_helper.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ee_mac.h',
'ipc/service/ca_layer_partial_damage_tree_mac.mm',
'ipc/service/ca_layer_tree_mac.h',
'ipc/service/ca_layer_tree_mac.mm',
'ipc/service/gpu_memory_buffer_factory_io_surface.cc',
'ipc/service/gpu_memory_buffer_factory_io_surface.h',
'ipc/service/ima... | code_fim | hard | {
"lang": "python",
"repo": "dummas2008/chromium",
"path": "/src/gpu/gpu_ipc_service.gypi",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dummas2008/chromium path: /src/gpu/gpu_ipc_service.gypi
# Copyright (c) 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'dependencies': [
'../base/base.gyp:base',
'../ipc/ipc.gyp:ipc... | code_fim | hard | {
"lang": "python",
"repo": "dummas2008/chromium",
"path": "/src/gpu/gpu_ipc_service.gypi",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bennofs/cscg20 path: /crypto2/solve.py
#!/usr/bin/env python3
from sage.all import *
from Crypto.Util.number import long_to_bytes
from Crypto.PublicKey import RSA
message = 621363947731259814514660628559741309475602891646020999492637656268572159753235499452741126103507031337156599617909690161866... | code_fim | hard | {
"lang": "python",
"repo": "bennofs/cscg20",
"path": "/crypto2/solve.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>41488594780860400420776664995973439686986538967952922269183014996803258574382869102287844486447643771783747439478831567060
pubkey = RSA.importKey("""
-----BEGIN PUBLIC KEY-----
MIIBITANBgkqhkiG9w0BAQEFAAOCAQ4AMIIBCQKCAQBXyI8cm57UfYRPh7KfRHlu
F85Hwv4kzBq340QyszUhJGPSOZ0HRxGABXLqaBLikBICvF8ZDMtJZtVwkEpBaXpj... | code_fim | hard | {
"lang": "python",
"repo": "bennofs/cscg20",
"path": "/crypto2/solve.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>Y.sort()
var_series = pd.DataFrame(data={'$Y_i$': Y})
print(var_series.T)
emp_dist_func = ECDF(Y)
print(emp_dist_func.y)
f_y = []
x_theor = np.linspace(0, 7, n)
for xi in x_theor:
f_y.append(pow(xi, 2/3) / 8) # теоретическая функция распределения
plt.plot(x_theor, f_y, label='Theoretical... | code_fim | medium | {
"lang": "python",
"repo": "SamaritaninS/TWIMS",
"path": "/lab3_2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SamaritaninS/TWIMS path: /lab3_2.py
from numpy import random
from collections import Counter
import matplotlib.pyplot as plt
import math
import pandas as pd
import scipy.stats as sts
from statsmodels.distributions.empirical_distribution import ECDF
import numpy as np
<|fim_suffix|>for i... | code_fim | medium | {
"lang": "python",
"repo": "SamaritaninS/TWIMS",
"path": "/lab3_2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print([k+'='+v for k,v in d.items()])
L = ['HEllo','World','IBM','APPLE']
print([s.lower() for s in L])
L1 = ['Hello','World',18,'Apple',None]
L2 = []
for l in L1:
if isinstance(l, str):
L2.append(l.lower())
else:
continue
print(L2)
# 使用列表生成式简洁太多了,厉害!
print([l.lower() for l in L... | code_fim | medium | {
"lang": "python",
"repo": "Philex5/Python-Learn",
"path": "/Python-learn/3.Advanced_Features/列表生成式.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Philex5/Python-Learn path: /Python-learn/3.Advanced_Features/列表生成式.py
# List Comprehensions
import os
print(list(range(1,11)))
print([x*x for x in range(1, 11)])
print([x*x for x in range(1, 20) if x % 2 == 0])
print([m+n for m in 'ABC' for n in 'XYZ'])
print([d for d in os.listdir('/home/phil... | code_fim | hard | {
"lang": "python",
"repo": "Philex5/Python-Learn",
"path": "/Python-learn/3.Advanced_Features/列表生成式.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> result.append(api_path + '/' + func_name + ',' + usage_name)
return result
def main(path: str):
# 遍历目录下所有文件
file_list = []
g = os.walk(path, topdown=False)
for root, dir_names, file_names in g:
for f in file_names:
file_list.append(os.path.join(roo... | code_fim | hard | {
"lang": "python",
"repo": "realjac/PythonUtils",
"path": "/getApiWithName.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def find_file_content(file_path: str) -> list:
"""查找文件内容,获取api接口"""
# 文件路径转换为api路径
try:
api_path = re.match(r'^.*controller[s]?(/[\w|/]+)_controller.*', file_path).group(1)
except:
raise AssertionError(f'不是controller文件:{file_path}')
with open(file_path) as f:
... | code_fim | hard | {
"lang": "python",
"repo": "realjac/PythonUtils",
"path": "/getApiWithName.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: realjac/PythonUtils path: /getApiWithName.py
import getopt
import os
import re
import sys
def parse_args():
"""
命令行参数解析
"""
path = ''
try:
opts, args = getopt.getopt(sys.argv[1:], "hp:", ["help", "path="])
except getopt.GetoptError:
print(f"Usage: ... | code_fim | hard | {
"lang": "python",
"repo": "realjac/PythonUtils",
"path": "/getApiWithName.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jatingarg0908/DragonsVsTerminators path: /characters/dragons/scary_thrower.py
from .thrower_dragon import ThrowerDragon
from utils import apply_effect, make_scare
class ScaryThrower(ThrowerDragon):
<|fim_suffix|> # BEGIN 4.4
"*** YOUR CODE HERE ***"
if target.ho_gya==0:
... | code_fim | hard | {
"lang": "python",
"repo": "jatingarg0908/DragonsVsTerminators",
"path": "/characters/dragons/scary_thrower.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def throw_at(self, target):
# BEGIN 4.4
"*** YOUR CODE HERE ***"
if target.ho_gya==0:
apply_effect(make_scare,target,2)
target.ho_gya=1
else:
super().throw_at(target)
# END 4.4<|fim_prefix|># repo: jatingarg0908/DragonsVsTerminat... | code_fim | hard | {
"lang": "python",
"repo": "jatingarg0908/DragonsVsTerminators",
"path": "/characters/dragons/scary_thrower.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for LearnerType in learners:
learner = LearnerType(data, use_gpu)
algorithm_name = learner.name() + '-' + device_type
print('Started to train ' + algorithm_name)
for params in ParameterGrid(params_grid):
print(params)
... | code_fim | hard | {
"lang": "python",
"repo": "xjzhou/catboost",
"path": "/catboost/benchmarks/speed_benchmarks/experiments.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for params in ParameterGrid(params_grid):
print(params)
log_dirname = os.path.join(out_dir, self.name, algorithm_name)
try:
elapsed = learner.run(params, log_dirname)
print('Timing: ' + str(elapsed) + ' se... | code_fim | hard | {
"lang": "python",
"repo": "xjzhou/catboost",
"path": "/catboost/benchmarks/speed_benchmarks/experiments.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xjzhou/catboost path: /catboost/benchmarks/speed_benchmarks/experiments.py
import os
import numpy as np
from sklearn.model_selection import train_test_split, ParameterGrid
import dataset_loader.datasets as data_loader
class Data:
def __init__(self, X, y, name, task, metric, train_size=0.8... | code_fim | hard | {
"lang": "python",
"repo": "xjzhou/catboost",
"path": "/catboost/benchmarks/speed_benchmarks/experiments.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Saves the image to the supplied filename, which must end in .ps or .eps"""
global _canvas
if _canvas == None:
raise RuntimeError("Canvas is not open yet.")
else:
_canvas.saveToFile(filename)
def wait_for_click():
"""This function just waits until the canvas ... | code_fim | hard | {
"lang": "python",
"repo": "williamfu24/CS141-CSI-",
"path": "/Comp Sci 141/Python Programs/Angry Birds/simplegraphics.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: williamfu24/CS141-CSI- path: /Comp Sci 141/Python Programs/Angry Birds/simplegraphics.py
from cs1graphics import *
_canvas = None
_current_color = "black"
_current_line_thickness = 1
_cue = None
def open_canvas(width, height):
"""Creates a window for painting of a given width and he... | code_fim | hard | {
"lang": "python",
"repo": "williamfu24/CS141-CSI-",
"path": "/Comp Sci 141/Python Programs/Angry Birds/simplegraphics.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pmspraju/Bioinformatics path: /Project 2/Docs/Merge_Sanger_v2.py
#usage: python3.7 Merging_sequencing.py 000F.seq 001F.seq 002R.seq 003R.seq
"""
This script is used to merge multiple sucessive sanger DNA sequencing results.
The file names of the sequences to be merged starts with '000' plus 'F' ... | code_fim | hard | {
"lang": "python",
"repo": "pmspraju/Bioinformatics",
"path": "/Project 2/Docs/Merge_Sanger_v2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> aligment_a_squence_line_str_split = aligment_a_squence_line_str.split()
print(aligment_a_squence_line_str_split[0].ljust(5,' '),\
aligment_a_squence_line_str_split[1],\
aligment_a_squence_line_str_split[2].rjust(6,' '),\
sep="")... | code_fim | hard | {
"lang": "python",
"repo": "pmspraju/Bioinformatics",
"path": "/Project 2/Docs/Merge_Sanger_v2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
for i in range(len(dir_new)):
f = open(dir_new[i])
file_sequence = f.read()
f.close()
DNA_sequence_tmp_list = []
for j in file_sequence:
if j.isalpha():
j = j.upper()
DNA_sequence_tmp_list.append(j)
merged_sequence_list += DN... | code_fim | hard | {
"lang": "python",
"repo": "pmspraju/Bioinformatics",
"path": "/Project 2/Docs/Merge_Sanger_v2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ivalearn/stepik-algos path: /dots_in_cuts.py
from sys import stdin
read = lambda: map(int, stdin.readline().split())
<|fim_suffix|>axis.sort()
hits = [0] * m
depth = 0
for x, dec, i in axis:
depth -= dec
if not dec:
hits[i] = depth
print(*hits)<|fim_middle|>n, m = read()
axis =... | code_fim | medium | {
"lang": "python",
"repo": "ivalearn/stepik-algos",
"path": "/dots_in_cuts.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for x, dec, i in axis:
depth -= dec
if not dec:
hits[i] = depth
print(*hits)<|fim_prefix|># repo: ivalearn/stepik-algos path: /dots_in_cuts.py
from sys import stdin
read = lambda: map(int, stdin.readline().split())
n, m = read()
axis = []
for i in range(n):
l, r = read()
axis.a... | code_fim | easy | {
"lang": "python",
"repo": "ivalearn/stepik-algos",
"path": "/dots_in_cuts.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>axis.sort()
hits = [0] * m
depth = 0
for x, dec, i in axis:
depth -= dec
if not dec:
hits[i] = depth
print(*hits)<|fim_prefix|># repo: ivalearn/stepik-algos path: /dots_in_cuts.py
from sys import stdin
read = lambda: map(int, stdin.readline().split())
n, m = read()
axis = []
<|fim_mid... | code_fim | medium | {
"lang": "python",
"repo": "ivalearn/stepik-algos",
"path": "/dots_in_cuts.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='task',
name='auto_join',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='note',
name='date_end',
field=models.DateTimeField(de... | code_fim | medium | {
"lang": "python",
"repo": "WebSofter/advertiser",
"path": "/backend/task/migrations/0008_auto_20200812_0557.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WebSofter/advertiser path: /backend/task/migrations/0008_auto_20200812_0557.py
# Generated by Django 3.0.8 on 2020-08-12 05:57
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
<|fim... | code_fim | medium | {
"lang": "python",
"repo": "WebSofter/advertiser",
"path": "/backend/task/migrations/0008_auto_20200812_0557.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fdlancelee/workspace path: /Spider/Spider-1/GetKennethreitzStar.py
# api https://api.github.com/repos/channelcat/sanic
# web_page https://github.com/channelcat/sanic
import requests
import webbrowser
import time
# api指定了follow的这个人star的所有项目,该用户是kennethreitz
api = "https://api.github.com/users/fdla... | code_fim | medium | {
"lang": "python",
"repo": "fdlancelee/workspace",
"path": "/Spider/Spider-1/GetKennethreitzStar.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>'''
while True:
# 获取star的项目
info = requests.get(api).json()
for i in info:
# 如果当前项目id在list变量中不存在,则说明是刚刚star的项目
if not i['id'] in starred:
starred.append(i['id'])
# 获取项目名称
repo_name = i['name']try:
pass
except Excep... | code_fim | medium | {
"lang": "python",
"repo": "fdlancelee/workspace",
"path": "/Spider/Spider-1/GetKennethreitzStar.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: roke1845/Cupoy_Course path: /D6/main.py
import numpy as np
<|fim_suffix|>with open('homework.npz', 'wb') as f:
np.savez(f, array1=array1,array2=array2)<|fim_middle|>array1 = np.array(range(30))
array2 = np.array([2,3,5])
| code_fim | easy | {
"lang": "python",
"repo": "roke1845/Cupoy_Course",
"path": "/D6/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>with open('homework.npz', 'wb') as f:
np.savez(f, array1=array1,array2=array2)<|fim_prefix|># repo: roke1845/Cupoy_Course path: /D6/main.py
import numpy as np
<|fim_middle|>array1 = np.array(range(30))
array2 = np.array([2,3,5])
| code_fim | easy | {
"lang": "python",
"repo": "roke1845/Cupoy_Course",
"path": "/D6/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ekkya/Project path: /Python Script/test4.py
import xlsxwriter
# Create a workbook and add a worksheet.
workbook = xlsxwriter.Workbook('data_PC_PC_STPC_IPC.xlsx')
worksheet = workbook.add_worksheet()
# Some data we want to write to the worksheet.
row = 0
col = 0
<|fim_suffix|>print "Complete"
w... | code_fim | hard | {
"lang": "python",
"repo": "ekkya/Project",
"path": "/Python Script/test4.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>with open('PC_PC_STPC_IPC_2.dat', 'r') as f:
data = f.readlines()
#print data
for line in data:
words = line.split()
worksheet.write(row, col, words[0])
worksheet.write(row, col + 1, words[1])
row += 1
print "Complete"
workbook.close()
workbook = xlsxwriter.Wo... | code_fim | hard | {
"lang": "python",
"repo": "ekkya/Project",
"path": "/Python Script/test4.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: juju-solutions/interface-sdn-plugin path: /provides.py
#!/usr/bin/python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.... | code_fim | medium | {
"lang": "python",
"repo": "juju-solutions/interface-sdn-plugin",
"path": "/provides.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_sdn_config(self):
''' Return a dict of the SDN configuration. '''
config = {}
conv = self.conversation()
config['mtu'] = conv.get_remote('mtu')
config['subnet'] = conv.get_remote('subnet')
config['cidr'] = conv.get_remote('cidr')
return c... | code_fim | hard | {
"lang": "python",
"repo": "juju-solutions/interface-sdn-plugin",
"path": "/provides.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # View it.
l = mlab.plot3d(x, y, z, s, tube_radius=0.025, colormap='Spectral')
mlab.show()
'''
# Now animate the data.
ms = l.mlab_source
for i in range(100):
x = numpy.cos(mu)*(1+numpy.cos(n_long*mu/n_mer + numpy.pi*(i+1)/5.)*0.5)
scalars = numpy.sin(mu + numpy.pi*(i+1)/5)
ms.set(x=x, sc... | code_fim | medium | {
"lang": "python",
"repo": "mattbellis/matts-work-environment",
"path": "/python/mayavi2/animate_0.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> x1 = r*numpy.sin(theta)*numpy.cos(phi)
y1 = r*numpy.sin(theta)*numpy.sin(phi)
z1 = r*numpy.cos(theta)
x = (x0,x1)
y = (y0,y1)
z = (z0,z1)
# View it.
l = mlab.plot3d(x, y, z, s, tube_radius=0.025, colormap='Spectral')
mlab.show()
'''
# Now animate the data.
ms = l.mlab_... | code_fim | medium | {
"lang": "python",
"repo": "mattbellis/matts-work-environment",
"path": "/python/mayavi2/animate_0.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mattbellis/matts-work-environment path: /python/mayavi2/animate_0.py
from enthought.mayavi import mlab
from numpy import *
import numpy as numpy
# Produce some nice data.
#n_mer, n_long = 6, 11
#pi = numpy.pi
#dphi = pi/1000.0
#phi = numpy.arange(0.0, 2*pi + 0.5*dphi, dphi, 'd')
#mu = phi*n_mer
... | code_fim | hard | {
"lang": "python",
"repo": "mattbellis/matts-work-environment",
"path": "/python/mayavi2/animate_0.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@router.get(
"/group", tags=["Group"],
summary="Status of Group",
response_model=GroupData
)
async def status(group: str):
return manager.get_by_id(group)<|fim_prefix|># repo: friends-share/swaddle path: /src/api/group.py
from fastapi import APIRouter
from src.dependency.manager import M... | code_fim | medium | {
"lang": "python",
"repo": "friends-share/swaddle",
"path": "/src/api/group.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@router.get(
"/group", tags=["Group"],
summary="Status of Group",
response_model=GroupData
)
async def status(group: str):
return manager.get_by_id(group)<|fim_prefix|># repo: friends-share/swaddle path: /src/api/group.py
from fastapi import APIRouter
from src.dependency.manager import ... | code_fim | medium | {
"lang": "python",
"repo": "friends-share/swaddle",
"path": "/src/api/group.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: friends-share/swaddle path: /src/api/group.py
from fastapi import APIRouter
from src.dependency.manager import Manager
from src.model.group import GroupData
<|fim_suffix|>@router.get(
"/group", tags=["Group"],
summary="Status of Group",
response_model=GroupData
)
async def status(gr... | code_fim | medium | {
"lang": "python",
"repo": "friends-share/swaddle",
"path": "/src/api/group.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
DOWNLOADER_MIDDLEWARES = {
"scrapy.downloadermiddlewares.httpcache.HttpCacheMiddleware": 500,
"scrapy_splash.SplashCookiesMiddleware": 723,
"scrapy_splash.SplashMiddleware": 725,
"scrapy.downloadermiddlewares.httpcom... | code_fim | hard | {
"lang": "python",
"repo": "gov-rss/scrape",
"path": "/gov_scrape/settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gov-rss/scrape path: /gov_scrape/settings.py
import os
BOT_NAME = "gov_scrape"
SPIDER_MODULES = ["gov_scrape.spiders"]
NEWSPIDER_MODULE = "gov_scrape.spiders"
# Splash config
SPLASH_URL = f"http://{os.getenv('SPLASH_IP', 'localhost:8050')}"
DUPEFILTER_CLASS = "scrapy_splash.SplashAwareDupeFilt... | code_fim | medium | {
"lang": "python",
"repo": "gov-rss/scrape",
"path": "/gov_scrape/settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maddiecain/qsim path: /qsim/evolution/hamiltonian.py
for k in range(num_IS):
self._diagonal_hamiltonian[k, 0] = np.sum(IS[k, ...] == self.transition[0]) - np.sum(
IS[k, ...] == self.transition[1])
self._csr_hamiltonian = ... | code_fim | hard | {
"lang": "python",
"repo": "maddiecain/qsim",
"path": "/qsim/evolution/hamiltonian.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self._hamiltonian is None:
assert not self.IS_subspace
try:
assert self.graph is not None
except AssertionError:
print('self.graph must be not None to generate the Hamiltonian property.')
self._hamiltonian = sparse.... | code_fim | hard | {
"lang": "python",
"repo": "maddiecain/qsim",
"path": "/qsim/evolution/hamiltonian.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def optimum_overlap(self, state: State):
# Returns \sum_i <s|opt_i><opt_i|s>
if self._is_diagonal:
optimum_indices = np.argwhere(self._diagonal_hamiltonian == self.optimum).T[0]
# Construct an operator that is zero everywhere except at the optimum
op... | code_fim | hard | {
"lang": "python",
"repo": "maddiecain/qsim",
"path": "/qsim/evolution/hamiltonian.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># __new__,__init__,__str__,__del__已两个下划线开始,两个下划线结束的方法都叫魔术方法,不会调用,程序会在特定情况下自动调用
p1 = Person('laoxiao', '男')
p2 = Person('xiaoli', '女')
p3 = p1
print(id(p1))
print(id(p2))
print(id(p3))
del (p1)
print(p2)
del (p3)<|fim_prefix|># repo: yourant/pythonStudy path: /oop/01-对象基本概念.py
class Person(object):
# 创... | code_fim | hard | {
"lang": "python",
"repo": "yourant/pythonStudy",
"path": "/oop/01-对象基本概念.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yourant/pythonStudy path: /oop/01-对象基本概念.py
class Person(object):
# 创建对象时调用
def __new__(cls, name, sex):
print('调用自己的构造方法创建对象')
return object.__new__(cls)
# 初始化方法
def __init__(self, name, sex):
self.name = name
self.sex = sex
<|fim_suffix|># __new__,__init__,__str__,__del__已两个下划线开始,... | code_fim | medium | {
"lang": "python",
"repo": "yourant/pythonStudy",
"path": "/oop/01-对象基本概念.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MagnusBau/Stupebrett path: /code/oppgave3.py
from oppgave2 import generateA
import numpy as np
from scipy.linalg import solve
# Gitte bjelkeparametre.
length = 2.0
width = 0.3
thickness = 0.03
density = 480.0 # kg/m^3
# Andre konstanter.
g = 9.8 # gravity, m/s^2
E = 1.3 * pow(10, 10) # Materi... | code_fim | medium | {
"lang": "python",
"repo": "MagnusBau/Stupebrett",
"path": "/code/oppgave3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Deler bjelkens lengde saa alle segmentene er like.
h = length / n
# Genererer baandmatrise (A matrisen)
matrixA = generateA(n)
# Genererer b-matrisen.
matrixB = np.array([[(pow(h, 4) / (E * I)) * f]] * n)
# Loser for Y basert paa A og B.
matrixY = solve(matrixA, matrixB)
... | code_fim | medium | {
"lang": "python",
"repo": "MagnusBau/Stupebrett",
"path": "/code/oppgave3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_basic_valid(self):
"""
Test valid downloads for both paired and single-end reads. Paired-end has examples for both
interleaved and not.
"""
tmp_dir = tempfile.mkdtemp()
# Paired reads, non-interleaved
ref = '15/45/1'
paths = down... | code_fim | medium | {
"lang": "python",
"repo": "jayrbolton/kbase_workspace_utils",
"path": "/src/kbase_workspace_utils/test/test_download_reads.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jayrbolton/kbase_workspace_utils path: /src/kbase_workspace_utils/test/test_download_reads.py
import os
import shutil
import tempfile
import unittest
from dotenv import load_dotenv
load_dotenv() # noqa
from src.kbase_workspace_utils import download_reads
from src.kbase_workspace_utils.exceptio... | code_fim | medium | {
"lang": "python",
"repo": "jayrbolton/kbase_workspace_utils",
"path": "/src/kbase_workspace_utils/test/test_download_reads.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> assembly_id = '34819/10/1'
tmp_dir = tempfile.mkdtemp()
with self.assertRaises(InvalidWSType) as err:
download_reads(ref=assembly_id, save_dir=tmp_dir)
self.assertTrue('Invalid workspace type' in str(err.exception))
shutil.rmtree(tmp_dir)<|fim_prefix|># ... | code_fim | hard | {
"lang": "python",
"repo": "jayrbolton/kbase_workspace_utils",
"path": "/src/kbase_workspace_utils/test/test_download_reads.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if starts_with_black:
if row % 2 == 0:
white = True
else:
white = False
else:
if row % 2 == 0:
white = False
else:
white = True
if white:
print(f"The position {position} is colored white")
else:
print(f"The position {position} is colored black")<|fi... | code_fim | medium | {
"lang": "python",
"repo": "GanLay20/the-python-workbook",
"path": "/Cap_2_DecisionMaking/ex_46.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GanLay20/the-python-workbook path: /Cap_2_DecisionMaking/ex_46.py
# EXERCISE 46 : What color is that square (chess)
position = input("Enter a chess board position: ")
col = position[0].lower()
row = int(position[1])
if col in "aceg":
starts_with_black = True
else:
starts_with_black = F... | code_fim | medium | {
"lang": "python",
"repo": "GanLay20/the-python-workbook",
"path": "/Cap_2_DecisionMaking/ex_46.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>employee = pd.read_csv('data/employee.csv',
parse_dates=['JOB_DATE', 'HIRE_DATE'],
index_col='HIRE_DATE')
'groupby' in dir(employee.resample('10AS'))
# In[ ]:<|fim_prefix|># repo: satriang/bigdata path: /minggu-13/praktik/src/10_141.py
#!/usr/bin/env pyth... | code_fim | easy | {
"lang": "python",
"repo": "satriang/bigdata",
"path": "/minggu-13/praktik/src/10_141.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
employee = pd.read_csv('data/employee.csv',
parse_dates=['JOB_DATE', 'HIRE_DATE'],
index_col='HIRE_DATE')
'groupby' in dir(employee.resample('10AS'))
# In[ ]:<|fim_prefix|># repo: satriang/bigdata path: /minggu-13/praktik/src/10_141.py
#!/usr/bin/env pyt... | code_fim | easy | {
"lang": "python",
"repo": "satriang/bigdata",
"path": "/minggu-13/praktik/src/10_141.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: satriang/bigdata path: /minggu-13/praktik/src/10_141.py
#!/usr/bin/env python
# coding: utf-8
# In[150]:
<|fim_suffix|>
# In[177]:
employee = pd.read_csv('data/employee.csv',
parse_dates=['JOB_DATE', 'HIRE_DATE'],
index_col='HIRE_DATE')
'groupby... | code_fim | medium | {
"lang": "python",
"repo": "satriang/bigdata",
"path": "/minggu-13/praktik/src/10_141.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: heiue/mysite path: /api/migrations/0001_initial.py
# Generated by Django 3.1.7 on 2021-03-19 15:18
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.CreateModel(
name='SaasScPoster',
fiel... | code_fim | hard | {
"lang": "python",
"repo": "heiue/mysite",
"path": "/api/migrations/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
]
operations = [
migrations.CreateModel(
name='SaasScPoster',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('qrstyle', models.CharField(db_column='qr... | code_fim | hard | {
"lang": "python",
"repo": "heiue/mysite",
"path": "/api/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #显示help文档信息
def help_(self):
f=open("help.txt","r")
text=f.read()
f.close()
type_=chardet.detect(text)
self.textEdit.append(text.decode(type_["encoding"]))
#暂停所有线程
def stop(self):
Global.thread_mark=0
#实时显... | code_fim | hard | {
"lang": "python",
"repo": "clau224/python-IP-Pool",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #暂停所有线程
def stop(self):
Global.thread_mark=0
#实时显示当前状态信息
def Update(self):
global message_queue
text=Global.outstatesinf()
if text:
self.textEdit.append(text)
if __name__ == "__main__":
app = QtGui.QAppli... | code_fim | hard | {
"lang": "python",
"repo": "clau224/python-IP-Pool",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: clau224/python-IP-Pool path: /main.py
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 12 17:41:29 2018
@author: Administrator
"""
import sys
from PyQt4 import QtCore,QtGui,uic
import views
import Global
import chardet
import workmanage
qtCreatorFile = "UI.ui"
Ui_MainWindow, Q... | code_fim | hard | {
"lang": "python",
"repo": "clau224/python-IP-Pool",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>from PhysicsTools.PatAlgos.patEventContent_cff import patEventContentNoCleaning
from PhysicsTools.PatAlgos.patEventContent_cff import patExtraAodEventContent
from PhysicsTools.PatAlgos.patEventContent_cff import patTriggerEventContent
process.out.outputCommands = [
'keep GenRunInfoProduct_generator_*... | code_fim | hard | {
"lang": "python",
"repo": "fblekman/UserCode",
"path": "/MyPatSkimmers/DiJetAnalysis/test/diJetSelection_cfg.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fblekman/UserCode path: /MyPatSkimmers/DiJetAnalysis/test/diJetSelection_cfg.py
from PhysicsTools.PatAlgos.patTemplate_cfg import *
from PhysicsTools.PatAlgos.tools.coreTools import *
useData=False
###############################
####### Parameters ############
###############################... | code_fim | hard | {
"lang": "python",
"repo": "fblekman/UserCode",
"path": "/MyPatSkimmers/DiJetAnalysis/test/diJetSelection_cfg.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>process.patJets.embedPFCandidates = True
process.patJets.embedCaloTowers = True
process.patJetsAK5PF.embedCaloTowers = True
process.patJetsAK5PF.embedPFCandidates = True
# prune gen particles
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
process.prunedGenParticles = cms.EDProducer("GenParticl... | code_fim | hard | {
"lang": "python",
"repo": "fblekman/UserCode",
"path": "/MyPatSkimmers/DiJetAnalysis/test/diJetSelection_cfg.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.scatter(r[:,0],r[:,1])
plt.axis('equal')
plt.show()<|fim_prefix|># repo: LuisC137/Python path: /00_Examples/04_Scipy/04_General_Multivariate_Normal.py
"""
Author: Luis_C-137
Using a spherical gausian distribution exmaple
This is just for practice purposes
This is NOT functional code
"""
from scip... | code_fim | medium | {
"lang": "python",
"repo": "LuisC137/Python",
"path": "/00_Examples/04_Scipy/04_General_Multivariate_Normal.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># r = mvn.rvs(mean=mu, cov=cov,size=1000) # We can use Scipy OR
r = np.random.multivariate_normal(mean=mu, cov=cov, size=1000) # Use Numpy
plt.scatter(r[:,0],r[:,1])
plt.axis('equal')
plt.show()<|fim_prefix|># repo: LuisC137/Python path: /00_Examples/04_Scipy/04_General_Multivariate_Normal.py
"""
... | code_fim | medium | {
"lang": "python",
"repo": "LuisC137/Python",
"path": "/00_Examples/04_Scipy/04_General_Multivariate_Normal.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LuisC137/Python path: /00_Examples/04_Scipy/04_General_Multivariate_Normal.py
"""
Author: Luis_C-137
Using a spherical gausian distribution exmaple
This is just for practice purposes
This is NOT functional code
"""
from scipy.stats import multivariate_normal as mvn
import numpy as np
import m... | code_fim | medium | {
"lang": "python",
"repo": "LuisC137/Python",
"path": "/00_Examples/04_Scipy/04_General_Multivariate_Normal.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 279zlj/Autotest_project path: /client/c_client.py
# transfer message from front to C
import socket
class Client(object):
# 从前端传回的数据中应包含 tcp server 的 ip 和 port
def __init__(self, host, port):
self.host = host
self.port = port
<|fim_suffix|> """
从前端发的数据直接通过... | code_fim | medium | {
"lang": "python",
"repo": "279zlj/Autotest_project",
"path": "/client/c_client.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
从前端发的数据直接通过这个方法转发到 c 程序,
发送完成即主动关闭连接.设置连接超时为 6 秒
:param data: 要发送的数据
:return:
"""
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as client_socket:
client_socket.settimeout(6)
client_socket.connect((self.host, self.... | code_fim | medium | {
"lang": "python",
"repo": "279zlj/Autotest_project",
"path": "/client/c_client.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.host = host
self.port = port
def send_msg_to_c(self, data):
"""
从前端发的数据直接通过这个方法转发到 c 程序,
发送完成即主动关闭连接.设置连接超时为 6 秒
:param data: 要发送的数据
:return:
"""
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as client_socket:
... | code_fim | medium | {
"lang": "python",
"repo": "279zlj/Autotest_project",
"path": "/client/c_client.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>img_patch = torch.squeeze(img_patch)
ins_patch = torch.squeeze(ins_patch)
gt_patch = torch.squeeze(gt_patch)
weight = torch.squeeze(weight)
assert img_patch.shape == (128, 128, 128)
assert ins_patch.shape == (128, 128, 128)
assert gt_patch.shape == (128, 128, 128)
assert weight.shape == (128, 128, 128)
... | code_fim | hard | {
"lang": "python",
"repo": "MY-Park/Pytorch-IterativeFCN",
"path": "/test/test_dataset.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MY-Park/Pytorch-IterativeFCN path: /test/test_dataset.py
import torch
import SimpleITK as sitk
from pathlib import Path
from data.dataset import CSIDataset
from torch.utils.data import Dataset, DataLoader
crop_img = '../crop_isotropic_dataset'
batch_size = 1
train_dataset = CSIDataset(crop_img)... | code_fim | medium | {
"lang": "python",
"repo": "MY-Park/Pytorch-IterativeFCN",
"path": "/test/test_dataset.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> miniGameWidget = ObjectProperty()<|fim_prefix|># repo: DerThorsten/kivy_dev path: /apps/tparty/tparty/game_widgets/menu_button_widget.py
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty
from kivy.lang import Builder
<|fim_middle|>Builder.load_string("""
<MenuButton... | code_fim | medium | {
"lang": "python",
"repo": "DerThorsten/kivy_dev",
"path": "/apps/tparty/tparty/game_widgets/menu_button_widget.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DerThorsten/kivy_dev path: /apps/tparty/tparty/game_widgets/menu_button_widget.py
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty
from kivy.lang import Builder
<|fim_suffix|> miniGameWidget = ObjectProperty()<|fim_middle|>Builder.load_string("""
<MenuButton... | code_fim | medium | {
"lang": "python",
"repo": "DerThorsten/kivy_dev",
"path": "/apps/tparty/tparty/game_widgets/menu_button_widget.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Compiling
network.compile(optimizer='rmsprop',
loss='categorical_crossentropy',
metrics=['accuracy'])
# Training
network.fit(train_images,
train_labels,
epochs=5,
batch_size=256
)
# Evaluating
test_loss, test_acc = network... | code_fim | medium | {
"lang": "python",
"repo": "xingyu-long/DL_with_Python_Keras",
"path": "/Chapter2/Neural network .py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xingyu-long/DL_with_Python_Keras path: /Chapter2/Neural network .py
from keras.datasets import mnist
from keras import models
from keras import layers
from keras.utils import to_categorical
# loading train data set
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()
# P... | code_fim | hard | {
"lang": "python",
"repo": "xingyu-long/DL_with_Python_Keras",
"path": "/Chapter2/Neural network .py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Training
network.fit(train_images,
train_labels,
epochs=5,
batch_size=256
)
# Evaluating
test_loss, test_acc = network.evaluate(test_images, test_labels)
print('test_acc', test_acc)<|fim_prefix|># repo: xingyu-long/DL_with_Python_Keras path: /Chapter2/Ne... | code_fim | medium | {
"lang": "python",
"repo": "xingyu-long/DL_with_Python_Keras",
"path": "/Chapter2/Neural network .py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HelloIshHere/Chatbot-project path: /Pyrohv2/com/Mute.py
import discord
from discord.ext import commands
class Mute(commands.Cog):
def init(self, bot):
self.bot = bot
self._last_member = None
@commands.command()
@commands.has_permissions(kick_members=True)
... | code_fim | hard | {
"lang": "python",
"repo": "HelloIshHere/Chatbot-project",
"path": "/Pyrohv2/com/Mute.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> bot.add_cog(Mute(bot))
#embed = discord.Embed(title="muted", description=f"{member.mention} was muted ", colour=discord.Colour.light_gray())
#embed.add_field(name="reason:", value=reason, inline=False)
#await ctx.send(embed=embed)<|fim_prefix|># repo: HelloIshHere/Chatbot-project path: /Pyrohv... | code_fim | hard | {
"lang": "python",
"repo": "HelloIshHere/Chatbot-project",
"path": "/Pyrohv2/com/Mute.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def setup(bot):
bot.add_cog(Mute(bot))
#embed = discord.Embed(title="muted", description=f"{member.mention} was muted ", colour=discord.Colour.light_gray())
#embed.add_field(name="reason:", value=reason, inline=False)
#await ctx.send(embed=embed)<|fim_prefix|># repo: HelloIshHere/Chatbot-proje... | code_fim | hard | {
"lang": "python",
"repo": "HelloIshHere/Chatbot-project",
"path": "/Pyrohv2/com/Mute.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>63 1 0.93949 0.24722 0.8101
864 1 0.884082 0.311601 0.81272
739 1 0.0560664 0.375091 0.688246
744 1 0.125958 0.43334 0.689909
866 1 0.064474 0.444444 0.75254
867 1 0.0593892 0.373463 0.820164
869 1 0.111926 0.374919 0.753486
872 1 0.120472 0.434501 0.820623
865 1 0.00036485 0.381635 0.758953
868 1 0.00648... | code_fim | hard | {
"lang": "python",
"repo": "scheuclu/atom_class",
"path": "/exam/1_three-dimensional_atomic_system/dump/phasetrans/temp74_7500.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
9 1 0.249552 0.00291577 0.98923
30 1 0.927322 0.0624821 0.994007
1681 1 0.497632 0.497692 0.617596
37 1 0.132658 0.126176 0.998773
90 1 0.8165 0.3167 0.996877
98 1 0.0698089 0.430871 0.994975
114 1 0.564199 0.434488 0.999371
29 1 0.874199 -0.000562696 0.996514
65 1 0.999056 0.247621 0.991859
93 1 0.87713... | code_fim | hard | {
"lang": "python",
"repo": "scheuclu/atom_class",
"path": "/exam/1_three-dimensional_atomic_system/dump/phasetrans/temp74_7500.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.