text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: cwolffff/m00sic path: /src/m00sic/constants.py
"""
A module for constants.
"""
# fin adding notes for keys and uncomment
KEYS = [
"CM",
"GM"
# ,
# "DM",
# "AM",
# "EM",
# "BM",
# "FSM",
# "CSM",
# "Am",
# "Em",
# "Bm",
# "FSm",
# "CSm",
... | code_fim | hard | {
"lang": "python",
"repo": "cwolffff/m00sic",
"path": "/src/m00sic/constants.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># constants for value function
# add more complex rewards
NOTE_IN_KEY_REWARD = 1
NOTE_IN_CHORDS_REWARD = 1
SUPER_CONSONANT_INTERVAL_REWARD = 3
CONSONANT_INTERVAL_REWARD = 2
SOMEWHAT_CONSONANT_INTERVAL_REWARD = 1
DISSONANT_INTERVAL_REWARD = -2
SOMEWHAT_DISSONANT_INTERVAL_REWARD = -1
CENTRICITY_FACTOR = 1 #... | code_fim | hard | {
"lang": "python",
"repo": "cwolffff/m00sic",
"path": "/src/m00sic/constants.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Katy-katy/paws path: /paws/core/operations/PROCESSING/SAXS/SpectrumFit.py
from collections import OrderedDict
import copy
import numpy as np
from scipy.optimize import curve_fit
from ... import Operation as opmod
from ...Operation import Operation
from ....tools import saxstools
class Spectru... | code_fim | hard | {
"lang": "python",
"repo": "Katy-katy/paws",
"path": "/paws/core/operations/PROCESSING/SAXS/SpectrumFit.py",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
input_names = ['q','I','flags','params','fit_params','objfun']
output_names = ['params','q_I_opt']
super(SpectrumFit, self).__init__(input_names, output_names)
self.input_doc['q'] = '1d array of wave vector values in 1/Angstrom units'
self.in... | code_fim | hard | {
"lang": "python",
"repo": "Katy-katy/paws",
"path": "/paws/core/operations/PROCESSING/SAXS/SpectrumFit.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: t6fore/network-automation path: /json/asav_config_retreival.py
#!/usr/bin/env python
import json
import requests
from requests.auth import HTTPBasicAuth
if __name__ == "__main__":
<|fim_suffix|> url = "https://asav/api/interfaces/physical/GigabitEthernet0_API_SLASH_0"
body = {
... | code_fim | medium | {
"lang": "python",
"repo": "t6fore/network-automation",
"path": "/json/asav_config_retreival.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> requests.packages.urllib3.disable_warnings()
response = requests.patch(url, data=json.dumps(body), auth=auth, headers=headers, verify=False)<|fim_prefix|># repo: t6fore/network-automation path: /json/asav_config_retreival.py
#!/usr/bin/env python
import json
import requests
from requests.auth im... | code_fim | hard | {
"lang": "python",
"repo": "t6fore/network-automation",
"path": "/json/asav_config_retreival.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
doc = q.popleft()
m -= 1
if doc != highest:
q.append(doc)
if m < 0:
m = len(q) - 1
else:
count += 1
if m < 0:
print(count)
break<|fim_prefix|># repo: holquew/PS path: /boj/0196... | code_fim | medium | {
"lang": "python",
"repo": "holquew/PS",
"path": "/boj/01966.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: holquew/PS path: /boj/01966.py
import sys
from collections import deque
t = int(sys.stdin.readline().rstrip())
for _ in range(t):
n, m = map(int, sys.stdi<|fim_suffix|> m = len(q) - 1
else:
count += 1
if m < 0:
print(count)
... | code_fim | hard | {
"lang": "python",
"repo": "holquew/PS",
"path": "/boj/01966.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> m = len(q) - 1
else:
count += 1
if m < 0:
print(count)
break<|fim_prefix|># repo: holquew/PS path: /boj/01966.py
import sys
from collections import deque
t = int(sys.stdin.readline().rstrip())
for _ in range(t):
n, m = map(int, sys... | code_fim | hard | {
"lang": "python",
"repo": "holquew/PS",
"path": "/boj/01966.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RachyJ/python-opencv path: /rotate.py
import numpy as np
import imutils
import cv2
image = cv2.imread("D:\\Github\\python-opencv\\images\\trex.png")
cv2.imshow("Original", image)
cv2.waitKey(0)
(h, w) = image.shape[:2] # get height and width of the image
center = (w/2, h/2) # which point to rot... | code_fim | hard | {
"lang": "python",
"repo": "RachyJ/python-opencv",
"path": "/rotate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>M = cv2.getRotationMatrix2D(center, 45, 1.0) # rotation matrix
rotated = cv2.warpAffine(image, M, (w, h)) # apply the rotation
cv2. imshow("Rotated by 45 degrees", rotated)
cv2.waitKey(0)
M = cv2.getRotationMatrix2D(center, -90, 1.0)
rotated = cv2.warpAffine(image, M, (w, h))
cv2.imshow("Rotated by -90 d... | code_fim | medium | {
"lang": "python",
"repo": "RachyJ/python-opencv",
"path": "/rotate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>M = cv2.getRotationMatrix2D(center, -90, 1.0)
rotated = cv2.warpAffine(image, M, (w, h))
cv2.imshow("Rotated by -90 degrees", rotated)
cv2.waitKey(0)
rotated = imutils.rotate(image, 180)
cv2.imshow("Rotated by 180", rotated)
cv2.waitKey(0)<|fim_prefix|># repo: RachyJ/python-opencv path: /rotate.py
impor... | code_fim | hard | {
"lang": "python",
"repo": "RachyJ/python-opencv",
"path": "/rotate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AishwaryaRK/Code path: /LeetCodePractice/course_schedule_topological_sort.py
# 4, [[1,0],[2,0],[3,1],[3,2]]
# 3->1->0
# \ ^
# \ |
# \> 2
# 1,0,2,3
# stack 3
#
# 0 1 2 3
# 1,0
# stack 1
# 0
#
# def findOrder(numCourses, prerequisites):
# if len(prerequisites) == 0:
# o... | code_fim | hard | {
"lang": "python",
"repo": "AishwaryaRK/Code",
"path": "/LeetCodePractice/course_schedule_topological_sort.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> edges = {}
for prerequisite in prerequisites:
if prerequisite[0] == prerequisite[1]:
return []
if prerequisite[0] not in edges:
edges[prerequisite[0]] = [prerequisite[1]]
else:
v = edges[prerequisite[0]]
v.append(prerequisite[... | code_fim | hard | {
"lang": "python",
"repo": "AishwaryaRK/Code",
"path": "/LeetCodePractice/course_schedule_topological_sort.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#save the scaled dataframe to new csv files
scaled_training_df.to_csv("sales_data_training_scaled.csv", index=False)
scaled_training_df.to_csv("sales_data_test_scaled.csv", index=False)<|fim_prefix|># repo: chizbob/ML100 path: /practice3.py
import pandas as pd
from sklearn.preprocessing import MinMaxScal... | code_fim | hard | {
"lang": "python",
"repo": "chizbob/ML100",
"path": "/practice3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chizbob/ML100 path: /practice3.py
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
#loading data from CSV
training_data_df = pd.read_csv("sales_data_training.csv")
test_data_df = pd.read_csv("sales_data_test.csv")
<|fim_suffix|>#to bring it back to the original values
print("N... | code_fim | medium | {
"lang": "python",
"repo": "chizbob/ML100",
"path": "/practice3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>_files:
output.append(analize_member(f, var, diagnostic_functions))
print("processing %s" %os.path.basename(f))
ds = xr.merge(output)
df = ds.to_dataframe()
df = df.reset_index()
data = df.to_xarray()
data.to_netcdf(path='../data/model_stats/S%s_gridded_stats.nc'%eke, mode='w')<|fim_prefix|># rep... | code_fim | hard | {
"lang": "python",
"repo": "lcolosi/IdealizedWaveCurrent",
"path": "/tools/compute_grid_stats.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lcolosi/IdealizedWaveCurrent path: /tools/compute_grid_stats.py
import glob
import xarray as xr
from model_diagnostics import *
data_root = '../data/synthetic/standard/'
var_list = ['hs', 'dp', 'spr', 'fp', 'dir', 't0m1']
eke = 0.01
##########################
output = []
diagnostic_functions = ... | code_fim | hard | {
"lang": "python",
"repo": "lcolosi/IdealizedWaveCurrent",
"path": "/tools/compute_grid_stats.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: martinmacko47/chcemvediet path: /chcemvediet/apps/obligees/templatetags/chcemvediet/obligees.py
# vim: expandtab
# -*- coding: utf-8 -*-
from poleno.utils.template import Library
from chcemvediet.apps.obligees.models import Obligee
<|fim_suffix|> if gender == Obligee.GENDERS.MASCULINE:
... | code_fim | medium | {
"lang": "python",
"repo": "martinmacko47/chcemvediet",
"path": "/chcemvediet/apps/obligees/templatetags/chcemvediet/obligees.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@register.simple_tag
def gender(gender, masculine, feminine, neuter, plurale):
if gender == Obligee.GENDERS.MASCULINE:
return masculine
elif gender == Obligee.GENDERS.FEMININE:
return feminine
elif gender == Obligee.GENDERS.NEUTER:
return neuter
elif gender == Oblig... | code_fim | medium | {
"lang": "python",
"repo": "martinmacko47/chcemvediet",
"path": "/chcemvediet/apps/obligees/templatetags/chcemvediet/obligees.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JovanaOrmanovic/mlrB2019seminarski path: /05 tocak_bicikla/tocak_bicikla.py
import math
r = float(input())
p = int(inpu<|fim_suffix|> = ukupanPut * 0.01
print("%.2f" % ukupanPut)<|fim_middle|>t())
obim = 2 * r * math.pi
ukupanPut = p * obim
# centimetre pretvaramo u metre
ukupanPut | code_fim | medium | {
"lang": "python",
"repo": "JovanaOrmanovic/mlrB2019seminarski",
"path": "/05 tocak_bicikla/tocak_bicikla.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>bim
# centimetre pretvaramo u metre
ukupanPut = ukupanPut * 0.01
print("%.2f" % ukupanPut)<|fim_prefix|># repo: JovanaOrmanovic/mlrB2019seminarski path: /05 tocak_bicikla/tocak_bicikla.py
import math
r = float(input())
p = int(inpu<|fim_middle|>t())
obim = 2 * r * math.pi
ukupanPut = p * o | code_fim | easy | {
"lang": "python",
"repo": "JovanaOrmanovic/mlrB2019seminarski",
"path": "/05 tocak_bicikla/tocak_bicikla.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class PictureUpdateForm(forms.Form):
width = forms.IntegerField()
height = forms.IntegerField()
size = forms.FloatField()
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for field_name, field in self.fields.items():
field.widget.attrs['c... | code_fim | hard | {
"lang": "python",
"repo": "sensactive/resizerImages",
"path": "/mainapp/forms.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sensactive/resizerImages path: /mainapp/forms.py
from django import forms
from .models import Picture
class PictureUploadForm(forms.ModelForm):
class Meta:
model = Picture
exclude = ()
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
... | code_fim | medium | {
"lang": "python",
"repo": "sensactive/resizerImages",
"path": "/mainapp/forms.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
'!=' or '<>' operator
"""
# supported type for operand except Rational
if isinstance(other, int):
return self.num - other * self.den != 0
if not isinstance(other, Rational):
return NotImplemented
return self.num * other.de... | code_fim | hard | {
"lang": "python",
"repo": "10hin/number",
"path": "/rational.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
calc hash value
"""
return hash((self.num, self.den))
#
def __repr__(self):
"""
'official' string representation
"""
return '<Rational: num=%d, den=%d>' % (self.num, self.den)
#
def __str__(self):
"""
'info... | code_fim | hard | {
"lang": "python",
"repo": "10hin/number",
"path": "/rational.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 10hin/number path: /rational.py
"""
module rational number
"""
def _gcd(num_a, num_b):
"""
gratest common divisor
"""
if num_a == 0 or num_b == 0:
raise ArithmeticError('gcd of zero')
var_p = num_a
var_q = num_b
if var_p < var_q:
var_p = num_b
... | code_fim | hard | {
"lang": "python",
"repo": "10hin/number",
"path": "/rational.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
X = np.array( [[ 1, 2, 3],
[ np.nan, 5, 6],
[ np.nan, np.nan, 9]])
idx = np.array( [ 0, 1 ] )
expected = np.array( [ 2 ] )
actual = indexing.take_upper_off_diagonal( X, idx )
np.testing.assert_array_equal( actual,... | code_fim | hard | {
"lang": "python",
"repo": "jsphon/NumericalFunctions",
"path": "/numerical_functions/tests/numba_funcs/indexing_tests.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jsphon/NumericalFunctions path: /numerical_functions/tests/numba_funcs/indexing_tests.py
'''
Created on 27 Mar 2015
@author: Jon
'''
import matplotlib.pyplot as plt
from numerical_functions import Timer
import numerical_functions.numba_funcs.indexing as indexing
import numpy as np
import unitte... | code_fim | hard | {
"lang": "python",
"repo": "jsphon/NumericalFunctions",
"path": "/numerical_functions/tests/numba_funcs/indexing_tests.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> X = np.array( [[ 1, 2, 3],
[ np.nan, 5, 6],
[ np.nan, np.nan, 9]])
idx = np.array( [ 0, 1 ] )
expected = np.array( [ 2 ] )
actual = indexing.take_upper_off_diagonal( X, idx )
np.testing.assert_array_equal( actual, ... | code_fim | hard | {
"lang": "python",
"repo": "jsphon/NumericalFunctions",
"path": "/numerical_functions/tests/numba_funcs/indexing_tests.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
vocabulary_path: path where the vocabulary will be created.
json_vocab_path: data file that will be used to create vocabulary.
"""
if not gfile.Exists(vocabulary_path):
print("Transform vocabulary to %s" % vocabulary_path)
with gfile.GFile(json_vocab_path, mod... | code_fim | hard | {
"lang": "python",
"repo": "mor91/redditor_bot",
"path": "/jsonl_data_utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mor91/redditor_bot path: /jsonl_data_utils.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http... | code_fim | hard | {
"lang": "python",
"repo": "mor91/redditor_bot",
"path": "/jsonl_data_utils.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
a list of integers, the token-ids for the sentence.
"""
return [vocabulary.get(w, UNK_ID) for w in sentence.strip().split()]
def data_to_token_ids(data_path, target_path, vocabulary_path):
"""Tokenize data file and turn into token-ids using given vocabulary file.
This... | code_fim | hard | {
"lang": "python",
"repo": "mor91/redditor_bot",
"path": "/jsonl_data_utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#convert xls file to csv using xlrd module
xlsfile = glob.glob(os.path.join(os.path.dirname(__file__), 'storage/robot*.xls'))[0]
wb = open_workbook(xlsfile)
sheet = wb.sheet_by_name('robot_list')
with open(os.path.join(os.path.dirname(__file__), 'storage/robot_list.csv'), "w") as file:
writer = csv.wr... | code_fim | medium | {
"lang": "python",
"repo": "SovanCSE/practice_python_packages",
"path": "/app/pandas_module/practice2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SovanCSE/practice_python_packages path: /app/pandas_module/practice2.py
import requests, shutil, os, glob
from zipfile import ZipFile
import pandas as pd
from xlrd import open_workbook
import csv
# zipfilename = 'desiya_hotels'
# try:
# # downloading zip file
# r = requests.get('http:/... | code_fim | hard | {
"lang": "python",
"repo": "SovanCSE/practice_python_packages",
"path": "/app/pandas_module/practice2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>, bola_papel, maça_organico]
return lixos[n]<|fim_prefix|># repo: RhodrigoLopesPicinini/GameEducacional path: /funcoes.py
def randomizer(n, garrafa_vidro, lata_metal, copo_plastico, bola_papel, maça_organico):
li<|fim_middle|>xos = [garrafa_vidro, lata_metal, copo_plastico | code_fim | easy | {
"lang": "python",
"repo": "RhodrigoLopesPicinini/GameEducacional",
"path": "/funcoes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RhodrigoLopesPicinini/GameEducacional path: /funcoes.py
def randomizer(n, garrafa_vidro, lata_metal, copo_plastico, bola_papel, maça_organico):
li<|fim_suffix|>, bola_papel, maça_organico]
return lixos[n]<|fim_middle|>xos = [garrafa_vidro, lata_metal, copo_plastico | code_fim | easy | {
"lang": "python",
"repo": "RhodrigoLopesPicinini/GameEducacional",
"path": "/funcoes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Solution:
def smallerNumbersThanCurrent(self, nums):
answer = []
sortedNums = sorted(nums)
for num in nums:
answer.append(sortedNums.index(num))
return answer
... | code_fim | hard | {
"lang": "python",
"repo": "AbdussamadYisau/ds-and-algos",
"path": "/Arrays/smallerNumbersThanCurrent.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AbdussamadYisau/ds-and-algos path: /Arrays/smallerNumbersThanCurrent.py
# https://leetcode.com/problems/how-many-numbers-are-smaller-than-the-current-number/
# BruteForce
class BruteForceSolution:
def smallerNumbersThanCurrent(self, nums):
answer = []
for n... | code_fim | hard | {
"lang": "python",
"repo": "AbdussamadYisau/ds-and-algos",
"path": "/Arrays/smallerNumbersThanCurrent.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for num in nums:
answer.append(sortedNums.index(num))
return answer
example = BruteForceSolution()
exampleTwo = Solution()
print(example.smallerNumbersThanCurrent([8,1,2,2,3]))
print(exampleTwo... | code_fim | medium | {
"lang": "python",
"repo": "AbdussamadYisau/ds-and-algos",
"path": "/Arrays/smallerNumbersThanCurrent.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gnana-prakash55/gd-sol-store path: /ecom/api/urls.py
from django.urls import path,include
from .import views
urlpatterns = [
path('',views.home,name='home'),
path('category/',include('api.category.urls')),
path('prod<|fim_suffix|>('order/',include('api.order.urls')),
path('payme... | code_fim | medium | {
"lang": "python",
"repo": "gnana-prakash55/gd-sol-store",
"path": "/ecom/api/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>('order/',include('api.order.urls')),
path('payment/',include('api.payment.urls')),
]<|fim_prefix|># repo: gnana-prakash55/gd-sol-store path: /ecom/api/urls.py
from django.urls import path,include
from .import views
urlpatterns = [
path('',views.home,name='home'),
path('category/',include('... | code_fim | medium | {
"lang": "python",
"repo": "gnana-prakash55/gd-sol-store",
"path": "/ecom/api/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
checkArgs()
# Open up the input / output files (read / write modes respectively)
rfile = open (sys.argv[1], 'r')
wfile = open (output_name, 'w')
parseAndStrip (rfile, wfile)
# Close the input / output files now that we are done
rfile.close()
wfile.close()
# checkArgs
# 1. Verifi... | code_fim | hard | {
"lang": "python",
"repo": "RiasKlein/DnDGenerator",
"path": "/Utilities/Rumors/Source/Wizards/1. Extraction/titleStrip.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> parseAndStrip (rfile, wfile)
# Close the input / output files now that we are done
rfile.close()
wfile.close()
# checkArgs
# 1. Verifies that the number of arguments is acceptable
# 2. Reads in optional output filename
def checkArgs ():
# Verify number of input arguments
if len (sys.argv) < 2 or... | code_fim | medium | {
"lang": "python",
"repo": "RiasKlein/DnDGenerator",
"path": "/Utilities/Rumors/Source/Wizards/1. Extraction/titleStrip.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RiasKlein/DnDGenerator path: /Utilities/Rumors/Source/Wizards/1. Extraction/titleStrip.py
################################################################################
#
# titleStrip.py
#
# Generates an output file with the titles of the input stripped
# Usage:
# python titleStrip.py [input f... | code_fim | hard | {
"lang": "python",
"repo": "RiasKlein/DnDGenerator",
"path": "/Utilities/Rumors/Source/Wizards/1. Extraction/titleStrip.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(B):
p1=0.0
for j in range(N1):
if(rnd.uniform(0,1)<p1mle):
p1+=1
p1/=N1
p2=0.0
for j in range(N2):
if(rnd.uniform(0,1)<p2mle):
p2+=1
p2/=N2
estimate.append(p2-p1)
t=-10
estimate=np.array(estimate)
allt=[0.01*t for t in xrange(-5000,5000)]
target=0.95
tol=0.01
for ... | code_fim | medium | {
"lang": "python",
"repo": "deepakdilipkumar/allofstatistics",
"path": "/HW9/bootstrapconfidence.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>t=-10
estimate=np.array(estimate)
allt=[0.01*t for t in xrange(-5000,5000)]
target=0.95
tol=0.01
for t in allt:
cur=np.mean(np.sqrt(N1+N2)*(estimate-taumle)<t)
if(np.abs(target-cur)<tol):
print(t)
print(cur)
break<|fim_prefix|># repo: deepakdilipkumar/allofstatistics path: /HW9/bootstrapconfi... | code_fim | hard | {
"lang": "python",
"repo": "deepakdilipkumar/allofstatistics",
"path": "/HW9/bootstrapconfidence.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: deepakdilipkumar/allofstatistics path: /HW9/bootstrapconfidence.py
import numpy.random as rnd
import numpy as np
B=100000
N1=50
N2=50
<|fim_suffix|>for i in range(B):
p1=0.0
for j in range(N1):
if(rnd.uniform(0,1)<p1mle):
p1+=1
p1/=N1
p2=0.0
for j in range(N2):
if(rnd.uniform(0,1... | code_fim | medium | {
"lang": "python",
"repo": "deepakdilipkumar/allofstatistics",
"path": "/HW9/bootstrapconfidence.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get(self, path=None):
return self.request(path, 'GET')
def post(self, path=None, body=None):
return self.request(path, 'POST', body)
def put(self, path=None, body=None):
return self.request(path, 'PUT', body)
class Request(BaseRequest):
"""A webob.Request wi... | code_fim | hard | {
"lang": "python",
"repo": "blaix/woma",
"path": "/woma/http.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> >>> response = Response.for_request(request)
>>> response.content_type
'text/html'
>>> response.charset
'latin1'
"""
return cls(
status_code=200,
content_type=request.content_type or 'text/plain',
charset=request.... | code_fim | hard | {
"lang": "python",
"repo": "blaix/woma",
"path": "/woma/http.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlaynaGrace/alexa-skill-practice path: /project/alexa-skill.py
from flask import Flask
from flask_ask import Ask, statement, question, session
# import json, requests
import random
app = Flask(__name__)
ask = Ask(app, "/")
def get_cat_fact():
myFacts = [
"Cats should not be fed tun... | code_fim | medium | {
"lang": "python",
"repo": "AlaynaGrace/alexa-skill-practice",
"path": "/project/alexa-skill.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> welcome_message = 'Hello there, would you like to hear a cat fact?'
return question(welcome_message)
@ask.intent("YesIntent")
def share_headlines():
fact = get_cat_fact()
cat_fact = 'Did you know, ' + fact
return statement(cat_fact)
@ask.intent("NoIntent")
def no_intent():
bye_te... | code_fim | medium | {
"lang": "python",
"repo": "AlaynaGrace/alexa-skill-practice",
"path": "/project/alexa-skill.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return img
wikipedia='https://en.wikipedia.org/wiki/Special:Random'
page = requests.get(wikipedia).text.strip()
file= ET.fromstring(page).find('head/title')
band_title = file.text.replace(' - Wikipedia','')
wikipedia='https://en.wikipedia.org/wiki/Special:Random'
page = requests.get(wikipedia).text... | code_fim | hard | {
"lang": "python",
"repo": "kannan-mayoo/python-projects",
"path": "/Random_Album_Art_Generator/Random Album art creator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kannan-mayoo/python-projects path: /Random_Album_Art_Generator/Random Album art creator.py
# Inspiration: [Fake Album Covers](https://fakealbumcovers.com/)
from IPython.display import Image as IPythonImage
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import requests
... | code_fim | hard | {
"lang": "python",
"repo": "kannan-mayoo/python-projects",
"path": "/Random_Album_Art_Generator/Random Album art creator.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> band_x, band_y = 50, 50
album_x, album_y = 50, 400
outline_color ="black"
draw.text((band_x-1, band_y-1), top, font=band_name_font, fill=outline_color)
draw.text((band_x+1, band_y-1), top, font=band_name_font, fill=outline_color)
draw.text((band_x-1, band_y+1), top, font=band_nam... | code_fim | hard | {
"lang": "python",
"repo": "kannan-mayoo/python-projects",
"path": "/Random_Album_Art_Generator/Random Album art creator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def delete_all_reports():
common.ot_utils.delete_from_model(models.SingleWifiReport)
common.ot_utils.delete_from_model(models.LocationInfo)
common.ot_utils.delete_from_model(models.Report)
def _collect_items(offset,count):
all_reports_count = reports.models.RawReport.objects.co... | code_fim | hard | {
"lang": "python",
"repo": "nonZero/OpenTrains",
"path": "/webserver/opentrain/analysis/logic.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def delete_all_reports():
common.ot_utils.delete_from_model(models.SingleWifiReport)
common.ot_utils.delete_from_model(models.LocationInfo)
common.ot_utils.delete_from_model(models.Report)
def _collect_items(offset,count):
all_reports_count = reports.models.RawReport.objects.count()
... | code_fim | hard | {
"lang": "python",
"repo": "nonZero/OpenTrains",
"path": "/webserver/opentrain/analysis/logic.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> qasm.append('rx({}) q[{}];\n'.format(-theta, qubit_pair_1[0])) # -
qasm.append('h q[{}];\n'.format(qubit_pair_2[1]))
qasm.append('cx q[{}], q[{}];\n'.format(qubit_pair_1[0], qubit_pair_2[1])) # 0 3
qasm.append('h q[{}];\n'.format(qubit_pair_2[1]))
qasm.append('r... | code_fim | hard | {
"lang": "python",
"repo": "ElenaStoyanovaC/VQE",
"path": "/scripts/drafts/test_ansatz_elements.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> qasm = ['']
theta = angle / 8
# determine the parity of the two pairs
qasm.append('cx q[{}], q[{}];\n'.format(*qubit_pair_1))
qasm.append('x q[{}];\n'.format(qubit_pair_1[1]))
qasm.append('cx q[{}], q[{}];\n'.format(*qubit_pair_2))
qasm.append('x q[... | code_fim | hard | {
"lang": "python",
"repo": "ElenaStoyanovaC/VQE",
"path": "/scripts/drafts/test_ansatz_elements.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ElenaStoyanovaC/VQE path: /scripts/drafts/test_ansatz_elements.py
from openfermion import QubitOperator, FermionOperator
from openfermion.transforms import jordan_wigner
from src.utils import QasmUtils, MatrixUtils
from src.ansatz_elements import AnsatzElement, DoubleExchange
import itertools
i... | code_fim | hard | {
"lang": "python",
"repo": "ElenaStoyanovaC/VQE",
"path": "/scripts/drafts/test_ansatz_elements.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> "Insert a picture in sheet"
sht = self.xlBook.Worksheets(sheet)
sht.Shapes.AddPicture(pictureName, 1, 1, Left, Top, Width, Height)
def cpSheet(self, before): #复制工作表
"copy sheet"
shts = self.xlBook.Worksheets
shts(1).Copy(None,shts(1)... | code_fim | hard | {
"lang": "python",
"repo": "tqscjrty/StudyPython",
"path": "/研究/信息技术考试/win.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tqscjrty/StudyPython path: /研究/信息技术考试/win.py
2com.client import Dispatch
import win32com.client
import time
import os
import re
import win32api
'''
windows操作部分说明:
考试波及知识点:
1.删除文件及文件夹
2.复制文件及文件夹
3.移动文件及文件夹
4.文件及文件夹改名
5.文件属性
考试样例:
1、在“蕨类植物”文件夹中,新建一个子文件夹“薄囊蕨类”。
2、将文件“淡水藻.ddd”移动到“藻类植物”文件夹中。
3、设置“螺... | code_fim | hard | {
"lang": "python",
"repo": "tqscjrty/StudyPython",
"path": "/研究/信息技术考试/win.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>考试样例:
1.将A2所在行的行高设置为30(40像素)。
2.根据工作表中提供的公式,计算各班级的“3D社团参与比例”,并将结果填写在F3:F7单元格内。
3.给A2:F8单元格区域加所有框线。
4.按“无人机社团人数”由高到低排序。
5.选定A2:B7单元格区域,制作“三维折线图”,并插入到Sheet1工作表中。
'''
class ExcelOperation:
def __init__(self, filename=None): #打开文件或者新建文件(如果不存在的话)
self.xlApp = win32com.client.Dispatch('Excel.App... | code_fim | hard | {
"lang": "python",
"repo": "tqscjrty/StudyPython",
"path": "/研究/信息技术考试/win.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Zeta-qixi/Hand-controller path: /controller/c1.py
from pymouse import PyMouse
m = PyMouse()
w,h = m.screen_size()
class base_controller:
def __init__(self):
pass
def move(self,xy:list):
'''
移动
'''
m.move(xy[0]*w,xy[1]*h)
def click(sel... | code_fim | medium | {
"lang": "python",
"repo": "Zeta-qixi/Hand-controller",
"path": "/controller/c1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def scroll(self, marks:list):
'''
滚动
'''
d = marks[0][1] - marks[-1][1]
R = 0.2
print(d)
if d > R:
m.scroll(-1)
elif d < -R:
m.scroll(1)
def press(self, xy:list, ones = True):
'''
长按
''... | code_fim | medium | {
"lang": "python",
"repo": "Zeta-qixi/Hand-controller",
"path": "/controller/c1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kevinmcaleer/lesson_12_learning_python_classes_and_oop path: /leg.py
class Leg():
__smelly = True
def bend_knee(self):
<|fim_suffix|>
@property
def smelly(self):
return self.__smelly
@smelly.setter
def smelly(self,smell):
self.__smelly = smell
d... | code_fim | easy | {
"lang": "python",
"repo": "kevinmcaleer/lesson_12_learning_python_classes_and_oop",
"path": "/leg.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @smelly.setter
def smelly(self,smell):
self.__smelly = smell
def is_smelly(self):
return self.__smelly<|fim_prefix|># repo: kevinmcaleer/lesson_12_learning_python_classes_and_oop path: /leg.py
class Leg():
__smelly = True
def bend_knee(self):
print("knee... | code_fim | medium | {
"lang": "python",
"repo": "kevinmcaleer/lesson_12_learning_python_classes_and_oop",
"path": "/leg.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not os.path.exists(output_folder):
os.mkdir(output_folder)
print('resampling is {}'.format(str(resampling)))
bb_df = pd.read_csv(bounding_boxes_file)
bb_df = bb_df.set_index('PatientID')
files_list = [
f for f in glob.glob(input_folder + '/**/*.nii.gz', recursive=Tru... | code_fim | hard | {
"lang": "python",
"repo": "Aaron1993/HNSCC-ct-pet-GTV",
"path": "/hecktor-master/src/resampling/cli_resampling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Coin
fields = ('id', 'catalog_coin', 'owner', 'status',)
catalog_coin = CatalogCoinListSerializer()
class CoinSerializer(serializers.ModelSerializer):
class Meta:
model = Coin
fields = '__all__'<|fim_prefix|># repo: Nerevarsoul/coin_catalog path: /coins/... | code_fim | hard | {
"lang": "python",
"repo": "Nerevarsoul/coin_catalog",
"path": "/coins/serializers.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
model = CatalogCoin
fields = (
'id', 'face_value', 'currency', 'country', 'year', 'theme', 'mint', 'serie', 'collection', 'exchange',
'wishlist',
)
serie = serializers.SlugRelatedField(slug_field='name', read_only=True)
collection = ... | code_fim | hard | {
"lang": "python",
"repo": "Nerevarsoul/coin_catalog",
"path": "/coins/serializers.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nerevarsoul/coin_catalog path: /coins/serializers.py
from rest_framework import serializers
from .models import *
__all__ = (
'CatalogCoinListSerializer', 'CatalogCoinSerializer', 'SeriesListSerializer', 'CoinListSerializer',
'CoinSerializer', 'CountriesListSerializer',
)
class Countr... | code_fim | hard | {
"lang": "python",
"repo": "Nerevarsoul/coin_catalog",
"path": "/coins/serializers.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: blairsec/challenges path: /angstromctf/2019/binary/weeb_hunting/solve.py
from pwn import *
p = process("./weeb_hunting")
elf = ELF("/lib/x86_64-linux-gnu/libc-2.23.so")
pwnlib.gdb.attach(p)
r = p.recv()
while "You found a" not in r:
r = p.recvuntil(">")
p.send("AAAA\n")
p.send("AAAA\n")
r =... | code_fim | hard | {
"lang": "python",
"repo": "blairsec/challenges",
"path": "/angstromctf/2019/binary/weeb_hunting/solve.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>p.sendline("4")
r = p.recv()
while "10. empty" not in r:
p.send("\n")
r = p.recv()
p.sendline("3")
r = p.recv()
while "You found a" not in r:
p.send("\n")
r = p.recv()
p.sendline(p64(hook)[:6])
p.interactive()<|fim_prefix|># repo: blairsec/challenges path: /angstromctf/2019/binary/weeb_hunting/so... | code_fim | hard | {
"lang": "python",
"repo": "blairsec/challenges",
"path": "/angstromctf/2019/binary/weeb_hunting/solve.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>while "10. empty" not in r:
p.send("\n")
r = p.recv()
p.sendline("3")
r = p.recv()
while "10. empty" not in r:
p.send("\n")
r = p.recv()
p.sendline("4")
r = p.recv()
while "10. empty" not in r:
p.send("\n")
r = p.recv()
p.sendline("3")
r = p.recv()
while "You found a" not in r:
p.send("\n")
r... | code_fim | hard | {
"lang": "python",
"repo": "blairsec/challenges",
"path": "/angstromctf/2019/binary/weeb_hunting/solve.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frdeso/2016-web path: /web/utils.py
import os
import json
import codecs
import markdown
from flask import current_app
def get_json_file(filename, lang='en'):
<|fim_suffix|> with open(filepath, 'r') as f:
return json.loads(f.read())
def get_markdown_file(name, lang='en'):
"""
... | code_fim | medium | {
"lang": "python",
"repo": "frdeso/2016-web",
"path": "/web/utils.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_markdown_file(name, lang='en'):
"""
Get the contents of a markdown file.
"""
filename_temp = "{0}_{1}.markdown"
md_dir = os.path.join(current_app.config['APP_PATH'], 'markdown')
filepath = os.path.join(md_dir, filename_temp.format(name, lang))
if not os.path.isfile... | code_fim | hard | {
"lang": "python",
"repo": "frdeso/2016-web",
"path": "/web/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> filename_temp = "{0}_{1}.markdown"
md_dir = os.path.join(current_app.config['APP_PATH'], 'markdown')
filepath = os.path.join(md_dir, filename_temp.format(name, lang))
if not os.path.isfile(filepath) and lang == 'fr':
filepath = os.path.join(md_dir, filename_temp.format(name, 'en... | code_fim | medium | {
"lang": "python",
"repo": "frdeso/2016-web",
"path": "/web/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Diegofergamboa/POO path: /optimizacion.py
'''
Encontrar el valor mas alto el mas rapido, el mas lento
para eso son los algoritmos de optimizacion
Para eso debemo<|fim_suffix|> Man
Cual es la ruta mas eficiente para recorrer todas las ciudades
Resolver el algoritmo de sales man... | code_fim | hard | {
"lang": "python",
"repo": "Diegofergamboa/POO",
"path": "/optimizacion.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>den generar buenas empresas
Empresas a la optimizacion
#############################################33
Traveling Sales Man
Cual es la ruta mas eficiente para recorrer todas las ciudades
Resolver el algoritmo de sales man
Turing Prize
'''<|fim_prefix|># repo: Diegofergamboa/POO p... | code_fim | medium | {
"lang": "python",
"repo": "Diegofergamboa/POO",
"path": "/optimizacion.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mpwillia/Keras-Talk-Examples path: /2_text/interactive_script_gen.py
#!/usr/bin/python3
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'
os.environ['KERAS_BACKEND'] = 'tensorflow'
import numpy as np
import sys
from util import load_model
from keras.preprocessing.text... | code_fim | hard | {
"lang": "python",
"repo": "mpwillia/Keras-Talk-Examples",
"path": "/2_text/interactive_script_gen.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #num_choices = results.shape[0] # (batch, outputs)
probs = np.exp(np.log(results) / temperature)
probs /= np.sum(probs)
return np.random.choice(len(results), p = probs)
#preds = np.asarray(preds).astype('float64')
#preds = np.log(preds) / temperature
#exp_preds = np.exp(preds... | code_fim | hard | {
"lang": "python",
"repo": "mpwillia/Keras-Talk-Examples",
"path": "/2_text/interactive_script_gen.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: majettet4888/cti110 path: /P5HW1_RandomNumber _ThelmaMajette.py
# Random number guessing game.
# 10 July 20
# CTI-110 P5HW1 - Random Number
# Thelma Majette
import random
randomNumber = random.randint (1,100)
# main function
def main():
<|fim_suffix|> # Ask user for a num... | code_fim | medium | {
"lang": "python",
"repo": "majettet4888/cti110",
"path": "/P5HW1_RandomNumber _ThelmaMajette.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Ask user for a number ()
guess = int(input('\nGuess a number between 1 and 100: '))
# Perform the selected action.
if guess > randomNumber:
print ('\nToo high, try again.' )
elif guess < randomNumber:
pri... | code_fim | medium | {
"lang": "python",
"repo": "majettet4888/cti110",
"path": "/P5HW1_RandomNumber _ThelmaMajette.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for idx in range(query_num):
op_f.write('{} {} {} {} {} >>{}/querywise_result\n'.format(
command, query, doc, idx, std_ans, std_dir))
op_f.close()
subprocess.call('cat {}/jobs | parallel --no-notice -j 4 '.format(std_dir), shell=True)
subprocess.call('rm {}/*.pkl'.format(std_dir), she... | code_fim | hard | {
"lang": "python",
"repo": "allyoushawn/grape_project",
"path": "/ssae/utils/std_dev_eval.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>command = 'utils/single_query_example.py'
query = std_dir + '/query.pkl'
doc = std_dir + '/doc.pkl'
with open(query, 'rb') as fp:
query_num = len(pickle.load(fp))
for idx in range(query_num):
op_f.write('{} {} {} {} {} >>{}/querywise_result\n'.format(
command, query, doc, idx, st... | code_fim | medium | {
"lang": "python",
"repo": "allyoushawn/grape_project",
"path": "/ssae/utils/std_dev_eval.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: allyoushawn/grape_project path: /ssae/utils/std_dev_eval.py
#!/usr/bin/env python3
import subprocess
import sys
import pickle
if len(sys.argv) != 3:
print('Usage: std_dev_eval.py <std_dir> <ans>')
quit()
std_dir=sys.argv[1]
std_ans=sys.argv[2]
subprocess.call('rm -f {}/result'.format(s... | code_fim | medium | {
"lang": "python",
"repo": "allyoushawn/grape_project",
"path": "/ssae/utils/std_dev_eval.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(f"\n\nParagraph Analysis of '{sourceFile}' file")
print(f"---------------------------------------------------------")
print(f" Approximate Word Count: {totWords} ")
print(f" Approximate Sentence Count: {len(paragraph)} ")
print(f" Average Letter Count: {avgLetterCount} ")
p... | code_fim | hard | {
"lang": "python",
"repo": "AQR8HZ/UCI-Coding-Bootcamp-Data",
"path": "/Unit_3_Python_Challenge/PyParagraph/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AQR8HZ/UCI-Coding-Bootcamp-Data path: /Unit_3_Python_Challenge/PyParagraph/main.py
import os
import csv
import re
totWords = 0
wordLen = 0
totSentWithPunctuation = 0
sourceFile = os.path.join('Resources', 'paragraph_2.txt')
with open(sourceFile, 'r') as paragraph:
paragraph = paragraph.rea... | code_fim | hard | {
"lang": "python",
"repo": "AQR8HZ/UCI-Coding-Bootcamp-Data",
"path": "/Unit_3_Python_Challenge/PyParagraph/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>etail'),
path('lic/',views.lic,name='lic'),
path('post/',views.post,name='post'),
path('post/<int:id>/',views.post_detail, name='post_detail'),
path('lic/<int:id>/',views.lic_detail, name='lic_detail'),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=sett... | code_fim | hard | {
"lang": "python",
"repo": "SDeVPro/jinja",
"path": "/shophit/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SDeVPro/jinja path: /shophit/urls.py
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from home import views
from order import views as OV
urlpatterns = [
path('user', include('user.urls')),
... | code_fim | hard | {
"lang": "python",
"repo": "SDeVPro/jinja",
"path": "/shophit/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def iniciales1(nombre,ape1,*apellidos):
iniciales=nombre[0]+'.'+ape1[0]
for ape in apellidos:
iniciales=iniciales+'.'+ape[0]
return iniciales.upper()<|fim_prefix|># repo: Bastalek/pr1-1 path: /lib/m1.py
import sys
def saludar(saludo):
print saludo
def iniciales(nombre,ape1,ape2):
<|fim_middle|>... | code_fim | medium | {
"lang": "python",
"repo": "Bastalek/pr1-1",
"path": "/lib/m1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bastalek/pr1-1 path: /lib/m1.py
import sys
def saludar(saludo):
print saludo
def iniciales(nombre,ape1,ape2):
iniciales=nombre[0]+'.'+ape1[0]+'.'+ape2[0]+'.'
return "Tus iniciales son:"+iniciales.upper()
<|fim_suffix|> iniciales=nombre[0]+'.'+ape1[0]
for ape in apellidos:
iniciales=in... | code_fim | easy | {
"lang": "python",
"repo": "Bastalek/pr1-1",
"path": "/lib/m1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cliffrunner/Machine_Learning path: /HW2/_algorithms/mimic.py
import numpy as np
from sklearn.metrics import mutual_info_score
def mimic_binary(max_iter=100, fitness_func=None, space=None):
assert fitness_func is not None
assert space is not None
<|fim_suffix|>def mutual_info(parent, ch... | code_fim | hard | {
"lang": "python",
"repo": "cliffrunner/Machine_Learning",
"path": "/HW2/_algorithms/mimic.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_pool = []
for i in range(max_iter):
print("mimic: {}|{}".format(i+1, max_iter))
theta += delta
for j, parent in enumerate(pool):
if j in new_pool or fitness_func(parent)<theta: continue
best_score = 0
best_child = parent
... | code_fim | hard | {
"lang": "python",
"repo": "cliffrunner/Machine_Learning",
"path": "/HW2/_algorithms/mimic.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> parent = [int(x) for x in parent]
child = [int(x) for x in child]
return mutual_info_score(parent,child)<|fim_prefix|># repo: cliffrunner/Machine_Learning path: /HW2/_algorithms/mimic.py
import numpy as np
from sklearn.metrics import mutual_info_score
def mimic_binary(max_iter=100, fitness_f... | code_fim | hard | {
"lang": "python",
"repo": "cliffrunner/Machine_Learning",
"path": "/HW2/_algorithms/mimic.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: knjosk/afi_uge path: /Accounting_Statistics/sbin/read-csv-dict.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import csv
from collections import defaultdict
from docopt import docopt
<|fim_suffix|>reader = csv.reader(user_limit_f)
header = next(reader)
for row in reader:
user_limit_dict[row[0]... | code_fim | hard | {
"lang": "python",
"repo": "knjosk/afi_uge",
"path": "/Accounting_Statistics/sbin/read-csv-dict.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>used_f = open(used_file, 'r')
reader = csv.DictReader(used_f)
for row in reader:
print row<|fim_prefix|># repo: knjosk/afi_uge path: /Accounting_Statistics/sbin/read-csv-dict.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import csv
from collections import defaultdict
from docopt import docopt
__doc_... | code_fim | hard | {
"lang": "python",
"repo": "knjosk/afi_uge",
"path": "/Accounting_Statistics/sbin/read-csv-dict.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paul-ollis/cleversheep3 path: /Test/Tester/Core.py
lf.cs_tags = {}
for arg in args:
if ":" in arg:
name, value = arg.split(":", 1)
self.cs_flags[name] = value
else:
self.cs_flags[arg] = True
for name in kwarg... | code_fim | hard | {
"lang": "python",
"repo": "paul-ollis/cleversheep3",
"path": "/Test/Tester/Core.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paul-ollis/cleversheep3 path: /Test/Tester/Core.py
est does not have ``abc`` set then the result
is ``None``.
"""
if name in self.__dict__:
return self.__dict__.get(name)
return self.cs_tags.get(name, None)
class Result:
"""Full result details for... | code_fim | hard | {
"lang": "python",
"repo": "paul-ollis/cleversheep3",
"path": "/Test/Tester/Core.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> If this is ``None`` then this item is the root of a (possibly nested)
suite of tests.
"""
return self._collection.parent(self)
@intelliprop
def ancestors(self):
"""A list of all ancestors for this item.
Each entry is a UID. The first entry is the ... | code_fim | hard | {
"lang": "python",
"repo": "paul-ollis/cleversheep3",
"path": "/Test/Tester/Core.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.