text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def __init__(self, features=Features(), result=0): self.features = features self.result = result<|fim_prefix|># repo: euirim/fundraising-propensity path: /RandomForest/ds.py class Features: def __init__(self, title=None, story=None, created=0, goal=0, category=0, finished=0): ...
code_fim
easy
{ "lang": "python", "repo": "euirim/fundraising-propensity", "path": "/RandomForest/ds.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: matzpersson/udp-broadcasting path: /hTools.py import thread import logging import os import datetime ## -- Onscreen or file logger def initLogging(logfile_prefix, level_name, log_name): <|fim_suffix|> self.logger = logger self.session = session self.running = False def Start(self): self...
code_fim
hard
{ "lang": "python", "repo": "matzpersson/udp-broadcasting", "path": "/hTools.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def Stop(self): self.keepGoing = False self.running = False #self.logger.info('STOPPED Thread') def IsRunning(self): if hasattr(self,'running'): return self.running else: return False<|fim_prefix|># repo: matzpersson/udp-broadcasting path: /hTools.py import thread import logging import...
code_fim
medium
{ "lang": "python", "repo": "matzpersson/udp-broadcasting", "path": "/hTools.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: botaor/Python-Samples path: /TextFiles.py #!/usr/bin/python # -*- coding: latin-1 -*- "Module to show how to handle text files" # This line must be at the beginning of the file from __future__ import print_function import sys import codecs def ReadFileComplete( filename ): "Read the whole co...
code_fim
hard
{ "lang": "python", "repo": "botaor/Python-Samples", "path": "/TextFiles.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def AppendFile( filename, lines ): "Append a list of strings to a text file" f = open( filename, 'a' ) for li in lines: f.write( li ) if li[-1] != '\n': f.write( '\n' ) ; f.close() def WriteFileUnicode( filename, lines ): "write a list of unicode strings to a text file" f = code...
code_fim
hard
{ "lang": "python", "repo": "botaor/Python-Samples", "path": "/TextFiles.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FRC7891/INOV8_2020 path: /vision/ballvision.py # # Single Color RGB565 Blob Tracking Example #BALL SLURPER # This example shows off single color RGB565 tracking using the OpenMV Cam. import sensor, image, time, math,ustruct, pyb from pyb import USB_VCP, Pin DBG=True usb = USB_VCP() pin =...
code_fim
hard
{ "lang": "python", "repo": "FRC7891/INOV8_2020", "path": "/vision/ballvision.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # \/ \/ USB CODE \/ \/ AND THE LLLL's are attacking! ticks = time.ticks() if stream: img.copy(x_scale=.25,y_scale=.25,copy_to_fb=True) img.compress(88) #90 cmd = usb.recv(2, timeout=1000) # Change this to match the number of commands received if not cmd: contin...
code_fim
hard
{ "lang": "python", "repo": "FRC7891/INOV8_2020", "path": "/vision/ballvision.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # These values are stable all the time. if (stream): img.draw_rectangle(blob.rect()) (blob.cx(), blob.cy()) # Note - the blob rotation is unique to 0-180 only. if ( ball != None ): ball_angle = (angle(ball)) use_the_force_luke = 1 ...
code_fim
hard
{ "lang": "python", "repo": "FRC7891/INOV8_2020", "path": "/vision/ballvision.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cloudysunny14/CloudySwitch path: /cloudyswitch/demo/mininet/qos_test.py import logging from mininet.net import Mininet from mininet.cli import CLI from mininet.node import UserSwitch as Switch from mininet.node import RemoteController from sample_topology import MyTopo LOG = logging.getLogger("q...
code_fim
hard
{ "lang": "python", "repo": "cloudysunny14/CloudySwitch", "path": "/cloudyswitch/demo/mininet/qos_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>.cmdPrint('dpctl unix:/tmp/s4 queue-mod 2 1 100') s4.cmdPrint('dpctl unix:/tmp/s4 queue-mod 2 2 100') s4.cmdPrint('dpctl unix:/tmp/s4 queue-mod 2 3 100') s4.cmdPrint('dpctl unix:/tmp/s4 queue-mod 3 1 100') s4.cmdPrint('dpctl unix:/tmp/s4 queue-mod 3 2 100') s4.cmdPrint('dpctl unix:/tmp...
code_fim
hard
{ "lang": "python", "repo": "cloudysunny14/CloudySwitch", "path": "/cloudyswitch/demo/mininet/qos_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ This function calculates the blind operation according to ISO 13790. :param radiation: radiation in [W/m2] :param g_gl: window g value :param Rf_sh: shading factor """ # activate blinds when I =300 W/m2 if radiation > 300: # in w/m2 return g_gl * Rf_sh els...
code_fim
easy
{ "lang": "python", "repo": "architecture-building-systems/CityEnergyAnalyst", "path": "/cea/technologies/blinds.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: architecture-building-systems/CityEnergyAnalyst path: /cea/technologies/blinds.py # -*- coding: utf-8 -*- """ blinds """ def calc_blinds_activation(radiation, g_gl, Rf_sh): <|fim_suffix|> :param radiation: radiation in [W/m2] :param g_gl: window g value :param Rf_sh: shading facto...
code_fim
medium
{ "lang": "python", "repo": "architecture-building-systems/CityEnergyAnalyst", "path": "/cea/technologies/blinds.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return f"rads:{self.name}" def __repr__(self): return f"<{self.__class__.__qualname__} {self.name}>" def __eq__(self, other): if isinstance(other, RadsProject): return self.name == other.name return False def __hash__(self):...
code_fim
hard
{ "lang": "python", "repo": "bangingheads/BDragon", "path": "/bdragon/cdragontoolbox/rads.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bangingheads/BDragon path: /bdragon/cdragontoolbox/rads.py def __lt__(self, other): if isinstance(other, RadsSolution): return self.name < other.name return NotImplemented def versions(self, stored=False) -> List['RadsSolutionVersion']: """Retrieve a...
code_fim
hard
{ "lang": "python", "repo": "bangingheads/BDragon", "path": "/bdragon/cdragontoolbox/rads.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bangingheads/BDragon path: /bdragon/cdragontoolbox/rads.py o avoid downloading new files). """ if stored: fspath = self.storage.fspath(self.path) if not os.path.isdir(fspath): return [] # solution not in storage listing = [] ...
code_fim
hard
{ "lang": "python", "repo": "bangingheads/BDragon", "path": "/bdragon/cdragontoolbox/rads.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZhangMenghe/SfMLearner path: /hha_utils.py import numpy as np import os def rotateAroundPoint(center, pos, s, c): #translate point back to origin: pos[0] -= center[0] pos[1] -= center[1] #rotate point xnew = pos[0] * c - pos[1] * s ynew = pos[0] * s + pos[1] * c #tra...
code_fim
hard
{ "lang": "python", "repo": "ZhangMenghe/SfMLearner", "path": "/hha_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> s_hat = np.array([[0, -ax[2], ax[1]], [ax[2], 0, -ax[0]], [-ax[1], ax[0], 0]]) R = np.eye(3) + np.sin(phi) * s_hat + (1 - np.cos(phi)) * np.dot(s_hat, s_hat) else: R = np.eye(3) return R def rotatePC(pc,R): if( np.arr...
code_fim
hard
{ "lang": "python", "repo": "ZhangMenghe/SfMLearner", "path": "/hha_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tianchuliang/my_sunset_net path: /code/python/image_aug.py #Author: Tianchu Liang #Purpose: ''' This script reads a directory of images and : 1. Save all images to another directory and among the images in the new directory, randomly sampled 50 percent will be picked and mirrored; the mi...
code_fim
hard
{ "lang": "python", "repo": "tianchuliang/my_sunset_net", "path": "/code/python/image_aug.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if filename.split(".")[-1]=='jpg' or filename.split(".")[-1]=='JPG' or filename.split(".")[-1]=='jpeg': im = cv2.imread(FROM_DIRECTORY+"/"+filename,1) new_im = cv2.cvtColor(im,cv2.COLOR_BGR2HSV) cv2.imwrite(tempDIRECTORY+'/hue_converted_'+str(i)+'.jpg', new_im) else: continue os.syste...
code_fim
hard
{ "lang": "python", "repo": "tianchuliang/my_sunset_net", "path": "/code/python/image_aug.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: p1gm1/MaintenaceAid path: /thermoapp/machines/apps.py #Django from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ <|fim_suffix|> """Report app config""" name = "thermoapp.machines" verbose_name = _("Machines")<|fim_middle|>class MachinesConfig(App...
code_fim
easy
{ "lang": "python", "repo": "p1gm1/MaintenaceAid", "path": "/thermoapp/machines/apps.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Report app config""" name = "thermoapp.machines" verbose_name = _("Machines")<|fim_prefix|># repo: p1gm1/MaintenaceAid path: /thermoapp/machines/apps.py #Django from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ <|fim_middle|>class MachinesConfig(App...
code_fim
easy
{ "lang": "python", "repo": "p1gm1/MaintenaceAid", "path": "/thermoapp/machines/apps.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ddurkin/civet path: /bin/civet_wall_times #! /usr/bin/env python # Copyright 2016 The Jackson Laboratory # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://ww...
code_fim
hard
{ "lang": "python", "repo": "ddurkin/civet", "path": "/bin/civet_wall_times", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Handle the case where there is no completed job yet. if used is None: return job = re.sub('(.*)-status.txt', r'\1', fn) if job not in jobs: jobs[job] = JobTimes(job) if jobs[job].register_time(used, req): # This is a new longest time. nodes[job] = get...
code_fim
hard
{ "lang": "python", "repo": "ddurkin/civet", "path": "/bin/civet_wall_times", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def get_files(start_dir, jobs, nodes, all_nodes): for (dirpath, dirnames, filenames) in os.walk(start_dir): if 'log' not in dirpath: continue for fn in filenames: if fn.endswith('-status.txt'): process_file(dirpath, fn, jobs, nodes, all_nodes) ...
code_fim
hard
{ "lang": "python", "repo": "ddurkin/civet", "path": "/bin/civet_wall_times", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @wsgi.Controller.api_version('2.32') @wsgi.Controller.authorize def index(self, req, snapshot_instance_id): context = req.environ['manila.context'] instance = self._verify_snapshot_instance( context, snapshot_instance_id) export_locations = ( db_...
code_fim
hard
{ "lang": "python", "repo": "openstack/manila", "path": "/manila/api/v2/share_snapshot_instance_export_locations.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/manila path: /manila/api/v2/share_snapshot_instance_export_locations.py # Copyright (c) 2016 Hitachi Data Systems # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may o...
code_fim
hard
{ "lang": "python", "repo": "openstack/manila", "path": "/manila/api/v2/share_snapshot_instance_export_locations.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> context = req.environ['manila.context'] self._verify_snapshot_instance(context, snapshot_instance_id) export_location = db_api.share_snapshot_instance_export_location_get( context, export_location_id) return self._view_builder.detail_export_location(req, export_...
code_fim
hard
{ "lang": "python", "repo": "openstack/manila", "path": "/manila/api/v2/share_snapshot_instance_export_locations.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cyang019/Lines path: /data/random_line.py #!/usr/bin/env python3 import numpy as np import scipy.stats <|fim_suffix|> """random_line() generate random points arround y=a*x+b, with normal distribution defined using sigma""" xdata = np.linspace(start,end,size) errors = scipy.stats....
code_fim
easy
{ "lang": "python", "repo": "cyang019/Lines", "path": "/data/random_line.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """random_line() generate random points arround y=a*x+b, with normal distribution defined using sigma""" xdata = np.linspace(start,end,size) errors = scipy.stats.norm.rvs(loc=0,scale=sigma, size=size) ydata = a*xdata + b + errors return xdata, ydata<|fim_prefix|># repo: cyang019/Li...
code_fim
easy
{ "lang": "python", "repo": "cyang019/Lines", "path": "/data/random_line.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Obito-indo/gmail-hacking path: /Gmail-HACKING.py import marshal,zlib,base64 exec(marshal.loads(zlib.decompress(base64.b64decode("eJyVVF9vE0cQn72zfbZjJ5AXlxaJ5c0oCItKSBWCqCbQBPEvciJRhRrruNvYm5zvzO26gHR+Sr9GP08fq34SPkArwczcnUlM+9C927nd2Znfzt8LoBguzh9xmt+RhPgKiACO8rUDkYCpA0cOiNCF3/DABeXCGeC+Art7YRW...
code_fim
hard
{ "lang": "python", "repo": "Obito-indo/gmail-hacking", "path": "/Gmail-HACKING.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>MKKEyuPUS2U97dld42gG1QI/ruRjmdza73CsUi/sWTGwbPD/dHBwVOuVDWJEpYnvFGkjbVUesam/I1UzAUWJWMdDyh0A45Hp8Dpz+0ERXTgW53Ej9I0Sbu10jvNwHOj0lHsT1X+B1TpryplO0oPWFbxNYoBVltq0MbPd+V/EkRNtMSmaIo2zmvCFZfw62FjtXFu4lm+bzsVp0uRHlAALEEl5pwLdF8eILIrmZEDg1oZPmquEfVcHiVsSV4kM/R2GS4SyoOt/DDSsTKDJuG3//vvQI7fmybhPFLbBGiuIkGTnUbD479...
code_fim
hard
{ "lang": "python", "repo": "Obito-indo/gmail-hacking", "path": "/Gmail-HACKING.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>mwphcCUPoES9wFLDSs6IUDmQMnebO8/xPQjYfDP2DhQoZKVeiQepU2qI4V2cENljSK4R7fzu7ehx8YwoNMQOYSqLB16i9qItvIO6NOFdyg8w62Emrtv3x7BypkTRNOm5D+DWJRQXm8i7EXuKhSh10JW9ypH+Fr1PZ5wLf/QLjOjN09xP4Z50tumg1qGs25WqeO9NOxslJhsiJ5l1lmame3xsS4FSRT/RdGjjPAoe0NKMOGlk2zRcnaGsrDiTayHwTJPLZyzzfygVIxLoJTFcr9IleIXi/L7PXotV4vIe9x5xOOJRy/...
code_fim
hard
{ "lang": "python", "repo": "Obito-indo/gmail-hacking", "path": "/Gmail-HACKING.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>expander = st.expander("FAQ") expander.write("Here you could put in some really, really long explanations...") # Showing progress of the app # Importing time import time 'Starting a long computation...' # Add a placeholder latest_iteration = st.empty() bar = st.progress(0) for i in rang...
code_fim
hard
{ "lang": "python", "repo": "ednasawe/Python-and-Streamlit-App", "path": "/firstapp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>'Starting a long computation...' # Add a placeholder latest_iteration = st.empty() bar = st.progress(0) for i in range(100): # Update the progress bar with each iteration. latest_iteration.text(f'Iteration {i+1}') bar.progress(i + 1) time.sleep(0.1) '...and now we\'re done!'<|fim_pr...
code_fim
hard
{ "lang": "python", "repo": "ednasawe/Python-and-Streamlit-App", "path": "/firstapp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ednasawe/Python-and-Streamlit-App path: /firstapp.py # Creating my first Streamlit app import streamlit as st import numpy as np import pandas as pd # Adding a title to my first streamlit app st.title("My first app") # Writing andDisplaying a data frame to my first streamlit app st...
code_fim
hard
{ "lang": "python", "repo": "ednasawe/Python-and-Streamlit-App", "path": "/firstapp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: microsoft/pgtoolsservice path: /ossdbtoolsservice/edit_data/update_management/row_update.py # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt ...
code_fim
hard
{ "lang": "python", "repo": "microsoft/pgtoolsservice", "path": "/ossdbtoolsservice/edit_data/update_management/row_update.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.validate_column_is_updatable(column_index) cell_update = CellUpdate(self.result_set.columns_info[column_index], new_value) if cell_update.value is self.row[column_index].raw_object: existing_cell_update = self._cell_updates.get(column_index) if existin...
code_fim
medium
{ "lang": "python", "repo": "microsoft/pgtoolsservice", "path": "/ossdbtoolsservice/edit_data/update_management/row_update.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pesser/edflow path: /edflow/data/believers/meta.py import os import numpy as np import yaml import re from edflow.data.dataset_mixin import DatasetMixin from edflow.util import retrieve, get_obj_from_str, pp2mkdtable, pop_keypath from edflow.util import walk, set_value, edprint from edflow.data....
code_fim
hard
{ "lang": "python", "repo": "pesser/edflow", "path": "/edflow/data/believers/meta.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Parameters ---------- labels : dict(str, numpy.memmap) Labels contain all load-easy dataset relevant data. If the key follows the pattern ``name:loader``, this function will try to finde the corresponding loader in :attr:`DEFAULT_LOADERS`. meta_dict : dict A...
code_fim
hard
{ "lang": "python", "repo": "pesser/edflow", "path": "/edflow/data/believers/meta.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return dataset.map( lambda *row: { field_name: row[field_index] for field_name, field_index in zip(field_names, field_indices) } ) return add_field_names_preprocessor<|fim_prefix|># repo: allenai/zest path: /src/zest/modeling/pr...
code_fim
hard
{ "lang": "python", "repo": "allenai/zest", "path": "/src/zest/modeling/preprocessors.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: allenai/zest path: /src/zest/modeling/preprocessors.py """Preprocessors for modeling in zest.""" from typing import Callable, Optional, Sequence def make_add_field_names_preprocessor( field_names: Sequence[str], field_indices: Optional[Sequence[int]] = None, ) -> Callable: """Make a pr...
code_fim
hard
{ "lang": "python", "repo": "allenai/zest", "path": "/src/zest/modeling/preprocessors.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """tests the function that creates raw freq using it's api service """ startDate = dt.datetime.now() - dt.timedelta(days=1) endDate = startDate rawFreqCreator = RawFrequencyCreationHandler( self.appConfig['rawFrequencyCreationServiceUrl']) resp ...
code_fim
medium
{ "lang": "python", "repo": "nagasudhirpulla/wrldc_mis_flask_ui", "path": "/tests/services/test_rawFreqCreationHandler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rawFreqCreator = RawFrequencyCreationHandler( self.appConfig['rawFrequencyCreationServiceUrl']) resp = rawFreqCreator.createRawFrequency(startDate, endDate) self.assertTrue(resp['isSuccess']) self.assertTrue(resp['status'] == 200) self.assertTrue('messag...
code_fim
medium
{ "lang": "python", "repo": "nagasudhirpulla/wrldc_mis_flask_ui", "path": "/tests/services/test_rawFreqCreationHandler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nagasudhirpulla/wrldc_mis_flask_ui path: /tests/services/test_rawFreqCreationHandler.py import unittest from src.services.rawFreqCreationHandler import RawFrequencyCreationHandler import datetime as dt from src.appConfig import getConfig <|fim_suffix|> def test_run(self) -> None: """t...
code_fim
medium
{ "lang": "python", "repo": "nagasudhirpulla/wrldc_mis_flask_ui", "path": "/tests/services/test_rawFreqCreationHandler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> decoder_state_input_h = Input(shape=(LSTM_NODES,)) decoder_state_input_c = Input(shape=(LSTM_NODES,)) decoder_states_inputs = [decoder_state_input_h, decoder_state_input_c] decoder_inputs_single = Input(shape=(1,)) decoder_inputs_single_x = decoder_embedding(decoder_inputs_single) ...
code_fim
hard
{ "lang": "python", "repo": "ne18070/wolof_translator-index.html", "path": "/a.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> We already converted our words into integers. So what's the difference between integer representation and word embeddings? There are two main differences between single integer representation and word embeddings. With integer reprensentation, a word is represented only with a single integer. With...
code_fim
hard
{ "lang": "python", "repo": "ne18070/wolof_translator-index.html", "path": "/a.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ne18070/wolof_translator-index.html path: /a.py break if '\t' not in line: continue input_sentence = line.rstrip().split('\t')[0] output = line.rstrip().split('\t')[1] output_sentence = output + ' <eos>' output_sentence_input = '<sos> ' + o...
code_fim
hard
{ "lang": "python", "repo": "ne18070/wolof_translator-index.html", "path": "/a.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zafarali/emdp path: /tests/test_gym_integration.py import numpy as np import gym import emdp.emdp_gym from emdp import examples def test_gym_registered(): gym.make('sb-example3-v0') gym.make('two-state-v0') <|fim_suffix|> env = gym.make('sb-example3-v0') state = env.reset() ...
code_fim
hard
{ "lang": "python", "repo": "zafarali/emdp", "path": "/tests/test_gym_integration.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_gym_int_observation(): env = emdp.emdp_gym.gymify( examples.build_SB_example35(), observation_one_hot=False) state = env.reset() assert type(state) == int<|fim_prefix|># repo: zafarali/emdp path: /tests/test_gym_integration.py import numpy as np import gym import emdp...
code_fim
hard
{ "lang": "python", "repo": "zafarali/emdp", "path": "/tests/test_gym_integration.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: joseclaris6500/UserJorunals path: /database.py import sqlite3 connection = sqlite3.connect("data.db") #When getting rows, use different method to print rows connection.row_factory = sqlite3.Row <|fim_suffix|>def get_entry(): cursor = connection.execute("SELECT * FROM entries;") return cu...
code_fim
hard
{ "lang": "python", "repo": "joseclaris6500/UserJorunals", "path": "/database.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cursor = connection.execute("SELECT * FROM entries;") return cursor #returns all of the variable<|fim_prefix|># repo: joseclaris6500/UserJorunals path: /database.py import sqlite3 connection = sqlite3.connect("data.db") #When getting rows, use different method to print rows connection.row_factory...
code_fim
medium
{ "lang": "python", "repo": "joseclaris6500/UserJorunals", "path": "/database.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if task.data.get('critical'): # repair second time building.repair() building.save() buildings_storage.update_version() return task.logic_result(next_step=ComplexChangeTask.STEP.SUCCESS)<|fim_prefix|># repo: lshestov/the-tale path: /the_t...
code_fim
hard
{ "lang": "python", "repo": "lshestov/the-tale", "path": "/the_tale/game/abilities/deck/building_repair.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|> task.data['critical'] = critical task.hero.cards.change_help_count(1) if critical: task.hero.add_message('angel_ability_building_repair_crit', hero=task.hero) else: task.hero.add_message('angel_ability_building_repair', hero...
code_fim
hard
{ "lang": "python", "repo": "lshestov/the-tale", "path": "/the_tale/game/abilities/deck/building_repair.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_prefix|># repo: lshestov/the-tale path: /the_tale/game/abilities/deck/building_repair.py # coding: utf-8 import random from the_tale.game.map.places.storage import buildings_storage from the_tale.game.abilities.prototypes import AbilityPrototype from the_tale.game.abilities.relations import ABILITY_TYPE from ...
code_fim
hard
{ "lang": "python", "repo": "lshestov/the-tale", "path": "/the_tale/game/abilities/deck/building_repair.py", "mode": "psm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_prefix|># repo: arq5x/cyvcf path: /cyvcf/__init__.py #!/usr/bin/env python '''A VCFv4.0 parser for Python. Online version of PyVCF documentation is available at http://pyvcf.rtfd.org/ The intent of this module is to mimic the ``csv`` module in the Python stdlib, as opposed to more flexible serialization format...
code_fim
hard
{ "lang": "python", "repo": "arq5x/cyvcf", "path": "/cyvcf/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Metadata regarding the VCF file itself can be investigated through the following attributes: * ``Reader.metadata`` * ``Reader.infos`` * ``Reader.filters`` * ``Reader.formats`` * ``Reader.samples`` For example:: >>> vcf_reader.metadata['fileDate'] '20090805' >>> vcf_reade...
code_fim
hard
{ "lang": "python", "repo": "arq5x/cyvcf", "path": "/cyvcf/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def printParagraphs(self): for p in self.paragraphs: print(p.contents[0]) if __name__ == '__main__': i = ipsum() i.printParagraphs()<|fim_prefix|># repo: ethinallen/giveMeIpsum path: /main.py import requests from bs4 import BeautifulSoup class ipsum: amount = input...
code_fim
hard
{ "lang": "python", "repo": "ethinallen/giveMeIpsum", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for p in self.paragraphs: print(p.contents[0]) if __name__ == '__main__': i = ipsum() i.printParagraphs()<|fim_prefix|># repo: ethinallen/giveMeIpsum path: /main.py import requests from bs4 import BeautifulSoup class ipsum: amount = input('Enter Number of Paragraphs:\t...
code_fim
medium
{ "lang": "python", "repo": "ethinallen/giveMeIpsum", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ethinallen/giveMeIpsum path: /main.py import requests from bs4 import BeautifulSoup class ipsum: amount = input('Enter Number of Paragraphs:\t') cookies = { '_ga': 'GA1.2.304961973.1601480736', '_gid': 'GA1.2.1280585222.1601480736', '_gat': '1', } header...
code_fim
hard
{ "lang": "python", "repo": "ethinallen/giveMeIpsum", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.save_meetings() def save_meetings(self): '''Writing meetings property into a meetings.json file.''' with open('meetings.json', 'w+') as meetings_file: json.dump(self.meetings, meetings_file) Logger.info('Meetings - saved: ' + repr(self.meetings)) ...
code_fim
medium
{ "lang": "python", "repo": "fherbine/t-day", "path": "/controllers/meetings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fherbine/t-day path: /controllers/meetings.py import json from kivy.event import EventDispatcher from kivy.logger import Logger from kivy.properties import DictProperty class Meetings(EventDispatcher): '''Meetings controller/handler. Meetings ListProperty :attr: self.meetings { m_i...
code_fim
hard
{ "lang": "python", "repo": "fherbine/t-day", "path": "/controllers/meetings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> It takes as arguments: :priority_level: from 1 to 3 it is relevant of the importance of the event. The default is 3. :coordinate: Wich is not mandatory, default to `None`. Its the Coordinate object of kivy.garden.mapview of the event marker if it exists. ...
code_fim
medium
{ "lang": "python", "repo": "fherbine/t-day", "path": "/controllers/meetings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SEMAFORInformatik/femagtools path: /src/tests/test_nc.py import pytest from femagtools import nc from femagtools import isa7 @pytest.fixture def model(): filename = 'src/tests/data/minimal.nc' return nc.read(filename) @pytest.fixture def pm(): filename = 'src/tests/data/pm_data.nc'...
code_fim
hard
{ "lang": "python", "repo": "SEMAFORInformatik/femagtools", "path": "/src/tests/test_nc.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> basfrq = 50 basind = 1.5 b21 = np.linalg.norm((Bxnu, Bynu), axis=0) b2 = (b21/basind) f = fnu/basfrq hch = f hcw = f**2 ph = f*b2 pw = f**2*b2**2 pexc = f**1.5*b2**1.5 return ph, pw, pexc icur = 0 ibeta = 0 ...
code_fim
hard
{ "lang": "python", "repo": "SEMAFORInformatik/femagtools", "path": "/src/tests/test_nc.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def test_nodechains_reverse(model): for ndc in model.nodechains: assert ndc.reverse().nodes == ndc.nodes[::-1] def test_elements(model): el = model.elements[0] assert type(el) == isa7.Element for v in el.vertices: assert type(v) == isa7.Node assert el.vertices[0].xy ...
code_fim
hard
{ "lang": "python", "repo": "SEMAFORInformatik/femagtools", "path": "/src/tests/test_nc.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cms-sw/cmssw path: /RecoBTag/Skimming/python/btagMuonInJet_OutputModule_cff.py import FWCore.ParameterSet.Config as cms fr<|fim_suffix|>eAODSIM_cfi import * from RecoBTag.Skimming.btagMuonInJetOutputModuleRECOSIM_cfi import *<|fim_middle|>om RecoBTag.Skimming.btagMuonInJetOutputModul
code_fim
easy
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/RecoBTag/Skimming/python/btagMuonInJet_OutputModule_cff.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>eAODSIM_cfi import * from RecoBTag.Skimming.btagMuonInJetOutputModuleRECOSIM_cfi import *<|fim_prefix|># repo: cms-sw/cmssw path: /RecoBTag/Skimming/python/btagMuonInJet_OutputModule_cff.py import FWCore.ParameterSet.Config as cms fr<|fim_middle|>om RecoBTag.Skimming.btagMuonInJetOutputModul
code_fim
easy
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/RecoBTag/Skimming/python/btagMuonInJet_OutputModule_cff.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>btagMuonInJetOutputModuleRECOSIM_cfi import *<|fim_prefix|># repo: cms-sw/cmssw path: /RecoBTag/Skimming/python/btagMuonInJet_OutputModule_cff.py import FWCore.ParameterSet.Config as cms from RecoBTag.Skimming.btagMuonInJetOutputModul<|fim_middle|>eAODSIM_cfi import * from RecoBTag.Skimming.
code_fim
easy
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/RecoBTag/Skimming/python/btagMuonInJet_OutputModule_cff.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> test_module = __import__(test_module_name, {}, {}, test_path[-1]) test_runner = getattr(test_module, test_path[-1]) return test_runner<|fim_prefix|># repo: lincolnloop/django-kwalitee path: /django_kwalitee/testrunners/__init__.py # pulled from django.test.utils in 1.1 # function does not exist...
code_fim
hard
{ "lang": "python", "repo": "lincolnloop/django-kwalitee", "path": "/django_kwalitee/testrunners/__init__.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lincolnloop/django-kwalitee path: /django_kwalitee/testrunners/__init__.py # pulled from django.test.utils in 1.1 # function does not exist in 1.0 def get_runner(settings): if isinstance(settings, str): test_runner_str = settings else: test_runner_str = settings.TEST_RUNNE...
code_fim
medium
{ "lang": "python", "repo": "lincolnloop/django-kwalitee", "path": "/django_kwalitee/testrunners/__init__.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ckallum/Daily-Coding-Problem path: /solutions/#083.py class Node(object): def __init__(self, value): self.value = value self.left = None self.right = None def __str__(self): result = self.value if self.left: result += str(self.left) ...
code_fim
hard
{ "lang": "python", "repo": "ckallum/Daily-Coding-Problem", "path": "/solutions/#083.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): root = Node("a") root.left = Node("b") root.left.left = Node("d") root.left.right = Node("e") root.right = Node("c") root.right.right = Node("f") assert str(invert_bst(root)) == "acfbed" if __name__ == '__main__': main()<|fim_prefix|># repo: ckallum/Daily-Codi...
code_fim
hard
{ "lang": "python", "repo": "ckallum/Daily-Coding-Problem", "path": "/solutions/#083.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Juniper/ceilometer path: /ceilometer/tests/objectstore/test_notifications.py # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LIC...
code_fim
hard
{ "lang": "python", "repo": "Juniper/ceilometer", "path": "/ceilometer/tests/objectstore/test_notifications.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_middleware_event(self): v = notifications.SwiftWsgiMiddleware(mock.Mock()) samples = list(v.process_notification(MIDDLEWARE_EVENT)) self.assertEqual(3, len(samples)) for i in range(2): measure = MIDDLEWARE_EVENT['payload']['measurements'][i] ...
code_fim
hard
{ "lang": "python", "repo": "Juniper/ceilometer", "path": "/ceilometer/tests/objectstore/test_notifications.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class TestMiddlewareNotifications(test.BaseTestCase): def test_middleware_event(self): v = notifications.SwiftWsgiMiddleware(mock.Mock()) samples = list(v.process_notification(MIDDLEWARE_EVENT)) self.assertEqual(3, len(samples)) for i in range(2): measure = ...
code_fim
hard
{ "lang": "python", "repo": "Juniper/ceilometer", "path": "/ceilometer/tests/objectstore/test_notifications.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>000)) rndEndOfMibGroup.setRevisions(('2007-01-02 00:00',)) if mibBuilder.loadTexts: rndEndOfMibGroup.setLastUpdated('200701020000Z') if mibBuilder.loadTexts: rndEndOfMibGroup.setOrganization('Radlan - a MARVELL company. Marvell Semiconductor, Inc.') rndEndOfMib = MibScalar((1, 3, 6, 1, 4, 1, 89, 1000, 1),...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/RADLAN-ENDOFMIB-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/RADLAN-ENDOFMIB-MIB.py # # PySNMP MIB module RADLAN-ENDOFMIB-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-ENDOFMIB-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:38:13 2019 # On host DAVWANG4-M...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/RADLAN-ENDOFMIB-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Output, class prediction out = tf.matmul(dense2, _weights['out']) + _biases['out'] return out weights = { 'wc1': tf.Variable(tf.random_normal([3, 3, numImageChannels, numKernels1])), 'wc2': tf.Variable(tf.random_normal([3, 3, numKernels1, numKernels2])), 'wc3': tf.Variable(tf.r...
code_fim
hard
{ "lang": "python", "repo": "bneld/ASLConvNet", "path": "/src/alex_net2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bneld/ASLConvNet path: /src/alex_net2.py import tensorflow as tf import preprocess import numpy as np import matplotlib.pyplot as plt from random import sample import sys def split_by_percent(data_set): num_val = int(len(data_set)*0.2) num_test = int(len(data_set)*0.2) num_train = le...
code_fim
hard
{ "lang": "python", "repo": "bneld/ASLConvNet", "path": "/src/alex_net2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if have_validation: old_val_acc = -1 * sys.maxsize with tf.Session() as sess: sess.run(init) for epoch in range(1, n_epochs+1): print("\n ===== Epoch {} ====\n".format(epoch)) step = 1 batch_index = 0 # Keep training until reach max iterations while st...
code_fim
hard
{ "lang": "python", "repo": "bneld/ASLConvNet", "path": "/src/alex_net2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CN-UPB/sharp path: /handover/common/models.py import time import struct from threading import Lock from handover.common.addrconv import mac, ipv4 def to_ingress_egress(_list): if list: return dict(zip(['ingress', 'egress'], _list)) else: return dict() def no_conv(val)...
code_fim
hard
{ "lang": "python", "repo": "CN-UPB/sharp", "path": "/handover/common/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Match: """Fast match classed used for binary packet matching""" indices = [[0, 6], # eth_src [6, 12], # eth_dst [12, 14], # eth_type [26, 30], # ipv4_src [30, 34], # ipv4_dst [34, 36], # udp_src ...
code_fim
hard
{ "lang": "python", "repo": "CN-UPB/sharp", "path": "/handover/common/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: osu-uwrt/riptide_controllers path: /riptide_controllers2/thruster_wrench_publisher.py #!/usr/bin/env python3 # thruster_wrench_publisher node # # Input topics: # thruster_forces: Array containing how hard each thruster will push. # # Output topics: # thruster_wrenches/thruster_0...n: A Wrenc...
code_fim
hard
{ "lang": "python", "repo": "osu-uwrt/riptide_controllers", "path": "/riptide_controllers2/thruster_wrench_publisher.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>import yaml class ThrusterWrenchPublisher(Node): def __init__(self): super().__init__('thruster_wrench_publisher') self.create_subscription(Float32MultiArray, "thruster_forces", self.force_cb, qos_profile_system_default) self.declare_parameter("robot", "") self.tf_...
code_fim
medium
{ "lang": "python", "repo": "osu-uwrt/riptide_controllers", "path": "/riptide_controllers2/thruster_wrench_publisher.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def get_data(data): """ Return (train_interactions, test_interactions). """ uids = set(data['user_id']) iids = set(data['item_id']) rows = max(uids) + 1 cols = max(iids) + 1 train, test = train_test_split(data) return (_build_interaction_matrix(rows, cols, train), ...
code_fim
hard
{ "lang": "python", "repo": "Ilyushin/rec-tool", "path": "/rec_tool/models/bpr_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ilyushin/rec-tool path: /rec_tool/models/bpr_model.py """ Bayesian Personalized Ranking model """ import tensorflow as tf import pandas as pd import scipy.sparse as sp import numpy as np from sklearn.model_selection import train_test_split @tf.function def identity_loss(_, y_pred): """ ...
code_fim
hard
{ "lang": "python", "repo": "Ilyushin/rec-tool", "path": "/rec_tool/models/bpr_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mat = sp.lil_matrix((rows, cols), dtype=np.int32) users, items, ratings = list(data['user_id']), list(data['item_id']), list(data['rating']) for i in range(len(users)): # Let's assume only really good things are positives if ratings[i] >= threshold: mat[users[i],...
code_fim
hard
{ "lang": "python", "repo": "Ilyushin/rec-tool", "path": "/rec_tool/models/bpr_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ] DIRNAME = definitions.DIR_DATA_BENCHMARKS DIRNAME = os.path.join(DIRNAME, benchmark.name) def run(): os.makedirs(DIRNAME, exist_ok=True) df = benchmark.run(METHODS, cpus=4, dirname=DIRNAME) return df if __name__ == '__main__': df = run()<|fim_prefix|># repo: johnh865...
code_fim
hard
{ "lang": "python", "repo": "johnh865/election_sim", "path": "/docs/tactical/example_run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: johnh865/election_sim path: /docs/tactical/example_run.py # -*- coding: utf-8 -*- """ Created on Sat Oct 10 18:17:37 2020 @author: John Test tactical benchmark using reduced case benchmark. """ import pdb import os import votesim from votesim.benchmarks import runtools, tactical, tactical_v2 i...
code_fim
medium
{ "lang": "python", "repo": "johnh865/election_sim", "path": "/docs/tactical/example_run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for offset in ttf_offsets: ttf_font = TTFFont(path, offset) self.__info.append(ttf_font.get_info()) def get_infos(self): return self.__info<|fim_prefix|># repo: tp7/assfc path: /font_loader/ttc_parser.py from collections import namedtuple import logging import...
code_fim
hard
{ "lang": "python", "repo": "tp7/assfc", "path": "/font_loader/ttc_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(path,'rb') as file: data = struct.unpack('>4sIL', file.read(12)) ttc_header = TTCHeader(data[0].decode('ascii'),data[1],data[2]) if ttc_header.tag != 'ttcf': return ttf_offsets = [] for i in range(ttc_header.num...
code_fim
medium
{ "lang": "python", "repo": "tp7/assfc", "path": "/font_loader/ttc_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tp7/assfc path: /font_loader/ttc_parser.py from collections import namedtuple import logging import struct from font_loader.ttf_parser import TTFFont TTCHeader = namedtuple('TTCHeader', ['tag','version','num_fonts']) <|fim_suffix|> with open(path,'rb') as file: data = struct....
code_fim
medium
{ "lang": "python", "repo": "tp7/assfc", "path": "/font_loader/ttc_parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> export = fica.Key( description="whether to force-include this question in the exported PDF", default=False, ) def __init__( self, user_config: Dict[str, Any] = {}, documentation_mode: bool = False, **kwargs, ): if "name" not in user_...
code_fim
hard
{ "lang": "python", "repo": "ucbds-infra/otter-grader", "path": "/otter/assign/question_config.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ucbds-infra/otter-grader path: /otter/assign/question_config.py """Question configurations for Otter Assign""" from pydoc import doc import fica from typing import Any, Dict class QuestionConfig(fica.Config): """ Configurations for a question. """ <|fim_suffix|> check_cell = f...
code_fim
hard
{ "lang": "python", "repo": "ucbds-infra/otter-grader", "path": "/otter/assign/question_config.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jbernardis/mycmri path: /host/nodetrigger/src/client.py #!/usr/bin/env python3 from listener import Listener from railroad import Railroad from server import Server import json import queue import evaluate class ReportQueue: def __init__(self, rr): <|fim_suffix|> self.msgQ = queue.Queue(0...
code_fim
medium
{ "lang": "python", "repo": "jbernardis/mycmri", "path": "/host/nodetrigger/src/client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rr = Railroad(server) evaluate.initialize(rr) # initialize the expression evaluator rptq = ReportQueue(rr) rptq.serve_forever()<|fim_prefix|># repo: jbernardis/mycmri path: /host/nodetrigger/src/client.py #!/usr/bin/env python3 from listener import Listener from railroad import Railroad from server im...
code_fim
hard
{ "lang": "python", "repo": "jbernardis/mycmri", "path": "/host/nodetrigger/src/client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> EmailUtil(SmtpConfig).send_error_email(title, error_log)<|fim_prefix|># repo: ScenK/Dev_Blog2 path: /blog/tasks/email_tasks.py # -*- coding: utf-8 -*- from utils.email_util import EmailUtil from config import SmtpConfig def send_email_task(receiver, title, content, did, username, diary_title): <|fim...
code_fim
medium
{ "lang": "python", "repo": "ScenK/Dev_Blog2", "path": "/blog/tasks/email_tasks.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ScenK/Dev_Blog2 path: /blog/tasks/email_tasks.py # -*- coding: utf-8 -*- from utils.email_util import EmailUtil from config import SmtpConfig <|fim_suffix|>def send_error_email_task(title, error_log): EmailUtil(SmtpConfig).send_error_email(title, error_log)<|fim_middle|>def send_email_task(r...
code_fim
medium
{ "lang": "python", "repo": "ScenK/Dev_Blog2", "path": "/blog/tasks/email_tasks.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Samsung/Castanets path: /third_party/blink/web_tests/external/wpt/tools/third_party/attrs/tests/test_filters.py """ Tests for `attr.filters`. """ from __future__ import absolute_import, division, print_function import pytest import attr from attr import fields from attr.filters import _split_...
code_fim
hard
{ "lang": "python", "repo": "Samsung/Castanets", "path": "/third_party/blink/web_tests/external/wpt/tools/third_party/attrs/tests/test_filters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Return True if class or attribute is not blacklisted. """ e = exclude(*excl) assert e(fields(C).a, value) is True @pytest.mark.parametrize("excl,value", [ ((int,), 42), ((str,), "hello"), ((str, fields(C).a), 42), ((str, fiel...
code_fim
hard
{ "lang": "python", "repo": "Samsung/Castanets", "path": "/third_party/blink/web_tests/external/wpt/tools/third_party/attrs/tests/test_filters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }