text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: cibinsb/tesk-core path: /tests/test_filer.py import unittest from tesk_core.filer import newTransput, FTPTransput, HTTPTransput, FileTransput,\ process_file, logConfig, getPath, copyDir from tesk_core.exception import UnknownProtocol, InvalidHostPath,\ FileProtocolDisabled from tesk_core....
code_fim
hard
{ "lang": "python", "repo": "cibinsb/tesk-core", "path": "/tests/test_filer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEquals( getTree(dst2) , stripLines(''' |-- a | |-- 1.txt | `-- 2.txt `-- 3.txt ''' ) ...
code_fim
hard
{ "lang": "python", "repo": "cibinsb/tesk-core", "path": "/tests/test_filer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AmberHarris/Shaco path: /jshbot/__init__.py # Import all modules necessary for JshBot # Core components import jshbot.core as core import jshbot.exceptions as exceptions import jshbot.parser as parser import jshbot.plugins as plugins import jshbot.commands as<|fim_suffix|>as utilities # Base is...
code_fim
medium
{ "lang": "python", "repo": "AmberHarris/Shaco", "path": "/jshbot/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>as utilities # Base is imported through the plugins module # Other plugins are imported in a similar fashion<|fim_prefix|># repo: AmberHarris/Shaco path: /jshbot/__init__.py # Import all modules necessary for JshBot # Core components import jshbot.core as core import jshbot.exceptions as exceptions imp...
code_fim
medium
{ "lang": "python", "repo": "AmberHarris/Shaco", "path": "/jshbot/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: steinitzu/speedyspotify path: /speedyspotify/client.py s) else: raise NotImplementedError return GletList(result, self._join_many) def _join_one(self, one_request, extract=None): one_request.join() response = one_request.value if not respon...
code_fim
hard
{ "lang": "python", "repo": "steinitzu/speedyspotify", "path": "/speedyspotify/client.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> url = '/users/{user_id}/playlists/{playlist_id}/tracks' uid = get_id('user', user) plid = get_id('playlist', playlist) turis = list(get_uris('track', get_ids('track', tracks))) body = dict(uris=turis) if position is not None: body['position'] = ...
code_fim
hard
{ "lang": "python", "repo": "steinitzu/speedyspotify", "path": "/speedyspotify/client.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> url = '/artists/{id}/related_artists' aid = get_id('artist', artist) return self._get(url.format(id=aid)) def album(self, album): url = '/albums/{id}' aid = get_id('album', album) return self._get(url.format(id=aid)) @max_limit(50) def album_tr...
code_fim
hard
{ "lang": "python", "repo": "steinitzu/speedyspotify", "path": "/speedyspotify/client.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> return pos[0] == 0 and pos[1] == 0 # Q5 """ 写一个验证email格式的程序, 对于给定的string监查是不是一个email地址: 1. 必须只包含小写字母,"-", "/" , "." , "_" 和数字 2. 有且仅有一个"@" 3. @之前之后不能为空 4. 以 ".edu" 或 ".com" 结尾 可以使用regex或者python标准包的方法。 """ def isValidEmail(email): import re pattern = r"[-/.0-9_a-z]+@[-/.0-9_a-z]*\.(com|edu)...
code_fim
hard
{ "lang": "python", "repo": "wsy-239/2021-march-bootcamp", "path": "/week3-numpy_pandas/assignment3/assignment3-yihan.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wsy-239/2021-march-bootcamp path: /week3-numpy_pandas/assignment3/assignment3-yihan.py # Q1. """ 请实现 2个python list 的 ‘cross product’ function. 要求按照Numpy 中cross product的效果: https://numpy.org/doc/stable/reference/generated/numpy.cross.html 只实现 1-d list 的情况即可. x = [1, 2, 0] y = [4, 5, 6] cross(x, y)...
code_fim
hard
{ "lang": "python", "repo": "wsy-239/2021-march-bootcamp", "path": "/week3-numpy_pandas/assignment3/assignment3-yihan.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: abantos/bolt path: /test/test_utils/test_utfiles.py import unittest import bolt.utils._utfiles as utfiles class TestFileDeleter(unittest.TestCase): def setUp(self): self.sourcedir = "C:\\sourcedir" self.pattern = "*.py" self.recursive = True self.subject = F...
code_fim
hard
{ "lang": "python", "repo": "abantos/bolt", "path": "/test/test_utils/test_utfiles.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def execute(self): self.subject.execute() def assert_sourcedir(self, expected): self.assertEqual(self.subject.sourcedir, expected) def assert_pattern(self, expected): self.assertEqual(self.subject.pattern, expected) def assert_recursive(self, expected): s...
code_fim
hard
{ "lang": "python", "repo": "abantos/bolt", "path": "/test/test_utils/test_utfiles.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fig, ax = plt.subplots() ax.matshow(bestStrategies, cmap = plt.cm.gray_r) #ax.set_xticklabels(budgets) plt.xticks(range(len(budgets)), budgets) ax.xaxis.set_label_position('top') ax.set_xlabel("Budget") #ax.set_yticklabels([55, 65, 75, 85, 95]) plt.yticks(range(len(workerAccuracies)), [55,65,75,85,95]) ax...
code_fim
medium
{ "lang": "python", "repo": "polarcoconut/thesis-reactive-learning", "path": "/plotRunLots.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: polarcoconut/thesis-reactive-learning path: /plotRunLots.py import matplotlib.pyplot as plt import numpy as np import cPickle as pickle <|fim_suffix|>fig, ax = plt.subplots() ax.matshow(bestStrategies, cmap = plt.cm.gray_r) #ax.set_xticklabels(budgets) plt.xticks(range(len(budgets)), budgets) a...
code_fim
hard
{ "lang": "python", "repo": "polarcoconut/thesis-reactive-learning", "path": "/plotRunLots.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> bestStrategies = pickle.load(open( "results/runlotsStrategiesHR50,2500,2000,50", "rb")) fig, ax = plt.subplots() ax.matshow(bestStrategies, cmap = plt.cm.gray_r) #ax.set_xticklabels(budgets) plt.xticks(range(len(budgets)), budgets) ax.xaxis.set_label_position('top') ax.set_xlabel("Budget...
code_fim
medium
{ "lang": "python", "repo": "polarcoconut/thesis-reactive-learning", "path": "/plotRunLots.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> def test_splash_request_has_history_option_on(self): request = self.prepared_get() splash_request = self.adapter.adapt_request(request) self.assertEqual(json.loads(splash_request.body)['history'], 1)<|fim_prefix|># repo: AntoineCezar/requests-splash path: /tests/test_request...
code_fim
hard
{ "lang": "python", "repo": "AntoineCezar/requests-splash", "path": "/tests/test_request_adapter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: AntoineCezar/requests-splash path: /tests/test_request_adapter.py import unittest import json import requests from requests_splash.request_adapter import RequestAdapter class TestAdaptRequest(unittest.TestCase): def setUp(self): self.splash_url = 'http://localhost:8085' s...
code_fim
hard
{ "lang": "python", "repo": "AntoineCezar/requests-splash", "path": "/tests/test_request_adapter.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> splash_request = self.adapter.adapt_request(request) self.assertEqual(json.loads(splash_request.body)['html'], 1) def test_splash_request_has_history_option_on(self): request = self.prepared_get() splash_request = self.adapter.adapt_request(request) self.ass...
code_fim
hard
{ "lang": "python", "repo": "AntoineCezar/requests-splash", "path": "/tests/test_request_adapter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jonasvr/kvdt path: /resources/workarea/setalarm.py import urllib2 import urllib from crontab import CronTab #get time to set clock url = 'http://kvdt.eu/api/setalarm' device_id = 'w@test123' <|fim_suffix|>#check if time is changed file = open("/home/pi/Desktop/workarea/alarm.txt","r") time = f...
code_fim
hard
{ "lang": "python", "repo": "jonasvr/kvdt", "path": "/resources/workarea/setalarm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#check if time is changed file = open("/home/pi/Desktop/workarea/alarm.txt","r") time = file.read() file.close() if response != time: #if changed: save new time & set cron file.close() file = open("/home/pi/Desktop/workarea/alarm.txt","w") file.write(response) file.close() arr...
code_fim
hard
{ "lang": "python", "repo": "jonasvr/kvdt", "path": "/resources/workarea/setalarm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #set cronjob cron = CronTab(user=True) cron.remove_all(comment='clock') job = cron.new(command='python /home/pi/Desktop/workarea/play.py', comment='clock') job.hour.on(hour) job.minutes.on(minutes) cron.write()<|fim_prefix|># repo: jonasvr/kvdt path: /resources/workarea/setala...
code_fim
hard
{ "lang": "python", "repo": "jonasvr/kvdt", "path": "/resources/workarea/setalarm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vhte/bagpipewriter path: /bagpipemanager/embellishments.py class Embellishments: GRACE_NOTES = r"([a-g,t]{1}g)" DOUBLINGS = r"([a-z]{0,1}db[a-z]{1,2})" GRACE_NOTES_STRIKES_STRIKES = r"([a-z]{0,2}st[a-z]{1,3})" PELES = r"([a-z]{0,2}pel[a-z]{1,2})" BIRLS = r"([a-z]{0,1}br[a-z]{0...
code_fim
medium
{ "lang": "python", "repo": "vhte/bagpipewriter", "path": "/bagpipemanager/embellishments.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return [ self.GRACE_NOTES, self.DOUBLINGS, self.GRACE_NOTES_STRIKES_STRIKES, self.PELES, self.BIRLS, self.D_THROWS, self.GRIPS, self.TAORLUATHS, self.BUBBLYS, ]<|fim_prefix|># repo: ...
code_fim
medium
{ "lang": "python", "repo": "vhte/bagpipewriter", "path": "/bagpipemanager/embellishments.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ToucanToco/weaverbird path: /server/src/weaverbird/backends/mongo_translator/steps/replacetext.py from weaverbird.backends.mongo_translator.steps.types import MongoStep from weaverbird.pipeline.steps.replacetext import ReplaceTextStep <|fim_suffix|> return [ { "$set": { ...
code_fim
hard
{ "lang": "python", "repo": "ToucanToco/weaverbird", "path": "/server/src/weaverbird/backends/mongo_translator/steps/replacetext.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return [ { "$set": { step.search_column: { "$replaceAll": { "input": f"${step.search_column}", "find": step.old_str, "replacement": step.new_str, } ...
code_fim
hard
{ "lang": "python", "repo": "ToucanToco/weaverbird", "path": "/server/src/weaverbird/backends/mongo_translator/steps/replacetext.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> text = str(self.process.readAllStandardError(), 'utf-8') self.append(text) u"""提取各项参数""" def extract_parameters(self): u""" 提取各项参数 """ parameters = {} for key, value in self.parameters.items(): element = get_key_by_va...
code_fim
hard
{ "lang": "python", "repo": "wxlg1117/kcptun_gui_qt5", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wxlg1117/kcptun_gui_qt5 path: /main.py #!/usr/bin/env python3 # -*- coding:utf-8 -*- u""" 2017.12.07 学习使用PyQt5 """ import os import sys import json from copy import deepcopy from functools import partial from itertools import chain from PyQt5.QtCore import * from PyQt5.QtGui import Q...
code_fim
hard
{ "lang": "python", "repo": "wxlg1117/kcptun_gui_qt5", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> u"""运行kcptun""" def start_kcptun(self): u""" 运行 """ cmds = [self.__config__['exe']] if self.__config__['config'] and self.__config__['config_path']: cmds.append("-c") cmds.append(self.__config__['config_path']) else: ...
code_fim
hard
{ "lang": "python", "repo": "wxlg1117/kcptun_gui_qt5", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ranksense/google-analytics path: /googleanalytics/segments.py # encoding: utf-8 """ Chaining for filters and segments. """ def condition(value): return "condition::" + value def sequence(value): <|fim_suffix|> return condition(",".join(values)) def followed_by(*values): return sequ...
code_fim
medium
{ "lang": "python", "repo": "ranksense/google-analytics", "path": "/googleanalytics/segments.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> return sequence(";->>".join(values)) def immediately_followed_by(*values): return sequence(";->".join(values))<|fim_prefix|># repo: ranksense/google-analytics path: /googleanalytics/segments.py # encoding: utf-8 """ Chaining for filters and segments. """ def condition(value): return "condi...
code_fim
medium
{ "lang": "python", "repo": "ranksense/google-analytics", "path": "/googleanalytics/segments.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> return condition(",".join(values)) def followed_by(*values): return sequence(";->>".join(values)) def immediately_followed_by(*values): return sequence(";->".join(values))<|fim_prefix|># repo: ranksense/google-analytics path: /googleanalytics/segments.py # encoding: utf-8 """ Chaining for ...
code_fim
medium
{ "lang": "python", "repo": "ranksense/google-analytics", "path": "/googleanalytics/segments.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: aritra1911/firefly path: /movie_writer.py import subprocess from constants import * class MovieWriter: def __init__(self, width, height, frame_rate): width = width height = height fps = frame_rate movie_file_extension = DEFAULT_MOVIE_EXTENSION file_pat...
code_fim
hard
{ "lang": "python", "repo": "aritra1911/firefly", "path": "/movie_writer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def open_movie_pipe(self): self.writing_process = subprocess.Popen( self.command, stdin=subprocess.PIPE ) def write_frame(self, frame): self.writing_process.stdin.write(frame.tostring()) def close_movie_pipe(self): self.writing_process....
code_fim
hard
{ "lang": "python", "repo": "aritra1911/firefly", "path": "/movie_writer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: greenhandatsjtu/douban_crawler path: /doudan_crawler/spiders/douban.py # -*- coding: utf-8 -*- import re from scrapy import Request from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from ..items import FilmItem, CommentItem from .. import settings cl...
code_fim
hard
{ "lang": "python", "repo": "greenhandatsjtu/douban_crawler", "path": "/doudan_crawler/spiders/douban.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # 编剧 text = response.css('#info>span').re_first(".*编剧.*") # 有些电影没有编剧,需要进行判断 if text: screenwriter = re.findall("<a.*?>(.*?)</a>", text) item['screenwriter'] = ','.join(screenwriter[:5]) # 只取前5个 else: item['screenwriter'] = str() ...
code_fim
hard
{ "lang": "python", "repo": "greenhandatsjtu/douban_crawler", "path": "/doudan_crawler/spiders/douban.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class CommentSpider(CrawlSpider): custom_settings = { 'ITEM_PIPELINES': { 'doudan_crawler.pipelines.CommentPipeline': 300, } } name = 'comment' allowed_domains = ['douban.com'] start_urls = settings.start_urls # extract film link rules = ( #...
code_fim
hard
{ "lang": "python", "repo": "greenhandatsjtu/douban_crawler", "path": "/doudan_crawler/spiders/douban.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> optimizer = 'Adam' max_grad_norm = 5 batch_size = 128 n_hidden = 128 ckp_dir = 'output/buzzer/rnn_buzzer.ckp' model_dir = 'output/buzzer/rnn_buzzer.npz'<|fim_prefix|># repo: ksjpswaroop/qb path: /qanta/buzzer/configs.py class mlp(): optimizer = 'Adam' max_grad_norm = 5 ...
code_fim
easy
{ "lang": "python", "repo": "ksjpswaroop/qb", "path": "/qanta/buzzer/configs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ksjpswaroop/qb path: /qanta/buzzer/configs.py class mlp(): optimizer = 'Adam' max_grad_norm = 5 batch_size = 128 n_hidden = 200 n_layers = 3 dropout = 0.3 step_size = 1 neg_weight = 1 batch_norm = True ckp_dir = 'output/buzzer/mlp_buzzer.ckp' model_dir ...
code_fim
easy
{ "lang": "python", "repo": "ksjpswaroop/qb", "path": "/qanta/buzzer/configs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SchusterLab/slab path: /slab/experiments/Nitrogen/ExpLib/QubitPulseSequenceExperiment.py __author__ = 'Nelson' from slab import * from slab.instruments.Alazar import Alazar from slab.experiments.Nitrogen.General.PulseSequences.SingleQubitPulseSequences import * from slab.experiments.Nitrogen.Mul...
code_fim
hard
{ "lang": "python", "repo": "SchusterLab/slab", "path": "/slab/experiments/Nitrogen/ExpLib/QubitPulseSequenceExperiment.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.adc==None: print("Prep Card") adc = Alazar(self.cfg['alazar']) else: adc = self.adc expt_data = None current_data = None for ii in tqdm(arange(max(1, self.cfg[self.expt_cfg_name]['averages'] / 100))): tpts, ch...
code_fim
hard
{ "lang": "python", "repo": "SchusterLab/slab", "path": "/slab/experiments/Nitrogen/ExpLib/QubitPulseSequenceExperiment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mumudexiaomuwu/Python24 path: /03Thread/day01/basic01.py """ TCP 三次握手原理: 1- client -> server 我可以和你吃饭吗? server收到客户端的SYN 2- server -> client 好的 回复ACK允许建立连接 3- client -> server 开始发送信息 <|fim_suffix|> # 设置socket断开连接的选项,close的时候会立即释放,答应断开分手,1表示确定,0为取消 server_socket.setsockopt(so...
code_fim
hard
{ "lang": "python", "repo": "mumudexiaomuwu/Python24", "path": "/03Thread/day01/basic01.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>""" 1- 并发: 多个任务在**同一时间段**执行,每个任务分配时间段执行,来回切换 2- 并行: 发生在多核cpu,多个任务在**同一时间点**执行 网站的并发量是多少:意思就是在一段时间段内的请求数量是多少 """<|fim_prefix|># repo: mumudexiaomuwu/Python24 path: /03Thread/day01/basic01.py """ TCP 三次握手原理: 1- client -> server 我可以和你吃饭吗? server收到客户端的SYN 2- server -> client 好的 ...
code_fim
hard
{ "lang": "python", "repo": "mumudexiaomuwu/Python24", "path": "/03Thread/day01/basic01.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 设置socket断开连接的选项,close的时候会立即释放,答应断开分手,1表示确定,0为取消 server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) """ """ TCP/IP协议并不是单一的协议,而是一族协议 在TCP/IP协议中简单的划分了四层:应用层,运输层,网际层,网络接口层 而在OSI协议中有7层:应用层,表示层,会话层,传输层,网络层,数据链路层,物理层 """ """ 1- 并发: 多个任务在**同一时间段**执行,每个任务分配时间段执行,来回切换 ...
code_fim
medium
{ "lang": "python", "repo": "mumudexiaomuwu/Python24", "path": "/03Thread/day01/basic01.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eclipse-ib/Software-University-Fundamentals_Module path: /03-Lists_Basics/Exercises/7-Easter_Gifts.py gifts = input().split() while True: command = input() list_command = command.split() if command == "No Money": break elif "OutOfStock" in command: none_gift = li...
code_fim
hard
{ "lang": "python", "repo": "eclipse-ib/Software-University-Fundamentals_Module", "path": "/03-Lists_Basics/Exercises/7-Easter_Gifts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>se" in command: replace_gift = list_command[1] gifts.pop() gifts.append(replace_gift) while "None" in gifts: gifts.remove("None") new_list_gifts = " ".join(gifts) print(f"{new_list_gifts}")<|fim_prefix|># repo: eclipse-ib/Software-University-Fundamentals_Module path: /03-Lists...
code_fim
hard
{ "lang": "python", "repo": "eclipse-ib/Software-University-Fundamentals_Module", "path": "/03-Lists_Basics/Exercises/7-Easter_Gifts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ 发送通知 :param message: :return: """ interval = 60 * 30 if self._get_self_name() in self._lastNotifyTime.keys(): now = datetime.datetime.now() last_time = self._lastNotifyTime[self._get_self_name()] if (now - last...
code_fim
medium
{ "lang": "python", "repo": "john123951/gold.icbc.watcher", "path": "/src/watcher/PageWatcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: john123951/gold.icbc.watcher path: /src/watcher/PageWatcher.py # -*- coding:utf-8 -*- from pyquery import PyQuery as pq from notify.PushNotify import PushNotify import datetime class PageWatcher(object): def __init__(self): self._push = PushNotify() self._lastNotifyTime = {}...
code_fim
hard
{ "lang": "python", "repo": "john123951/gold.icbc.watcher", "path": "/src/watcher/PageWatcher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ 获取要监视的页面url :return: String """ pass def process(self, document): """ 处理程序 :param document: :return: """ pass def notify(self, message): """ 发送通知 :param message: :return: ...
code_fim
medium
{ "lang": "python", "repo": "john123951/gold.icbc.watcher", "path": "/src/watcher/PageWatcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r'[^"$\\]+' t.lexer.lineno += len(t.value.split('\n')) - 1 if ws.match(t.value): t.type = 'WS' return t # def t_vars_XMLCOMMENT(t): # r'<!--.*?-->' # t.lexer.lineno += len(t.value.split('\n')) - 1 # t.value = t.value[4:-3] # # TODO: ignoring these tokens for now... the re...
code_fim
hard
{ "lang": "python", "repo": "k3online/js2esi", "path": "/js2esi/token/dtokens.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def t_xmlattrvalue_expr_exprlist_newline(t): r'\n+' t.lexer.lineno += len(t.value) def t_xmlattrvalue_expr_exprlist_SYMBOL(t): r'[a-zA-Z_][a-zA-Z_0-9]*' return t # tbd: this is not correct... these states can be pushed in an XML attribute, # where XML comments are not legal... ugh...
code_fim
hard
{ "lang": "python", "repo": "k3online/js2esi", "path": "/js2esi/token/dtokens.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: k3online/js2esi path: /js2esi/token/dtokens.py """ js2esi.token.dtokens ply.lex token definitions for esi-to-js decompilation Generates esi-to-js decompilation lexer tokens. Note the following token naming pattern: sCOMMAND start ESI open element, eg "<esi:assign" oCOMMAND opening ESI elem...
code_fim
hard
{ "lang": "python", "repo": "k3online/js2esi", "path": "/js2esi/token/dtokens.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mxterry/py-fortranformat path: /tests/misc/g-config-input-tests.py import unittest import os import sys # sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) from fortranformat._input import input as _input from fortranformat._lexer import lexer as _lexer from fortranformat._...
code_fim
hard
{ "lang": "python", "repo": "mxterry/py-fortranformat", "path": "/tests/misc/g-config-input-tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # By default G_INPUT_TRIAL_EDS is set to ['F', 'L', 'A'] see if # combination of different values gives correct results inpt = ' R3.1' fmt = '(2G3.1)' eds, rev_eds = _parser(_lexer(fmt)) result = [' R', 3.1] self.assertEqual(result, _input(eds, rev...
code_fim
hard
{ "lang": "python", "repo": "mxterry/py-fortranformat", "path": "/tests/misc/g-config-input-tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Try custom list of edit descriptors config.G_INPUT_TRIAL_EDS = ['Z', 'A'] inpt = ' L0' fmt = '(G3.1)' eds, rev_eds = _parser(_lexer(fmt)) result = [' L0'] self.assertEqual(result, _input(eds, rev_eds, inpt))<|fim_prefix|># repo: mxterry/py-fortranf...
code_fim
hard
{ "lang": "python", "repo": "mxterry/py-fortranformat", "path": "/tests/misc/g-config-input-tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Get the profile, the `save` method above creates a profile for each # user because it calls the manager method `create_user`. # See: https://github.com/django-userena-ce/django-userena-ce/blob/master/userena/managers.py#L65 profile = new_user.my_profile profile.ge...
code_fim
hard
{ "lang": "python", "repo": "acer1832a/myQuestionnaireSite", "path": "/accounts/forms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: acer1832a/myQuestionnaireSite path: /accounts/forms.py from django import forms from django.utils.translation import ugettext_lazy as _ from userena.forms import SignupForm from .models import MyProfile class SignupFormExtra(SignupForm): blank_choice = (('', _('Please choose an option')),) ...
code_fim
hard
{ "lang": "python", "repo": "acer1832a/myQuestionnaireSite", "path": "/accounts/forms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Override the save method to save the first and last name to the user field. """ # First save the parent form and get the user. new_user = super(SignupFormExtra, self).save() # Get the profile, the `save` method above creates a profile for each ...
code_fim
medium
{ "lang": "python", "repo": "acer1832a/myQuestionnaireSite", "path": "/accounts/forms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self, input: torch.Tensor, input_lengths: torch.Tensor ) -> Tuple[torch.Tensor, torch.Tensor]: """Forward.""" output = self.linear_out(self.dropout(input)) return output, input_lengths # no state in this layer def output_size(self) -> int: """Get the outpu...
code_fim
medium
{ "lang": "python", "repo": "espnet/espnet", "path": "/espnet2/asr/preencoder/linear.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: espnet/espnet path: /espnet2/asr/preencoder/linear.py #!/usr/bin/env python3 # 2021, Carnegie Mellon University; Xuankai Chang # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Linear Projection.""" <|fim_suffix|> self, input: torch.Tensor, input_lengths: torch.Tensor ...
code_fim
hard
{ "lang": "python", "repo": "espnet/espnet", "path": "/espnet2/asr/preencoder/linear.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Main arguments srcdir = os.path.join(os.getcwd(), "docs/source/") confdir = os.path.join(os.getcwd(), "docs/source/") builddir = os.path.join(os.getcwd(), "docs/build/") doctreedir = os.path.join(os.getcwd(), "docs/build/doctres") builder = "html" # Write warning messages to a file (instead of stderr)...
code_fim
medium
{ "lang": "python", "repo": "risoms/mdl", "path": "/docs/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Create the Sphinx application object app = Sphinx(srcdir, confdir, builddir, doctreedir, builder) # Run the build app.build()<|fim_prefix|># repo: risoms/mdl path: /docs/run.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 15 12:35:53 2019 @author: mdl-admin """ import os fro...
code_fim
hard
{ "lang": "python", "repo": "risoms/mdl", "path": "/docs/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: risoms/mdl path: /docs/run.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 15 12:35:53 2019 @author: mdl-admin """ import os from sphinx.application import Sphinx <|fim_suffix|># Create the Sphinx application object app = Sphinx(srcdir, confdir, builddir, doctreedir, b...
code_fim
hard
{ "lang": "python", "repo": "risoms/mdl", "path": "/docs/run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Construct a new OpenStack provider class.""" self._cloud = openstack.connect() self._stack_name = stack_name def get_ext_ip_addr(self, node_name): """Get external IP address of Task Manager node.""" node = self._cloud.get_server(node_name) if node is...
code_fim
medium
{ "lang": "python", "repo": "lanl/BEE", "path": "/beeflow/common/cloud/openstack.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lanl/BEE path: /beeflow/common/cloud/openstack.py """OpenStack provider module.""" import openstack from beeflow.common.cloud import provider from beeflow.common.cloud.cloud import CloudError class OpenstackProvider(provider.Provider): <|fim_suffix|> """Construct a new OpenStack provider...
code_fim
medium
{ "lang": "python", "repo": "lanl/BEE", "path": "/beeflow/common/cloud/openstack.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ezarowny/hey-look-a-todo-app path: /todo/views.py from rest_framework.permissions import IsAuthenticated from rest_framework import viewsets from todo.models import ToDo, ToDoList from todo.permissions import IsOwner from todo.serializers import ToDoSerializer, ToDoListSerializer <|fim_suffix|>...
code_fim
medium
{ "lang": "python", "repo": "ezarowny/hey-look-a-todo-app", "path": "/todo/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class ToDoListViewSet(viewsets.ModelViewSet): """ API endpoint that allows ToDoLists to be viewed or edited. """ queryset = ToDoList.objects.all() serializer_class = ToDoListSerializer permission_classes = (IsAuthenticated, IsOwner) def get_queryset(self): user = self....
code_fim
medium
{ "lang": "python", "repo": "ezarowny/hey-look-a-todo-app", "path": "/todo/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_spur.py #calss header class _SPUR(): def __init__(self,): self.name = "SPUR" self.definitions = [u'a sharp, wheel-shaped metal object that is attached to the heel of boots worn by people riding horses and is used to encourage the horse to go f...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_spur.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eoner/WaveRNN path: /utils/text/numbers_tr.py # -*- coding: utf-8 -*- """ Numeric to word convertor in Turkish Copyright (c) 2017 Munich Artificial Intelligence Laboratories GmbH (M-AILABS) Created: 2017-02-25 ??:?? CET, KA eoner: Added ordinal, percent, .5 (bucuk) handling """ import sys im...
code_fim
hard
{ "lang": "python", "repo": "eoner/WaveRNN", "path": "/utils/text/numbers_tr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return m.group(1).replace('.', '') def _expand_ordinal(m): num = _num_to_words(int(m.group(0)[:-2])) for suffix, replacement in _ordinal_suffixes: if num.endswith(suffix): return num[:-len(suffix)] + replacement+ ' ' return num + '.' def _replace_apostroph(m): if...
code_fim
hard
{ "lang": "python", "repo": "eoner/WaveRNN", "path": "/utils/text/numbers_tr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># # The code below can be used to generate a setup.info, which can then be used # # to feed a totally new build tool # from toydist import \ # distutils_to_package_description, static_representation # # pkg = distutils_to_package_description(dist) # print static_representation(pkg)<|fim_prefix|>#...
code_fim
medium
{ "lang": "python", "repo": "stefanv/toydist", "path": "/examples/simple3/setup.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: stefanv/toydist path: /examples/simple3/setup.py """A trivial package with some C code.""" from distutils.core import setup, Extension <|fim_suffix|># # The code below can be used to generate a setup.info, which can then be used # # to feed a totally new build tool # from toydist import \ # ...
code_fim
medium
{ "lang": "python", "repo": "stefanv/toydist", "path": "/examples/simple3/setup.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> hint = f'【{self.session_type}】{direction} by{api}\nScript: {script}' return [ResponseMsg(hint), ResponseMsg(translator.translate(script=script))] class TranslationAPI: def __init__(self, direction='auto2zh'): self.direction = direction def translate(self, scrip...
code_fim
hard
{ "lang": "python", "repo": "paidpay/MultiBot", "path": "/sessions/translation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: paidpay/MultiBot path: /sessions/translation.py from MultiBot.sessions.argument import ArgSession, Argument from MultiBot.responses import ResponseMsg from MultiBot.api_tokens import CAIYUN_TRANS_TOKEN, TCT_SECRET_ID, TCT_SECRET_KEY import requests, json class TranslationSession(ArgSessio...
code_fim
hard
{ "lang": "python", "repo": "paidpay/MultiBot", "path": "/sessions/translation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def translate(self, script: str): import json from tencentcloud.common import credential from tencentcloud.common.profile.client_profile import ClientProfile from tencentcloud.common.profile.http_profile import HttpProfile from tencentcloud.common.exception...
code_fim
hard
{ "lang": "python", "repo": "paidpay/MultiBot", "path": "/sessions/translation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>setup( name="pyobjc-framework-CoreServices", description="Wrappers for the framework CoreServices on macOS", packages=["CoreServices"] + subpackages, ext_modules=[ Extension( "CoreServices._inlines", ["Modules/_CoreServices_inlines.m"], extra_lin...
code_fim
hard
{ "lang": "python", "repo": "ronaldoussoren/pyobjc", "path": "/pyobjc-framework-CoreServices/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ronaldoussoren/pyobjc path: /pyobjc-framework-CoreServices/setup.py """ Wrappers for the "CoreServices" framework on macOS. These wrappers don't include documentation, please check Apple's documentation for information on how to use this framework and PyObjC's documentation for general tips and ...
code_fim
medium
{ "lang": "python", "repo": "ronaldoussoren/pyobjc", "path": "/pyobjc-framework-CoreServices/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>VERSION = "9.2.1" subpackages = [ f"CoreServices.{fn}" for fn in os.listdir("Lib/CoreServices") if os.path.exists(os.path.join("Lib/CoreServices", fn, "__init__.py")) ] setup( name="pyobjc-framework-CoreServices", description="Wrappers for the framework CoreServices on macOS", pa...
code_fim
medium
{ "lang": "python", "repo": "ronaldoussoren/pyobjc", "path": "/pyobjc-framework-CoreServices/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # split into multiple messages based on reply length BLOCK_QUOTES = "```" len_limit = int(os.environ.get("DISCORD_MSG_CHAR_LIMIT")) - len(BLOCK_QUOTES) replies = split_string(reply, len_limit, "\n") # preserve blockquotes for i, r in enumerate(replies): if i == len(repli...
code_fim
hard
{ "lang": "python", "repo": "clandestine8/vdator", "path": "/vdator/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # only listens in bot and review channels if not (message.channel.name in BOT_CHANNELS or message.channel.name in REVIEW_CHANNELS): return # help command if message.content == "!help": reply = print_help() await client.send_message(message.channel, reply) return # self ...
code_fim
hard
{ "lang": "python", "repo": "clandestine8/vdator", "path": "/vdator/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: clandestine8/vdator path: /vdator/main.py from dotenv import load_dotenv import os, re, traceback # APIs import discord from discord import Emoji from discord.utils import get # parsers from helpers import balanced_blockquotes, split_string from url_parser import URLParser from paste_parser imp...
code_fim
hard
{ "lang": "python", "repo": "clandestine8/vdator", "path": "/vdator/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> env_params = EnvParams( iteration_timeout=1200, pose_delay=1, control_delay=0, state_delay=1, goal_spat_dist=1.0, goal_ang_dist=np.pi/2, dt=0.05, # 20 Hz path_limiter_max_dist=5.0, ) env = PlanEnv( costmap=test_maps[map_...
code_fim
medium
{ "lang": "python", "repo": "braincorp/bc-gym-planning-env", "path": "/bc_gym_planning_env/scripts/env_runners/rw_randomized_corridor_3_boxes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: braincorp/bc-gym-planning-env path: /bc_gym_planning_env/scripts/env_runners/rw_randomized_corridor_3_boxes.py """ Experiment, running an example planning environment based on real data case of corridor with three boxes, along with some randomization """ from __future__ import print_function from...
code_fim
hard
{ "lang": "python", "repo": "braincorp/bc-gym-planning-env", "path": "/bc_gym_planning_env/scripts/env_runners/rw_randomized_corridor_3_boxes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while not done: obs, reward, done, info = env.step(env.action_space.sample()) env.render() time.sleep(0.1)<|fim_prefix|># repo: braincorp/bc-gym-planning-env path: /bc_gym_planning_env/scripts/env_runners/rw_randomized_corridor_3_boxes.py """ Experiment, running an example pla...
code_fim
hard
{ "lang": "python", "repo": "braincorp/bc-gym-planning-env", "path": "/bc_gym_planning_env/scripts/env_runners/rw_randomized_corridor_3_boxes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: reiserm/Xana path: /Xana/XsvsAna/PhotonStats.py import numpy as np from .betaratio import betaratio from ..Xfit.FitPoissonGammaLikelihood import fit_pg_likelihood def prob2beta(prob, gproi): """Use betaratios to calculate the speckle contrast of a given data set of photon probabilities....
code_fim
medium
{ "lang": "python", "repo": "reiserm/Xana", "path": "/Xana/XsvsAna/PhotonStats.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for it in range(t.size): for iq in range(q.size): beta = contrast[0][it][iq, ratio + 1] v2_av[it + 1, iq + 1] = np.ma.mean(beta), np.ma.std(beta) v2_md[it + 1, iq + 1] = np.ma.median(beta), np.ma.std(beta) h = np.histogram(beta[~beta.mask], bins=...
code_fim
hard
{ "lang": "python", "repo": "reiserm/Xana", "path": "/Xana/XsvsAna/PhotonStats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HumbleLu/algorigthmsExercises path: /algo3_5.py class Edge: def __init__(self, v1, v2, weight): if v1 > v2: self.vertices = [v2, v1] else: self.vertices = [v1, v2] self.weight = weight def __eq__(self, other): """Override the defa...
code_fim
hard
{ "lang": "python", "repo": "HumbleLu/algorigthmsExercises", "path": "/algo3_5.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if len(linked_newcomponents) == 1: insert_ind = new_components.index( linked_newcomponents[0]) if len(linked_newcomponents[0]) >= len( linked_components[0]): ...
code_fim
hard
{ "lang": "python", "repo": "HumbleLu/algorigthmsExercises", "path": "/algo3_5.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if len(linked_newcomponents) == 2: insert_ind = new_components.index(linked_newcomponents[0]) new_components[insert_ind] = \ linked_newcomponents[0] + \ [v for v ...
code_fim
hard
{ "lang": "python", "repo": "HumbleLu/algorigthmsExercises", "path": "/algo3_5.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: raclab/RACLAB path: /Goruntu Isleme/ornek3.py #-*-coding: cp1254-*- ###Renk Filtresi Oluşturma### import numpy as np import cv2 ##renklerin filitre değerlerinin bulunması: #blue = np.uint8([[[255,0,0 ]]]) #hsv_blue = cv2.cvtColor(blue,cv2.COLOR_BGR2HSV) #print hsv_blue #[[[120 255 255]]] # #gre...
code_fim
hard
{ "lang": "python", "repo": "raclab/RACLAB", "path": "/Goruntu Isleme/ornek3.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _,cntr,_=cv2.findContours(red, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) for i,c in enumerate(cntr): if cv2.contourArea(c)<1000: continue x,y,w,h=cv2.boundingRect(c) cv2.rectangle(frame,(x,y),(x+w,y+h),(255,0,0),0) cv2.putText(frame,"Kirmizi",(x,y),cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255,0,0)) ...
code_fim
hard
{ "lang": "python", "repo": "raclab/RACLAB", "path": "/Goruntu Isleme/ornek3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xiaye0816/py_tools path: /py_tools/test/test.py from py_tools.config import APPLICATION_NAME from py_tools.config import DING_TALK_ROBOT_ACCESS_TOKEN from py_tools.config import TIAN_API_KEY <|fim_suffix|>print(APPLICATION_NAME) print(DING_TALK_ROBOT_ACCESS_TOKEN) print(TIAN_API_KEY) # ding_talk...
code_fim
medium
{ "lang": "python", "repo": "xiaye0816/py_tools", "path": "/py_tools/test/test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print(APPLICATION_NAME) print(DING_TALK_ROBOT_ACCESS_TOKEN) print(TIAN_API_KEY) # ding_talk_notify_util.send_robot_notify('哈哈') # print(stock_data_util.stock_data_query('sh600794')) # print(movie_util.check_movie_open_booking(1280791)) print(int(2.000001))<|fim_prefix|># repo: xiaye0816/py_tools path: /p...
code_fim
medium
{ "lang": "python", "repo": "xiaye0816/py_tools", "path": "/py_tools/test/test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: harshp8l/deep-learning-lang-detection path: /data/test/python/1d268644be5459147a3d85f8b36d388c18a28f09mips_tests.py # coding: utf-8 import sys sys.path.append("../") from src.program_controller import ProgramController if __name__ == '__main__': <|fim_suffix|> controller = ProgramC...
code_fim
hard
{ "lang": "python", "repo": "harshp8l/deep-learning-lang-detection", "path": "/data/test/python/1d268644be5459147a3d85f8b36d388c18a28f09mips_tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> controller = ProgramController() ##addi : R0 = 100 ##addi : R1 = 100 ##mul: r1 = r1*r0 ##add : R2 = R1 + R0 controller.pipeline.PC = ["00100010000000000000000001100100","00100010000000010000000001100100", "00000000000000010000100000011000", "0000000000...
code_fim
hard
{ "lang": "python", "repo": "harshp8l/deep-learning-lang-detection", "path": "/data/test/python/1d268644be5459147a3d85f8b36d388c18a28f09mips_tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: YiqunPeng/leetcode_pro path: /solutions/311_sparse_matrix_multiplication.py class Solution: def multiply(self, A: List[List[int]], B: List[List[int]]) -> List[List[int]]: """Hash table. """ ma, na = len(A), len(A[0]) m<|fim_suffix|>[j] for ka, va in da....
code_fim
hard
{ "lang": "python", "repo": "YiqunPeng/leetcode_pro", "path": "/solutions/311_sparse_matrix_multiplication.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>[j] for ka, va in da.items(): for kb, vb in db.items(): if ka[1] == kb[0]: res[ka[0]][kb[1]] += va * vb return res<|fim_prefix|># repo: YiqunPeng/leetcode_pro path: /solutions/311_sparse_matrix_multiplication.py class Solution: def multi...
code_fim
hard
{ "lang": "python", "repo": "YiqunPeng/leetcode_pro", "path": "/solutions/311_sparse_matrix_multiplication.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jade1998/LCFCN path: /src/models/base_networks/__init__.py from . import fcn8_resnet, fcn8_vgg16 def get_base(base_name, exp_dict, n_classes): if base_name == "fcn8_resnet": model = fcn8_resnet.FCN8() <|fim_suffix|> else: raise ValueError('%s does not exist' % base_n...
code_fim
medium
{ "lang": "python", "repo": "jade1998/LCFCN", "path": "/src/models/base_networks/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if base_name == "fcn8_resnet": model = fcn8_resnet.FCN8() elif base_name == "fcn8_vgg16": model = fcn8_vgg16.FCN8_VGG16(n_classes=n_classes) else: raise ValueError('%s does not exist' % base_name) return model<|fim_prefix|># repo: jade1998/LCFCN path: /src/m...
code_fim
easy
{ "lang": "python", "repo": "jade1998/LCFCN", "path": "/src/models/base_networks/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> else: raise ValueError('%s does not exist' % base_name) return model<|fim_prefix|># repo: jade1998/LCFCN path: /src/models/base_networks/__init__.py from . import fcn8_resnet, fcn8_vgg16 def get_base(base_name, exp_dict, n_classes): <|fim_middle|> if base_name == "fcn8_resnet": ...
code_fim
medium
{ "lang": "python", "repo": "jade1998/LCFCN", "path": "/src/models/base_networks/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: r3dcrosse/pong path: /Paddle.py """ Paddle is a moving paddle in a graphics window (David Wayman 2012) """ #from time import sleep #from random import randrange, random from graphics import * #from Ball import * <|fim_suffix|> def move(self, win, dy): self.pad.move(0, (dy - self.getMid...
code_fim
hard
{ "lang": "python", "repo": "r3dcrosse/pong", "path": "/Paddle.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def getLen(self): p1 = self.pad.getP1() p2 = self.pad.getP2() lengthPad = p1.getY() - p2.getY() #print "length", lengthPad return lengthPad def getMiddle(self): mid = self.pad.getCenter() #print "middle", mid.getY() return mid.getY() def move(self, win, dy): self.pad.move(0, (...
code_fim
hard
{ "lang": "python", "repo": "r3dcrosse/pong", "path": "/Paddle.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }