text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: sidarth164/RecoEdge path: /fedrec/utilities/saver_utils.py
"""Tools to save/restore model from checkpoints."""
import shutil
import os
import re
import torch
CHECKPOINT_PATTERN = re.compile('^model_checkpoint-(\d+)$')
class ArgsDict(dict):
def __init__(self, **kwargs):
super(Arg... | code_fim | hard | {
"lang": "python",
"repo": "sidarth164/RecoEdge",
"path": "/fedrec/utilities/saver_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def save(self, model_dir, step, epoch, is_best=False):
"""Saves model and optimizer to given directory.
Args:
model_dir: Model directory to save. If None ignore.
step: Current training step.
"""
if model_dir is None:
return
save... | code_fim | hard | {
"lang": "python",
"repo": "sidarth164/RecoEdge",
"path": "/fedrec/utilities/saver_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Exp1Sets(dj.Relvar):
"""
aperture.Exp1Sets (imported) # List of completed exp 1 sets
-> aperture.Subjects
"""<|fim_prefix|># repo: eywalker/misc path: /aperture.py
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 10 22:01:52 2014
@author: eywalker
"""
import datajoint as dj
conn = ... | code_fim | hard | {
"lang": "python",
"repo": "eywalker/misc",
"path": "/aperture.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Subjects(dj.Relvar):
"""
aperture.Subjects (manual) # my \
newest table
subject_id :int unsigned # unique subject identifier number
-----
subject_initials :varchar(10) # Initials of the subject
subject_gender='N' :ENUM('M','F','N') #... | code_fim | hard | {
"lang": "python",
"repo": "eywalker/misc",
"path": "/aperture.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eywalker/misc path: /aperture.py
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 10 22:01:52 2014
@author: eywalker
"""
import datajoint as dj
<|fim_suffix|> """
aperture.Subjects (manual) # my \
newest table
subject_id :int unsigned # unique subject identifier... | code_fim | hard | {
"lang": "python",
"repo": "eywalker/misc",
"path": "/aperture.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> f = open('10.json', 'rb')
y =[]
for a in f:
y.append(a)
y = ast.literal_eval(y[0])
y = map(lambda k: ' '.join(k['tags']), filter(lambda n: len(n['tags']) > 0, y))
ids = range(0, len(y))
data = zip(ids, y)
fs = primelookup(data)
fs.map_primes()
return fs,data... | code_fim | easy | {
"lang": "python",
"repo": "saifuddin778/primelookup",
"path": "/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saifuddin778/primelookup path: /test.py
import ast
from primelookup import primelookup
<|fim_suffix|> f = open('10.json', 'rb')
y =[]
for a in f:
y.append(a)
y = ast.literal_eval(y[0])
y = map(lambda k: ' '.join(k['tags']), filter(lambda n: len(n['tags']) > 0, y))
... | code_fim | easy | {
"lang": "python",
"repo": "saifuddin778/primelookup",
"path": "/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Azzy001/Vehicle_Management_System path: /vehicle_management_system.py
from prettytable import PrettyTable
import random
import time
import datetime
file = open("vehicle_management_system.txt", "a")
vehicle_ms = PrettyTable()
vehicle_ms.field_names = ["Vehicle ID", "Vehicle Brand", "Vehi... | code_fim | hard | {
"lang": "python",
"repo": "Azzy001/Vehicle_Management_System",
"path": "/vehicle_management_system.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # input cost of vehicle
cost = float(input("Enter vehicle cost (no commas): "))
# formats cost to 2 decimal places
veh_cost = '{0:.2f}'.format(cost)
# adds date of now
d = datetime.datetime.now()
date = d.strftime("%x")
# random generator to generate id and combi... | code_fim | hard | {
"lang": "python",
"repo": "Azzy001/Vehicle_Management_System",
"path": "/vehicle_management_system.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("\nAdd vehicle to Database")
brand = input("Enter vehicle brand: ")
model = input("Enter vehicle model: ")
plate = input("Enter vehicle registration plate: ")
colour = input("Enter vehicle colour: ")
# input cost of vehicle
cost = float(input("Enter vehicle cost (... | code_fim | hard | {
"lang": "python",
"repo": "Azzy001/Vehicle_Management_System",
"path": "/vehicle_management_system.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michael-deprospo/OptionsTradingProject path: /MultiRegression.py
from yahoo_fin import stock_info as si
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
from sklearn.model_selection import train_test_split
#This class pertains to multiple ... | code_fim | hard | {
"lang": "python",
"repo": "michael-deprospo/OptionsTradingProject",
"path": "/MultiRegression.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.live_price = si.get_live_price(self.ticker)
return self.live_price
def get_historic_data(ticker):
self.data = si.get_data(ticker, start_date=self.startdate, end_date=self.enddate, index_as_date = False)
return self.data
def crossValidation(self):
... | code_fim | hard | {
"lang": "python",
"repo": "michael-deprospo/OptionsTradingProject",
"path": "/MultiRegression.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>num_perm = 128
min_dict = {}
pbar = tqdm(total=len(s1))
for i, val in enumerate(s1):
m = MinHash(num_perm=num_perm)
m.update_batch(np.floor(val.flatten() * 10000).astype(int))
min_dict[f"s1-{i}"] = m
pbar.update(1)
# if i > 20:
# break
pbar = tqdm(total=len(s2))
for i, val in enume... | code_fim | medium | {
"lang": "python",
"repo": "amitab/master_thesis",
"path": "/src/shareable_pages/deduplicator/minhash.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amitab/master_thesis path: /src/shareable_pages/deduplicator/minhash.py
from datasketch import MinHash, MinHashLSH
import tensorflow as tf
import numpy as np
from tqdm import tqdm
from .matrix_utils import split, split_model, dedup_blocks
<|fim_suffix|>s1 = split_model(vgg16, 500, 500, 32)
s2 ... | code_fim | medium | {
"lang": "python",
"repo": "amitab/master_thesis",
"path": "/src/shareable_pages/deduplicator/minhash.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>pbar = tqdm(total=len(s1))
for i, val in enumerate(s1):
m = MinHash(num_perm=num_perm)
m.update_batch(np.floor(val.flatten() * 10000).astype(int))
min_dict[f"s1-{i}"] = m
pbar.update(1)
# if i > 20:
# break
pbar = tqdm(total=len(s2))
for i, val in enumerate(s2):
m = MinHash(num_p... | code_fim | medium | {
"lang": "python",
"repo": "amitab/master_thesis",
"path": "/src/shareable_pages/deduplicator/minhash.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
try:
#start_time = time.time()
data = { "timestramp":datetime.datetime.now(),"ID": ID, "Gender": gender}
firebase.post('/Conut/people', data)
#print("Totle time to update ",time.time()-start_time)
except Exception as e:
print("Can't update Firebase with exception:"+str(e) )<|fim_prefix|># r... | code_fim | medium | {
"lang": "python",
"repo": "JuanCarlosRomeroC/Count-Face-And-Detect-Gender",
"path": "/Gender_Detec/SendToFirebase.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JuanCarlosRomeroC/Count-Face-And-Detect-Gender path: /Gender_Detec/SendToFirebase.py
import datetime
from firebase import firebase
import time
import urllib, http.client
import json
import os
<|fim_suffix|>firebase = firebase.FirebaseApplication(firebaseURL, None)
def update_firebase(ID,ge... | code_fim | medium | {
"lang": "python",
"repo": "JuanCarlosRomeroC/Count-Face-And-Detect-Gender",
"path": "/Gender_Detec/SendToFirebase.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hello-starry/MotionExplorer path: /scripts/benchmarks/ParseBenchmarkFile.py
from xml.dom.minidom import parse
from xml.etree import ElementTree as ET
import os
import sys
import numpy as np
from tabulate import tabulate
class PlannerResults:
name = ""
run_ctr = 0
number_of_levels = 0
dim... | code_fim | hard | {
"lang": "python",
"repo": "hello-starry/MotionExplorer",
"path": "/scripts/benchmarks/ParseBenchmarkFile.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def GetPercentageOfFeasibleNodesPerPlannerLastLevel(self):
P = self.GetPercentageOfFeasibleNodesPerPlannerPerDimensionalityMatrixLastLevel()
return np.nanmin(P,axis=0)
def GetTimePerPlanner(self):
T = self.GetAverageTimePerPlannerPerDimensionalityMatrix()
Tm = np.nanmin(T, axis=0)
... | code_fim | hard | {
"lang": "python",
"repo": "hello-starry/MotionExplorer",
"path": "/scripts/benchmarks/ParseBenchmarkFile.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: minas528/a2sv path: /Introdution to Competitive Programming/D15/InsertIntoBST.py
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def insertIntoBST(self, root: TreeNode, val... | code_fim | medium | {
"lang": "python",
"repo": "minas528/a2sv",
"path": "/Introdution to Competitive Programming/D15/InsertIntoBST.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # now print the data of node
print(root.val)
root = Node(1)
root.left = Node(2)
root.right = Node(3)
root.left.left = Node(4)
root.left.right = Node(5)
print(printPostorder(root))<|fim_prefix|># repo: minas528/a2sv path: /Introdution... | code_fim | hard | {
"lang": "python",
"repo": "minas528/a2sv",
"path": "/Introdution to Competitive Programming/D15/InsertIntoBST.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.left = None
self.right = None
self.val = key
def printPostorder(root):
if root:
# First recur on left child
printPostorder(root.left)
# the recur on right child
printPostorder(root.right)
# ... | code_fim | medium | {
"lang": "python",
"repo": "minas528/a2sv",
"path": "/Introdution to Competitive Programming/D15/InsertIntoBST.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mirzasaad/leetcode-solutions path: /binary_search/33.search.py
class Solution:
def search(self, nums: List[int], target: int) -> int:
N = len(nums)
lo, hi = 0, N - 1
<|fim_suffix|> rotation, lo, hi = lo, 0, N-1
while lo <= hi:
mid = lo + ((hi-lo)//2)
... | code_fim | hard | {
"lang": "python",
"repo": "mirzasaad/leetcode-solutions",
"path": "/binary_search/33.search.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> rotation, lo, hi = lo, 0, N-1
while lo <= hi:
mid = lo + ((hi-lo)//2)
realmid = (mid+rotation) % N
if nums[realmid] == target: return realmid
if target > nums[realmid]: lo = mid + 1
else: hi = mid - 1
return -1<|fim_prefix|># repo: ... | code_fim | hard | {
"lang": "python",
"repo": "mirzasaad/leetcode-solutions",
"path": "/binary_search/33.search.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> while lo < hi:
mid = lo + ((hi-lo)//2)
if nums[mid] > nums[hi]: lo = mid + 1
else: hi = mid
rotation, lo, hi = lo, 0, N-1
while lo <= hi:
mid = lo + ((hi-lo)//2)
realmid = (mid+rotation) % N
if nums[realmid] == target: re... | code_fim | hard | {
"lang": "python",
"repo": "mirzasaad/leetcode-solutions",
"path": "/binary_search/33.search.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> " " +b
print(c)
age = 22
Txt = " my name is aashish and i am {}yrs old "
print(Txt.format(age))
quantity = 3
itemno = 567
price = 49.95
myorder = "I want {2} pieces of item {0} for {1} dollars."
print(myorder.format(quantity,itemno,price))<|fim_prefix|># repo: aashishjha99/python path: /strings.py
a = "... | code_fim | medium | {
"lang": "python",
"repo": "aashishjha99/python",
"path": "/strings.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aashishjha99/python path: /strings.py
a = " Hello, World!"
print(a.strip())
print(a.lower())
print(a.upper())
print(a.replace("H","j"))
print(a.split(" , "<|fim_suffix|>67
price = 49.95
myorder = "I want {2} pieces of item {0} for {1} dollars."
print(myorder.format(quantity,itemno,price))<|fim_... | code_fim | hard | {
"lang": "python",
"repo": "aashishjha99/python",
"path": "/strings.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>### BF
# dist_1 = [float("inf")] * (n + 1)
# dist_1[1] = 0
# for _ in range(n - 1):
# flag = 0
# for [u, v, w] in edges:
# if dist_1[v] > dist_1[u] + w:
# dist_1[v] = dist_1[u] + w
# flag = 1
# if flag == 0: break
# dist_n = [float("inf")] * (n + 1)
# dist_n[n]... | code_fim | hard | {
"lang": "python",
"repo": "suryabulusu/CSES-Python",
"path": "/Python_Code/Flight_Discount.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
### BF
# dist_1 = [float("inf")] * (n + 1)
# dist_1[1] = 0
# for _ in range(n - 1):
# flag = 0
# for [u, v, w] in edges:
# if dist_1[v] > dist_1[u] + w:
# dist_1[v] = dist_1[u] + w
# flag = 1
# if flag == 0: break
# dist_n = [float("inf")] * (n + 1)
# dist_n[n... | code_fim | hard | {
"lang": "python",
"repo": "suryabulusu/CSES-Python",
"path": "/Python_Code/Flight_Discount.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: suryabulusu/CSES-Python path: /Python_Code/Flight_Discount.py
####################################################################################
# Please consider trying a few more times before referring to this code.
# Code might be incorrect - TLE / Wrong Answer (especially filenames with _... | code_fim | hard | {
"lang": "python",
"repo": "suryabulusu/CSES-Python",
"path": "/Python_Code/Flight_Discount.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sydleither/meal-planner path: /controller/recipe_input_parser.py
import re
from fractions import Fraction
def normalize_ingredients(ingredients):
with open('controller/measurements.txt') as f:
measurements = f.read().split()
final_ingredients = []
for line in ingredient... | code_fim | medium | {
"lang": "python",
"repo": "sydleither/meal-planner",
"path": "/controller/recipe_input_parser.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = data.to_dict()
name = data.get("name")
ingredients = normalize_ingredients(data.get("ingredients"))
instructions = data.get("instructions")
link = data.get("link")
meal_type = data.get("type")
subtype = data.get("subtype")
servings = data.get("servings")
veg... | code_fim | hard | {
"lang": "python",
"repo": "sydleither/meal-planner",
"path": "/controller/recipe_input_parser.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>with open('baidu.html', 'w', encoding='utf-8') as f:
f.write(driver.page_source)
time.sleep(2)
driver.quit()<|fim_prefix|># repo: mrliangqixiong/spider path: /selenium_baidu_fanyi.py
from selenium import webdriver
import time
driver = webdriver.Chrome()
# driver = webdriver.Firefox()
# dri... | code_fim | medium | {
"lang": "python",
"repo": "mrliangqixiong/spider",
"path": "/selenium_baidu_fanyi.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mrliangqixiong/spider path: /selenium_baidu_fanyi.py
from selenium import webdriver
import time
driver = webdriver.Chrome()
# driver = webdriver.Firefox()
# driver = webdriver.PhantomJS('D:/ProgramFiles/phantomjs-2.1.1-windows/bin/phantomjs.exe')
driver.get('http://fanyi.baidu.com/transl... | code_fim | medium | {
"lang": "python",
"repo": "mrliangqixiong/spider",
"path": "/selenium_baidu_fanyi.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>NSACTION ISOLATION LEVEL READ COMMITTED")<|fim_prefix|># repo: AK-1121/code_extraction path: /python/python_4733.py
# Problem with concurrent reading and wr<|fim_middle|>iting (distinct processes) using MySQL and Python
cursor.execute("SET SESSION TRA | code_fim | medium | {
"lang": "python",
"repo": "AK-1121/code_extraction",
"path": "/python/python_4733.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AK-1121/code_extraction path: /python/python_4733.py
# Problem with concurrent reading and writing (distinct processes) using MySQL an<|fim_suffix|>NSACTION ISOLATION LEVEL READ COMMITTED")<|fim_middle|>d Python
cursor.execute("SET SESSION TRA | code_fim | easy | {
"lang": "python",
"repo": "AK-1121/code_extraction",
"path": "/python/python_4733.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>d Python
cursor.execute("SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED")<|fim_prefix|># repo: AK-1121/code_extraction path: /python/python_4733.py
# Problem with concurrent reading and wr<|fim_middle|>iting (distinct processes) using MySQL an | code_fim | easy | {
"lang": "python",
"repo": "AK-1121/code_extraction",
"path": "/python/python_4733.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.forward(STEP_DISTANCE)
def move_down(self):
self.backward(STEP_DISTANCE)<|fim_prefix|># repo: zhd204/Python path: /day22_pong-game/paddle.py
from turtle import Turtle
PADDLE_WIDTH = 20
PADDLE_HEIGHT = 100
STEP_DISTANCE = 20
class Paddle(Turtle):
def __init__(self, xcor, y... | code_fim | medium | {
"lang": "python",
"repo": "zhd204/Python",
"path": "/day22_pong-game/paddle.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhd204/Python path: /day22_pong-game/paddle.py
from turtle import Turtle
PADDLE_WIDTH = 20
PADDLE_HEIGHT = 100
STEP_DISTANCE = 20
<|fim_suffix|> def __init__(self, xcor, ycor):
super().__init__()
self.shape("square")
self.resizemode("user")
self.penup()
... | code_fim | medium | {
"lang": "python",
"repo": "zhd204/Python",
"path": "/day22_pong-game/paddle.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: handriss/new_school_system path: /server.py
from flask import *
from models import Applicant, Mentor
from populator import Populator
from models.basemodel import *
from peewee import *
from flask_login import LoginManager, UserMixin, login_required, login_user, logout_user
app = Flask('school_sy... | code_fim | hard | {
"lang": "python",
"repo": "handriss/new_school_system",
"path": "/server.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route("/logout")
@login_required
def logout():
logout_user()
return Response(render_template('logout.html'))
@app.errorhandler(401)
def page_not_found(e):
return Response('<p>Login failed</p> <a href="/applicant/login">back</a>')
@login_manager.user_loader
def load_user(userid):
r... | code_fim | hard | {
"lang": "python",
"repo": "handriss/new_school_system",
"path": "/server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>x, y, _ = sim_mi_cd(x, snr=1., n_conditions=3)
# print the conditions for the single subject
print(y[0])
###############################################################################
# Define the electrophysiological dataset
# ---------------------------------------
#
# Now we define an instance of :cl... | code_fim | hard | {
"lang": "python",
"repo": "brainets/frites",
"path": "/examples/mi/plot_wf_mi_cd.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
###############################################################################
# Simulate electrophysiological data
# ----------------------------------
#
# Let's start by simulating MEG / EEG electrophysiological data coming from
# multiple subjects using the function
# :func:`frites.simulations.sim_mu... | code_fim | hard | {
"lang": "python",
"repo": "brainets/frites",
"path": "/examples/mi/plot_wf_mi_cd.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brainets/frites path: /examples/mi/plot_wf_mi_cd.py
"""
MI between a continuous and a discret variables
===============================================
This example illustrates how to compute the mutual information between a
continuous and a discret variables. The first variable is an
electrophy... | code_fim | hard | {
"lang": "python",
"repo": "brainets/frites",
"path": "/examples/mi/plot_wf_mi_cd.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('network', '0004_auto_20201203_1630'),
]
operations = [
migrations.AddField(
model_name='post',
name='likes_count',
field=models.IntegerField(default=0),
),
migrations.RemoveField(
model_name='po... | code_fim | medium | {
"lang": "python",
"repo": "T-Dogg-PO/cs50_network_project",
"path": "/network/migrations/0005_auto_20201207_1656.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: T-Dogg-PO/cs50_network_project path: /network/migrations/0005_auto_20201207_1656.py
# Generated by Django 3.1 on 2020-12-07 15:56
from django.conf import settings
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
('network', '0004_auto_20201203_1630'),
]
... | code_fim | medium | {
"lang": "python",
"repo": "T-Dogg-PO/cs50_network_project",
"path": "/network/migrations/0005_auto_20201207_1656.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kevinsn/pratica-dio-python path: /app_python/aula_6.py
#-------------------CONJUNTO-------------------
# tipo é set
# conjunto = {1, 2, 3, 4}
# print(type(conjunto))
# conjunto.add(5)
# conjunto.discard(2)
# print(conjunto)
<|fim_suffix|># Transformando lista em conjunto e vice versa, retira dup... | code_fim | hard | {
"lang": "python",
"repo": "kevinsn/pratica-dio-python",
"path": "/app_python/aula_6.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Subset (se o conjunto a está presente em b)
# E Superset (se o conjunto b possui o conjunto a)
# conjunto_a = {1, 2, 3}
# conjunto_b = {1, 2, 3, 4 ,5}
# conjunto_subset = conjunto_a.issubset(conjunto_b)
# print(conjunto_subset)
# conjunto_superset = conjunto_b.issuperset(conjunto_a)
# print(conjunto_sup... | code_fim | hard | {
"lang": "python",
"repo": "kevinsn/pratica-dio-python",
"path": "/app_python/aula_6.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lasp/maven_iuvs path: /make_documentation.py
import os
package_path = os.path.dirname(__file__)
module_path = os.path.join(package_path, 'maven_iuvs/')
docs_path = os.path.join(package_path, 'docs')
os.system('rm -r ' + docs_path)
os.system('pdoc --htm<|fim_suffix|>s')
os.system('mv -f ' + os.pa... | code_fim | medium | {
"lang": "python",
"repo": "lasp/maven_iuvs",
"path": "/make_documentation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>s')
os.system('mv -f ' + os.path.join(pdoc_path, '*') + ' ' + docs_path)
os.system('rm -r ' + pdoc_path)<|fim_prefix|># repo: lasp/maven_iuvs path: /make_documentation.py
import os
package_path = os.path.dirname(__file__)
module_path = os.path.join(package_path, 'maven_iuvs/')
docs_path = os.path.join(p... | code_fim | medium | {
"lang": "python",
"repo": "lasp/maven_iuvs",
"path": "/make_documentation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maxthyron/Scheduler path: /backend/api/configs.py
# time-section
DATE_FORMAT = '%d-%m-%Y'
TIME_FORMAT = '%H:%M:%S'
SUBJECT_BODY = \
'''
LESSON:{lesson}
STARTTIME:{start_time}
ENDTIME:{end_time}
DAY:{day}
WEEK:{week}
LOCATION:{auditorium}
PROFESSOR:{professor}
... | code_fim | medium | {
"lang": "python",
"repo": "maxthyron/Scheduler",
"path": "/backend/api/configs.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>MAIN_URL = 'https://students.bmstu.ru'
GROUPS_LIST_URL = '/schedule/list'
DAY_MAP = {
"ПН": "Monday",
"ВТ": "Tuesday",
"СР": "Wednesday",
"ЧТ": "Thursday",
"ПТ": "Friday",
"СБ": "Saturday"
}<|fim_prefix|># repo: maxthyron/Scheduler path: /backend/api/configs.py
# time-section
DAT... | code_fim | medium | {
"lang": "python",
"repo": "maxthyron/Scheduler",
"path": "/backend/api/configs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>DAY_MAP = {
"ПН": "Monday",
"ВТ": "Tuesday",
"СР": "Wednesday",
"ЧТ": "Thursday",
"ПТ": "Friday",
"СБ": "Saturday"
}<|fim_prefix|># repo: maxthyron/Scheduler path: /backend/api/configs.py
# time-section
DATE_FORMAT = '%d-%m-%Y'
TIME_FORMAT = '%H:%M:%S'
<|fim_middle|>SUBJECT_BODY ... | code_fim | hard | {
"lang": "python",
"repo": "maxthyron/Scheduler",
"path": "/backend/api/configs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: attearturo/LearningPython path: /Introduction/test_package/conditionals.py
# Condionales
x = 15
# Basic IF
# La indexacion es muy importante y determina los bloques de codigo
if x < 6:
print('this is true')
# If false
if x < 6:
print('This is true')
else:
print('This is false')
... | code_fim | hard | {
"lang": "python",
"repo": "attearturo/LearningPython",
"path": "/Introduction/test_package/conditionals.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if color == 'red':
print('Color is red')
elif color == 'blue':
print('Color is blue')
else:
print('Color is both')
# Nested if
if color == 'red':
if x < 10:
print('Color is red and x is less than 10')
# Logical operatora
if color == 'red' and x > 10:
print(... | code_fim | medium | {
"lang": "python",
"repo": "attearturo/LearningPython",
"path": "/Introduction/test_package/conditionals.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Logical operatora
if color == 'red' and x > 10:
print('Color is red and x is more than 10')<|fim_prefix|># repo: attearturo/LearningPython path: /Introduction/test_package/conditionals.py
# Condionales
x = 15
# Basic IF
# La indexacion es muy importante y determina los bloques de codigo
if x < 6:
... | code_fim | hard | {
"lang": "python",
"repo": "attearturo/LearningPython",
"path": "/Introduction/test_package/conditionals.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>seed(1)
train = [['0'], ['0'], ['0'], ['0'], ['1'], ['1']]
test = [[None], [None], [None], [None]]
predictions = zero_rule_algorithm_classification(train, test)
print(predictions)<|fim_prefix|># repo: liadbiz/ai_books path: /machine_learning_algorithms_from_scratch/code/chapter_05/zero_rule_classificatio... | code_fim | hard | {
"lang": "python",
"repo": "liadbiz/ai_books",
"path": "/machine_learning_algorithms_from_scratch/code/chapter_05/zero_rule_classification.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liadbiz/ai_books path: /machine_learning_algorithms_from_scratch/code/chapter_05/zero_rule_classification.py
# Example of Zero Rule Classification Predictions
from random import seed
from random import randrange
<|fim_suffix|> output_values = [row[-1] for row in train]
prediction = max(set(outp... | code_fim | medium | {
"lang": "python",
"repo": "liadbiz/ai_books",
"path": "/machine_learning_algorithms_from_scratch/code/chapter_05/zero_rule_classification.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: glvnst/cruft path: /delete_above/delete_above.py
#!/usr/bin/env python3
"""
Inkscape plugin: delete the selected object(s) and any objects on top of them.
I.E. delete the selected node(s) and any other nodes that are completely
within the bounding-boxes of the selected nodes that have a greater ... | code_fim | hard | {
"lang": "python",
"repo": "glvnst/cruft",
"path": "/delete_above/delete_above.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for id, node in self.svg.selected.items():
selected_node_bbox = self.bbox(node)
nodes_to_remove.append(node)
# search the document tree for the selected node
# when found, every subsequent node will be "above" it.
# (i.e. svg documents d... | code_fim | hard | {
"lang": "python",
"repo": "glvnst/cruft",
"path": "/delete_above/delete_above.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NiuGenen/DataMiningProject path: /dm_prediction_func.py
def time_enumrate():
times = []
hour = 0
<|fim_suffix|> < 60:
times.append(hour * 100 + min)
min += 5
hour += 1
return times<|fim_middle|> while hour < 24:
min = 0
while min | code_fim | easy | {
"lang": "python",
"repo": "NiuGenen/DataMiningProject",
"path": "/dm_prediction_func.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> min += 5
hour += 1
return times<|fim_prefix|># repo: NiuGenen/DataMiningProject path: /dm_prediction_func.py
def time_enumrate():
times = []
hour = 0
<|fim_middle|> while hour < 24:
min = 0
while min < 60:
times.append(hour * 100 + min)
| code_fim | medium | {
"lang": "python",
"repo": "NiuGenen/DataMiningProject",
"path": "/dm_prediction_func.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def cmd(self, data, enable):
"""send command to display"""
pass
def data(self, data, enable):
"""send data to display"""
app_x, app_y = self.pointer
self.buffer[
self.area['start_x'] + app_x][self.area['start_y'] + app_y
] = data
... | code_fim | hard | {
"lang": "python",
"repo": "fernandoremor/gfxlcd",
"path": "/gfxlcd/driver/null/area_driver.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> app_x, app_y = self.pointer
app_x += 1
if self.area['start_x'] + app_x > self.area['end_x']:
app_x = 0
app_y += 1
if self.area['start_y'] + app_y > self.area['end_y']:
app_x = 0
app_y = 0
self.pointer = (app_x, app_y... | code_fim | hard | {
"lang": "python",
"repo": "fernandoremor/gfxlcd",
"path": "/gfxlcd/driver/null/area_driver.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fernandoremor/gfxlcd path: /gfxlcd/driver/null/area_driver.py
"""Area driver """
from gfxlcd.abstract.driver import Driver
class AreaDriver(Driver):
"""Null communication driver"""
def __init__(self, width, height):
self.height = height
self.width = width
self.bu... | code_fim | hard | {
"lang": "python",
"repo": "fernandoremor/gfxlcd",
"path": "/gfxlcd/driver/null/area_driver.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print "PublicIp"
print data["ip"][0]["PublicIp"]<|fim_prefix|># repo: caiomsouza/log-manager path: /amazon-aws-cli/parser-ip.py
import json
import sys
from pprint import pprint
jdata = sys.stdin.read()
<|fim_middle|>data = json.loads(jdata)
| code_fim | easy | {
"lang": "python",
"repo": "caiomsouza/log-manager",
"path": "/amazon-aws-cli/parser-ip.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: caiomsouza/log-manager path: /amazon-aws-cli/parser-ip.py
import json
import sys
from pprint import pprint
jdata = sys.stdin.read()
<|fim_suffix|>print "PublicIp"
print data["ip"][0]["PublicIp"]<|fim_middle|>data = json.loads(jdata)
| code_fim | easy | {
"lang": "python",
"repo": "caiomsouza/log-manager",
"path": "/amazon-aws-cli/parser-ip.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>from app import views<|fim_prefix|># repo: radoslav/brother_ql_print_label path: /app/__init__.py
from flask import Flask
import redis
from rq import Queue
app = Flask(__name__)
<|fim_middle|>r = redis.Redis()
q = Queue('default', connection=r, failure_ttl=3600)
| code_fim | medium | {
"lang": "python",
"repo": "radoslav/brother_ql_print_label",
"path": "/app/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: radoslav/brother_ql_print_label path: /app/__init__.py
from flask import Flask
import redis
from rq import Queue
<|fim_suffix|>from app import views<|fim_middle|>app = Flask(__name__)
r = redis.Redis()
q = Queue('default', connection=r, failure_ttl=3600)
| code_fim | medium | {
"lang": "python",
"repo": "radoslav/brother_ql_print_label",
"path": "/app/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.expire_time = time() + self.timeout
with self.lock:
if self.closed:
print('create session')
self.expire_time = time() + self.timeout
self._session = self.session_class()
Thread(target=self._timer, daemon=True)... | code_fim | hard | {
"lang": "python",
"repo": "RugnarLodbrok/py_tools",
"path": "/py_tools/drafts/adapters/session_keeper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while True:
sleep(1)
with self.lock:
if time() >= self.expire_time:
print('close session')
self._session.close()
self.closed = True
return
@property
def session(self):
... | code_fim | hard | {
"lang": "python",
"repo": "RugnarLodbrok/py_tools",
"path": "/py_tools/drafts/adapters/session_keeper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RugnarLodbrok/py_tools path: /py_tools/drafts/adapters/session_keeper.py
from threading import Lock, Thread
from time import sleep, time
from requests import Session
class SessionKeeper:
<|fim_suffix|> self.expire_time = time()
self._session = None
self.closed = True
... | code_fim | hard | {
"lang": "python",
"repo": "RugnarLodbrok/py_tools",
"path": "/py_tools/drafts/adapters/session_keeper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tomaspc83/MasterCiDAEN_TFM path: /sentiment-analysis/handler_analysis.py
import json, boto3, os
from datetime import datetime
from decimal import Decimal
#Servicio DynamoDb
dynamodb_client = boto3.resource('dynamodb', region_name=os.environ['REGION'])
#Servicio Comprehend
comprehend = boto3.cli... | code_fim | hard | {
"lang": "python",
"repo": "tomaspc83/MasterCiDAEN_TFM",
"path": "/sentiment-analysis/handler_analysis.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> table = dynamodb_client.Table('tweets')
table.put_item(
Item={
'tweet_id': tweet_id,
'tweet_text': tweet_text,
'sentiment': sentiment,
'polarity': polarity,
'tweet_date': datetime.today().strftime("... | code_fim | hard | {
"lang": "python",
"repo": "tomaspc83/MasterCiDAEN_TFM",
"path": "/sentiment-analysis/handler_analysis.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: g3l/python path: /functions/last.py
def jobroles():
return "decant", "Each Recieve", "Prep", "Docks", "Reactives"
def addwords(ican):
return "At amazon i can work in the %s area" % ican
<|fim_suffix|> jobs = jobroles()
for x in jobs:
print (addwords(x))
buildjobs()<|fim_... | code_fim | easy | {
"lang": "python",
"repo": "g3l/python",
"path": "/functions/last.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> jobs = jobroles()
for x in jobs:
print (addwords(x))
buildjobs()<|fim_prefix|># repo: g3l/python path: /functions/last.py
def jobroles():
return "decant", "Each Recieve", "Prep", "Docks", "Reactives"
def addwords(ican):
<|fim_middle|> return "At amazon i can work in the %s area" ... | code_fim | medium | {
"lang": "python",
"repo": "g3l/python",
"path": "/functions/last.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def buildjobs():
jobs = jobroles()
for x in jobs:
print (addwords(x))
buildjobs()<|fim_prefix|># repo: g3l/python path: /functions/last.py
def jobroles():
return "decant", "Each Recieve", "Prep", "Docks", "Reactives"
<|fim_middle|>def addwords(ican):
return "At amazon i can work... | code_fim | medium | {
"lang": "python",
"repo": "g3l/python",
"path": "/functions/last.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haishenrong/python_belt_exam path: /flask_app/controllers/users.py
from flask import request, redirect, render_template, session
from flask_app.models.user import User
from flask_app.models.painting import Painting
from flask_app import app
from flask.helpers import flash
from flask_bcrypt import... | code_fim | hard | {
"lang": "python",
"repo": "haishenrong/python_belt_exam",
"path": "/flask_app/controllers/users.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@app.route('/login', methods=["POST"])
def login():
data = {
"email": request.form['email']
}
loggedUser = User.get_one_email(data)
validation_data = {
"loggedUser":loggedUser,
"password":request.form['password']
}
if not User.validate_login(validation_da... | code_fim | hard | {
"lang": "python",
"repo": "haishenrong/python_belt_exam",
"path": "/flask_app/controllers/users.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> b = np.zeros((height,width))
c = np.zeros((height,width))
L,w = 20,0.5
for i in range(height):
for j in range(width):
for k in range(1,3):
for x in range(0,k+1):
y = k - x
if(i + x < height and j + y < widt... | code_fim | hard | {
"lang": "python",
"repo": "lshpku/spikling",
"path": "/filtering.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lshpku/spikling path: /filtering.py
import numpy as np
def denoising(a: np.ndarray) -> np.ndarray:
b = np.zeros((height,width))
dx = [0,1,1,1,0,-1,-1,-1]
dy = [-1,-1,0,1,1,1,0,-1]
for i in range(1, height-1):
for j in range(1, width -1):
t = 0
... | code_fim | hard | {
"lang": "python",
"repo": "lshpku/spikling",
"path": "/filtering.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: natalie-ayers/covid-school-reopening path: /ui/res/ui_lists.py
'''
Code to create csv files for search terms
'''
import sqlite3
import csv
def generate_lists():
connection = sqlite3.connect('../../school_access.sqlite3')
c = connection.cursor()
# get lists of unique values from s... | code_fim | hard | {
"lang": "python",
"repo": "natalie-ayers/covid-school-reopening",
"path": "/ui/res/ui_lists.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> f = open('school_list.csv', 'w')
w = csv.writer(f, delimiter="|")
for row in school:
w.writerow(row)
f.close()
f = open('state_list.csv', 'w')
w = csv.writer(f, delimiter="|")
for row in state:
w.writerow(row)
f.close()
'''
Currently we don't need this cod... | code_fim | hard | {
"lang": "python",
"repo": "natalie-ayers/covid-school-reopening",
"path": "/ui/res/ui_lists.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getBSSID(self):
return self.features["BSSID"]
def getLevel(self):
return self.features["level"]
#-------------------------------------------------------------------------------
# Bluetooth feature accessors
#--------------------------------------------------------------------... | code_fim | hard | {
"lang": "python",
"repo": "shuangjj/owl4droid-models",
"path": "/features.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shuangjj/owl4droid-models path: /features.py
#!/usr/bin/env python
# File: features.py
# Extract formatted features form database
import os
import ast
import datetime as dt
#-------------------------------------------------------------------------------
# Map feature database row columns to cor... | code_fim | hard | {
"lang": "python",
"repo": "shuangjj/owl4droid-models",
"path": "/features.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> X = color
O = nothing
digit = [
X, O, O, X, O, O, O, O,
X, O, O, X, O, O, O, O,
X, O, O, X, O, O, O, O,
X, O, O, X, O, O, O, O,
O, X, X, X, O, O, O, O,
O, O, O, X, O, O, O, O,
O, O, O, X, O, O, O, O,
O, O, O, X, O, O, O, O,
]
... | code_fim | hard | {
"lang": "python",
"repo": "Resul134/AutoVen",
"path": "/AutoVenProxyServer/double_digits.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Resul134/AutoVen path: /AutoVenProxyServer/double_digits.py
from sense_hat import SenseHat
import time
import math
s = SenseHat()
s.low_light = True
green = (0, 255, 0)
yellow = (255, 255, 0)
blue = (0, 0, 255)
red = (255, 0, 0)
white = (255, 255, 255)
nothing = (0, 0, 0)
pink = (255, 105, 180)... | code_fim | hard | {
"lang": "python",
"repo": "Resul134/AutoVen",
"path": "/AutoVenProxyServer/double_digits.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return digit
def digit_two(color, digit_place):
X = color
O = nothing
digit = [
O, X, X, O, O, O, O, O,
X, O, O, X, O, O, O, O,
O, O, O, X, O, O, O, O,
O, O, O, X, O, O, O, O,
O, O, X, O, O, O, O, O,
O, X, O, O, O, O, O, O,
X, O, O, ... | code_fim | hard | {
"lang": "python",
"repo": "Resul134/AutoVen",
"path": "/AutoVenProxyServer/double_digits.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(generator_list) == 1:
return map(lambda el: (el,), generator_list[0])
else:
return reduce(lambda a, b: _tuple_reducer(a, b), generator_list)<|fim_prefix|># repo: tenkeyless/image-keras path: /image_keras/supports/generator.py
from functools import reduce
from typing import ... | code_fim | hard | {
"lang": "python",
"repo": "tenkeyless/image-keras",
"path": "/image_keras/supports/generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for _element in zip(a, b):
if isinstance(_element[0], tuple):
yield _element[0] + (_element[1],)
else:
yield (_element[0],) + (_element[1],)
if len(generator_list) == 1:
return map(lambda el: (el,), generator_list[0])
else:
... | code_fim | hard | {
"lang": "python",
"repo": "tenkeyless/image-keras",
"path": "/image_keras/supports/generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tenkeyless/image-keras path: /image_keras/supports/generator.py
from functools import reduce
from typing import Generator, List
def zip_generators(generator_list: List[Generator]):
"""
`generator_list` 들을 모아, 단일 Generator를 생성합니다.
Parameters
----------
generator_list : List[... | code_fim | hard | {
"lang": "python",
"repo": "tenkeyless/image-keras",
"path": "/image_keras/supports/generator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: p80n-sec/Useful-Tools path: /bulk_reverse_lookup.py
"""
Objective: Bulk Reverse DNS ('PTR' Record) Lookup
Usage:
1. Create a file, <input.txt> and place all the IP addresses in it. Please make sure each IP Address goes in a new line.
2. python bulk_reverse_lookup.py
3. Output resides in ... | code_fim | hard | {
"lang": "python",
"repo": "p80n-sec/Useful-Tools",
"path": "/bulk_reverse_lookup.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for host in host_names:
clean_host = host.replace(' ', '').replace('\n', '')
clean_hostnames.append(clean_host)
for host in clean_hostnames:
print (host)
try:
log_cmd= "dig -x %s +short 2>&1" %host
output = commands.getoutput(log_cmd)
lookup_result.append([host, output])
except Exception as ... | code_fim | hard | {
"lang": "python",
"repo": "p80n-sec/Useful-Tools",
"path": "/bulk_reverse_lookup.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
doc = classify_document("ham.txt", master_dict, "testspam.text")
spam_doc = classify_document("spam.txt", spam_dict, "testspam.text")
if math.log(sum(spam_doc.values())/sum(doc.values())) > 0:
print "Document is spam."
else:
print "Document is not spam."
if __name__ == '__main__':
m... | code_fim | hard | {
"lang": "python",
"repo": "QLGQ/spam-filter-1",
"path": "/classify_doc.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: QLGQ/spam-filter-1 path: /classify_doc.py
import nltk
import string
import math
"""Bayesian Classifier:
Takes any spam message and decides if it's spam or not spam
using the data gathered by spam_training"""
stop_words = [line.strip() for line in open('100_most_common.txt')]
master_dict = {}
... | code_fim | hard | {
"lang": "python",
"repo": "QLGQ/spam-filter-1",
"path": "/classify_doc.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Take a document and see how close it is spam or ham by its classification file."""
document_dictionary = make_prob_dictionary(classification_file, classification_dict)
document = read_doc(document)
doc_words = document[0]
doc_length = float(document[1])
document = probabilities(doc_words, doc_len... | code_fim | hard | {
"lang": "python",
"repo": "QLGQ/spam-filter-1",
"path": "/classify_doc.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> is: {}, father is: {}".format(os.getpid(), os.getppid()))
else:
print("my is father, pid is :{}".format(pid))<|fim_prefix|># repo: helios741/myblog path: /src/2019/1010_about_mult_process/test_fork.py
import os
print("not fork")
pid = os.fork()
print("alrea<|fim_middle|>dy fork")
if pid == 0:
p... | code_fim | easy | {
"lang": "python",
"repo": "helios741/myblog",
"path": "/src/2019/1010_about_mult_process/test_fork.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>)
else:
print("my is father, pid is :{}".format(pid))<|fim_prefix|># repo: helios741/myblog path: /src/2019/1010_about_mult_process/test_fork.py
import os
print("not fork")
pid = os.fork()
print("already fork")
if pid == 0:
print("my is child process id<|fim_middle|> is: {}, father is: {}".forma... | code_fim | easy | {
"lang": "python",
"repo": "helios741/myblog",
"path": "/src/2019/1010_about_mult_process/test_fork.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: helios741/myblog path: /src/2019/1010_about_mult_process/test_fork.py
import os
print("not fork")
pid = os.fork()
print("already fork")
if pid == 0:
print("my is child process id<|fim_suffix|>)
else:
print("my is father, pid is :{}".format(pid))<|fim_middle|> is: {}, father is: {}".forma... | code_fim | easy | {
"lang": "python",
"repo": "helios741/myblog",
"path": "/src/2019/1010_about_mult_process/test_fork.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SOFTWARE-ENGINEERING-CSE343/Book-Worm-App path: /pages_app/views.py
import random
from random import random
import random
from django.shortcuts import render
import pandas as pd
from Assets import knn_logic
from pages_app.models import OneBook
from pages_app.readFromFirebase import read_from_fir... | code_fim | hard | {
"lang": "python",
"repo": "SOFTWARE-ENGINEERING-CSE343/Book-Worm-App",
"path": "/pages_app/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.