text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: shawn243343/comp9321Groj path: /rank.py import pandas as pd def ranked(country, variety, price, num): data = pd.read_csv("wine_final.csv") if num == 0: return None if country !='': data = data.query("country==\"{}\"".format(country)) <|fim_suffix|> if price !=''...
code_fim
medium
{ "lang": "python", "repo": "shawn243343/comp9321Groj", "path": "/rank.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if price !='': # data['price']=data['price'].str.replace(',','').astype(int) data = data.query("price=={}".format(price)) data = data.sort_values(by='points', ascending=False) result=[] count = 0 for index,row in data.iterrows(): if count >= num: bre...
code_fim
medium
{ "lang": "python", "repo": "shawn243343/comp9321Groj", "path": "/rank.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #从fund_info数据表中提取出fund_id,加入fund_nav_data数据表中的fund_id for fund_name in sql_df['fund_name'].unique(): sql = "SELECT * FROM fund_info" fund_info_sql_df = pd.read_sql(sql, con) fund_id = fund_info_sql_df.loc[fund_info_sql_df.fund_name == fund_name, 'fund_id'].values[0] ...
code_fim
hard
{ "lang": "python", "repo": "Geek-Lee/excel-upload-sqlite3", "path": "/mins/website/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Geek-Lee/excel-upload-sqlite3 path: /mins/website/views.py ame, 'group'].values[0]) fund_type_strategy = str(commit_data.loc[commit_data.fund_full_name == name, 'fund_type_strategy'].values[0]) reg_code = str(commit_data.loc[commit_data.fund_full_name == name, 'reg_code']....
code_fim
hard
{ "lang": "python", "repo": "Geek-Lee/excel-upload-sqlite3", "path": "/mins/website/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #把一行表格dataframe提取其中的值 user_name = str(name) sex = str(commit_data.loc[commit_data.user_name == name, 'sex'].values[0]) org_name = str(commit_data.loc[commit_data.user_name == name, 'org_name'].values[0]) introduction = str(commit_data.loc[commit_...
code_fim
hard
{ "lang": "python", "repo": "Geek-Lee/excel-upload-sqlite3", "path": "/mins/website/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: allisson/loafer path: /loafer/ext/aws/routes.py from ...routes import Route from .providers import SQSProvider from .message_translators import SQSMessageTranslator, SNSMessageTranslator class SQSRoute(Route): def __init__(self, provider_queue, provider_options=None, *args, **kwargs): <|fim...
code_fim
hard
{ "lang": "python", "repo": "allisson/loafer", "path": "/loafer/ext/aws/routes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, provider_queue, provider_options=None, *args, **kwargs): provider_options = provider_options or {} provider = SQSProvider(provider_queue, **provider_options) kwargs['provider'] = provider if 'message_translator' not in kwargs: kwargs['mess...
code_fim
hard
{ "lang": "python", "repo": "allisson/loafer", "path": "/loafer/ext/aws/routes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for index in matrix: jndex = 0 new_row = [] while jndex < len(index): new_row.append(index[jndex] ** 2) jndex += 1 new_matrix.append(new_row) return new_matrix<|fim_prefix|># repo: MarcoANT9/holbertonschool-higher_level_programming path: /0x...
code_fim
easy
{ "lang": "python", "repo": "MarcoANT9/holbertonschool-higher_level_programming", "path": "/0x04-python-more_data_structures/0-square_matrix_simple.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarcoANT9/holbertonschool-higher_level_programming path: /0x04-python-more_data_structures/0-square_matrix_simple.py #!/usr/bin/python3 def square_matrix_simple(matrix=[]): '''This function will compute the square root of all integers in a matrix. ...
code_fim
easy
{ "lang": "python", "repo": "MarcoANT9/holbertonschool-higher_level_programming", "path": "/0x04-python-more_data_structures/0-square_matrix_simple.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Anezeres/AprendizajeConPython path: /RStudio y Python/Python/01-Estructura de datos Python/00-Listas.py L5 = [0]*10 print(L5) L5[2] = 20 print(L5) <|fim_suffix|>L6 = [1,2,3,4,5,6] print(L6[1::2]) print(L6[::2])<|fim_middle|>print(L5[1:4]) L5.append(30) print(L5) L5.remove(30) #Elimina la pri...
code_fim
medium
{ "lang": "python", "repo": "Anezeres/AprendizajeConPython", "path": "/RStudio y Python/Python/01-Estructura de datos Python/00-Listas.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print(L5[1:4]) L5.append(30) print(L5) L5.remove(30) #Elimina la primera ocurrencia del objeto print(L5) L6 = [1,2,3,4,5,6] print(L6[1::2]) print(L6[::2])<|fim_prefix|># repo: Anezeres/AprendizajeConPython path: /RStudio y Python/Python/01-Estructura de datos Python/00-Listas.py L5 = [0]*10 print(L5...
code_fim
easy
{ "lang": "python", "repo": "Anezeres/AprendizajeConPython", "path": "/RStudio y Python/Python/01-Estructura de datos Python/00-Listas.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> L5.remove(30) #Elimina la primera ocurrencia del objeto print(L5) L6 = [1,2,3,4,5,6] print(L6[1::2]) print(L6[::2])<|fim_prefix|># repo: Anezeres/AprendizajeConPython path: /RStudio y Python/Python/01-Estructura de datos Python/00-Listas.py L5 = [0]*10 print(L5) <|fim_middle|>L5[2] = 20 print(L5) pr...
code_fim
medium
{ "lang": "python", "repo": "Anezeres/AprendizajeConPython", "path": "/RStudio y Python/Python/01-Estructura de datos Python/00-Listas.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: caopeirui/station-py path: /tests/test.py #! /usr/bin/env python3 # -*- coding: utf-8 -*- """ DIM Station Test ~~~~~~~~~~~~~~~~ Unit test for DIM Station """ import unittest from dimp import ID, NetworkID class StationTestCase(unittest.TestCase): <|fim_suffix|> total_mone...
code_fim
hard
{ "lang": "python", "repo": "caopeirui/station-py", "path": "/tests/test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> total_money = 15 * 10000 * 10000 package = 2 ** 20 print('total money: %d, first package: %d' % (total_money, package)) spent = 0 day = 0 year = 0 while (spent + package) <= total_money and package >= 1: spent += package day +...
code_fim
hard
{ "lang": "python", "repo": "caopeirui/station-py", "path": "/tests/test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: HpBoss/Cubor path: /TypeWriting/PyScripts/GetTones.py import os from typing import List from pypinyin import pinyin, lazy_pinyin # map vowel-number combination to unicode toneMap = { "d": ['ā', 'ē', 'ī', 'ō', 'ū', 'ǜ'], "f": ['á', 'é', 'í', 'ó', 'ú', 'ǘ'], "j": ['ǎ', 'ě', 'ǐ', 'ǒ', ...
code_fim
hard
{ "lang": "python", "repo": "HpBoss/Cubor", "path": "/TypeWriting/PyScripts/GetTones.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> tempToneKeys = [] for tone in tones: toneKey = getToneKeys(tone) if toneKey not in tempToneKeys: # 如果类似 啊 这样的字有多音 a e 都是一声就避免重复 tempToneKeys.append(toneKey) # base-dict 来源于 pinyin_simp...
code_fim
hard
{ "lang": "python", "repo": "HpBoss/Cubor", "path": "/TypeWriting/PyScripts/GetTones.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ugiete/PPD-2021-1 path: /Trabalho-1.2/src/utils.py from random import randint import matplotlib.pyplot as plt def generate_list(length: int) -> list: """Generate a list with given length with random integer values in the interval [0, length] <|fim_suffix|> Args: k (list): Threads...
code_fim
hard
{ "lang": "python", "repo": "ugiete/PPD-2021-1", "path": "/Trabalho-1.2/src/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: k (list): Threads/Process used deviation (list): Standard deviation of the timestamps label (str): "Threads" or "Processos" """ plt.plot(threadList, timestamps.values(), 'o-') plt.legend(mList, title = 'Total valores', loc='best', bbox_to_anchor=(0.5, 0., 0.5,...
code_fim
medium
{ "lang": "python", "repo": "ugiete/PPD-2021-1", "path": "/Trabalho-1.2/src/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Faith-qa/alx-interview path: /0x02-minimum_operations/0-minoperations.py #!/usr/bin/python3 """minimum time time to write operations of copy and paste""" <|fim_suffix|> """ a method that calculates the fewest number of operations needed to result in exactly n H characters in the file ...
code_fim
easy
{ "lang": "python", "repo": "Faith-qa/alx-interview", "path": "/0x02-minimum_operations/0-minoperations.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """loop for n number of times""" for i in range(2, n + 1): if n % i == 0: return minOperations(int(n / i)) + i<|fim_prefix|># repo: Faith-qa/alx-interview path: /0x02-minimum_operations/0-minoperations.py #!/usr/bin/python3 """minimum time time to write operations of copy and ...
code_fim
medium
{ "lang": "python", "repo": "Faith-qa/alx-interview", "path": "/0x02-minimum_operations/0-minoperations.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ a method that calculates the fewest number of operations needed to result in exactly n H characters in the file """ if n <= 1: return 0 """loop for n number of times""" for i in range(2, n + 1): if n % i == 0: return minOperations(int(n / i)) + ...
code_fim
easy
{ "lang": "python", "repo": "Faith-qa/alx-interview", "path": "/0x02-minimum_operations/0-minoperations.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print(c.display())<|fim_prefix|># repo: devansh27201/AkashTechnolabs_Internship path: /D-3-Tasks/cal4.py class cal4: def setdata(self,n1): self.n1 = n1 def display(self): <|fim_middle|> return n1*n1 n1 = int(input("Enter number: ")) c = cal4()
code_fim
medium
{ "lang": "python", "repo": "devansh27201/AkashTechnolabs_Internship", "path": "/D-3-Tasks/cal4.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: devansh27201/AkashTechnolabs_Internship path: /D-3-Tasks/cal4.py class cal4: def setdata(self,n1): <|fim_suffix|> return n1*n1 n1 = int(input("Enter number: ")) c = cal4() print(c.display())<|fim_middle|> self.n1 = n1 def display(self):
code_fim
easy
{ "lang": "python", "repo": "devansh27201/AkashTechnolabs_Internship", "path": "/D-3-Tasks/cal4.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: anbykova/web-poste path: /app/__init__.py import os from flask import Flask from flask.ext.login import LoginManager from config import basedir from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.openid import OpenID from momentjs import momentjs <|fim_suffix|>lm = LoginManager() lm.init_...
code_fim
medium
{ "lang": "python", "repo": "anbykova/web-poste", "path": "/app/__init__.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>lm = LoginManager() lm.init_app(app) app.jinja_env.globals['momentjs'] = momentjs from app import views, models<|fim_prefix|># repo: anbykova/web-poste path: /app/__init__.py import os from flask import Flask from flask.ext.login import LoginManager from config import basedir from flask.ext.sqlalchemy i...
code_fim
medium
{ "lang": "python", "repo": "anbykova/web-poste", "path": "/app/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: priyankakushi/machine-learning path: /018_011_019.py '''import math x = 5 print("sqrt of 5 is", math.sqrt(64)) str1 = "bollywood" str2 = 'ody' if str2 in str1: print("String found") else: print("String not found") print(10+20)''' #try: #block of code #except Exception l: #b...
code_fim
hard
{ "lang": "python", "repo": "priyankakushi/machine-learning", "path": "/018_011_019.py", "mode": "psm", "license": "CC-BY-3.0", "source": "the-stack-v2" }
<|fim_suffix|>try: fileptr = open("file.txt", "w") try: fileptr.write("Hi I am good") finally: fileptr.close() print("file.closed") except: print("Error") else: print("inside else block") try: age = int(input("Enter the age?")) if age<18: raise ValueError ...
code_fim
hard
{ "lang": "python", "repo": "priyankakushi/machine-learning", "path": "/018_011_019.py", "mode": "spm", "license": "CC-BY-3.0", "source": "the-stack-v2" }
<|fim_suffix|> node = self.Node(data) if(self.tail is not None): self.tail.next = node self.tail = node if (self.head is None): self.head = node def remove(self): data = self.head.data self.head = self.head.next if (self.head is None): ...
code_fim
hard
{ "lang": "python", "repo": "alexander-pang/interviewPrep", "path": "/queue.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexander-pang/interviewPrep path: /queue.py class Queue: def __init__(self): self.head = None self.tail = None class Node: def __init__(self, data): self.data = data self.next = None def isEmpty(self): return self.head is N...
code_fim
hard
{ "lang": "python", "repo": "alexander-pang/interviewPrep", "path": "/queue.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>Thread import MainThread from .nexonServer import NexonServer from .tmLogging import TMLoggingThread from .worldCheckboxStatus import WorldCheckBoxThread from .setStartup import setStartupThread<|fim_prefix|># repo: parthspatel/TMRemote path: /python_app/backend/__init__.py from .auth import Auth from .b...
code_fim
medium
{ "lang": "python", "repo": "parthspatel/TMRemote", "path": "/python_app/backend/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ead from .worldCheckboxStatus import WorldCheckBoxThread from .setStartup import setStartupThread<|fim_prefix|># repo: parthspatel/TMRemote path: /python_app/backend/__init__.py from .auth import Auth from .banDetection import BanDetectionThread from .botLogging import BotLoggingThread from .clientLaunch...
code_fim
medium
{ "lang": "python", "repo": "parthspatel/TMRemote", "path": "/python_app/backend/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: parthspatel/TMRemote path: /python_app/backend/__init__.py from .auth import Auth from .banDetection import BanDetectionThread from .botLogging import BotLo<|fim_suffix|>Thread import MainThread from .nexonServer import NexonServer from .tmLogging import TMLoggingThread from .worldCheckboxStatus ...
code_fim
medium
{ "lang": "python", "repo": "parthspatel/TMRemote", "path": "/python_app/backend/__init__.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#%% # Plot percent cytes with expression by bias*chrom*intronless g = sns.FacetGrid( df, row="bias", row_order=["cyte", "gonia", "NS"], col="FB_chrom", col_order=["X", "2L", "2R", "3L", "3R"], sharex=True, sharey=True, margin_titles=True, ) g.map(sns.boxplot, "intronless", ...
code_fim
hard
{ "lang": "python", "repo": "jfear/larval_gonad", "path": "/docs/x_escapers_and_intronless_genes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#%% # Main effects model model = smf.logit("intronless ~ cyte_bias + X", data=df.replace({True: 1, False: 0})) results = model.fit() plot_statsmodels_results( "../output/docs/x_escapers_and_intronless_genes_main_effects.png", str(results.summary2()) ) display(results.summary2()) np.exp(results.params...
code_fim
hard
{ "lang": "python", "repo": "jfear/larval_gonad", "path": "/docs/x_escapers_and_intronless_genes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Oran-G/crispr1011 path: /dataloaders.py print(df.head()) average_value = list() thisdata = list() for line in df.to_dict("records"): if line['cleavage_freq'] != '' and float(line['cleavage_freq']) >= 0: thisdata.append([ ...
code_fim
hard
{ "lang": "python", "repo": "Oran-G/crispr1011", "path": "/dataloaders.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> running_loss += loss.item() if full_output == None: full_output = outputs else: full_output = torch.cat((full_output, outputs), 0) if full_labels == None: full_labels = labels ...
code_fim
hard
{ "lang": "python", "repo": "Oran-G/crispr1011", "path": "/dataloaders.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> data.append(thisdata1) print('time to load data: ', time.monotonic() - ftime, 'seconds') return [data, dl] def fullDataLoader(file="augmentcrisprsql.csv", batch=64, mode="target", target='rank'): ftime = time.monotonic() with open(file) as f: d = list(csv....
code_fim
hard
{ "lang": "python", "repo": "Oran-G/crispr1011", "path": "/dataloaders.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sourjp/gof-design-patterns path: /adapter/adapter-jp.py """I referred below sample. https://ja.wikipedia.org/wiki/Adapter_%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3#:~:text=Adapter%20%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3%EF%BC%88%E3%82%A2%E3%83%80%E3%83%97%E3%82%BF%E3%83%BC%E3%83%BB%E3%83%91%E3%82%BF%E...
code_fim
hard
{ "lang": "python", "repo": "sourjp/gof-design-patterns", "path": "/adapter/adapter-jp.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': product = Product(cost=1000) print(f'product cost {product.get_yen()} yen') adapted_product = ProductAdapter(product) print(f'product cost {adapted_product.get_doll():.1f} doll')<|fim_prefix|># repo: sourjp/gof-design-patterns path: /adapter/adapter-jp.py """I...
code_fim
hard
{ "lang": "python", "repo": "sourjp/gof-design-patterns", "path": "/adapter/adapter-jp.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> elif isinstance(li, list): derivatives.update(resolve_data(li, derivatives_prefix)) else: pass else: pass else: for li in raw_data: if isinstance(li, ...
code_fim
hard
{ "lang": "python", "repo": "ztttttttt/work_file_1", "path": "/common.utility/mlx_utility/resolve_data.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ztttttttt/work_file_1 path: /common.utility/mlx_utility/resolve_data.py def resolve_data(raw_data, derivatives_prefix): derivatives = {} if isinstance(raw_data, dict): for k, v in raw_data.items(): if isinstance(v, dict): derivatives.update(resolve_data...
code_fim
hard
{ "lang": "python", "repo": "ztttttttt/work_file_1", "path": "/common.utility/mlx_utility/resolve_data.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yalaIrfan/python_setup path: /src/CommonUtil/SuperMethodsUtil.py from google.cloud import vision from google.cloud.vision import types from google.oauth2 import service_account import os # import re import io import pdf2image import tempfile import datetime <|fim_suffix|> return {'x1': bo...
code_fim
hard
{ "lang": "python", "repo": "yalaIrfan/python_setup", "path": "/src/CommonUtil/SuperMethodsUtil.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> "Creating temp directory.." print("Creating temp directory.. with src and prefix .. ", prifx, src) # temp_dir = tempfile.mkdtemp(("-"+str(datetime.datetime.now()).replace(":", "-")), "PMR_Claims", self.cwd+os.sep # + "GENERATED"+os.sep+"CLAIMS") temp_dir = ...
code_fim
medium
{ "lang": "python", "repo": "yalaIrfan/python_setup", "path": "/src/CommonUtil/SuperMethodsUtil.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def createSubDir(self, src, subDirNameList): print("Creating a subdirectory..") for subfolder_name in subDirNameList: os.makedirs(os.path.join(src, subfolder_name)) def getFilesindir(self, dire): print('Fetching the file in the directory') print(dire) return os.listdir(dire)...
code_fim
hard
{ "lang": "python", "repo": "yalaIrfan/python_setup", "path": "/src/CommonUtil/SuperMethodsUtil.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>= img[100, 100, 1] # 63 r = img[100, 100, 2] # 68 r = img[100, 100, 2] = 99 # 设置red通道 # 获取和设置 piexl = img.item(100, 100, 2) img.itemset((100, 100, 2), 99)<|fim_prefix|># repo: caok168/pythondemo path: /opencv_demos/demo2.py import cv2 img = cv2.imread('imgs/1.png') pixel = img[100, 100] img[100, 100] ...
code_fim
medium
{ "lang": "python", "repo": "caok168/pythondemo", "path": "/opencv_demos/demo2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: caok168/pythondemo path: /opencv_demos/demo2.py import cv2 img = cv2.imread('imgs/1.png') pixel = img[100, 100] img[100, 100] <|fim_suffix|>= img[100, 100, 1] # 63 r = img[100, 100, 2] # 68 r = img[100, 100, 2] = 99 # 设置red通道 # 获取和设置 piexl = img.item(100, 100, 2) img.itemset((100, 100, 2), 99)...
code_fim
medium
{ "lang": "python", "repo": "caok168/pythondemo", "path": "/opencv_demos/demo2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lord-Gusarov/holbertonschool-higher_level_programming path: /0x0F-python-object_relational_mapping/8-model_state_fetch_first.py #!/usr/bin/python3 """Prints the first State object from the database specified """ from sys import argv import sqlalchemy from sqlalchemy import create_engine, orm from...
code_fim
hard
{ "lang": "python", "repo": "Lord-Gusarov/holbertonschool-higher_level_programming", "path": "/0x0F-python-object_relational_mapping/8-model_state_fetch_first.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> first = session.query(State).order_by(State.id).first() out = 'Nothing' if first is None else '{}: {}'.format(first.id, first.name) print(out) session.close()<|fim_prefix|># repo: Lord-Gusarov/holbertonschool-higher_level_programming path: /0x0F-python-object_relational_mapping/8-model_s...
code_fim
hard
{ "lang": "python", "repo": "Lord-Gusarov/holbertonschool-higher_level_programming", "path": "/0x0F-python-object_relational_mapping/8-model_state_fetch_first.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zihuaweng/leetcode-solutions path: /leetcode_python/math_leetcode.py #!/usr/bin/env python3 # coding: utf-8 # Time complexity: O() # Space complexity: O() import math # 最大公约数 Greatest common divisor def get_gcd(a, b): if b == 0: return a print(a, b) return get_gcd(b, a % ...
code_fim
hard
{ "lang": "python", "repo": "zihuaweng/leetcode-solutions", "path": "/leetcode_python/math_leetcode.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def myPow(self, x: float, n: int) -> float: if n == 0: return 1 if n < 0: n = -n x = 1 / x if n & 1 == 0: return self.myPow(x * x, n >> 1) else: return x * self.myPow(x * x, n >> 1) # sqrt class Solution: ...
code_fim
hard
{ "lang": "python", "repo": "zihuaweng/leetcode-solutions", "path": "/leetcode_python/math_leetcode.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># power class Solution: def myPow(self, x: float, n: int) -> float: if n == 0: return 1 if n < 0: n = -n x = 1 / x if n & 1 == 0: return self.myPow(x * x, n >> 1) else: return x * self.myPow(x * x, n >> 1) # s...
code_fim
hard
{ "lang": "python", "repo": "zihuaweng/leetcode-solutions", "path": "/leetcode_python/math_leetcode.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>data = LaserData() #server = TCP(SERVER, PORT) server = TCP() server.start_server() for i in range(100): data = server.recv_server() print data<|fim_prefix|># repo: maluethi/laser_tcp path: /test_server.py __author__ = 'matthias' from tcp import * from data import * <|fim_middle|>#SERVER = "13...
code_fim
easy
{ "lang": "python", "repo": "maluethi/laser_tcp", "path": "/test_server.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: maluethi/laser_tcp path: /test_server.py __author__ = 'matthias' from tcp import * from data import * <|fim_suffix|>data = LaserData() #server = TCP(SERVER, PORT) server = TCP() server.start_server() for i in range(100): data = server.recv_server() print data<|fim_middle|>#SERVER = "13...
code_fim
easy
{ "lang": "python", "repo": "maluethi/laser_tcp", "path": "/test_server.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AhmedSakrr/Freqtrade_strategies-2 path: /Maro4h_bb_Adx.py # --- Do not remove these libs --- from freqtrade.strategy.interface import IStrategy from typing import Dict, List from functools import reduce from pandas import DataFrame # -------------------------------- import datetime import talib....
code_fim
hard
{ "lang": "python", "repo": "AhmedSakrr/Freqtrade_strategies-2", "path": "/Maro4h_bb_Adx.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Based on TA indicators, populates the buy signal for the given dataframe :param dataframe: DataFrame :return: DataFrame with buy column """ dataframe.loc[ ( (qtpylib.crossed_above(dataframe['ema'],dataframe['ema2'])) ...
code_fim
hard
{ "lang": "python", "repo": "AhmedSakrr/Freqtrade_strategies-2", "path": "/Maro4h_bb_Adx.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># data = minerl.data.make("MineRLNavigateDense-v0", data_dir="../dataset/navigate") # # # Iterate through a single epoch gathering sequences of at most 32 steps # for current_state, action, reward, next_state, done in data.sarsd_iter(num_epochs=1, max_sequence_len=32): # # Print the POV @ the first st...
code_fim
medium
{ "lang": "python", "repo": "dsiegler2000/MineRL", "path": "/src/ddqn/data_loader.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dsiegler2000/MineRL path: /src/ddqn/data_loader.py import numpy as np import skimage def preprocess_img(img, size): img = np.rollaxis(img, 0, 3) # It becomes (640, 480, 3) img = skimage.transform.resize(img, size) img = skimage.color.rgb2gray(img) <|fim_suffix|># data = minerl.dat...
code_fim
medium
{ "lang": "python", "repo": "dsiegler2000/MineRL", "path": "/src/ddqn/data_loader.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in rows: for j in cols: rowVals = rows[i] colVals = cols[j] total = 0 p1, p2 = 0, 0 while p1 < len(rowVals) and p2 < len(colVals): if rowVals[p1][1] ==...
code_fim
hard
{ "lang": "python", "repo": "JeremyTsaii/LeetCode", "path": "/sparse-matrix-multiplication/sparse-matrix-multiplication.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(len(B)): for j in range(len(B[0])): if B[i][j]: cols[j].append((B[i][j], i)) for i in rows: for j in cols: rowVals = rows[i] colVals = cols[j] total ...
code_fim
hard
{ "lang": "python", "repo": "JeremyTsaii/LeetCode", "path": "/sparse-matrix-multiplication/sparse-matrix-multiplication.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JeremyTsaii/LeetCode path: /sparse-matrix-multiplication/sparse-matrix-multiplication.py from collections import defaultdict class Solution: def multiply(self, A: List[List[int]], B: List[List[int]]) -> List[List[int]]: <|fim_suffix|> for i in range(len(B)): for j in range(...
code_fim
hard
{ "lang": "python", "repo": "JeremyTsaii/LeetCode", "path": "/sparse-matrix-multiplication/sparse-matrix-multiplication.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def testPricingMultipleItemsWithMultipleDiscounts(self): scanner = Scanner(self.multipleDiscountsItemList) groceryList = ['Orange','Apple','Tomato','Orange','Tomato','Cucumber','Tomato','Tomato','Tomato', 'Apple','Cucumber','Apple','Tomato','Tomato','Apple','Toma...
code_fim
hard
{ "lang": "python", "repo": "example-neitz/vogogo-shopping-cart", "path": "/Checkout_unittests.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class CheckoutTests(unittest.TestCase): def setUp(self): pricingRulesWithSingleDiscount = { 'Apple': { 1 : '0.50' , 3 : '1.30' }, 'Orange': {1 : '0.20'}, 'Tomato': {1 : '1.25'}, 'Cucumber': {1 : '0.10'} ...
code_fim
hard
{ "lang": "python", "repo": "example-neitz/vogogo-shopping-cart", "path": "/Checkout_unittests.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: example-neitz/vogogo-shopping-cart path: /Checkout_unittests.py """ Unit test for the Supermarket checkout exercise """ import unittest from decimal import * from ShoppingCart import * # Unit tests ----- class ScannerTests(unittest.TestCase): def setUp(self): pricingRulesWithSing...
code_fim
hard
{ "lang": "python", "repo": "example-neitz/vogogo-shopping-cart", "path": "/Checkout_unittests.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> des=request.args.get('description') json_data=searchKnowledge.getTotalData_forKnowledgeSearch(des) print(json_data) return jsonify(json_data) @app.route('/case_search_Test',methods=['get','post']) def case_search_Test(): return render_template( 'case_search_Test.html', ...
code_fim
hard
{ "lang": "python", "repo": "realcopycat/Athena_App", "path": "/athena_App/athena_App/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> caseDes=request.args.get('caseDes') #initialize graph search object case_graph_result=caseQuery(caseDes) pre_json_data=case_graph_result.getData() print(pre_json_data) return jsonify(pre_json_data) @app.route('/knife',methods=['get','post']) def knife(): return render_templa...
code_fim
hard
{ "lang": "python", "repo": "realcopycat/Athena_App", "path": "/athena_App/athena_App/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: realcopycat/Athena_App path: /athena_App/athena_App/views.py """ Routes and views for the flask application. """ from datetime import datetime from flask import render_template, redirect, url_for, request, jsonify from athena_App import app from athena_App.formClass import QuestionForm import t...
code_fim
hard
{ "lang": "python", "repo": "realcopycat/Athena_App", "path": "/athena_App/athena_App/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tomhuntcouk/mayaSettings_2016.5 path: /python/th_utils/th_VertexColorToUVMoveNode.py import pymel.all as pm from collections import Counter # example # v.Create( sel[0], pm.datatypes.Color.red, sel[1], 'leftEye', 0.2 ) # select mesh 1st then the control def Create( obj, targetColor, control, a...
code_fim
medium
{ "lang": "python", "repo": "tomhuntcouk/mayaSettings_2016.5", "path": "/python/th_utils/th_VertexColorToUVMoveNode.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> else : pm.warning('The target must be a mesh') # use this to connect the PolyMoveUV to the joint attribute you want FF (shader) to read # example : ConnectToAttr( sel[0], sel[1], 'translateX' ) - select mesh 1st then joint def ConnectToAttr( src, trgt, attr ) : moveUVs = src.getShape().history(ty...
code_fim
hard
{ "lang": "python", "repo": "tomhuntcouk/mayaSettings_2016.5", "path": "/python/th_utils/th_VertexColorToUVMoveNode.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if( len(moveUVs) > len(attr) ) : pm.warning( 'There are more polyMoveUV nodes that attrs to connect to %s:%s' % ( len(moveUVs), len(attr) ) ) else : for i, moveUV in enumerate(moveUVs) : moveUV.translateV >> attr[i]<|fim_prefix|># repo: tomhuntcouk/mayaSettings_2016.5 path: /python/th_utils/th_...
code_fim
hard
{ "lang": "python", "repo": "tomhuntcouk/mayaSettings_2016.5", "path": "/python/th_utils/th_VertexColorToUVMoveNode.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>rt(kwic1.kwic(mystr) == [mystr]) #assert(len(kwic3.kwic(mystr))==2) assert len(kwic.kwic(mystr)) == 3<|fim_prefix|># repo: DrakeSeifert/Software-Engineering-I path: /assignment1/finalProduct/testkwic3.py import kwic mystr = "hello world\nmy test\napple<|fim_middle|>s oranges" #asseirt(kwic0.kwic(mystr)...
code_fim
easy
{ "lang": "python", "repo": "DrakeSeifert/Software-Engineering-I", "path": "/assignment1/finalProduct/testkwic3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>.kwic(mystr))==2) assert len(kwic.kwic(mystr)) == 3<|fim_prefix|># repo: DrakeSeifert/Software-Engineering-I path: /assignment1/finalProduct/testkwic3.py import kwic mystr = "hello world\nmy test\napple<|fim_middle|>s oranges" #asseirt(kwic0.kwic(mystr) == []) #assert(kwic1.kwic(mystr) == [mystr]) #ass...
code_fim
medium
{ "lang": "python", "repo": "DrakeSeifert/Software-Engineering-I", "path": "/assignment1/finalProduct/testkwic3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: DrakeSeifert/Software-Engineering-I path: /assignment1/finalProduct/testkwic3.py import kwic mystr = "hello world\nmy test\napples oranges" #asseirt(kwic0.kwic(mystr) == []) #asse<|fim_suffix|>.kwic(mystr))==2) assert len(kwic.kwic(mystr)) == 3<|fim_middle|>rt(kwic1.kwic(mystr) == [mystr]) #ass...
code_fim
easy
{ "lang": "python", "repo": "DrakeSeifert/Software-Engineering-I", "path": "/assignment1/finalProduct/testkwic3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ajaniv/pytorch_explore path: /explore/neural_network_pytorch.py """ Simple neural network using pytorch """ import torch import torch.nn as nn # Prepare the data # X represents the amount of hours studied and how much time students spent sleeping X = torch.tensor(([2, 9], [1, 5], [3, 6]), dtype...
code_fim
hard
{ "lang": "python", "repo": "ajaniv/pytorch_explore", "path": "/explore/neural_network_pytorch.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def save_weights(self, model): # we will use the PyTorch internal storage functions torch.save(model, "NN") # you can reload model with all the weights and so forth with: # torch.load("NN") def predict(self): """predict""" # @TODO: should be...
code_fim
hard
{ "lang": "python", "repo": "ajaniv/pytorch_explore", "path": "/explore/neural_network_pytorch.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>: for j in range(i-1): if not (sum_array[i]-sum_array[j])%k: return True return False<|fim_prefix|># repo: xwang322/Coding-Interview path: /python/P523.py class Solution(object): def checkSubarraySum(self, nums, k): if not nums or ...
code_fim
hard
{ "lang": "python", "repo": "xwang322/Coding-Interview", "path": "/python/P523.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: xwang322/Coding-Interview path: /python/P523.py class Solution(object): def checkSubarraySum(self, nums, k): if not nums or len(nums) == 1: return False sum_array = [0]*(len(nums)+1) for i, num in enumerate(nums): sum_array[i+1] = sum_arra...
code_fim
hard
{ "lang": "python", "repo": "xwang322/Coding-Interview", "path": "/python/P523.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if sum_array[-1] == 0: return True else: return False for i in range(1, len(sum_array)): for j in range(i-1): if not (sum_array[i]-sum_array[j])%k: return True return False<|fim_prefix|># ...
code_fim
hard
{ "lang": "python", "repo": "xwang322/Coding-Interview", "path": "/python/P523.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hai-zhu/bebop2_toolbox path: /bebop2_nonlinear_mpc/scripts/bebop_nmpc_node.py #!/usr/bin/env python import numpy as np import rospy import tf from geometry_msgs.msg import PoseStamped, Twist, TwistStamped, Point from nav_msgs.msg import Odometry from visualization_msgs.msg import Marker from beb...
code_fim
hard
{ "lang": "python", "repo": "hai-zhu/bebop2_toolbox", "path": "/bebop2_nonlinear_mpc/scripts/bebop_nmpc_node.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # obtain solution traj_opt = nlp_sol['x'].reshape((self.mpc_nu_ + self.mpc_nx_ + self.mpc_ns_, self.mpc_N_)) self.mpc_u_plan_ = np.array(traj_opt[:self.mpc_nu_, :]) self.mpc_x_plan_ = np.array(traj_opt[self.mpc_nu_:self.mpc_nu_+self.mpc_nx_, :]) self.mpc_s_plan_ = n...
code_fim
hard
{ "lang": "python", "repo": "hai-zhu/bebop2_toolbox", "path": "/bebop2_nonlinear_mpc/scripts/bebop_nmpc_node.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i, x in enumerate(p): if type(x) is tuple: new_tuple = tuple([_x[:, offset, :] for _x in x]) p[i] = new_tuple else: p[i] = x[offset, :] # update action history if self.relation_only...
code_fim
hard
{ "lang": "python", "repo": "dertilo/MultiHopKG", "path": "/src/rl/graph_search/graph_walk_agent.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: dertilo/MultiHopKG path: /src/rl/graph_search/graph_walk_agent.py ace( action_spaces: List[ActionSpace], inv_offset, kg: KnowledgeGraph ): db_r_space, db_e_space, db_action_mask = [], [], [] forks = [] for acsp in action_spaces: forks += acsp.forks db_r_space.appen...
code_fim
hard
{ "lang": "python", "repo": "dertilo/MultiHopKG", "path": "/src/rl/graph_search/graph_walk_agent.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> A list of action space tensor representations grouped in n buckets, s.t. r_space_b0.size(0) + r_space_b1.size(0) + ... + r_space_bn.size(0) = e.size(0) :return db_references: [l_batch_refs0, l_batch_refs1, ..., l_batch_refsn] l_batch_refsi stores th...
code_fim
hard
{ "lang": "python", "repo": "dertilo/MultiHopKG", "path": "/src/rl/graph_search/graph_walk_agent.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: BerilBBJ/scraperwiki-scraper-vault path: /Users/R/russkel/wa_department_of_health_health_act_offenders.py import scraperwiki, lxml.html, urllib2, re from datetime import datetime #html = scraperwiki.scrape("http://www.public.health.wa.gov.au/2/1035/2/publication_of_names_of_offenders_list.pm") d...
code_fim
hard
{ "lang": "python", "repo": "BerilBBJ/scraperwiki-scraper-vault", "path": "/Users/R/russkel/wa_department_of_health_health_act_offenders.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#select the table that contains the offenders, ignoring the first one that contains the header row for tr in root.xpath("//div[@id='verdiSection10']/div/div/table/tbody/tr")[1:]: data = { 'conviction_date': datetime.strptime( re.match("(\d+/\d+/\d+)", tr[0].text_content().strip())....
code_fim
hard
{ "lang": "python", "repo": "BerilBBJ/scraperwiki-scraper-vault", "path": "/Users/R/russkel/wa_department_of_health_health_act_offenders.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: enplus/parttime path: /singleton_abc/main.py from common.utils import create_brokers from Bot import DataGatherBot, ArbitrageBot import api_config as config <|fim_suffix|># brokers = create_brokers('BACKTEST', config.CURRENCIES, config.EXCHANGES) # bot = ArbitrageBot(config, brokers) # this auto...
code_fim
medium
{ "lang": "python", "repo": "enplus/parttime", "path": "/singleton_abc/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>brokers = create_brokers('LIVE', config.CURRENCIES, config.EXCHANGES) gp = brokers[2] # gp.update_all_balances() # gp.xchg.get_all_balances() # gatherbot = DataGatherBot(config, brokers) # maxdepth 체크할 호가 개수(-1) # gatherbot.start(sleep=1, duration=60 * 60 * 4, maxdepth=4) # 5 hours of data, one minute in...
code_fim
hard
{ "lang": "python", "repo": "enplus/parttime", "path": "/singleton_abc/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def reset(self): for player, data in self.player_data.items(): data[1] = None data[2] = None def round_won(self): sum = self.sum() for player, data in self.player_data.items(): if data[2] == sum: return player re...
code_fim
hard
{ "lang": "python", "repo": "thurbridi/INE5430", "path": "/trabalhos/trabalho-01/palitos.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for player, data in self.player_data.items(): data[1] = None data[2] = None def round_won(self): sum = self.sum() for player, data in self.player_data.items(): if data[2] == sum: return player return None def wo...
code_fim
hard
{ "lang": "python", "repo": "thurbridi/INE5430", "path": "/trabalhos/trabalho-01/palitos.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: thurbridi/INE5430 path: /trabalhos/trabalho-01/palitos.py from random import randint class Game(object): def __init__(self, players): if len(players) < 2: raise ValueError('Number of player must be at least 2') self.play_order = players self.player_data...
code_fim
hard
{ "lang": "python", "repo": "thurbridi/INE5430", "path": "/trabalhos/trabalho-01/palitos.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return render_to_response(template_name, { "form": form, }, context_instance=RequestContext(request))<|fim_prefix|># repo: pydanny/whydjango path: /src/whydjango/casestudies/views.py from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpR...
code_fim
hard
{ "lang": "python", "repo": "pydanny/whydjango", "path": "/src/whydjango/casestudies/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if form.is_valid(): form.save() return HttpResponseRedirect(reverse("submit_message")) return render_to_response(template_name, { "form": form, }, context_instance=RequestContext(request))<|fim_prefix|># repo: pydanny/whydjango path: /src/...
code_fim
medium
{ "lang": "python", "repo": "pydanny/whydjango", "path": "/src/whydjango/casestudies/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pydanny/whydjango path: /src/whydjango/casestudies/views.py from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound from django.shortcuts import render_to_response from django.template import RequestContext from whydjango.c...
code_fim
medium
{ "lang": "python", "repo": "pydanny/whydjango", "path": "/src/whydjango/casestudies/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if k not in name: print("ERROR:Key does not exists Enter a valid key!!") else: m = name[k] if m[1] != 0: if time.time() < m[1]: print ( k + "-" + str(m[0])) else: print("ERROR: " + k + " Time expired") ...
code_fim
hard
{ "lang": "python", "repo": "sivasa02/freshworks_assignment", "path": "/testing/testing.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sivasa02/freshworks_assignment path: /testing/testing.py import time import json from threading import Thread try: with open('file.json') as f: name = json.load(f) except: f = open("file.json", "w+") name = {} def create(k, v, t='0'): if k in name: ...
code_fim
hard
{ "lang": "python", "repo": "sivasa02/freshworks_assignment", "path": "/testing/testing.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: xie-huan/Machine-Learning path: /Machine_Learning/LinearReg/LinearRegression.py import numpy as np from .metrics import r2_score class LinearRegression: def __init__(self): self.coef_ = None # 系数 self.interception_ = None # 截距 self._theta = None def fit_nor...
code_fim
hard
{ "lang": "python", "repo": "xie-huan/Machine-Learning", "path": "/Machine_Learning/LinearReg/LinearRegression.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert X_train.shape[0] == y_train.shape[0], "" def dJ_sgd(theta, X_b_i, y_i): return X_b_i.T.dot(X_b_i.dot(theta) - y_i) * 2 # Stochastic gradient descent def sgd(X_b, y, initial_theta, n_iter, t0=5, t1=50): def learning_rate(t): ...
code_fim
hard
{ "lang": "python", "repo": "xie-huan/Machine-Learning", "path": "/Machine_Learning/LinearReg/LinearRegression.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: EnjambreBit/presentes-backend path: /presentes/migrations/0016_auto_20190523_1107.py # Generated by Django 2.2.1 on 2019-05-23 14:07 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AddField( model_...
code_fim
medium
{ "lang": "python", "repo": "EnjambreBit/presentes-backend", "path": "/presentes/migrations/0016_auto_20190523_1107.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('presentes', '0015_caso_lugar_del_hecho'), ] operations = [ migrations.AddField( model_name='organizacion', name='descripcion', field=models.TextField(default=''), ), migrations.AddField( model_n...
code_fim
medium
{ "lang": "python", "repo": "EnjambreBit/presentes-backend", "path": "/presentes/migrations/0016_auto_20190523_1107.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sliem/ScientificColorschemez path: /latest.py from ScientificColorschemez import Colorschemez import matplotlib.pyplot as plt cs = Colorschemez.latest() <|fim_suffix|>fig, ax = plt.subplots() cs.example_plot(ax) fig.savefig('latest.png', dpi=200, bbox_inches='tight')<|fim_middle|>for name, hexc...
code_fim
medium
{ "lang": "python", "repo": "sliem/ScientificColorschemez", "path": "/latest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fig, ax = plt.subplots() cs.example_plot(ax) fig.savefig('latest.png', dpi=200, bbox_inches='tight')<|fim_prefix|># repo: sliem/ScientificColorschemez path: /latest.py from ScientificColorschemez import Colorschemez import matplotlib.pyplot as plt cs = Colorschemez.latest() <|fim_middle|>for name, hexc...
code_fim
medium
{ "lang": "python", "repo": "sliem/ScientificColorschemez", "path": "/latest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }