text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> operations = [ migrations.RemoveField(model_name="participant", name="challenge") ]<|fim_prefix|># repo: Cloud-CV/EvalAI path: /apps/participants/migrations/0003_remove_participant_challenge.py # -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-12-02 14:45 from __future__ import...
code_fim
medium
{ "lang": "python", "repo": "Cloud-CV/EvalAI", "path": "/apps/participants/migrations/0003_remove_participant_challenge.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ("participants", "0002_participantteam_participantteammember") ] operations = [ migrations.RemoveField(model_name="participant", name="challenge") ]<|fim_prefix|># repo: Cloud-CV/EvalAI path: /apps/participants/migrations/0003_remove_participant_challeng...
code_fim
easy
{ "lang": "python", "repo": "Cloud-CV/EvalAI", "path": "/apps/participants/migrations/0003_remove_participant_challenge.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cloud-CV/EvalAI path: /apps/participants/migrations/0003_remove_participant_challenge.py # -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-12-02 14:45 from __future__ import unicode_literals <|fim_suffix|> dependencies = [ ("participants", "0002_participantteam_participant...
code_fim
medium
{ "lang": "python", "repo": "Cloud-CV/EvalAI", "path": "/apps/participants/migrations/0003_remove_participant_challenge.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pmkid = input("PMKID: ") essid = input("ESSID: ") mac_ap = input("MAC-AP: ") mac_sta = input("MAC-STA: ") passphrase = input("Passphrase: ") if len(pmkid) > 32: hashcat_format = True # Probably (else, that is an invalid pmkid) else: hashcat_format = False if verify_pmkid(pmkid, essid, mac_ap, ...
code_fim
medium
{ "lang": "python", "repo": "s77rt/pmkid_verifier", "path": "/pmkid_verifier.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: s77rt/pmkid_verifier path: /pmkid_verifier.py import hashlib, binascii, hmac from pbkdf2 import PBKDF2 def verify_pmkid(pmkid, essid, mac_ap, mac_sta, passphrase, hashcat_format=False): # Clean inputs: mac_ap = str(mac_ap).replace(':', '').replace('-', '').lower() mac_sta = str(mac_sta).repla...
code_fim
medium
{ "lang": "python", "repo": "s77rt/pmkid_verifier", "path": "/pmkid_verifier.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dbarsam/python-vsgen path: /vsgen/solution.py # -*- coding: utf-8 -*- """ This module provides the neccessary defintions to generate a Solution File. """ import os import uuid import errno import pkg_resources from vsgen.writer import VSGWritable, VSGJinjaRenderer class VSGSolution(VSGWritabl...
code_fim
hard
{ "lang": "python", "repo": "dbarsam/python-vsgen", "path": "/vsgen/solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param dict datadict: The dictionary containing variables values. """ self.GUID = datadict.get("GUID", uuid.uuid1()) self.FileName = datadict.get("FileName", "") self.Name = datadict.get("Name", "") self.Projects = datadict.get("Projects", []) self.V...
code_fim
hard
{ "lang": "python", "repo": "dbarsam/python-vsgen", "path": "/vsgen/solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _import(self, datadict): """ Internal method to import instance variables data from a dictionary :param dict datadict: The dictionary containing variables values. """ self.GUID = datadict.get("GUID", uuid.uuid1()) self.FileName = datadict.get("FileN...
code_fim
hard
{ "lang": "python", "repo": "dbarsam/python-vsgen", "path": "/vsgen/solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if s < 3: return 0, -1 else: if s not in _Knap: _Knap[s] = max((values[a] + Knap(s - sizes[a])[0], 'Item {}'.format(a + 1), s - sizes[a]) for a in J if sizes[a] <= s) return _Knap[s] print(Knap(20))<|fim_prefix|># repo: roycek7/oper...
code_fim
medium
{ "lang": "python", "repo": "roycek7/operation_research", "path": "/Dynamic Programming/knapsack.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: roycek7/operation_research path: /Dynamic Programming/knapsack.py """ Knapsack Problem We have a container of size 20 units, and want to pack it with the following valuable items: Item j Size vj Value tj 1 7 25 2 4 12 3 3 8 How many of each item should we pack in order to maximize the total value...
code_fim
medium
{ "lang": "python", "repo": "roycek7/operation_research", "path": "/Dynamic Programming/knapsack.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kyleconroy/python-wufoo path: /wufoo/core.py import itertools import logging import os import re import urllib import base64 try: from google.appengine.api import urlfetch from django.utils import simplejson as json APPENGINE = True except: import httplib2 import json APP...
code_fim
hard
{ "lang": "python", "repo": "kyleconroy/python-wufoo", "path": "/wufoo/core.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> logging.debug("%s: %s" % (method, uri)) if xml: headers = {'Content-type': 'application/xml'} body = xml else: headers = {'Content-type': 'application/x-www-form-urlencoded'} body = urlencode(d) if APPENGINE: enco...
code_fim
hard
{ "lang": "python", "repo": "kyleconroy/python-wufoo", "path": "/wufoo/core.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: noonat/deathbeam path: /src/deathbeam/score.py from pyglet import gl from . import defs class Score(object): HUMANS_LOST = 'humans_lost' HUMANS_SAVED = 'humans_saved' POINTS = 'points' VALUES = { HUMANS_LOST: { 'text': 'HUMANS LOST: %d', 'size':...
code_fim
hard
{ "lang": "python", "repo": "noonat/deathbeam", "path": "/src/deathbeam/score.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if name == 'points': text = '+%d' % value if why: text = why + ' ' + text self.game.player.attach_text(text) self.set(name, self.get(name) + value) def get(self, name): if not hasattr(self, name): return 0 ...
code_fim
hard
{ "lang": "python", "repo": "noonat/deathbeam", "path": "/src/deathbeam/score.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZhihangXu/adaptive-f-divergence path: /bnn/load_data.py import math import time import numpy as np import tensorflow as tf import tensorflow.contrib.slim as slim from tensorflow.python.ops import data_flow_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops import array_ops...
code_fim
hard
{ "lang": "python", "repo": "ZhihangXu/adaptive-f-divergence", "path": "/bnn/load_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def load_uci_dataset(dataset, i): # We load the data datapath = base_dir + dataset + '/' data = np.loadtxt(datapath + 'data.txt') index_features = np.loadtxt(datapath + 'index_features.txt').astype('int') index_target = np.loadtxt(datapath + 'index_target.txt').astype('int') X = d...
code_fim
medium
{ "lang": "python", "repo": "ZhihangXu/adaptive-f-divergence", "path": "/bnn/load_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # We load the data datapath = base_dir + dataset + '/' data = np.loadtxt(datapath + 'data.txt') index_features = np.loadtxt(datapath + 'index_features.txt').astype('int') index_target = np.loadtxt(datapath + 'index_target.txt').astype('int') X = data[ : , index_features.tolist() ]...
code_fim
medium
{ "lang": "python", "repo": "ZhihangXu/adaptive-f-divergence", "path": "/bnn/load_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Generates the script to set the hostname in a node """ script = [] script.append(Statements.exec("hostname %s" % node.getName())) script.append(Statements.createOrOverwriteFile( "/etc/hostname", [node.getName()])) script.append(Statements.exec( "sed -i 's/127.0.0.1/...
code_fim
easy
{ "lang": "python", "repo": "esagecloudOS/esage-kahuna-master", "path": "/kahuna/utils/hostname.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: esagecloudOS/esage-kahuna-master path: /kahuna/utils/hostname.py #!/usr/bin/env jython from org.jclouds.scriptbuilder.domain import Statements <|fim_suffix|> """ Generates the script to set the hostname in a node """ script = [] script.append(Statements.exec("hostname %s" % node.get...
code_fim
easy
{ "lang": "python", "repo": "esagecloudOS/esage-kahuna-master", "path": "/kahuna/utils/hostname.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Prepare the image url = 'https://github.com/zhanghang1989/image-data/blob/master/' + \ 'encoding/segmentation/ade20k/ADE_val_00001142.jpg?raw=true' filename = 'example.jpg' # img = encoding.utils.load_image( # encoding.utils.download(url, filename)).unsqueeze(0) img_data, img_h, img_w, size = ...
code_fim
medium
{ "lang": "python", "repo": "A201124253/PyTorch-Encoding", "path": "/experiments/segmentation/demo_crfrnn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Make prediction output = model(torch.from_numpy(img_data)) print("outputshape is") print(output.shape) print(output) print(torch.max(output, 1)[1].shape) predict = torch.max(output, 1)[1].cpu().numpy() + 1 print(predict) # Get color pallete for visualization mask = encoding.utils.get_mask_pallete(predic...
code_fim
hard
{ "lang": "python", "repo": "A201124253/PyTorch-Encoding", "path": "/experiments/segmentation/demo_crfrnn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: A201124253/PyTorch-Encoding path: /experiments/segmentation/demo_crfrnn.py import torch import sys # sys.path.insert(0,'/home/lzj/anaconda3/envs/materialseg/lib/python3.7/site-packages') from crfasrnn.crfasrnn_model import CrfRnnNet import encoding from PIL import Image import torchvision.transfo...
code_fim
hard
{ "lang": "python", "repo": "A201124253/PyTorch-Encoding", "path": "/experiments/segmentation/demo_crfrnn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cfmeyers/chain-breaker path: /chain_breaker/chain_breaker.py # -*- coding: utf-8 -*- from datetime import date, timedelta from collections import namedtuple import csv from prompt_toolkit import prompt, HTML from prompt_toolkit import print_formatted_text as print from prompt_toolkit.styles impo...
code_fim
hard
{ "lang": "python", "repo": "cfmeyers/chain-breaker", "path": "/chain_breaker/chain_breaker.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if d.date.strftime('%A') == 'Thursday': letter = 'Þ' else: letter = d.date.strftime('%A')[0].lower() decorated = f"<bold><white>{letter}</white></bold>" return f"""\ <{d.color}>▆▆▆</{d.color}> <{d.color}>▆{decorated}▆</{d.color}> <{d.color}>▆▆▆</{d.color}>\ """ def make_b...
code_fim
hard
{ "lang": "python", "repo": "cfmeyers/chain-breaker", "path": "/chain_breaker/chain_breaker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for k, v in tagsInfo.items(): if v.countYes >= threshold_newtag * (v.countYes + v.countIncorrect): cursor.execute("INSERT INTO tags_use VALUES ('" + k + "'," + str(v.count) + "," + str(v.countYes) + "," ...
code_fim
hard
{ "lang": "python", "repo": "Keesiu/meta-kaggle", "path": "/data/external/repositories_2to3/136086/kaggle-master/facebook-recruiting-iii/tags_popular_statistics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Keesiu/meta-kaggle path: /data/external/repositories_2to3/136086/kaggle-master/facebook-recruiting-iii/tags_popular_statistics.py import MySQLdb, time from common_functions import * from parameters import * startTime = time.time() ###################################################### ...
code_fim
hard
{ "lang": "python", "repo": "Keesiu/meta-kaggle", "path": "/data/external/repositories_2to3/136086/kaggle-master/facebook-recruiting-iii/tags_popular_statistics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return loader.find_template(path)[0]<|fim_prefix|># repo: scheib/chromium-dashboard path: /customtags/templatetags/include_raw.py from django.template import loader from google.appengine.ext.webapp import template <|fim_middle|>register = template.create_template_register() @register.simple_tag def i...
code_fim
medium
{ "lang": "python", "repo": "scheib/chromium-dashboard", "path": "/customtags/templatetags/include_raw.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: scheib/chromium-dashboard path: /customtags/templatetags/include_raw.py from django.template import loader from google.appengine.ext.webapp import template register = template.create_template_register() <|fim_suffix|> return loader.find_template(path)[0]<|fim_middle|>@register.simple_tag def i...
code_fim
easy
{ "lang": "python", "repo": "scheib/chromium-dashboard", "path": "/customtags/templatetags/include_raw.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ make sure nodes are generated with correct heights in new trees """ successes = 0 failures = 0 iterations = NUM_CALLS for _ in range(iterations): handler = self.new_handler() ret = check_heights(handler.root) if ret: ...
code_fim
hard
{ "lang": "python", "repo": "Plongesam/data-structures-game", "path": "/game_board/avl/test_avl.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Plongesam/data-structures-game path: /game_board/avl/test_avl.py ight(root) return True def check_balance(root): """ Checks if tree is balanced or not Returns true if height balanced Returns false if height imbalanced """ if root is None: # base return True ...
code_fim
hard
{ "lang": "python", "repo": "Plongesam/data-structures-game", "path": "/game_board/avl/test_avl.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> failure_callback = False handler = self.new_handler() new_vals = [randint(1, POINT_CAP) for _ in range(randint(HEIGHT[0], HEIGHT[1]))] for val in new_vals: handler.addNewNode(val, b=False) true_bal = check_balance(handler.root...
code_fim
hard
{ "lang": "python", "repo": "Plongesam/data-structures-game", "path": "/game_board/avl/test_avl.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> all_words = {} for f in glob('faces/*'): fname = os.path.basename(f).replace('.png', '') fwords = fname.split('_') for fword in fwords: try: all_words[fword] += [fname] except Exception: all_words[fword] = [fname] ...
code_fim
easy
{ "lang": "python", "repo": "breyten/hackalod2018", "path": "/faces_words.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: breyten/hackalod2018 path: /faces_words.py #!/usr/bin/env python import sys import os import json from glob import glob <|fim_suffix|> all_words = {} for f in glob('faces/*'): fname = os.path.basename(f).replace('.png', '') fwords = fname.split('_') for fword in ...
code_fim
easy
{ "lang": "python", "repo": "breyten/hackalod2018", "path": "/faces_words.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HenriqueLR/sample-flask-api path: /run.py """Main entrypint of the application.""" # Api factory import from api import factory # Eventually force the environment # factory.environment = 'default' <|fim_suffix|># Get celery instance celery = factory.celery if __name__ == '__main__': # Actu...
code_fim
easy
{ "lang": "python", "repo": "HenriqueLR/sample-flask-api", "path": "/run.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Get celery instance celery = factory.celery if __name__ == '__main__': # Actually run the application app.run()<|fim_prefix|># repo: HenriqueLR/sample-flask-api path: /run.py """Main entrypint of the application.""" # Api factory import from api import factory # Eventually force the environme...
code_fim
easy
{ "lang": "python", "repo": "HenriqueLR/sample-flask-api", "path": "/run.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MHM18/easy-scraping-tutorial path: /source_code/xkn1.py # coding = utf-8 import urllib.request import ssl ssl._create_default_https_context = ssl._create_unverifie<|fim_suffix|>ww.douban.com/') print(response.read().decode('utf-8'))<|fim_middle|>d_context response = urllib.request.urlopen('http...
code_fim
easy
{ "lang": "python", "repo": "MHM18/easy-scraping-tutorial", "path": "/source_code/xkn1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ww.douban.com/') print(response.read().decode('utf-8'))<|fim_prefix|># repo: MHM18/easy-scraping-tutorial path: /source_code/xkn1.py # coding = utf-8 import urllib.request import ssl ssl._create_default_https_context = ssl._create_unverifie<|fim_middle|>d_context response = urllib.request.urlopen('http...
code_fim
easy
{ "lang": "python", "repo": "MHM18/easy-scraping-tutorial", "path": "/source_code/xkn1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>iou import NPMeanIntersectionOverUnion as NPmIoU from simplecv._impl.metric.pixel import NPPixelMertic<|fim_prefix|># repo: Bobholamovic/SimpleCV path: /simplecv/api/metric.py from simplecv._impl.metric.confusion_matrix import ConfusionMatrix from simplecv._impl.metric.miou imp<|fim_middle|>ort THMeanInt...
code_fim
hard
{ "lang": "python", "repo": "Bobholamovic/SimpleCV", "path": "/simplecv/api/metric.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bobholamovic/SimpleCV path: /simplecv/api/metric.py from simplecv._impl.metric.confusion_matrix import ConfusionMatrix from simplecv._impl.metric.miou imp<|fim_suffix|>iou import NPMeanIntersectionOverUnion as NPmIoU from simplecv._impl.metric.pixel import NPPixelMertic<|fim_middle|>ort THMeanInt...
code_fim
hard
{ "lang": "python", "repo": "Bobholamovic/SimpleCV", "path": "/simplecv/api/metric.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: migregal/bmstu-iu7-cg path: /lab_07/main.py import sys from copy import deepcopy from PyQt5 import QtWidgets from PyQt5 import uic from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from funcs import * from simple_cut import simple_cut # Класс главного окна cl...
code_fim
hard
{ "lang": "python", "repo": "migregal/bmstu-iu7-cg", "path": "/lab_07/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> following_line(self, x, y) following_cutter(self, x, y) return QWidget.eventFilter(self, src, event) def keyPressEvent(self, event): key = event.key() if key == Qt.Key_Shift: self.ctrl_pressed = True def keyReleaseEvent(self, event): ...
code_fim
hard
{ "lang": "python", "repo": "migregal/bmstu-iu7-cg", "path": "/lab_07/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def clear(self): self.scene.clear() self.lines.clear() self.cur_line.clear() self.follow_line = None self.cutter = None self.cur_cutter.clear() self.follow_cutter = None self.drawing_cutter = False class MyScene(QtWidgets.QGraphicsSce...
code_fim
hard
{ "lang": "python", "repo": "migregal/bmstu-iu7-cg", "path": "/lab_07/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Args: field_value (list, bool, integer, or string): value for the field returned by PyVCF. E.g. [0.33, 0.66] is a field value for Allele frequency (AF) field. """ if isinstance(field_value, list): return (self._get_field_type(field_value[0]) if field_value e...
code_fim
hard
{ "lang": "python", "repo": "Jessime/gcp-variant-transforms", "path": "/gcp_variant_transforms/transforms/infer_undefined_headers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jessime/gcp-variant-transforms path: /gcp_variant_transforms/transforms/infer_undefined_headers.py # Copyright 2018 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may ob...
code_fim
hard
{ "lang": "python", "repo": "Jessime/gcp-variant-transforms", "path": "/gcp_variant_transforms/transforms/infer_undefined_headers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rlworkgroup/metaworlds path: /tests/metaworlds/envs/mujoco/test_mujoco_env.py import unittest from metaworlds.envs.mujoco.mujoco_env import MujocoEnv class TestMujocoEnv(unittest.TestCase): <|fim_suffix|> # MujocoEnv needs to be subclassed and subclasses specify an XML file # in...
code_fim
easy
{ "lang": "python", "repo": "rlworkgroup/metaworlds", "path": "/tests/metaworlds/envs/mujoco/test_mujoco_env.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_must_subclass(self): # MujocoEnv needs to be subclassed and subclasses specify an XML file # in the class member FILE with self.assertRaises(NotImplementedError): env = MujocoEnv()<|fim_prefix|># repo: rlworkgroup/metaworlds path: /tests/metaworlds/envs/mu...
code_fim
easy
{ "lang": "python", "repo": "rlworkgroup/metaworlds", "path": "/tests/metaworlds/envs/mujoco/test_mujoco_env.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # MujocoEnv needs to be subclassed and subclasses specify an XML file # in the class member FILE with self.assertRaises(NotImplementedError): env = MujocoEnv()<|fim_prefix|># repo: rlworkgroup/metaworlds path: /tests/metaworlds/envs/mujoco/test_mujoco_env.py import uni...
code_fim
medium
{ "lang": "python", "repo": "rlworkgroup/metaworlds", "path": "/tests/metaworlds/envs/mujoco/test_mujoco_env.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: weisisheng/jobs-for-hope path: /backend/scraper_runner.py import sys import traceback import scraperloader import psycopg2 import globals from os.path import basename from config import config from globals import conn, cur # CONSTANTS pdf_message = 'See PDF document.' def connect(): """ C...
code_fim
hard
{ "lang": "python", "repo": "weisisheng/jobs-for-hope", "path": "/backend/scraper_runner.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # close the communication with the PostgreSQL globals.cur.close() except (Exception, psycopg2.DatabaseError) as error: print(error) finally: if globals.conn is not None: globals.conn.close() print('Database connection closed.') pr...
code_fim
hard
{ "lang": "python", "repo": "weisisheng/jobs-for-hope", "path": "/backend/scraper_runner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #globals.drop_tables() # create schema globals.create_tables() # set the active scraper if one is passed in if len(sys.argv) - 1 == 1: globals.active_scrapers = [basename(sys.argv[1])] # load and run scrapers total_jobs = 0 scra...
code_fim
hard
{ "lang": "python", "repo": "weisisheng/jobs-for-hope", "path": "/backend/scraper_runner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jwmannings/property_monitor path: /functions.py import requests as r import configparser import modin.pandas as pd import warnings import numpy as np from ast import literal_eval from datetime import datetime from domainapi import domain warnings.filterwarnings("ignore") <|fim_suffi...
code_fim
medium
{ "lang": "python", "repo": "jwmannings/property_monitor", "path": "/functions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def feature_score(df, feature_df): '''docstring''' df['feature_score'] = np.nan for index, row in df.iterrows(): score_list = [] #print(row['features']) for i in row['features']: #print(i) score = fea...
code_fim
medium
{ "lang": "python", "repo": "jwmannings/property_monitor", "path": "/functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_another(): assert add_numbers(4, 5) == 9 def test_two_n_plus_one(): assert two_n_plus_one(10) == 21<|fim_prefix|># repo: ryanelandt/throwAwayPython path: /myFuns/tests/test_myFuns.py import pytest from myFuns.myFuns import * # content of test_sample.py def inc(x): <|fim_middle|> ...
code_fim
medium
{ "lang": "python", "repo": "ryanelandt/throwAwayPython", "path": "/myFuns/tests/test_myFuns.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return x + 1 def test_answer(): assert inc(4) == 5 def test_another(): assert add_numbers(4, 5) == 9 def test_two_n_plus_one(): assert two_n_plus_one(10) == 21<|fim_prefix|># repo: ryanelandt/throwAwayPython path: /myFuns/tests/test_myFuns.py import pytest from myFuns.myFuns import...
code_fim
easy
{ "lang": "python", "repo": "ryanelandt/throwAwayPython", "path": "/myFuns/tests/test_myFuns.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ryanelandt/throwAwayPython path: /myFuns/tests/test_myFuns.py import pytest from myFuns.myFuns import * <|fim_suffix|> def test_two_n_plus_one(): assert two_n_plus_one(10) == 21<|fim_middle|># content of test_sample.py def inc(x): return x + 1 def test_answer(): assert inc(4) == ...
code_fim
medium
{ "lang": "python", "repo": "ryanelandt/throwAwayPython", "path": "/myFuns/tests/test_myFuns.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZFhuang/DiveIntoDLSketches path: /Networks/ZSSR/ZSSR.py from torch import nn # ZSSR, 无监督超分辨率, 2018 class ZSSR(nn.Module): def __init__(self, in_channel=1, num_layers=8,num_filter=64): <|fim_suffix|> skip=x x=self.input_conv(x) x=self.body(x) x=skip+x ...
code_fim
hard
{ "lang": "python", "repo": "ZFhuang/DiveIntoDLSketches", "path": "/Networks/ZSSR/ZSSR.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # 简单的全卷积残差网络 super(ZSSR, self).__init__() self.input_conv=nn.Conv2d(in_channel,num_filter,3,padding=1) seq=[] for _ in range(num_layers-2): seq.append(nn.Conv2d(num_filter,num_filter,3,padding=1)) seq.append(nn.ReLU(True)) self.body=n...
code_fim
medium
{ "lang": "python", "repo": "ZFhuang/DiveIntoDLSketches", "path": "/Networks/ZSSR/ZSSR.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Monk9636/py-social-force path: /tests/scenarios_pedped.py import numpy as np import pysocialforce as psf OUTPUT_DIR = "images/" def test_crossing(): initial_state = np.array( [[0.0, 0.0, 0.5, 0.5, 10.0, 10.0], [10.0, 0.3, -0.5, 0.5, 0.0, 10.0],] ) s = psf.Simulator(initial_...
code_fim
hard
{ "lang": "python", "repo": "Monk9636/py-social-force", "path": "/tests/scenarios_pedped.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for ped in range(2): x = states[:, ped, 0] y = states[:, ped, 1] ax.plot(x, y, "-o", label="ped {}".format(ped), markersize=2.5) ax.legend() def test_2opposing(): initial_state = np.array( [ [0.0, 0.0, 0.5, 0.0, 0.0, 10.0], ...
code_fim
hard
{ "lang": "python", "repo": "Monk9636/py-social-force", "path": "/tests/scenarios_pedped.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_narrow_crossing(): initial_state = np.array( [[0.0, 0.0, 0.5, 0.5, 2.0, 10.0], [2.0, 0.3, -0.5, 0.5, 0.0, 10.0],] ) s = psf.Simulator(initial_state) states = np.stack([s.step().state.copy() for _ in range(40)]) # visualize print("") with psf.show.canvas(OUTPU...
code_fim
hard
{ "lang": "python", "repo": "Monk9636/py-social-force", "path": "/tests/scenarios_pedped.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhengl7/purity_fb_python_client path: /test/utils.py DEBUG = False def print_list(items): if items: print('[') for item in items: print(item) print(']') def check_is_list_of(data, the_type): <|fim_suffix|> print ('Filter: {}...\n'.format(filter_str)) ...
code_fim
hard
{ "lang": "python", "repo": "zhengl7/purity_fb_python_client", "path": "/test/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def list_by_limit(fun, limit_key, the_type): print ('\nLIMIT is {}'.format(limit_key)) res = fun(limit=limit_key, _return_http_data_only="False") if DEBUG: print_list(res.items) check_is_list_of(res.items, the_type) return res def list_by_token(fun, token_key, the_type): ...
code_fim
hard
{ "lang": "python", "repo": "zhengl7/purity_fb_python_client", "path": "/test/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: boconlonton/python-deep-dive path: /part-4/3-single_inheritance/5-delegating_to_parent.py """Delegating to Parent""" from math import pi from numbers import Real class Person: def work(self): return 'Person works...' class Student(Person): def work(self): result = su...
code_fim
hard
{ "lang": "python", "repo": "boconlonton/python-deep-dive", "path": "/part-4/3-single_inheritance/5-delegating_to_parent.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return 'Person works...' class Student(Person): def work(self): result = super().work() return f'Student studies... and {result}' class PythonStudent(Student): def work(self): result = super().work() return f'PythonStudent codes ... and {result}' ps = ...
code_fim
hard
{ "lang": "python", "repo": "boconlonton/python-deep-dive", "path": "/part-4/3-single_inheritance/5-delegating_to_parent.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tkornuta-nvidia/NeMo path: /collections/nemo_cv/nemo_cv/utils/utils.py # Copyright (C) NVIDIA. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
code_fim
medium
{ "lang": "python", "repo": "tkornuta-nvidia/NeMo", "path": "/collections/nemo_cv/nemo_cv/utils/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Interleave two lists. pad_sizes = list(itertools.chain(*zip(zero_sizes, ext_sizes))) #print("pad_sizes = ", pad_sizes) # Pad tensor, starting from last dimension. padded_tensor = pad( input=tensor, pad=pad_sizes, mode='constan...
code_fim
medium
{ "lang": "python", "repo": "tkornuta-nvidia/NeMo", "path": "/collections/nemo_cv/nemo_cv/utils/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Create the reverted list of "desired extensions". ext_sizes = [m-c for (m, c) in zip(max_sizes, cur_sizes)][::-1] #print("ext_sizes = ", ext_sizes) # Interleave two lists. pad_sizes = list(itertools.chain(*zip(zero_sizes, ext_sizes))) #print("pad_sizes ...
code_fim
hard
{ "lang": "python", "repo": "tkornuta-nvidia/NeMo", "path": "/collections/nemo_cv/nemo_cv/utils/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def fetch_user_data(): # (kam193) OpenID library needs full decoded url, but from flask we # can get only encoded URL which breaks parsing. full_decoded_url = urljoin(request.host_url, request.full_path) oid_consumer = consumer.Consumer(session, None) info = oid_consumer.complete(req...
code_fim
hard
{ "lang": "python", "repo": "codilime/acid", "path": "/acid/features/auth/service.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: codilime/acid path: /acid/features/auth/service.py # -*- coding: utf-8 -*- from functools import wraps from urllib.parse import urljoin import requests from flask import abort, request, session, url_for from openid.consumer import consumer from openid.extensions import sreg from .exceptions i...
code_fim
hard
{ "lang": "python", "repo": "codilime/acid", "path": "/acid/features/auth/service.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> session['user'] = user def drop_user_session(): session.pop('user') def admin_required(wrapped_function): @wraps(wrapped_function) def is_user_admin(*args, **kwargs): current_user = get_current_user() if current_user and current_user.is_admin(): return wrapp...
code_fim
medium
{ "lang": "python", "repo": "codilime/acid", "path": "/acid/features/auth/service.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlexsLemonade/refinebio path: /foreman/data_refinery_foreman/surveyor/array_express.py platforms["platform_accession_code"] = external_accession platforms["platform_accession_name"] = UNKNOWN platforms["manufacturer"] = UNKNOWN # Create the expe...
code_fim
hard
{ "lang": "python", "repo": "AlexsLemonade/refinebio", "path": "/foreman/data_refinery_foreman/surveyor/array_express.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlexsLemonade/refinebio path: /foreman/data_refinery_foreman/surveyor/array_express.py # downloader inspect the downloaded file to determine the # array then. if len(array_designs) != 1: platforms["platform_accession_code"] = UNKNOWN platforms["plat...
code_fim
hard
{ "lang": "python", "repo": "AlexsLemonade/refinebio", "path": "/foreman/data_refinery_foreman/surveyor/array_express.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if not download_url: logger.error( "Sample %s did not specify a download url, skipping.", sample_accession_code, experiment_accession_code=experiment.accession_code, survey_j...
code_fim
hard
{ "lang": "python", "repo": "AlexsLemonade/refinebio", "path": "/foreman/data_refinery_foreman/surveyor/array_express.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> (error, _), figure, marks = print_stats(grids, logger) success = error is None if not success: logger.error(error.default_message) return False, False ns.plot_output.parent.mkdir(parents=True, exist_ok=True) getLogger('matplotlib.backends.backend_pdf').disabled = True try: figur...
code_fim
hard
{ "lang": "python", "repo": "stefantaubert/textgrid-ipa", "path": "/src/textgrid_tools_cli/grids/stats_generation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stefantaubert/textgrid-ipa path: /src/textgrid_tools_cli/grids/stats_generation.py from argparse import ArgumentParser, Namespace from logging import getLogger from pathlib import Path from typing import List, cast from textgrid import TextGrid from tqdm import tqdm from textgrid_tools.grids.st...
code_fim
hard
{ "lang": "python", "repo": "stefantaubert/textgrid-ipa", "path": "/src/textgrid_tools_cli/grids/stats_generation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: helq/pytropos path: /pytropos/internals/values/__main__.py from .python_values import PythonValue from .builtin_mutvalues import List from .builtin_values import NoneType from ..errors import TypeCheckLogger from .__init__ import int, float, bool, none, list print("Testing Python Values") val1...
code_fim
hard
{ "lang": "python", "repo": "helq/pytropos", "path": "/pytropos/internals/values/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(f"val1 = {val1}") print(f"val2 = {val2}") val3 = val1.join_mut(val2, {}) print(f"val1.join(val2) => {val3}") print() # Using other lists val1 = list([int(3), list([]), int(2)]) val2 = list([int(5), list([])]) print(f"val1 = {val1}") print(f"val2 = {val2}") val3 = val1.join_mut(val2, {}) print(...
code_fim
hard
{ "lang": "python", "repo": "helq/pytropos", "path": "/pytropos/internals/values/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> one_mat = torch.ones(pred.shape[0], pred.shape[1], pred.shape[2] + 1) index_mat = vlabel.type(torch.LongTensor) onehot_ = zero_mat.scatter(2, index_mat, one_mat) onehot = onehot_[:, :, 1:].type(torch.Tensor).to(pred.device) loss = sigmoid_focal_loss_jit(pred, onehot...
code_fim
hard
{ "lang": "python", "repo": "attiamohammed/video_analyst", "path": "/videoanalyst/model/loss/loss_impl/focal_loss.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r""" Focal loss :param pred: shape=(B, HW, C), classification logits (BEFORE Sigmoid) :param label: shape=(B, HW) """ r""" Focal loss Arguments --------- pred: torch.Tensor classification logits (BEFORE Sigmoid) ...
code_fim
hard
{ "lang": "python", "repo": "attiamohammed/video_analyst", "path": "/videoanalyst/model/loss/loss_impl/focal_loss.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: attiamohammed/video_analyst path: /videoanalyst/model/loss/loss_impl/focal_loss.py # -*- coding: utf-8 -* import torch from ...common_opr.common_loss import sigmoid_focal_loss_jit from ...module_base import ModuleBase from ..loss_base import TRACK_LOSSES @TRACK_LOSSES.register class FocalLoss...
code_fim
medium
{ "lang": "python", "repo": "attiamohammed/video_analyst", "path": "/videoanalyst/model/loss/loss_impl/focal_loss.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # publish all message try: sqsManager.send_messages(messages) except SQSMessageSendingError: logger.warn(f"Failed to send SQS message for generation {generation}") else: for user in users: logger.info(f"[SYNC SCHEDULE] Synchronization planned for hub use...
code_fim
hard
{ "lang": "python", "repo": "Decathlon/hub-decathlon", "path": "/sync_scheduler.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # append user message into list (it will be send as a batch into queue) messages.append(user_message) # publish all message try: sqsManager.send_messages(messages) except SQSMessageSendingError: logger.warn(f"Failed to send SQS message for generation {generatio...
code_fim
hard
{ "lang": "python", "repo": "Decathlon/hub-decathlon", "path": "/sync_scheduler.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Decathlon/hub-decathlon path: /sync_scheduler.py from tapiriik.database import db from tapiriik.settings import _GLOBAL_LOGGER from datetime import datetime from pymongo.read_preferences import ReadPreference from tapiriik.helper.sqs.manager import SqsManager, SQSMessageSendingError import time i...
code_fim
hard
{ "lang": "python", "repo": "Decathlon/hub-decathlon", "path": "/sync_scheduler.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self._cursor = 0 self._start = 0 def nextBatch(self, batch_size): """Return the next `batch_size` examples from this data set.""" self._start = self._cursor self._cursor += batch_size if self._start + batch_size > self._num_samples: rest_num...
code_fim
hard
{ "lang": "python", "repo": "wensincai/transwarp-nlp", "path": "/transwarpnlp/multi_class_classify/dataset/dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def num_samples(self): return self._num_samples def hasNext(self): return self._cursor < self._num_samples def reset(self): self._cursor = 0 self._start = 0 def nextBatch(self, batch_size): """Return the next `batch_size` examples fr...
code_fim
medium
{ "lang": "python", "repo": "wensincai/transwarp-nlp", "path": "/transwarpnlp/multi_class_classify/dataset/dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wensincai/transwarp-nlp path: /transwarpnlp/multi_class_classify/dataset/dataset.py # -*- coding: utf-8 -*- # Reading POS data input_data and target_data """Utilities for reading POS train, dev and test files files.""" from __future__ import absolute_import from __future__ import division from ...
code_fim
hard
{ "lang": "python", "repo": "wensincai/transwarp-nlp", "path": "/transwarpnlp/multi_class_classify/dataset/dataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> delimiter = ':' def template_str(line, settings): t = ConfigTemplate(line) return t.substitute(settings) def write_tracks_dict_raw(tracks_dict, cmt_msg=None, directory=None): upconvert_bloom_to_config_branch() cmt_msg = cmt_msg if cmt_msg is not None else 'Modified tracks.yaml' ...
code_fim
hard
{ "lang": "python", "repo": "ros-infrastructure/bloom", "path": "/bloom/config.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ros-infrastructure/bloom path: /bloom/config.py # Software License Agreement (BSD License) # # Copyright (c) 2013, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions...
code_fim
hard
{ "lang": "python", "repo": "ros-infrastructure/bloom", "path": "/bloom/config.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def main(): SERVER_PORT = 8443 httpd = None # Since unit tests run in parallel, the port may be in use, so # retry creating the server while incrementing the port number while SERVER_PORT < 8493: # Max 50 retries try: # SSL server copied from here: #...
code_fim
hard
{ "lang": "python", "repo": "aaranyak/DesignVideoGame", "path": "/Installer_Modules/pyinstaller-develop/tests/functional/scripts/pyi_lib_requests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> httpd.serve_forever() # Start the SSL server thread = threading.Thread(target=ssl_server) thread.daemon = True thread.start() # Wait a bit for the server to start time.sleep(1) # Use requests to get a page from the server requests.get( u"https://localhost...
code_fim
hard
{ "lang": "python", "repo": "aaranyak/DesignVideoGame", "path": "/Installer_Modules/pyinstaller-develop/tests/functional/scripts/pyi_lib_requests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aaranyak/DesignVideoGame path: /Installer_Modules/pyinstaller-develop/tests/functional/scripts/pyi_lib_requests.py # ----------------------------------------------------------------------------- # Copyright (c) 2014-2020, PyInstaller Development Team. # # Distributed under the terms of the GNU Ge...
code_fim
hard
{ "lang": "python", "repo": "aaranyak/DesignVideoGame", "path": "/Installer_Modules/pyinstaller-develop/tests/functional/scripts/pyi_lib_requests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: R-Andrei/py_address_parser path: /py_address_parser/address.py from .componentcontainer import ComponentContainer from .component import Component class Address(object): """ Description ----------- >A Class used to represent an address. Contains multiple components. Paramate...
code_fim
hard
{ "lang": "python", "repo": "R-Andrei/py_address_parser", "path": "/py_address_parser/address.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if component in self.address: self.address[component.name] = component if component.value else Component(component.name, '') def __setitem__(self, component_name, component_value): #DONE if component_name in self.__keys: self.address[component_name] = Compo...
code_fim
hard
{ "lang": "python", "repo": "R-Andrei/py_address_parser", "path": "/py_address_parser/address.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> >ZipCode -> zipcode base (e.g. 21 Michigan Avenue, Campbell, NC >75121<-1234) >ZipCodeExtension -> extension of zip-code (e.g. 21 Michigan Avenue, Campbell, NC 75121->1234<) Usable methods -------------- > """ def __init__(self, *components): self.address = ...
code_fim
hard
{ "lang": "python", "repo": "R-Andrei/py_address_parser", "path": "/py_address_parser/address.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: junfu1115/DANet path: /scripts/prepare_minc.py import os import shutil import argparse import tarfile from encoding.utils import download, mkdir _TARGET_DIR = os.path.expanduser('~/.encoding/data') def parse_args(): parser = argparse.ArgumentParser( description='Initialize MINC data...
code_fim
medium
{ "lang": "python", "repo": "junfu1115/DANet", "path": "/scripts/prepare_minc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _AUG_DOWNLOAD_URLS = [ ('http://opensurfaces.cs.cornell.edu/static/minc/minc-2500.tar.gz', 'bcccbb3b1ab396ef540f024a5ba23eff54f7fe31')] download_dir = os.path.join(path, 'downloads') mkdir(download_dir) for url, checksum in _AUG_DOWNLOAD_URLS: filename = download(url, path=...
code_fim
medium
{ "lang": "python", "repo": "junfu1115/DANet", "path": "/scripts/prepare_minc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': args = parse_args() mkdir(os.path.expanduser('~/.encoding/datasets')) if args.download_dir is not None: if os.path.isdir(_TARGET_DIR): os.remove(_TARGET_DIR) os.symlink(args.download_dir, _TARGET_DIR) else: download_minc(_TARGE...
code_fim
hard
{ "lang": "python", "repo": "junfu1115/DANet", "path": "/scripts/prepare_minc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: isabella232/ingest-client path: /tests/exporter/test_staging.py import logging from copy import deepcopy from unittest import TestCase from mock import Mock, MagicMock from requests import HTTPError from ingest.api.stagingapi import FileDescription, FileUploadFailed from ingest.exporter import ...
code_fim
hard
{ "lang": "python", "repo": "isabella232/ingest-client", "path": "/tests/exporter/test_staging.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_stage_metadata_eventually_none(self): # given: staging_area_uuid = '566be204-a684-4896-bda7-8dbb3e4fc65c' metadata = self._create_test_metadata_resource() # and: repository raises FileDuplication file_name = metadata.get_staging_file_name() sel...
code_fim
hard
{ "lang": "python", "repo": "isabella232/ingest-client", "path": "/tests/exporter/test_staging.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # and: ensure consistent interface self.staging_info_repository.update.assert_not_called() self.staging_info_repository.find_one.assert_called_once_with(staging_area_uuid, file_name) def test_stage_metadata_delete_info_on_failure(self): # given: staging_area_uu...
code_fim
hard
{ "lang": "python", "repo": "isabella232/ingest-client", "path": "/tests/exporter/test_staging.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }