text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: windj007/pyarc path: /pyarc/backends/erequests_client.py
import erequests
from pyarc.base import RestException
class ResultWrapper(object):
def __init__(self, client, method, url):
self.client = client
self.method = method
self.url = url
self.response = None
... | code_fim | hard | {
"lang": "python",
"repo": "windj007/pyarc",
"path": "/pyarc/backends/erequests_client.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ERequestsClient(object):
def __init__(self, verify = None):
self.requests_to_send = []
self.results = []
self.verify = verify or False
def start_req(self, method, prepared_url, headers, body = ''):
method = method.lower()
assert method in _METHODS, "... | code_fim | hard | {
"lang": "python",
"repo": "windj007/pyarc",
"path": "/pyarc/backends/erequests_client.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(self.requests_to_send) == 0:
return
try:
for resp, result in zip(erequests.map(self.requests_to_send), self.results):
result.response = resp
finally:
self.requests_to_send = []
self.results = []<|fim_prefix|># r... | code_fim | hard | {
"lang": "python",
"repo": "windj007/pyarc",
"path": "/pyarc/backends/erequests_client.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hirasaki1985/Oreilly_deepLearning path: /aiserver/console_backpro_net.py
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
from dataset.mnist import load_mnist
from controller import Controller
<|fim_suffix|># accuracy
trycount = 1000
accuracy_cnt = 0
resu... | code_fim | medium | {
"lang": "python",
"repo": "hirasaki1985/Oreilly_deepLearning",
"path": "/aiserver/console_backpro_net.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># instance
controller = Controller()
# accuracy
trycount = 1000
accuracy_cnt = 0
result = np.zeros((10, 10))
for i in range(len(x_test)):
p = controller.accuracy(x_test[i])
a = np.argmax(t_test[i])
#print("p = " + str(p))
#print("a = " + str(a))
result[p][a] += 1
#print(t_test[i... | code_fim | medium | {
"lang": "python",
"repo": "hirasaki1985/Oreilly_deepLearning",
"path": "/aiserver/console_backpro_net.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if (i == trycount):
break
print("Accuracy:" + str(float(accuracy_cnt) / trycount))
print(result)<|fim_prefix|># repo: hirasaki1985/Oreilly_deepLearning path: /aiserver/console_backpro_net.py
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
from dataset... | code_fim | hard | {
"lang": "python",
"repo": "hirasaki1985/Oreilly_deepLearning",
"path": "/aiserver/console_backpro_net.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Maulik1528/python-patterns path: /PatternE.py
for row in range(7):
for col in range(5)<|fim_suffix|>
print(" ", end=" ")
print()<|fim_middle|>:
if (col == 0) or (row % 3 == 0):
print("*", end=" ")
else: | code_fim | medium | {
"lang": "python",
"repo": "Maulik1528/python-patterns",
"path": "/PatternE.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("*", end=" ")
else:
print(" ", end=" ")
print()<|fim_prefix|># repo: Maulik1528/python-patterns path: /PatternE.py
for row in range(7):
for col in range(5)<|fim_middle|>:
if (col == 0) or (row % 3 == 0):
| code_fim | easy | {
"lang": "python",
"repo": "Maulik1528/python-patterns",
"path": "/PatternE.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> inspector.run(args=["./sample.tar"], env={'LD_LIBRARY_PATH': os.environ['LD_LIBRARY_PATH']})
return inspector.collect(cond)
if __name__ == "__main__":
res = test_file()
print(res)
assert len(res) > 0<|fim_prefix|># repo: Trietptm-on-Coding-Algorithms/binary-analysis-using-gradient-met... | code_fim | medium | {
"lang": "python",
"repo": "Trietptm-on-Coding-Algorithms/binary-analysis-using-gradient-method",
"path": "/experiment/test-dynamic-lib-support.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Trietptm-on-Coding-Algorithms/binary-analysis-using-gradient-method path: /experiment/test-dynamic-lib-support.py
#!/usr/bin/python
import os
from nao.tactics import Tactic
from nao.inspector import Inspector
def test_file():
<|fim_suffix|> inspector.run(args=["./sample.tar"], env={'LD_LIBRAR... | code_fim | hard | {
"lang": "python",
"repo": "Trietptm-on-Coding-Algorithms/binary-analysis-using-gradient-method",
"path": "/experiment/test-dynamic-lib-support.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ni/systemlink-configuration-utility path: /slconf/slconf.py
def increment(number: int) -> int:
<|fim_suffix|> Args:
number (int): The number to increment.
Returns:
int: The incremented number.
"""
return number + 1<|fim_middle|> """Increment a number.
| code_fim | easy | {
"lang": "python",
"repo": "ni/systemlink-configuration-utility",
"path": "/slconf/slconf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
int: The incremented number.
"""
return number + 1<|fim_prefix|># repo: ni/systemlink-configuration-utility path: /slconf/slconf.py
def increment(number: int) -> int:
"""Increment a number.
<|fim_middle|> Args:
number (int): The number to increment.
| code_fim | easy | {
"lang": "python",
"repo": "ni/systemlink-configuration-utility",
"path": "/slconf/slconf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if p1*c1=p2*c2:
print('O')
if pi*c1>p2*c2:
print('-1')
else:
print('1')<|fim_prefix|># repo: rafaelperazzo/programacao-web path: /moodledata/vpl_data/59/usersdata/243/48438/submittedfiles/testes.py
# -*- coding: utf-8 -*-
#COMECE AQUI ABAIXO
<|fim_middle|>p1=float(input('digite o p1:'))
c1... | code_fim | medium | {
"lang": "python",
"repo": "rafaelperazzo/programacao-web",
"path": "/moodledata/vpl_data/59/usersdata/243/48438/submittedfiles/testes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rafaelperazzo/programacao-web path: /moodledata/vpl_data/59/usersdata/243/48438/submittedfiles/testes.py
# -*- coding: utf-8 -*-
#COMECE AQUI ABAIXO
<|fim_suffix|>if p1*c1=p2*c2:
print('O')
if pi*c1>p2*c2:
print('-1')
else:
print('1')<|fim_middle|>p1=float(input('digite o p1:'))
c1... | code_fim | medium | {
"lang": "python",
"repo": "rafaelperazzo/programacao-web",
"path": "/moodledata/vpl_data/59/usersdata/243/48438/submittedfiles/testes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if pi*c1>p2*c2:
print('-1')
else:
print('1')<|fim_prefix|># repo: rafaelperazzo/programacao-web path: /moodledata/vpl_data/59/usersdata/243/48438/submittedfiles/testes.py
# -*- coding: utf-8 -*-
#COMECE AQUI ABAIXO
p1=float(input('digite o p1:'))
c1=float(input('digite o c1:'))
p2=float(input('... | code_fim | easy | {
"lang": "python",
"repo": "rafaelperazzo/programacao-web",
"path": "/moodledata/vpl_data/59/usersdata/243/48438/submittedfiles/testes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> t, p = ba.sample_tp(q, 10000)
kde = stats.kde.gaussian_kde(
np.column_stack((t, p)).T, "scott"
)
plt.xlabel(r"$\theta$")
plt.xticks(
[0, 19, 39, 59, 79, 99],
[(r"$%d^∘$" % t) for t in np.linspace(-90, 90, 6)]
)
plt.ylabel(r"$\phi$", rotation=0)
pl... | code_fim | hard | {
"lang": "python",
"repo": "gutnar/masters",
"path": "/lib/plotting.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> plot_kde(kde, QT_GRID, False, aspect=1, **kwargs)
def plot_q_phi_kde(ba, **kwargs):
plt.xlabel(r"$q$")
plt.xticks(
[0, 19, 39, 59, 79, 99],
["0.0", "0.2", "0.4", "0.6", "0.8", "1.0"]
)
plt.ylabel(r"$\phi$", rotation=0)
plt.yticks(
[0, 19, 39, 59, 79, 99],... | code_fim | hard | {
"lang": "python",
"repo": "gutnar/masters",
"path": "/lib/plotting.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gutnar/masters path: /lib/plotting.py
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats
XZ_MESH = np.meshgrid(
np.linspace(0, 1, 100), np.linspace(0.5, 1, 100)
)
XZ_GRID = np.append(
XZ_MESH[0].reshape(-1, 1), XZ_MESH[1].reshape(-1, 1), 1
)
QI_MESH = np.mes... | code_fim | hard | {
"lang": "python",
"repo": "gutnar/masters",
"path": "/lib/plotting.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sroelants/BdG2.0 path: /constants.py
''' Load a variety of relevant physical parameters.
<|fim_suffix|>import numpy as np
hbar = 1.0
m_e = 1.0
h22m = hbar**2 / (2*m_e)
pi = np.pi
eV = 1/27.21138505
eV_Ha = eV
nm = 18.89726124565
kB_eV = 8.6173324e-5
kB = kB_eV * eV_Ha<|fim_middle|>All quantiti... | code_fim | medium | {
"lang": "python",
"repo": "sroelants/BdG2.0",
"path": "/constants.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>import numpy as np
hbar = 1.0
m_e = 1.0
h22m = hbar**2 / (2*m_e)
pi = np.pi
eV = 1/27.21138505
eV_Ha = eV
nm = 18.89726124565
kB_eV = 8.6173324e-5
kB = kB_eV * eV_Ha<|fim_prefix|># repo: sroelants/BdG2.0 path: /constants.py
''' Load a variety of relevant physical parameters.
<|fim_middle|>All quantiti... | code_fim | medium | {
"lang": "python",
"repo": "sroelants/BdG2.0",
"path": "/constants.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>g/mac/lib/clang/3.7.0/'
'lib/darwin/libclang_rt.asan_osx_dynamic.dylib',
],
},
],
}, { # OS!="mac"
'actions': [
{
'action_name': 'touch_asan_dylib',
'inputs': [
],
'out... | code_fim | hard | {
"lang": "python",
"repo": "floitschG/fletch",
"path": "/fletch.gyp",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: floitschG/fletch path: /fletch.gyp
# Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE.md file.
{
'variables': {
'mac_asan_dylib': '<(... | code_fim | hard | {
"lang": "python",
"repo": "floitschG/fletch",
"path": "/fletch.gyp",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: schrummy14/ISP_Speed_Test path: /ISP_Helper.py
import subprocess
import datetime
def ping_address(host,n):
ping = subprocess.Popen(
["ping","-c",str(n),host],
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
out,error = ping.communicate()
return out, error
de... | code_fim | hard | {
"lang": "python",
"repo": "schrummy14/ISP_Speed_Test",
"path": "/ISP_Helper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> rhs = msg.split('=')
try:
nums = rhs[1].split('/')
min_num = float(nums[0])
ave_num = float(nums[1])
max_num = float(nums[2])
std_num = nums[3].split(' ')
std_num = float(std_num[0])
except:
print("Could not Ping Website...")
min_... | code_fim | hard | {
"lang": "python",
"repo": "schrummy14/ISP_Speed_Test",
"path": "/ISP_Helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> path_logging = os.path.join(root_dir, 'logging', model.__class__.__name__, exp_id)
train_logger = TrainingLogger(model, measure_interval=PRINT_EVERY, predict_interval=PREDICT_EVERY,
path_to_file=path_logging + '_train', input_transform=input2_text,
... | code_fim | hard | {
"lang": "python",
"repo": "ductri/sentiment_price",
"path": "/source/main/train/run_new_trainer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ductri/sentiment_price path: /source/main/train/run_new_trainer.py
import os
import logging
from datetime import datetime
import torch
from naruto_skills.training_checker import TrainingChecker
from data_for_train import is_question as my_dataset
from model_def.lstm_attention import LSTMAttenti... | code_fim | medium | {
"lang": "python",
"repo": "ductri/sentiment_price",
"path": "/source/main/train/run_new_trainer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luckzsh/test path: /testconv2d.py
# coding=utf-8
import tensorflow as tf
import numpy as np
state = [[1.0000037e+00, 1.0000037e+00, 1.0000000e+00, 4.5852923e-01],
[1.0000000e+00, 1.0000000e+00, 1.0000000e+00, 8.3596563e-01],
[1.0000478e+00, 1.0000000e+00, 1.0000478e+00, 1.4663... | code_fim | hard | {
"lang": "python",
"repo": "luckzsh/test",
"path": "/testconv2d.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>37e-01],
[1.0008628e+00, 1.0006763e+00, 1.0005518e+00, 2.8207576e-01],
[1.0000950e+00, 9.9964195e-01, 1.0000950e+00, 1.2079760e+00],
[1.0000913e+00, 1.0006396e+00, 1.0000913e+00, 4.5529306e-01],
[1.0000511e+00, 1.0001425e+00, 1.0002812e+00, 6.6403847e+00],
[1.0... | code_fim | hard | {
"lang": "python",
"repo": "luckzsh/test",
"path": "/testconv2d.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yieldthought/hemelb path: /deploy/test/test_fabric.py
#!/usr/bin/env python
#
# Copyright (C) University College London, 2007-2012, all rights reserved.
#
# This file is part of HemeLB and is CONFIDENTIAL. You may not work
# with, install, use, duplicate, modify, redistribute or share this
# f... | code_fim | hard | {
"lang": "python",
"repo": "yieldthought/hemelb",
"path": "/deploy/test/test_fabric.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> execute(create_configs,'cylinder',VoxelSize='[0.1:0.21:0.01]')
self.assertEqual(env.config,"cylinder_0_2_1000_3")
self.assertCommandRegexp("mkdir -p .*/configs/cylinder_0_1_1000_3",0)
self.assertCommand("generate 0.1 1000 3",1)
self.assertCommandCount(2*11)
def ... | code_fim | hard | {
"lang": "python",
"repo": "yieldthought/hemelb",
"path": "/deploy/test/test_fabric.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PetraSt/Proclus-with-Map-Reduce path: /Greedy.py
import random
import Manhattan_segmental_dist
# Greedy
# s: dictionary of points
# k: number of medoids
# returns
# k medoids from sample set s
def greedy(s, k):
# print("Hello Word!")
m_<|fim_suffix|>[m_i]
dist.pop(m_i)
... | code_fim | hard | {
"lang": "python",
"repo": "PetraSt/Proclus-with-Map-Reduce",
"path": "/Greedy.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>:
dist[x] = Manhattan_segmental_dist.manhattan_segmental_dist(medoids[m_1], s[x], dimensions)
for i in range(1, k):
m_i = max(dist, key=lambda x: dist.get(x))
medoids[m_i] = s[m_i]
dist.pop(m_i)
s.pop(m_i)
for x in s:
dist[x] = min(dist[x], M... | code_fim | hard | {
"lang": "python",
"repo": "PetraSt/Proclus-with-Map-Reduce",
"path": "/Greedy.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> username = forms.CharField(max_length=100, widget= forms.TextInput(attrs={'class': 'form-control'}))
first_name = forms.CharField(max_length=100, widget= forms.TextInput(attrs={'class': 'form-control'}))
last_name = forms.CharField(max_length=100, widget= forms.TextInput(attrs={'class': 'form-... | code_fim | medium | {
"lang": "python",
"repo": "nrking0/votesite",
"path": "/votesite/forms.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nrking0/votesite path: /votesite/forms.py
from django.contrib.auth.forms import UserChangeForm
from django.contrib.auth.models import User
from django import forms
<|fim_suffix|> class Meta:
model = User
fields = ('username', 'first_name', 'last_name', 'email')<|fim_middle|>cl... | code_fim | hard | {
"lang": "python",
"repo": "nrking0/votesite",
"path": "/votesite/forms.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = User
fields = ('username', 'first_name', 'last_name', 'email')<|fim_prefix|># repo: nrking0/votesite path: /votesite/forms.py
from django.contrib.auth.forms import UserChangeForm
from django.contrib.auth.models import User
from django import forms
class editForm(forms.ModelForm):... | code_fim | hard | {
"lang": "python",
"repo": "nrking0/votesite",
"path": "/votesite/forms.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Functions
# Write a function called countWords
# Count how many times a word appears in a list
# Input: list of strings, and a string to search for
# Output: an integer representing how many times the searched word was found
# def countWords(wordList, searchWord):
# counter = 0
#... | code_fim | hard | {
"lang": "python",
"repo": "Shamitbh/ITP-115",
"path": "/Lecture Notes/Cities example/Lecture Notes 10-4-16.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Shamitbh/ITP-115 path: /Lecture Notes/Cities example/Lecture Notes 10-4-16.py
# Midterm Review Class!
'''
This is a Multi line comment:
'''
# Break and Continue
# for i in range(10):
# if i == 5:
# continue
# print(i)
# Prints 0-4, 6-9
# # Structure
... | code_fim | hard | {
"lang": "python",
"repo": "Shamitbh/ITP-115",
"path": "/Lecture Notes/Cities example/Lecture Notes 10-4-16.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if closure is not None:
closure()
return None
class NoOp(object):
def __init__(self,
parameters: typing.Iterator[torch.nn.Parameter],
):
self.optimizers = [Null(parameters)]
def step(self, closure=None):
return None<|fim_prefix|># repo: iampakos/moai-0.1.0a2 path: /m... | code_fim | medium | {
"lang": "python",
"repo": "iampakos/moai-0.1.0a2",
"path": "/moai/parameters/optimization/noop.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self,
parameters: typing.Iterator[torch.nn.Parameter],
):
self.optimizers = [Null(parameters)]
def step(self, closure=None):
return None<|fim_prefix|># repo: iampakos/moai-0.1.0a2 path: /moai/parameters/optimization/noop.py
import torch
import typing
__all__ = ['NoOp']... | code_fim | medium | {
"lang": "python",
"repo": "iampakos/moai-0.1.0a2",
"path": "/moai/parameters/optimization/noop.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iampakos/moai-0.1.0a2 path: /moai/parameters/optimization/noop.py
import torch
import typing
__all__ = ['NoOp']
class Null(torch.optim.Optimizer):
def __init__(self,
parameters: typing.Iterator[torch.nn.Parameter],
):
super(Null, self).__init__(parameters, {"lr": 0.0, "eps": 1e-8})
... | code_fim | medium | {
"lang": "python",
"repo": "iampakos/moai-0.1.0a2",
"path": "/moai/parameters/optimization/noop.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>response = requests.get (Eliq_request_string)
Eliq_just_NOW = (response.json())
power_value = Eliq_just_NOW['power']
power_value_int = int (float (power_value))
power_str = ('Power is {} Watts'.format(power_value_int))
print (power_str)
if power_value_int > level_warning:
engine.say(power_str)
... | code_fim | medium | {
"lang": "python",
"repo": "Conny128/Eliq-Voice",
"path": "/Eliq_NOW_RPi.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Conny128/Eliq-Voice path: /Eliq_NOW_RPi.py
import requests
import json
import pyttsx
engine = pyttsx.init()
engine.say('Hello from Eliq.')
engine.runAndWait()
<|fim_suffix|>Eliq_just_NOW = (response.json())
power_value = Eliq_just_NOW['power']
power_value_int = int (float (power_value))
power_... | code_fim | hard | {
"lang": "python",
"repo": "Conny128/Eliq-Voice",
"path": "/Eliq_NOW_RPi.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.name = name
self.sex = sex
self.salary = salary
def give_raise(self):
222<|fim_prefix|># repo: cathyxiao/selenium_practice path: /PycharmProjects/test_class_example/employee.py
#encoding:utf-8
class Employee():
<|fim_middle|> def __int__(self,name,sex,salary):
| code_fim | easy | {
"lang": "python",
"repo": "cathyxiao/selenium_practice",
"path": "/PycharmProjects/test_class_example/employee.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cathyxiao/selenium_practice path: /PycharmProjects/test_class_example/employee.py
#encoding:utf-8
class Employee():
<|fim_suffix|> self.name = name
self.sex = sex
self.salary = salary
def give_raise(self):
222<|fim_middle|> def __int__(self,name,sex,salary):
| code_fim | easy | {
"lang": "python",
"repo": "cathyxiao/selenium_practice",
"path": "/PycharmProjects/test_class_example/employee.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.title = title
self.authors = authors
self.pub_year = pub_year<|fim_prefix|># repo: IstrazivackiCentarMladih/PythonGUI path: /src/models/book.py
class Book:
"""Class that defines book model."""
<|fim_middle|> def __init__(self, title, authors, pub_year):
| code_fim | easy | {
"lang": "python",
"repo": "IstrazivackiCentarMladih/PythonGUI",
"path": "/src/models/book.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IstrazivackiCentarMladih/PythonGUI path: /src/models/book.py
class Book:
"""Class that defines book model."""
<|fim_suffix|> self.title = title
self.authors = authors
self.pub_year = pub_year<|fim_middle|> def __init__(self, title, authors, pub_year):
| code_fim | easy | {
"lang": "python",
"repo": "IstrazivackiCentarMladih/PythonGUI",
"path": "/src/models/book.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> source = schema.Choice(title=_('Source'),
vocabulary='raptus.mailcone.mails.mailattributes',
required=True)<|fim_prefix|># repo: mailcone/mailcone-google-svn-dump path: /mailcone/project/raptus.mailcone.rules_regex/trunk/raptus/mailcone/rules_rege... | code_fim | hard | {
"lang": "python",
"repo": "mailcone/mailcone-google-svn-dump",
"path": "/mailcone/project/raptus.mailcone.rules_regex/trunk/raptus/mailcone/rules_regex/interfaces.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mailcone/mailcone-google-svn-dump path: /mailcone/project/raptus.mailcone.rules_regex/trunk/raptus/mailcone/rules_regex/interfaces.py
from zope import schema
from zope import interface
from zope import component
from raptus.mailcone.rules_regex import _
from raptus.mailcone.rules import interfac... | code_fim | hard | {
"lang": "python",
"repo": "mailcone/mailcone-google-svn-dump",
"path": "/mailcone/project/raptus.mailcone.rules_regex/trunk/raptus/mailcone/rules_regex/interfaces.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class IRegexItem(interfaces.IConditionItem):
""" Interface for regex match filter
"""
regex = schema.TextLine(title=_('Regex'),
required=True,
description=_('a regular expression'))
source = schema.Choice(title=_('Source'),... | code_fim | hard | {
"lang": "python",
"repo": "mailcone/mailcone-google-svn-dump",
"path": "/mailcone/project/raptus.mailcone.rules_regex/trunk/raptus/mailcone/rules_regex/interfaces.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FrankLee94/ECOC2017 path: /decision_tree.py
#!usr/bin/env python
#-*- coding:utf-8 -*-
# this model is for decision tree
# objective: To cluster different service
# JialongLi 2017/03/18
import re
import os
import sys
import pickle
import copy
import random
import pydotplus
USE... | code_fim | hard | {
"lang": "python",
"repo": "FrankLee94/ECOC2017",
"path": "/decision_tree.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(feature_train[0]) != 7:
print 'feature wrong'
category_predict = ['FFF' for i in range(len(feature_test))]
for i in range(len(feature_train)):
sample = feature_train[i]
user_id = sample[0]
hour = sample[-2]
date = sample[-1]
if date == 0: # 0 means it is Sunday and should ... | code_fim | hard | {
"lang": "python",
"repo": "FrankLee94/ECOC2017",
"path": "/decision_tree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>train_size = 89
valid_size = 10
valid_dataset, valid_labels, train_dataset, train_labels = merge_datasets(
train_datasets, train_size, valid_size)
# _, _, test_dataset, test_labels = merge_datasets(test_datasets, test_size)
print('Training:', train_dataset.shape, train_labels.shape)
print('V... | code_fim | hard | {
"lang": "python",
"repo": "HelloJahid/Python-Toolkit",
"path": "/Preprocessing/1_prepare_data.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> num_images = 0
for image_index, image in enumerate(image_files):
image_file = os.path.join(folder, image)
try:
image_data = (ndimage.imread(image_file).astype(float) - pixel_depth / 2) / pixel_depth
print(image_data.shape)
if image_data.shape != (image_size, image_siz... | code_fim | hard | {
"lang": "python",
"repo": "HelloJahid/Python-Toolkit",
"path": "/Preprocessing/1_prepare_data.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HelloJahid/Python-Toolkit path: /Preprocessing/1_prepare_data.py
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import tarfile
import tensorflow as tf
from IPython.display import display, Image
from scipy import ndimage
fro... | code_fim | hard | {
"lang": "python",
"repo": "HelloJahid/Python-Toolkit",
"path": "/Preprocessing/1_prepare_data.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vinuchandrappan/100-days-of-code path: /day-2/exercise.py
two_digit_number=input("Type a two dig<|fim_suffix|>er[0]
second_digit=two_digit_number[1]
print(int(first_digit)+int(second_digit))<|fim_middle|>it number: ")
first_digit=two_digit_numb | code_fim | easy | {
"lang": "python",
"repo": "vinuchandrappan/100-days-of-code",
"path": "/day-2/exercise.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>er[0]
second_digit=two_digit_number[1]
print(int(first_digit)+int(second_digit))<|fim_prefix|># repo: vinuchandrappan/100-days-of-code path: /day-2/exercise.py
two_digit_number=input("Type a two dig<|fim_middle|>it number: ")
first_digit=two_digit_numb | code_fim | easy | {
"lang": "python",
"repo": "vinuchandrappan/100-days-of-code",
"path": "/day-2/exercise.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lancekindle/gitTA path: /hooks/pre-push
#!/usr/bin/env python
# https://github.com/git/git/blob/master/Documentation/githooks.txt#L181
# This hook is called by 'git push' and can be used to prevent a push from taking
# place. The hook is called with two parameters which provide the name and
# l... | code_fim | medium | {
"lang": "python",
"repo": "lancekindle/gitTA",
"path": "/hooks/pre-push",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># refs/heads/master 67890 refs/heads/foreign 12345
# although the full, 40-character SHA-1s would be supplied. If the foreign ref
# does not yet exist the `<remote SHA-1>` will be 40 `0`. If a ref is to be
# deleted, the `<local ref>` will be supplied as `(delete)` and the `<local
# SHA-1>` will be ... | code_fim | medium | {
"lang": "python",
"repo": "lancekindle/gitTA",
"path": "/hooks/pre-push",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JohnStokes228/home_scraping_project path: /HousingPriceScraper/HousingPriceScraper/functions/menus.py
"""
contains generic code for use in main menus. currently this is a function which turns dictionaries of functions
into a menu. I envision any further menu functions being stored here so don't e... | code_fim | hard | {
"lang": "python",
"repo": "JohnStokes228/home_scraping_project",
"path": "/HousingPriceScraper/HousingPriceScraper/functions/menus.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> :return: defaults.json is updated
"""
with open('HousingPriceScraper/HousingPriceScraper/configs/input_urls/defaults.json') as default_urls_json:
default_dict = json.load(default_urls_json)
with open('HousingPriceScraper/HousingPriceScraper/configs/input_urls/recent_urls.json') as ... | code_fim | hard | {
"lang": "python",
"repo": "JohnStokes228/home_scraping_project",
"path": "/HousingPriceScraper/HousingPriceScraper/functions/menus.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jtrner/maya_script path: /Adbrower/adb_tools/Tool__MultiSkin.py
mainBox.addWidget(self.scroll_layout)
self.setLayout(self.mainBox)
self.scroll_layout.setContentsMargins(0, 0, 0, 0)
self.scroll_layout.setWidgetResizable(True)
self.scroll_layout.setFrameStyle(QtWidg... | code_fim | hard | {
"lang": "python",
"repo": "jtrner/maya_script",
"path": "/Adbrower/adb_tools/Tool__MultiSkin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if type == 'mesh':
[root.setExpanded(False) for root in self.roots]
elif type == 'shape':
[shape.setExpanded(False) for shape in self.QtShapes]
elif type == 'skin cluster':
[sclus.setExpanded(False) for sclus in self.QTClusters]
def expandTr... | code_fim | hard | {
"lang": "python",
"repo": "jtrner/maya_script",
"path": "/Adbrower/adb_tools/Tool__MultiSkin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jtrner/maya_script path: /Adbrower/adb_tools/Tool__MultiSkin.py
= Adbrower.PATH_WINDOW_INIT + 'AppData/Roaming'
PATH_LINUX = Adbrower.PATH_LINUX_INIT
FOLDER_NAME = Adbrower.FOLDER_NAME_INIT
ICONS_FOLDER = Adbrower.ICONS_FOLDER_INIT
YELLOW = '#ffe100'
ORANGE = '#fd651d'
GREEN = '#597A59'
DARKRED ... | code_fim | hard | {
"lang": "python",
"repo": "jtrner/maya_script",
"path": "/Adbrower/adb_tools/Tool__MultiSkin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: drie/pullproxy path: /demo_fileserver.py
#!/usr/bin/env python
import argparse
import http.server
import os
class SimpleHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
<|fim_suffix|>
parser = argparse.ArgumentParser()
parser.add_argument('port', action='store',
# d... | code_fim | medium | {
"lang": "python",
"repo": "drie/pullproxy",
"path": "/demo_fileserver.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>parser = argparse.ArgumentParser()
parser.add_argument('port', action='store',
# default=8000, type=int,
default=int(os.environ.get("PORT", "8000")), type=int,
nargs='?',
help='Specify alternate port [default: 8000]')
args = p... | code_fim | medium | {
"lang": "python",
"repo": "drie/pullproxy",
"path": "/demo_fileserver.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>root',
'/store/mc/Summer12_DR53X/TTH_Inclusive_M-115_8TeV_pythia6/AODSIM/PU_S10_START53_V7A-v1/00000/74013EE7-D90B-E211-B929-001E673970C1.root',
'/store/mc/Summer12_DR53X/TTH_Inclusive_M-115_8TeV_pythia6/AODSIM/PU_S10_START53_V7A-v1/00000/726A8A0A-A90B-E211-86C8-001E67397094.root',
'/... | code_fim | hard | {
"lang": "python",
"repo": "kovalch/TopAnalysis",
"path": "/Configuration/python/Summer12/TTH_Inclusive_M_115_8TeV_pythia6_Summer12_DR53X_PU_S10_START53_V7A_v1_cff.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kovalch/TopAnalysis path: /Configuration/python/Summer12/TTH_Inclusive_M_115_8TeV_pythia6_Summer12_DR53X_PU_S10_START53_V7A_v1_cff.py
ODSIM/PU_S10_START53_V7A-v1/00000/F2F3F436-C70B-E211-A3A4-002481E1511E.root',
'/store/mc/Summer12_DR53X/TTH_Inclusive_M-115_8TeV_pythia6/AODSIM/PU_S10_START... | code_fim | hard | {
"lang": "python",
"repo": "kovalch/TopAnalysis",
"path": "/Configuration/python/Summer12/TTH_Inclusive_M_115_8TeV_pythia6_Summer12_DR53X_PU_S10_START53_V7A_v1_cff.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return board
def deleteBoard(delete, board) :
for delNode in delete :
board[delNode[0]][delNode[1]] = '0'
return board
def solution(m, n, board):
answer = 0
for i in range(len(board)) :
board[i] = list(board[i])
while T... | code_fim | hard | {
"lang": "python",
"repo": "Yu7in/J2KB_Group3_Algorithm_Study_2",
"path": "/Week 7/조예린/프렌트4블록.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> delete = set([])
for y in range(len(board)) :
for x in range(len(board[0])) :
tmp = check22(y, x, board)
if tmp :
delete |= set(tmp)
delete = list(delete)
if not delete : break
... | code_fim | hard | {
"lang": "python",
"repo": "Yu7in/J2KB_Group3_Algorithm_Study_2",
"path": "/Week 7/조예린/프렌트4블록.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yu7in/J2KB_Group3_Algorithm_Study_2 path: /Week 7/조예린/프렌트4블록.py
# 체크는 오른쪽+아래로만 체크합니다.
def check22(y, x, board) :
dirs = [[0,1], [1,0], [1,1]]
ret = [(y,x)]
for d in dirs :
dy, dx = y+d[0], x+d[1]
if not ( (0<=dy<len(board)) and (0<=dx<len(board[0])) and boar... | code_fim | hard | {
"lang": "python",
"repo": "Yu7in/J2KB_Group3_Algorithm_Study_2",
"path": "/Week 7/조예린/프렌트4블록.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.addValidation({'field': field, 'value': features}, self._check_with_featuresValidator)
return self
def checkUserName(self, field, username="unAssigned"):
self.addValidation({'field': field, 'value': username}, self._check_with_userNameValidator)
return self
d... | code_fim | hard | {
"lang": "python",
"repo": "iamdanialkamali/ZanbilBackEndDB",
"path": "/zanbil/validation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def checkOfficer2NationalCode(self, field, code="unAssigned"):
self.addValidation({'field': field, 'value': code}, self._check_with_officer2NationalCodeValidator)
return self
def checkNationalCode(self, field, code="unAssigned"):
self.addValidation({'field': field, 'value'... | code_fim | hard | {
"lang": "python",
"repo": "iamdanialkamali/ZanbilBackEndDB",
"path": "/zanbil/validation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iamdanialkamali/ZanbilBackEndDB path: /zanbil/validation.py
self.invalidFields.append(field)
def getErrors(self):
return self.errors
def validate(self):
for validation in self.validationPipeline:
try:
validation['validator'](val... | code_fim | hard | {
"lang": "python",
"repo": "iamdanialkamali/ZanbilBackEndDB",
"path": "/zanbil/validation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wirasuta/Greedy24 path: /bydifferenceall.py
points_dict = {
'+': 5,
'-': 4,
'*': 3,
'/': 2,
'(': -1,
}
op_list = ['+','-','*','/']
def fitness(x1,op,x2):
#Mengembalikan point dari penyambungan expresi dengan operasi dan bilangan berikutnya
try:
hasil = eval(f... | code_fim | medium | {
"lang": "python",
"repo": "wirasuta/Greedy24",
"path": "/bydifferenceall.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
# bil = [int(c) for c in input("Masukkan 4 angka dipisahkan spasi:").strip().split()]
points = 0
solves = []
for a in range(1,14):
for b in range(1,14):
for c in range(1,14):
for d in range(1,14):
bil = [a,b,c,d]
... | code_fim | medium | {
"lang": "python",
"repo": "wirasuta/Greedy24",
"path": "/bydifferenceall.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NQMTri/NumberTheory path: /RationalReconstruction.py
import sys
import math
from random import randrange
from utilities import *
from EffectiveThueLemma import *
def getZ(value):
s = str(value)
p10 = 1
if s[0] != '0':
p10 = 10
for i in range(1, len(s)):
if s[i] == '.':
break
p10 *=... | code_fim | hard | {
"lang": "python",
"repo": "NQMTri/NumberTheory",
"path": "/RationalReconstruction.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def RationalReconstruction(value, M = int(1e9)):
# check if value is already an integer
if value.is_integer():
return (value, 1)
# get additional 10^x and z array
p10, z = getZ(value)
print(z)
k = len(z)
# 1. Compute n = 10^k and b = sum(z(i-1) * 10^(k-i)) with i = 1..k
n = pow(10, k)
b = 0
... | code_fim | hard | {
"lang": "python",
"repo": "NQMTri/NumberTheory",
"path": "/RationalReconstruction.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> all_subsets.append(all_subsets[idx] + [num])
return all_subsets<|fim_prefix|># repo: BorthakurAyon/Algorithms path: /leetcode/Subsets.py
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
'''
ans = set()
... | code_fim | hard | {
"lang": "python",
"repo": "BorthakurAyon/Algorithms",
"path": "/leetcode/Subsets.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BorthakurAyon/Algorithms path: /leetcode/Subsets.py
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
'''
ans = set()
n = len(nums)
for x, val in enumerate(nums):
for y in range(x + 1, n + 1):
ans.add(frozenset(n... | code_fim | hard | {
"lang": "python",
"repo": "BorthakurAyon/Algorithms",
"path": "/leetcode/Subsets.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: siepkes/envoy-smartos path: /configs/example_configs_validation.py
import pathlib
import sys
import yaml
from google.protobuf.json_format import ParseError
sys.path = [p for p in sys.path if not p.endswith('bazel_tools')]
<|fim_suffix|>
def main():
errors = []
for arg in sys.argv[1:]:... | code_fim | medium | {
"lang": "python",
"repo": "siepkes/envoy-smartos",
"path": "/configs/example_configs_validation.py",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|> if errors:
raise SystemExit(f"ERROR: some configuration files ({len(errors)}) failed to validate")
if __name__ == "__main__":
main()<|fim_prefix|># repo: siepkes/envoy-smartos path: /configs/example_configs_validation.py
import pathlib
import sys
import yaml
from google.protobuf.json_... | code_fim | hard | {
"lang": "python",
"repo": "siepkes/envoy-smartos",
"path": "/configs/example_configs_validation.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|> domain_registration = Fields.StringProperty()
domain_registration_price = Fields.StringProperty()
domain_registration_date = Fields.DateProperty()
domain_expiration_date = Fields.DateProperty()
space_rental_level = Fields.StringProperty()
space_rental_price = Fields.StringProperty(... | code_fim | hard | {
"lang": "python",
"repo": "cwen0708/order-plus",
"path": "/plugins/web_information/models/web_information_model.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cwen0708/order-plus path: /plugins/web_information/models/web_information_model.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created with YooLiang Technology (侑良科技).
# Author: Qi-Liang Wen (温啓良)
# Web: http://www.yooliang.com/
# Date: 2015/7/12.
from monkey import BasicModel
from monkey i... | code_fim | hard | {
"lang": "python",
"repo": "cwen0708/order-plus",
"path": "/plugins/web_information/models/web_information_model.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> manager_company = Fields.StringProperty(default=u"侑良科技")
manager_website = Fields.StringProperty(default="http://")
manager_person = Fields.StringProperty()
manager_telephone = Fields.StringProperty()
manager_mobile = Fields.StringProperty()
manager_email = Fields.StringProperty()
... | code_fim | hard | {
"lang": "python",
"repo": "cwen0708/order-plus",
"path": "/plugins/web_information/models/web_information_model.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> base_dir = '%s/%s' % (config['source_data_dir'], config['source_data_fname']['base'])
base_npy_dir = '%s/%s' % (config['project_data_dir'], 'dataset.npy')
base = vecs2numpy(base_dir, base_npy_dir, config['dataset_type'])
print("提取base")
query_dir = '%s/%s' % (config['source_data_... | code_fim | medium | {
"lang": "python",
"repo": "bianzheng123/R-Classifier-Learn-Hash",
"path": "/procedure/get_base_query_gnd.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bianzheng123/R-Classifier-Learn-Hash path: /procedure/get_base_query_gnd.py
import numpy as np
import faiss
from util import vecs_io, vecs_util
from time import time
import os
'''
提取vecs, 输出numpy文件
'''
def vecs2numpy(fname, new_file_name, file_type, file_len=None):
if file_type... | code_fim | medium | {
"lang": "python",
"repo": "bianzheng123/R-Classifier-Learn-Hash",
"path": "/procedure/get_base_query_gnd.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
fname = '/home/bz/learn-to-hash/data/sift/sift_dataset_unnorm.npy'
new_fname = '/home/bz/learn-to-hash/data/sift/sift_graph_10/test_graph.txt'
get_NN_graph(fname, new_fname, 10)
a = '/home/bz/KaHIP/deploy/graphchecker'
b = '/home/bz/learn-to-hash/data/... | code_fim | hard | {
"lang": "python",
"repo": "bianzheng123/R-Classifier-Learn-Hash",
"path": "/procedure/get_base_query_gnd.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> high -= 1
return arr
*arr, = map(str, input("enter the list of R, G, B").split())
print(group(arr))<|fim_prefix|># repo: ksvr444/Coding path: /groupRGB.py
def group(arr):
low, mid, high = 0, 0, len(arr)-1
while mid <= high:
print(arr)
if arr[mid] == 'R' :
... | code_fim | medium | {
"lang": "python",
"repo": "ksvr444/Coding",
"path": "/groupRGB.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ksvr444/Coding path: /groupRGB.py
def group(arr):
low, mid, high = 0, 0, len(arr)-1
while mid <= high:
print(arr)
if arr[mid]<|fim_suffix|>f arr[mid] == 'G':
mid += 1
else:
arr[high], arr[mid] = arr[mid], arr[high]
high -... | code_fim | medium | {
"lang": "python",
"repo": "ksvr444/Coding",
"path": "/groupRGB.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HotKurry/Twitterbots path: /Pheebo/pivot_tools.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from twython import Twython
import random
tweetStr = "None"
#twitter consumer and access information goes here
api = Twython(apiKey,apiSecret,accessToken,accessTokenSecret)
timeline = ... | code_fim | medium | {
"lang": "python",
"repo": "HotKurry/Twitterbots",
"path": "/Pheebo/pivot_tools.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> for tweet in twitSearch['statuses']:
user = tweet["user"]["screen_name"]
text = tweet['text']
id = str(tweet['id'])
print text.encode('utf-8')
if sString in text.lower():
statushead = "@" + user + " "
if "RT" not in text:
api.create_favorite(id=id)
photo = open('/home/pi/gifs/' + g... | code_fim | hard | {
"lang": "python",
"repo": "HotKurry/Twitterbots",
"path": "/Pheebo/pivot_tools.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>def oneGif(twitSearch, sString, gifName):
for tweet in twitSearch['statuses']:
user = tweet["user"]["screen_name"]
text = tweet['text']
id = str(tweet['id'])
print text.encode('utf-8')
if sString in text.lower():
statushead = "@" + user + " "
if "RT" not in text:
api.create_favorite(i... | code_fim | medium | {
"lang": "python",
"repo": "HotKurry/Twitterbots",
"path": "/Pheebo/pivot_tools.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.rr = pos-self.last_det
self.last_det = pos
from numpy import max
self.n_max = max(self.input_wave[max([pos-400,0]):min([pos+1000,len(self.input_wave)])])*1.1
if self.input_wave[pos]-self.z_cumulative > 0:
self.z_cumulative = float(self.z_cumulative ... | code_fim | hard | {
"lang": "python",
"repo": "jacor-/old_proj_ekg_classifier",
"path": "/old_src/qrsDetector/thresholds/adaptive_exp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getThrs(self, pos):
if pos-self.last_det < self.D0:
return self.n_max
#elif pos-self.last_det < self.D1:
# return self.n_max - (self.n_max-self.z_cumulative)/(self.D1-self.D1)(pos-self.last_det)
else:
from numpy import e
retur... | code_fim | hard | {
"lang": "python",
"repo": "jacor-/old_proj_ekg_classifier",
"path": "/old_src/qrsDetector/thresholds/adaptive_exp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jacor-/old_proj_ekg_classifier path: /old_src/qrsDetector/thresholds/adaptive_exp.py
class thrs:
def __init__(self, input_wave):
from numpy import mod, array, sqrt, dot,median,convolve
self.D0 = 20
self.last_det = 0
self.mu = 0.6
self.a_up = 0.2
... | code_fim | hard | {
"lang": "python",
"repo": "jacor-/old_proj_ekg_classifier",
"path": "/old_src/qrsDetector/thresholds/adaptive_exp.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vinitha33/Miscellaneous path: /Python/Day16/Ques8.py
def long_alpha(str1):
list1 = []
list2 = ""
maxi = 0
j = 0
for i in range(len(str1)):
if i == 0:
list2 += str1[i]
elif ord(str1[i - 1]) <= ord(str1[i]):
list2 += str1[i]
... | code_fim | medium | {
"lang": "python",
"repo": "vinitha33/Miscellaneous",
"path": "/Python/Day16/Ques8.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ist1[i]):
maxi = len(list1[i])
j = i
return list1[j]
str1 = "abcaklmoeeffd"
res = long_alpha(str1)
print(res)<|fim_prefix|># repo: vinitha33/Miscellaneous path: /Python/Day16/Ques8.py
def long_alpha(str1):
list1 = []
list2 = ""
maxi = 0
j = 0
f... | code_fim | hard | {
"lang": "python",
"repo": "vinitha33/Miscellaneous",
"path": "/Python/Day16/Ques8.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> -> Tuple[List[T], List[T]]: ...<|fim_prefix|># repo: giannitedesco/plinn path: /plinn/_partition.pyi
from typing import List, Any, Callable, Iterable, TypeVar, Tuple
T = TypeVar('T')
<|fim_middle|>def partition(pred: Callable[[T], bool], it: Iterable[T]) \
| code_fim | medium | {
"lang": "python",
"repo": "giannitedesco/plinn",
"path": "/plinn/_partition.pyi",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: giannitedesco/plinn path: /plinn/_partition.pyi
from typing import List, Any, Callable, Iterable, TypeVar, Tuple
<|fim_suffix|> -> Tuple[List[T], List[T]]: ...<|fim_middle|>T = TypeVar('T')
def partition(pred: Callable[[T], bool], it: Iterable[T]) \
| code_fim | medium | {
"lang": "python",
"repo": "giannitedesco/plinn",
"path": "/plinn/_partition.pyi",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lynx-r/pizza-test path: /apps/orders/views.py
from django.views.generic import TemplateView, FormView, CreateView, ListView
from .models import Order
from .form import OrderForm
<|fim_suffix|>class OrderCreateView(CreateView):
template_name = 'orders/form.html'
form_class = OrderForm
... | code_fim | medium | {
"lang": "python",
"repo": "lynx-r/pizza-test",
"path": "/apps/orders/views.py",
"mode": "psm",
"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.