text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: retorno/aquitania path: /aquitania/data_source/storage/abstract_storage_system.py ######################################################################################################################## # |||||||||||||||||||||||||||||||||||||||||||||||||| AQUITANIA |||||||||||||||||||||||||||||||...
code_fim
hard
{ "lang": "python", "repo": "retorno/aquitania", "path": "/aquitania/data_source/storage/abstract_storage_system.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nik6198/song-recommender path: /user_class.py import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.metrics.pairwise import pairwise_distances from sklearn.metrics.pairwise import cosine_similarity from sklearn import metrics from scipy.spatial.d...
code_fim
hard
{ "lang": "python", "repo": "Nik6198/song-recommender", "path": "/user_class.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """if(len(user_test)!=0): for j in range(len(user_test)): # if self.prediction[songs_to_ix[user_test.iloc[j,12]]] !=self.mean_ratings[user_no]: # print("ATTENTION ",user_test.iloc[j,8],self.prediction[songs_to_ix[user_test.iloc[j,12]]]) ...
code_fim
hard
{ "lang": "python", "repo": "Nik6198/song-recommender", "path": "/user_class.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def receive(self, message): data = self.format(message) if not data: return title, slug, keyword, text = data dbs.Article.add(title, slug, text, False, keyword) return def format(self, message): if not hasattr(message, 'subject'): ...
code_fim
medium
{ "lang": "python", "repo": "lepture/Vealous", "path": "/vealous/service/mail.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class Page(InboundMailHandler): def receive(self, message): data = self.format(message) if not data: return title, slug, text = data dbs.Page.add(title, slug, text) return def format(self, message): if not hasattr(message, 'subject'): ...
code_fim
hard
{ "lang": "python", "repo": "lepture/Vealous", "path": "/vealous/service/mail.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lepture/Vealous path: /vealous/service/mail.py #-*- coding: utf-8 -*- import logging import urllib2 from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app as run from google.appengine.ext.webapp.mail_handlers import InboundMailHandler <|fim_suffix|>cla...
code_fim
hard
{ "lang": "python", "repo": "lepture/Vealous", "path": "/vealous/service/mail.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(3,3) if __name__ == '__main__': unittest.main()<|fim_prefix|># repo: jucoba/IpCamMonitorSystem path: /poc/test.py import random import unittest class MyTest(unittest.TestCase): <|fim_middle|> def test_shuffle(self): self.assertEqual(1,2) def test_ok(self):
code_fim
medium
{ "lang": "python", "repo": "jucoba/IpCamMonitorSystem", "path": "/poc/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jucoba/IpCamMonitorSystem path: /poc/test.py import random import unittest class MyTest(unittest.TestCase): def test_shuffle(self): <|fim_suffix|> def test_ok(self): self.assertEqual(3,3) if __name__ == '__main__': unittest.main()<|fim_middle|> self.assertEqual(1,2)
code_fim
easy
{ "lang": "python", "repo": "jucoba/IpCamMonitorSystem", "path": "/poc/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_shuffle(self): self.assertEqual(1,2) def test_ok(self): self.assertEqual(3,3) if __name__ == '__main__': unittest.main()<|fim_prefix|># repo: jucoba/IpCamMonitorSystem path: /poc/test.py import random import unittest <|fim_middle|>class MyTest(unittest.TestCase):
code_fim
easy
{ "lang": "python", "repo": "jucoba/IpCamMonitorSystem", "path": "/poc/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FlantasticDan/awscraft path: /AWS Instance/first_run_setup.py import subprocess import data_manager as data # Download Latest Server .jar data.update_server() # Run First Time subprocess.run('java -jar server.jar nogui', shell=True) # Accept Mojang EULA with open('eula.txt', 'r') as eula: ...
code_fim
easy
{ "lang": "python", "repo": "FlantasticDan/awscraft", "path": "/AWS Instance/first_run_setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>text[2] = 'eula=true\n' with open('eula.txt', 'w') as eula: eula.writelines(text)<|fim_prefix|># repo: FlantasticDan/awscraft path: /AWS Instance/first_run_setup.py import subprocess import data_manager as data # Download Latest Server .jar data.update_server() <|fim_middle|># Run First Time subpr...
code_fim
medium
{ "lang": "python", "repo": "FlantasticDan/awscraft", "path": "/AWS Instance/first_run_setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: powderluv/Ultra96-PYNQ path: /Ultra96/specs/Ultra96_v2.spec ARCH_Ultra96 := aarch64 BSP_Ultra96 := sensors96b_v2.<|fim_suffix|>th0 sensorconf STAGE4_PACKAGES_Ultra96 += wilc3000 xrt<|fim_middle|>bsp BITSTREAM_Ultra96 := sensors96b/sensors96b.bit STAGE4_PACKAGES_Ultra96 := pynq mraa upm usbgadget...
code_fim
medium
{ "lang": "python", "repo": "powderluv/Ultra96-PYNQ", "path": "/Ultra96/specs/Ultra96_v2.spec", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>th0 sensorconf STAGE4_PACKAGES_Ultra96 += wilc3000 xrt<|fim_prefix|># repo: powderluv/Ultra96-PYNQ path: /Ultra96/specs/Ultra96_v2.spec ARCH_Ultra96 := aarch64 BSP_Ultra96 := sensors96b_v2.bsp BITSTREAM_Ultra96 := sensors96b/sensors96b.bit ST<|fim_middle|>AGE4_PACKAGES_Ultra96 := pynq mraa upm usbgadget...
code_fim
easy
{ "lang": "python", "repo": "powderluv/Ultra96-PYNQ", "path": "/Ultra96/specs/Ultra96_v2.spec", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if show_graph == True: plt.plot(dab_signal_bins) plt.grid() plt.title("dab block shape") plt.xlabel("sample bin") plt.ylabel("amplitude") plt.show() limit_db = 2.0 dab_block_detected = cali.dabplus.dab.block_check( dab_signal_bins, dab_s...
code_fim
hard
{ "lang": "python", "repo": "jyrj/CalibrateSDR", "path": "/calibratesdr/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sdr.read_bytes_async(callback, BLOCK_SIZE) f.close() def scan_one_dab_channel(dabchannels, channel, sdr, rs, ns, rg, filename, samplerate, show_graph, verbose): cf = dabchannels["dab"][channel]["f_center"] block = dabchannels["dab"][channel]["block"] record_with_rtlsdr(sdr, rs, cf,...
code_fim
hard
{ "lang": "python", "repo": "jyrj/CalibrateSDR", "path": "/calibratesdr/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jyrj/CalibrateSDR path: /calibratesdr/utils.py import numpy as np from scipy.fftpack import fft, fftshift, ifft import matplotlib.pyplot as plt import calibratesdr as cali from rtlsdr.helpers import limit_calls def movingaverage(values, window): weights = np.repeat(1.0, window)/window s...
code_fim
hard
{ "lang": "python", "repo": "jyrj/CalibrateSDR", "path": "/calibratesdr/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mcps-analysts/mcps-genetic-cohort-profile path: /04_rfmix/including_mais_samples/three_way/02.1_prepare-ref-vcfs-jobs.py #!/usr/bin/python -O # Jason Matthew Torres ''' Usage: module load Python/3.7.4-GCCcore-8.3.0 python 02.1_prepare-ref-vcfs-jobs.py ''' # libraries import sys,os import subproce...
code_fim
medium
{ "lang": "python", "repo": "mcps-analysts/mcps-genetic-cohort-profile", "path": "/04_rfmix/including_mais_samples/three_way/02.1_prepare-ref-vcfs-jobs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>##make a vcf file of just the reference individuals %s --vcf %s \ --keep %s \ --recode --out %s bgzip %s ''' % (job_name,log_dir + job_name,log_dir + job_name,str(shmem), vcftools,vcf_dir + vcf_pre + str(chromo) + vcf_post,ref_file,in_dir + "ref.cohort.chr" + str(chromo), in_dir + "ref.c...
code_fim
hard
{ "lang": "python", "repo": "mcps-analysts/mcps-genetic-cohort-profile", "path": "/04_rfmix/including_mais_samples/three_way/02.1_prepare-ref-vcfs-jobs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>m) else: print("it is not an armstrong number:",num)<|fim_prefix|># repo: bgoonz/UsefulResourceRepo2.0 path: /MY_REPOS/my-gists/_CURRENT/36edf2915f/Armstrong number.py num=int(input("enter 1-digit number:")) f=num sum=0 while (f>0): a=f%10 f=int(f/10) sum=sum+(a**3) <|fim_middle|>if(sum==...
code_fim
easy
{ "lang": "python", "repo": "bgoonz/UsefulResourceRepo2.0", "path": "/MY_REPOS/my-gists/_CURRENT/36edf2915f/Armstrong number.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bgoonz/UsefulResourceRepo2.0 path: /MY_REPOS/my-gists/_CURRENT/36edf2915f/Armstrong number.py num=int(input("enter 1-digit number:")) f=num sum=0 whi<|fim_suffix|>if(sum==num): print("it is an armstrong number:",num) else: print("it is not an armstrong number:",num)<|fim_middle|>le (f>0):...
code_fim
easy
{ "lang": "python", "repo": "bgoonz/UsefulResourceRepo2.0", "path": "/MY_REPOS/my-gists/_CURRENT/36edf2915f/Armstrong number.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: microsoftgraph/msgraph-sdk-python path: /msgraph/generated/models/localized_notification_message.py from __future__ import annotations import datetime from dataclasses import dataclass, field from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter from typing import ...
code_fim
medium
{ "lang": "python", "repo": "microsoftgraph/msgraph-sdk-python", "path": "/msgraph/generated/models/localized_notification_message.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ The deserialization information for the current model Returns: Dict[str, Callable[[ParseNode], None]] """ from .entity import Entity from .entity import Entity fields: Dict[str, Callable[[Any], None]] = { "isDefault": lambda n : set...
code_fim
hard
{ "lang": "python", "repo": "microsoftgraph/msgraph-sdk-python", "path": "/msgraph/generated/models/localized_notification_message.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MalikQasimAli/cvd_pupillometry path: /pyplr/silentsub.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' pyplr.silentsub =============== Module to assist with performing silent substitution for STLAB. @author: jtm, ms Here are the cases that we want to have in the silent substitution module...
code_fim
hard
{ "lang": "python", "repo": "MalikQasimAli/cvd_pupillometry", "path": "/pyplr/silentsub.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _illuminance_constraint_function(self, requested_illuminance, weights): vl = get_CIE_1924_photopic_vl(asdf=True, binwidth=self.binwidth) settings = self.weights_to_settings(weights) spd = self.redict_spd(settings) illuminance = spd.dot return requested_illum...
code_fim
hard
{ "lang": "python", "repo": "MalikQasimAli/cvd_pupillometry", "path": "/pyplr/silentsub.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheBeachLab/kokopelli path: /koko/c/asdf.py import ctypes from koko.c.interval import Interval <|fim_suffix|> """ @class ASDF @brief C data structure describing an ASDF. """ pass ASDF._fields_ = [('state', ctypes.c_int), ('X', Interval), ('Y', Interval), ('Z'...
code_fim
easy
{ "lang": "python", "repo": "TheBeachLab/kokopelli", "path": "/koko/c/asdf.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ @class ASDF @brief C data structure describing an ASDF. """ pass ASDF._fields_ = [('state', ctypes.c_int), ('X', Interval), ('Y', Interval), ('Z', Interval), ('branches', ctypes.POINTER(ASDF)*8), ('d', ctypes.c_float*8), ...
code_fim
easy
{ "lang": "python", "repo": "TheBeachLab/kokopelli", "path": "/koko/c/asdf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ panel for testing the BRemsher addon """ bl_idname = TestPanelID bl_category = "Test Panel" bl_label = "Test Panel" bl_space_type = "VIEW_3D" bl_region_type = "UI" def draw(self, context): layout = self.layout row = layout.row() row.operato...
code_fim
medium
{ "lang": "python", "repo": "moshe-kabala/BRemesher", "path": "/ui/test_panel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: moshe-kabala/BRemesher path: /ui/test_panel.py import bpy from .. ops.test_setup_map import TestVertexMapID from .. ops.test_map_on_active import TestMapActiveID <|fim_suffix|> class TestPanel(bpy.types.Panel): """ panel for testing the BRemsher addon """ bl_idname = TestPanelID...
code_fim
medium
{ "lang": "python", "repo": "moshe-kabala/BRemesher", "path": "/ui/test_panel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class TestPanel(bpy.types.Panel): """ panel for testing the BRemsher addon """ bl_idname = TestPanelID bl_category = "Test Panel" bl_label = "Test Panel" bl_space_type = "VIEW_3D" bl_region_type = "UI" def draw(self, context): layout = self.layout row...
code_fim
medium
{ "lang": "python", "repo": "moshe-kabala/BRemesher", "path": "/ui/test_panel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: robertavichm/CMPUT-404-PROJECT-WORK-W21 path: /back-end/SocialDistribution/Author/formatters.py from django.shortcuts import render from django.shortcuts import get_object_or_404 from django.http import HttpResponseBadRequest,HttpResponse from django.http import JsonResponse from rest_framework.d...
code_fim
hard
{ "lang": "python", "repo": "robertavichm/CMPUT-404-PROJECT-WORK-W21", "path": "/back-end/SocialDistribution/Author/formatters.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def comment_formatter(comment): ser = {} comment_ser = CommentSerializer(comment, many=False) ser.update(comment_ser.data) #ser.update(ser_tem.data) ser["id"] = HOST_URL+"author/"+str(comment.post_id.author_id.id)+"/posts/"+str(comment.post_id.post_id)+"/comments/"+str(comme...
code_fim
hard
{ "lang": "python", "repo": "robertavichm/CMPUT-404-PROJECT-WORK-W21", "path": "/back-end/SocialDistribution/Author/formatters.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # ser["author"] = AuthorSerializer(liker).data # if(like.comment_id !=None and like.post_id !=None): # ser["summary"] = liker["displayName"]+ " likes a comment" # ser["object"] = "http://localhost:8000/author/"+str(like.author_id.id)+"/posts/"+str(like.post_id.post...
code_fim
hard
{ "lang": "python", "repo": "robertavichm/CMPUT-404-PROJECT-WORK-W21", "path": "/back-end/SocialDistribution/Author/formatters.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if args.debug: _ncs.set_debug(ncs.TRACE, sys.stdout) with ncs.maapi.Maapi() as m: with ncs.maapi.Session(m, 'admin', 'admin'): with m.start_read_trans() as t: root = ncs.maagic.get_root(t) root.devices.sync_from() version...
code_fim
medium
{ "lang": "python", "repo": "NSO-developer/apply-config-template", "path": "/test/invoke-action.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NSO-developer/apply-config-template path: /test/invoke-action.py import ncs import _ncs import sys import argparse debug = False def test1(t): root = ncs.maagic.get_root(t) at = root.template.apply_config_template args = at.get_input() args.name = 'frobnicator-foo' # Why is...
code_fim
medium
{ "lang": "python", "repo": "NSO-developer/apply-config-template", "path": "/test/invoke-action.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: databand-ai/dbnd path: /plugins/dbnd-redshift/src/dbnd_redshift/sdk/redshift_connection_extractor.py # © Copyright Databand.ai, an IBM Company 2022 import re import attr from psycopg2.extensions import connection DEFAULT_REDSHIFT_SCHEMA = "public" <|fim_suffix|>def get_target_table_and_sch...
code_fim
hard
{ "lang": "python", "repo": "databand-ai/dbnd", "path": "/plugins/dbnd-redshift/src/dbnd_redshift/sdk/redshift_connection_extractor.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> table_and_schema_regex = r"""COPY ["']?((?P<schema>\w+)\.)?(?P<table>\w+)["']?""" match = re.search(table_and_schema_regex, query, flags=re.IGNORECASE) table = match.group("table") schema = match.group("schema") return table, schema def get_connection_parameter(con: connection, param...
code_fim
hard
{ "lang": "python", "repo": "databand-ai/dbnd", "path": "/plugins/dbnd-redshift/src/dbnd_redshift/sdk/redshift_connection_extractor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_target_table_and_schema(con: connection, query): table, schema = _extract_table_and_schema_from_query(query) # Schema can also be extracted from search_path provided as a connection option or # using `SHOW search_path` query. It can contain more than one schema, # hence requires m...
code_fim
hard
{ "lang": "python", "repo": "databand-ai/dbnd", "path": "/plugins/dbnd-redshift/src/dbnd_redshift/sdk/redshift_connection_extractor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bingwen-Hu/hackaway path: /books/masteringPython/cp06/coroutines.py # coroutines # The difference between regular generators and coroutines is that coroutines don't # simply return values to the calling function but can receive values as well. # a basic example def generator(): value = yield...
code_fim
hard
{ "lang": "python", "repo": "Bingwen-Hu/hackaway", "path": "/books/masteringPython/cp06/coroutines.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # bidirectional pipelines @coroutine def replace(search, replace): while True: item = yield print(item.replace(search, replace)) spam_replace = replace('spam', 'bacon') for line in open('lines.txt'): spam_replace.send(line.rstrip()) # Grep sends all matching items to the target ...
code_fim
hard
{ "lang": "python", "repo": "Bingwen-Hu/hackaway", "path": "/books/masteringPython/cp06/coroutines.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/genemark-et/package.py # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import glob im...
code_fim
hard
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/genemark-et/package.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> mkdirp(prefix.bin) mkdirp(prefix.bin.heu_dir) if self.version <= Version("4.38"): source_dir = "gmes_petap" else: source_dir = self.stage.source_path with working_dir(source_dir): install_tree("lib", prefix.lib) files ...
code_fim
hard
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/genemark-et/package.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> __tablename__ = 'nodes' id = Column(Integer, primary_key=True, autoincrement=True) node_id = Column(String(3)) node_name = Column(String(50)) identifier = Column(String(150)) create_time = Column(TIMESTAMP, server_default=text('(now())')) def to_dict(self): user_info =...
code_fim
medium
{ "lang": "python", "repo": "ardihikaru/api-dashboard-5g-dive", "path": "/app/models/node/node_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ardihikaru/api-dashboard-5g-dive path: /app/models/node/node_model.py from app import Base from sqlalchemy import text, Column, Integer, String, TIMESTAMP class NodeModel(Base): <|fim_suffix|> user_info = { 'id': self.id, 'node_id': self.node_id, 'node...
code_fim
hard
{ "lang": "python", "repo": "ardihikaru/api-dashboard-5g-dive", "path": "/app/models/node/node_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_order(self, order): """ Retrieves order info Args: order: string containing the orderId for your order; e.g. 37f550a202aa6a3fe120f420637c894c """ method = self.private_endpoints['get_order']['method'] url = self.base_url + ...
code_fim
hard
{ "lang": "python", "repo": "thomasbeukema/cobinhood_api", "path": "/cobinhood_api/cobinhood.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> payload = { "trading_pair_id": str(pair), "side": str(side), "type": str(ttype), "size": str(size) } if not price == 0: payload['price'] = str(price) method = self.private_endpoints['place_order']['meth...
code_fim
hard
{ "lang": "python", "repo": "thomasbeukema/cobinhood_api", "path": "/cobinhood_api/cobinhood.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thomasbeukema/cobinhood_api path: /cobinhood_api/cobinhood.py ancel_order": { "url": "/v1/trading/orders/{orderId}", "method": "DELETE" }, "order_history": { "url": "/v1/trading/order_history", "method": "GET" }, ...
code_fim
hard
{ "lang": "python", "repo": "thomasbeukema/cobinhood_api", "path": "/cobinhood_api/cobinhood.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Anurag810/frappe path: /frappe/templates/includes/feedback/feedback.py # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE from __future__ import unicode_literals import frappe from frappe.utils import add_to_date, now from frappe import _ @frappe.w...
code_fim
hard
{ "lang": "python", "repo": "Anurag810/frappe", "path": "/frappe/templates/includes/feedback/feedback.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def send_mail(feedback, subject): doc = frappe.get_doc(feedback.reference_doctype, feedback.reference_name) message = ("<p>{0} ({1})</p>".format(feedback.feedback, feedback.rating) + "<p><a href='{0}/app/feedback/{1}' style='font-size: 80%'>{2}</a></p>".format(frappe.utils.get_request_site_address(),...
code_fim
hard
{ "lang": "python", "repo": "Anurag810/frappe", "path": "/frappe/templates/includes/feedback/feedback.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@frappe.whitelist() def update_feedback(reference_doctype, reference_name, rating, feedback): doc = frappe.get_doc(reference_doctype, reference_name) if doc.disable_feedback == 1: return filters = { "owner": frappe.session.user, "reference_doctype": reference_doctype, "reference_name": referen...
code_fim
hard
{ "lang": "python", "repo": "Anurag810/frappe", "path": "/frappe/templates/includes/feedback/feedback.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> feature_vector = context["feature_transformer"].transform_observation_to_feature_vector(data) prediction = context["model"].predict_one(feature_vector) return {"success": True, "prediction": prediction} def predict(msg: dict, context: dict) -> dict: # we can use initialized model from co...
code_fim
hard
{ "lang": "python", "repo": "mlquants/interoper_demo", "path": "/lib/python/predict.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mlquants/interoper_demo path: /lib/python/predict.py import os, sys from struct import unpack, pack import msgpack from feature_transformation import FeatureTransformerInference from prediction_client import RandomForestClient, RandomClient UUID4_SIZE = 16 # setup of FD 3 for input (instead ...
code_fim
hard
{ "lang": "python", "repo": "mlquants/interoper_demo", "path": "/lib/python/predict.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # [START_NAVIGATION] [20 9C 59 08 00 00 00 00 00 00 ] else: sm.setSpeakerID(1202004) sm.sendNext("What? You don't want the potion?")<|fim_prefix|># repo: Bratah123/v203.4 path: /scripts/quest/q21012e.py # Created by MechAviv # Quest ID :: 21012 # Abilities Lost sm.setSpeakerID(1202004) if s...
code_fim
medium
{ "lang": "python", "repo": "Bratah123/v203.4", "path": "/scripts/quest/q21012e.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bratah123/v203.4 path: /scripts/quest/q21012e.py # Created by MechAviv # Quest ID :: 21012 # Abilities Lost sm.setSpeakerID(1202004) if sm.sendAskYesNo("Hm... Your expression tells me that the exercise didn't jog any memories. But don't you worry. They'll come back, eventually. Here, drink this ...
code_fim
medium
{ "lang": "python", "repo": "Bratah123/v203.4", "path": "/scripts/quest/q21012e.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LikeLionSCH/9th_ASSIGNMENT path: /18_정은서/session08/catproject/cat/views.py from django.shortcuts import render, get_object_or_404, redirect from .models import * from django.utils import timezone # Create your views here. def home(request): cats = Cat.objects.all() return render (request,...
code_fim
hard
{ "lang": "python", "repo": "LikeLionSCH/9th_ASSIGNMENT", "path": "/18_정은서/session08/catproject/cat/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def update(request, id): update_cat = Cat.objects.get(id=id) update_cat.title = request.POST['title'] update_cat.author = request.POST['author'] update_cat.body = request.POST['body'] update_cat.save() return redirect('detail', update_cat.id) def delete(request, id): delete_ca...
code_fim
hard
{ "lang": "python", "repo": "LikeLionSCH/9th_ASSIGNMENT", "path": "/18_정은서/session08/catproject/cat/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def create(request): new_cat = Cat() new_cat.title = request.POST['title'] new_cat.author = request.POST['author'] new_cat.image = request.FILES['image'] new_cat.body = request.POST['body'] new_cat.pub_date = timezone.now() new_cat.save() return redirect('home') def edit(r...
code_fim
hard
{ "lang": "python", "repo": "LikeLionSCH/9th_ASSIGNMENT", "path": "/18_정은서/session08/catproject/cat/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ignore_value=0, is_sequence_rst=False, resize2fixedsize=False, ext_func=None, func_container=_process_funcs): """ 为图片处理函数编写的装饰器,抽象了数值循环过程, 通过收集所有处理函数,并统一处理函数的签名来简化调用 :param process_func: 图像处理函数 :param value_range: 传递给处理函数的阈值范围 ...
code_fim
hard
{ "lang": "python", "repo": "hamlet0x62/Bank-Card-OCR", "path": "/prepare/enlarge_dataset_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @wraps(process_func) def wrapper(image, *args, use_ext_func=True, **kws): """ :param image: :param args: :param use_ext_func: 是否使用该处理函数的扩展函数, 用于各增强函数之间的互相调用 :param kws: :return: """ p...
code_fim
hard
{ "lang": "python", "repo": "hamlet0x62/Bank-Card-OCR", "path": "/prepare/enlarge_dataset_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hamlet0x62/Bank-Card-OCR path: /prepare/enlarge_dataset_utils.py # coding: utf-8 import numpy as np from skimage.util import random_noise from skimage import transform, color import math from functools import wraps from settings import CARDNO_IMG_WIDTH, CARDNO_IMG_HEIGHT from itertools i...
code_fim
hard
{ "lang": "python", "repo": "hamlet0x62/Bank-Card-OCR", "path": "/prepare/enlarge_dataset_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> path = Path(path) return path.mkdir(parents=True, exist_ok=True) @export(name='rmdir') def call_rmdir(path, force=False, verbose=False): return shutil.rmtree(path, True, None) @export(name='ls') def call_ls(path, verbose=False): path = Path(path) result = list(path.iterdir()) p...
code_fim
medium
{ "lang": "python", "repo": "davidegazze/pyyawl", "path": "/pyyawl/operators/bashops.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return shutil.rmtree(path, True, None) @export(name='ls') def call_ls(path, verbose=False): path = Path(path) result = list(path.iterdir()) print(result) return result<|fim_prefix|># repo: davidegazze/pyyawl path: /pyyawl/operators/bashops.py __all__ = ['call_echo', 'call_mkdir', 'c...
code_fim
hard
{ "lang": "python", "repo": "davidegazze/pyyawl", "path": "/pyyawl/operators/bashops.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: davidegazze/pyyawl path: /pyyawl/operators/bashops.py __all__ = ['call_echo', 'call_mkdir', 'call_rmdir', 'call_ls'] from pathlib import Path import shutil from ..namedregistry import export from .baseops import subprocess_run @export(name='echo') def call_echo(value, verbose=False): <|fim_suf...
code_fim
medium
{ "lang": "python", "repo": "davidegazze/pyyawl", "path": "/pyyawl/operators/bashops.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jieguangzhou/AIChallenger_SentimentAnalysis path: /hah_classification/models/nn_factory.py import tensorflow as tf from tensorflow.contrib import rnn def init_embedding(vocab_size, embedding_size, embedding_path=None, name='embedding'): embedding = tf.get_variable(name, [vocab_size, embeddi...
code_fim
medium
{ "lang": "python", "repo": "jieguangzhou/AIChallenger_SentimentAnalysis", "path": "/hah_classification/models/nn_factory.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def muti_class_attention(inputs, class_num, concat_inputs=None): attention = tf.nn.softmax(tf.layers.conv1d(inputs, class_num, 1, padding='same', activation=tf.nn.relu), axis=2) inputs_reshape = tf.transpose(inputs, [0, 2, 1]) attention_out = tf.matmul(inputs_reshape, attention) outputs = ...
code_fim
hard
{ "lang": "python", "repo": "jieguangzhou/AIChallenger_SentimentAnalysis", "path": "/hah_classification/models/nn_factory.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parms = { "source_columns": ["duration"], "destination_columns": ["new_duration"], "map_list": [[0.5083, 0.6], [0.5084, 0.7]], "ignore_missing": True } op = RemapColumnsOp(parms) df, df_test = ...
code_fim
hard
{ "lang": "python", "repo": "hed-standard/hed-python", "path": "/tests/tools/remodeling/operations/test_remap_columns_op.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parms2 = json.loads(self.json_parms) parms2["destination_columns"] = [] with self.assertRaises(ValueError) as context2: RemapColumnsOp(parms2) self.assertEqual(context2.exception.args[0], "EmptyDestinationColumns") parms3 = json.loads(self.json_pa...
code_fim
hard
{ "lang": "python", "repo": "hed-standard/hed-python", "path": "/tests/tools/remodeling/operations/test_remap_columns_op.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hed-standard/hed-python path: /tests/tools/remodeling/operations/test_remap_columns_op.py import json import pandas as pd import unittest from hed.tools.remodeling.dispatcher import Dispatcher from hed.tools.remodeling.operations.remap_columns_op import RemapColumnsOp class Test(unittest...
code_fim
hard
{ "lang": "python", "repo": "hed-standard/hed-python", "path": "/tests/tools/remodeling/operations/test_remap_columns_op.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mengqhui/mypython path: /taobaoitem.py import time,leveldb from urllib.parse import quote_plus import re,json,sys import itertools,requests from queue import Queue from threading import Thread URL_BASE = 'http://s.m.taobao.com/search?q={}&n=200&m=api4h5&style=list&page={}' def url_get(...
code_fim
hard
{ "lang": "python", "repo": "mengqhui/mypython", "path": "/taobaoitem.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> while True: try: for key, value in db_cate.RangeIter(): if value != b'OK': print('CateThread: put {} into queue'.format(key.decode('utf-8'))) cate_queue.put(key.decode('utf-8')) time.sleep(10) except KeyboardInterrupt: break except Exception as e: print('CateThre...
code_fim
hard
{ "lang": "python", "repo": "mengqhui/mypython", "path": "/taobaoitem.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xflows/tf_core path: /tf_core/bow_model_contructor.py from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer, TfidfTransformer from .nltoolkit.helpers import TokenSplitter from tf_core.nltoolkit.helpers import TokenSplitter class BowModelConstructor: def __init__(self...
code_fim
hard
{ "lang": "python", "repo": "xflows/tf_core", "path": "/tf_core/bow_model_contructor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_annotation_texts(self,documents): return [document.get_annotation_texts(selector=self._feature_name, stop_word_feature_name=self._stop_word_feature_name) for document in documents] def get_document_labels(self,adc,binary=False): ...
code_fim
hard
{ "lang": "python", "repo": "xflows/tf_core", "path": "/tf_core/bow_model_contructor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class AwaitableGetRolesResult(GetRolesResult): # pylint: disable=using-constant-test def __await__(self): if False: yield self return GetRolesResult( filter=self.filter, id=self.id, roles=self.roles) def get_roles(filter: Optional[...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-datadog", "path": "/sdk/python/pulumi_datadog/get_roles.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Filter all roles by the given string. """ return pulumi.get(self, "filter") @property @pulumi.getter def id(self) -> str: """ The provider-assigned unique ID for this managed resource. """ return pulumi.get(self, "id") @...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-datadog", "path": "/sdk/python/pulumi_datadog/get_roles.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-datadog path: /sdk/python/pulumi_datadog/get_roles.py # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi im...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-datadog", "path": "/sdk/python/pulumi_datadog/get_roles.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: youdar/usesul_functions path: /source/miscellaneous/get_sub_dir_dates.py #!/usr/bin/env python from __future__ import division import sys import os import re __author__ = 'youval.dar' def get_sub_dir_dates(main_folder): """ Get a list of dates in the format YYYY-MM-DD, for subdirector...
code_fim
hard
{ "lang": "python", "repo": "youdar/usesul_functions", "path": "/source/miscellaneous/get_sub_dir_dates.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns: dates (set): {'YYYY-MM-DD',...} """ # remove leading "hdfs://nameservice1" if main_folder.startswith('hdfs://nameservice1'): main_folder = main_folder[19:] ls_com = 'hdfs dfs -ls ' + main_folder dates =set() # Filter collect folders to delete d = '...
code_fim
hard
{ "lang": "python", "repo": "youdar/usesul_functions", "path": "/source/miscellaneous/get_sub_dir_dates.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': args = sys.argv[1:] if len(args) == 1: get_folder_ls(args[0])<|fim_prefix|># repo: youdar/usesul_functions path: /source/miscellaneous/get_sub_dir_dates.py #!/usr/bin/env python from __future__ import division import sys import os import re __author__ = 'youval...
code_fim
hard
{ "lang": "python", "repo": "youdar/usesul_functions", "path": "/source/miscellaneous/get_sub_dir_dates.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dantesdoesthings/danteswebsite path: /dantes_site/dantes_site/asgi.py """ ASGI config for dantes_site project. """ <|fim_suffix|>if settings.DEBUG: application = ASGIStaticFilesHandler(get_asgi_application()) else: application = get_asgi_application()<|fim_middle|>import os from django....
code_fim
hard
{ "lang": "python", "repo": "dantesdoesthings/danteswebsite", "path": "/dantes_site/dantes_site/asgi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if settings.DEBUG: application = ASGIStaticFilesHandler(get_asgi_application()) else: application = get_asgi_application()<|fim_prefix|># repo: dantesdoesthings/danteswebsite path: /dantes_site/dantes_site/asgi.py """ ASGI config for dantes_site project. """ import os from django.conf import se...
code_fim
medium
{ "lang": "python", "repo": "dantesdoesthings/danteswebsite", "path": "/dantes_site/dantes_site/asgi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: taskforcesh/bullmq path: /python/bullmq/backoffs.py from bullmq.types import BackoffOptions import math class Backoffs: builtin_strategies = { "fixed": lambda delay: lambda attempts_made, type, err, job: delay, "exponential": lambda delay: lambda attempts_made, type, err, ...
code_fim
hard
{ "lang": "python", "repo": "taskforcesh/bullmq", "path": "/python/bullmq/backoffs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> backoff_type = backoff.get("type") if backoff_type in Backoffs.builtin_strategies: Backoffs.builtin_strategies[backoff.type](backoff.delay) elif custom_strategy: return custom_strategy else: raise Exception(f"Unknown backoff strategy {backoff_type}.If a custom backo...
code_fim
hard
{ "lang": "python", "repo": "taskforcesh/bullmq", "path": "/python/bullmq/backoffs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod async def calculate(backoff: BackoffOptions, attempts_made: int, err, job, customStrategy): if backoff: strategy = lookup_strategy(backoff, customStrategy) return strategy(attempts_made, backoff.get("type"), err, job) def lookup_strategy(backoff: Ba...
code_fim
hard
{ "lang": "python", "repo": "taskforcesh/bullmq", "path": "/python/bullmq/backoffs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(image, 'wb') as f: shutil.copyfileobj(r.raw, f) else: print "Invalid distrobution: " + args.distro print "This script should have errored earlier. This is a bug." exit(1) # Do shit here with qemu # should only need kickstart and image at this point<|fim_prefi...
code_fim
hard
{ "lang": "python", "repo": "paholg/openpowercloudimaging", "path": "/cloudprep/cloudprep.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>(image): os.makedirs("images") url = "http://ports.ubuntu.com/ubuntu-ports/dists/trusty-updates/main/installer-ppc64el/current/images/netboot/mini.iso" print "Image not found. Downloading." r = requests.get(url, stream=True) if r.status_code == 200: with...
code_fim
hard
{ "lang": "python", "repo": "paholg/openpowercloudimaging", "path": "/cloudprep/cloudprep.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: paholg/openpowercloudimaging path: /cloudprep/cloudprep.py #!/usr/bin/python2 import os, subprocess, argparse, requests, shutil import kickstarts distrobutions = ["Ubuntu"] parser = argparse.ArgumentParser(description="Setup cloud things") parser.add_argument("distro", type=str, help="Linux dis...
code_fim
hard
{ "lang": "python", "repo": "paholg/openpowercloudimaging", "path": "/cloudprep/cloudprep.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mallik-G/pyspark-stubs path: /third_party/3/pyspark/ml/__init__.pyi # Stubs for pyspark.ml (Python 3.5) # # NOTE: This dynamically typed stub<|fim_suffix|>rk.ml.pipeline import Pipeline as Pipeline, PipelineModel as PipelineModel<|fim_middle|> was automatically generated by stubgen. from pyspark...
code_fim
medium
{ "lang": "python", "repo": "Mallik-G/pyspark-stubs", "path": "/third_party/3/pyspark/ml/__init__.pyi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>mator as Estimator, Model as Model, Transformer as Transformer from pyspark.ml.pipeline import Pipeline as Pipeline, PipelineModel as PipelineModel<|fim_prefix|># repo: Mallik-G/pyspark-stubs path: /third_party/3/pyspark/ml/__init__.pyi # Stubs for pyspark.ml (Python 3.5) # # NOTE: This dynamically typed...
code_fim
medium
{ "lang": "python", "repo": "Mallik-G/pyspark-stubs", "path": "/third_party/3/pyspark/ml/__init__.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SimplyCo/cityproblems path: /cityproblems/urls.py from django.conf.urls import patterns, url, include from django.conf import settings <|fim_suffix|> # media files if settings.DEBUG: from django.conf.urls.static import static urlpatterns += static(settings.MEDIA_URL, document_root=settin...
code_fim
hard
{ "lang": "python", "repo": "SimplyCo/cityproblems", "path": "/cityproblems/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # media files if settings.DEBUG: from django.conf.urls.static import static urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)<|fim_prefix|># repo: SimplyCo/cityproblems path: /cityproblems/urls.py from django.conf.urls import patterns, url, include from django.conf imp...
code_fim
hard
{ "lang": "python", "repo": "SimplyCo/cityproblems", "path": "/cityproblems/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZHENTAN007/Chem-Graph-Kernel-Machine path: /chemml/__init__.py #!/usr/bin/env python # -*- coding: utf-8 -*- fro<|fim_suffix|> 'KernelArgs', 'TrainArgs', 'ActiveLearningArgs' ]<|fim_middle|>m .args import CommonArgs, KernelArgs, TrainArgs, ActiveLearningArgs __all__ = [ 'CommonArgs',
code_fim
medium
{ "lang": "python", "repo": "ZHENTAN007/Chem-Graph-Kernel-Machine", "path": "/chemml/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ActiveLearningArgs __all__ = [ 'CommonArgs', 'KernelArgs', 'TrainArgs', 'ActiveLearningArgs' ]<|fim_prefix|># repo: ZHENTAN007/Chem-Graph-Kernel-Machine path: /chemml/__init__.py #!/usr/bin/env python # -*- coding: utf-8 -*- fro<|fim_middle|>m .args import CommonArgs, KernelArgs, TrainArgs,
code_fim
easy
{ "lang": "python", "repo": "ZHENTAN007/Chem-Graph-Kernel-Machine", "path": "/chemml/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data = '' result = is_unique(data) self.assertEqual(result, True) if __name__ == "__main__": unittest.main()<|fim_prefix|># repo: cedricium/cracking-the-coding-interview path: /python/chapter1/1.1_is_unique/test.py import unittest from is_unique import * class TestIsUnique...
code_fim
hard
{ "lang": "python", "repo": "cedricium/cracking-the-coding-interview", "path": "/python/chapter1/1.1_is_unique/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cedricium/cracking-the-coding-interview path: /python/chapter1/1.1_is_unique/test.py import unittest from is_unique import * class TestIsUnique(unittest.TestCase): def test_truly_unique_str(self): data = 'abcdefg' result = is_unique(data) self.assertEqual(result, Tru...
code_fim
medium
{ "lang": "python", "repo": "cedricium/cracking-the-coding-interview", "path": "/python/chapter1/1.1_is_unique/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lyn1874/region_based_active_learning path: /select_images.py # -*- coding: utf-8 -*- """ Created on Wed Mar 7 16:42:15 2018 This file is for selecting the most uncertain images in each acquisition step based on the updated model @author: s161488 """ import tensorflow as tf from data_utils.prepa...
code_fim
hard
{ "lang": "python", "repo": "lyn1874/region_based_active_learning", "path": "/select_images.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fb_bald_mean_tot = np.squeeze(np.array(fb_bald_mean_tot), axis=1) # ed_bald_mean_tot = np.squeeze(np.array(ed_bald_mean_tot), axis=1) print("Using seletion method", acqu_method) acqu_method_index = 0 for single_acqu_method in a...
code_fim
hard
{ "lang": "python", "repo": "lyn1874/region_based_active_learning", "path": "/select_images.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: securifera/Defcon-Quals-2017-Divided path: /poc.py #!/usr/bin/env python # Author: b0yd # Ex: AppJailLauncher.exe /outbound /key:flag.txt /port:4444 ConsoleApplication2.exe from pwn import * import sys import binascii ##### ##Uncomment the following code to use BugId as the test harness while t...
code_fim
hard
{ "lang": "python", "repo": "securifera/Defcon-Quals-2017-Divided", "path": "/poc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #Move file handle to rcx for next call rax_off = rax_gadg.address & 0xffffffff rax_rop = rax_off + k32_base buf += p64(rax_rop) buf += "D" * 0x28 #Garbage buf += p64(rdx_rop) buf += p64(read_buf_off + base_addr + 0x30) #Ptr to data section buf #Get p...
code_fim
hard
{ "lang": "python", "repo": "securifera/Defcon-Quals-2017-Divided", "path": "/poc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: noironetworks/acc-provision path: /provision/gitversion/gitversion.py from subprocess import Popen, PIPE import os.path as path def call_git_rev_parse(): try: p = Popen(['git', 'rev-parse', 'HEAD'], stdout=PIPE, stderr=PIPE) p.stderr.close() line = "Git commit ID: " + p.stdout.readlines()...
code_fim
hard
{ "lang": "python", "repo": "noironetworks/acc-provision", "path": "/provision/gitversion/gitversion.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Read in the version that's currently in RELEASE-VERSION. release_version = read_release_version() version, version_formatted = call_git_rev_parse() # If that doesn't work, fall back on the value that's in # RELEASE-VERSION. if version is None: version = release_version if version is None: ...
code_fim
hard
{ "lang": "python", "repo": "noironetworks/acc-provision", "path": "/provision/gitversion/gitversion.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tsabelmann/cthulhucmd path: /cthulhu_cmd/cli.py """Module provides CLI class. """ # Import C import cmd from colorama import Fore, Style, init as colorama_init from cthulhu_cmd.utils import * # Import R import re import random # Colorama colorama_init(autoreset=True) class CthulhuCmd(cmd.Cmd...
code_fim
hard
{ "lang": "python", "repo": "tsabelmann/cthulhucmd", "path": "/cthulhu_cmd/cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }