prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore, QtSvg from PyQt4.QtCore import QMimeData from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication from Orange.data.io import FileFormat class ImgFormat(FileFormat): @staticmethod def _get_buffer(size, filenam...
write
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore, QtSvg from PyQt4.QtCore import QMimeData from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication from Orange.data.io import FileFormat class ImgFormat(FileFormat): @staticmethod def _get_buffer(size, filenam...
_get_buffer
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore, QtSvg from PyQt4.QtCore import QMimeData from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication from Orange.data.io import FileFormat class ImgFormat(FileFormat): @staticmethod def _get_buffer(size, filenam...
_get_target
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore, QtSvg from PyQt4.QtCore import QMimeData from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication from Orange.data.io import FileFormat class ImgFormat(FileFormat): @staticmethod def _get_buffer(size, filenam...
_save_buffer
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore, QtSvg from PyQt4.QtCore import QMimeData from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication from Orange.data.io import FileFormat class ImgFormat(FileFormat): @staticmethod def _get_buffer(size, filenam...
_get_exporter
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore, QtSvg from PyQt4.QtCore import QMimeData from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication from Orange.data.io import FileFormat class ImgFormat(FileFormat): @staticmethod def _get_buffer(size, filenam...
_export
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore, QtSvg from PyQt4.QtCore import QMimeData from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication from Orange.data.io import FileFormat class ImgFormat(FileFormat): @staticmethod def _get_buffer(size, filenam...
_save_buffer
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore, QtSvg from PyQt4.QtCore import QMimeData from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication from Orange.data.io import FileFormat class ImgFormat(FileFormat): @staticmethod def _get_buffer(size, filenam...
_export
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore, QtSvg from PyQt4.QtCore import QMimeData from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication from Orange.data.io import FileFormat class ImgFormat(FileFormat): @staticmethod def _get_buffer(size, filenam...
_get_buffer
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore, QtSvg from PyQt4.QtCore import QMimeData from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication from Orange.data.io import FileFormat class ImgFormat(FileFormat): @staticmethod def _get_buffer(size, filenam...
_get_target
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore, QtSvg from PyQt4.QtCore import QMimeData from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication from Orange.data.io import FileFormat class ImgFormat(FileFormat): @staticmethod def _get_buffer(size, filenam...
_save_buffer
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore, QtSvg from PyQt4.QtCore import QMimeData from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication from Orange.data.io import FileFormat class ImgFormat(FileFormat): @staticmethod def _get_buffer(size, filenam...
_get_exporter
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore, QtSvg from PyQt4.QtCore import QMimeData from PyQt4.QtGui import QGraphicsScene, QGraphicsView, QWidget, QApplication from Orange.data.io import FileFormat class ImgFormat(FileFormat): @staticmethod def _get_buffer(size, filenam...
_export
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
def __init__(self,username=None,password=None,filter=None): ContentProvider.__init__(self,'hejbejse.tv','http://www.kynychova-tv.cz/',username,password,filter) opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookielib.LWPCookieJar())) urllib2.install_opener(opener) def capabilities(self): return ['...
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
ContentProvider.__init__(self,'hejbejse.tv','http://www.kynychova-tv.cz/',username,password,filter) opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookielib.LWPCookieJar())) urllib2.install_opener(opener)
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
return ['resolve','categories','list']
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
page = util.parse_html('http://www.kynychova-tv.cz/index.php?id=5') result = [] for title,uri in [(x.h3.text,x.h3.a['href']) for x in page.select('div.entry5') if x.h3]: item = self.dir_item() item['title'] = title item['url'] = uri result.append(item) return result
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
url = self._url(url) page = util.parse_html(url) result = [] for title,uri in [(x.img['title'],x['href']) for x in page.select('div.entry3')[0].findAll('a')]: item = self.video_item() item['title'] = title item['url'] = uri result.append(item) return result
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
item = item.copy() url = self._url(item['url']) page = util.parse_html(url) result = [] data=str(page.select('div.entry3 > center')[0]) resolved = resolver.findstreams(data,['<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]']) try: for i in resolved: item = self.video_item() item['title'] = i['name'] ...
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
return result[0]
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
return select_cb(result)
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
__init__
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
capabilities
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
categories
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
list
<|file_name|>hejbejse.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*- #/* # * Copyright (C) 2011 Ivo Brhel # * # * # * This Program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either ve...
resolve
<|file_name|>test_tutorial001.py<|end_file_name|><|fim▁begin|>from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { ...
<|file_name|>test_tutorial001.py<|end_file_name|><|fim▁begin|>from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { ...
response = client.get("/openapi.json") assert response.status_code == 200, response.text assert response.json() == openapi_schema
<|file_name|>test_tutorial001.py<|end_file_name|><|fim▁begin|>from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { ...
response = client.post("/files/") assert response.status_code == 422, response.text assert response.json() == file_required
<|file_name|>test_tutorial001.py<|end_file_name|><|fim▁begin|>from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { ...
response = client.post("/files/", json={"file": "Foo"}) assert response.status_code == 422, response.text assert response.json() == file_required
<|file_name|>test_tutorial001.py<|end_file_name|><|fim▁begin|>from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { ...
path = tmp_path / "test.txt" path.write_bytes(b"<file content>") client = TestClient(app) with path.open("rb") as file: response = client.post("/files/", files={"file": file}) assert response.status_code == 200, response.text assert response.json() == {"file_size": 14}
<|file_name|>test_tutorial001.py<|end_file_name|><|fim▁begin|>from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { ...
default_pydantic_max_size = 2 ** 16 path = tmp_path / "test.txt" path.write_bytes(b"x" * (default_pydantic_max_size + 1)) client = TestClient(app) with path.open("rb") as file: response = client.post("/files/", files={"file": file}) assert response.status_code == 200, response.text ...
<|file_name|>test_tutorial001.py<|end_file_name|><|fim▁begin|>from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { ...
path = tmp_path / "test.txt" path.write_bytes(b"<file content>") client = TestClient(app) with path.open("rb") as file: response = client.post("/uploadfile/", files={"file": file}) assert response.status_code == 200, response.text assert response.json() == {"filename": "test.txt"}
<|file_name|>test_tutorial001.py<|end_file_name|><|fim▁begin|>from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { ...
test_openapi_schema
<|file_name|>test_tutorial001.py<|end_file_name|><|fim▁begin|>from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { ...
test_post_form_no_body
<|file_name|>test_tutorial001.py<|end_file_name|><|fim▁begin|>from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { ...
test_post_body_json
<|file_name|>test_tutorial001.py<|end_file_name|><|fim▁begin|>from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { ...
test_post_file
<|file_name|>test_tutorial001.py<|end_file_name|><|fim▁begin|>from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { ...
test_post_large_file
<|file_name|>test_tutorial001.py<|end_file_name|><|fim▁begin|>from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/files/": { ...
test_post_upload_file
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib<|fim▁hole|>IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ------- ...
import json import os
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): <|fim_middle|> def strip_first_dir(full_path): return os.path.join(*(full_path.split(os.path.sep)[1:]...
"""Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ------- md5_hash: str md5 hash of data in file_path """ hash_md5 = hashlib.md5() with open(file_path, 'rb') as fhandle: for chunk in iter(lambda: fhandle.read(4096), b''): ...
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
return os.path.join(*(full_path.split(os.path.sep)[1:]))
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
count = 0 irmas_dict = dict() for root, dirs, files in os.walk(irmas_data_path): for directory in dirs: if 'Train' in directory: for root_, dirs_, files_ in os.walk( os.path.join(irmas_data_path, directory) ): for di...
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
count = 1 irmas_dict = dict() for root, dirs, files in os.walk(irmas_data_path): for directory in dirs: if 'Test' in directory: for root_, dirs_, files_ in os.walk( os.path.join(irmas_data_path, directory) ): for dir...
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
make_irmas_index(args.irmas_data_path) # make_irmas_test_index(args.irmas_data_path)
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
for root_, dirs_, files_ in os.walk( os.path.join(irmas_data_path, directory) ): for directory_ in dirs_: for root__, dirs__, files__ in os.walk( os.path.join(irmas_data_path, directory, directory...
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
if 'dru' in file: irmas_id_dru = file.split(']')[3] # Obtain id irmas_id_dru_no_wav = irmas_id_dru.split('.')[ 0 ] # O...
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
irmas_id_dru = file.split(']')[3] # Obtain id irmas_id_dru_no_wav = irmas_id_dru.split('.')[ 0 ] # Obtain id without '.wav' ...
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
irmas_id_nod = file.split(']')[3] # Obtain id irmas_id_nod_no_wav = irmas_id_nod.split('.')[ 0 ] # Obtain id without '.wav' ...
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
irmas_id = file.split(']')[2] # Obtain id irmas_id_no_wav = irmas_id.split('.')[ 0 ] # Obtain id without '.wav' ir...
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
for root_, dirs_, files_ in os.walk( os.path.join(irmas_data_path, directory) ): for directory_ in dirs_: for root__, dirs__, files__ in os.walk( os.path.join(irmas_data_path, directory, directory...
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
file_name = os.path.join( directory, directory_, file ) track_name = str(file_name.split('.wa')[0]) + '.txt' irmas_test_dict[count] = [f...
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
for root_, dirs_, files_ in os.walk( os.path.join(irmas_data_path, directory) ): for directory_ in dirs_: for root__, dirs__, files__ in os.walk( os.path.join(irmas_data_path, directory, directory...
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
file_name = os.path.join( directory, directory_, file ) track_name = str(file_name.split('.wa')[0]) + '.txt' irmas_dict[count] = [file_n...
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
PARSER = argparse.ArgumentParser(description='Make IRMAS index file.') PARSER.add_argument('irmas_data_path', type=str, help='Path to IRMAS data folder.') main(PARSER.parse_args())
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def <|fim_middle|>(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. ...
md5
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
strip_first_dir
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
make_irmas_index
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
make_irmas_test_index
<|file_name|>make_irmas_index.py<|end_file_name|><|fim▁begin|>import argparse import glob import hashlib import json import os IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json' def md5(file_path): """Get md5 hash of a file. Parameters ---------- file_path: str File path. Returns ...
main
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
btoi = {} for i, book in enumerate(bible): btoi[book['name'].lower()] = i return btoi
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
global bible, book_to_index try: bible = json.loads(open(BIBLE_FILE, encoding='utf-8-sig').read()) book_to_index = make_book_to_index(bible) return except BaseException as e: pass # We've tried nothing and we're all out of ideas, download a new bible. try: bib...
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
bot.sendMessage( HELP_STR, thread_id=message.thread_id, thread_type=message.thread_type)
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
return (0 <= book < len(bible) and 0 <= chapter < len(bible[book]['chapters']) and 0 <= verse < len(bible[book]['chapters'][chapter]))
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
return "{}\n - {} {}:{}".format( bible[book]["chapters"][chapter][verse], bible[book]["name"], chapter + 1, verse + 1)
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
if book_name.lower() not in book_to_index: return "Could not find book name: " + book_name book_i = book_to_index[book_name.lower()] if len(ref.split(':')) != 2: return 'Reference not in form "Book Chapter:Passage"' chapter, verse = ref.split(':') if not chapter.isnumeric(): ...
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
if 'passage' not in kwargs: book = random.randrange(len(bible)) chapter = random.randrange(len(bible[book]["chapters"])) verse = random.randrange(len(bible[book]["chapters"][chapter])) bot.sendMessage( get_quote(book, chapter, verse), thread_id=message...
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
return "Could not find book name: " + book_name
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
return 'Reference not in form "Book Chapter:Passage"'
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
return "Chapter must be an int"
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
return "Passage must be an int"
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
return "Verse or chapter out of range"
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
book = random.randrange(len(bible)) chapter = random.randrange(len(bible[book]["chapters"])) verse = random.randrange(len(bible[book]["chapters"][chapter])) bot.sendMessage( get_quote(book, chapter, verse), thread_id=message.thread_id, thread_type=message....
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
bot.sendMessage( get_quote_from_ref(kwargs['book'], kwargs['passage']), thread_id=message.thread_id, thread_type=message.thread_type)
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
make_book_to_index
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
plugin_setup
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
help_command
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
is_valid_quote
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
get_quote
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
get_quote_from_ref
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import json import random import requests from plugin import create_plugin from message import SteelyMessage HELP_STR = """ Request your favourite bible quotes, right to the chat. Usage: /bible - Random quote /bible Genesis 1:3 - Specific verse /bible hel...
passage_command
<|file_name|>weak_crypto.py<|end_file_name|><|fim▁begin|>from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa # Crypto and Cryptodome have same API if random(): from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA else: from Cryptodome.Pub...
BIG = 10000 EC_WEAK = ec.SECT163K1() # has key size of 163
<|file_name|>weak_crypto.py<|end_file_name|><|fim▁begin|>from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa # Crypto and Cryptodome have same API if random(): from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA else: from Cryptodome.Pub...
return RSA.generate(bits) # NOT OK
<|file_name|>weak_crypto.py<|end_file_name|><|fim▁begin|>from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa # Crypto and Cryptodome have same API if random(): from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA else: from Cryptodome.Pub...
return RSA.generate(bits) # OK
<|file_name|>weak_crypto.py<|end_file_name|><|fim▁begin|>from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa # Crypto and Cryptodome have same API if random(): from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA else: from Cryptodome.Pub...
return RSA.generate(bits)
<|file_name|>weak_crypto.py<|end_file_name|><|fim▁begin|>from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa # Crypto and Cryptodome have same API if random(): <|fim_middle|> else: from Cryptodome.PublicKey import DSA from Cryptodome.PublicKey im...
from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA
<|file_name|>weak_crypto.py<|end_file_name|><|fim▁begin|>from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa # Crypto and Cryptodome have same API if random(): from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA else: <|fim_middle|> ...
from Cryptodome.PublicKey import DSA from Cryptodome.PublicKey import RSA
<|file_name|>weak_crypto.py<|end_file_name|><|fim▁begin|>from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa # Crypto and Cryptodome have same API if random(): from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA else: from Cryptodome.Pub...
make_new_rsa_key_weak
<|file_name|>weak_crypto.py<|end_file_name|><|fim▁begin|>from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa # Crypto and Cryptodome have same API if random(): from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA else: from Cryptodome.Pub...
make_new_rsa_key_strong
<|file_name|>weak_crypto.py<|end_file_name|><|fim▁begin|>from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa # Crypto and Cryptodome have same API if random(): from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA else: from Cryptodome.Pub...
only_used_by_test
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from __future__ import absolute_import class BadOption(Exception): """ Incorrect HTTP API arguments """ pass class RenderError(Exception): """ Error rendering page """ pass class InternalError(Exception): """ Unhan...
class UnsupportedContentType(Exception): """ Request Content-Type is not supported """
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from __future__ import absolute_import class BadOption(Exception): <|fim_middle|> class RenderError(Exception): """ Error rendering page """ pass class InternalError(Exception): """ Unhandled internal error """ pa...
""" Incorrect HTTP API arguments """ pass
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from __future__ import absolute_import class BadOption(Exception): """ Incorrect HTTP API arguments """ pass class RenderError(Exception): <|fim_middle|> class InternalError(Exception): """ Unhandled internal error ""...
""" Error rendering page """ pass
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from __future__ import absolute_import class BadOption(Exception): """ Incorrect HTTP API arguments """ pass class RenderError(Exception): """ Error rendering page """ pass class InternalError(Exception): <|fim_mid...
""" Unhandled internal error """ pass
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from __future__ import absolute_import class BadOption(Exception): """ Incorrect HTTP API arguments """ pass class RenderError(Exception): """ Error rendering page """ pass class InternalError(Exception): """ Unhan...
""" Timeout exceeded rendering page """ pass
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from __future__ import absolute_import class BadOption(Exception): """ Incorrect HTTP API arguments """ pass class RenderError(Exception): """ Error rendering page """ pass class InternalError(Exception): """ Unhan...
""" Request Content-Type is not supported """ pass
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from __future__ import absolute_import class BadOption(Exception): """ Incorrect HTTP API arguments """ pass class RenderError(Exception): """ Error rendering page """ pass class InternalError(Exception): """ Unhan...
""" Arguments stored with ``save_args`` are expired """ pass
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from __future__ import absolute_import class BadOption(Exception): """ Incorrect HTTP API arguments """ pass class RenderError(Exception): """ Error rendering page """ pass class InternalError(Exception): """ Unhan...
""" Error happened while executing Lua script """ LUA_INIT_ERROR = 'LUA_INIT_ERROR' # error happened before coroutine starts LUA_ERROR = 'LUA_ERROR' # lua error() is called from the coroutine LUA_CONVERT_ERROR = 'LUA_CONVERT_ERROR' # result can't be converted to Python SPLASH_LUA_ERROR = 'SPLASH_...