text
stringlengths
12
6.59M
# # Copyright (c) 2009 Wireless Generation, Inc. # # 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, copy, modify, merge, ...
#!/usr/bin/env python #----------------------- # Copyright 2014 Halfmoon Labs, Inc. # All Rights Reserved #----------------------- from flask import Flask, request, jsonify, Response from pymongo import Connection from config import * app = Flask(__name__) import json import bitcoinrpc from bitcoinrpc.exceptions i...
from pysys.constants import * from xpybuild.xpybuild_basetest import XpybuildBaseTest class PySysTest(XpybuildBaseTest): def execute(self): dirs = list() EXCLUDED_MODULES = [] i = 0 skipped = 0 failedModules = [] DIR = PROJECT.XPYBUILD_ROOT allScripts = [] for dirpath, dirnames, filenames in os.w...
from collections import deque import test import re # directive, v, # special cases def d(prefix_parameters, colon_modifier, at_modifier, argument, arg_list, arg_index): """ process directive d """ # up to four prefix arguments # ints dxobr def parse_prefix_arg(a): """look for a single prefix a...
#!/usr/bin/env python3 -tt """ File: strlib.py --------------- Exports a few useful string functions that are not included by default with Python strings. """ import string as _string import urllib.parse as _parse _STRING_DELIMITERS = ",:)}]\n" def equals_ignore_case(s1, s2): return s1.lower() == s2....
import os import sys import logging import numpy as np from skimage.io import use_plugin, imread, imsave logger = logging.getLogger('__main__.{}'.format(__name__)) def apply_mask(input_file, mask_file, output_file): use_plugin('pil') # TODO - shape mismatches input_image = imread(input_file) mask...
import codecs import json import unittest from mock import patch from currency_converter.money import Money test_data_path = "raw_data/test_rates.json" class MockResponse(object): ''' Simple mock for urllib.request for downloading exchange_rates ''' def __init__(self, code=200, msg='OK'): ...
import os import logging from os import mkdir from os.path import join, split, exists, isdir from itertools import chain from git.cmd import GitCommandError from datetime import datetime import hashlib import yaml import edit_functions TASK_METADATA_FILENAME = u'_task.yml' class MergeConflict (Exception): def __i...
from __future__ import print_function from builtins import input import flask import os import threading import time import webbrowser from tornado.wsgi import WSGIContainer from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop _basedir = os.path.join("..", os.path.dirname(__file__)) app = f...
import re from .. import factories as f def test_organisation_flow(base_url, browser, outbox): user = f.create_user() user.set_password('123123') user.save() url = base_url + '/accounts/login/' browser.visit(url) browser.fill('login', user.email) browser.fill('password', '123123') brow...
import unittest import os from utils import create_sparse_tempfile from gi.repository import BlockDev if not BlockDev.is_initialized(): BlockDev.init(None, None) class MpathTestCase(unittest.TestCase): def setUp(self): self.dev_file = create_sparse_tempfile("mpath_test", 1024**3) succ, loop = ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import re import os import json import shutil import tempfile import subprocess import itertools import operator import click __all__ = ['check', 'parse_dep'] # https://github.com/davglass/license-checker#custom-format LICENSE_CHECKER_FORMAT_KEYS = [...
# Author Michele Mattioni # Wed Mar 18 17:51:51 GMT 2009 import logging import numpy as np import math import sys import os #this is just to import sqlite properly! sys.path.append('/ebi/research/software/Linux_x86_64/opt/stow/python-2.6.1/lib/python2.6/lib-dynload/') import sqlite3 import cPickle from neuron impo...
# POTENTIALLY ADD THE COMMANDER IN CONTROL TO THE CREATURE CLASS? """ This module gives a way to generate all of the creatures that fight in CyberBattles. Some creatures can attack from range in addition to melee, some creatures move via flight and aren't obstructed, and some creatures are slimy and can't be melee atta...
#!/usr/bin/env python2 # # Description: This script is run at boot in a Rackconnected # cloud server. It will continue to run until # Rackconnect automation is complete, then it will # launch the scripts inside /etc/crewchief.d/. # # # Filelist: /etc/crewchief/ # ...
# -*- coding: utf-8 -*- # Copyright (c) 2013 Johannes Baiter. All rights reserved. # 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 right...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys from shutil import copyfile import glob import time from datetime import datetime from collections import OrderedDict import re import markdown import yaml import unidecode from jinja2 import Environment, FileSystemLoader def slugify(text): # c...
from __future__ import absolute_import, division, print_function from collections import Mapping from keyword import iskeyword import re import datashape from datashape import ( dshape, DataShape, Record, Var, Fixed, promote, Option, Null, ) from datashape.predicates import ( issca...
# -*- coding: utf-8 -*- # Copyright (C) 2014 Johannes Baiter <johannes.baiter@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 your ...
""" fillerbase Module Classes to help fill widgets with data Copyright (c) 2008 Christopher Perkins Original Version by Christopher Perkins 2008 Released under MIT license. """ from configbase import ConfigBase, ConfigBaseError from metadata import FieldsMetadata from genshi import XML import inspect class FillerBa...
#! /usr/bin/python #import faulthandler import sys, os from PySide import QtCore, QtGui, QtUiTools from PySide.QtCore import QThread import serial import platform, glob import threading def closeEvent(self, event): event.ignore() cleanUp() def cleanUp(): global connected global serial_thread if c...
#****************************************************************************** # (C) 2018, Stefan Korner, Austria * # * # The Space Python Library is free software; you can redistribute it and/or * ...
# # Copyright 2011, Blender Foundation. # # 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 program is distribute...
# -*- coding: utf-8 -*- """ Created on Mon May 2 14:02:44 2016 @author: kevin """ Samfname = "sample.sam" with open(Samfname) as f: Sam = f.readlines() lines = [] for i in range(len(Sam)): lines.append(Sam[i].split("\t", Sam[i].count("\t"))) Gfffname = "sample.gtf" with open(Gfffname) as f: Gff =...
# like a version, touched for the very first time version = '0.1.34'
# -*- coding: utf-8 -*- """ Model ----- The declarative base model class for SQLAlchemy ORM. """ from collections import deque import sqlalchemy as sa from sqlalchemy.ext import declarative from sqlalchemy.util._collections import ImmutableProperties from . import event from .utils import classonce, is_sequence fro...
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Daniel Zhang (張道博)' import xml.etree.ElementTree as ET import re from mecodbinsert import MECODBInserter from mecoconfig import MECOConfiger from mecodbutils import MECODBUtil from mecomapper import MECOMapper from mecodbconnect import MECODBConnector from m...
""" Copyright (c) 2015 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. abstraction on top of http api calls use pycurl (can handle chunked response properly), fallback to requests chunked implementation for pycurl...
#!/usr/bin/env python2 import subprocess as sp import urllib2 import time import sys import os ## Set some variables for being lazy later on yes = ['y', 'ye', 'yes', 'Y', 'YE', 'YES'] no = ['n', 'no', 'N', 'NO'] pacmanconf = "/etc/pacman.conf" archstrike_mirrorlist = "/etc/pacman.d/archstrike-mirrorlist" def main(): ...
import math def intro(): print "This program will ask you for 5 integer or float values. It will calculate the average of all valus from 0 inclusive to 10 exclusive. It will print out whether the resulting average is even or odd." def average(): average = float((n0 + n1 + n2 + n3 + n4) / 5) return def therange(n...
#!/usr/bin/env python # Copyright 2013-2017 Aerospike, 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 la...
#! /usr/bin/env python # -*- coding: iso-8859-1 -*- # vi:ts=4:et import pycurl import unittest import select from . import appmanager from . import util setup_module_1, teardown_module_1 = appmanager.setup(('app', 8380)) setup_module_2, teardown_module_2 = appmanager.setup(('app', 8381)) setup_module_3, teardown_mod...
from __future__ import division import json from collections import Counter from operator import sub def bunk_lecture(n, tot_lec): with open('../attendance_output.json', 'r') as f: report = json.loads(f.read()) result = (((int(report[0]['total_lec_attended']) + int(tot_lec)) - int(n))/(int(report[0]['t...
# Copyright (C) 2010,2011 Chris Lalancette <clalance@redhat.com> # This library 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 versi...
import pprint import unittest from p2p import ( get_connection, P2PNotFound, P2PSlugTaken, filters, P2PUniqueConstraintViolated ) pp = pprint.PrettyPrinter(indent=4) class BaseP2PTest(unittest.TestCase): content_item_keys = ( 'altheadline', 'expire_time', 'canonical_url', 'mobi...
""" Useful callbacks for the Run Engine """ from itertools import count import warnings from collections import deque, namedtuple, OrderedDict import time as ttime import matplotlib.pyplot as plt import matplotlib.colors as mcolors from datetime import datetime import numpy as np import logging from ..utils import ens...
#!/usr/bin/python3 # -*- coding: utf-8 -*- # # A tool for the automation of MARC downloads from the BNB. import datetime import os import pexpect import pipes import process_util import re import sys import time import traceback import urllib.request import util import xml.etree.ElementTree as ElementTree import zipfi...
# -*- coding: utf-8 -*- ############################################################################### # # Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License a...
# Copyright 2022 Google LLC # # 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 to in writing, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Liblouis test harness # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later v...
# -*- coding: utf-8 -*- """Tests for the site module.""" # # (C) Pywikibot team, 2008-2018 # # Distributed under the terms of the MIT license. # from __future__ import absolute_import, division, unicode_literals import os import pickle import re import sys try: from collections.abc import Iterable, Mapping except...
# # CORE # Copyright (c)2010-2012 the Boeing Company. # See the LICENSE file included in this distribution. # # author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com> # ''' quagga.py: defines routing services provided by Quagga. ''' import os if os.uname()[0] == 'Linux': from core.netns import nodes elif os.unam...
# -*- encoding: utf-8 -*- from __future__ import unicode_literals import datetime import re import textwrap from time import mktime from django.core.management.base import BaseCommand import feedparser from digest.management.commands import save_item from digest.models import Item, Resource, Section l = [ 'Те...
from direct.distributed import DoHierarchy #hack: BAD_DO_ID = BAD_ZONE_ID = 0 # 0xFFFFFFFF BAD_CHANNEL_ID = 0 # 0xFFFFFFFFFFFFFFFF class DoCollectionManager: def __init__(self): # Dict of {DistributedObject ids: DistributedObjects} self.doId2do = {} # (parentId, zoneId) to dict of doId->Di...
#!/usr/bin/env python import time import threading import pprint import copy import Bybop_NetworkAL from Bybop_Network import * from Bybop_Commands import * from Bybop_Discovery import * from Bybop_Connection import * import arsdkparser MOVE_SPEED = 20 class State(object): """ Three level dictionnary to sav...
#!/usr/bin/env python3 # # Copyright © 2018 Tomasz Miąsko # # This library 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 of the licence, or (at your option) any later version. # # T...
# Django settings for {{ project_name }} project. DEBUG = True ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS LANGUAGE_CODE = 'en-us' DATABASE_ENGINE = 'postgresql' # 'postgresql', 'mysql', or 'sqlite3'. DATABASE_NAME = '' # Or path to database file if using sqlite3. DATAB...
# Django settings for {{ project_name }} project. DEBUG = True ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS LANGUAGE_CODE = 'en-us' DATABASE_ENGINE = 'postgresql' # 'postgresql', 'mysql', or 'sqlite3'. DATABASE_NAME = '' # Or path to database file if using sqlite3. DATAB...
#!/usr/bin/env python import dpkt import time, unittest class TestPerf(unittest.TestCase): rounds = 10000 def setUp(self): self.start = time.time() def tearDown(self): print self.rounds / (time.time() - self.start), 'rounds/s' def test_pack(self): for i in xrange(self.rounds)...
from __future__ import print_function import numpy as np from itertools import izip from matplotlib import pyplot as plt """ Provides a number of useful evaluation metrics And helper-routines to compute the metrics """ __version__ = '0.2' #---------------------------------------------------------------------------...
import helpers, testly from os import path, makedirs from shutil import rmtree from tempfile import gettempdir from time import sleep from six.moves.queue import Empty from multiprocessing import JoinableQueue from pyppl import Jobmgr, Proc, utils from pyppl.runners import RunnerLocal def _getItemsFromQ (q): ret = ...
import requests import lxml.html import cookielib from functools import wraps import cStringIO as StringIO from django.conf import settings from namelist.models import Player USERNAME = settings.BRAINS_SCRAPE_SETTINGS['username'] PASSWORD = settings.BRAINS_SCRAPE_SETTINGS['password'] PROFILES_URL = 'http://profiles.u...
import numpy as np import os.path import sys import copy import tables from metatlas import metatlas_objects as metob import pandas as pd from textwrap import wrap import matplotlib.pyplot as plt def create_msms_dataframe(df): """ create a dataframe organized into spectra from a raw dataframe of points ""...
import twisted.internet.defer as defer import twisted.internet.threads as threads __all__ = [ 'Queue', 'Future', 'asynchronous', ] class Queue(object): """ A non-blocking queue for use with asynchronous code """ class OverflowError(Exception): """ The queue has overflown """ pas...
""" Utility functions for atmospheric data wrangling / preparation. - ndarrays - netCDF files - Lat-lon geophysical data - Pressure level data and topography """ from __future__ import division import numpy as np import collections import scipy.interpolate as interp from mpl_toolkits import basemap import xray from x...
# Main class for StatusBarExtended from fman import DirectoryPaneCommand, DirectoryPaneListener, \ show_status_message, load_json, save_json, PLATFORM from fman.url import as_url, as_human_readable from fman.fs import is_dir, query from core.commands.util import is_hidden # works on file_paths, not urls import glob f...
import pytest from _pytest.main import EXIT_OK, EXIT_TESTSFAILED, EXIT_USAGEERROR, EXIT_NOTESTSCOLLECTED, EXIT_INTERRUPTED # NOQA @pytest.mark.old def test_contacted_with_params(testdir, option): """FIXME """ src = """ import pytest def test_func(ansible_module): contacted = ...
import itertools import logic import graphs import re import sympy import numpy import functools import time import ilp import random import csv import gurobipy import stochastic import multiprocessing def find_num_attractors_multistage(G, use_ilp): T = 1 P = 1 iteration = 1 while P <= 2 ** len(G.ver...
#!/usr/bin/python3 # -*- coding: utf-8 -*- import random from serpscrap.config import Config from serpscrap.serpscrap import SerpScrap class TestClass: def test_simple(self): keyword_list = [ 'computer news', 'since topics', 'python tutorial', 'pythons', ...
#! /usr/bin/local/python # -*- coding: utf-8 -*- import sys import breakmer.utils as utils __author__ = "Ryan Abo" __copyright__ = "Copyright 2015, Ryan Abo" __email__ = "ryanabo@gmail.com" __license__ = "MIT" class Filter: """ """ def __init(self): self.name = None self.svType = None ...
import scvelo as scv import numpy as np def test_einsum(): from scvelo.tools.utils import prod_sum_obs, prod_sum_var, norm Ms, Mu = np.random.rand(5, 4), np.random.rand(5, 4) assert np.allclose(prod_sum_obs(Ms, Mu), np.sum(Ms * Mu, 0)) assert np.allclose(prod_sum_var(Ms, Mu), np.sum(Ms * Mu, 1)) a...
""" @package mi.dataset.driver.wfp.ctdpfk.test.test_driver @file marine-integrations/mi/dataset/driver/wfp/ctdpfk/test/test_driver.py @author Bill French (template) @author Roger Unwin @brief Test cases for wfp/ctdpfk driver USAGE: Make tests verbose and provide stdout * From the IDK $ bin/test_driver ...
""" This is an adapter for RAPD to connect to the control database when it is a MySQL type database. """ __license__ = """ This file is part of RAPD Copyright (C) 2009-2016, Cornell University All rights reserved. RAPD is free software: you can redistribute it and/or modify it under the terms of the GNU Affero Gener...
#!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime from random import random import os import tests.util import utils from google.appengine.api import taskqueue from google.appengine.ext import ndb from google.appengine.runtime import apiproxy_errors class CacheTest(tests.util.TestCase): ...
#!/usr/bin/env python global dofile_basename import re, os, sys, shutil, commands, pprint, time, glob, codecs try: from collections import OrderedDict # v2.7 and v3.1 except ImportError: # use standard arbitrary-ordered dict instead (original order of # citations is then lost) OrderedDict = dict def...
### # Copyright (c) 2002-2004, Jeremiah Fincher # 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 retain the above copyright notice, # this list of co...
from django.contrib.auth import logout as django_logout from django.contrib.auth import login as django_login from django.contrib.auth import authenticate as django_authenticate from django.contrib.auth.models import User from django.contrib.auth.models import UserManager from django.contrib.sites.models import Site fr...
#!/usr/bin/env python # -*- coding: utf-8 -*- import base import brewery.metadata try: import sqlalchemy # (sql type, storage type, analytical type) _sql_to_brewery_types = ( (sqlalchemy.types.UnicodeText, "text", "typeless"), (sqlalchemy.types.Text, "text", "typeless"), (sqlalche...
# -*- coding: utf-8 -*- from django.contrib.auth import logout as django_logout from django.contrib.auth import login as django_login from django.contrib.auth import authenticate as django_authenticate from django.contrib.auth.models import User from django.contrib.auth.models import UserManager from django.contrib.sit...
# -*- coding: utf-8 -*- import unittest from formencode import Invalid from formencode.validators import Email class TestEmail(unittest.TestCase): def setUp(self): self.validator = Email() def validate(self, *args): try: return self.validator.to_python(*args) except Inv...
# -*- coding: utf-8 -*- messages = [] from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.db import IntegrityError from django.shortcuts import render from django.contrib import auth from django.utils import simplejson from django.contrib.auth.models import User from diogenis.teachers.mo...
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json from lxml import html from db.common import session_scope from db.event import Event from utils.summary_downloader import SummaryDownloader from utils.data_handler import DataHandler from parsers.team_parser import TeamParser from parsers.gam...
from time import time from os.path import exists from traceback import format_exc import logging MAX_OUTPUT_LEN = 32 logger = logging.getLogger(__name__) class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD...
#!/usr/bin/env python # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. import ctypes import os import shutil import subprocess import sys from copy import deepcopy fr...
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt """Tests for files.py""" import os import os.path from unittest import mock import pytest from coverage import env, files from coverage.exceptions import ConfigE...
#!/usr/bin/env python # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. import ctypes import os import platform import shutil import subprocess import sys from copy im...
#!/usr/bin/env python # -*- coding: utf-8 -*- from pytest import fixture, yield_fixture, raises from unittest.mock import patch from sys import float_info import numpy as np from numpy.testing import assert_almost_equal from numpy.linalg import norm from space.env.poleandtimes import ScalesDiff from datetime import t...
import unittest import time import requests import collections try: import mock # Python 2 except ImportError: from unittest import mock # Python 3 import faucet.gauge_prom as gauge_prom from faucet.gauge_prom import GaugePrometheusClient, GaugePortStatsPrometheusPoller from ryu.ofproto.ofproto_v1_3_parser ...
# -*- coding:utf-8 -*- import os import PIL import pytest from PIL import Image from sigal import init_logging from sigal.image import (generate_image, generate_thumbnail, get_exif_tags, get_exif_data, get_size, process_image) from sigal.settings import create_settings, Status CURRENT_DIR = ...
from imantics import Image class TestImageCreate: def test_create_empty(self): width, height = (50, 100) image = Image.empty(width=width, height=height) draw = image.draw() assert image.height == height assert image.width == width assert image.array.shape == (heigh...
from cheeseprism.utils import resource_spec from itertools import count from mock import Mock from mock import patch from nose.tools import raises from path import path from pprint import pformat as pprint import logging import textwrap import unittest logger = logging.getLogger(__name__) here = path(__file__).parent...
"""Tests all major functionality of the isort library Should be ran using py.test by simply running py.test in the isort project directory """ import importlib.machinery import os import os.path from pathlib import Path import posixpath import subprocess import sys import sysconfig from tempfile import NamedTemporaryF...
import string import unittest import sure from compiler import error, lex class TestLexer(unittest.TestCase): def _lex_data(self, input): mock = error.LoggerMock() tokens = lex.tokenize(input, logger=mock) return list(tokens), mock def _assert_individual_token(self, input, expected_...
from context import core from context import models from models import model from core import logic import unittest class test_create_room(unittest.TestCase): def setUp(self): self.white_char_in_name = logic.create_room('office', "name ") self.white_char_in_typr = logic.create_room('livin...
#!/usr/bin/python """ .. Copyright 2017 EMBL-European Bioinformatics Institute 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 Unle...
from unittest import TestCase import pytest import niche_vlaanderen from niche_vlaanderen.niche import NicheException from rasterio.errors import RasterioIOError import numpy as np import pandas as pd import tempfile import shutil import os import sys import distutils.spawn import subprocess class TestNiche(TestCa...
import gc from contextlib import suppress from shutil import copy from sys import getrefcount as refcount import pytest from pikepdf import Pdf, PdfMatrix, Stream, Dictionary, Name # pylint: disable=redefined-outer-name,pointless-statement @pytest.fixture def graph(resources): return Pdf.open(resources / 'gra...
from __future__ import absolute_import from ofxparse.ofxparse import soup_maker from datetime import datetime, timedelta from decimal import Decimal from unittest import TestCase import sys sys.path.append('..') import six from .support import open_file from ofxparse import OfxParser, AccountType, Account, Statement...
import time from collections import namedtuple from pprint import PrettyPrinter import inspect class WrappedFunc(object): def __init__(self, func, owner): """ Args: func(function): The function to wrap owner(WrappedObject): The containing instance wrapping this function ...
# -*- code: utf8 -*- try: import enum except ImportError: enum = None import re import sys import unittest from collections import namedtuple from datetime import date from parsy import ( ParseError, alt, any_char, char_from, decimal_digit, digit, from_enum, generate, index, letter, line_info, line_inf...
''' Calculates the k-nearest neighbor (kNN) algorithm ''' import math import numpy as np import scipy.io from calculate_cosine_distance import cosineDistance __author__ = """Marina von Steinkirch""" ########################################### def loading_data(filename): ''' This function load a M...
from mock import call, patch import pytest import pluvo from pluvo import PluvoResultSet, DEFAULT_API_URL, DEFAULT_PAGE_SIZE import datetime class Multiple: call_nr = 0 def __init__(self, pages): self.pages = pages def results(self, *args, **kwargs): result = self.pages[self.call_nr] ...
import unittest import time from robot.robot import Robot from tests.mock_robotd import MockRobotD class PowerBoardTest(unittest.TestCase): def setUp(self): mock = MockRobotD(root_dir="/tmp/robotd") self.power_board = mock.new_powerboard() time.sleep(0.2) self.mock = mock ...
import os # python 2.4 does not have os.SEEK_* try: os.SEEK_SET except AttributeError: os.SEEK_SET, os.SEEK_CUR, os.SEEK_END = range(3) import logging log = logging.getLogger('flvlib') log.setLevel(logging.NOTSET) handler = logging.StreamHandler() handler.setLevel(logging.NOTSET) formatter = logging.Format...
from __future__ import print_function import datetime import itertools import sys from collections import Counter, defaultdict from dateutil.parser import parse as parse_date from dateutil.relativedelta import relativedelta from xtermcolor import colorize from .core import logger from .util import helpers days = ['...
from __future__ import division from slack_service import SlackService from sqlite_helper import SqliteHelper from models import EventType, DbMessage from enum import Enum import os import time BOT_ID = os.environ.get('KARMA_BOT_ID') AT_BOT = "<@" + BOT_ID + ">" class Commands(Enum): SHOW = 'show' GIVE = 'giv...
# -*- coding: utf-8 -*- """ Kay main handler script. :Copyright: (c) 2009 Accense Technology, Inc. All rights reserved. :license: BSD, see LICENSE for more details. """ import logging import os import sys sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) import kay kay.setup() from k...
''' Application =========== The :class:`App` class is the base for creating Kivy applications. Think of it as your main entry point into the Kivy run loop. In most cases, you subclass this class and make your own app. You create an instance of your specific app class and then, when you are ready to start the applicat...
from pytest import raises, mark from rangeparser import * # from worse to best (suit matter) DEUCE_COMBOS = ( Combo('2d2c'), Combo('2h2c'), Combo('2h2d'), Combo('2s2c'), Combo('2s2d'), Combo('2s2h') ) THREE_COMBOS = ( Combo('3d3c'), Combo('3h3c'), Combo('3h3d'), Combo('3s3c'), Combo('3s3d'), Combo('3...
import os import stat import shutil import filecmp from dvc.main import main from dvc.command.repro import CmdRepro from dvc.project import ReproductionError from dvc.utils import file_md5 from tests.basic_env import TestDvc class TestRepro(TestDvc): def setUp(self): super(TestRepro, self).setUp() ...