text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def __call__(self, x, l=1.0): grad_name = "FlipGradient%d" % self.num_calls @ops.RegisterGradient(grad_name) def _flip_gradients(op, grad): return [tf.negative(grad) * l] g = tf.get_default_graph() with g.gradient_override_map({"Identity": grad_nam...
code_fim
hard
{ "lang": "python", "repo": "sun-peach/x-vector-kaldi-tf", "path": "/local/tf/tf_block.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # noinspection PyArgumentList @app.route('/admin/documents/new', methods=['POST']) @required_permission(Permission.create_document) def document_new(): """ Create a new document from form data. Takes the type into consideration, if type is not one of {'book', 'av', 'article'} (yeah, it is...
code_fim
hard
{ "lang": "python", "repo": "ionagamed/hexagonal", "path": "/hexagonal/ui/admin/documents.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ionagamed/hexagonal path: /hexagonal/ui/admin/documents.py from hexagonal import app, db, AVMaterial, JournalArticle from flask import render_template, redirect, request, session from hexagonal import Document, Book, DocumentCopy, QueuedRequest from hexagonal.ui.helpers import comma_to_list, load...
code_fim
hard
{ "lang": "python", "repo": "ionagamed/hexagonal", "path": "/hexagonal/ui/admin/documents.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andreRBarata/minecraft-forge path: /rootfs/bin/connector #!/usr/bin/env python """ A simple echo server """ import socket import subprocess import sys, getopt from multiprocessing import Process host = '' port = 5000 backlog = 5 size = 1024 s = socket.socket(socket.AF_INET, socket.SOCK_S...
code_fim
medium
{ "lang": "python", "repo": "andreRBarata/minecraft-forge", "path": "/rootfs/bin/connector", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": if len(sys.argv) <= 2: print 'Invalid arguments\n' sys.exit(2) else: proc = subprocess.Popen( sys.argv[1:], stdin=subprocess.PIPE, stdout=subprocess.PIPE ) main()<|fim_prefix|># repo: andreRBarata/minecraft-forge path: /rootfs/bin/connector #!/usr/bin/env p...
code_fim
hard
{ "lang": "python", "repo": "andreRBarata/minecraft-forge", "path": "/rootfs/bin/connector", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": if len(sys.argv) <= 2: print 'Invalid arguments\n' sys.exit(2) else: proc = subprocess.Popen( sys.argv[1:], stdin=subprocess.PIPE, stdout=subprocess.PIPE ) main()<|fim_prefix|># repo: andreRBarata/minecraft-forge path: /rootfs/bin/connector #!/usr/bin/env ...
code_fim
hard
{ "lang": "python", "repo": "andreRBarata/minecraft-forge", "path": "/rootfs/bin/connector", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: magnuspedro/ams path: /ams/ticket/serializers.py from rest_framework import serializers from .models import Ticket class TicketSerializer(serializers.ModelSerializer): """Serializer a ticket""" class Meta: <|fim_suffix|> """Serializer for only view""" class Meta: model = ...
code_fim
medium
{ "lang": "python", "repo": "magnuspedro/ams", "path": "/ams/ticket/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = Ticket fields = ( 'id', 'code', 'price', 'lot', 'status', 'date', 'delegation', 'event' ) read_only_fields = ('id',)<|fim_prefix|># repo: magnuspedro/ams path: /ams/tick...
code_fim
hard
{ "lang": "python", "repo": "magnuspedro/ams", "path": "/ams/ticket/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: luopeixiang/textclf path: /textclf/models/classifier/base.py import torch.nn as nn from textclf.config import ClassifierConfig <|fim_suffix|> def __init__(self, config: ClassifierConfig): super(Classifier, self).__init__() self.config = config def forward(self, batch):...
code_fim
easy
{ "lang": "python", "repo": "luopeixiang/textclf", "path": "/textclf/models/classifier/base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, batch): raise NotImplementedError<|fim_prefix|># repo: luopeixiang/textclf path: /textclf/models/classifier/base.py import torch.nn as nn from textclf.config import ClassifierConfig class Classifier(nn.Module): <|fim_middle|> def __init__(self, config: ClassifierConfi...
code_fim
medium
{ "lang": "python", "repo": "luopeixiang/textclf", "path": "/textclf/models/classifier/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>z quadrada : "**(1/x)" -> 2**(1/3) = 1.2599210498948732<|fim_prefix|># repo: MateusPeschke/CursoPython path: /Aula04/Formulas_div_pot_raiz.py # divisão normal : "/" -> 5/3 = 1.666 # mostrar o resto : "%" -> 5%3 = 2 # mostrar o resultado (só inteiro) : <|fim_middle|>"//" -> 5//3 = 1 # Potenciação : "**" -...
code_fim
easy
{ "lang": "python", "repo": "MateusPeschke/CursoPython", "path": "/Aula04/Formulas_div_pot_raiz.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MateusPeschke/CursoPython path: /Aula04/Formulas_div_pot_raiz.py # divisão normal : "/" -> 5/3 = 1.666 # mostrar o resto<|fim_suffix|>"//" -> 5//3 = 1 # Potenciação : "**" -> 2**3 = 8 # raiz quadrada : "**(1/x)" -> 2**(1/3) = 1.2599210498948732<|fim_middle|> : "%" -> 5%3 = 2 # mostrar o resultado...
code_fim
easy
{ "lang": "python", "repo": "MateusPeschke/CursoPython", "path": "/Aula04/Formulas_div_pot_raiz.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: return article.find('img')['data-src'] except (TypeError, KeyError): try: return article.find('img')['src'] except (TypeError, KeyError): self.logging.error('photo can not be found') @staticmethod def get_cor...
code_fim
hard
{ "lang": "python", "repo": "TomasJani/news-scraper", "path": "/news_scraper/scrapers/sme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> text = article_content.find('article') for script in text.find_all('script'): script.decompose() for ad in text.find_all(class_='artemis-promo-labels'): ad.decompose() text.find(class_='share-box').decompose() return text.get_text().strip() ...
code_fim
hard
{ "lang": "python", "repo": "TomasJani/news-scraper", "path": "/news_scraper/scrapers/sme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TomasJani/news-scraper path: /news_scraper/scrapers/sme.py from typing import Dict from bs4 import Tag from news_scraper import scraper_utils, SCRAPER_DIR from news_scraper.atomic_dict import AtomicDict from news_scraper.enums.categories import Category from news_scraper.enums.site import Site ...
code_fim
hard
{ "lang": "python", "repo": "TomasJani/news-scraper", "path": "/news_scraper/scrapers/sme.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># load playback model playbackRobotModel, playbackJointController = roboturdf.loadRobotModel('playback robot model', view, color=roboturdf.getRobotOrangeColor(), visible=False) # initialize the playback panel planPlayback = planplayback.PlanPlayback() manipPlanner = robotplanlistener.ManipulationPlanDri...
code_fim
hard
{ "lang": "python", "repo": "DAIRLab/director", "path": "/src/python/tests/testDrawRobotLog.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># show widgets with a grid layout w = QtGui.QWidget() l = QtGui.QGridLayout(w) l.addWidget(view, 0, 0) l.addWidget(cameraView.view, 0, 1) l.addWidget(playbackPanel.widget, 1, 0, 1, 2) # row, column, row span, column span l.setContentsMargins(0, 0, 0, 0) w.resize(1024, 600) w.show() # add lcm logplayer ke...
code_fim
hard
{ "lang": "python", "repo": "DAIRLab/director", "path": "/src/python/tests/testDrawRobotLog.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: DAIRLab/director path: /src/python/tests/testDrawRobotLog.py from director.consoleapp import ConsoleApp from director import roboturdf from director import jointcontrol from director import planplayback from director import playbackpanel from director import robotplanlistener from director import...
code_fim
hard
{ "lang": "python", "repo": "DAIRLab/director", "path": "/src/python/tests/testDrawRobotLog.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: w84death/piot path: /malinowy/test.py from blessed import Terminal t = Terminal() print("press 'q' to quit.") with t.cbreak(): val = None while val not in (u'q', u'Q',): val = t.inkey(timeout=5) if not val: # timeout <|fim_suffix|>mat((str(val), val.nam...
code_fim
medium
{ "lang": "python", "repo": "w84death/piot", "path": "/malinowy/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("It sure is quiet in here ...") elif val.is_sequence: print("got sequence: {}.".format((str(val), val.name, val.code))) elif val: print("got {}.".format(val)) print('bye!')<|fim_prefix|># repo: w84death/piot path: /malinowy/test.py from blessed import T...
code_fim
medium
{ "lang": "python", "repo": "w84death/piot", "path": "/malinowy/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("url_file", type=pathlib.Path) args = parser.parse_args() main(args.url_file)<|fim_prefix|># repo: SoftwareSystemsLaboratory/PTMTorrent path: /ptm_torrent/huggingface/downloadRepos.py from typing import Li...
code_fim
hard
{ "lang": "python", "repo": "SoftwareSystemsLaboratory/PTMTorrent", "path": "/ptm_torrent/huggingface/downloadRepos.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> parser = argparse.ArgumentParser() parser.add_argument("url_file", type=pathlib.Path) args = parser.parse_args() main(args.url_file)<|fim_prefix|># repo: SoftwareSystemsLaboratory/PTMTorrent path: /ptm_torrent/huggingface/downloadRepos.py from typing import List import argparse import pa...
code_fim
hard
{ "lang": "python", "repo": "SoftwareSystemsLaboratory/PTMTorrent", "path": "/ptm_torrent/huggingface/downloadRepos.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: SoftwareSystemsLaboratory/PTMTorrent path: /ptm_torrent/huggingface/downloadRepos.py from typing import List import argparse import pathlib from progress.bar import Bar from progress.spinner import Spinner import ptm_torrent.huggingface as hf from ptm_torrent.utils.fileSystem import readJSON, t...
code_fim
hard
{ "lang": "python", "repo": "SoftwareSystemsLaboratory/PTMTorrent", "path": "/ptm_torrent/huggingface/downloadRepos.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_curses.py from xai.brain.wordbase.verbs._curse import _CURSE <|fim_suffix|> def __init__(self,): _CURSE.__init__(self) self.name = "CURSES" self.specie = 'verbs' self.basic = "curse" self.jsondata = {}<|fim_middle|>#calss header class _C...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_curses.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _CURSE.__init__(self) self.name = "CURSES" self.specie = 'verbs' self.basic = "curse" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_curses.py from xai.brain.wordbase.verbs._curse import _CURSE <|fim_middle|>#calss header class _CURSES(_CURSE, ): def _...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_curses.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MooWantFree/NwuDailyUp path: /instal.py import configparser import sqlite3 def init_config(): # 创建初始化配置文件 config = configparser.ConfigParser() config['DEFAULT'] = {'Post_login': 'True', 'Wechat_login': 'True', } config['Notice_id'] ...
code_fim
hard
{ "lang": "python", "repo": "MooWantFree/NwuDailyUp", "path": "/instal.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def init_sql(): # 创建初始化数据库 conn = sqlite3.connect('user.db') c = conn.cursor() c.execute('''CREATE TABLE userinfo (Stuid TEXT PRIMARY KEY NOT NULL, password TEXT NOT NULL, cookies TEXT NOT NULL, location TEXT, Status text);'''...
code_fim
hard
{ "lang": "python", "repo": "MooWantFree/NwuDailyUp", "path": "/instal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shane-kercheval/oo-learning path: /tests/MockClassificationModelWrapper.py from typing import Union import numpy as np import pandas as pd from oolearning.model_wrappers.HyperParamsBase import HyperParamsBase from oolearning.model_wrappers.ModelWrapperBase import ModelWrapperBase class MockRe...
code_fim
hard
{ "lang": "python", "repo": "shane-kercheval/oo-learning", "path": "/tests/MockClassificationModelWrapper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # get length of data, return random np.random.seed(123) # generate random `0` through `(len-1)` following the distribution found in data_y, # generate n=len(data_x) predictions random_predictions = np.random.choice(a=model_object._unique_targets, ...
code_fim
hard
{ "lang": "python", "repo": "shane-kercheval/oo-learning", "path": "/tests/MockClassificationModelWrapper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SoloLa-Platform/MusicXML-Synthesizer path: /tests/test_unit_Synthesizer.py import pytest from MusicXMLSynthesizer.utils import parse_notes_meta_to_list from MusicXMLSynthesizer.Synthesizer import Synthesizer from utility.testHelper import create_synthesizer import numpy as np from lxml import etr...
code_fim
hard
{ "lang": "python", "repo": "SoloLa-Platform/MusicXML-Synthesizer", "path": "/tests/test_unit_Synthesizer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_Synthesize_add_technique_prebend(): NOTE_El = ET.Element('note') TECHNIQUE = [2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] synthesizer = create_synthesizer('input_mock/bend/') synthesizer.add_technique(NOTE_El, TECHNIQUE) assert ET.tostring(NOTE_El,encoding="unicode") =...
code_fim
hard
{ "lang": "python", "repo": "SoloLa-Platform/MusicXML-Synthesizer", "path": "/tests/test_unit_Synthesizer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> NOTE_El = ET.Element('note') TECHNIQUE = [0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0] synthesizer = create_synthesizer('input_mock/bend/') synthesizer.add_technique(NOTE_El, TECHNIQUE) assert ET.tostring(NOTE_El,encoding="unicode") == '<note><notations><technical><slide typ...
code_fim
hard
{ "lang": "python", "repo": "SoloLa-Platform/MusicXML-Synthesizer", "path": "/tests/test_unit_Synthesizer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> js = r.json() iterate_streams = js['streams'] update_streams(iterate_streams, streams, game_name) def get_streams(games): base_url = 'https://api.twitch.tv/kraken/' stream_url = base_url + 'streams' streams = [] # get the games for game in games: get_...
code_fim
hard
{ "lang": "python", "repo": "Nytrox/MUTTwitchBot", "path": "/twitch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nytrox/MUTTwitchBot path: /twitch.py import requests import json from stream import Stream def update_streams(streams, result, game): # update the stream list for stream in streams: # the stream has 1 or more viewers channel = stream['channel'] if stream[...
code_fim
hard
{ "lang": "python", "repo": "Nytrox/MUTTwitchBot", "path": "/twitch.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_streams(games): base_url = 'https://api.twitch.tv/kraken/' stream_url = base_url + 'streams' streams = [] # get the games for game in games: get_game(stream_url, streams, game) return streams<|fim_prefix|># repo: Nytrox/MUTTwitchBot path: /twitch.py impo...
code_fim
hard
{ "lang": "python", "repo": "Nytrox/MUTTwitchBot", "path": "/twitch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> except Exception as e: print('Error converting file', filename) raise def directory_walker(start_dir): """ Walk a directory and generate list of valid images """ for root, dirs, files in os.walk(os.path.expanduser(start_dir)): for f in files: filename = o...
code_fim
hard
{ "lang": "python", "repo": "phiratio/learn_python", "path": "/books/software-architecture-with-python/Chapter05-scalability-performance/16-concurrent_thumbnail.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> basename = os.path.basename(filename) thumb_filename = os.path.join('thumbs', f'{basename.rsplit(".")[0]}_thumb.png') im.save(thumb_filename) print('Saved', thumb_filename) return True except Exception as e: print('Error converting file', filename) ...
code_fim
hard
{ "lang": "python", "repo": "phiratio/learn_python", "path": "/books/software-architecture-with-python/Chapter05-scalability-performance/16-concurrent_thumbnail.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: phiratio/learn_python path: /books/software-architecture-with-python/Chapter05-scalability-performance/16-concurrent_thumbnail.py # Code Listing #16 """ Processing of pictures into thumbnails using concurrent futures """ # NOTE: This requires presence of a local "thumbs" folder. Otherwise it ...
code_fim
hard
{ "lang": "python", "repo": "phiratio/learn_python", "path": "/books/software-architecture-with-python/Chapter05-scalability-performance/16-concurrent_thumbnail.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> newsFeed = feedparser.parse(data2) list_result.append('Tin mới từ '+ data1) i =1 while i < 6: entry = newsFeed.entries[i] # print (entry.published) clean = re.compile('<.*?>') clean_content= re.sub(clean, '', entry.summary) list_result.ap...
code_fim
medium
{ "lang": "python", "repo": "PTA84/vietbot", "path": "/src/news_skill.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: PTA84/vietbot path: /src/news_skill.py #import news import feedparser import re import os from termcolor import colored import json <|fim_suffix|> newsFeed = feedparser.parse(data2) list_result.append('Tin mới từ '+ data1) i =1 while i < 6: entry = newsFeed....
code_fim
medium
{ "lang": "python", "repo": "PTA84/vietbot", "path": "/src/news_skill.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bkopanichuk/sevsed2 path: /apps/contracts/models/contract_constants.py CHARGING_DATE = 20 CONTRACT_STATUS_FUTURE = 'future' ##'Укладається' CONTRACT_STATUS_ACTUAL = 'actual' ##'Дійсний' CONTRACT_STATUS_ARCHIVE = 'archive' ##'Архівний' CONTRACT_STATUS_REJECTED = 'rejected' ##'Не заключений', к...
code_fim
medium
{ "lang": "python", "repo": "bkopanichuk/sevsed2", "path": "/apps/contracts/models/contract_constants.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>TUS_ACTUAL, 'Дійсний'], [CONTRACT_STATUS_ARCHIVE, 'Архівний'], [CONTRACT_STATUS_REJECTED, 'Не заключений'] ]<|fim_prefix|># repo: bkopanichuk/sevsed2 path: /apps/contracts/models/contract_constants.py CHARGING_DATE = 20 CONTRACT_STATUS_FUTURE = 'future' ##'Укладається' CONTRACT_STATUS_ACTUAL = '...
code_fim
medium
{ "lang": "python", "repo": "bkopanichuk/sevsed2", "path": "/apps/contracts/models/contract_constants.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> spc = '' for i in range(0,level): spc += ' ' return spc def dfs(self, level): global unique_id, outhash # case begin spaces = self.get_spaces(level) VHDL(spaces + 'case OP' + str(level) + ' is') for i in range (0,256): opcode = str(i) if opcode in s...
code_fim
hard
{ "lang": "python", "repo": "luizesramos/project-utils", "path": "/decoder-py/decoder0.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>elif argc == 2: fname = sys.argv[1] elif argc == 3: if sys.argv[1] == '-simple': COMPLEX = False; fname = sys.argv[2] elif sys.argv[2] == '-simple': COMPLEX = False; fname = sys.argv[1] else: die() if not os.path.isfile(fname): print 'Error: ' + fname + ' is not a valid f...
code_fim
hard
{ "lang": "python", "repo": "luizesramos/project-utils", "path": "/decoder-py/decoder0.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: luizesramos/project-utils path: /decoder-py/decoder0.py #!/usr/bin/python import csv; import sys; import os; import random; ####################################### # global variables # by default, we output a complex decoder of the ISA COMPLEX = True # reserved decoder output encodings INVALID...
code_fim
hard
{ "lang": "python", "repo": "luizesramos/project-utils", "path": "/decoder-py/decoder0.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>graph['fin'] = {} infinity = float('inf') costs = {} costs['a'] = 6 costs['b'] = 2 costs['fin'] = infinity parents = {} parents['a'] = 'start' parents['b'] = 'start' parents['fin'] = None processed= [] def find_lowest_cost_node(costs): lowest_cost = float('inf') lowest_cost_node = None fo...
code_fim
hard
{ "lang": "python", "repo": "vcody/grokking-algorithms", "path": "/dijkstra.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vcody/grokking-algorithms path: /dijkstra.py ''' Dijkstra's Algorithm steps: 1. Find "cheapest" node 2. Check if neighbors are cheaper. If yes, update 3. Repeat for every node 4. Calculate final path - Works with "directed acylic graphs" - Does not work with negative-weight edges ...
code_fim
hard
{ "lang": "python", "repo": "vcody/grokking-algorithms", "path": "/dijkstra.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> backup_path = path + "." + ext if not os.path.isfile(path): raise IOError("No file at: '%s'" % path) if os.path.exists(backup_path) and not overwrite: return shutil.copyfile(path, backup_path) def SetPairingData(local_port, remote_addr, remote_port, mjcroot=None): inip...
code_fim
hard
{ "lang": "python", "repo": "dz111/mjc-broker", "path": "/client-src/configurator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dz111/mjc-broker path: /client-src/configurator.py #!/usr/bin/env python ############################################################################### # mjc-broker # # configurator.py ...
code_fim
hard
{ "lang": "python", "repo": "dz111/mjc-broker", "path": "/client-src/configurator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JY00002/ReDet path: /mmdet/ops/roi_align_rotated/gradcheck.py # TODO import random import numpy as np import torch from torch.autograd import gradcheck import os.path as osp import sys sys.path.append(osp.abspath(osp.join(__file__, '../../'))) from roi_align_rotated import RoIAlignRotated # noq...
code_fim
hard
{ "lang": "python", "repo": "JY00002/ReDet", "path": "/mmdet/ops/roi_align_rotated/gradcheck.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> roialign_rotated = RoIAlignRotated(out_size=2, spatial_scale=1, sample_num=0) results = roialign_rotated(data, rois).cpu().numpy() print(results) np.testing.assert_almost_equal(results, expected_feat, decimal=6) def test_roi_align_rotated_autograd(self): # x1 =...
code_fim
hard
{ "lang": "python", "repo": "JY00002/ReDet", "path": "/mmdet/ops/roi_align_rotated/gradcheck.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: codenerix/django-codenerix-products path: /codenerix_products/models.py slug="{}__slug".format(lang), product_meta_title="product__{}__meta_title".format(lang), product_meta_description="product__{}__meta_description".format(lang), product_descriptio...
code_fim
hard
{ "lang": "python", "repo": "codenerix/django-codenerix-products", "path": "/codenerix_products/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return self.__unicode__() def __fields__(self, info): fields = [] fields.append(('product', _("Product"))) fields.append(('feature', _("Feature"))) fields.append(('value', _("Value"))) return fields # valor de las caracteristica...
code_fim
hard
{ "lang": "python", "repo": "codenerix/django-codenerix-products", "path": "/codenerix_products/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Save necesita un check que indique si debe comprobar o no los productos destacados y productos estrella. @transaction.atomic def save(self, *args, **kwards): if self.principal: ProductFinalImage.objects.filter(product_final=self.product_final).exclude(pk=self.pk).update(p...
code_fim
hard
{ "lang": "python", "repo": "codenerix/django-codenerix-products", "path": "/codenerix_products/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SoyGema/Limbic_System path: /PoCs/WatsonToneAnalyzer.py #Watson call and toneanzalizer import json from watson_developer_cloud import ToneAnalyzerV3 <|fim_suffix|>print(json.dumps(tone_analyzer.tone(text='Put the sentence to analyze here'), indent=2))<|fim_middle|> #Generated in BlueMix Platfor...
code_fim
medium
{ "lang": "python", "repo": "SoyGema/Limbic_System", "path": "/PoCs/WatsonToneAnalyzer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(json.dumps(tone_analyzer.tone(text='Put the sentence to analyze here'), indent=2))<|fim_prefix|># repo: SoyGema/Limbic_System path: /PoCs/WatsonToneAnalyzer.py #Watson call and toneanzalizer import json from watson_developer_cloud import ToneAnalyzerV3 <|fim_middle|>#Generated in BlueMix Platfor...
code_fim
medium
{ "lang": "python", "repo": "SoyGema/Limbic_System", "path": "/PoCs/WatsonToneAnalyzer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class getPaymentForm(Method): # an invoice payment form. This method should be called # the user presses inlineKeyboardButtonBuy @chat_id Chat identifier of the # message @message_id Message identifier chat_id = None # type: "int53" message_id = None # type: "int53"<|fim_prefix|...
code_fim
hard
{ "lang": "python", "repo": "Tempah28/python-tdlib", "path": "/py_tdlib/constructors/payment_form.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Tempah28/python-tdlib path: /py_tdlib/constructors/payment_form.py from ..factory import Method, Type class paymentForm(Type): # information about an invoice payment form @invoice Full information # the invoice @url Payment form URL @payments_provider Contains information # the p...
code_fim
hard
{ "lang": "python", "repo": "Tempah28/python-tdlib", "path": "/py_tdlib/constructors/payment_form.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __getitem__(self, key): return self.__load(self.cacheMap[key]) def __setitem__(self, key, value): filename = self.getFilename(key) self.cacheMap[key] = filename self.__dump(value, filename) pkl.dump(self.cacheMap, open('cacheMap.pkl', 'wb')) def __...
code_fim
medium
{ "lang": "python", "repo": "alexsieusahai/webStash", "path": "/webStash/cacher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexsieusahai/webStash path: /webStash/cacher.py import pickle as pkl import os import shutil import hashlib import codecs try: from config import Config except (SystemError, ImportError): from .config import Config try: from exceptions import SerializerImplementationError, CacheMap...
code_fim
hard
{ "lang": "python", "repo": "alexsieusahai/webStash", "path": "/webStash/cacher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def clean(self): self.config.debugPrint('cleaning...') try: shutil.rmtree('webstashcache') except FileNotFoundError: self.config.debugPrint('no webstashcache to remove; doing nothing...') try: os.remove('cacheMap.pkl') except ...
code_fim
hard
{ "lang": "python", "repo": "alexsieusahai/webStash", "path": "/webStash/cacher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get(self, *args, **kwargs): # print(self.__class__.__name__) raise NotImplementedError def put(self, *args, **kwargs): raise NotImplementedError def handle(self, *args, **kwargs): "Call a class-specific method" # print(self.__class__.__name__) ...
code_fim
hard
{ "lang": "python", "repo": "derekmerck/diana_plus", "path": "/packages/diana/diana/utils/pattern.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: derekmerck/diana_plus path: /packages/diana/diana/utils/pattern.py import uuid, logging import attr import inspect from pprint import pprint @attr.s(cmp=False, hash=None) class Pattern(object): uid = attr.ib(factory=uuid.uuid4) logger = attr.ib(init=False) @logger.default def ...
code_fim
hard
{ "lang": "python", "repo": "derekmerck/diana_plus", "path": "/packages/diana/diana/utils/pattern.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chaostoolkit/chaostoolkit-lib path: /tests/test_substitution.py from fixtures import config from chaoslib import substitute from chaoslib.configuration import load_configuration from chaoslib.hypothesis import within_tolerance from chaoslib.provider.http import run_http_activity def test_subst...
code_fim
hard
{ "lang": "python", "repo": "chaostoolkit/chaostoolkit-lib", "path": "/tests/test_substitution.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># see https://github.com/chaostoolkit/chaostoolkit-lib/issues/180 def test_use_integer_as_substitution(): config = load_configuration({"value": 8}) result = substitute("${value}", configuration=config, secrets=None) assert isinstance(result, int) assert result == 8 def test_always_retur...
code_fim
hard
{ "lang": "python", "repo": "chaostoolkit/chaostoolkit-lib", "path": "/tests/test_substitution.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ynny-github/User-Config-Management-Tool path: /src/ucmt/database.py # -*- coding: utf-8 -*- import sys from tinydb import TinyDB, Query from .path_translator import DBFilter class ConfigDB: """設定ファイルの管理情報を記録するための DB Args: json_path (str): db 本体となる json ファイルの path filt...
code_fim
hard
{ "lang": "python", "repo": "ynny-github/User-Config-Management-Tool", "path": "/src/ucmt/database.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_managed_config_list(self): # TODO: できれば型アノテーションをつけたい config_list = (self._filter.apply_outward(x["path"]) for x in self._db.all()) return config_list<|fim_prefix|># repo: ynny-github/User-Config-Management-Tool path: /src/ucmt/database.py # -*- c...
code_fim
hard
{ "lang": "python", "repo": "ynny-github/User-Config-Management-Tool", "path": "/src/ucmt/database.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SchiefLab/G001 path: /src/g001/sequence_pipeline/mutation.py import pandas as pd from g001.data import Data from g001.sequence_pipeline.anarci import run_mutational_analysis from sadie.airr.airrtable import LinkedAirrTable <|fim_suffix|> """ Add mutations_heavy and mutations_light """...
code_fim
medium
{ "lang": "python", "repo": "SchiefLab/G001", "path": "/src/g001/sequence_pipeline/mutation.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Add mutations_heavy and mutations_light """ lat = LinkedAirrTable(working_dataframe, key_column="cellid") lat_with_mutational_analysis = run_mutational_analysis(lat, scheme="kabat") lat_with_mutational_analysis[["cellid", "mutations_heavy", "mutations_light"]] working_dataf...
code_fim
medium
{ "lang": "python", "repo": "SchiefLab/G001", "path": "/src/g001/sequence_pipeline/mutation.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return Dimension3D(self.annotation_2.Dimension3D()) def flag_note(self) -> FlagNote: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)) | o Func FlagNote() As FlagNote | ...
code_fim
hard
{ "lang": "python", "repo": "evereux/pycatia", "path": "/pycatia/tps_interfaces/annotation_2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: evereux/pycatia path: /pycatia/tps_interfaces/annotation_2.py port TYPE_CHECKING from pycatia.system_interfaces.any_object import AnyObject from pycatia.tps_interfaces.datum_simple import DatumSimple from pycatia.tps_interfaces.datum_target import DatumTarget from pycatia.tps_interfaces.default_...
code_fim
hard
{ "lang": "python", "repo": "evereux/pycatia", "path": "/pycatia/tps_interfaces/annotation_2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: evereux/pycatia path: /pycatia/tps_interfaces/annotation_2.py ps_status(self) -> str: """ .. note:: :class: toggle CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357) | o Property TPSStatus() As CATBSTR (Read Only) | ...
code_fim
hard
{ "lang": "python", "repo": "evereux/pycatia", "path": "/pycatia/tps_interfaces/annotation_2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jcchuks/triplet_loss_in_practice path: /extended_model.py import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from opensource.siamesetriplet.utils import pdist from torch.nn.modules.distance import PairwiseDistance from constants import * class EmbeddingNet(nn....
code_fim
hard
{ "lang": "python", "repo": "jcchuks/triplet_loss_in_practice", "path": "/extended_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.pairSelector = pairSelector self.margin = margin self.name = "recog" self.anchors = torch.stack(anchors).cuda() if cuda else torch.stack(anchors).cpu() self.svm = svm self.cuda = cuda def forward(self, embeddings, labels): pp, nn = self.pai...
code_fim
hard
{ "lang": "python", "repo": "jcchuks/triplet_loss_in_practice", "path": "/extended_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("AnotherWithSuper.__init__ called") super(AnotherWithSuper, self).__init__(name, sex) pass class MultipleInheritanceWithSuper(WithSuper, AnotherWithSuper): def __init__(self, name, sex, emp_id): super(MultipleInheritanceWithSuper, self).__init__(name, sex) ...
code_fim
hard
{ "lang": "python", "repo": "makeesyai/makeesy-python", "path": "/python_advance/python_classes/test_multilevel_inheritance.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: makeesyai/makeesy-python path: /python_advance/python_classes/test_multilevel_inheritance.py class PersonalInfo(object): def __init__(self, name, sex): self.name = name self.sex = sex class WithSuper(PersonalInfo): def __init__(self, name, sex): super(WithSuper, ...
code_fim
hard
{ "lang": "python", "repo": "makeesyai/makeesy-python", "path": "/python_advance/python_classes/test_multilevel_inheritance.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class MultipleInheritanceWithSuper(WithSuper, AnotherWithSuper): def __init__(self, name, sex, emp_id): super(MultipleInheritanceWithSuper, self).__init__(name, sex) self.emp_id = emp_id class MultipleInheritanceWithoutSuper(WithoutSuper, AnotherWithSuper): def __init__(self, nam...
code_fim
medium
{ "lang": "python", "repo": "makeesyai/makeesy-python", "path": "/python_advance/python_classes/test_multilevel_inheritance.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> std_per_day = mobility_time_gen.activity( n=.5, per=pd.Timedelta("1day")) gaussian_activity = NumpyRandomGenerator( method="normal", loc=five_per_day, scale=std_per_day, seed=1) mobility_activity_gen = gaussian_activity.map(bound_value(lb=1)) ...
code_fim
hard
{ "lang": "python", "repo": "nsutcliffe/trumania", "path": "/tests/unit_tests/test_activity.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nsutcliffe/trumania path: /tests/unit_tests/test_activity.py import path import pandas as pd import logging import os from trumania.core.util_functions import setup_logging, load_all_logs from trumania.core.clock import CyclicTimerProfile, CyclicTimerGenerator from trumania.core.random_generator...
code_fim
hard
{ "lang": "python", "repo": "nsutcliffe/trumania", "path": "/tests/unit_tests/test_activity.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> This is a low activity test, where the populations have less than one activity per cycle """ with path.tempdir() as log_parent_folder: log_folder = os.path.join(log_parent_folder, "logs") run_test_scenario_1(clock_step="1 h", simulation_durati...
code_fim
hard
{ "lang": "python", "repo": "nsutcliffe/trumania", "path": "/tests/unit_tests/test_activity.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.assertAlmostEqual(self.auto1.get_connection_probability(automata.Connection('A', 'B')), 2/3) self.assertAlmostEqual(self.auto1.get_connection_probability(automata.Connection('A', 'C')), 1/3) self.assertAlmostEqual(self.auto1.get_connection_probability(automata.Connection('C', ...
code_fim
hard
{ "lang": "python", "repo": "iFocusing/StreamingEventCompliance", "path": "/test/automata_test.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: iFocusing/StreamingEventCompliance path: /test/automata_test.py import unittest from streaming_event_compliance.objects.automata import automata class AutomataTest(unittest.TestCase): def setUp(self): self.auto1 = automata.Automata() self.auto2 = automata.Automata() ...
code_fim
hard
{ "lang": "python", "repo": "iFocusing/StreamingEventCompliance", "path": "/test/automata_test.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_contains_source_node(self): self.assertEqual(self.auto1.contains_source_node('C'), True) self.assertEqual(self.auto1.contains_source_node('A'), True) self.assertEqual(self.auto1.contains_source_node('B'), False) self.assertEqual(self.auto1.contains_source_node(...
code_fim
hard
{ "lang": "python", "repo": "iFocusing/StreamingEventCompliance", "path": "/test/automata_test.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class Ing(_Network): _icon = "ing.png" class Netpol(_Network): _icon = "netpol.png" class SVC(_Network): _icon = "svc.png" # Aliases Endpoint = Ep Ingress = Ing NetworkPolicy = Netpol Service = SVC<|fim_prefix|># repo: mingrammer/diagrams path: /diagrams/k8s/network.py # This module is...
code_fim
easy
{ "lang": "python", "repo": "mingrammer/diagrams", "path": "/diagrams/k8s/network.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mingrammer/diagrams path: /diagrams/k8s/network.py # This module is automatically generated by autogen.sh. DO NOT EDIT. from . import _K8S class _Network(_K8S): _type = "network" _icon_dir = "resources/k8s/network" <|fim_suffix|> _icon = "svc.png" # Aliases Endpoint = Ep Ingres...
code_fim
medium
{ "lang": "python", "repo": "mingrammer/diagrams", "path": "/diagrams/k8s/network.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Aliases Endpoint = Ep Ingress = Ing NetworkPolicy = Netpol Service = SVC<|fim_prefix|># repo: mingrammer/diagrams path: /diagrams/k8s/network.py # This module is automatically generated by autogen.sh. DO NOT EDIT. from . import _K8S class _Network(_K8S): _type = "network" _icon_dir = "reso...
code_fim
easy
{ "lang": "python", "repo": "mingrammer/diagrams", "path": "/diagrams/k8s/network.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Vinhui007/mini-shop-server path: /app/api/v1/category.py # _*_ coding: utf-8 _*_ """ Created by Alimazing on 2018/6/17. """ from app.libs.error_code import Success from app.libs.redprint import RedPrint from app.models.category import Category <|fim_suffix|>@api.route('/all', methods=['GET']) ...
code_fim
medium
{ "lang": "python", "repo": "Vinhui007/mini-shop-server", "path": "/app/api/v1/category.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @api.route('/all', methods=['GET']) @api.doc() def get_all_categories(): '''获取所有产品的分类''' categories = Category.get_all_categories() return Success(categories)<|fim_prefix|># repo: Vinhui007/mini-shop-server path: /app/api/v1/category.py # _*_ coding: utf-8 _*_ """ Created by Alimazing on 2018/6/17....
code_fim
medium
{ "lang": "python", "repo": "Vinhui007/mini-shop-server", "path": "/app/api/v1/category.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ealexisaraujo/cryptongo-mongo path: /cryptongo/api/main.py import pymongo from flask import Flask, jsonify, request def get_db_connection(uri): client = pymongo.MongoClient(uri) return client.cryptongo app = Flask(__name__) db_connection = get_db_connection('mongodb://mongo-crypto:270...
code_fim
hard
{ "lang": "python", "repo": "ealexisaraujo/cryptongo-mongo", "path": "/cryptongo/api/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> params = {} # Defino un diccionario de datos # Obtengo el campo "name", recibido por get. Si no existe, devuelve vacío name = request.args.get('name', '') if name: # Si existe "name" params.update({'name': name}) # Lo agrego al diccionario de datos else: return Fals...
code_fim
hard
{ "lang": "python", "repo": "ealexisaraujo/cryptongo-mongo", "path": "/cryptongo/api/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if request.method == "GET": # Si el método consultado por la ruta, es GET # Devuelve un json con el resultado de tickers, según parámetros por get (Puede ser sin parámetros) return jsonify(get_documents()) elif request.method == "DELETE": # En cambio, si el método consultado es p...
code_fim
hard
{ "lang": "python", "repo": "ealexisaraujo/cryptongo-mongo", "path": "/cryptongo/api/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> form = MenuItemForm mptt_level_indent = 0 fields = ['parent', 'title', 'flatpage', 'machine_name', 'has_custom_link', 'custom_link', ] list_display = ('indented_title', 'machine_name', 'parent', 'weight') list_editable = ['parent', 'weight'] def indented_title(self, obj): ...
code_fim
hard
{ "lang": "python", "repo": "savoirfairelinux/django-flatpages-i18n", "path": "/flatpages_i18n/admin.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> fields = ['parent', 'title', 'flatpage', 'machine_name', 'has_custom_link', 'custom_link', ] list_display = ('indented_title', 'machine_name', 'parent', 'weight') list_editable = ['parent', 'weight'] def indented_title(self, obj): level = getattr(obj, obj._mptt_meta.level_attr) ...
code_fim
hard
{ "lang": "python", "repo": "savoirfairelinux/django-flatpages-i18n", "path": "/flatpages_i18n/admin.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: savoirfairelinux/django-flatpages-i18n path: /flatpages_i18n/admin.py from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from modeltranslation.admin import TranslationAdmin from mptt.admin import MPTTModelAdmin from forms import FlatpageForm, MenuItemForm f...
code_fim
hard
{ "lang": "python", "repo": "savoirfairelinux/django-flatpages-i18n", "path": "/flatpages_i18n/admin.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if len(found_cmds) == 0: raise RuntimeError("Could not find command for {}".format(bin_name)) found_cmd = found_cmds[0] if len(found_cmds) > 1: print("WARNING: found multiple candidates for {}, taking {}".format(bin_name, found_cmd)) return found_cmd<|fim_prefix|># repo: ...
code_fim
medium
{ "lang": "python", "repo": "jchesterpivotal/Faasm", "path": "/tasks/util/shell.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jchesterpivotal/Faasm path: /tasks/util/shell.py import shutil from os.path import join, exists def find_command(bin_name, dirs): # First check on the path found_cmd = shutil.which(bin_name) if found_cmd: return found_cmd # If not found on the path, check in provided di...
code_fim
medium
{ "lang": "python", "repo": "jchesterpivotal/Faasm", "path": "/tasks/util/shell.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _setScript(self): self._command.append(self._namespace['script']) def _logCommand(self): logging.debug('command: %s', self._command) def setCommand(self): self._setRepl() self._setOptions() self._setScript() self._logCommand() def getC...
code_fim
hard
{ "lang": "python", "repo": "kuwolf/atom-python-run", "path": "/cp/cp/parse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kuwolf/atom-python-run path: /cp/cp/parse.py """parser - handles arbitrary arguments to be executed.""" # # NOTE: 2to3 and 3to2 Compatability # importing should consider 2to3 and 3to2 implications. # # https://stackoverflow.com/questions/85451/python-time-clock-vs-time-time-accuracy#85533 # https...
code_fim
hard
{ "lang": "python", "repo": "kuwolf/atom-python-run", "path": "/cp/cp/parse.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># add cannes path to python path # `export PYTHONPATH=$PATHONPATH:~/WorkSpace/shawn/robben` sys.path.append(os.getcwd()) if __name__ == '__main__': # train # trainer1.train_through_cnn() # test # text, image = data_generator.gen_captcha_text_and_image() # image = image_util.convert2g...
code_fim
medium
{ "lang": "python", "repo": "SethWen/robben", "path": "/app.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SethWen/robben path: /app.py """ author: Shawn time : 11/8/18 7:11 PM desc : update: Shawn 11/8/18 7:11 PM """ <|fim_suffix|># add cannes path to python path # `export PYTHONPATH=$PATHONPATH:~/WorkSpace/shawn/robben` sys.path.append(os.getcwd()) if __name__ == '__main__'...
code_fim
medium
{ "lang": "python", "repo": "SethWen/robben", "path": "/app.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }