text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> Returns: numpy.array adjacency matrix """ am = numpy.zeros([et.nodes.num_nds, et.nodes.num_nds], dtype=numpy.uint8) for i in range(et.nodes.num_nds): parents = et.nodes[i].parents.display() if debug: print 'node ', i, parents for j in range(len(p...
code_fim
medium
{ "lang": "python", "repo": "sergioluengosanchez/TSEM", "path": "/export.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sergioluengosanchez/TSEM path: /export.py # -------------------------------------------------------# # Auxiliar functions for exporting elimination trees # -------------------------------------------------------# import numpy def get_adjacency_matrix_from_et(et, debug = False): <|fim_suffix|> ...
code_fim
medium
{ "lang": "python", "repo": "sergioluengosanchez/TSEM", "path": "/export.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Gets the adjacency matrix of the Bayesian network encoded by the elimination tree et Args: et (elimination_tree.ElimTree): Elimination tree Returns: numpy.array adjacency matrix """ am = numpy.zeros([et.nodes.num_nds, et.nodes.num_nds], dtype=numpy.uint8) for i...
code_fim
medium
{ "lang": "python", "repo": "sergioluengosanchez/TSEM", "path": "/export.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> async def listener_close(app: Sanic, loop: AbstractEventLoop) -> None: client = getattr(app, client_app_key) await client.close() return listener_setup, listener_close def middlewares_factory( *, client_app_key: str = DEFAULT_CLIENT_APP_KEY, request_duration_metric_n...
code_fim
hard
{ "lang": "python", "repo": "adaco/aiodogstatsd", "path": "/aiodogstatsd/contrib/sanic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adaco/aiodogstatsd path: /aiodogstatsd/contrib/sanic.py from asyncio import AbstractEventLoop from http import HTTPStatus from typing import Awaitable, Callable, Optional, Tuple from sanic import Sanic from sanic.exceptions import MethodNotSupported, NotFound from sanic.request import Request fr...
code_fim
hard
{ "lang": "python", "repo": "adaco/aiodogstatsd", "path": "/aiodogstatsd/contrib/sanic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def middleware_response(request: Request, response: HTTPResponse) -> None: if _proceed_collecting( request, response, collect_not_allowed, collect_not_found ): request_duration = ( get_event_loop().time() - request.ctx._statsd_request_start...
code_fim
hard
{ "lang": "python", "repo": "adaco/aiodogstatsd", "path": "/aiodogstatsd/contrib/sanic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OsvaldoD/Django-blog path: /blog/views.py from django.shortcuts import render from .models import Post, Autor <|fim_suffix|> post = Post.objects.get(pk=question_id) context = {'id':post} return render(request, 'blog/detail.html',context)<|fim_middle|># Create your views here. def inde...
code_fim
hard
{ "lang": "python", "repo": "OsvaldoD/Django-blog", "path": "/blog/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> post = Post.objects.get(pk=question_id) context = {'id':post} return render(request, 'blog/detail.html',context)<|fim_prefix|># repo: OsvaldoD/Django-blog path: /blog/views.py from django.shortcuts import render from .models import Post, Autor <|fim_middle|># Create your views here. def inde...
code_fim
hard
{ "lang": "python", "repo": "OsvaldoD/Django-blog", "path": "/blog/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> posts = Post.objects.order_by('-data') body = '' for post in posts: body = post.corpo[:250] moment = str(post.data) data = moment.split(' ')[0] context = {'posts': posts,'corpo':body, 'data':data} return render(request, 'blog/index.html', context) def detail(r...
code_fim
medium
{ "lang": "python", "repo": "OsvaldoD/Django-blog", "path": "/blog/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: niterain/digsby path: /digsby/src/gui/native/win/winextensions.py ''' This file will contain all platform-specific extensions or method replacements to wx API, such as overriding wx.LaunchDefaultBrowser on Windows or adding wx.Window.Cut method. ''' from peak.util.imports import lazyModule,...
code_fim
hard
{ "lang": "python", "repo": "niterain/digsby", "path": "/digsby/src/gui/native/win/winextensions.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return wx.Rect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top) def GetRECT(win): return wxRectToRECT(win.Rect) def GetLRECT(win): return wxRectToRECT(wx.RectS(win.GetSize())) def _monkeypatch(*a, **k): # Hack until patching methods works better in new bindi...
code_fim
hard
{ "lang": "python", "repo": "niterain/digsby", "path": "/digsby/src/gui/native/win/winextensions.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> WindowClass.GetRECT = GetRECT WindowClass.RECT = property(GetRECT) WindowClass.GetLRECT = GetLRECT WindowClass.LRECT = property(GetLRECT) wx.Rect.FromRECT = staticmethod(wxRectFromRECT) wx.Rect.RECT = property(wxRectToRECT) whenImported('wx', _monkeypatch)<|fim_prefix|># re...
code_fim
hard
{ "lang": "python", "repo": "niterain/digsby", "path": "/digsby/src/gui/native/win/winextensions.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: achillesrasquinha/spockpy path: /spockpy/_util/_util.py # imports - standard imports import io import base64 # imports - third-party imports import numpy as np from PIL import Image import cv2 def _resize_image(image, size, maintain_aspect_ratio = False): copy = image.copy() copy.thumb...
code_fim
hard
{ "lang": "python", "repo": "achillesrasquinha/spockpy", "path": "/spockpy/_util/_util.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> major, minor, patch = int(version[0]), int(version[1]), int(version[2]) return (major, minor, patch) def _mount_roi(array, roi, color = (0, 255, 0), thickness = 1): x, y, w, h = roi cv2.rectangle(array, (x, y), (x + w, y + h), color = color, thickness = thickness) return array def...
code_fim
hard
{ "lang": "python", "repo": "achillesrasquinha/spockpy", "path": "/spockpy/_util/_util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def updateXMLGauge(self, progress): self.Gauge_XML.SetValue(progress) def resetXMLGenerationButton(self): # Reset XML generation button self.updateXMLGauge(0) self.formerXMLCorr = None self.xmlButtonMode = BUTTON_GENERATE self.Btn_XML.SetLabel('Get ...
code_fim
hard
{ "lang": "python", "repo": "uds-lsv/ATC-Anno", "path": "/annotator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: uds-lsv/ATC-Anno path: /annotator.py n "[]{}()" and styleBefore == stc.STC_P_OPERATOR: braceAtCaret = caretPos - 1 # check after if braceAtCaret < 0: charAfter = self.GetCharAt(caretPos) styleAfter = self.GetStyleAt(caretPos) if ch...
code_fim
hard
{ "lang": "python", "repo": "uds-lsv/ATC-Anno", "path": "/annotator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: uds-lsv/ATC-Anno path: /annotator.py lHyp = fp.read().strip() if self.showsASR: self.TextEdit.SetValue(xmlHyp) # Generate pure-text hypothesis textHyp = stripXML(xmlHyp) if self.showsASR: self.TextNoXML.SetValue(text...
code_fim
hard
{ "lang": "python", "repo": "uds-lsv/ATC-Anno", "path": "/annotator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class RTPolarityExtractor(DataExtractor): #Used for the RT-PolarityData set def __init__(self, filename): self.filepath = filename def process(self): delchars = str.maketrans( dict.fromkeys(''.join(c for c in map(chr, range(256)) if not (c.isalnum() or c.isspace())))) ...
code_fim
hard
{ "lang": "python", "repo": "IanHTai/LSTM-stock-prediction", "path": "/dataExtract/dataExtractor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IanHTai/LSTM-stock-prediction path: /dataExtract/dataExtractor.py from abc import ABC, abstractmethod import csv import os import numpy as np import re import pandas as pd import pickle from datetime import datetime from datetime import timedelta import math class DataExtractor(ABC): @abstr...
code_fim
hard
{ "lang": "python", "repo": "IanHTai/LSTM-stock-prediction", "path": "/dataExtract/dataExtractor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Turn into MultiIndex form after manual (scripted) tampering in CSV format, then store in pickle form :param filename: :return: """ df = pd.read_csv(filename, float_precision='high', header=[0,1,2]) #print(df.loc[(slice(None), slice(None)), 'Date...
code_fim
hard
{ "lang": "python", "repo": "IanHTai/LSTM-stock-prediction", "path": "/dataExtract/dataExtractor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert( len(tmp) >= len(nfo[0]) ) line = tmp + line[len(tmp):] elif _i == 6: nfo = line.split() tmp = '%1d' % radiate assert( len(tmp) >= len(nfo[0]) ) line = tmp + line[len(tmp):] fout.write(line) return def test(): ModelSuite(values_to_test=[1., 2., 4., 8., 16.]) #M...
code_fim
hard
{ "lang": "python", "repo": "nmancinelli/PSPHOTON_POSO", "path": "/tools/ModelSuite.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nmancinelli/PSPHOTON_POSO path: /tools/ModelSuite.py from os import mkdir, chdir, getcwd, symlink from subprocess import Popen class ModelSuite(): def __init__(self, name='TRIALS', param_to_test='freq', base_file='BASE_DOFILES/do.photon', values_to_test=[], SLURM = True): root = get...
code_fim
hard
{ "lang": "python", "repo": "nmancinelli/PSPHOTON_POSO", "path": "/tools/ModelSuite.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Gomax-07/netclone100 path: /accounts/form.py from django.contrib.auth.forms import UserCreationForm from django import forms from django.db import transaction from .models import User, Customer, Employee class CustomerSignUpForm(UserCreationForm): <|fim_suffix|> @transaction.atomic def s...
code_fim
hard
{ "lang": "python", "repo": "Gomax-07/netclone100", "path": "/accounts/form.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @transaction.atomic def save(self): user = super().save(commit=False) user.is_customer = True user.first_name = self.cleaned_data.get('first_name') user.last_name = self.cleaned_data.get('last_name') user.email = self.cleaned_data.get('email') user.s...
code_fim
medium
{ "lang": "python", "repo": "Gomax-07/netclone100", "path": "/accounts/form.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('Preproc ',stl_filename) stl2vtk(stl_filename,vtk_filename) command = """python src/convert_mesh.py -d 3 "%s" "%s" """ %(vtk_filename,vtk_filename) os.system(command)<|fim_prefix|># repo: lucascbarbosa/INT path: /Manufatura Aditiva/Simulacao-GAN/Pipeline/3-Simulate_geometries/open-s...
code_fim
easy
{ "lang": "python", "repo": "lucascbarbosa/INT", "path": "/Manufatura Aditiva/Simulacao-GAN/Pipeline/3-Simulate_geometries/open-source/src/preproc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lucascbarbosa/INT path: /Manufatura Aditiva/Simulacao-GAN/Pipeline/3-Simulate_geometries/open-source/src/preproc.py import os from src.stl2vtk import stl2vtk <|fim_suffix|> print('Preproc ',stl_filename) stl2vtk(stl_filename,vtk_filename) command = """python src/convert_mesh.py -d 3 "...
code_fim
easy
{ "lang": "python", "repo": "lucascbarbosa/INT", "path": "/Manufatura Aditiva/Simulacao-GAN/Pipeline/3-Simulate_geometries/open-source/src/preproc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jewel-Hong/SC-projects path: /SC101Lecture_code/SC101_week5/palindrome.py """ File: palindrome.py Name: ---------------------------- This program prints the answers of whether 'madam', 'step on no pets', 'Q', 'pythonyp', and 'notion' are palindrome using a recursive function called is_palindrome(...
code_fim
hard
{ "lang": "python", "repo": "Jewel-Hong/SC-projects", "path": "/SC101Lecture_code/SC101_week5/palindrome.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if len(s) == 0: return True elif len(s) == 1: return True else: if s[0] != s[len(s)-1]: return False else: return is_palindrome(s[1:len(s)-1]) #注意上限不包含 if __name__ == '__main__': main()<|fim_prefix|># repo: Jewel-Hong/SC-projects path: /SC101Lecture_code/SC101_week5/palindrome.py """ ...
code_fim
hard
{ "lang": "python", "repo": "Jewel-Hong/SC-projects", "path": "/SC101Lecture_code/SC101_week5/palindrome.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tdruiva/cerificates path: /generate_certificate.py # -*- coding: utf-8 -*- import csv, re import codecs, hashlib, os.path, unicodedata, string from subprocess import Popen, PIPE class Certificate: <|fim_suffix|> def as_pdf(self): inkscape = '/usr/bin/inkscape' output_dir = os.getcwd()...
code_fim
hard
{ "lang": "python", "repo": "tdruiva/cerificates", "path": "/generate_certificate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with open(CSV_PATH, "rb") as csv_file: rows = csv.reader(csv_file, delimiter='\t') for row in rows: name = row[0] result = Certificate(name).as_pdf() if os.path.isfile(result): print 'Certificate: ' + name + ' ========= OK' else: print 'Certificate: ' + name + ' #########...
code_fim
hard
{ "lang": "python", "repo": "tdruiva/cerificates", "path": "/generate_certificate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: franzihe/Python_Masterthesis path: /MEPS/calc_station_properties.py # coding: utf-8 # In[ ]: import sys sys.path.append('/Volumes/SANDISK128/Documents/Thesis/Python/') import fill_values as fv import pandas as pd import numpy as np from scipy.integrate import simps # In[ ]: def find_station_...
code_fim
hard
{ "lang": "python", "repo": "franzihe/Python_Masterthesis", "path": "/MEPS/calc_station_properties.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_value_at_station(fn, var_ml,ens_memb,x,y): var_ml = fn.variables[var_ml] var_ml, dtype = fv.mask_array(var_ml,ens_memb,y,x) var_ml = pd.DataFrame.from_dict(var_ml[:,:]) var_ml = np.fliplr(var_ml) var_ml = np.ma.masked_where(np.isnan(var_ml), var_ml) return(var_ml); ...
code_fim
hard
{ "lang": "python", "repo": "franzihe/Python_Masterthesis", "path": "/MEPS/calc_station_properties.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>output_path = "/scratch/wdjo224/deep_protein_binding/experiments/" + args.exp_name + "/test_results/{}".format(args.pid) def test(rank, model): idxs = test_idxs[rank] print("pid: {}".format(os.getpid())) result_summary = None molecules = MoleculeDatasetCSV( csv_file=args.D, ...
code_fim
hard
{ "lang": "python", "repo": "wderekjones/deep_protein_binding", "path": "/src/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wderekjones/deep_protein_binding path: /src/test.py import sys sys.path.append("/scratch/wdjo224/deep_protein_binding") import torch torch.manual_seed(0) import os import time import pandas as pd import numpy as np from tqdm import tqdm from itertools import chain from torch.utils.data.sampler im...
code_fim
hard
{ "lang": "python", "repo": "wderekjones/deep_protein_binding", "path": "/src/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mi = ModelInstance(Model, alias='alias') self.assertIsInstance(mi.deserialize(None, 'other'), Model) self.assertIsInstance(mi.deserialize(None, 'existing'), Model) self.assertRaises(colander.Invalid, mi.deserialize, None, 'missing')<|fim_prefix|># repo: pombredanne/glottolo...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/glottolog3", "path": "/glottolog3/tests/test_unit.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pombredanne/glottolog3 path: /glottolog3/tests/test_unit.py from unittest import TestCase import colander from glottolog3.models import Doctype class Tests(TestCase): def test_normalize_language_explanation(self): from glottolog3.util import normalize_language_explanation ...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/glottolog3", "path": "/glottolog3/tests/test_unit.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def get(cls, val, key='id', default=None): if val == 'other' and key == 'alias': return Model() if val == 'existing': return Model() return None mi = ModelInstance(Model, a...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/glottolog3", "path": "/glottolog3/tests/test_unit.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mvdwoord/PyGNS3 path: /tools/api_gen/_source/project_handler.py ram is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later versi...
code_fim
hard
{ "lang": "python", "repo": "mvdwoord/PyGNS3", "path": "/tools/api_gen/_source/project_handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mvdwoord/PyGNS3 path: /tools/api_gen/_source/project_handler.py software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Thi...
code_fim
hard
{ "lang": "python", "repo": "mvdwoord/PyGNS3", "path": "/tools/api_gen/_source/project_handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> controller = Controller.instance() project = controller.get_project(request.match_info["project_id"]) response.json(project) @Route.put( r"/projects/{project_id}", status_codes={ 200: "Node updated", 400: "Invalid request", 4...
code_fim
hard
{ "lang": "python", "repo": "mvdwoord/PyGNS3", "path": "/tools/api_gen/_source/project_handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # =================================================================================== # Analyze the results # =================================================================================== test_predictions = session.run(mean_x, feed_dict={input_data: test_data}) np.save('sine_...
code_fim
hard
{ "lang": "python", "repo": "Shahip2016/quantum-neural-networks", "path": "/function_fitting/function_fitting.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Shahip2016/quantum-neural-networks path: /function_fitting/function_fitting.py # Copyright 2018 Xanadu Quantum Technologies 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 Lic...
code_fim
hard
{ "lang": "python", "repo": "Shahip2016/quantum-neural-networks", "path": "/function_fitting/function_fitting.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: henriklied/adsb-tools path: /adsb-filter.py #!/usr/bin/env python import json import os, sys import argparse import zipfile import uuid import datetime import requests, geojson from shapely.geometry import Point, MultiPoint from clint.textui import progress parser = argparse.ArgumentParser(des...
code_fim
hard
{ "lang": "python", "repo": "henriklied/adsb-tools", "path": "/adsb-filter.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> out_tmpfile = 'filtered_%s.json' % date zf = zipfile.ZipFile(f) for info in zf.infolist(): try: data = json.loads(zf.read(info.filename)) print "Working on", info.filename for sample in data['acList']: if 'Lat' in sample and 'Long' in sample and 'Icao' i...
code_fim
hard
{ "lang": "python", "repo": "henriklied/adsb-tools", "path": "/adsb-filter.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print 'Downloading http://history.adsbexchange.com/Aircraftlist.json/%s.zip' % date temp_file = '/tmp/adsb_%s.zip' % date if not os.path.exists(temp_file): r = requests.get('http://history.adsbexchange.com/Aircraftlist.json/%s.zip' % date, stream=True) with open(temp_file, 'wb') as...
code_fim
hard
{ "lang": "python", "repo": "henriklied/adsb-tools", "path": "/adsb-filter.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def check_connectivity(config): global diagram test_result = '\033[40;32m{}\033[m'.format("TEST PASSED") f = os.popen('ssh 10.212.93.44 virsh list | awk \'NR >2 { print $2 }\'') running_vms = f.read().strip('\n') # print("Following VMs are running:\n"+running_vms+"\n") for s...
code_fim
hard
{ "lang": "python", "repo": "amitinfo2k/deployment", "path": "/setupremote/scripts/check_connectivity_spgw.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: amitinfo2k/deployment path: /setupremote/scripts/check_connectivity_spgw.py import constants_spgw as constants import ConfigParser import ipaddress import os diagram = """\ +--------------+ Control+----------------> S1MME| MME | ...
code_fim
hard
{ "lang": "python", "repo": "amitinfo2k/deployment", "path": "/setupremote/scripts/check_connectivity_spgw.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>.3f" % (len(filter(lambda x : x > 0, A)) / N)) print ("%.3f" % (len(filter(lambda x : x < 0, A)) / N)) print ("%.3f" % (len(filter(lambda x : x == 0, A)) / N))<|fim_prefix|># repo: jamesandreou/hackerrank-solutions path: /warmup/hr_plus_minus.py # hackerrank - Algorithms: Plus Minus # Written by James An...
code_fim
medium
{ "lang": "python", "repo": "jamesandreou/hackerrank-solutions", "path": "/warmup/hr_plus_minus.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>da x : x < 0, A)) / N)) print ("%.3f" % (len(filter(lambda x : x == 0, A)) / N))<|fim_prefix|># repo: jamesandreou/hackerrank-solutions path: /warmup/hr_plus_minus.py # hackerrank - Algorithms: Plus Minus # Written by James Andreou, University of<|fim_middle|> Waterloo N = float(raw_input()) A = map(int,...
code_fim
medium
{ "lang": "python", "repo": "jamesandreou/hackerrank-solutions", "path": "/warmup/hr_plus_minus.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jamesandreou/hackerrank-solutions path: /warmup/hr_plus_minus.py # hackerrank - Algorithms: Plus Minus # Written by James Andreou, University of<|fim_suffix|>.3f" % (len(filter(lambda x : x > 0, A)) / N)) print ("%.3f" % (len(filter(lambda x : x < 0, A)) / N)) print ("%.3f" % (len(filter(lambda x...
code_fim
medium
{ "lang": "python", "repo": "jamesandreou/hackerrank-solutions", "path": "/warmup/hr_plus_minus.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nectar-Project/nectar-aliments-database path: /fdb/datasources/__init__.py #from fdb.datasources.ciqual import CiqualDatasource from fdb.datasources.cnf import CnfDatasource class Datasources: <|fim_suffix|> return self.datasources[0].generate()<|fim_middle|> def __init__(self): ...
code_fim
medium
{ "lang": "python", "repo": "Nectar-Project/nectar-aliments-database", "path": "/fdb/datasources/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): self.datasources = [ # Ciqual has not enough data # CiqualDatasource() CnfDatasource() ] def generate(self): return self.datasources[0].generate()<|fim_prefix|># repo: Nectar-Project/nectar-aliments-database path: /f...
code_fim
easy
{ "lang": "python", "repo": "Nectar-Project/nectar-aliments-database", "path": "/fdb/datasources/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: QQuick/zzz_Numscrypt path: /numscrypt/development/shipment/shipment_test.py import os import webbrowser os.system ('clear') shipDir = os.path.dirname (os.path.abspath (__file__)) .replace ('\\', '/') rootDir = '/'.join (shipDir.split ('/')[ : -2]) def getAbsPath (relPath): return '{...
code_fim
hard
{ "lang": "python", "repo": "QQuick/zzz_Numscrypt", "path": "/numscrypt/development/shipment/shipment_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if fcallSwitch: print ('Shipment test completed') else: input ('Close browser tabs opened by shipment test and press [enter] for fcall test')<|fim_prefix|># repo: QQuick/zzz_Numscrypt path: /numscrypt/development/shipment/shipment_test.py import os import webbrowser os.system ('clear') sh...
code_fim
hard
{ "lang": "python", "repo": "QQuick/zzz_Numscrypt", "path": "/numscrypt/development/shipment/shipment_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>os.system ('py39 test_install.py') for fcallSwitch in (' ',): # for fcallSwitch in (' ', '-f '): # Outcommented to save testing time autoTest ('development/automated_tests/ndarray', 'autotest') # test ('development/manual_tests/slicing_optimization', 'test') if fcallSwitch: print ('Shipme...
code_fim
hard
{ "lang": "python", "repo": "QQuick/zzz_Numscrypt", "path": "/numscrypt/development/shipment/shipment_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_deserialize(self): o = self.TestClass(self.data.copy()) self.assertTrue((isinstance(o.id, str))) self.assertEqual(o.id, 'abc') self.assertTrue(isinstance(o.nb, int)) self.assertEqual(o.nb, 1) self.assertEqual(o.created.isoformat(), '2020-11-12'...
code_fim
hard
{ "lang": "python", "repo": "thaichat04/conciliator-python", "path": "/tests/test_serializable.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: thaichat04/conciliator-python path: /tests/test_serializable.py from unittest import TestCase from conciliator.conciliatorobj import ConciliatorObj import datetime class TestSerializable(TestCase): class TestClass(ConciliatorObj): id: str nb: int isBool: bool ...
code_fim
hard
{ "lang": "python", "repo": "thaichat04/conciliator-python", "path": "/tests/test_serializable.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_serialize(self): o = self.TestClass(self.data.copy()) d = o.serializes() self.assertEqual(d, '{"id": "abc", "nb": 1, "isBool": true, "created": "2020-11-12", "ts_tz": "2020-10-20T16:40:40.036783+00:00", "ts_iso": "2020-10-20T16:40:40.036783", "ts_notrailingzeros": "202...
code_fim
hard
{ "lang": "python", "repo": "thaichat04/conciliator-python", "path": "/tests/test_serializable.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__=='__main__': #输入日记 diary_file = open("diary",'a') inputdiary(diary_file) diary_file.close() #输出日记 diary_file = open("diary",'r') printdiary(diary_file) diary_file.close()<|fim_prefix|># repo: LishuaiBeijing/OMOOC2py path: /_src/om2py3w/3wex0/diary_func.py # -*-...
code_fim
medium
{ "lang": "python", "repo": "LishuaiBeijing/OMOOC2py", "path": "/_src/om2py3w/3wex0/diary_func.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LishuaiBeijing/OMOOC2py path: /_src/om2py3w/3wex0/diary_func.py # -*-coding=utf-8 -*- def inputdiary(file): print "逐行输入日记(exit表示结束输入):\n" diary_input = "" while 1: line = raw_input(" > ") if line=="exit": file.write(diary_input) exit(0) ...
code_fim
medium
{ "lang": "python", "repo": "LishuaiBeijing/OMOOC2py", "path": "/_src/om2py3w/3wex0/diary_func.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dataloader, size = build_dataloader(args.batch_size, args.num_workers, use_gpu, args.font, args.size, args.from_unicode, args.to_unicode) model = GAN(args.num_fakes, args.rand_dim, size, use_gpu) criterion = BCELoss() d_optimizer = torch.optim.SGD(mo...
code_fim
hard
{ "lang": "python", "repo": "mo-vic/HanZiGan", "path": "/main/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> os.environ['CUDA_VISIBLE_DEVICES'] = ','.join(args.gpu_ids) if args.gpu_ids: if torch.cuda.is_available(): use_gpu = True torch.cuda.manual_seed_all(args.seed) else: use_gpu = False else: use_gpu = False torch.manual_seed(args.s...
code_fim
hard
{ "lang": "python", "repo": "mo-vic/HanZiGan", "path": "/main/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mo-vic/HanZiGan path: /main/train.py import os import sys import argparse from datetime import datetime import torch from tensorboardX import SummaryWriter from utils.utils import train from utils.logger import Logger from models.gan import GAN from losses.bce import BCELoss from utils.datalo...
code_fim
hard
{ "lang": "python", "repo": "mo-vic/HanZiGan", "path": "/main/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bugraahmetcaglar/ticket-system path: /wvenv/Lib/site-packages/online_users/middleware.py from django.utils.deprecation import MiddlewareMixin from online_users.models import OnlineUserActivity <|fim_suffix|> user = request.user if not user.is_authenticated: return ...
code_fim
hard
{ "lang": "python", "repo": "bugraahmetcaglar/ticket-system", "path": "/wvenv/Lib/site-packages/online_users/middleware.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> user = request.user if not user.is_authenticated: return OnlineUserActivity.update_user_activity(user)<|fim_prefix|># repo: bugraahmetcaglar/ticket-system path: /wvenv/Lib/site-packages/online_users/middleware.py from django.utils.deprecation import MiddlewareMixin f...
code_fim
hard
{ "lang": "python", "repo": "bugraahmetcaglar/ticket-system", "path": "/wvenv/Lib/site-packages/online_users/middleware.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: daviddrysdale/python-phonenumbers path: /python/phonenumbers/shortdata/region_IQ.py """Auto-generated file, do not edit by hand. IQ metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_IQ = PhoneMetadata(id='IQ', country_code=None, international_pre...
code_fim
hard
{ "lang": "python", "repo": "daviddrysdale/python-phonenumbers", "path": "/python/phonenumbers/shortdata/region_IQ.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>(national_number_pattern='(?:443|711\\d|998)\\d', example_number='4430', possible_length=(4, 5)), sms_services=PhoneNumberDesc(national_number_pattern='(?:443|711\\d|998)\\d', example_number='4430', possible_length=(4, 5)), short_data=True)<|fim_prefix|># repo: daviddrysdale/python-phonenumbers p...
code_fim
hard
{ "lang": "python", "repo": "daviddrysdale/python-phonenumbers", "path": "/python/phonenumbers/shortdata/region_IQ.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>tern='1(?:0[04]|15|22)', example_number='100', possible_length=(3,)), short_code=PhoneNumberDesc(national_number_pattern='1(?:0[04]|15|22)|4432|71117|9988', example_number='100', possible_length=(3, 4, 5)), carrier_specific=PhoneNumberDesc(national_number_pattern='(?:443|711\\d|998)\\d', example_n...
code_fim
hard
{ "lang": "python", "repo": "daviddrysdale/python-phonenumbers", "path": "/python/phonenumbers/shortdata/region_IQ.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lmc1993217/vnpy path: /vn.trader/ctaStrategy/SaveData.py # -*- coding: utf-8 -*- """ Created on Mon May 08 19:51:42 2017 @author: lizard """ import pandas as pd from WindPy import w from datetime import datetime, timedelta import pymongo from time import time from multiprocessing.pool import Thr...
code_fim
hard
{ "lang": "python", "repo": "lmc1993217/vnpy", "path": "/vn.trader/ctaStrategy/SaveData.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> bar.datetime = barDatetime bar.date = bar.datetime.date().strftime('%Y%m%d') bar.time = bar.datetime.time().strftime('%H:%M:%S') bar.open = float(row['open']) bar.high = float(row['high']) bar.low = float(row['low']) bar.close = float(row['c...
code_fim
hard
{ "lang": "python", "repo": "lmc1993217/vnpy", "path": "/vn.trader/ctaStrategy/SaveData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: anasmatic/xRayArab path: /scripts/face_recognation.py # -*- coding: utf-8 -*- """ Created on Sun Mar 7 22:24:46 2021 @author: Omnia """ from PIL import ImageGrab import face_recognition import pandas as pd import numpy as np import threading import cv2 from vertical_layout import HorizontalImag...
code_fim
hard
{ "lang": "python", "repo": "anasmatic/xRayArab", "path": "/scripts/face_recognation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if results1[0] == True: print("It's a picture of me!") else: print("It's not a picture of me!") if results2[0] == True: print("It's a picture of me!") else: print("It's not a picture of me!") """ db = [] first_image_list = [] loaddb() print("db ready") bar = HorizontalImageBar() pr...
code_fim
hard
{ "lang": "python", "repo": "anasmatic/xRayArab", "path": "/scripts/face_recognation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 475763610/Darily path: /notes/demo/jingdong/urls.py """jingdong URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views ...
code_fim
medium
{ "lang": "python", "repo": "475763610/Darily", "path": "/notes/demo/jingdong/urls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ # path('api-auth/', include('rest_framework.urls')), # drf文档,title自定义 path('docs/', include_docs_urls(title='京东')), # 生产环境开启配置 # re_path(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}), # re_path(r'^static/(?P<path>.*)$', serve, {"document_root": STAT...
code_fim
hard
{ "lang": "python", "repo": "475763610/Darily", "path": "/notes/demo/jingdong/urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nuitka/Nuitka path: /nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/filesystem.py """SCons.Tool.filesystem Tool-specific initialization for the filesystem tools. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool....
code_fim
hard
{ "lang": "python", "repo": "Nuitka/Nuitka", "path": "/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/filesystem.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return env.subst_target_source(env['COPYSTR'], 0, target, source) copy_action = SCons.Action.Action( copy_action_func, copy_action_str ) def generate(env): try: env['BUILDERS']['CopyTo'] env['BUILDERS']['CopyAs'] except KeyError as e: global copyToBuilder if c...
code_fim
hard
{ "lang": "python", "repo": "Nuitka/Nuitka", "path": "/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/filesystem.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: posguy99/comp660-fall2020 path: /src/M5_zombies.py # base case example # taken from https://www.shmoop.com/computer-science/recursion/base-case.html # and shamelessly modified <|fim_suffix|> def escapeZombies(numberOfZombies): """Escape from the zombie horde Args: numberOfZombie...
code_fim
medium
{ "lang": "python", "repo": "posguy99/comp660-fall2020", "path": "/src/M5_zombies.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def escapeZombies(numberOfZombies): """Escape from the zombie horde Args: numberOfZombies ([int]): [number of zombies in vicinity] """ # the base case is the number of zombies, the test is whether or not # there are still zombies around. As long as it's > 0, the # recursi...
code_fim
medium
{ "lang": "python", "repo": "posguy99/comp660-fall2020", "path": "/src/M5_zombies.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass def escapeZombies(numberOfZombies): """Escape from the zombie horde Args: numberOfZombies ([int]): [number of zombies in vicinity] """ # the base case is the number of zombies, the test is whether or not # there are still zombies around. As long as it's > 0, the ...
code_fim
medium
{ "lang": "python", "repo": "posguy99/comp660-fall2020", "path": "/src/M5_zombies.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jimmy-INL/google-research path: /basisnet/personalization/centralized_so_nwp/so_nwp_preprocessing.py # coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. ...
code_fim
hard
{ "lang": "python", "repo": "Jimmy-INL/google-research", "path": "/basisnet/personalization/centralized_so_nwp/so_nwp_preprocessing.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return tf.concat([[bos], tokens], 0) return to_ids def batch_and_split(dataset, max_sequence_length, batch_size): return dataset.padded_batch( batch_size, padded_shapes=[max_sequence_length + 1]).map( split_input_target, num_parallel_calls=tf.data.experimenta...
code_fim
hard
{ "lang": "python", "repo": "Jimmy-INL/google-research", "path": "/basisnet/personalization/centralized_so_nwp/so_nwp_preprocessing.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> n = len(joints) JJ_te = np.zeros((n, 3)) if num_q == 0: print('Single body, there is no link') else: POS_j, ORI_j = f_kin_j(RR, AA, q, joints) POS_e, ORI_e = f_kin_e(RR, AA, joints) for i in range(n): A_I_i = AA[joints[i], :, :] ...
code_fim
medium
{ "lang": "python", "repo": "lirun-sat/spacerobot_dynamics", "path": "/calc_jte.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lirun-sat/spacerobot_dynamics path: /calc_jte.py import numpy as np from Get_global_value import J_type from Get_global_value import Qe from Get_global_value import cc from Get_global_value import Ez from Get_global_value import ce from Get_global_value import num_q from f_kin_j import f_k...
code_fim
medium
{ "lang": "python", "repo": "lirun-sat/spacerobot_dynamics", "path": "/calc_jte.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vasmedvedev/welltory_test path: /api/views.py from rest_framework import viewsets from api import serializers from welltory import models class SleepViewSet(viewsets.ReadOnlyModelViewSet): queryset = models.Sleep.objects.all() serializer_class = serializers.SleepSerializer <|fim_suffix...
code_fim
hard
{ "lang": "python", "repo": "vasmedvedev/welltory_test", "path": "/api/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class StepsViewSet(SleepViewSet): queryset = models.Steps.objects.all() serializer_class = serializers.StepsSerializer class GeoViewSet(SleepViewSet): queryset = models.Geo.objects.all() serializer_class = serializers.GeoSerializer<|fim_prefix|># repo: vasmedvedev/welltory_test path: /a...
code_fim
hard
{ "lang": "python", "repo": "vasmedvedev/welltory_test", "path": "/api/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rr) exit(1) c1=cnx.cursor() c1.execute('select id,num,nam from admin') for(id,num,nam) in c1: print(id.__str__()+' '+num+' '+nam) c1.close() cnx.close()<|fim_prefix|># repo: NaiveWang/Just_for_Fun path: /Others/insertion.py # coding=UTF-8 import mysql.connector from mysql.connector import error...
code_fim
medium
{ "lang": "python", "repo": "NaiveWang/Just_for_Fun", "path": "/Others/insertion.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NaiveWang/Just_for_Fun path: /Others/insertion.py # coding=UTF-8 import mysql.connector from mysql.connector import errorcode try: cnx = mysql.connector.connect(user='root',password='123123',host=None,database='coursesenrolling') except mysql.connector.Error as err: if err.errno == errorc...
code_fim
medium
{ "lang": "python", "repo": "NaiveWang/Just_for_Fun", "path": "/Others/insertion.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CAMOBAP/conan-center-index path: /recipes/pfr/all/conanfile.py from conans import ConanFile, tools from conans.errors import ConanInvalidConfiguration import os class PfrConan(ConanFile): name = "pfr" description = "std::tuple like methods for user defined types without any macro or boi...
code_fim
hard
{ "lang": "python", "repo": "CAMOBAP/conan-center-index", "path": "/recipes/pfr/all/conanfile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> include_folder = os.path.join(self._source_subfolder, "include") self.copy(pattern=os.path.join(self._source_subfolder, "LICENSE_1_0.txt"), dst="licenses", src=self.source_folder) self.copy(pattern="*", dst="include", src=include_folder) def package_id(self):...
code_fim
hard
{ "lang": "python", "repo": "CAMOBAP/conan-center-index", "path": "/recipes/pfr/all/conanfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Provider Information provider_info = dxchain.provider.info() print(provider_info)<|fim_prefix|># repo: fanxx288/dxchainpy path: /example/provider_example.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This file is used to demo features on Provider module Author: DxChain Team Created at: 2018121...
code_fim
medium
{ "lang": "python", "repo": "fanxx288/dxchainpy", "path": "/example/provider_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fanxx288/dxchainpy path: /example/provider_example.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This file is used to demo features on Provider module <|fim_suffix|># import dxchainpy package import dxchainpy # declare a class object with self defined host dxchain = dxchainpy.Dxchain() ...
code_fim
easy
{ "lang": "python", "repo": "fanxx288/dxchainpy", "path": "/example/provider_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/<docname>','to_route':'property/detail'}, ]<|fim_prefix|># repo: alijasim/Frappe-ERPNext path: /estate_app/routes.py urlpatterns = [ {'from_route': '/property/detail/<doctypename>','to_route':'property/d<|fim_middle|>etail'}, # {'from_route': '/property/detail
code_fim
easy
{ "lang": "python", "repo": "alijasim/Frappe-ERPNext", "path": "/estate_app/routes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alijasim/Frappe-ERPNext path: /estate_app/routes.py urlpatterns = [ {'from_route': '/property/<|fim_suffix|>/<docname>','to_route':'property/detail'}, ]<|fim_middle|>detail/<doctypename>','to_route':'property/detail'}, # {'from_route': '/property/detail
code_fim
medium
{ "lang": "python", "repo": "alijasim/Frappe-ERPNext", "path": "/estate_app/routes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alijasim/Frappe-ERPNext path: /estate_app/routes.py urlpatterns = [ {'from_route': '/property/detail/<doctypename>','to_route':'property/d<|fim_suffix|>/<docname>','to_route':'property/detail'}, ]<|fim_middle|>etail'}, # {'from_route': '/property/detail
code_fim
easy
{ "lang": "python", "repo": "alijasim/Frappe-ERPNext", "path": "/estate_app/routes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # VARS self._addr_fifo = self.var("addr_fifo", self.config_width, size=self.addr_fifo_depth, packed=True, explicit_array=True) self._lin_addr_cnter = self.var("lin_addr_cnter", ...
code_fim
hard
{ "lang": "python", "repo": "StanfordAHA/lake", "path": "/lake/modules/agg_sram_shared_addr_gen.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if ~self._rst_n: self._wr_ptr = 0 self._rd_ptr = 0 self._addr_fifo = 0 self._addr_fifo_out = 0 elif self._mode[1] == 1: if self._addr_fifo_wr_en: self._wr_ptr = self._wr_ptr + 1 self._addr_fifo[self...
code_fim
hard
{ "lang": "python", "repo": "StanfordAHA/lake", "path": "/lake/modules/agg_sram_shared_addr_gen.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: StanfordAHA/lake path: /lake/modules/agg_sram_shared_addr_gen.py from kratos import * from functools import reduce import operator import kratos from lake.attributes.config_reg_attr import ConfigRegAttr from lake.passes.passes import lift_config_reg from lake.attributes.formal_attr import Formal...
code_fim
hard
{ "lang": "python", "repo": "StanfordAHA/lake", "path": "/lake/modules/agg_sram_shared_addr_gen.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: meshack-mbuvi/ride-my-way-api path: /tests/testEditRides.py import json import unittest from baseSetUp import Base class EditRides(Base): def setUp(self): super().setUp() self.app.post('/api/v1/users/rides', data=json.dumps(self.ride), ...
code_fim
hard
{ "lang": "python", "repo": "meshack-mbuvi/ride-my-way-api", "path": "/tests/testEditRides.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_can_edit_non_existing_ride_offer(self): """test that user cannot change details of a non-existing offer""" response = self.app.put('/api/v1/users/rides/-1', data=json.dumps(self.ride), content_type='application/json', ...
code_fim
hard
{ "lang": "python", "repo": "meshack-mbuvi/ride-my-way-api", "path": "/tests/testEditRides.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """View a dataframe of up to [count] most recent submissions. This is a convenience method for use within the annotation flow. For full access to the underlying annotations, connect to the table directly using the BigQuery client of your choice. Args: count: The number of the most ...
code_fim
hard
{ "lang": "python", "repo": "broadinstitute/ml4h", "path": "/ml4h/visualization_tools/annotation_storage.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }