text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: scheuclu/atom_class path: /exam/1_three-dimensional_atomic_system/dump/phasetrans/temp74_7500.py
7e-05 0.248359 0.496608
609 1 0.00233759 0.363905 0.488668
634 1 0.825304 0.436673 0.499594
538 1 0.809064 0.0608729 0.497663
530 1 0.560021 0.0571797 0.49212
38 1 0.182356 0.189844 -0.00133514
61 1 0... | code_fim | hard | {
"lang": "python",
"repo": "scheuclu/atom_class",
"path": "/exam/1_three-dimensional_atomic_system/dump/phasetrans/temp74_7500.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wenxiaobao007/- path: /02.代码/task_3/task3-1_3.py
'''
根据会员用户的兴趣特征,构建如下字段:
购物季节:春天、夏天、秋天、冬天
购物时间段:凌晨、上午、中午、下午、晚上
构建的特征保存在“task3_3.csv”文件中
'''
import pandas as pd
<|fim_suffix|>#购物时间段
task1['购物时间段'] = pd.cut(task1['消费时间'].dt.hour,
bins=[0,6,11,14,18,24],
... | code_fim | hard | {
"lang": "python",
"repo": "wenxiaobao007/-",
"path": "/02.代码/task_3/task3-1_3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#购物季节
task1['消费时间'] = pd.to_datetime(task1['消费时间'])
task1['季节'] = pd.cut(task1['消费时间'].dt.month,
bins=[0,2,5,8,11,13],
labels=['冬天','春天','夏天','秋天','冬'])
task1.loc[task1['季节']=='冬','季节'] = '冬天'
df = task1[['会员卡号','季节']].groupby(by='会员卡号').max()
data = pd.mer... | code_fim | medium | {
"lang": "python",
"repo": "wenxiaobao007/-",
"path": "/02.代码/task_3/task3-1_3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#购物时间段
task1['购物时间段'] = pd.cut(task1['消费时间'].dt.hour,
bins=[0,6,11,14,18,24],
labels=['凌晨','上午','中午','下午','晚上'])
task1.drop(task1[task1['购物时间段'].isnull().values==True].index,inplace=True)
df1 = task1[['会员卡号','购物时间段']].groupby(by='会员卡号').max()
data = pd... | code_fim | hard | {
"lang": "python",
"repo": "wenxiaobao007/-",
"path": "/02.代码/task_3/task3-1_3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: harsh376/crawler path: /test/unit/test_pagerank.py
from test.basetestcase import TestCase
from pagerank import get_page_rank_scores
<|fim_suffix|> result = get_page_rank_scores(
[(1, 2), (2, 4), (4, 3), (3, 1), (3, 2)],
)
self.assertEqual(result, {
... | code_fim | hard | {
"lang": "python",
"repo": "harsh376/crawler",
"path": "/test/unit/test_pagerank.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = get_page_rank_scores([(1, 2), (2, 4), (4, 3)])
self.assertEqual(result, {
1: 0.05000000000000001,
2: 0.092500000000000027,
4: 0.12862500000000002,
})
result = get_page_rank_scores(
[(1, 2), (2, 4), (4, 3), (3, 1), (3... | code_fim | hard | {
"lang": "python",
"repo": "harsh376/crawler",
"path": "/test/unit/test_pagerank.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>1 0.942625
1011 1 0.56372 0.381925 0.939045
1005 1 0.378952 0.374161 0.874435
987 1 0.80732 0.250883 0.939982
956 1 0.745169 0.188023 0.932163
988 1 0.754402 0.312891 0.937019
986 1 0.811924 0.315569 0.871033
982 1 0.693408 0.312968 0.87302
954 1 0.809884 0.184073 0.87133
983 1 0.693744 0.257463 0.934125
... | code_fim | hard | {
"lang": "python",
"repo": "scheuclu/atom_class",
"path": "/exam/1_three-dimensional_atomic_system/dump/phasetrans/temp78_1500.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>0.133862
1222 1 0.19432 0.826553 0.131034
1225 1 0.25404 0.753408 0.124971
1226 1 0.322651 0.823909 0.12766
1035 1 0.309427 0.506118 0.0677806
1072 1 0.374717 0.690148 0.0654375
1103 1 0.436911 0.752091 0.0627227
1104 1 0.375894 0.808795 0.0627334
1198 1 0.437986 0.685415 0.129722
1229 1 0.370975 0.750711... | code_fim | hard | {
"lang": "python",
"repo": "scheuclu/atom_class",
"path": "/exam/1_three-dimensional_atomic_system/dump/phasetrans/temp78_1500.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scheuclu/atom_class path: /exam/1_three-dimensional_atomic_system/dump/phasetrans/temp78_1500.py
-0.000917952 0.0555098 0.559262
544 1 0.880443 0.064396 0.559048
575 1 0.936945 0.129905 0.562074
670 1 0.934666 0.0610092 0.615348
701 1 0.873932 0.123083 0.625542
557 1 0.374999 0.128586 0.504603
9... | code_fim | hard | {
"lang": "python",
"repo": "scheuclu/atom_class",
"path": "/exam/1_three-dimensional_atomic_system/dump/phasetrans/temp78_1500.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> global SNP,TIK,TWR,EML,INS,eml
headers = {'cookie':'mid=YQvmcwAEAAFVrBezgjwUhwEQuv3c; ig_did=6C10D114-3B6D-4E5E-9E35-5E808661CBAD; ig_nrcb=1; shbid="13126\05446165248972\0541660151679:01f76272a193b960d6a59109693b94e7ceb63f379a095665f9e6588098e95e4d3c3a7ecc"; shbts="1628615679\05446165248972\054166015167... | code_fim | hard | {
"lang": "python",
"repo": "vv1ck/Who-is-this",
"path": "/Who-is-this.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vv1ck/Who-is-this path: /Who-is-this.py
):
with PRNT:
print(*a, **b)
def searched():
global SNP,TIK,TWR,EML,INS,SCLD,NON,ACP,VIM,NEapi,DARK,eml
telegram_vv1ck(f"[*] Email : {eml} \n\n{EML}\n{SNP}\n{TWR}\n{TIK}\n{INS}\n{SCLD}\n{NON}\n{ACP}\n{VIM}\n{NEapi}\n{DARK}")
def EMdark():
global SNP,T... | code_fim | hard | {
"lang": "python",
"repo": "vv1ck/Who-is-this",
"path": "/Who-is-this.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vv1ck/Who-is-this path: /Who-is-this.py
global SNP,TIK,TWR,EML,INS,SCLD,NON,ACP,VIM,NEapi,DARK,eml
telegram_vv1ck(f"[*] Email : {eml} \n\n{EML}\n{SNP}\n{TWR}\n{TIK}\n{INS}\n{SCLD}\n{NON}\n{ACP}\n{VIM}\n{NEapi}\n{DARK}")
def EMdark():
global SNP,TIK,TWR,EML,INS,SCLD,NON,ACP,VIM,NEapi,DARK,eml
t... | code_fim | hard | {
"lang": "python",
"repo": "vv1ck/Who-is-this",
"path": "/Who-is-this.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if longest_palindrome(s) in ["bb"]:
self.assertEqual(1,1)
else:
self.assertEqual(1,2)
def test4(self):
s = "aaabaaaa"
if longest_palindrome(s) in ["aaabaaa"]:
self.assertEqual(1,1)
else:
self.assertEqual(1,2)
... | code_fim | hard | {
"lang": "python",
"repo": "VimanyuAgg/code-morsels",
"path": "/leetcode/tests/test_largest_palindrome.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test2(self):
s = "aaaaaab"
if longest_palindrome(s) in ["aaaaaa"]:
self.assertEqual(1,1)
else:
self.assertEqual(1,2)
def test3(self):
s = "abcdbb"
if longest_palindrome(s) in ["bb"]:
self.assertEqual(1,1)
els... | code_fim | hard | {
"lang": "python",
"repo": "VimanyuAgg/code-morsels",
"path": "/leetcode/tests/test_largest_palindrome.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VimanyuAgg/code-morsels path: /leetcode/tests/test_largest_palindrome.py
import unittest
from leetcode.longest_palindrome import longest_palindromic_substring_dp as longest_palindrome
import leetcode
class TestLongestPalindrome(unittest.TestCase):
def test1(self):
s = "babad"
... | code_fim | hard | {
"lang": "python",
"repo": "VimanyuAgg/code-morsels",
"path": "/leetcode/tests/test_largest_palindrome.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FrankYao44/AnsycEventHandler path: /PandoraHub/code_recode.py
from functools import reduce
SEPARATOR = '^#$'
def code(function_name, kwargs_dict):
<|fim_suffix|> splited_list = coded_str.split(SEPARATOR)
function_name = splited_list[0]
if len(splited_list) == 1:
return functi... | code_fim | medium | {
"lang": "python",
"repo": "FrankYao44/AnsycEventHandler",
"path": "/PandoraHub/code_recode.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> splited_list = coded_str.split(SEPARATOR)
function_name = splited_list[0]
if len(splited_list) == 1:
return function_name, {}
else:
kwargs_dict = {}
for i in range((len(splited_list)-1)/2):
kwargs_dict[splited_list[2*i]] = splited_list[2*i + 1]
r... | code_fim | medium | {
"lang": "python",
"repo": "FrankYao44/AnsycEventHandler",
"path": "/PandoraHub/code_recode.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: erbogart28/CS-Capstone-Final path: /website/scraper/__init__.py
from threading import Thread
from queue import Queue
__all__ = ['ThreadPool', 'season_map', 'Course', 'CSCurriculumKey', 'ISCurriculumKey']
class CSCurriculumKey:
INTRODUCTORY = 0
FOUNDATION = 1
SOFTWARE_AND_SYSTE... | code_fim | hard | {
"lang": "python",
"repo": "erbogart28/CS-Capstone-Final",
"path": "/website/scraper/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.subject = subject
self.num = num
self.name = name
self.description = None
self.prerequisites = None
self.history = None
self.priority = None
def __repr__(self):
return "<Course subject={}, num={}, name={}, prerequisites={},... | code_fim | hard | {
"lang": "python",
"repo": "erbogart28/CS-Capstone-Final",
"path": "/website/scraper/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: meme-adviser/MemeAdviser path: /constants.py
class Thresholds:
submission = 800
comment = 1000
pm = 1000
class Messages:
comment = "I **strongly advise** investing! This meme hit #1 on [hot](https://www.reddit.com/r/memeeconomy/hot/) within **{min}**, at **{upvotes}** upvotes. I... | code_fim | hard | {
"lang": "python",
"repo": "meme-adviser/MemeAdviser",
"path": "/constants.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ily market updates.\n***\n^(Beep boop, I'm a bot | [Contact me](https://www.reddit.com/message/compose?to=hypnotic-hippo&subject=MemeAdviser))"
submission = "This meme just hit #1 on MemeEconomy with only {upvotes} upvotes! Invest now and break even at {break_even} upvotes"
pm = "[This meme](https... | code_fim | hard | {
"lang": "python",
"repo": "meme-adviser/MemeAdviser",
"path": "/constants.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BlackSwanBay/sabayon-distro path: /app-misc/calamares-sabayon-base-modules/files/calamares-sabayon-base-modules/sabayon/main.py
#!/usr/bin/env python3
# encoding: utf-8
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Calamares is free software: you can redistribute ... | code_fim | medium | {
"lang": "python",
"repo": "BlackSwanBay/sabayon-distro",
"path": "/app-misc/calamares-sabayon-base-modules/files/calamares-sabayon-base-modules/sabayon/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Grub set background
libcalamares.utils.chroot_call(['mkdir', '-p', '/boot/grub/'])
libcalamares.utils.chroot_call(['cp', '-f', '/usr/share/grub/default-splash.png', '/boot/grub/default-splash.png'])
return None<|fim_prefix|># repo: BlackSwanBay/sabayon-distro path: /app-misc/calamares... | code_fim | medium | {
"lang": "python",
"repo": "BlackSwanBay/sabayon-distro",
"path": "/app-misc/calamares-sabayon-base-modules/files/calamares-sabayon-base-modules/sabayon/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Panos1221/Python-Lab path: /askhsh9.py
#-*-coding: utf-8-*-
import sys
f = open(sys.argv[1], "r")
thes = f.read()
f.close()
thesi = 0
mnhmh = [0]
thesimnhm = 0
while thesi < len(thes):
if thes[thesi] == ">":
thesimnhm += 1
if len(mnhmh) <= thesimnhm:
mnhmh.append(0)
... | code_fim | hard | {
"lang": "python",
"repo": "Panos1221/Python-Lab",
"path": "/askhsh9.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif thes[thesi] == "]":
if mnhmh[thesimnhm] != 0:
countClosed = 0
thesi -= 1
while thesi >= 0:
if thes[thesi] == "[" and countClosed == 0:
break
elif thes[thesi] == "]":
countClosed += 1
elif thes[thesi] == "[":
countClosed -= 1
thesi -= 1
thesi +... | code_fim | hard | {
"lang": "python",
"repo": "Panos1221/Python-Lab",
"path": "/askhsh9.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif thes[thesi] == ".":
print(chr(mnhmh[thesimnhm]), end="")
elif thes[thesi] == ",":
inp = input("Input requested: ")
mnhmh[thesimnhm] = ord( inp[0] )
elif thes[thesi] == "[":
if mnhmh[thesimnhm] == 0:
countOpened = 0
thesi += 1
while thesi < len(thes):
if thes[... | code_fim | medium | {
"lang": "python",
"repo": "Panos1221/Python-Lab",
"path": "/askhsh9.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: entrekid/algorithms path: /basic/2693/nth.py
test_case = int(input())
for _ in rang<|fim_suffix|>(reverse = True)
print(num_list[2])<|fim_middle|>e(test_case):
num_list = list(map(int, input().split()))
num_list.sort | code_fim | medium | {
"lang": "python",
"repo": "entrekid/algorithms",
"path": "/basic/2693/nth.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>(reverse = True)
print(num_list[2])<|fim_prefix|># repo: entrekid/algorithms path: /basic/2693/nth.py
test_case = int(input())
for _ in range(test_case):
num_list = list(map(i<|fim_middle|>nt, input().split()))
num_list.sort | code_fim | easy | {
"lang": "python",
"repo": "entrekid/algorithms",
"path": "/basic/2693/nth.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> redirect_uri = get_redirect_uri()
sign_in_url = get_signin_url(redirect_uri)
context = {'sign_in_url': sign_in_url}
return render_template('login.html', **context)
@app.route('/get_token')
def token():
# receive the authorization code
auth_code = request.args.get('code')
if ge... | code_fim | medium | {
"lang": "python",
"repo": "scign/graph-auth",
"path": "/app/routes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scign/graph-auth path: /app/routes.py
from flask import render_template, url_for, request, redirect, session
from app import app
from app.authhelper import get_signin_url, get_token_from_code, access_token_is_valid
from app.graphapi import get_me
def get_redirect_uri():
'''
Return the l... | code_fim | hard | {
"lang": "python",
"repo": "scign/graph-auth",
"path": "/app/routes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alan-turing-institute/plark_ai_public path: /Components/plark-game/plark_game/agents/basic/nn_agent.py
from plark_game.classes.agent import Agent
from plark_game.classes.observation import Observation
import numpy as np
import torch
import datetime
import os
import json
import csv
#One should ... | code_fim | hard | {
"lang": "python",
"repo": "alan-turing-institute/plark_ai_public",
"path": "/Components/plark-game/plark_game/agents/basic/nn_agent.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.nn = torch.nn.Sequential(*layers).double()
#Takes a list, passes through the network and returns a list
def _forward_pass(self, x):
x = torch.tensor(x, dtype=torch.float64)
net_out = self.nn.forward(x)
return net_out.tolist()
#Randomly sample action from ... | code_fim | hard | {
"lang": "python",
"repo": "alan-turing-institute/plark_ai_public",
"path": "/Components/plark-game/plark_game/agents/basic/nn_agent.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> metadata['num_inputs'] = self.num_inputs
metadata['num_hidden_layers'] = self.num_hidden_layers
metadata['neurons_per_hidden_layer'] = self.neurons_per_hidden_layer
file_path = dir_path + '/metadata.json'
with open(file_path, 'w') as outfile:
json.dump... | code_fim | hard | {
"lang": "python",
"repo": "alan-turing-institute/plark_ai_public",
"path": "/Components/plark-game/plark_game/agents/basic/nn_agent.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>za
liczba = int(input('Podaj liczbę: '))
print("Liczba pierwsza", pierwsza(liczba))<|fim_prefix|># repo: jasonj2333/python8 path: /cmi/czy_pierwsza.py
def pierwsza(liczba):
if (liczba < 2):
return False
else:
i = 2
while(i*i<=liczba):
if(liczba%i==0):
... | code_fim | medium | {
"lang": "python",
"repo": "jasonj2333/python8",
"path": "/cmi/czy_pierwsza.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jasonj2333/python8 path: /cmi/czy_pierwsza.py
def pierwsza(liczba):
if (liczba < 2):
return False
else:
i<|fim_suffix|>za
liczba = int(input('Podaj liczbę: '))
print("Liczba pierwsza", pierwsza(liczba))<|fim_middle|> = 2
while(i*i<=liczba):
if(liczba%i... | code_fim | medium | {
"lang": "python",
"repo": "jasonj2333/python8",
"path": "/cmi/czy_pierwsza.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__=='__main__':
a=int(input())
b=int(input())
print(a//b)
print(a/b)<|fim_prefix|># repo: Rohanpatki1995/HackerRank path: /04_Python-Division.py
'''
Task
The provided code stub reads two integers, a and b, from STDIN.
Add logic to print two lines. The first line should contain... | code_fim | easy | {
"lang": "python",
"repo": "Rohanpatki1995/HackerRank",
"path": "/04_Python-Division.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rohanpatki1995/HackerRank path: /04_Python-Division.py
'''
Task
The provided code stub reads two integers, a and b, from STDIN.
<|fim_suffix|>
if __name__=='__main__':
a=int(input())
b=int(input())
print(a//b)
print(a/b)<|fim_middle|>Add logic to print two lines. The first line ... | code_fim | hard | {
"lang": "python",
"repo": "Rohanpatki1995/HackerRank",
"path": "/04_Python-Division.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class F5CcclResourceUpdateError(F5CcclError):
"""General resource update failure."""
class F5CcclResourceDeleteError(F5CcclError):
"""General resource delete failure."""
class F5CcclApplyConfigError(F5CcclError):
"""General config deployment failure."""
class F5CcclCacheRefreshError(F5C... | code_fim | hard | {
"lang": "python",
"repo": "f5devcentral/f5-cccl",
"path": "/f5_cccl/exceptions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def search(self, *args, **kwargs):
triples = get_all_triples(self.g, self.data)
triple = list()
print(triples)
for item in triples:
if str(item[0]) == self.id_leb.get():
triple = item
break
print(triple)
self... | code_fim | hard | {
"lang": "python",
"repo": "mzhirko/ontology-editor",
"path": "/Update.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mzhirko/ontology-editor path: /Update.py
# import all the modules
from tkinter import *
import tkinter.messagebox
import json
from rdflib import Graph, Literal
from app import replace_triple, add_triple, remove_triple, get_all_triples, read_base_json, save_base_json
class Database:
def __i... | code_fim | hard | {
"lang": "python",
"repo": "mzhirko/ontology-editor",
"path": "/Update.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhangzhimin96/Leetcode path: /python_leetcode/sort/mergeSort.py
# 归并排序
def merge_sort_c(data_list, p, q):
"""
递归调用
"""
# 退出条件
if p + 1 >= q: # 只有两个元素的时候退出
return
else:
r = (p + q) // 2 # 中间位置下标
merge_sort_c(data_list, p, r)
merge_sort_c(... | code_fim | medium | {
"lang": "python",
"repo": "zhangzhimin96/Leetcode",
"path": "/python_leetcode/sort/mergeSort.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> while j < q:
tmp.append(data_list[j])
j += 1
# 将 tmp 数据复制到 data_list
# for tmp_index, index in enumerate(range(p, q)):
# data_list[index] = tmp[tmp_index]
for m, n in enumerate(tmp):
data_list[p+m] = tmp[m]
if __name__ == "__main__":
a = [4, 7, 2, 8, 9... | code_fim | hard | {
"lang": "python",
"repo": "zhangzhimin96/Leetcode",
"path": "/python_leetcode/sort/mergeSort.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alex2shiyu/UFlib path: /wanntb/xyz.py
#!/usr/bin/env python
import sys
import numpy as np
from numpy.linalg import inv
z=[-1,<|fim_suffix|>9875, 3.3497967182]]
z1=np.dot(z,a)
x1=np.dot(x,a)
print('z1',z1)
print('x1',x1)<|fim_middle|>1,1]
x=[1,-1,1]
a=[[4.1026463509, 0.0000000000... | code_fim | medium | {
"lang": "python",
"repo": "alex2shiyu/UFlib",
"path": "/wanntb/xyz.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>9875, 3.3497967182]]
z1=np.dot(z,a)
x1=np.dot(x,a)
print('z1',z1)
print('x1',x1)<|fim_prefix|># repo: alex2shiyu/UFlib path: /wanntb/xyz.py
#!/usr/bin/env python
import sys
import numpy as np
from numpy.linalg import inv
z=[-1,<|fim_middle|>1,1]
x=[1,-1,1]
a=[[4.1026463509, 0.0000000000... | code_fim | medium | {
"lang": "python",
"repo": "alex2shiyu/UFlib",
"path": "/wanntb/xyz.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for d in str1:
if str1.index(d) % 2 == 0 :
print(d ,end="")
print(" ",end="")
for x in str1:
if str1.index(x) % 2 ==1:
print(x ,end="")
print()<|fim_prefix|># repo: Yomna-Ashraf/exercises path: /Exercises.py
# -*- coding: utf-8 -*-... | code_fim | medium | {
"lang": "python",
"repo": "Yomna-Ashraf/exercises",
"path": "/Exercises.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yomna-Ashraf/exercises path: /Exercises.py
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 28 18:25:42 2021
@author: win10
"""
<|fim_suffix|>num = int(input())
for i in range(num):
str1 = input()
for d in str1:
if str1.index(d) % 2 == 0 :
print(d ,en... | code_fim | hard | {
"lang": "python",
"repo": "Yomna-Ashraf/exercises",
"path": "/Exercises.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
num = int(input())
for i in range(num):
str1 = input()
for d in str1:
if str1.index(d) % 2 == 0 :
print(d ,end="")
print(" ",end="")
for x in str1:
if str1.index(x) % 2 ==1:
print(x ,end="")
print()<|fim_prefix|># repo:... | code_fim | hard | {
"lang": "python",
"repo": "Yomna-Ashraf/exercises",
"path": "/Exercises.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ankitandel/function.py path: /7h.py
# write a python program to execute a strin<|fim_suffix|>r+=str[count+1]
count=count+1
print(var)<|fim_middle|>g containing python code.
str="ankita"
var=""
b=[]
count=len(str)
while count>0:
va | code_fim | medium | {
"lang": "python",
"repo": "ankitandel/function.py",
"path": "/7h.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ankitandel/function.py path: /7h.py
# write a python program to execute a string containing python code.
str="ankita"
var="<|fim_suffix|>r+=str[count+1]
count=count+1
print(var)<|fim_middle|>"
b=[]
count=len(str)
while count>0:
va | code_fim | easy | {
"lang": "python",
"repo": "ankitandel/function.py",
"path": "/7h.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>"
b=[]
count=len(str)
while count>0:
var+=str[count+1]
count=count+1
print(var)<|fim_prefix|># repo: ankitandel/function.py path: /7h.py
# write a python program to execute a strin<|fim_middle|>g containing python code.
str="ankita"
var=" | code_fim | easy | {
"lang": "python",
"repo": "ankitandel/function.py",
"path": "/7h.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kangly/python3 path: /ch10/simple_webapp.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello from the simple webapp.'
@app.route('/page1')
def page1():
return 'This is page 1.'
@app.route('/page2')
def page2():
<|fim_suffix|>
if __name__ == '... | code_fim | medium | {
"lang": "python",
"repo": "kangly/python3",
"path": "/ch10/simple_webapp.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 'This is page 3.'
if __name__ == '__main__':
app.run(debug=True)<|fim_prefix|># repo: kangly/python3 path: /ch10/simple_webapp.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello from the simple webapp.'
@app.route('/page1')
def page1():
<... | code_fim | medium | {
"lang": "python",
"repo": "kangly/python3",
"path": "/ch10/simple_webapp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@app.route('/page2')
def page2():
return 'This is page 2.'
@app.route('/page3')
def page3():
return 'This is page 3.'
if __name__ == '__main__':
app.run(debug=True)<|fim_prefix|># repo: kangly/python3 path: /ch10/simple_webapp.py
from flask import Flask
app = Flask(__name__)
@app.rout... | code_fim | medium | {
"lang": "python",
"repo": "kangly/python3",
"path": "/ch10/simple_webapp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: almirms/adventofcode path: /2016/day5/main.py
# -*- coding: UTF-8 -*-
import os
import input_file
def contem_pelo_menos_tres_vogais(string):
vogais = ('a', 'e', 'i', 'o', 'u')
vogais_na_string = 0
for vogal in vogais:
vogais_na_string += string.count(vogal)
if vogais_n... | code_fim | hard | {
"lang": "python",
"repo": "almirms/adventofcode",
"path": "/2016/day5/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def allindices(string, sub, listindex=[], offset=0):
i = string.find(sub, offset)
while i >= 0:
listindex.append(i)
i = string.find(sub, i + 1)
return listindex
def encontrar_pares(string_percorrida):
return ["xx"]
def encontrar_indices_pares(string_percorrida):
pa... | code_fim | hard | {
"lang": "python",
"repo": "almirms/adventofcode",
"path": "/2016/day5/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 1122Dipak/PrimeNumberchecker path: /main.py
def primeNumberchecker(num):
number = int(num)
if number > 1:
for i in range(2,number//2):
if number % i == 0:
print("This is not a Prime Number.")
break
else:
print... | code_fim | easy | {
"lang": "python",
"repo": "1122Dipak/PrimeNumberchecker",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>primeNumberchecker(input("Check This Number :"))<|fim_prefix|># repo: 1122Dipak/PrimeNumberchecker path: /main.py
def primeNumberchecker(num):
number = int(num)
if number > 1:
for i in range(2,number//2):
if number % i == 0:
print("This is not a Prime Number.")... | code_fim | easy | {
"lang": "python",
"repo": "1122Dipak/PrimeNumberchecker",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>a):
print(i, end=" ")
input("\n\nAby zakonczyć program, naciśnij Enter")<|fim_prefix|># repo: EdytaBalcerzak/python-for-all path: /04_chapter/Liczenie_petla_for_in.py
#program liczący za użytkownika
pierwsza_liczba = int(input("Podaj pierwszą <|fim_middle|>liczbę"))
druga_liczba = int(input("Podaj d... | code_fim | medium | {
"lang": "python",
"repo": "EdytaBalcerzak/python-for-all",
"path": "/04_chapter/Liczenie_petla_for_in.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EdytaBalcerzak/python-for-all path: /04_chapter/Liczenie_petla_for_in.py
#program liczący za użytkownika
pierwsza_liczba = int(input("Podaj pierwszą <|fim_suffix|>("Co ile mam liczyć?"))
for i in range(pierwsza_liczba, druga_liczba, roznica):
print(i, end=" ")
input("\n\nAby zakonczyć progra... | code_fim | medium | {
"lang": "python",
"repo": "EdytaBalcerzak/python-for-all",
"path": "/04_chapter/Liczenie_petla_for_in.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
if len(sys.argv) != 2:
raise Exception('Usage python Counting_DNA_Nucleotides.py <FolderName>')
if not isfile(join(sys.argv[1])):
countNucleotides(sys.argv[1])
printCounting()
else:
raise Exception('<FolderName> must be a Folder')
if __name_... | code_fim | hard | {
"lang": "python",
"repo": "lmarinl1/HPC-Project-DNA",
"path": "/src/serial/Counting_Proteins.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lmarinl1/HPC-Project-DNA path: /src/serial/Counting_Proteins.py
import sys
from os import listdir
from os.path import isfile, join
from datetime import datetime
# Map declaration this will list all the amino acids with their respective codon
m = {'GCT':'A','GCC':'A','GCA':'A','GCG':'A','CGT':'... | code_fim | hard | {
"lang": "python",
"repo": "lmarinl1/HPC-Project-DNA",
"path": "/src/serial/Counting_Proteins.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Gasheezy/Python path: /Higher_Order_Functions.py
#def write_repeat (message, n):
# for i in range (n):
# print (message)
#write_repeat ("Hello", 5)
def hof_write_repeat (message, n, action):
<|fim_suffix|># Import the logging library
import logging
# Log the output as an error instea... | code_fim | medium | {
"lang": "python",
"repo": "Gasheezy/Python",
"path": "/Higher_Order_Functions.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Import the logging library
import logging
# Log the output as an error instead
hof_write_repeat ("hello", 5, logging.error)<|fim_prefix|># repo: Gasheezy/Python path: /Higher_Order_Functions.py
#def write_repeat (message, n):
# for i in range (n):
# print (message)
#write_repeat ("Hello", 5)... | code_fim | medium | {
"lang": "python",
"repo": "Gasheezy/Python",
"path": "/Higher_Order_Functions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> email = models.EmailField()
class Existencias(models.Model):
pass<|fim_prefix|># repo: adrianglez2203/tuenvio path: /scrapp/models.py
from django.db import models
# Create your models here.
class Producto(models.Model):
producto = models.CharField(max_length=25)
url_de_busqueda = models.... | code_fim | easy | {
"lang": "python",
"repo": "adrianglez2203/tuenvio",
"path": "/scrapp/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adrianglez2203/tuenvio path: /scrapp/models.py
from django.db import models
# Create your models here.
class Producto(models.Model):
producto = models.CharField(max_length=25)
url_de_busqueda = models.URLField()
def __str__(self):
<|fim_suffix|> email = models.EmailField()
class E... | code_fim | easy | {
"lang": "python",
"repo": "adrianglez2203/tuenvio",
"path": "/scrapp/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # the generator g is pre defined as 2
g = 2
# The shared prime is a Safe prime, decided by 2q+1, where q is a Sophie Germain prime
sharedPrime = 719
print("The shared prime is ", sharedPrime, '. Which gives us the cyclic group: Z*', sharedPrime)
print("The generator (g) is ", g)
... | code_fim | hard | {
"lang": "python",
"repo": "froydis98/DAT510",
"path": "/Assignment2/SecureCommunication.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: froydis98/DAT510 path: /Assignment2/SecureCommunication.py
from SDES import SDES, frombits
# Creates the public key, which is the first part of diffie-hellman key exchange
def publicKey(privateKey, g, prime):
return g**privateKey % prime
# Uses the public key to the other part and your priv... | code_fim | hard | {
"lang": "python",
"repo": "froydis98/DAT510",
"path": "/Assignment2/SecureCommunication.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>e + two
elif a == "р":
re = "10010"
st = st + re + two
elif a == "с":
sss = "10011"
st = st + sss + two
elif a == "т":
ttt = "10100"
st = st + ttt + two
elif a == "у":
uuu = "10101"
... | code_fim | hard | {
"lang": "python",
"repo": "Simka-Team/secret",
"path": "/cryptographer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Simka-Team/secret path: /cryptographer.py
# Version 1.1.0
asd = "000"
st = "000"
two = "2"
lan = input("Choose your language (English, Russian):")
if lan == "English":
print("This program encrypts one letter in English into binary")
print("To end encryption write command end")
print("... | code_fim | hard | {
"lang": "python",
"repo": "Simka-Team/secret",
"path": "/cryptographer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, name):
self.title = title
self.name = name<|fim_prefix|># repo: fdanmon/bd2-lab-demo path: /app/models/category.py
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Cate... | code_fim | medium | {
"lang": "python",
"repo": "fdanmon/bd2-lab-demo",
"path": "/app/models/category.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fdanmon/bd2-lab-demo path: /app/models/category.py
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Category(Base):
__tablename__ = 'categories'
<|fim_suffix|> self.title = title
... | code_fim | medium | {
"lang": "python",
"repo": "fdanmon/bd2-lab-demo",
"path": "/app/models/category.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kianannchan/Data-Anoymonous-and-Cleaning path: /view.py
import controller
import interface
import time
import os
# ini class constructor
obj = controller.Model()
interfaceObj = interface.interfaceClass()
# load Interface obj
window = interfaceObj.load()
def update_list(element, new_val):
w... | code_fim | hard | {
"lang": "python",
"repo": "kianannchan/Data-Anoymonous-and-Cleaning",
"path": "/view.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # file meant for decryption process
if (obj.mode == 2):
obj.setPassword('') # override default_password
window.FindElement('remove_en').Update(disabled=True)
window.FindElement('add_en').Update(disabled=True)
window.Fi... | code_fim | hard | {
"lang": "python",
"repo": "kianannchan/Data-Anoymonous-and-Cleaning",
"path": "/view.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> n_rules = {}
for rule in rules:
splitted_rule = re.sub('[\{\}]', '', rule)
splitted_rule = re.sub('=>', ',', splitted_rule).split(',')
for index, item in enumerate(splitted_rule):
splitted_rule[index] = item.split('=')
n_rules[rule] = splitted_rule
r... | code_fim | medium | {
"lang": "python",
"repo": "JarnDev/daily-challenges",
"path": "/hackerrank/Machine Learning/Census/census.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Write your code here
table = normalize_csv('Census/census.csv')
rules_norm = normalize_rules(rules)
for rule in rules_norm:
rules_norm[rule] = measure_rule(rules_norm[rule], table)
sorted_rules = sorted(rules_norm.items(), key=lambda kv: (kv[1], kv[0]), reverse=True)
ret... | code_fim | hard | {
"lang": "python",
"repo": "JarnDev/daily-challenges",
"path": "/hackerrank/Machine Learning/Census/census.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JarnDev/daily-challenges path: /hackerrank/Machine Learning/Census/census.py
#!/bin/python3
import math
import os
import random
import re
import sys
import json
import pandas as pd
RULES = ['{native-country=United-States,capital-gain=None}=>{capital-loss=None}',
'{capital-gain=None,capital-los... | code_fim | hard | {
"lang": "python",
"repo": "JarnDev/daily-challenges",
"path": "/hackerrank/Machine Learning/Census/census.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args.d == "cifar":
if args.adv:
# load adversarial
x_adv = np.load('./adv/adv_cifar.npy')
x_train = x_train.astype("float32")
x_train = (x_train / 255.0) - (1.0 - CLIP_MAX)
x_test = x_test.astype("float32")
x_test = (... | code_fim | hard | {
"lang": "python",
"repo": "hvdthong/sadl",
"path": "/confidence_score_test_vs_adv.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hvdthong/sadl path: /confidence_score_test_vs_adv.py
from box_plot import mnist_get_correct_and_incorrect_test_images
from keras.datasets import mnist, cifar10
from keras.models import load_model, Model
import argparse
from keras import utils
import numpy as np
from utils import load_file, load_a... | code_fim | hard | {
"lang": "python",
"repo": "hvdthong/sadl",
"path": "/confidence_score_test_vs_adv.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abilijang/findDiffspots path: /tools/bgsubstract.py
import numpy as np
cimport numpy as np
cimport cython
from libc.math cimport floor, sqrt, fmin
DTYPE = np.float32
ctypedef np.float32_t DTYPE_t
@cython.boundscheck(False)
@cython.wraparound(False)
cdef azumith(float[:, :] data, float[:, :] ds... | code_fim | hard | {
"lang": "python",
"repo": "abilijang/findDiffspots",
"path": "/tools/bgsubstract.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@cython.boundscheck(False)
@cython.wraparound(False)
def subtract(float[:, :] data, center, azumith):
cdef float ctx = center[0]
cdef float cty = center[1]
cdef float azm1 = azumith[0]
cdef float azm2 = azumith[1]
# if ctx > cty:
# cdef int bins = floor(cty)
# else:
# cdef int bins = floor(c... | code_fim | hard | {
"lang": "python",
"repo": "abilijang/findDiffspots",
"path": "/tools/bgsubstract.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jbesemer/jb_src path: /HomeAuto/io/bin/watch
#!/usr/bin/python
import os, sys, regex
from time import time
from string import *
# serial input device
TTY = "/dev/ttyS0"
input = open( TTY, "rb" )
########################################
# form a timestamp
prev_tv = (0,0,0,0)
def ts():
ta =... | code_fim | medium | {
"lang": "python",
"repo": "jbesemer/jb_src",
"path": "/HomeAuto/io/bin/watch",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>########################################
# startup initialization
def init():
pass
########################################
# main loop
def main():
while 1:
line = input.readline()
print ts(), line,
init()
main()<|fim_prefix|># repo: jbesemer/jb_src path: /HomeAuto/io/bin/watch
#!/usr/bin/pyth... | code_fim | hard | {
"lang": "python",
"repo": "jbesemer/jb_src",
"path": "/HomeAuto/io/bin/watch",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
while 1:
line = input.readline()
print ts(), line,
init()
main()<|fim_prefix|># repo: jbesemer/jb_src path: /HomeAuto/io/bin/watch
#!/usr/bin/python
import os, sys, regex
from time import time
from string import *
# serial input device
TTY = "/dev/ttyS0"
input = open( TTY, "rb" )
############... | code_fim | medium | {
"lang": "python",
"repo": "jbesemer/jb_src",
"path": "/HomeAuto/io/bin/watch",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for word in words:
curr = root
for char in word:
curr.children[char] = curr.children.get(char, TrieNode())
curr = curr.children[char]
curr.is_word = True
self.matched = []
for i in range(len(board)):
f... | code_fim | hard | {
"lang": "python",
"repo": "kevinshenyang07/Data-Structures-and-Algorithms",
"path": "/algorithms/data_structure_related/trie/word_search.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kevinshenyang07/Data-Structures-and-Algorithms path: /algorithms/data_structure_related/trie/word_search.py
from prefix_tree import TrieNode
# Word Search
class Solution(object):
def exist(self, board, word):
"""
:type board: List[List[str]]
:type word: str
:r... | code_fim | hard | {
"lang": "python",
"repo": "kevinshenyang07/Data-Structures-and-Algorithms",
"path": "/algorithms/data_structure_related/trie/word_search.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return False
# test case 1:
# [["a"]]
# "a"
# => true
# test case 2:
# [["A","B","C","E"],
# ["S","F","E","S"],
# ["A","D","E","E"]]
# "ABCESEEEFS"
# => true
# Word Search II
class Solution(object):
def findWords(self, board, words):
"""
:type board: List[List[str]]
... | code_fim | hard | {
"lang": "python",
"repo": "kevinshenyang07/Data-Structures-and-Algorithms",
"path": "/algorithms/data_structure_related/trie/word_search.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: enescavus/Big-Data path: /Thesis-RealTimeBigDataProject/TrendProducer.py
###################################################################################################################
# author : ENES ÇAVUŞ
# subject : Getting Real Time trend data from Twitter via Tweepy -
################... | code_fim | hard | {
"lang": "python",
"repo": "enescavus/Big-Data",
"path": "/Thesis-RealTimeBigDataProject/TrendProducer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(2):
# this condition gets global trend data and sending usable datas via kafka producer on topic for global transfer
if i == 0:
print("\n\n GLOBAL \n\n")
trends = api.trends_place(1) # for global
globalTrends = []
for trend in trends[0]['trends']:
... | code_fim | hard | {
"lang": "python",
"repo": "enescavus/Big-Data",
"path": "/Thesis-RealTimeBigDataProject/TrendProducer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: caroline-gschwend/metabrainz.org path: /manage.py
from flask_script import Manager
from flask import current_app
from metabrainz import create_app
from metabrainz.model.access_log import AccessLog
from metabrainz.model.utils import init_postgres, create_tables as db_create_tables
manager = Mana... | code_fim | medium | {
"lang": "python",
"repo": "caroline-gschwend/metabrainz.org",
"path": "/manage.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@manager.command
def create_tables():
db_create_tables(current_app.config['SQLALCHEMY_DATABASE_URI'])
@manager.command
def cleanup_logs():
with create_app().app_context():
AccessLog.remove_old_ip_addr_records()
if __name__ == '__main__':
manager.run()<|fim_prefix|># repo: caroline-... | code_fim | medium | {
"lang": "python",
"repo": "caroline-gschwend/metabrainz.org",
"path": "/manage.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>"map",
"manual",
]
INITIAL_SCENE = 'cryo'<|fim_prefix|># repo: ebarna2/suspended_sentence path: /gamelib/scenes/__init__.py
"""Package for holding scenes."""
SCENE_LIST = [
"cryo",
"bridge",
"mess",
"engi<|fim_middle|>ne",
"machine",
"crew_... | code_fim | easy | {
"lang": "python",
"repo": "ebarna2/suspended_sentence",
"path": "/gamelib/scenes/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def on_namreply(self, c, e):
pass
def on_invite(self, c, e):
if e.source.nick not in self.config.get("blacklist"):
c.join(e.arguments[0])
def on_join(self, c, e):
if e.source.nick == self.config.get("nick"):
self.logger.info(f"Joined {e.target}")
def on_welcome(self, c, ... | code_fim | medium | {
"lang": "python",
"repo": "mpaulon/ircbots",
"path": "/Roran/core/reactions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mpaulon/ircbots path: /Roran/core/reactions.py
def on_pubmsg(self, c, e):
if "Katrina" in e.arguments[0]:
c.kick(e.target, e.source.nick, "D'où tu parles de ma meuf ? Tu vas tater de mon marteau !")
def on_privmsg(self, c, e):
pass
def on_namreply(self, c, e):
pass
def o... | code_fim | hard | {
"lang": "python",
"repo": "mpaulon/ircbots",
"path": "/Roran/core/reactions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def on_join(self, c, e):
if e.source.nick == self.config.get("nick"):
self.logger.info(f"Joined {e.target}")
def on_welcome(self, c, e):
if self.config.get("password"):
c.privmsg("NickServ", text='RECOVER {} {}'.format(
self.config.get("nick"),
self.confi... | code_fim | medium | {
"lang": "python",
"repo": "mpaulon/ircbots",
"path": "/Roran/core/reactions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ezhk/python-learning path: /client-server-app/messenger/server/jim/descriptors.py
class Port(object):
"""
Descriptor check port range,
that must be in 1024-65535 range.
"""
def __set_name__(self, owner, name):
self.prop = name
def __get__(self, instance, cls):
<|... | code_fim | medium | {
"lang": "python",
"repo": "ezhk/python-learning",
"path": "/client-server-app/messenger/server/jim/descriptors.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return instance.__dict__.get(self.prop, None)
def __set__(self, instance, value):
"""
Check port range: must be not well known port:
"The Well Known Ports are those from 0 through 1023".
And must be less or qeual than 65535.
"""
if 1023 > value ... | code_fim | medium | {
"lang": "python",
"repo": "ezhk/python-learning",
"path": "/client-server-app/messenger/server/jim/descriptors.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kelmory06/Proyecto_2017_201554422_201554041 path: /Descargas.py
En el modulo descarga ya se debe abrir la conexion entre la intranet y la pasarela ,
en <|fim_suffix|>enviar
la informacion necesaria para iniciar o continuar la descarga (la informacion se envia a transmission)
y poder monitorea... | code_fim | medium | {
"lang": "python",
"repo": "kelmory06/Proyecto_2017_201554422_201554041",
"path": "/Descargas.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>envia a transmission)
y poder monitorearla, en caso de que no exista sigue con la consulta.<|fim_prefix|># repo: kelmory06/Proyecto_2017_201554422_201554041 path: /Descargas.py
En el modulo descarga ya se debe abrir la conexion entre la intranet y la pasarela ,
en este se consultara periodicamente si ... | code_fim | medium | {
"lang": "python",
"repo": "kelmory06/Proyecto_2017_201554422_201554041",
"path": "/Descargas.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_create_and_read_note_with_incorrect_password(app):
driver = app.driver
app.open_home_page()
inputtext = ''.join([random.choice(string.ascii_letters + string.digits) for i in range(random.randrange(200))])
# открываем дополнительные параметры
driver.find_element_by_css_sel... | code_fim | hard | {
"lang": "python",
"repo": "sckobeleva/Autotests_privnote",
"path": "/test/tests.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_read_destroyed_note_via_link(app):
driver = app.driver
app.open_home_page()
inputtext = ''.join([random.choice(string.ascii_letters + string.digits) for i in range(random.randrange(200))])
app.create_note(inputtext)
# получаем ссылку на заметку и открываем ее
link = drive... | code_fim | hard | {
"lang": "python",
"repo": "sckobeleva/Autotests_privnote",
"path": "/test/tests.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.