text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: yamamotsu/OpenTsiolkovsky path: /bin/monte_carlo.py #!/usr/bin/python import json import copy from numpy import random from numpy.random import normal,rand from datetime import datetime import os import multiprocessing def error_loader(data,route): result = [] for k,v in data.items(): ...
code_fim
hard
{ "lang": "python", "repo": "yamamotsu/OpenTsiolkovsky", "path": "/bin/monte_carlo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__=="__main__": Nproc = multiprocessing.cpu_count() - 3 # number of processor missionname = os.getenv("otmc_mission_name") i = int(os.getenv("AWS_BATCH_JOB_ARRAY_INDEX")) os.system("aws s3 cp s3://otmc/" + missionname + "/raw/inp . --recursive") fp = open("mc.json") ...
code_fim
hard
{ "lang": "python", "repo": "yamamotsu/OpenTsiolkovsky", "path": "/bin/monte_carlo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mang0kitty/bwbble path: /Controller/k8sbwbble/jobs/index_job.py from ..job import V1AlignJob, Job from kubernetes.client import V1ResourceRequirements, V1Job class IndexJob(Job): def __init__(self): <|fim_suffix|> api_responses = self.create_job_resources( job, ...
code_fim
hard
{ "lang": "python", "repo": "mang0kitty/bwbble", "path": "/Controller/k8sbwbble/jobs/index_job.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> job.status.waiting_for.extend( [r.metadata.name for r in api_responses if isinstance(r, V1Job)] )<|fim_prefix|># repo: mang0kitty/bwbble path: /Controller/k8sbwbble/jobs/index_job.py from ..job import V1AlignJob, Job from kubernetes.client import V1ResourceRequirements, V1Job ...
code_fim
hard
{ "lang": "python", "repo": "mang0kitty/bwbble", "path": "/Controller/k8sbwbble/jobs/index_job.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(n): tester.circuit.data[i] = i tester.circuit.sel = 2 tester.eval() tester.circuit.out.expect(2) compile_and_run(tester)<|fim_prefix|># repo: David-Durst/aetherling path: /tests/test_mux.py from aetherling.modules.mux_any_type import DefineMuxAnyType from magma ...
code_fim
medium
{ "lang": "python", "repo": "David-Durst/aetherling", "path": "/tests/test_mux.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: David-Durst/aetherling path: /tests/test_mux.py from aetherling.modules.mux_any_type import DefineMuxAnyType from magma import * from magma.bitutils import * import fault from aetherling.helpers.fault_helpers import compile_and_run from aetherling.space_time.type_helpers import ST_Int import buil...
code_fim
medium
{ "lang": "python", "repo": "David-Durst/aetherling", "path": "/tests/test_mux.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='user', name='count', field=models.IntegerField(default=0), ), migrations.CreateModel( name='Content', fields=[ ('id', models.IntegerField(primary_key=Tr...
code_fim
medium
{ "lang": "python", "repo": "narcotis/emoTale", "path": "/django/diary/migrations/0002_auto_20200826_1714.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: narcotis/emoTale path: /django/diary/migrations/0002_auto_20200826_1714.py # Generated by Django 3.0.8 on 2020-08-26 08:14 from django.db import migrations, models import django.db.models.deletion <|fim_suffix|> dependencies = [ ('diary', '0001_initial'), ] operations = [ ...
code_fim
medium
{ "lang": "python", "repo": "narcotis/emoTale", "path": "/django/diary/migrations/0002_auto_20200826_1714.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: prediction2020/explainable-predictive-models path: /code/create_table_for_performance_results.py """ File name: create_table_for_performance_results.py Author: Esra Zihni Date created: 21.05.2018 This script creates a table of the overall performance results. It reads the implementation and pat...
code_fim
hard
{ "lang": "python", "repo": "prediction2020/explainable-predictive-models", "path": "/code/create_table_for_performance_results.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for perf, subs, mdl in itertools.product( performance_measures, subsampling_types, models_to_use ): model_results = pd.read_csv( f"{scores_folder}/{mdl}_{perf}_scores_{subs}_subsampling.csv", index_col=0 ) df.loc[(subs, mdl), ...
code_fim
hard
{ "lang": "python", "repo": "prediction2020/explainable-predictive-models", "path": "/code/create_table_for_performance_results.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cynthia7979/PigeonCoding path: /Classes/[11]/animation_advanced.py import pygame import sys from pygame.locals import * WIDTH, HEIGHT = 1000, 600 XSPEED = 10 YSPEED = 10 <|fim_suffix|>while True: # main loop display.fill((255, 255, 255)) display.blit(ball_surf, ball_rect) ...
code_fim
hard
{ "lang": "python", "repo": "Cynthia7979/PigeonCoding", "path": "/Classes/[11]/animation_advanced.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>while True: # main loop display.fill((255, 255, 255)) display.blit(ball_surf, ball_rect) ball_rect.x += XSPEED ball_rect.y += YSPEED if ball_rect.right >= WIDTH or ball_rect.left < 0: ball_rect.x -= 2*XSPEED XSPEED = -XSPEED if ball_rect.bottom >= HEIGHT or...
code_fim
hard
{ "lang": "python", "repo": "Cynthia7979/PigeonCoding", "path": "/Classes/[11]/animation_advanced.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_woodwinds.py from xai.brain.wordbase.nouns._woodwind import _WOODWIND <|fim_suffix|> _WOODWIND.__init__(self) self.name = "WOODWINDS" self.specie = 'nouns' self.basic = "woodwind" self.jsondata = {}<|fim_middle|>#calss header class _WOODWI...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_woodwinds.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self,): _WOODWIND.__init__(self) self.name = "WOODWINDS" self.specie = 'nouns' self.basic = "woodwind" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_woodwinds.py from xai.brain.wordbase.nouns._woodwind import _WOODWIND <|fim_middle|>#cal...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_woodwinds.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _WOODWIND.__init__(self) self.name = "WOODWINDS" self.specie = 'nouns' self.basic = "woodwind" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_woodwinds.py from xai.brain.wordbase.nouns._woodwind import _WOODWIND <|fim_middle|>#calss header class _WOODWI...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_woodwinds.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> nodeSet, tdirWithClientPoolTxns, looper, trustee, trusteeWallet, poolConfigWFFF): stClient, stWallet = getClientAddedWithRole( nodeSet, tdirWithClientPoolTxns, looper, trustee, trusteeWallet, 'tmpname', STEWARD) _, req = sendPoolConfig(stClient, stWallet, poolConfigWFFF) looper...
code_fim
hard
{ "lang": "python", "repo": "johadahl/indy-node", "path": "/indy_node/test/pool_config/test_send_pool_config_only_trustee.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_only_trustee_send_pool_config_writes_false_force_true( nodeSet, tdirWithClientPoolTxns, looper, trustee, trusteeWallet, poolConfigWFFT): stClient, stWallet = getClientAddedWithRole( nodeSet, tdirWithClientPoolTxns, looper, trustee, trusteeWallet, 'tmpname', STEWARD) _, req...
code_fim
hard
{ "lang": "python", "repo": "johadahl/indy-node", "path": "/indy_node/test/pool_config/test_send_pool_config_only_trustee.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: johadahl/indy-node path: /indy_node/test/pool_config/test_send_pool_config_only_trustee.py from indy_client.test.helper import getClientAddedWithRole from indy_client.test.helper import checkRejects, checkNacks from stp_core.loop.eventually import eventually from indy_node.test.pool_config.helper...
code_fim
hard
{ "lang": "python", "repo": "johadahl/indy-node", "path": "/indy_node/test/pool_config/test_send_pool_config_only_trustee.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>guess = input("Enter the password: ") code = "turtle" trial = 1 maxTries = 3 while guess != code: if trial >= maxTries: break trial +=1 guess = input("Enter again: ") if (trial >= maxTries): print("Took too long...") else: print("Nice, you got it")<|fim_prefix|># repo: ...
code_fim
easy
{ "lang": "python", "repo": "ItsMrTurtle/PythonChris", "path": "/Unit 4 For Loops/Lesson18.3-Break_Statements.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>trial = 1 maxTries = 3 while guess != code: if trial >= maxTries: break trial +=1 guess = input("Enter again: ") if (trial >= maxTries): print("Took too long...") else: print("Nice, you got it")<|fim_prefix|># repo: ItsMrTurtle/PythonChris path: /Unit 4 For Loops/Lesson...
code_fim
medium
{ "lang": "python", "repo": "ItsMrTurtle/PythonChris", "path": "/Unit 4 For Loops/Lesson18.3-Break_Statements.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ItsMrTurtle/PythonChris path: /Unit 4 For Loops/Lesson18.3-Break_Statements.py # -*- coding: utf-8 -*- """ Created on Thu Apr 30 23:20:43 2020 @author: Christopher Cheng """ <|fim_suffix|>if (trial >= maxTries): print("Took too long...") else: print("Nice, you got it")<|fim_middle|...
code_fim
medium
{ "lang": "python", "repo": "ItsMrTurtle/PythonChris", "path": "/Unit 4 For Loops/Lesson18.3-Break_Statements.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kopalja/neural_network1 path: /neural-networks-and-deep-learning-master/src/Random_walk.py import numpy as np class State(object): expected_reward = 0.0 reward_for_entering = 0.0 number_of_steps = 0 terminal_state = False discount_factor = 1 #terminal state def _...
code_fim
hard
{ "lang": "python", "repo": "kopalja/neural_network1", "path": "/neural-networks-and-deep-learning-master/src/Random_walk.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(5): states[i + 1].add_neighbors(states[i], states[i + 2]) for epoch in range(1000000): for state in states: state.update_expected_reward() for state in states: print(state.expected_reward)<|fim_prefix|># repo: kopalja/neural_network1 path: /neural-networks-and-deep...
code_fim
hard
{ "lang": "python", "repo": "kopalja/neural_network1", "path": "/neural-networks-and-deep-learning-master/src/Random_walk.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: acercado/jd-ph-cms path: /jd-ph-cms/notifications/models.py from django.db import models from ..users.models import User class NotificationMessage(models.Model): title = models.CharField(max_length=255) message = models.TextField(null=True, blank=True) timestamp = models.DateTimeFie...
code_fim
medium
{ "lang": "python", "repo": "acercado/jd-ph-cms", "path": "/jd-ph-cms/notifications/models.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class Notification(models.Model): message = models.ForeignKey(NotificationMessage, related_name='messages', null=True, blank=True, on_delete=models.CASCADE) is_viewed = models.BooleanField(default=False) is_read = models.BooleanField(default=False) user = models.ForeignKey(User, null=True,...
code_fim
medium
{ "lang": "python", "repo": "acercado/jd-ph-cms", "path": "/jd-ph-cms/notifications/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> message = models.ForeignKey(NotificationMessage, related_name='messages', null=True, blank=True, on_delete=models.CASCADE) is_viewed = models.BooleanField(default=False) is_read = models.BooleanField(default=False) user = models.ForeignKey(User, null=True, blank=True) class Meta: ...
code_fim
medium
{ "lang": "python", "repo": "acercado/jd-ph-cms", "path": "/jd-ph-cms/notifications/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@login_required def topic_update(request, pk): if request.method=='GET': topic = Topic.objects.get(pk=pk) context = {'genre':topic.genre, 'topic':topic, 'form':forms.UpdateTopicForm(instance=topic)} return render(request, 'topic_new.html', context) elif request.method=='POS...
code_fim
hard
{ "lang": "python", "repo": "GiggleLiu/numericclub", "path": "/topics/views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GiggleLiu/numericclub path: /topics/views.py from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.views import generic from django.utils import timezone from .models import get_topics_...
code_fim
hard
{ "lang": "python", "repo": "GiggleLiu/numericclub", "path": "/topics/views.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with pytest.raises(exception): multihash.decode(mh_bytes)<|fim_prefix|># repo: bmcorser/py-multihash path: /test/test_decode.py import six import pytest import multihash def test_decode_sha1(): <|fim_middle|> mh_bytes = six.b('\x11(86f7e437faa5a7fce15d1ddcb9eaeaea377667b8') mh = multi...
code_fim
hard
{ "lang": "python", "repo": "bmcorser/py-multihash", "path": "/test/test_decode.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bmcorser/py-multihash path: /test/test_decode.py import six import pytest import multihash def test_decode_sha1(): <|fim_suffix|>@pytest.mark.parametrize('mh_bytes,exception', ( (six.b('\x11d' + 'a' * 10), multihash.exceptions.InconsistentLen), )) def test_decode_raises(mh_bytes, exception):...
code_fim
hard
{ "lang": "python", "repo": "bmcorser/py-multihash", "path": "/test/test_decode.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: trunghlt/cape-api-helpers path: /cape_api_helpers/output.py # Copyright 2018 BLEMUNDSBURY AI LIMITED # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www....
code_fim
hard
{ "lang": "python", "repo": "trunghlt/cape-api-helpers", "path": "/cape_api_helpers/output.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if number_of_items is not None and offset is not None: return wrapped(request, number_of_items, offset) elif number_of_items is not None: return wrapped(request, number_of_items) elif offset is not None: return wrapped(request, offset=offset) ...
code_fim
hard
{ "lang": "python", "repo": "trunghlt/cape-api-helpers", "path": "/cape_api_helpers/output.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def debuggable(wrapped): @wraps(wrapped) def decorated(request, *args, **kwargs): debug_server = request['args'].get(SECRET_DEBUG_KEYWORD, False) if debug_server: import pydevd import socket hostname, port = debug_server.split(":") po...
code_fim
hard
{ "lang": "python", "repo": "trunghlt/cape-api-helpers", "path": "/cape_api_helpers/output.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wtfaremyinitials/powerapi-python path: /demo.py from pprint import pprint #DEBUG import sys #DEBUG <|fim_suffix|>courses = user.getCourses() pprint(courses[2].getName()) pprint(courses[2].getScores())<|fim_middle|>import powerapi ps = powerapi.core('https://psserv') try: user = ps.auth('usern...
code_fim
medium
{ "lang": "python", "repo": "wtfaremyinitials/powerapi-python", "path": "/demo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>courses = user.getCourses() pprint(courses[2].getName()) pprint(courses[2].getScores())<|fim_prefix|># repo: wtfaremyinitials/powerapi-python path: /demo.py from pprint import pprint #DEBUG import sys #DEBUG import powerapi ps = powerapi.core('https://psserv') <|fim_middle|>try: user = ps.auth('usern...
code_fim
medium
{ "lang": "python", "repo": "wtfaremyinitials/powerapi-python", "path": "/demo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> X *= 2 cnt += 1 return '{:b}'.format(X - Y).count('1') + cnt + step<|fim_prefix|># repo: Wizmann/ACM-ICPC path: /Leetcode/Algorithm/python/1000/00991-Broken Calculator.py class Solution(object): def brokenCalc(self, X, Y): if X >= Y: re...
code_fim
hard
{ "lang": "python", "repo": "Wizmann/ACM-ICPC", "path": "/Leetcode/Algorithm/python/1000/00991-Broken Calculator.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wizmann/ACM-ICPC path: /Leetcode/Algorithm/python/1000/00991-Broken Calculator.py class Solution(object): def brokenCalc(self, X, Y): if X >= Y: return X - Y else: cnt = 0 XX = X while X < Y: X *= 2 ...
code_fim
hard
{ "lang": "python", "repo": "Wizmann/ACM-ICPC", "path": "/Leetcode/Algorithm/python/1000/00991-Broken Calculator.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> helps['task'] = """ type: group short-summary: Grouping of all task related tasks """<|fim_prefix|># repo: chermehdi/egor path: /egor/help.py from knack.help_files import helps <|fim_middle|>class HelpGenerator: def load(self):
code_fim
easy
{ "lang": "python", "repo": "chermehdi/egor", "path": "/egor/help.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chermehdi/egor path: /egor/help.py from knack.help_files import helps <|fim_suffix|> helps['task'] = """ type: group short-summary: Grouping of all task related tasks """<|fim_middle|>class HelpGenerator: def load(self):
code_fim
easy
{ "lang": "python", "repo": "chermehdi/egor", "path": "/egor/help.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chermehdi/egor path: /egor/help.py from knack.help_files import helps <|fim_suffix|> def load(self): helps['task'] = """ type: group short-summary: Grouping of all task related tasks """<|fim_middle|>class HelpGenerator:
code_fim
easy
{ "lang": "python", "repo": "chermehdi/egor", "path": "/egor/help.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Used to count the number of frames count_frames = count_frames+1; # Combine the answer return left * right def exp_fast(b, c): """ Returns the value b^c. Property. b^c = b * b^(c-1) Property. b^c = (b*b)^(c/2) for even c Parameter b: the number to raise to a po...
code_fim
hard
{ "lang": "python", "repo": "LizzieDeng/kalman_fliter_analysis", "path": "/docs/cornell CS class/lesson 17. Recursion/demos/exp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Combine the answer return left * right def exp_fast(b, c): """ Returns the value b^c. Property. b^c = b * b^(c-1) Property. b^c = (b*b)^(c/2) for even c Parameter b: the number to raise to a power Precondition: b is a number Parameter c: the exponent Precon...
code_fim
hard
{ "lang": "python", "repo": "LizzieDeng/kalman_fliter_analysis", "path": "/docs/cornell CS class/lesson 17. Recursion/demos/exp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LizzieDeng/kalman_fliter_analysis path: /docs/cornell CS class/lesson 17. Recursion/demos/exp.py """ Functions for raising a number to an exponent These functions show the why the choice of division at the recursive step matters. In this case, it greatly affects the performance of the algorithm....
code_fim
hard
{ "lang": "python", "repo": "LizzieDeng/kalman_fliter_analysis", "path": "/docs/cornell CS class/lesson 17. Recursion/demos/exp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __getstate__(self): raise Exception('getstate should never be called') def __setstate__(self, state): raise Exception('setstate should never be called') def __str__(self): return '{}({})'.format(self.__class__.__name__, ','.join(str(arg) for arg in self._args)) def edit(self, op...
code_fim
hard
{ "lang": "python", "repo": "pietervanzuijlen/nutils", "path": "/nutils/cache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pietervanzuijlen/nutils path: /nutils/cache.py # Copyright (c) 2014 Evalf # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limit...
code_fim
hard
{ "lang": "python", "repo": "pietervanzuijlen/nutils", "path": "/nutils/cache.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> 'call' try: import cPickle as pickle except ImportError: import pickle name = func.__name__ + ''.join(' {}'.format(arg) for arg in args) + ''.join(' {}={}'.format(*item) for item in kwargs.items()) pos = self.data.tell() try: data = pickle.load(self.data) exc...
code_fim
hard
{ "lang": "python", "repo": "pietervanzuijlen/nutils", "path": "/nutils/cache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: huaSoftware/chat path: /chatApi/app/Job/Interval.py ''' @Author: hua @Date: 2019-12-12 14:03:17 @description: https://www.cnblogs.com/luxiaojun/p/6567132.html @LastEditors: hua @LastEditTime: 2019-12-13 13:24:09 ''' from app import sched, delayQueue, socketio import time from app.Vendor.Utils im...
code_fim
medium
{ "lang": "python", "repo": "huaSoftware/chat", "path": "/chatApi/app/Job/Interval.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ed_job('interval', seconds=5) def interval_job(): #获取任务 """ d_list = delayQueue.consumer() for item in d_list: if item["action"] == 'invite': socketio.emit('beg', Utils.formatBody(item), namespace='/api', room='@broadcast.'+str(item["id"])) """<|fim_prefix|># repo: huaSoftw...
code_fim
medium
{ "lang": "python", "repo": "huaSoftware/chat", "path": "/chatApi/app/Job/Interval.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShikouYamaue/SISideBar path: /Contents/scripts/sisidebar/sisidebar_sub.py sb.transform_center() # cmds.undoInfo(cn='cng_center', cck=True) return # COGモードチェックしておく sb.window.setup_object_center() # UIの変更を反映する sb.check_option_parm() # コンテキストを切り替えてリアルタイム検出...
code_fim
hard
{ "lang": "python", "repo": "ShikouYamaue/SISideBar", "path": "/Contents/scripts/sisidebar/sisidebar_sub.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShikouYamaue/SISideBar path: /Contents/scripts/sisidebar/sisidebar_sub.py "transform"): # 複合選択モードの時は逃げる print("multi selection mode return :") return if cmds.ls(sl=True, set=True): # 複合選択モードの時は逃げる print("multi selection mode return :") ret...
code_fim
hard
{ "lang": "python", "repo": "ShikouYamaue/SISideBar", "path": "/Contents/scripts/sisidebar/sisidebar_sub.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> c_ctx = cmds.currentCtx(q=True) # print(c_ctx) sel = cmds.ls(sl=True, l=True) # print('set reference :', mode, sel) current_ctx = cmds.currentCtx() if mode == "object": # print('set reference object mode :') cmds.selectMode(o=True) rot = cmds.xform(sel, q=Tr...
code_fim
hard
{ "lang": "python", "repo": "ShikouYamaue/SISideBar", "path": "/Contents/scripts/sisidebar/sisidebar_sub.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: twistedpair/google-cloud-sdk path: /google-cloud-sdk/lib/googlecloudsdk/surface/dataproc/operations/delete.py # Copyright 2015 Google Inc. All Rights Reserved. """Delete operation command.""" from googlecloudsdk.api_lib.dataproc import util from googlecloudsdk.calliope import base from googlecl...
code_fim
medium
{ "lang": "python", "repo": "twistedpair/google-cloud-sdk", "path": "/google-cloud-sdk/lib/googlecloudsdk/surface/dataproc/operations/delete.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> parser.add_argument('operation', help='The ID of the operation to delete.') @util.HandleHttpError def Run(self, args): client = self.context['dataproc_client'] messages = self.context['dataproc_messages'] request = messages.DataprocOperationsDeleteRequest( name=args.operation...
code_fim
medium
{ "lang": "python", "repo": "twistedpair/google-cloud-sdk", "path": "/google-cloud-sdk/lib/googlecloudsdk/surface/dataproc/operations/delete.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jorgediazjr/dials-dev20191018 path: /modules/cctbx_project/iotbx/command_line/cif.as_xray_structure.py from __future__ import absolute_import, division, print_function from cctbx import xray from libtbx import easy_pickle from libtbx.str_utils import show_string import sys, os op = os.path <|fim...
code_fim
medium
{ "lang": "python", "repo": "jorgediazjr/dials-dev20191018", "path": "/modules/cctbx_project/iotbx/command_line/cif.as_xray_structure.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for f in args: try: xray_structures = xray.structure.from_cif(file_path=f) except KeyboardInterrupt: raise except Exception as e: print("Error extracting xray structure from file: %s:" % ( show_string(f))) print(" ", str(e)) continue basename, _ = op...
code_fim
medium
{ "lang": "python", "repo": "jorgediazjr/dials-dev20191018", "path": "/modules/cctbx_project/iotbx/command_line/cif.as_xray_structure.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>rint(single_quote_str) print(double_quote_str)<|fim_prefix|># repo: jasonrbriggs/python-for-kids path: /ch3/escaping.py single_quote_str = 'He said, "Aren\'t can\'t <|fim_middle|>shouldn\'t wouldn\'t."' double_quote_str = "He said, \"Aren't can't shouldn't wouldn't.\"" p
code_fim
medium
{ "lang": "python", "repo": "jasonrbriggs/python-for-kids", "path": "/ch3/escaping.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jasonrbriggs/python-for-kids path: /ch3/escaping.py single_quote_str = 'He said, "Aren\'t can\'t <|fim_suffix|>rint(single_quote_str) print(double_quote_str)<|fim_middle|>shouldn\'t wouldn\'t."' double_quote_str = "He said, \"Aren't can't shouldn't wouldn't.\"" p
code_fim
medium
{ "lang": "python", "repo": "jasonrbriggs/python-for-kids", "path": "/ch3/escaping.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> said, \"Aren't can't shouldn't wouldn't.\"" print(single_quote_str) print(double_quote_str)<|fim_prefix|># repo: jasonrbriggs/python-for-kids path: /ch3/escaping.py single_quote_str = 'He said, "Aren\'t can\'t <|fim_middle|>shouldn\'t wouldn\'t."' double_quote_str = "He
code_fim
easy
{ "lang": "python", "repo": "jasonrbriggs/python-for-kids", "path": "/ch3/escaping.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Modified to read NumPy arrays for eastings and northings. The conversion is pretty crude (just a loop through all the input coordinates rather than a proper array-based conversion). Also flipped order of the returned arrays to be the same as the input (x then y). Parameters ------...
code_fim
hard
{ "lang": "python", "repo": "wangrenz/PyFVCOM", "path": "/PyFVCOM/coordinate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wangrenz/PyFVCOM path: /PyFVCOM/coordinate.py coordinates (optinally inverse). This function can therefore to UTM -> lat/lon as well as lat/lon -> UTM Parameters ---------- args : tuple Arguments: in_x, in_y : float zone, ellipsoid, datum : str ...
code_fim
hard
{ "lang": "python", "repo": "wangrenz/PyFVCOM", "path": "/PyFVCOM/coordinate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wangrenz/PyFVCOM path: /PyFVCOM/coordinate.py =False): """ Simple back and forth test of the functions with a given lat/long pair. Parameters ---------- inLat, inLong : float Input latitude and longitude pair. """ e, n, z = utm_from_lonlat(inLong, inLat, inZone) ...
code_fim
hard
{ "lang": "python", "repo": "wangrenz/PyFVCOM", "path": "/PyFVCOM/coordinate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thorwhalen/pipoke path: /pipoke/__init__.py """pipoke""" __author__ = 'thorwhalen' from collections import ChainMap import os proj_rootdir = os.path.dirname(__file__) DFLT_ROOTDIR = proj_rootdir ROOTDIR_ENV_VAR = 'PIPOKE_ROOTDIR' resources = ChainMap(os.environ) rootdir = resources.get(ROOTD...
code_fim
hard
{ "lang": "python", "repo": "thorwhalen/pipoke", "path": "/pipoke/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from pipoke.pkg_vs_words import ( available_simple_words, simple_words, all_words, pypi_pkg_names, builtin_pkg_names, builtin_obj_names, py_reserved_words, words_and_pkg_names_satisfying_condition, words_and_pkg_names_satisfying_regex, is_not_a_pkg_name ) from pipok...
code_fim
hard
{ "lang": "python", "repo": "thorwhalen/pipoke", "path": "/pipoke/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nelsonjchen/cv_pubsubs path: /displayarray/subscriber_window/__init__.py """ Displays arrays. <|fim_suffix|>from .subscriber_windows import SubscriberWindows<|fim_middle|>SubscriberWindows displays one array per window, updating it as it's changed. """
code_fim
medium
{ "lang": "python", "repo": "nelsonjchen/cv_pubsubs", "path": "/displayarray/subscriber_window/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from .subscriber_windows import SubscriberWindows<|fim_prefix|># repo: nelsonjchen/cv_pubsubs path: /displayarray/subscriber_window/__init__.py """ Displays arrays. <|fim_middle|>SubscriberWindows displays one array per window, updating it as it's changed. """
code_fim
medium
{ "lang": "python", "repo": "nelsonjchen/cv_pubsubs", "path": "/displayarray/subscriber_window/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bhourahine/hsdparser path: /python/test/hsd/profile_parser.py import cProfile import sys from hsd.parser import HSDParser <|fim_suffix|> parser = HSDParser() fp = open(sys.argv[1], "r") parser.feed(fp) fp.close() if __name__ == "__main__": if len(sys.argv) < 2: sys.st...
code_fim
medium
{ "lang": "python", "repo": "bhourahine/hsdparser", "path": "/python/test/hsd/profile_parser.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": if len(sys.argv) < 2: sys.stderr.write("Script needs at least one argument (the input file to" " be used for profiling)!\n") sys.exit() if len(sys.argv) > 2: sort = sys.argv[2] else: sort = 'time' c...
code_fim
medium
{ "lang": "python", "repo": "bhourahine/hsdparser", "path": "/python/test/hsd/profile_parser.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: RamonvdW/nhb-apps path: /Webwinkel/management/commands/check_fotos.py # -*- coding: utf-8 -*- # Copyright (c) 2022 Ramon van der Winkel. # All rights reserved. # Licensed under BSD-3-Clause-Clear. See LICENSE file for details. # stel de foto's in voor een product in de webwinkel from django...
code_fim
hard
{ "lang": "python", "repo": "RamonvdW/nhb-apps", "path": "/Webwinkel/management/commands/check_fotos.py", "mode": "psm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_suffix|> # kan een omslagfoto zijn, dus alleen locatie checken en niet de thumb self._check_foto_bestand(foto, 'locatie') # for if self.aantal_nok: self.stdout.write("[INFO] %s foto's OK" % self.aantal_ok) self.stderr.write("[ERROR] %s foto's...
code_fim
hard
{ "lang": "python", "repo": "RamonvdW/nhb-apps", "path": "/Webwinkel/management/commands/check_fotos.py", "mode": "spm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_suffix|> # rapporteer ongebruikte fotos for foto in WebwinkelFoto.objects.all(): if foto.pk not in self.fotos_used.keys(): self.stdout.write('[WARNING] Foto pk=%s (%s) wordt niet (meer) gebruikt' % (foto.pk, foto)) # kan een omslagfoto zijn, dus alleen l...
code_fim
hard
{ "lang": "python", "repo": "RamonvdW/nhb-apps", "path": "/Webwinkel/management/commands/check_fotos.py", "mode": "spm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_suffix|>D3D10_TEXCUBE_ARRAY_SRV1 = Struct("D3D10_TEXCUBE_ARRAY_SRV1", [ (UINT, "MostDetailedMip"), (UINT, "MipLevels"), (UINT, "First2DArrayFace"), (UINT, "NumCubes"), ]) D3D10_SHADER_RESOURCE_VIEW_DESC1 = Struct("D3D10_SHADER_RESOURCE_VIEW_DESC1", [ (DXGI_FORMAT, "Format"), (D3D10_SRV_DI...
code_fim
hard
{ "lang": "python", "repo": "juhapekka/apitrace", "path": "/specs/d3d10_1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: juhapekka/apitrace path: /specs/d3d10_1.py ########################################################################## # # Copyright 2008-2012 VMware, Inc. # All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated docu...
code_fim
hard
{ "lang": "python", "repo": "juhapekka/apitrace", "path": "/specs/d3d10_1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>d3d10_1 = Module("d3d10_1") d3d10_1.addFunctions([ StdFunction(HRESULT, "D3D10CreateDevice1", [(ObjPointer(IDXGIAdapter), "pAdapter"), (D3D10_DRIVER_TYPE, "DriverType"), (HMODULE, "Software"), (D3D10_CREATE_DEVICE_FLAG, "Flags"), (D3D10_FEATURE_LEVEL1, "HardwareLevel"), (UINT, "SDKVersion"), Out(Point...
code_fim
hard
{ "lang": "python", "repo": "juhapekka/apitrace", "path": "/specs/d3d10_1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: esix2/coffee-accounting path: /python/PeopleBalance_to_excel.py import pandas as pd from openpyxl.styles import Color, Fill, Border, Alignment, Font from openpyxl.cell import get_column_letter def PeopleBalance_to_excel(): csvFile = 'PeopleBalance' df = pd.read_csv(csvFile) ...
code_fim
hard
{ "lang": "python", "repo": "esix2/coffee-accounting", "path": "/python/PeopleBalance_to_excel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(Row_s,Row_e+1): for j in range(Col_s,Col_e+1): # print "i="+str(i)+", j="+str(j) tmp_cell = ws.cell(row=i-1,column=j-1) if ws.cell(row=0,column=j-1).value == 'Balance': if tmp_cell.value < 0:...
code_fim
hard
{ "lang": "python", "repo": "esix2/coffee-accounting", "path": "/python/PeopleBalance_to_excel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>build": "hg19", "program": "tcga" }, { "table_id": "{}:TCGA_hg38_data_v0.Protein_Expression".format(settings.BIGQUERY_DATA_PROJECT_ID), "gene_label_field": "gene_name", "value_field": "protein_expression", "internal_table_id": "hg...
code_fim
hard
{ "lang": "python", "repo": "isb-cgc/ISB-CGC-Webapp", "path": "/bq_data_access/data_types/rppa.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> "gene_name", "value_field": "protein_expression", "internal_table_id": "hg38_protein_expression", "genomic_build": "hg38", "program": "tcga" } ] }<|fim_prefix|># repo: isb-cgc/ISB-CGC-Webapp path: /bq_data_access/data_types/rppa.py from django....
code_fim
hard
{ "lang": "python", "repo": "isb-cgc/ISB-CGC-Webapp", "path": "/bq_data_access/data_types/rppa.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: isb-cgc/ISB-CGC-Webapp path: /bq_data_access/data_types/rppa.py from django.conf import settings BIGQUERY_CONFIG = { "supported_genomic_builds": ['hg19', 'hg38'], "tables": [ { "table_id": "{}:TCGA_hg19_data_v0.Protein_Expression".format(sett<|fim_suffix|>build": "hg1...
code_fim
hard
{ "lang": "python", "repo": "isb-cgc/ISB-CGC-Webapp", "path": "/bq_data_access/data_types/rppa.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: eronca/pyscf path: /ee_fcigf/run_gf.py import numpy as np import scipy.linalg import pyscf.gto import pyscf.scf import pyscf.mcscf import pyscf.ao2mo import pyscf.lib.logger as logger import math import sys from pyscf.ee_fcigf import compute_gf #from pyscf.fcigf import run_gf from compute_gf impo...
code_fim
hard
{ "lang": "python", "repo": "eronca/pyscf", "path": "/ee_fcigf/run_gf.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> sys.stdout.flush() import scipy.integrate print "Integral of the interacting Green's function: ", scipy.integrate.simps(np.array(density_of_states), omega_array) sys.stdout.flush() print "\nCASSCF-GF Done!\n" # Plot the results with open('density_of_state...
code_fim
hard
{ "lang": "python", "repo": "eronca/pyscf", "path": "/ee_fcigf/run_gf.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #test gf_mf_real_trace = [] # Compute density of states only if(dos_only): for omega_val in omega_array: if(omega_real): romega = omega_val iomega = 0.0 else: romega = 0.0 iomega = omega_va...
code_fim
hard
{ "lang": "python", "repo": "eronca/pyscf", "path": "/ee_fcigf/run_gf.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def test_storage_unit_stack(): stack = StorageUnitStack([ds1, ds2], 't') expected = numpy.array([ [ [624, 625, 626], [634, 635, 636] ], [ [24, 25, 26], [34, 35, 36] ] ]) data = stack.get('B10', t=Range(400, 50...
code_fim
hard
{ "lang": "python", "repo": "Spaxe/agdc-v2", "path": "/tests/storage/test_access.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Spaxe/agdc-v2 path: /tests/storage/test_access.py # Copyright 2015 Geoscience Australia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://ww...
code_fim
hard
{ "lang": "python", "repo": "Spaxe/agdc-v2", "path": "/tests/storage/test_access.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> from datacube.storage.access.backends import NetCDF4StorageUnit su = NetCDF4StorageUnit.from_file(data_folder+'/test.nc') assert set(su.coordinates.keys()) == ({'longitude', 'latitude', 'time'}) assert su.variables['B2'].nodata == -999 data = su.get('B2', longitude=Range(151.5, 151.7...
code_fim
hard
{ "lang": "python", "repo": "Spaxe/agdc-v2", "path": "/tests/storage/test_access.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> context = MockContext() print("TYPE\tITEMS\tCREATE\tACCESS\tSIZE") def geometric_mean(xs): return reduce(mul, xs) ** (1 / len(xs)) with Pool() as pool: for kind in (str,): total_create = [] total_access = [] total_size = [] ...
code_fim
hard
{ "lang": "python", "repo": "hartescout/automap", "path": "/tasks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for so in glob("*.so"): context.run( f"patchelf --remove-needed libpython{get_python_version()}{abiflags}.so.1.0 {so}", echo=True, ) context.run(f"{executable} setup.py bdist_wheel", echo=True) WHEELS = glob("dist/*.whl") assert W...
code_fim
hard
{ "lang": "python", "repo": "hartescout/automap", "path": "/tasks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hartescout/automap path: /tasks.py from functools import reduce from glob import glob from itertools import product from multiprocessing import Pool from operator import mul from os import environ, remove, replace from random import random from subprocess import run from sys import executable, ge...
code_fim
hard
{ "lang": "python", "repo": "hartescout/automap", "path": "/tasks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>t * from .inception_resnet_v2 import * from .inception_v2 import *<|fim_prefix|># repo: liuguoyou/quantized.pytorch path: /models/__init__.py from .alexnet import * from .alexnet_quantized import * from .resnet import * from .resnet_bwn import * from .resnet_quantized imp<|fim_middle|>ort * from .resnet...
code_fim
medium
{ "lang": "python", "repo": "liuguoyou/quantized.pytorch", "path": "/models/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: liuguoyou/quantized.pytorch path: /models/__init__.py from .alexnet import * from .alexnet_quantized import * from .re<|fim_suffix|>t * from .inception_resnet_v2 import * from .inception_v2 import *<|fim_middle|>snet import * from .resnet_bwn import * from .resnet_quantized import * from .resnet...
code_fim
medium
{ "lang": "python", "repo": "liuguoyou/quantized.pytorch", "path": "/models/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hypothesis/lms path: /tests/unit/lms/services/d2l_api/factory_test.py from unittest.mock import create_autospec, sentinel import pytest from lms.models import ApplicationInstance from lms.services.d2l_api.factory import d2l_api_client_factory def test_d2l_api_client_factory( http_service,...
code_fim
medium
{ "lang": "python", "repo": "hypothesis/lms", "path": "/tests/unit/lms/services/d2l_api/factory_test.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.fixture(autouse=True) def BasicClient(patch): return patch("lms.services.d2l_api.factory.BasicClient") @pytest.fixture(autouse=True) def D2LAPIClient(patch): return patch("lms.services.d2l_api.factory.D2LAPIClient")<|fim_prefix|># repo: hypothesis/lms path: /tests/unit/lms/services/d2l_...
code_fim
hard
{ "lang": "python", "repo": "hypothesis/lms", "path": "/tests/unit/lms/services/d2l_api/factory_test.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> formfield_overrides = { models.CharField: {'widget': TextInput(attrs={'size':'100'})}, models.TextField: {'widget': CKEditorWidget(config_name='default')}, } admin.site.register(Post, PostAdmin)<|fim_prefix|># repo: bevenky/dev-cms path: /posts/admin.py from django.conf import se...
code_fim
hard
{ "lang": "python", "repo": "bevenky/dev-cms", "path": "/posts/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return '<a href="/%s/%s">View</a>' % (settings.POSTS_URL_PREFIX, self.preview_url.lstrip('/')) preview_url_link.allow_tags = True list_display = ('created_at', 'publish_time', 'title', url_link , preview_url_link , 'is_draft', 'exclude_from_sitemap', 'post_ranking', '...
code_fim
hard
{ "lang": "python", "repo": "bevenky/dev-cms", "path": "/posts/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bevenky/dev-cms path: /posts/admin.py from django.conf import settings from django.contrib import admin from django.db import models from django.forms import TextInput, Textarea from ckeditor.widgets import CKEditorWidget from models import Category, CategoryResource, Post, PostResource from im...
code_fim
medium
{ "lang": "python", "repo": "bevenky/dev-cms", "path": "/posts/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tlmolane/Volt path: /number_of_keys.py import glob import os def key_list_numbers(directory, ext): folders = glob.glob(directory) key_list = [] for folder in folders: #os.path.join() for f in glob.glob(folder+'/*.{}'.format(ext)): key_list.append(f) ...
code_fim
medium
{ "lang": "python", "repo": "tlmolane/Volt", "path": "/number_of_keys.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Runs in log(n) time where n is the number of existing files in sequence """ for path_pat in two_patterns: i = 1 # First do an exponential search while os.path.exists(path_pat % i): i = i*2 # Result lies somewhere in the interval (i/2..i] #...
code_fim
hard
{ "lang": "python", "repo": "tlmolane/Volt", "path": "/number_of_keys.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dataset = DglNodePropPredDataset(name=args.dataset) split_idx = dataset.get_idx_split() train_idx, val_idx, test_idx = torch.LongTensor(split_idx['train']), torch.LongTensor(split_idx['valid']), torch.LongTensor(split_idx['test']) g, labels = dataset[0] # graph: dgl graph object, label: t...
code_fim
hard
{ "lang": "python", "repo": "tanhimislam/graph4nlp", "path": "/graph4nlp/pytorch/test/graph_embedding/run_graphsage.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tanhimislam/graph4nlp path: /graph4nlp/pytorch/test/graph_embedding/run_graphsage.py import os import argparse import numpy as np import networkx as nx import time import torch import torch.nn as nn import torch.nn.functional as F import torch.backends.cudnn as cudnn import dgl from dgl import D...
code_fim
hard
{ "lang": "python", "repo": "tanhimislam/graph4nlp", "path": "/graph4nlp/pytorch/test/graph_embedding/run_graphsage.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def linkrepl(m): return '{before}{root}?link={link}&next={next}{after}'.format( root=external_link_root, next=next, before=m.group('before'), # unescape the link before encoding it to ensure entitie...
code_fim
hard
{ "lang": "python", "repo": "incuna/django-rewrite-external-links", "path": "/rewrite_external_links/middleware.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: incuna/django-rewrite-external-links path: /rewrite_external_links/middleware.py import re from django.conf import settings from django.core.urlresolvers import reverse from django.template.defaultfilters import urlencode from django.utils.html_parser import HTMLParser SAFE_EXTERNAL_LINK_PATTE...
code_fim
hard
{ "lang": "python", "repo": "incuna/django-rewrite-external-links", "path": "/rewrite_external_links/middleware.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }