text
stringlengths
17
737k
#This file is part of Tryton. The COPYRIGHT file at the top level #of this repository contains the full copyright notices and license terms. "Nereid CMS" from string import Template from nereid import render_template, current_app, cache, request from nereid.helpers import slugify, url_for, key_from_list, Pagination,...
from flask import Flask, abort, request import json app = Flask(__name__) descriptor = None data = None with open("./descriptor.json") as f: descriptor = json.loads(f.read()) with open("./data.json") as f: data = json.loads(f.read()) @app.route("/") def get_descriptor(): return json.dumps(descriptor) ...
import numpy as np from scipy.fftpack import fft, ifft, fftshift __all__ = ['cwt', 'ccwt', 'icwt', 'SDG', 'Morlet'] class MotherWavelet(object): """Class for MotherWavelets. Contains methods related to mother wavelets. Also used to ensure that new mother wavelet objects contain the minimum requirements ...
#exec(open('__init__.py').read()) #exec(open('_research/dev.py').read()) from __future__ import division, print_function import __builtin__ import argparse import textwrap import sys from os.path import join import multiprocessing import latex_formater as pytex import DataStructures as ds import matching_functions as m...
from ctypes import cdll mylib = cdll.LoadLibrary("osvrClientKit") def OSVR_ClientContext(Structure): pass def OSVR_ReturnCode(Structure): pass def OSVR_ClientInterface(Structure): pass def OSVR_DisplayConfigObject(Structure): pass def OSVR_DisplayDimension(Structure): pass def OSVR_ViewerCount(Str...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Basic file upload WSGI application (python >=2.6.x/>=3.x). This script brings up a simple_server from python's wsgiref package and runs a really simple web application on it. It allows to upload any file using multipart/form-data encoding. Don't use it in production en...
# -*- coding: utf-8 -*- # # ####################################################################################### # GEF - Multi-Architecture GDB Enhanced Features for Exploiters & Reverse-Engineers # # by @_hugsy_ ####################################################################################### # # GEF is a ki...
# -*- coding: utf-8 -*- # # ####################################################################################### # GEF - Multi-Architecture GDB Enhanced Features for Exploiters & Reverse-Engineers # # by @_hugsy_ ####################################################################################### # # GEF is a ki...
from Tkinter import Tk, RIGHT, LEFT, TOP, BOTTOM, BOTH, RAISED, END, SW, W, Listbox, StringVar from ttk import Frame, Button, Style, Label import sqlite3 class Database(object): def __init__(self, filename, table): self.connection = sqlite3.connect(filename) with self.connection: self....
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk from numpy import sin, linspace from matplotlib.figure import Figure from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as FigureCanvas from sympy import symbols, sympify from ...
#!/usr/bin/env python3 # # Got Your Back # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
# Copyright 2014 Yahoo! Inc. # Licensed under the Apache 2.0 license. Developed for Yahoo! by Sean Gillespie. # # Yahoo! licenses this file to you 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: # #...
#!/usr/bin/env python # -*- coding: utf-8 -*- import bs4 import urllib2 import gzip import StringIO BASE_URL = 'https://kat.cr/' class Category(object): ALL = 'all' MOVIES = 'movies' TV = 'tv' ANIME = 'anime' MUSIC = 'music' BOOKS = 'books' APPS = 'applications' GAMES = 'games' XX...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals import os import os.path import re import sys from argparse import ArgumentParser, Namespace from docutils import statemachine, nodes, io, utils from docutils.parsers import rst from docutils.core import ErrorString...
#!/usr/bin/env python # coding: utf-8 """ Usage: mdv [-t THEME] [-T C_THEME] [-x] [-l] [-L] [-c COLS] [-m] [MDFILE] Options: MDFIlE : path to markdown file -t THEME : key within the color ansi_table.json. 'random' accepted. -T C_THEME: pygments theme for code highlight. If not set: Use THEME. ...
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
#!/usr/bin/env python # coding: utf-8 ''' A very fast cross-platform multiple screenshots module in pure python using ctypes. This module is maintained by Mickaël Schoentgen <mickael@jmsinfo.co>. Note: please keep this module compatible to Python 2.6. You can always get the latest version of this mod...
#!/usr/bin/env python """ Copyright (c) 2011, Scott Burns All rights reserved. """ from argparse import ArgumentParser from multiprocessing import cpu_count from pdb import set_trace from nibble import config reload(config) from nibble import spm reload(spm) from nibble import util reload(util) try: from jobl...
import os import random import smart_open import pandas as pd import click N_POSITIVE = 99684 N_NEGATIVE = 996941 N_TOTAL = N_POSITIVE + N_NEGATIVE POSITIVE_RATIO = N_POSITIVE / N_TOTAL def read_submission(file): df = pd.read_csv(file) return df def validate_submission(submission, n_advertise): column...
#!/usr/bin/python from flask import Flask, make_response, jsonify, request, abort, url_for, \ render_template from flask.ext.httpauth import HTTPBasicAuth from flask.ext.pymongo import PyMongo from flask.ext.testing import TestCase from md5 import md5 from bson.json_util import dumps import code app = Flask(__nam...
#=============================================================================== # Copyright (C) 2011-2012 by Andrew Moffat # # 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 restrict...
import numpy as np class PCA: def __init__(self, dim = None, whiten = False, eps= 1.e-8): """PCA object that can be fit to and transform data. Args: dim: Dimensionality to reduce to. whiten: Flag that tell pca to whiten the data before return. Default is False ...
#! /usr/bin/python """ ppp.py peggy.pi.pic Take picture with Raspberry Pi camera and then display as 25 x 25 pixel image (16 shades) on Peggy2 """ # http://picamera.readthedocs.org/en/release-1.9/recipes1.html#capturing-to-a-pil-image import io import time import picamera from PIL import Image # Create the in-mem...
# #Runge-Kutta ODE solver #Author: Ian Huston #CVS: $Id: rk4.py,v 1.38 2010/01/18 16:57:02 ith Exp $ # from __future__ import division # Get rid of integer division problems, i.e. 1/2=0 import numpy as np import logging from helpers import seq #Proper sequencing of floats import helpers from configuration import _deb...
#!/usr/bin/env python # coding: utf-8 from datetime import datetime from distutils import spawn import argparse import json import os import platform import shutil import socket import sys import time import urllib import urllib2 import main from main import config ##################################################...
#!flask/bin/python import argparse import os.path from app import flask_application from install import dbUtil def main(): fontus = "A stripper well management tool based on Miguel Grinberg's Flask tutorial." usage = "usage: %prog [options] arg" parser = argparse.ArgumentParser(description=fontus) pa...
""" atlas.run.py ~~~~~~~~~~~ The API launch script. """ import os import sys import json import logging from logging.handlers import WatchedFileHandler import ssl from collections import Counter from eve import Eve from eve.auth import requires_auth from flask import jsonify, make_response, abort, request ...
#!/usr/bin/env python import os import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument('--run', action="store_true") parser.add_argument('--deploy', action="store_true") args = parser.parse_args() if not any(vars(args).values()): parser.print_help() elif args.run: os.system...
#!/usr/bin/env python3 # # Copyright 2018 Red Hat, Inc. # # Authors: # Paolo Bonzini <pbonzini@redhat.com> # # This work is licensed under the MIT License. Please see the LICENSE file or # http://opensource.org/licenses/MIT. from collections import OrderedDict from django.contrib.auth.models import User from djan...
# Django settings for farmer project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'farmer....
#!/usr/bin/python # Author: Chris Zacharias (chris@imgix.com) # Copyright (c) 2012, Zebrafish Labs Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of source code must ...
""" Classes and functions for quality assessment of FASTQ and SAM format NGS reads """ from __future__ import division import sys import os from six.moves import range, zip, map from six import string_types import math import matplotlib as mpl from itertools import groupby, islice if sys.platform is not 'darwin': ...
"""Utility functions to parse/create OpenFlow messages.""" # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation. # Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer. # Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd. # Copyright (C) 2015--2017 The Contributors # #...
import random import math import colorsys from tkinter import Tk, Canvas, PhotoImage, mainloop def mandelbrot(n, steps=20, threashold=2): z_prev = n z_cur = n in_mandelbrot_set = True for steps_taken in range(steps): z_prev = z_cur z_cur = z_prev**2 + n if abs(z_cur) > threasho...
# -*- coding: utf-8 -*- # TODO: create iso lens between sugar and non-sugar # TODO: supress + given a + (-b). i.e. want a - b from collections import namedtuple, deque from itertools import repeat from typing import Union from enum import Enum from sympy import Symbol VarKind = Enum("VarKind", ["x", "u", "w"]) str_to...
# Copyright (c) 2014, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. import stix import stix.common.identity from stix.common import Identity import stix.bindings.stix_common as stix_common_binding import stix.bindings.extensions.identity.ciq_identity_3_0 as ciq_identity_binding # x...
# Copyright 2008 Red Hat, Inc. # This file is part of python-fedora # # python-fedora is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later ...
# -*- coding: utf-8 -*- # Copyright 2016 ACSONE SA/NV (<http://acsone.eu>) # Copyright 2016 Eficent Business and IT Consulting Services S.L. # (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models, _ from odoo.tools.float_utils import floa...
#!/usr/bin/env python from argparse import ArgumentParser from os import mkdir from os.path import isfile, exists, join as pjoin from numpy import array, delete from biom.util import biom_open from biom.parse import parse_biom_table from americangut.generate_otu_signifigance_tables import ( calculate_abundance, ...
__author__ = 'Thierry Schellenbach' __copyright__ = 'Copyright 2012, Thierry Schellenbach' __credits__ = ['Thierry Schellenbach, mellowmorning.com, @tschellenbach'] __license__ = 'BSD' __version__ = '0.6.12' __maintainer__ = 'Thierry Schellenbach' __email__ = 'thierryschellenbach@gmail.com' __status__ = 'Production'
import os import json from datetime import datetime from urllib3.util.retry import Retry import requests from requests.adapters import HTTPAdapter from requests_futures.sessions import FuturesSession from usgs import USGS_API, USGSError, USGSAuthExpiredError, __version__ from usgs import payloads TMPFILE = os.path...
# coding: utf-8 """Setup lightgbm package.""" import logging import os import struct import subprocess import sys from distutils.dir_util import copy_tree, create_tree, remove_tree from distutils.file_util import copy_file from platform import system from typing import List, Optional from setuptools import find_packag...
#!/usr/bin/env python # -*- coding: utf-8 -*- """auth.py: basic web front-end to auth/de-auth ipaddrs using iptables. author: anton@belodedenko.me """ from subprocess import Popen, PIPE from collections import defaultdict import datetime, traceback, sys, socket from settings import (MAX_AUTH_IP_COUNT, SQLITE_DB, DEB...
from cStringIO import StringIO import argparse import contextlib import logging import os import sys from teuthology import misc as teuthology from teuthology import contextutil from teuthology.parallel import parallel from ..orchestra import run log = logging.getLogger(__name__) class DaemonState(object): def ...
#!/usr/bin/env python ################################################################# # python fitbit web client for uploading data to fitbit site # By Kyle Machulis <kyle@nonpolynomial.com> # http://www.nonpolynomial.com # # Distributed as part of the libfitbit project # # Repo: http://www.github.com/openyou/libfitb...
# coding: utf-8 """Information about mxnet.""" from __future__ import absolute_import import os import platform def find_lib_path(): """Find MXNet dynamic library files. Returns ------- lib_path : list(string) List of all found path to the libraries """ curr_path = os.path.dirname(os.p...
#!/usr/bin/env python from __future__ import print_function import argparse import logging import subprocess import sys from jujucharm import Charm from deploy_stack import BootstrapManager from utility import ( add_basic_testing_arguments, configure_logging, JujuAssertionError, temp_dir, ) __metacl...
# The MIT License # # Copyright (c) 2016 Jérémie DECOCK (www.jdhp.org) # # 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 limitation the rights # to use,...
# -*- coding: utf-8 -*- """ Autopilots for the DriveIt Gym environment. @author: Jean-Claude Manoli """ import numpy as np from belief import BeliefTracking from PositionTracking import PositionTracking epsilon = 0.05 class Autopilot(object): def __init__(self, car, other_cars=None, tracker_type=PositionTracking...
from operator import attrgetter import io import json import fcm from django.contrib.auth.decorators import login_required, user_passes_test from django.contrib.auth.models import User from django.core.exceptions import PermissionDenied from django.core.urlresolvers import reverse from django.http import \ HttpRe...
''' Created on 21 Feb 2013 @author: jmht ''' # Python modules import glob import logging import os import random import re import shutil import unittest # Our modules import add_sidechains_SCWRL import ample_sequence import ample_util import clusterize import octopus_predict import pdb_edit import workers def align...
import requests from ltk.api_uri import API_URI from ltk.utils import restart import ltk.utils from ltk.exceptions import RequestFailedError,ConnectionFailed from ltk.logger import logger import sys, os # Python 2 # import urlparse as parse # End Python 2 # Python 3 import urllib.parse as parse # End Python 3 class Ap...
# -*- coding: utf-8 -*- r""" This module implements function objects which are then passed to solvers. The :class:`func` base class defines the interface whereas specialised classes who inherit from it implement the methods. These classes include : * :class:`dummy`: A dummy function object which returns 0 for the ...
# Copyright 2015 datawire. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
# tsuserver3, an Attorney Online server # # Copyright (C) 2016 argoneus <argoneuscze@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at...
"""These classes hold methods to apply general filters to any data type. By inheriting these classes into the wrapped VTK data structures, a user can easily apply common filters in an intuitive manner. Example ------- >>> import pyvista >>> from pyvista import examples >>> dataset = examples.load_uniform() >>> # Thr...
"""These classes hold methods to apply general filters to any data type. By inheriting these classes into the wrapped VTK data structures, a user can easily apply common filters in an intuitive manner. Example ------- >>> import pyvista >>> from pyvista import examples >>> dataset = examples.load_uniform() >>> # Thr...
"""Options and Choices for :py:meth:`pywikibot.input_choice`.""" # # (C) Pywikibot team, 2015-2021 # # Distributed under the terms of the MIT license. # import re from abc import ABC, abstractmethod from textwrap import fill from typing import Any, Optional import pywikibot from pywikibot.backports import Iterable, ...
# -*- coding: utf-8 -*- """ femagtools.isa7 ~~~~~~~~~~~~~~~ Read FEMAG I7/ISA7 model files """ import logging import struct import sys import pdb import re import numpy as np from collections import Counter logger = logging.getLogger('femagtools.isa7') class Reader(object): """ Open and Read I7/...
""" JupyterHub Spawner to spawn user notebooks on a Kubernetes cluster. This module exports `KubeSpawner` class, which is the actual spawner implementation that should be used by JupyterHub. """ from functools import partial import os import string from urllib.parse import urlparse, urlunparse import multiprocessing ...
""" Views for api/va/transactions """ from itertools import chain from seven23.models.categories.models import Category from seven23.models.categories.serializers import CategorySerializer from seven23.models.transactions.models import DebitsCredits, Change from seven23.models.transactions.serializers import Debit...
import calendar import collections import logging import time import xml.etree.cElementTree as ET import base.api ATOM_NS = 'http://www.w3.org/2005/Atom' READER_NS = 'http://www.google.com/schemas/reader/atom/' def init(): ET.register_namespace('gr', READER_NS) ET.register_namespace('atom', ATOM_NS) ET.registe...
# -*- coding: utf-8 -*- """ Use blaze.bkernel to assemble ckernels for evaluation. """ from __future__ import print_function, division, absolute_import import collections from pykit.ir import interp, visit, transform, Op, FuncArg import blaze from blaze.bkernel import BlazeFuncDeprecated from blaze.bkernel.blaze_ke...
#!/usr/bin/python3 # -*- coding: utf-8 -*- import bcrypt import concurrent.futures import MySQLdb import markdown import os.path import json import subprocess import torndb import tornado.escape from tornado import gen import tornado.httpserver import tornado.ioloop import tornado.options import libs.common as common ...
import logging import gevent import pytest from dateutil.parser import parse as dateparse from zmq.utils import jsonapi as json logging.basicConfig(level=logging.DEBUG) from volttron.platform.vip.agent import Agent, Core, RPC from volttron.platform.messaging.health import STATUS_GOOD, STATUS_BAD, \ STATUS_UNKNOWN...
# -*- coding: UTF-8 -*- """ This module is used to preprocess corpora. """ import os import pickle import regex from langdist.util import CorpusParser from langdist.constant import CORPUS_DIR __author__ = 'kensk8er1017@gmail.com' _SENTENCE_BORDER_REGEX = regex.compile(r'[\.。.!?!?]') _MAX_PARAGRAPH_LEN = 500 def _...
# Copyright 2015 The Bazel Authors. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
"""Functions for attempting to de novo align unmapped reads. """ import os import subprocess from django.conf import settings from main.model_utils import clean_filesystem_location from main.model_utils import get_dataset_with_type from main.models import Dataset from main.models import get_or_create_derived_bam_dat...
# coding: utf-8 import time import os import stat def save_private_key(file_name, private_key): """ save ssh private key """ if not save_file(file_name, private_key): return False os.chmod(file_name, stat.S_IREAD + stat.S_IWRITE) return True def save_file(file_name, content): with open("%...
#!/usr/bin/env python import numpy as np import sys import audioLoopback, channelModel, maskNoise, wifi80211 import audio import pylab as pl wifi = wifi80211.WiFi_802_11() fn = '35631__reinsamba__crystal-glass.wav' Fs = 48000. Fc = 19000. #Fs/4 upsample_factor = 16 mask_noise = maskNoise.prepareMaskNoise(fn, Fs, Fc, ...
# Copyright 2015 datawire. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
""" Code for python planner """ import blockSim as BlockDet import twoWayDict as twd import navigation.nav as nav from datetime import datetime import comm.serial_interface as comm class Planner: nextSeaLandBlock = [] #list of the next available sea or land block to pick up nextAirBlock = [] #list of the 2 air bl...
from maraschino import app app._static_folder = '../static' app.run(debug=True)
#!/usr/bin/env python3 # https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.optimize.linprog.html from scipy.optimize import linprog from timfuz import Benchmark, Ar_di2np, Ar_ds2t, A_di2ds, A_ds2di, simplify_rows, loadc_Ads_b, index_names, A_ds2np, load_sub, run_sub_json, A_ub_np2d, print_eqns, print_e...
# # Copyright (c) 2004-2005 Specifix, Inc. # # This program is distributed under the terms of the Common Public License, # version 1.0. A copy of this license should have been distributed with this # source file in a file called LICENSE. If it is not present, the license # is always available at http://www.opensource.o...
from unittest import TestCase from pyproteome import pathways class PathwaysTest(TestCase): def test_gskb_pathways(self): for species in ["Mus musculus"]: gene_sets = pathways.get_gskb_pathways(species) for col in ["name", "set"]: self.assertIn(col, gene_sets.col...
import aiohttp import asyncio import discord import functools from io import BytesIO import numpy as np import os from PIL import Image from redbot.core import Config, checks, commands from redbot.core.utils.chat_formatting import box, pagify from redbot.core.data_manager import cog_data_path from wordcloud import Wor...
# # # Copyright (c) 2004 Anthony Baxter. # import socket def leaveGroup(sock,addr): """Join a multicast group. arguments: sock = an already open socket. addr = either a string, which will be passed to gethostbyname(), or a 32 bit number (the string can be a DNS name, or a dotted quad. ...
''' A program to turn a SCAMSources into a ds9 region files. ''' import phot_utils import Sources def fromFile(filename, outname, pixsize, color): with open(filename, "r") as catalog: sources = [Sources.SCAMSource(line) for line in catalog if phot_utils.no_head(line)] with open(outname, "w") as ou...
""" market_cap.py View the market capitalization of your coinex account. Uses bitstamp prices. OUTPUT: xxxx BTC xxxx USD """ import urllib.request import models import json from decimal import * # set the decimal precision to 8 getcontext().prec = 8 def get_bitstamp_price(): """ Get the price from bitsta...
#!/usr/bin/env python3 # This file is part of the MicroPython project, http://micropython.org/ # The MIT License (MIT) # Copyright (c) 2019 Damien P. George import os import subprocess import sys import argparse from glob import glob sys.path.append("../tools") import pyboard # Paths for host executables if os.name...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Program: Write to GSheets Programmer: Michael Fryar, Research Fellow, EPoD Date created: January 5, 2017 Purpose: Write to Google Sheets via API. """ # Note: Must first establish SSH connection to epodx analytics import csv import os import httplib2 import requests fr...
import os import subprocess from nose.tools import istest, assert_equal from whack.sources import PackageSourceFetcher from whack.tempdir import create_temporary_dir from whack.files import read_file, write_file @istest def can_fetch_package_source_from_source_control(): with create_temporary_dir() as package_s...
import logging from django.core.paginator import Paginator, InvalidPage from django.contrib.auth.models import User from django.conf.urls.defaults import url from django.shortcuts import get_object_or_404 from django.http import Http404 from haystack.query import SearchQuerySet from haystack.utils import Highlighter ...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2016 - now Bytebrand Outsourcing AG (<http://www.bytebrand.net>). # # This program is free software: you can redistribute it and/or modify # it...
import logging from modules.loggingFunctions import initialize_logging from modules.groupComparisons.handle_logical import handle_logical from modules.groupComparisons.logical_queries import query_targets from modules.groupComparisons.fishers import fishers from modules.decorators import tofromHumanReadable # logging ...
from webrecorder.basecontroller import BaseController from tempfile import SpooledTemporaryFile from bottle import request from pywb.warc.archiveiterator import ArchiveIterator from pywb.utils.loaders import LimitReader from pywb.cdx.cdxobject import CDXObject import traceback import json import requests import base...
import os import subprocess import sys from django.conf import settings from celery.decorators import task from repocracy.repo.models import Repository, Status, RepoTypes import mercurial.ui import mercurial.localrepo from mercurial.commands import pull import hggit import pexpect import shutil @task def translate_r...
import os import os.path import re import sys import topsort import datetime # the variables that are declared in the header file HEADER_DECLARATIONS = ["global", "globalDocument", "html", "canCall", "isHostObjectProperty"] GLOBAL_DIRECTIVE = "\/\*global\s(.*)\s+?\*\/" class Rendition(object): def __init__(sel...
import pytest # type: ignore from hypothesis import given from ppb_vector import Vector from utils import vector_likes, vectors def test_addition_vectors(): test_vector1 = Vector(1, 0) test_vector2 = Vector(0, 1) result = test_vector1 + test_vector2 assert result == Vector(1, 1) def test_addition_...
# -*- coding: utf-8 -*- from testino import ASGIAgent from fastapi import FastAPI app = FastAPI() @app.get("/users/{user_id}") def read_user(user_id: str): return {'user_id': user_id} def test_get(): agent = ASGIAgent(app) response = agent.get("/users/foo") assert response.json() == {'user_id': ...
# Copyright (C) 2006-2007 Jelmer Vernooij <jelmer@samba.org> # 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 version 2 of the License, or # (at your option) any later version. # This pr...
import pytest from katana.storage import Node, Pair, prepare from katana.compound import sequence, group, repeat, option, maybe from katana.term import term A = term('a') B = term('b') C = term('c') node = lambda x: Node(x, 'data') def test_sequence(): na = node('a') nb = node('b') s = sequence(A, B) ...
import os from tinydb import where, Query from tinydb.storages import MemoryStorage from passpie.database import Database, PasspieStorage from .helpers import MockerTestCase class StorageTests(MockerTestCase): def setUp(self): self.mock_os = self.patch('passpie.database.os') self.mock_shutil = ...
import kindred def test_document_str(): doc1 = kindred.Document('<disease id="T1">Cancer</disease> is caused by mutations in <gene id="T2">ABCDE1</gene>.') mapping1 = doc1.getSourceEntityIDsToEntityIDs() expected1 = "<Document Cancer is caused by mutations in ABCDE1. [<Entity disease:'Cancer' id=%d sourceid=T1 [(0,...
from nose.tools import assert_true, assert_equal import tempfile import datajoint as dj import os from .schema_external import Filepath def test_filepath(): """ test file management """ store = 'repo' stage_path = dj.config['stores'][store]['stage'] # create a mock file relpath = 'one/two/three'...
#!/usr/bin/env python """ mbed SDK Copyright (c) 2011-2015 ARM 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.apache.org/licenses/LICENSE-2.0 Unless required by applicable ...
from __future__ import unicode_literals from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models from django.test import TestCase from rest_framework import ( exceptions, metadata, serializers, status, versioning, views ) from rest_framework.renderers import BrowsableAP...
""" bedoperations_test ---------------------------------- Tests for `moca.bedoperations` module. """ import os import shutil import unittest from Bio import SeqIO from moca.helpers import get_cpu_count from moca.pipeline import Pipeline from moca.bedoperations import fimo_to_sites from moca.helpers import read_memefi...
import pathlib import click from snafu import utils from .common import version_command def download_installer(version): click.echo('Downloading {}'.format(version.url)) return utils.download_file(version.url, check=version.check_installer) @version_command() def download(ctx, version, dest_dir, force): ...