content
string
r""" ``$ mwxml inflate -h`` :: Converts a stream of flat RevisionDocument JSON blobs into hierarchical JSON RevisionDocument JSON blobs. Usage: inflate (-h|--help) inflate [<input-file>...] [--threads=<num>] [--output=<path>] [--compress=<type>] [--verbose] [--debug] O...
import contextlib import os import tarfile import zipfile from .base import maybe_requirement from .common import safe_mkdtemp from .http.link import Link from .interpreter import PythonInterpreter from .pep425 import PEP425, PEP425Extras from .platforms import Platform from pkg_resources import ( EGG_NAME, p...
"""Unit test for UAParser(useragent_parser.py) module.""" import unittest import useragent_parser class UAParserTest(unittest.TestCase): TESTDATA_CHROME = [ {'user_agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US) ' 'AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13', ...
from django.core.management.base import BaseCommand from django.contrib.sites.models import Site from urlparse import urlsplit class Command(BaseCommand): """Overrides the default Site object with information from SITENAME and SITEURL """ can_import_settings = True def handle(self, *args, **op...
""" ConqueSoleCommunicator This script will create a new Windows console and start the requested program inside of it. This process is launched independently from the parent Vim program, so it has no access to the vim module. The main loop in this script reads data from the console and syncs it onto blocks of memo...
import time from swift import gettext_ as _ import eventlet from swift.common.utils import cache_from_env, get_logger, register_swift_info from swift.proxy.controllers.base import get_account_info, get_container_info from swift.common.memcached import MemcacheConnectionError from swift.common.swob import Request, Res...
# media files conversion stuff from .colortable import ColorTable, PlayerColorTable from collections import defaultdict from . import dataformat from .drs import DRS from . import filelist from .hardcoded import termcolors import os import os.path import pickle from string import Template import subprocess from .textu...
import micropython # viper function taking and returning ints @micropython.viper def viper_int(x:int, y:int) -> int: return x + y + 3 print(viper_int(1, 2)) # viper function taking and returning objects @micropython.viper def viper_object(x:object, y:object) -> object: return x + y print(viper_object(1, 2)) ...
""" Cached, database-backed sessions. """ import logging from django.conf import settings from django.contrib.sessions.backends.db import SessionStore as DBStore from django.core.cache import caches from django.core.exceptions import SuspiciousOperation from django.utils import timezone from django.utils.encoding imp...
"""This example creates new teams. To determine which teams exist, run get_all_teams.py. Tags: TeamService.createTeams """ __author__ = '<EMAIL> (Jeff Sham)' # Locate the client library. If module was installed via "setup.py" script, then # the following two lines are not needed. import os import sys sys.path.inser...
from django.test import TestCase from oscar.apps.address import models, forms from oscar.core.compat import get_user_model from oscar.test.factories import UserFactory class TestUserAddressForm(TestCase): def setUp(self): self.user = UserFactory() self.country = models.Country.objects.create( ...
"""Build a language detector model The goal of this exercise is to train a linear classifier on text features that represent sequences of up to 3 consecutive characters so as to be recognize natural languages by using the frequencies of short character sequences as 'fingerprints'. """ # License: Simplified BSD impor...
""" This file implements the a keyboard interface using the *pynput* Python package. This implementation is used for Linux (X11) and Mac OS (Darwin). """ import logging import sys import time from pynput.keyboard import Controller, KeyCode, Key from ._base import BaseKeyboard, Typeable as BaseTypeable class Typea...
# Django settings for {{ project_name }} project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', '<EMAIL>'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '', ...
#!/usr/bin/env python """ File: test.py Package: grindstone Author: Elijah Caine Description: Test GrindStone lib functionality """ from lib import GrindStone import unittest import shutil import os class TestGrindStoneLibrary(unittest.TestCase): def setUp(self): # We're testing everything in a /tmp/*...
from __future__ import absolute_import import logging from core.tools import open_dialog # Create a logger for optional handling of debug messages. logger = logging.getLogger(__name__) class Core(object): def __init__(self): # this is a potentially temporary solution to a problem with dialog chains ...
#-*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.utils.translation import ugettext_lazy as _ from django.conf import settings from filer.models import filemodels from filer.utils.compatibility import python_2_unicode_compatible @python_2_unicode_compatible class...
"""Tests for ar_model.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools import numpy as np from tensorflow.contrib.timeseries.python.timeseries import ar_model from tensorflow.contrib.timeseries.python.timeseries import input_pipeline f...
#!/usr/bin/python import argparse import os import re def main(): # def arguments argparser = argparse.ArgumentParser() argparser.add_argument("input") argparser.add_argument("target") args = argparser.parse_args() # get input file if not os.path.isfile(args.input): raise Exceptio...
#/usr/bin/python # -*- coding:utf-8 -*- # base/apache/var/www/region_load/ # region related INTERNAL_ADDRESS = "0.0.0.0" EXTERNAL_HOSTNAME = "162.105.17.48" ALLOW_ALTERNATE_PORTS = False MAX_AGENTS = 100 MAX_PRIMS = 15000 GLOBAL_REGION_DATA2 = { "huyu": {"orig":(1000,1000), "startPort":9000, "wh":(2,2)}, "xwd": {"o...
''' ===================================================================================== Python implementation of the ALS (Adujusted Least Square) ellipsoid fitting algorithm ===================================================================================== Sources: "Consistent least squares fitting of ellipsoids"...
from .resource import Resource class AuthorizationRule(Resource): """Description of a namespace authorization rule. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource ID. :vartype id: str :ivar name: Resource name. :vartype name: st...
from os.path import dirname, join from setuptools import setup, find_packages with open(join(dirname(__file__), 'scrapy/VERSION'), 'rb') as f: version = f.read().decode('ascii').strip() setup( name='Scrapy', version=version, url='http://scrapy.org', description='A high-level Web Crawling and Web...
import sys import string import operator keywordsText = open(sys.argv[1]).read() # A second argument signifies that the output # should be redirected to a file redirect_to_file = len(sys.argv) > 2 # Change stdout to point to the file if requested if redirect_to_file: file_output = open(sys.argv[-1], "w") sys...
""" Copyright (c) 2008, appengine-utilities project 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 conditions and ...
#!/usr/bin/python """ # Created on Aug 12, 2016 # # @author: Gaurav Rastogi (<EMAIL>) GitHub ID: grastogi23 # # module_check: not supported # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Fr...
#!/usr/bin/python import sys, os, commands, time, re, copy try: from PyQt4 import QtCore, QtGui QtCore.Signal = QtCore.pyqtSignal QtCore.Slot = QtCore.pyqtSlot except ImportError: try: from PySide import QtCore, QtGui QtCore.QString = str except ImportError: raise ImportErro...
from openerp.osv import fields, osv class stock_location_path(osv.osv): _inherit = "stock.location.path" _columns = { 'invoice_state': fields.selection([ ("invoiced", "Invoiced"), ("2binvoiced", "To Be Invoiced"), ("none", "Not Applicable")], "Invoice Status",), ...
from base64 import b32decode, b16encode from couchpotato.core.event import addEvent from couchpotato.core.helpers.variable import mergeDicts from couchpotato.core.logger import CPLog from couchpotato.core.providers.base import Provider import random import re log = CPLog(__name__) class Downloader(Provider): pr...
# -*- coding: utf-8 -*- import datetime, time, csv, os import numpy as np from utils.db import SqliteDB from utils.rwlogging import log from utils.rwlogging import strategyLogger as logs from utils.rwlogging import balLogger as logb from trader import Trader from indicator import ma, macd, bolling, rsi, kdj from strate...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='DjangoAdminDialog', fields=[ ('id', models.Auto...
import sys import subprocess from SALib.test_functions import Ishigami import numpy as np import re salib_cli = "./src/SALib/scripts/salib.py" ishigami_fp = "./src/SALib/test_functions/params/Ishigami.txt" if sys.version_info[0] == 2: subprocess.run = subprocess.call def test_delta(): cmd = "python {cli} sa...
""" The Horizon interface. Contains the core Horizon classes--:class:`~horizon.Dashboard` and :class:`horizon.Panel`--the dynamic URLconf for Horizon, and common interface methods like :func:`~horizon.register` and :func:`~horizon.unregister`. """ # Because this module is compiled by setup.py before Django may be ins...
import re import IECore ## The SWAReader class reads SpeedTree .swa files in the form of # IECore.PointsPrimitives. class SWAReader( IECore.Reader ) : def __init__( self, fileName=None ) : IECore.Reader.__init__( self, "Reads SpeedTree SWA files" ) if fileName is not None : self["fileName"].setTyp...
import os from django.conf import settings from django.contrib.auth.models import User from django.test import TestCase, Client class FlatpageCSRFTests(TestCase): fixtures = ['sample_flatpages'] urls = 'django.contrib.flatpages.tests.urls' def setUp(self): self.client = Client(enforce_csrf_checks=...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import pytest import sys from nose.plugins.skip import SkipTest if sys.version_info < (2, 7): raise SkipTest("F5 Ansible modules require Python >= 2.7") from ansible.compat.tests import unittest from ans...
from openerp.addons.web import http from openerp.addons.web.http import request from openerp.tools.translate import _ import json class Twitter(http.Controller): @http.route(['/twitter_reload'], type='json', auth="user", website=True) def twitter_reload(self): return request.website.fetch_favorite_twe...
import json from django.conf import settings from haystack import indexes from geonode.groups.models import GroupProfile class GroupIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) title = indexes.CharField(boost=2) # https://github.com/toastdriv...
from twisted.trial import unittest from twisted.spread import pb, flavors, jelly from twisted.internet import reactor, defer from twisted.python import log, failure ## # test exceptions ## class PoopError(Exception): pass class FailError(Exception): pass class DieError(Exception): pass class TimeoutError(Exception): ...
"""The tests for the Template Binary sensor platform.""" import unittest from unittest import mock from homeassistant.const import EVENT_STATE_CHANGED from homeassistant.components.binary_sensor import template from homeassistant.exceptions import TemplateError from tests.common import get_test_home_assistant class...
# -*- coding: utf-8 -*- """ Created on Fri Feb 24 15:59:29 2017 @author: CFord """ import sys, math, signal from PyQt4 import QtGui, QtCore from PyQt4.QtGui import * from PyQt4.QtCore import * from collections import deque from sirfcontrol.sirf import SirfMessageReader # Globals to begin with port = "COM7" baud = 38...
#!/usr/bin/env python from tests.compat import unittest from tests.unit import AWSMockServiceTestCase from boto.ec2.connection import EC2Connection from boto.ec2.securitygroup import SecurityGroup DESCRIBE_SECURITY_GROUP = br"""<?xml version="1.0" encoding="UTF-8"?> <DescribeSecurityGroupsResponse xmlns="http://ec2...
#!/usr/bin/env python3 """ Created on 10 Feb 2021 @author: Bruno Beloff (<EMAIL>) Getting distance between two points based on latitude/longitude https://stackoverflow.com/questions/19412462/getting-distance-between-two-points-based-on-latitude-longitude """ from scs_core.position.position import Position # -----...
#! /usr/bin/env python from openturns import * from math import * TESTPREAMBLE() RandomGenerator().SetSeed(0) try : # Instanciate one distribution object dim = 2 copula = FrankCopula(2.5) print "Copula " , repr(copula) print "Copula " , copula print "Mean " , repr(copula.getMean()) print ...
from eos.const.eos import EffectBuildStatus from eos.const.eos import ModAffecteeFilter from eos.const.eos import ModDomain from eos.const.eos import ModOperator from eos.const.eve import OperandId from tests.mod_builder.testcase import ModBuilderTestCase class TestBuilderEtreeAffecteeDomGrp(ModBuilderTestCase): ...
# -*- coding: utf-8 -*- """ Utilities to load datasets from the `dataset` package. """ # License: BSD from __future__ import absolute_import, division, print_function, unicode_literals import os import numpy as np from .dataset import DataSet __all__ = ('load_faithful', 'load_iris', 'load_women') DATAPATH = os.pat...
''' unit tests ONTAP Ansible module: na_ontap_cifs_server ''' from __future__ import print_function import json import pytest from units.compat import unittest from units.compat.mock import patch from ansible.module_utils import basic from ansible.module_utils._text import to_bytes import ansible.module_utils.netapp ...
""" Error and information logging for IDL """ import sys class IDLLog(object): """Captures and routes logging output. Caputres logging output and/or sends out via a file handle, typically stdout or stderr. """ def __init__(self, name, out): if name: self._name = '%s : ' % name else: se...
# -*- coding: utf-8 -*- from openerp.addons.website_blog.tests.common import TestWebsiteBlogCommon class TestWebsiteBlogFlow(TestWebsiteBlogCommon): def test_website_blog_followers(self): """ Test the flow of followers and notifications for blogs. Intended flow : - people subscribe to ...
"""IMDB movie review sentiment classification dataset.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.keras.datasets.imdb import get_word_index from tensorflow.python.keras.datasets.imdb import load_data del absolute_import del d...
"""Set of functions from PyGame that are handy to have in the local namespace for your module""" from pygame.constants import * from pygame.rect import Rect import pygame.color as color Color = color.Color
import time from openerp.osv import fields,osv from openerp.tools.translate import _ class subscription_document(osv.osv): _name = "subscription.document" _description = "Subscription Document" _columns = { 'name': fields.char('Name', required=True), 'active': fields.boolean('Active', help=...
"""Fixes foreign key relationship.""" from invenio.ext.sqlalchemy import db from invenio.modules.upgrader.api import op depends_on = ['invenio_2015_03_03_tag_value'] def info(): """Return upgrade recipe information.""" return "Fixes foreign key relationship." def do_upgrade(): """Carry out the upgra...
from django.contrib.gis.db import models class SouthTexasCity(models.Model): "City model on projected coordinate system for South Texas." name = models.CharField(max_length=30) point = models.PointField(srid=32140) objects = models.GeoManager() def __unicode__(self): return self.name class SouthTe...
import cgi import json import pprint from webob import Response from persistent import Persistent def as_json(context): """Return an object's representation as JSON""" info = { 'info': cgi.escape(pprint.pformat(context.context)), } return Response(content_type='application/json', body=json.dum...
from __future__ import absolute_import from __future__ import print_function class AbandonChain(Exception): """A series of chained steps can raise this exception to indicate that one of the intermediate RunProcesses has failed, such that there is no point in running the remainder. 'rc' should be the non-...
from ansible.compat.tests.mock import patch, Mock, call from .netscaler_module import TestModule import copy import tempfile import json import sys import codecs from ansible.modules.network.netscaler import netscaler_nitro_request module_arguments = dict( nsip=None, nitro_user=None, nitro_pass=None, ...
{ 'name': 'PosBox Software Upgrader', 'version': '1.0', 'category': 'Hardware Drivers', 'website': 'https://www.odoo.com/page/point-of-sale', 'sequence': 6, 'summary': 'Allows to remotely upgrade the PosBox software', 'description': """ PosBox Software Upgrader ======================== This...
"""Test processing of unrequested blocks. Setup: two nodes, node0+node1, not connected to each other. Node1 will have nMinimumChainWork set to 0x10, so it won't process low-work unrequested blocks. We have one P2PInterface connection to node0 called test_node, and one to node1 called min_work_node. The test: 1. Gene...
from itertools import count from unittest.mock import Mock from case import ContextMock from kombu.transport import base from kombu.utils import json def PromiseMock(*args, **kwargs): m = Mock(*args, **kwargs) def on_throw(exc=None, *args, **kwargs): if exc: raise exc raise ...
import sys from codebase import logger from codebase.client import CodeBaseAPI class CodeBaseAPIUtils(CodeBaseAPI): def bulk_update_ticket_statuses(self, current_status_name, target_status_name): """ Example usage to set all "Approved for Dev" tp "Deployed to Dev": STATUS_TRANSITIONS = ...
from django.forms.renderers import DjangoTemplates, Jinja2 from django.test import SimpleTestCase try: import jinja2 except ImportError: jinja2 = None class WidgetTest(SimpleTestCase): beatles = (('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo')) @classmethod def setUpClass(cls): ...
import unittest from ...compatibility import StringIO from ..helperfunctions import _xml_to_list from ...worksheet import Worksheet class TestAssembleWorksheet(unittest.TestCase): """ Test assembling a complete Worksheet file. """ def test_assemble_xml_file(self): """Test writing a worksheet ...
import datetime import re from django import forms from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm from django.forms.widgets import Widget, Select from django.utils import six from django.utils.dates import MONTHS from django.utils.safestring import mark_safe from .mod...
"""Self-tests for Crypto.Util.Counter""" __revision__ = "$Id$" import sys if sys.version_info[0] == 2 and sys.version_info[1] == 1: from Crypto.Util.py21compat import * from Crypto.Util.py3compat import * import unittest class CounterTests(unittest.TestCase): def setUp(self): global Counter ...
""" Management class for Storage-related functions (attach, detach, etc). """ from oslo_log import log as logging from oslo_utils import excutils from oslo_utils import strutils from nova import exception from nova.i18n import _LI, _LW from nova.virt.xenapi import vm_utils from nova.virt.xenapi import volume_utils ...
"""An Ansible module to utilize GCE image resources.""" ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'} try: import libcloud from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver f...
from __future__ import unicode_literals from django.db import transaction from django.test import TestCase from django.utils import six from .models import Article, Publication class ManyToManyTests(TestCase): def setUp(self): # Create a couple of Publications. self.p1 = Publication.objects.cre...
""" Support for ecobee Send Message service. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/notify.ecobee/ """ import logging import voluptuous as vol from homeassistant.components import ecobee from homeassistant.components.notify import ( BaseNot...
from odoo import models, fields class ResBank(models.Model): """ Inherit res.bank class in order to add swiss specific fields Fields from the original file downloaded from here: http://www.six-interbank-clearing.com/de/home/bank-master-data/download-bc-bank-master.html ============= ===============...
import re import logging from collections import namedtuple import uuid def _prefix_only_url_replace_regex(pattern): """ Match urls in quotes pulling out the fields from pattern """ return re.compile(ur""" (?x) # flags=re.VERBOSE (?P<quote>\\?['"]) # the op...
""" """ # Standard library imports from __future__ import (absolute_import, division, print_function, unicode_literals, with_statement) import sys # Third party imports from qtpy.QtCore import Qt, QSize from qtpy.QtGui import QIcon, QPixmap from qtpy.QtWidgets import (QApplication, QHBoxLayou...
# -*- coding: utf-8 -*- from django.db.models import Q from django.template import RequestContext from aldryn_search.utils import get_index_base, strip_tags from .conf import settings from .models import Post class BlogIndex(get_index_base()): haystack_use_for_indexing = settings.ALDRYN_BLOG_SEARCH INDEX_T...
import difflib import tarfile from glob import glob from datetime import datetime, timedelta from time import strftime from uuid import uuid4 # Import from itools from itools.fs import lfs from itools.loop import cron class PatchsBackend(object): rotate_interval = timedelta(weeks=2) def __init__(self, db_p...
import os import logging import shutil from theano import config from pylearn2.datasets import preprocessing from pylearn2.datasets.svhn import SVHN from pylearn2.utils.string_utils import preprocess orig_path = preprocess('${PYLEARN2_DATA_PATH}/SVHN/format2') try: local_path = preprocess('${SVHN_LOCAL_PATH}') exc...
try: import bigsuds except ImportError: bigsuds_found = False else: bigsuds_found = True TEMPLATE_TYPE = 'TTYPE_HTTP' DEFAULT_PARENT_TYPE = 'http' # =========================================== # bigip_monitor module generic methods. # these should be re-useable for other monitor types # def bigip_api(bi...
from pip.req import InstallRequirement, RequirementSet, parse_requirements from pip.basecommand import Command from pip.exceptions import InstallationError class UninstallCommand(Command): """ Uninstall packages. pip is able to uninstall most installed packages. Known exceptions are: - Pure distutil...
r"""Support for regular expressions (RE). This module provides regular expression matching operations similar to those found in Perl. It supports both 8-bit and Unicode strings; both the pattern and the strings being processed can contain null bytes and characters outside the US ASCII range. Regular expressions can ...
import math import pdb import numpy as np import Orange from Orange.feature import Type as OType class OverlapPenalty(object): def __init__(self, domain, cdists, ddists, granularity=100): """ Args: domain: Orange.Domain object """ self.domain = domain self.cdists = cdists self.ddists ...
import hashlib import hmac import time from six.moves.urllib import parse as urlparse from tempest_lib import exceptions as lib_exc from tempest.api.object_storage import base from tempest.common.utils import data_utils from tempest import test class ObjectTempUrlNegativeTest(base.BaseObjectTest): metadata = {...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <<EMAIL>> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) This file is based, although a rewrite, on MIT-licensed code from the Bottle web framework. """ import os import sys impor...
from dogpile.cache import api NO_VALUE = api.NO_VALUE class NoopCacheBackend(api.CacheBackend): """A no op backend as a default caching backend. The no op backend is provided as the default caching backend for keystone to ensure that ``dogpile.cache.memory`` is not used in any real-world circumstan...
import _surface import chimera try: import chimera.runCommand except: pass from VolumePath import markerset as ms try: from VolumePath import Marker_Set, Link new_marker_set=Marker_Set except: from VolumePath import volume_path_dialog d= volume_path_dialog(True) new_marker_set= d.new_marker_set marker_set...
#! /usr/bin/env python # -*- coding: utf-8 -*- """@package pySEIMS Python APIs for SEIMS Preprocess, postprocess, parameters sensitivity, calibration, and scenario_analysis ------------------- author : Liangjun Zhu, Junzhi Liu copyright : (C) 2018-...
import collections from spack import * class Plumed(AutotoolsPackage): """PLUMED is an open source library for free energy calculations in molecular systems which works together with some of the most popular molecular dynamics engines. Free energy calculations can be performed as a function of many ...
# # iso2022_jp_2004.py: Python Unicode Codec for ISO2022_JP_2004 # # Written by Hye-Shik Chang <<EMAIL>> # import _codecs_iso2022, codecs import _multibytecodec as mbc codec = _codecs_iso2022.getcodec('iso2022_jp_2004') class Codec(codecs.Codec): encode = codec.encode decode = codec.decode cl...
import os import glob import shutil import sipconfig from distutils.core import setup, Extension from distutils.sysconfig import get_python_lib from distutils.cmd import Command from distutils.command.build import build from distutils.command.clean import clean from distutils.command.install import install from distuti...
""" unittest2 unittest2 is a backport of the new features added to the unittest testing framework in Python 2.7. It is tested to run on Python 2.4 - 2.6. To use unittest2 instead of unittest simply replace ``import unittest`` with ``import unittest2``. Copyright (c) 1999-2003 Steve Purcell Copyright (c) 2003-2010 P...
import math from django.shortcuts import render from django.views import generic from allauthdemo.auth.models import DemoUser from allauthdemo.demo.models import Problem from fileupload.models import Submission from allauthdemo.demo.models import ContestParticipation class ProblemView(generic.ListView): model = Pr...
""" HoNCore. Python library providing connectivity and functionality with HoN's chat server. """ import hashlib, urllib2 from exceptions import * from httplib import BadStatusLine """ Sends requests to the HoN master servers. These are just basic HTTP get requests which return serialised php. A version of ...
from __future__ import unicode_literals, division, absolute_import from builtins import * # noqa pylint: disable=unused-import, redefined-builtin from future.utils import text_to_native_str import logging import smtplib import socket import getpass from email.mime.multipart import MIMEMultipart from email.mime.text i...
import os try: import json except ImportError: import simplejson as json class Npm(object): def __init__(self, module, **kwargs): self.module = module self.glbl = kwargs['glbl'] self.name = kwargs['name'] self.version = kwargs['version'] self.path = kwargs['path'] ...
import unittest from scrapy.settings import Settings from scrapy.spiders import Spider import scrapy from scrapyscript import Job, Processor, ScrapyScriptException class MySpider(Spider): name = 'myspider' def start_requests(self): yield scrapy.Request(self.url) def parse(self, response): ...
class MockPort(object): def name(self): return "MockPort" def check_webkit_style_command(self): return ["mock-check-webkit-style"] def update_webkit_command(self, non_interactive=False): return ["mock-update-webkit"] def build_webkit_command(self, build_style=None): re...
# -*- coding: utf-8 -*- """Principal Component Analysis Created on Tue Sep 29 20:11:23 2009 Author: josef-pktd TODO : add class for better reuse of results """ import numpy as np def pca(data, keepdim=0, normalize=0, demean=True): '''principal components with eigenvector decomposition similar to princomp ...
class DeviceCfgRpcCallbackMixin(object): """Mixin for Cisco cfg agent device reporting rpc support.""" def report_non_responding_hosting_devices(self, context, host, hosting_device_ids): """Report that a hosting device cannot be contacted. @param: ...
import unittest import os import commands import glob import sys; sys.path.append(os.getcwd()) sys.path.append(os.path.realpath('..')) import comm class TestOnlineGradleBuild(unittest.TestCase): def test_build(self): comm.setUp() app_name = "Demo" pkg_name = "com.example.demo" com...
import codecs import mimetypes from uuid import uuid4 from io import BytesIO from .packages import six from .packages.six import b from .fields import RequestField writer = codecs.lookup('utf-8')[3] def choose_boundary(): """ Our embarassingly-simple replacement for mimetools.choose_boundary. """ r...
__revision__ = "$Id$" import binascii import unittest from Crypto.Util import RFC1751 from Crypto.Util.py3compat import * test_data = [('EB33F77EE73D4053', 'TIDE ITCH SLOW REIN RULE MOT'), ('CCAC2AED591056BE4F90FD441C534766', 'RASH BUSH MILK LOOK BAD BRIM AVID GAFF BAIT ROT POD LOVE'), ...
""" Plot sequence prediction experiment with multiple possible outcomes """ import os from matplotlib import pyplot import matplotlib as mpl import numpy from plot import computeAccuracy from plot import plotAccuracy from plot import readExperiment mpl.rcParams['pdf.fonttype'] = 42 pyplot.ion() pyplot.close('all') ...