content
stringlengths
4
20k
""" exception classes. """ class ResourceError(Exception): def __init__(self, msg=None, http_code=None, response=None): self.msg = msg or '' self.status_code = http_code self.response = response Exception.__init__(self) def _get_message(self): return self.msg ...
from pyrem.polygram import Polygram __author__ = 'quentin' #todo edf, csv import scipy.io as scio import pandas as pd import numpy as np from pyrem.time_series import Signal, Annotation import joblib from pyrem.time_series import BiologicalTimeSeries, Annotation, Signal def polygram_from_pkl(filename): retu...
from optparse import make_option import sys from django.core.management.base import BaseCommand, CommandError from gunicorn.app.djangoapp import DjangoApplicationCommand from gunicorn.config import make_settings from gunicorn import util # monkey patch django. # This patch make sure that we use real threads to get ...
__all__ = ['TacticException', 'TacticInfo'] import cStringIO, os, sys, urllib, xmlrpclib, re, string from xml.dom.minidom import parseString from pyasm.application.common import BaseAppInfo class TacticException(Exception): pass class TacticInfo(BaseAppInfo): '''Holds data in application session that is ...
import sys import exceptions import numpy as np from numpy.ctypeslib import ndpointer, load_library from numpy.testing import * try: cdll = load_library('multiarray', np.core.multiarray.__file__) _HAS_CTYPE = True except ImportError: _HAS_CTYPE = False except exceptions.OSError, e: _HAS_CTYPE = False ...
from __future__ import absolute_import, print_function from django.conf.urls import patterns, url from .endpoints.auth_index import AuthIndexEndpoint from .endpoints.broadcast_index import BroadcastIndexEndpoint from .endpoints.catchall import CatchallEndpoint from .endpoints.event_details import EventDetailsEndpoint...
"""Glue between OpenID and django.contrib.auth.""" __metaclass__ = type from django.conf import settings from django.contrib.auth.models import User, Group from openid.consumer.consumer import SUCCESS from openid.extensions import ax, sreg from django_openid_auth import teams from django_openid_auth.models import Us...
from setuptools import setup, find_packages from hueversion import VERSION setup( name = "filebrowser", version = VERSION, author = "Hue", url = 'http://github.com/cloudera/hue', description = "HDFS browser", packages = find_packages('src'), package_dir = {'': 'src'}, in...
from urllib.parse import urlencode from django.apps import apps from django.contrib.admin.utils import quote, unquote from django.core.paginator import Paginator from django.http import Http404 from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse from django.utils.text impor...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ LTTng User Space Tracing backend. """ __author__ = "Lluís Vilanova <<EMAIL>>" __copyright__ = "Copyright 2012, Lluís Vilanova <<EMAIL>>" __license__ = "GPL version 2 or (at your option) any later version" __maintainer__ = "Stefan Hajnoczi" __email__ = "<...
""" Nagios NDO external inventory script. ======================================== Returns hosts and hostgroups from Nagios NDO. Configuration is read from `nagios_ndo.ini`. """ import os import argparse try: import configparser except ImportError: import ConfigParser configparser = ConfigParser import j...
import numpy as np from procedural_city_generation.polygons.Polygon2D import Polygon2D, Edge def getFoundation(poly, grid_width=0.01, eps=10**-8): rect_area = 0 rect_height = 0 rect_x = [0,0] rect_base = None #Iterate through edges which are bordering a road, find largest #rectangle for each one for base ...
from django.core.paginator import Paginator, InvalidPage from django.core.exceptions import ImproperlyConfigured from django.http import Http404 from django.utils.encoding import smart_str from django.utils.translation import ugettext as _ from django.views.generic.base import TemplateResponseMixin, View class Multip...
""" SQLite3 backend for django. Python 2.4 requires pysqlite2 (http://pysqlite.org/). Python 2.5 and later can use a pysqlite2 module or the sqlite3 module in the standard library. """ import re import sys import datetime from django.db import utils from django.db.backends import * from django.db.backends.signals i...
# -*- coding: utf-8 -*- """ pygments.styles.native ~~~~~~~~~~~~~~~~~~~~~~ pygments version of my "native" vim theme. :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.style import Style from pygments.token import Keyword, ...
""" The enrollment_track dynamic partition generation to be part of the openedx.dynamic_partition plugin. """ import logging import six from django.conf import settings from django.utils.translation import ugettext_lazy as _ from xmodule.partitions.partitions import ( get_partition_from_id, ENROLLMENT_TRACK_P...
from xen.xend import sxp from xen.xend.Args import FormFn from xen.xend import PrettyPrint from xen.xend import XendVnet from xen.xend.XendError import XendError from xen.web.SrvDir import SrvDir class SrvVnet(SrvDir): def __init__(self, vnetinfo): SrvDir.__init__(self) self.vnetinfo = vnetinfo ...
from __future__ import absolute_import import mock from bokeh.core.properties import field, value from bokeh.core.validation import check_integrity from bokeh.models.annotations import ( Legend, LegendItem, ColorBar, Arrow, BoxAnnotation, Span, LabelSet, Label, Title ) from bokeh.models import ( ColumnDataSour...
# -*- coding:utf-8 -*- #!/usr/bin/env python """ 多说API测试文件。作为通用的Python程序,没有使用Django的TestCase """ import os import unittest try: import json _parse_json = lambda s: json.loads(s) except ImportError: try: import simplejson _parse_json = lambda s: simplejson.loads(s) except ImportError: ...
""" :module: watchdog.observers.inotify :synopsis: ``inotify(7)`` based emitter implementation. :author: Sebastien Martini <<EMAIL>> :author: Luke McCarthy <<EMAIL>> :author: <EMAIL> (Yesudeep Mangalapilly) :author: Tim Cuthbertson <<EMAIL>> :platforms: Linux 2.6.13+. .. ADMONITION:: About system requirements Rec...
class IDataHolder: #def __setattr__(self, key, value): # self.__dict__[key] = value # self.__dict__['_v_modified'] = 1 #def setModified(self, modified): # self.__dict__['_v_modified'] = modified # for debug only def __repr__(self): result = '<%s.%s %X ' % (self.__class__....
import unittest import cgi from webkitpy.common.host import Host from webkitpy.common.host_mock import MockHost from webkitpy.common.system.executive_mock import MockExecutive from webkitpy.layout_tests.breakpad.dump_reader_multipart import DumpReaderMultipart class TestDumpReaderMultipart(unittest.TestCase): _...
from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains from component_editor import ComponentEditorView class HtmlComponentEditorView(ComponentEditorView): """ Represents the rendered view of an HTML component editor. """ def set_content_and_sa...
import unittest from test import support import ctypes import gc MyCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int) OtherCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_ulonglong) import _ctypes_test dll = ctypes.CDLL(_ctypes_test.__file__) class RefcountTestCase(unittest.TestCase): @sup...
from __future__ import unicode_literals from django.db import models from django.urls import reverse from django.utils import timezone from django.utils.encoding import uri_to_iri from django.contrib.auth.models import User from mptt.models import MPTTModel, TreeForeignKey from post.models import Question from root....
'''Tests for multipletests and fdr pvalue corrections Author : Josef Perktold ['b', 's', 'sh', 'hs', 'h', 'fdr_i', 'fdr_n', 'fdr_tsbh'] are tested against R:multtest 'hommel' is tested against R stats p_adjust (not available in multtest 'fdr_gbs', 'fdr_2sbky' I did not find them in R, currently tested for cons...
# SQLite connection with python based on chapter 3. # Python 3.4 """ A script for query on Skype Database. The default location of Skype's main.db on linux is: /home/$LINUX_USER_NAME/.Skype/$SKYPE_USER_NAME """ import sqlite3 import argparse import os def printProfile(skypeDB): connection...
import os import os.path import re import string import sys srcdir = os.path.abspath(os.path.dirname(__file__)) docdir = os.path.abspath(os.path.join(srcdir, "..", "doc")) def edit(file, *replacements): print(" '%s'..." % file) f = open(file, 'r') text = f.read() f.close() for (source, target) i...
""" articles module (imdb package). This module provides functions and data to handle in a smart way articles (in various languages) at the beginning of movie titles. Copyright 2009 Davide Alberani <<EMAIL>> 2009 H. Turgut Uyar <<EMAIL>> This program is free software; you can redistribute it and/or modify...
"""The Flyweight Pattern Notes: If you work for a data science team or have to deal with big data, this pattern will be particularly useful. In situations wherein several objects have some common memory intensive state, the flyweight pattern can be implemented to separate and store the memory intensive state in a co...
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import ( compat_urllib_parse, compat_urllib_request, ) from ..utils import ( ExtractorError, ) class FiredriveIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?firedrive\.com/' + \ ...
"""Cache for marking a record as locked.""" from __future__ import absolute_import, division, print_function from invenio_cache import current_cache class LockCache(object): """Lock cache for ``pid_value``""" key_prefix = 'lock::' def __init__(self): """Initialize the cache.""" def _prefi...
# -*- coding: utf-8 -*- """ pygments.formatters.latex ~~~~~~~~~~~~~~~~~~~~~~~~~ Formatter for LaTeX fancyvrb output. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import division from pygments.formatter import Forma...
from openerp import SUPERUSER_ID from openerp.tools import html2plaintext from openerp.tools.translate import _ from openerp.osv import osv, fields, expression class MailMessage(osv.Model): _inherit = 'mail.message' def _get_description_short(self, cr, uid, ids, name, arg, context=None): res = dict.fr...
"""Module containing some plugin to run pytest. """ import configparser import logging import os import tempfile import json import subprocess import shlex import urllib import urllib.parse import urllib.request import hmac import jinja2 import xmltodict import yaml from ox_herd import settings as ox_herd_settings...
# The views used below are normally mapped in django.contrib.admin.urls.py # This URLs file is used to provide a reliable view deployment for test purposes. # It is also provided as a convenience to those who want to deploy these URLs # elsewhere. from django.conf.urls import patterns, url urlpatterns = patterns('', ...
from copy import deepcopy import unittest from file_system import FileSystem, FileNotFoundError, StatInfo from future import Future from patched_file_system import PatchedFileSystem from patcher import Patcher from test_file_system import TestFileSystem from test_patcher import TestPatcher import url_constants _TEST_...
import ansible from ansible.callbacks import vv from ansible.errors import AnsibleError as ae from ansible.runner.return_data import ReturnData from ansible.utils import parse_kv from ansible.inventory.host import Host from ansible.inventory.group import Group class ActionModule(object): ''' Create inventory host...
import sys, os sys.path.append('./tools/') import traversal, bfutils, graphkit import unknownrate as ur from multiprocessing import Pool,Process, Queue, cpu_count, current_process, active_children import functools import zickle as zkl import time, socket import scipy KEY='rasl_il_u2' UMAX = 2 INPNUM = 1 # number of ra...
from django.contrib import auth from django.contrib.auth import load_backend from django.contrib.auth.backends import RemoteUserBackend from django.core.exceptions import ImproperlyConfigured from django.utils.functional import SimpleLazyObject def get_user(request): if not hasattr(request, '_cached_user'): ...
from __future__ import absolute_import from datetime import datetime, timedelta from grab.spider.error import SpiderMisuseError from grab.base import copy_config from grab.util.warning import warn class BaseTask(object): pass class Task(BaseTask): """ Task for spider. """ def __init__(self, na...
from webkitpy.tool.bot.patchanalysistask import PatchAnalysisTask, PatchAnalysisTaskDelegate, UnableToApplyPatch class StyleQueueTaskDelegate(PatchAnalysisTaskDelegate): def parent_command(self): return "style-queue" class StyleQueueTask(PatchAnalysisTask): def validate(self): self._patch = ...
# -*- coding: utf-8 -*- """ *************************************************************************** EditScriptAction.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com **********************...
"""Resource-aware json reference loaders to be used with jsonref.""" from __future__ import absolute_import, division, print_function import re from flask import current_app from jsonref import JsonLoader, JsonRef from werkzeug.urls import url_parse import jsonresolver from jsonresolver.contrib.jsonref import json_...
""" Tests for results finder. """ from django.core.urlresolvers import reverse from tests import case class CaseColumnTest(case.DBTestCase): """Tests for results finder CaseColumn.""" @property def column(self): """The Column class under test.""" from moztrap.view.results.finders import...
import types import mock import pytest import librarian.data.meta.archive as mod # UNIT TESTS @mock.patch.object(mod, 'exts') @mock.patch.object(mod.Archive, 'MetaWrapper') @mock.patch.object(mod.Archive.Processor, 'is_entry_point') def test__analyze(is_entry_point, MetaWrapper, exts): is_entry_point.return_v...
import analytic_plan_create_model import account_crossovered_analytic # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# -*- coding: utf-8 -*- """ *************************************************************************** PointSelectionPanel.py --------------------- Date : February 2016 Copyright : (C) 2016 by Alexander Bruy Email : alexander dot bruy at gmail dot com ****...
__version__ = '0.2.2' import sys import os import re from sgmllib import SGMLParser from StringIO import StringIO from textwrap import TextWrapper from urllib2 import urlparse CODEBLOCK = '::' BLOCKTAGS = ['div', 'blockquote'] IGNORETAGS = ['title', 'style', 'script'] UNDERLINES = list('=-~`+;') # Fredrik Lundh, htt...
# -*- coding: utf-8 -*- # # Unbound scripting interface documentation build configuration file # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleable (module imports are okay, they're rem...
import os import abc import glob import filecmp import unittest import sandpaper import six import braceexpand class BaseRuleTest(six.with_metaclass(abc.ABCMeta, unittest.TestCase)): """ The base rule test. """ @abc.abstractproperty def rule_name(self): """ Required rule name for static pat...
""" A reader for corpora that consist of plaintext documents. """ import codecs import nltk.data from nltk.compat import string_types from nltk.tokenize import * from nltk.corpus.reader.util import * from nltk.corpus.reader.api import * class PlaintextCorpusReader(CorpusReader): """ Reader for corpora that ...
from .. import types from ._runtime_segment import runtime_weaver class weaver(object): identifier = None def __init__(self, type, *inputs): self.type = types.typeclass(type).get_tuple() if len(self.type) != len(inputs): raise TypeError("Weaver is declared as a tuple of %d inputs,...
# coding: utf-8 # django imports from django.contrib.sessions.models import Session from django.shortcuts import get_object_or_404, render_to_response from django.http import HttpResponseRedirect from django.contrib.auth.models import User from django.template import RequestContext from django.conf import settings fro...
#!/usr/bin/env python3 """ /*************************************************************************** context_help_id.py ------------------- begin : 2009-11-16 copyright : (C) 2009 by Gary E.Sherman email ...
import unittest import numpy import chainer from chainer import cuda from chainer import functions from chainer import testing from chainer.testing import attr def _to_gpu(x, device_id): if device_id >= 0: return cuda.to_gpu(x, device_id) else: return x @testing.parameterize(*testing.prod...
DATE_FORMAT = 'l, j F, Y' TIME_FORMAT = 'h:i:s a' DATETIME_FORMAT = 'j F, Y h:i:s a' YEAR_MONTH_FORMAT = 'F, Y' MONTH_DAY_FORMAT = 'j F' SHORT_DATE_FORMAT = 'j.M.Y' SHORT_DATETIME_FORMAT = 'j.M.Y H:i:s' FIRST_DAY_OF_WEEK = 1 # (Monday) DATE_INPUT_FORMATS = ( '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '...
"""Print the valid actions.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from absl import app from absl import flags from pysc2.lib import actions from pysc2.lib import features from pysc2.lib import point_flag FLAGS = flags.FLAGS point_flag.DEFINE_...
from StandardDataSets.scripts import JudgeAssistant # Please feed your node list here: tagLst = [] attrName = '' attrVal = '' dataToCheck = '' class SimpleJudgingObject: def __init__(self, _tagLst, _attrName, _attrVal, _data): self.tagList = _tagLst self.attrName = _attrName se...
import os import pickle import tempfile from colors import colors from regression import linear def tree2dot(outfilename, tree, axes, categories): """ Dumps a tree in dotty format. outfilename : name of the output dot file tree : the tree to dump axes : a list of strings containing the label for...
import sys if sys.version < '2.6' or sys.version >= '2.8': print >> sys.stderr, "Unsupported Python version: WebKit only supports 2.6.x - 2.7.x, and you're running %s." % sys.version.split()[0] sys.exit(1)
""" This modules implements the CrawlSpider which is the recommended spider to use for scraping typical web sites that requires crawling pages. See documentation in docs/topics/spiders.rst """ import copy from scrapy.http import Request, HtmlResponse from scrapy.utils.spider import iterate_spider_output from scrapy....
# -*- coding: utf-8 -*- # # Basic testing script that creates a sample universe and world # with a predefined set of parameters and executes a simulation batch import numpy as np import matplotlib.pyplot as plt from simul.universe import Universe from simul.world import WonderfulWorld from simul.control import Simulat...
""" ZSNES Save State Parser (v143 only currently) Author: Jason Gorski Creation date: 2006-09-15 """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, StaticFieldSet, UInt8, UInt16, UInt32, String, PaddingBytes, Bytes, RawBytes) from hachoir_core.endian import LITTLE_ENDIAN class ZS...
data = ( 'Kui ', # 0x00 'Si ', # 0x01 'Liu ', # 0x02 'Nao ', # 0x03 'Heng ', # 0x04 'Pie ', # 0x05 'Sui ', # 0x06 'Fan ', # 0x07 'Qiao ', # 0x08 'Quan ', # 0x09 'Yang ', # 0x0a 'Tang ', # 0x0b 'Xiang ', # 0x0c 'Jue ', # 0x0d 'Jiao ', # 0x0e 'Zun ', # 0x0f 'Liao ', # 0x...
import Framework class Label(Framework.TestCase): def setUp(self): Framework.TestCase.setUp(self) self.label = self.g.get_user().get_repo("PyGithub").get_label("Bug") def testAttributes(self): self.assertEqual(self.label.color, "e10c02") self.assertEqual(self.label.name, "Bug"...
#encoding=utf-8 from __future__ import print_function,unicode_literals import sys sys.path.append("../") import jieba g_mode="default" def cuttest(test_sent): global g_mode result = jieba.tokenize(test_sent,mode=g_mode,HMM=False) for tk in result: print("word %s\t\t start: %d \t\t end:%d" % (tk[0]...
""" This provides a restricted tag language to define the sosreport index/report """ try: import json except ImportError: import simplejson as json class Node(object): def __str__(self): return json.dumps(self.data) def can_add(self, node): return False class Leaf(Node): "...
from ..broker import Broker class SpmHistoryEndHostHistoryGridBroker(Broker): controller = "spm_history_end_host_history_grids" def index(self, **kwargs): """Lists the available spm history end host history grids. Any of the inputs listed may be be used to narrow the list; other inputs will be ignore...
from __future__ import print_function from Components.config import config from enigma import eServiceReference, eActionMap, eServiceCenter from Plugins.Extensions.OpenWebif.controllers.models.services import getProtection from Screens.InfoBar import InfoBar, MoviePlayer import NavigationInstance import os ENABLE_QPIP...
import re import time from urllib import urlencode from urlparse import parse_qs, urlsplit, urlunsplit from buildbot.status.builder import FAILURE, SUCCESS from master import build_utils from master.chromium_notifier import ChromiumNotifier from master.failures_history import FailuresHistory from twisted.internet imp...
import numpy as np from orbital_elements.mee.gve import GVE __author__ = "Nathan I. Budd" __email__ = "<EMAIL>" __copyright__ = "Copyright 2017, LASR Lab" __license__ = "MIT" __version__ = "0.1" __status__ = "Production" __date__ = "19 Mar 2017" class ConstantThrust(object): """Constant LVLH acceleration as MEE ...
from django.db import connection from django.test.utils import CaptureQueriesContext from django.urls import reverse from django.utils.translation import gettext_lazy as _ from tcms.management.models import Component from tcms.tests import LoggedInTestCase from tcms.tests.factories import BuildFactory from tcms.utils....
import subprocess from json import json class OrcidSearch: def search_authors(self, query): query = query.replace(" ", "+") """ FIXME: Don't create a process to do this! """ p = subprocess.Popen("curl -H 'Accept: application/orcid+json' \ 'http:...
"""A class for handling font file access.""" from typing import Text, List, Iterable from fontTools import ttLib from fontTools.ttLib import ttFont from src.utils import region as region_lib _RANGES = [ # (1) CJK Unified Ideographs (0x4E00, 0x9FFF), # (2) CJK Unified Ideographs Extension A (0x3400, ...
from time import clock from math import * from Numeric import * from presto import * from miscutils import * from Statistics import * import Pgplot # Some admin variables showplots = 0 # True or false showsumplots = 0 # True or false debugout = 0 # True or false outfiledir = '/home/ransom' outfil...
from test.support import findfile, TESTFN, unlink import unittest import array import io import pickle import sys class UnseekableIO(io.FileIO): def tell(self): raise io.UnsupportedOperation def seek(self, *args, **kwargs): raise io.UnsupportedOperation class AudioTests: close_fd = False...
# coding: utf-8 """ flask_wtf.i18n ~~~~~~~~~~~~~~ Internationalization support for Flask WTF. :copyright: (c) 2013 by Hsiaoming Yang. """ from flask import _request_ctx_stack from flask_babel import get_locale from babel import support try: from wtforms.i18n import messages_path except ImportErro...
import logging from django.utils.encoding import smart_str from desktop.lib import export_csvxls LOG = logging.getLogger(__name__) DL_FORMATS = [ 'csv', 'xls' ] def download(api, session, cell, format): if format not in DL_FORMATS: LOG.error('Unknown download format "%s"' % format) return content_gen...
from tempest.api.compute import base from tempest import config from tempest import test CONF = config.CONF class FixedIPsTestJson(base.BaseV2ComputeAdminTest): @classmethod def skip_checks(cls): super(FixedIPsTestJson, cls).skip_checks() if CONF.service_available.neutron: msg = ...
""" Client side of the scheduler manager RPC API. """ import oslo_messaging as messaging import jacket.compute.conf from jacket.objects.compute import base as objects_base from jacket import rpc CONF = jacket.compute.conf.CONF class SchedulerAPI(object): '''Client side of the scheduler rpc API. API versio...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.inventory.manager import split_host_pattern, order_patterns from ansible.plugins.lookup import LookupBase class LookupModule(LookupBase): def get_hosts(self, variables, pattern): hosts = [] if pa...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from tests import TestCase from i8c.compiler import StackError # All binary operations were considered equal to each other: the "mul" # and "add" were considered equival...
"""Implementations of mapping abstract base class query_inspectors.""" # pylint: disable=invalid-name # Method names comply with OSID specification. # pylint: disable=no-init # Abstract classes do not define __init__. # pylint: disable=too-few-public-methods # Some interfaces are specified as 'markers' and ...
import requests from six.moves.urllib import parse from rally.common.i18n import _ from rally.common import logging from rally.common import utils as rutils from rally import consts from rally import osclients from rally.plugins.openstack.cleanup import manager as resource_manager from rally.plugins.openstack.cleanup ...
import yaml import os import pathlib2 import itertools import sys TRAVIS_BUILD_DIR = os.environ.get("TRAVIS_BUILD_DIR", "") CONFIG_FILE_PATH = pathlib2.Path(TRAVIS_BUILD_DIR, "util", "parsefiles_config.yml") def get_used_images(images): """ Returns the images and their ranks that are scheduled to be built and...
# -*- coding: utf-8 -*- ''' Genesis Add-on Copyright (C) 2015 lambda 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 3 of the License, or (at your opt...
""" Support for fetching WiFi associations through SNMP. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.snmp/ """ import binascii import logging import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassis...
import itertools from oslo_config import cfg from oslo_context import context from oslo_log import log import oslo_messaging from stevedore import extension from ceilometer.agent import plugin_base as base from ceilometer import coordination from ceilometer.event import endpoint as event_endpoint from ceilometer.i18n...
from social.backends.oauth import BaseOAuth2 # This provides a backend for python-social-auth. This should not be confused # with officially battle.net offerings. This piece of code is not officially # affiliated with Blizzard Entertainment, copyrights to their respective # owners. See http://us.battle.net/en/forum/t...
import pytest import mock from api.users.serializers import UserSerializer from osf_tests.factories import ( UserFactory, ) from tests.utils import make_drf_request_with_version @pytest.fixture() @mock.patch('website.search.elastic_search.update_user') def user(mock_update_user): user = UserFactory() use...
from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from django.http import HttpResponse, Http404 from exceptions import * from django.conf import settings from default_settings import RATINGS_VOTES_PER_IP class AddRatingView(object): def __call__(self,...
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.test import TestCase from persons.models import Person from models import Candidate, CandidateList class CreationTest(Test...
"""Tests each of the functions in mongo_doc_manager """ import time import sys if sys.version_info[:2] == (2, 6): import unittest2 as unittest else: import unittest sys.path[0:0] = [""] from mongo_connector.doc_managers.mongo_doc_manager import DocManager from pymongo import MongoClient from tests import mo...
from __future__ import print_function from __future__ import absolute_import from .common import * from .dr8 import * class DR9(DR8): def __init__(self, **kwargs): ''' Useful kwargs: basedir : (string) - local directory where data will be stored. ''' DR8.__init__(s...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import DataMigration from django.db import models from django_countries import countries class Migration(DataMigration): def forwards(self, orm): """Populate the available countries with all 2-character ISO country codes. """ ...
""" Python shell for Diofant. This is just a normal Python shell (IPython shell if you have the IPython package installed), that adds default imports and run some initialization code. """ import argparse import ast import atexit import code import os import readline from diofant.interactive.session import (Automatic...
"""Run time libraries needed to run parsers generated by Yapps. This module defines parse-time exception classes, a scanner class, a base class for parsers produced by Yapps, and a context class that keeps track of the parse stack. """ from __future__ import print_function import sys, re MIN_WINDOW=4096 # File look...
import re from ampadb.support import Forms from django import forms from django.core.exceptions import ValidationError from .models import Extraescolar, Inscripcio class _ExtraescolarMeta: # pylint: disable=too-few-public-methods model = Extraescolar fields = [ 'nom', 'id_interna', 'descripcio_curta'...
from __future__ import unicode_literals from time import gmtime from calendar import timegm from datetime import datetime import pytz from dateutil.parser import parse from dateutil.relativedelta import relativedelta from elasticsearch import Elasticsearch from website import settings from util import generate_co...