text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> n_critic = 5 num_steps = 100 with tf.train.MonitoredSession() as sess: for i in range(num_steps): print("step %d" % i) if i % (n_critic + 1) == 0: sess.run(train_g_op) else: sess.run(train_f_op)<|fim_prefix|># repo: lq...
code_fim
hard
{ "lang": "python", "repo": "lqian/Cycle-W-GAN", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': inputs = train_input_fn() train_f_op, loss_f = model_fn(inputs[0], inputs[1], True, True) train_g_op, loss_g = model_fn(inputs[0], inputs[1], True, False) n_critic = 5 num_steps = 100 with tf.train.MonitoredSession() as sess: for i in range(num_s...
code_fim
hard
{ "lang": "python", "repo": "lqian/Cycle-W-GAN", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lqian/Cycle-W-GAN path: /main.py import numpy as np import tensorflow as tf import generator import GAN_f import GAN_g def model_fn(img_A, img_B, training=True, train_f=True): cycle_loss_weight = 0.5 optimizer = tf.train.RMSPropOptimizer(learning_rate=1e-3) w_dist_A = tf.reduce_mean...
code_fim
hard
{ "lang": "python", "repo": "lqian/Cycle-W-GAN", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pybel/pybel path: /src/pybel/io/hetionet/constants.py # -*- coding: utf-8 -*- """Constants for Hetionet.""" from ...dsl import Abundance, BiologicalProcess, Pathology, Population, Protein, Rna from ...struct import BELGraph HETIONET_PUBMED = "28936969" ################## # Hetionet types # ##...
code_fim
hard
{ "lang": "python", "repo": "pybel/pybel", "path": "/src/pybel/io/hetionet/constants.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ACTIVATES_ACTIONS = { "agonist", "potentiator", "inducer", "positive modulator", "partial agonist", "positive allosteric modulator", "activator", "stimulator", } INHIBITS_ACTIONS = { "inhibitor", "antagonist", "blocker", "partial antagonist", "inhibitor,...
code_fim
hard
{ "lang": "python", "repo": "pybel/pybel", "path": "/src/pybel/io/hetionet/constants.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#################### # Drug action tags # #################### ACTIVATES_ACTIONS = { "agonist", "potentiator", "inducer", "positive modulator", "partial agonist", "positive allosteric modulator", "activator", "stimulator", } INHIBITS_ACTIONS = { "inhibitor", "antag...
code_fim
hard
{ "lang": "python", "repo": "pybel/pybel", "path": "/src/pybel/io/hetionet/constants.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": main()<|fim_prefix|># repo: LLNL/HPCCEA path: /2021/HANFS/fence-agents/tests/test-drac4.py #!/usr/bin/python from fence_testing import test_action def main(): <|fim_middle|> DRAC4 = "devices.d/dell-drac-4I.cfg" ACT_STATUS = "actions.d/status.cfg" ACT_ONOFF = "actions.d/po...
code_fim
hard
{ "lang": "python", "repo": "LLNL/HPCCEA", "path": "/2021/HANFS/fence-agents/tests/test-drac4.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LLNL/HPCCEA path: /2021/HANFS/fence-agents/tests/test-drac4.py #!/usr/bin/python from fence_testing import test_action <|fim_suffix|>if __name__ == "__main__": main()<|fim_middle|>def main(): DRAC4 = "devices.d/dell-drac-4I.cfg" ACT_STATUS = "actions.d/status.cfg" ACT_ONOFF = "actions.d/po...
code_fim
hard
{ "lang": "python", "repo": "LLNL/HPCCEA", "path": "/2021/HANFS/fence-agents/tests/test-drac4.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ikanel/PiHub path: /PythonPi/remotecommand.py import subprocess import sys import settings <|fim_suffix|> try: p = subprocess.Popen(command, stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=True) proc_output=p.communicate(timeout=settings.rpc_command_timeout) res=p...
code_fim
easy
{ "lang": "python", "repo": "ikanel/PiHub", "path": "/PythonPi/remotecommand.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: p = subprocess.Popen(command, stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=True) proc_output=p.communicate(timeout=settings.rpc_command_timeout) res=proc_output[0].decode("utf-8")+proc_output[1].decode("utf-8") return res except: return "Unexpec...
code_fim
easy
{ "lang": "python", "repo": "ikanel/PiHub", "path": "/PythonPi/remotecommand.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stellaGK/stella path: /stellapy/data/potential/load_potentialObject.py #!/usr/bin/python3 import sys, os import pathlib # Stellapy package sys.path.append(os.path.abspath(pathlib.Path(os.environ.get('STELLAPY')).parent)+os.path.sep) from stellapy.data.potential.read_potential3D import g...
code_fim
hard
{ "lang": "python", "repo": "stellaGK/stella", "path": "/stellapy/data/potential/load_potentialObject.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @calculate_attributeWhenReadFirstTime def phi2_vs_t_zonal(self): get_potentialVsTime(self); return self.phi2_vs_t_zonal @calculate_attributeWhenReadFirstTime def phi2_vs_t_nozonal(self): get_potentialVsTime(self); return self.phi2_vs_t_nozonal # Get the 3D potenti...
code_fim
hard
{ "lang": "python", "repo": "stellaGK/stella", "path": "/stellapy/data/potential/load_potentialObject.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def draw(self, screen): screen.blit(self._background, (0, 0)) BaseContext.draw(self, screen) """ button press functions """ def buttonEditNetwork(self, fileName): from context.networkeditcontext import NetworkEditContext self._setContextFunc(...
code_fim
hard
{ "lang": "python", "repo": "YueNing/gadakeco-ml", "path": "/Gadakeco_Code/src/context/networkcontext.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: YueNing/gadakeco-ml path: /Gadakeco_Code/src/context/networkcontext.py import os import random import pygame from pygame.font import Font, SysFont from context.basecontext import BaseContext from gui.guibutton import GuiButton from gui.guicontainer import GuiContainer from gui.guilabel...
code_fim
hard
{ "lang": "python", "repo": "YueNing/gadakeco-ml", "path": "/Gadakeco_Code/src/context/networkcontext.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: juhasch/scikit-rf path: /skrf/plotting.py **heavyColor)) # clipping circle clipc = Circle( [0,0], smithR, ec='k',fc='None',visible=True) ax1.add_patch( clipc) #draw x and y axis ax1.axhline(0, color='k', lw=.1, clip_path=clipc) ax1.axvline(1*y_flip_sign, color='k', clip_...
code_fim
hard
{ "lang": "python", "repo": "juhasch/scikit-rf", "path": "/skrf/plotting.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> x_label : string x-axis label y_label : string y-axis label title : string plot title show_legend : Boolean controls the drawing of the legend ax : :class:`matplotlib.axes.AxesSubplot` object axes to draw on *args,**kwargs : passed to pylab.p...
code_fim
hard
{ "lang": "python", "repo": "juhasch/scikit-rf", "path": "/skrf/plotting.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ''' adds markers to existing lings on a plot this is convinient if you have already have a plot made, but then need to add markers afterwards, so that it can be interpreted in black and white. The markevery argument makes the markers less frequent than the data, which is g...
code_fim
hard
{ "lang": "python", "repo": "juhasch/scikit-rf", "path": "/skrf/plotting.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> download.set_cache_root(cls.default_cache_root) shutil.rmtree(cls.temp_dir) @pytest.mark.slow def test_get_cnn_dailymail(self): raw = get_cnn_dailymail() # train self.assertIn('train', raw) self.assertEqual(len(raw['train']), 2) for x in raw...
code_fim
hard
{ "lang": "python", "repo": "tofunlp/lineflow", "path": "/tests/datasets/test_cnn_dailymail.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tofunlp/lineflow path: /tests/datasets/test_cnn_dailymail.py import shutil import tempfile from unittest import TestCase, mock import pytest from lineflow import download from lineflow.datasets.cnn_dailymail import CnnDailymail, get_cnn_dailymail class CnnDailymailTestCase(TestCase): @cl...
code_fim
hard
{ "lang": "python", "repo": "tofunlp/lineflow", "path": "/tests/datasets/test_cnn_dailymail.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.slow def test_get_cnn_dailymail_twice(self): get_cnn_dailymail() with mock.patch('lineflow.datasets.cnn_dailymail.pickle', autospec=True) as \ mock_pickle: get_cnn_dailymail() mock_pickle.dump.assert_not_called() self.assertE...
code_fim
hard
{ "lang": "python", "repo": "tofunlp/lineflow", "path": "/tests/datasets/test_cnn_dailymail.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Given a known and experimental pair of letter-frequency dictionaries, a translation table is constructed with the experimental letter as the key and the known letter as the value. >>> e = {'a':10, 'b':7, 'c':3} >>> k = {'a':2, 'b':3, 'c':1} >>> t = create_translation(e, k)...
code_fim
hard
{ "lang": "python", "repo": "jreiher2003/7oars", "path": "/frequency/frequency/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jreiher2003/7oars path: /frequency/frequency/__init__.py # -*- coding: utf-8 -*- # # Copyright (C) 2008 John Paulett (john -at- 7oars.com) # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. import ...
code_fim
hard
{ "lang": "python", "repo": "jreiher2003/7oars", "path": "/frequency/frequency/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> with pytest.raises(ValueError): isodatetime(datetime.fromisoformat("2022-09-16T12:03:45+02:00")) def test_parse_isodatetime() -> None: time = parse_isodatetime("2022-09-16T12:03:45Z") assert time == datetime(2022, 9, 16, 12, 3, 45, tzinfo=timezone.utc) now = current_datetime() ...
code_fim
hard
{ "lang": "python", "repo": "lsst-sqre/safir", "path": "/tests/datetime_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lsst-sqre/safir path: /tests/datetime_test.py """Tests for datetime utility functions.""" from __future__ import annotations from datetime import datetime, timedelta, timezone import pytest from safir.datetime import ( current_datetime, format_datetime_for_logging, isodatetime, ...
code_fim
hard
{ "lang": "python", "repo": "lsst-sqre/safir", "path": "/tests/datetime_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_format_datetime_for_logging() -> None: time = datetime.fromisoformat("2022-09-16T12:03:45+00:00") assert format_datetime_for_logging(time) == "2022-09-16 12:03:45" # Test with milliseconds, allowing for getting extremely unlucky and # having no microseconds. Getting unlucky twic...
code_fim
hard
{ "lang": "python", "repo": "lsst-sqre/safir", "path": "/tests/datetime_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fi-ksi/web-backend path: /endpoint/admin/__init__.py from endpoint.admin.evaluations import Evaluation from endpoint.admin.corrections import Corrections from endpoint.admin.corrections import Correction from endpoint.admin.correctionsInfo import CorrectionsInfo from endpoint.admin.correctionsInf...
code_fim
hard
{ "lang": "python", "repo": "fi-ksi/web-backend", "path": "/endpoint/admin/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>point.admin.userExport import UserExport from endpoint.admin.evalCode import EvalCode from endpoint.admin.execs import Execs from endpoint.admin.execs import Exec from endpoint.admin.monitoringDashboard import MonitoringDashboard from endpoint.admin.diploma import DiplomaGrant<|fim_prefix|># repo: fi-ksi/...
code_fim
hard
{ "lang": "python", "repo": "fi-ksi/web-backend", "path": "/endpoint/admin/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TransitApp/gtfs-realtime-bindings path: /python/tests/test_gtfs_realtime_pb2.py #!/usr/bin/python # # Copyright 2015 Google Inc. # # 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 L...
code_fim
medium
{ "lang": "python", "repo": "TransitApp/gtfs-realtime-bindings", "path": "/python/tests/test_gtfs_realtime_pb2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def testParseFromString(self): feed = gtfs_realtime_pb2.FeedMessage() data_dir = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(data_dir, 'vehicle_position.pb'), 'rb') as f: feed.ParseFromString(f.read()) self.assertEquals(1, len(feed.entity)) entity = feed....
code_fim
medium
{ "lang": "python", "repo": "TransitApp/gtfs-realtime-bindings", "path": "/python/tests/test_gtfs_realtime_pb2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> feed = gtfs_realtime_pb2.FeedMessage() data_dir = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(data_dir, 'vehicle_position.pb'), 'rb') as f: feed.ParseFromString(f.read()) self.assertEquals(1, len(feed.entity)) entity = feed.entity[0] self.assertEquals('1...
code_fim
medium
{ "lang": "python", "repo": "TransitApp/gtfs-realtime-bindings", "path": "/python/tests/test_gtfs_realtime_pb2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: neurodata/maggot_models path: /src/embed/embed.py import numpy as np from graspy.embed import AdjacencySpectralEmbed, LaplacianSpectralEmbed, OmnibusEmbed from graspy.utils import pass_to_ranks, get_lcc def ase(adj, n_components, ptr=True): if ptr: adj = pass_to_ranks(adj) ase =...
code_fim
hard
{ "lang": "python", "repo": "neurodata/maggot_models", "path": "/src/embed/embed.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def omni(adjs, n_components, ptr=True): if ptr: adjs = [pass_to_ranks(a) for a in adjs] omni = OmnibusEmbed(n_components=n_components // len(adjs)) latent = omni.fit_transform(adjs) latent = np.concatenate(latent, axis=-1) # first is for in/out latent = np.concatenate(latent,...
code_fim
hard
{ "lang": "python", "repo": "neurodata/maggot_models", "path": "/src/embed/embed.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hpi-dhc/fiber path: /fiber/database/mysql.py from sqlalchemy import ( create_engine, MetaData, ) <|fim_suffix|>engine = create_engine(DATABASE_URI) meta = add_tables(MetaData(bind=engine))<|fim_middle|>from fiber.config import ( DB_HOST, DB_PASSWD, DB_PORT, DB_SCHEMA, ...
code_fim
hard
{ "lang": "python", "repo": "hpi-dhc/fiber", "path": "/fiber/database/mysql.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>meta = add_tables(MetaData(bind=engine))<|fim_prefix|># repo: hpi-dhc/fiber path: /fiber/database/mysql.py from sqlalchemy import ( create_engine, MetaData, ) <|fim_middle|>from fiber.config import ( DB_HOST, DB_PASSWD, DB_PORT, DB_SCHEMA, DB_USER ) from fiber.database.meta i...
code_fim
hard
{ "lang": "python", "repo": "hpi-dhc/fiber", "path": "/fiber/database/mysql.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>DATABASE_URI = ( f'mysql+pymysql://{DB_USER}:{DB_PASSWD}' + f'@{DB_HOST}:{DB_PORT}/{DB_SCHEMA}' ) engine = create_engine(DATABASE_URI) meta = add_tables(MetaData(bind=engine))<|fim_prefix|># repo: hpi-dhc/fiber path: /fiber/database/mysql.py from sqlalchemy import ( create_engine, MetaD...
code_fim
medium
{ "lang": "python", "repo": "hpi-dhc/fiber", "path": "/fiber/database/mysql.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": print(compute())<|fim_prefix|># repo: arvganesh/Project-Euler-Log path: /Python/001.py # # Solution to Project Euler problem 1 # by Project Nayuki # # https://www.nayuki.io/page/project-euler-solutions # https://github.com/nayuki/Project-Euler-solutions # <|fim_middle|># ...
code_fim
medium
{ "lang": "python", "repo": "arvganesh/Project-Euler-Log", "path": "/Python/001.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: arvganesh/Project-Euler-Log path: /Python/001.py # # Solution to Project Euler problem 1 # by Project Nayuki # # https://www.nayuki.io/page/project-euler-solutions # https://github.com/nayuki/Project-Euler-solutions # <|fim_suffix|> ans = sum(x for x in range(1000) if (x % 3 == 0 or x % 5 ==...
code_fim
medium
{ "lang": "python", "repo": "arvganesh/Project-Euler-Log", "path": "/Python/001.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|># fetch result1 with column headings result1 = pd.DataFrame(data=curs.execute(top_10_most_expensive_qry).fetchall(), columns=cols print('\n') print(result1) ############## Average age of an employee ############# result2 = curs.execute(avgAge_query).fetchone() ############## Average age of an employee a...
code_fim
hard
{ "lang": "python", "repo": "rokshana10/DS-Unit-3-Sprint-2-SQL-and-Databases", "path": "/northwind.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Query to see table's schema (the `CREATE TABLE` statement) curs.execute('SELECT sql FROM sqlite_master WHERE name="Customer";').fetchall() ########### Ten most expensive items############## top_10_most_expensive_qry = """ SELECT prod.ProductName, prod.UnitPrice FROM Product AS prod ORDER BY prod.UnitP...
code_fim
medium
{ "lang": "python", "repo": "rokshana10/DS-Unit-3-Sprint-2-SQL-and-Databases", "path": "/northwind.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rokshana10/DS-Unit-3-Sprint-2-SQL-and-Databases path: /northwind.py import sqlite3 import pandas as pd # Conn = sqlite3.connect('".."/data_u3sc2/northwind_small.sqlite3') db_path = ('C:\Users\Rokshana_Parul\Desktop\ROKSHANA\Data_Engineering\Ciass_lecture_Unit3_SP2\DS-Unit-3-Sprint-2-SQL-and-Datab...
code_fim
hard
{ "lang": "python", "repo": "rokshana10/DS-Unit-3-Sprint-2-SQL-and-Databases", "path": "/northwind.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: breencp/Sudoku path: /sudoku_proj/sudoku/views.py import copy import json import re import time from django import forms from django.contrib.admin.views.decorators import staff_member_required from django.db import IntegrityError from django.http import HttpResponseRedirect, HttpResponse from dj...
code_fim
hard
{ "lang": "python", "repo": "breencp/Sudoku", "path": "/sudoku_proj/sudoku/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # uncomment save_game when not using custom board for testing, comment when testing or save will crash # save_game(data) return HttpResponse(status=204) def corrupted_board(user_board): # ensure user_board hasn't been tampered with try: if len(user_board) != 9: ra...
code_fim
hard
{ "lang": "python", "repo": "breencp/Sudoku", "path": "/sudoku_proj/sudoku/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return HttpResponse(json.dumps( 'Sorry, your on your own. You may want to Verify Solutions to see if any mistakes have been made.')) def convert_board(old_board, direction, orig_board): new_board = copy.deepcopy(old_board) if direction == 'Int': # user solved cells remain as...
code_fim
hard
{ "lang": "python", "repo": "breencp/Sudoku", "path": "/sudoku_proj/sudoku/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: crscardellino/html2txt path: /tests/test_00002_html2txt_5.py import pytest from html2txt import converters # example: 2 # section: html2txt def test_5_00002(): html = """<div class="bd-example"> <address> <strong>Twitter, Inc.</strong><br /> 1355 Market St, Suite 900<br /> San Fr...
code_fim
medium
{ "lang": "python", "repo": "crscardellino/html2txt", "path": "/tests/test_00002_html2txt_5.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Phone (123) 456-7890 </address> <address> **Full Name** <[email protected]> </address> """ markdown = converters.Html2Markdown().convert(html) assert markdown == expected_markdown<|fim_prefix|># repo: crscardellino/html2txt path: /tests/test_00002_html2txt_5.py import pytest from...
code_fim
medium
{ "lang": "python", "repo": "crscardellino/html2txt", "path": "/tests/test_00002_html2txt_5.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> <address> **Full Name** <[email protected]> </address> """ markdown = converters.Html2Markdown().convert(html) assert markdown == expected_markdown<|fim_prefix|># repo: crscardellino/html2txt path: /tests/test_00002_html2txt_5.py import pytest from html2txt import converters # exam...
code_fim
medium
{ "lang": "python", "repo": "crscardellino/html2txt", "path": "/tests/test_00002_html2txt_5.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sunaga-lab/vizexec path: /logwriter/python/VizexecLogWriter.py # -*- coding: utf-8 -*- import os import sys import threading import socket time_counter = 0 # for internal def build_id(params): return "_".join(str(p) for p in params) write_log_raw = None flash_log_raw = None tracer_data =...
code_fim
hard
{ "lang": "python", "repo": "sunaga-lab/vizexec", "path": "/logwriter/python/VizexecLogWriter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def send(*msgobj): """ Sending marker """ write_log("SND", build_id(msgobj)) def recv(*msgobj): """ Receiving marker """ write_log("RCV", build_id(msgobj)) def thread_name(name): """ Thread naming marker """ write_log_notime("TNM", name) def event(ename): """ Event marker "...
code_fim
hard
{ "lang": "python", "repo": "sunaga-lab/vizexec", "path": "/logwriter/python/VizexecLogWriter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>type and >0." return # Main code n=x.size mov_av_x=np.zeros(n) if type_av=="n": if l%2==0: lbis=l+1 # if even number => +1 else: lbis=l m=(lbis-1)/2 # on the borders of the time series for k in range(m): mov_av_x[k]=np.sum(x[:(k+m+1)])/float(k+1+m) mov_av_x[n-1-k]=np.sum(...
code_fim
hard
{ "lang": "python", "repo": "mtoqeerpk/WAVEPAL", "path": "/wavepal/mov_av.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mtoqeerpk/WAVEPAL path: /wavepal/mov_av.py import numpy as np def mov_av(t,x,l,type_av="t"): """ mov_av returns the moving average of a time series. If type_av="n": For each data point, it makes the average on l points, i.e. enter in the average: the (l-1)/2 data points before, the (l-1)...
code_fim
hard
{ "lang": "python", "repo": "mtoqeerpk/WAVEPAL", "path": "/wavepal/mov_av.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return 1 <= coords[0] <= 8 and 1 <= coords[1] <= 8 def chessKnight(cell): knightCoords = parseCell(cell) moves = [(-2, 1), (-1, 2), (1, 2), (2, 1), (-2, -1), (-1, -2), (1, -2), (2, -1)] validMoves = 0 for m in moves: if inBounds((knightCoords[0] + m[0], ...
code_fim
medium
{ "lang": "python", "repo": "heitorchang/learn-code", "path": "/battles/arcade/intro/chessKnight.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: heitorchang/learn-code path: /battles/arcade/intro/chessKnight.py def parseCell(cell): col = 1 + ord(cell[0]) - ord('a') row = int(cell[1]) return (row, col) <|fim_suffix|> return 1 <= coords[0] <= 8 and 1 <= coords[1] <= 8 def chessKnight(cell): knightCoords = parseCell(cell...
code_fim
medium
{ "lang": "python", "repo": "heitorchang/learn-code", "path": "/battles/arcade/intro/chessKnight.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: znick/anytask path: /anytask/groups/models.py from django.db import models from django.contrib.auth.models import User from years.models import Year <|fim_suffix|> def __unicode__(self): return u"{0}|{1}".format(self.year, unicode(self.name)) def get_full_name(self): ret...
code_fim
hard
{ "lang": "python", "repo": "znick/anytask", "path": "/anytask/groups/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> unique_together = (("year", "name"),) def __unicode__(self): return u"{0}|{1}".format(self.year, unicode(self.name)) def get_full_name(self): return unicode(self.name)<|fim_prefix|># repo: znick/anytask path: /anytask/groups/models.py from django.db import models from dj...
code_fim
medium
{ "lang": "python", "repo": "znick/anytask", "path": "/anytask/groups/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> added_time = models.DateTimeField(auto_now_add=True) # remove default=timezone.now update_time = models.DateTimeField(auto_now=True) # remove default=timezone.now class Meta: unique_together = (("year", "name"),) def __unicode__(self): return u"{0}|{1}".format(self.year...
code_fim
hard
{ "lang": "python", "repo": "znick/anytask", "path": "/anytask/groups/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HPCC-Cloud-Computing/CALplus path: /calplus/tests/base.py """Base classes for our unit tests. Allows overriding of flags for use of fakes, and some black magic for inline callbacks. """ import contextlib from falcon import testing import fixtures import mock import six from calplus.tests import ...
code_fim
hard
{ "lang": "python", "repo": "HPCC-Cloud-Computing/CALplus", "path": "/calplus/tests/base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _clear_attrs(self): # Delete attributes that don't start with _ so they don't pin # memory around unnecessarily for the duration of the test # suite for key in [k for k in self.__dict__.keys() if k[0] != '_']: # NOTE(gmann): Skip attribute 'id' because i...
code_fim
hard
{ "lang": "python", "repo": "HPCC-Cloud-Computing/CALplus", "path": "/calplus/tests/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def save_weak_folds(full, nb_folds=5): kfold = KFold(nb_folds, shuffle=True, random_state=42) return kfold.split(full) def load_folds(options=None, df=None): """ Either folds are specified in the CSV file or they are generated according to whether options.folds is 'weak' or not. ...
code_fim
hard
{ "lang": "python", "repo": "jilljenn/ktm", "path": "/dataio.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jilljenn/ktm path: /dataio.py """ If options.folds is 'weak', the k-fold is performed on samples. Otherwise, it is performed on users. """ from pathlib import Path import re from sklearn.model_selection import KFold import pandas as pd import numpy as np <|fim_suffix|> def save_folds(full, nb_f...
code_fim
hard
{ "lang": "python", "repo": "jilljenn/ktm", "path": "/dataio.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Measurement loop count = 0 size = int(self.data.itemsize / 2) * length previous_bin_slice = b'' while not hasAborted() and self.samples > count: bin_slice = previous_bin_slice while len(bin_slice) < size: bin_slice += self....
code_fim
hard
{ "lang": "python", "repo": "pymeasure/pymeasure", "path": "/pymeasure/instruments/comedi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pymeasure/pymeasure path: /pymeasure/instruments/comedi.py # # This file is part of the PyMeasure package. # # Copyright (c) 2013-2023 PyMeasure Developers # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "...
code_fim
hard
{ "lang": "python", "repo": "pymeasure/pymeasure", "path": "/pymeasure/instruments/comedi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # --------------- # sub1.axvline(x=1e-3*freq[i0], linewidth=2, color='k') sub1.axvline(x=1e-3*freq[i1], linewidth=2, color='k') sub2.axvline(x=1e-3*freq[i0], linewidth=2, color='k') sub2.axvline(x=1e-3*freq[i1], linewidth=2, color='k') sub3.axvline(x=1e-3*freq[i0], li...
code_fim
hard
{ "lang": "python", "repo": "gmweir/HJ", "path": "/source/Scripts/cece_anal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># NeAvg, NeVar, _, _ = _ut.trapz_var(freq[i0:i1], Cxy_avg[i0:i1], varx=None, vary=_np.abs(Cxy_var[i0:i1]) ) # NeAvg = _np.sqrt(NeAvg/Bif) # NeVar = (0.5/Bif*(NeAvg/Bif)**(-0.5))**2.0*NeVar # --------------- # sub1.axvline(x=1e-3*freq[i0], linewidth=2, color='k') ...
code_fim
hard
{ "lang": "python", "repo": "gmweir/HJ", "path": "/source/Scripts/cece_anal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gmweir/HJ path: /source/Scripts/cece_anal.py ils as _pltut from FFT import fft_analysis as _fft from scipy import signal as _sig from FFT.fft_analysis import butter_lowpass from FFT.notch_filter import iirnotch # =============================================== # # datafolder = _os.path.abspath(...
code_fim
hard
{ "lang": "python", "repo": "gmweir/HJ", "path": "/source/Scripts/cece_anal.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gams/openkongqi path: /openkongqi/records/sqlalch.py # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals from copy import copy import pytz from sqlalchemy import create_engine from sqlalchemy import Column, String, DateTime, Float from sqlalchemy.orm ...
code_fim
hard
{ "lang": "python", "repo": "gams/openkongqi", "path": "/openkongqi/records/sqlalch.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def is_duplicate(self, record): dup_count = self._cnx.query(Record).filter_by( ts=record.ts, uuid=record.uuid, key=record.key ).count() return dup_count != 0 def write_records(self, records, ignore_check_latest=False, context=None): for uuid, records in...
code_fim
hard
{ "lang": "python", "repo": "gams/openkongqi", "path": "/openkongqi/records/sqlalch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>default_handler = logging.StreamHandler() default_handler.setFormatter(logging.Formatter( "[%(asctime)s] [tuya-%(module)s] %(message)s" )) logger.addHandler(default_handler) tuya_logger = logger<|fim_prefix|># repo: azhar-reddy/tuya-light-manager path: /tuya_iot/logging.py #!/usr/bin/env python # -*...
code_fim
easy
{ "lang": "python", "repo": "azhar-reddy/tuya-light-manager", "path": "/tuya_iot/logging.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: azhar-reddy/tuya-light-manager path: /tuya_iot/logging.py #!/usr/bin/env python # -*- coding: UTF-8 -*- """Tuya iot logging.""" import logging <|fim_suffix|>default_handler = logging.StreamHandler() default_handler.setFormatter(logging.Formatter( "[%(asctime)s] [tuya-%(module)s] %(message)s...
code_fim
easy
{ "lang": "python", "repo": "azhar-reddy/tuya-light-manager", "path": "/tuya_iot/logging.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not root: return search(root.left, k) global count, res count += 1 if count == k: res = root.val search(root.right, k) search(root, k) return res<|fim_prefix|># repo: summertian4/Prac...
code_fim
medium
{ "lang": "python", "repo": "summertian4/Practice", "path": "/LeetCode/0230.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ :type root: TreeNode :type k: int :rtype: int """ global res, count res,count = 0,0 def search(root, k) : if not root: return search(root.left, k) global count, res count += ...
code_fim
medium
{ "lang": "python", "repo": "summertian4/Practice", "path": "/LeetCode/0230.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: summertian4/Practice path: /LeetCode/0230.py # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None <|fim_suffix|> if not root: return search(...
code_fim
hard
{ "lang": "python", "repo": "summertian4/Practice", "path": "/LeetCode/0230.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> f2.write(line[0]+"\n") f2.close()<|fim_prefix|># repo: CSUChico-CINS465/CINS465-S21-Examples path: /test.py f = open("requirements.txt","r") f2 =<|fim_middle|> open("requirements2.txt","w+") for line in f: line = line.split("=")
code_fim
medium
{ "lang": "python", "repo": "CSUChico-CINS465/CINS465-S21-Examples", "path": "/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CSUChico-CINS465/CINS465-S21-Examples path: /test.py f = open("requirements.txt","r") f2 = open("requirements2.txt","w+") for l<|fim_suffix|> f2.write(line[0]+"\n") f2.close()<|fim_middle|>ine in f: line = line.split("=")
code_fim
easy
{ "lang": "python", "repo": "CSUChico-CINS465/CINS465-S21-Examples", "path": "/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>_scm'], # setuptools_scm>=6.0 doesn't support Python 3.5 use_scm_version = True, ) # yapf: disable<|fim_prefix|># repo: freebsd/freebsd-ports path: /devel/py-logfury/files/patch-setup.py --- setup.py.orig 2021-10-21 05:05:21 UTC +++ setup.py @@ -72,6 +72,6 @@ setup( classifiers = CLASS...
code_fim
medium
{ "lang": "python", "repo": "freebsd/freebsd-ports", "path": "/devel/py-logfury/files/patch-setup.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: freebsd/freebsd-ports path: /devel/py-logfury/files/patch-setup.py --- setup.py.orig 2021-10-21 05:05:21 UTC +++ setup.py @@ -72,6 +72,6 @@ setup( classifiers = CL<|fim_suffix|>tuptools_scm<6.0'], # setuptools_scm>=6.0 doesn't support Python 3.5 + setup_requires = ['setuptools_scm...
code_fim
medium
{ "lang": "python", "repo": "freebsd/freebsd-ports", "path": "/devel/py-logfury/files/patch-setup.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual([2, 4], split(tests, 0, 2)) self.assertEqual([1, 3, 5], split(tests, 1, 2)) self.assertEqual([3], split(tests, 0, 3)) self.assertEqual([1, 4], split(tests, 1, 3)) self.assertEqual([2, 5], split(tests, 2, 3)) tests = [1, 2, 3, 4...
code_fim
hard
{ "lang": "python", "repo": "ECS-251-W2020/chromium", "path": "/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_finder_unittest.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ECS-251-W2020/chromium path: /third_party/blink/tools/blinkpy/web_tests/controllers/web_test_finder_unittest.py # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import sys i...
code_fim
hard
{ "lang": "python", "repo": "ECS-251-W2020/chromium", "path": "/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_finder_unittest.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: iago-suarez/SOLD2 path: /model/line_matcher.py """ Implements the full pipeline from raw images to line matches. """ import time import cv2 import numpy as np import torch import torch.nn.functional as F from torch.nn.functional import softmax from model.model_util import get_model from model.lo...
code_fim
hard
{ "lang": "python", "repo": "iago-suarez/SOLD2", "path": "/model/line_matcher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Extract junctions junc_pred_nms = super_nms( junctions[..., None], self.grid_size, self.junc_detect_thresh, self.max_num_junctions) if valid_mask is None: junctions = np.where(junc_pred_nms.squeeze()) else: ...
code_fim
hard
{ "lang": "python", "repo": "iago-suarez/SOLD2", "path": "/model/line_matcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Upload the avatar to s3 s3 = boto3.client('s3') upload = s3.put_object(Bucket="scuttle-s3", Body=avatar, Key="avatars/wikidot/" + str(user_id)) # Give SCUTTLE back the data requested and a link to the file. payload = {"wd_user_id": user_id, "username": username, ...
code_fim
hard
{ "lang": "python", "repo": "scuttle/2stacks", "path": "/2stacks-get-user-metadata.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: scuttle/2stacks path: /2stacks-get-user-metadata.py import json import boto3 from botocore.exceptions import ClientError # import logging import helpers import requests import re import config import os # logger = logging.getLogger() # logger.setLevel(logging.INFO) def lambda_handler(event, con...
code_fim
hard
{ "lang": "python", "repo": "scuttle/2stacks", "path": "/2stacks-get-user-metadata.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: neurorestore/neuraldynamicplatform path: /code/generateForSimInputs/generateRatAfferentFirings.py import sys sys.path.append('../code') from tools import load_data_tools as ldt from tools import emg_tools as et from AfferentInput import AfferentInput import matplotlib.pyplot as plt import numpy a...
code_fim
hard
{ "lang": "python", "repo": "neurorestore/neuraldynamicplatform", "path": "/code/generateForSimInputs/generateRatAfferentFirings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># get gait cycles nSamples = len(kinematic['time']) heelStrikeSamples = [int(x) for x in heelStrikes/kinematic['dt']] footOffSamples = [int(x) for x in footOffs/kinematic['dt']] samples = range(nSamples) stance = np.zeros(nSamples).astype(bool) for strike,off in zip(heelStrikeSamples,footOffSamples): if ...
code_fim
hard
{ "lang": "python", "repo": "neurorestore/neuraldynamicplatform", "path": "/code/generateForSimInputs/generateRatAfferentFirings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fig,ax = plt.subplots(1,sharey=True) fig.suptitle('Foot height') ax.plot(footHeight['time'],footHeight['height']) ax.set_ylabel('height (mm)') """ Generate figures """ redAi = "#e9342f" bluAi = "#00aaeb" # Smooth the data with a moving average nSamples = len(IAExt) IAExtFilt = np.zeros(nSamples) IAFlexF...
code_fim
hard
{ "lang": "python", "repo": "neurorestore/neuraldynamicplatform", "path": "/code/generateForSimInputs/generateRatAfferentFirings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> vect, unflatten = flatten(val) def fun(vec): v = unflatten(vec) return np.sum(v['k5']) + np.sum(v['k6']) grad(fun)(vect)<|fim_prefix|># repo: CamDavidsonPilon/autograd path: /benchmarks/bench_util.py import autograd.numpy.random as npr import autograd.numpy as np from autogra...
code_fim
hard
{ "lang": "python", "repo": "CamDavidsonPilon/autograd", "path": "/benchmarks/bench_util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CamDavidsonPilon/autograd path: /benchmarks/bench_util.py import autograd.numpy.random as npr import autograd.numpy as np from autograd import grad try: from autograd.misc.flatten import flatten except ImportError: from autograd.util import flatten def time_flatten(): val = {'k': n...
code_fim
hard
{ "lang": "python", "repo": "CamDavidsonPilon/autograd", "path": "/benchmarks/bench_util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Nevada_dicast_site_array = [] for (key, value) in Nevada_image_table.items(): Nevada_dicast_site_array.append(value[1]) Nevada_dicast_site_set = set(Nevada_dicast_site_array)<|fim_prefix|># repo: OSADP/Pikalert-Vehicle-Data-Translator- path: /scripts/python/nevada_image_table.py #!/usr/bin/env ...
code_fim
hard
{ "lang": "python", "repo": "OSADP/Pikalert-Vehicle-Data-Translator-", "path": "/scripts/python/nevada_image_table.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OSADP/Pikalert-Vehicle-Data-Translator- path: /scripts/python/nevada_image_table.py #!/usr/bin/env python """""" # ============================================================================== # # # # (c) Copyrigh...
code_fim
hard
{ "lang": "python", "repo": "OSADP/Pikalert-Vehicle-Data-Translator-", "path": "/scripts/python/nevada_image_table.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': #[gap, H, D, A, HP1, HP2, HP3, HP4, HP5, HP6, HP7, HP8, HP9, HP10, HP11, AP1, AP2, AP3, AP4, AP5, AP6, AP7, AP8, AP9, AP10, AP11] predicted = [1, 2.5, 4.5, 1.5, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50, 50, 60, 70, 80, 90, 100, 90, 80, 70, 60, 50] print(predicted)...
code_fim
hard
{ "lang": "python", "repo": "leviskim17/soccerprediction", "path": "/gap_prediction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #xs = getMatchHistory() #print(xs) predict_gap = 0 return predict_gap if __name__ == '__main__': #[gap, H, D, A, HP1, HP2, HP3, HP4, HP5, HP6, HP7, HP8, HP9, HP10, HP11, AP1, AP2, AP3, AP4, AP5, AP6, AP7, AP8, AP9, AP10, AP11] predicted = [1, 2.5, 4.5, 1.5, 50, 60, 70, 80, 90, 10...
code_fim
medium
{ "lang": "python", "repo": "leviskim17/soccerprediction", "path": "/gap_prediction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: leviskim17/soccerprediction path: /gap_prediction.py from sklearn.model_selection import train_test_split from gap_data import getMatchHistory from classifier_helper import predictByMultinomialNB, predictByDecisionTree, predictBySGDClassifier, getAccuracy, getMatrix, getReport <|fim_suffix|>if...
code_fim
hard
{ "lang": "python", "repo": "leviskim17/soccerprediction", "path": "/gap_prediction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iforgotid/webmail path: /web.py __author__ = 'philipp' import webapp2,leancloud,json,os,time,datetime,mimetypes from webapp2_extras import jinja2 from leancloud import Object from service.mailer import mailer os.environ['TZ'] = 'Asia/Shanghai' time.tzset() leancloud.init('73b6c6p6lgs8s07m6yaq5je...
code_fim
hard
{ "lang": "python", "repo": "iforgotid/webmail", "path": "/web.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.response.headers['Content-Type'] = 'application/json' data = json.loads(self.request.body) Mail = Object.extend('Mail') newMail = Mail() newMail.set('subject',data['subject']) newMail.set('to',data['to']) newMail.set('html',data['html']) ...
code_fim
hard
{ "lang": "python", "repo": "iforgotid/webmail", "path": "/web.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Myzel394/django-common-utils path: /django_common_utils/templatetags/math.py import math import operator from functools import reduce from django.template.defaulttags import register from ..libraries.typings import Number from ..libraries.utils.templatetags_factory import iter_module @registe...
code_fim
medium
{ "lang": "python", "repo": "Myzel394/django-common-utils", "path": "/django_common_utils/templatetags/math.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for name, function in iter_module(math): register.simple_tag( function, name=name )<|fim_prefix|># repo: Myzel394/django-common-utils path: /django_common_utils/templatetags/math.py import math import operator from functools import reduce from django.template.defaulttags import ...
code_fim
hard
{ "lang": "python", "repo": "Myzel394/django-common-utils", "path": "/django_common_utils/templatetags/math.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @register.simple_tag def divide(*args) -> Number: return reduce(operator.__floordiv__, args) for name, function in iter_module(math): register.simple_tag( function, name=name )<|fim_prefix|># repo: Myzel394/django-common-utils path: /django_common_utils/templatetags/math.py...
code_fim
medium
{ "lang": "python", "repo": "Myzel394/django-common-utils", "path": "/django_common_utils/templatetags/math.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>heart = turtle.Turtle() heart.speed(10) heart.penup() #heart.setx(-350) heart.sety(-300) heart.pendown() heart.pensize(9) heartMovement = 400 numHearts = 20 heart.left(45) x = 0 for j in range(numHearts): heart.color(colorChoices[x]) x = x + 1 if x > len(colorChoices) - 1: x = 0 ...
code_fim
hard
{ "lang": "python", "repo": "Koldenblue/heart-card", "path": "/heart.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Koldenblue/heart-card path: /heart.py import turtle, random wn = turtle.Screen() wn.bgcolor('light pink') wn.title('Hello, Sarah!') colorChoices = ['red', 'orange', 'orchid', 'green', 'blue', 'violet', 'salmon'] for darkColor in range(len(colorChoices)): darkColor = 'dark ' + colorChoices[d...
code_fim
hard
{ "lang": "python", "repo": "Koldenblue/heart-card", "path": "/heart.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rpboyer15/sounds-of-the-storm path: /scripts/full_refresh.py import os, sys print("Are you sure you want to regenerate all html files?") while True: print('(y/n): ', end='') ans = input().lower() if ans == 'no' or ans == 'n': print('exited') sys.exit() elif ans =...
code_fim
hard
{ "lang": "python", "repo": "rpboyer15/sounds-of-the-storm", "path": "/scripts/full_refresh.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(0, len(skins)): altSkinBody = """ <a href="{0}.html" class='skin'>{1}</a><br>""".format(skins[i],link_list[i]) text += altSkinBody altSkinCloser = """ </h3> </div> """ text += altSkinCloser ...
code_fim
hard
{ "lang": "python", "repo": "rpboyer15/sounds-of-the-storm", "path": "/scripts/full_refresh.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }