content stringlengths 4 20k |
|---|
"""
This module provides models for NAT-SDK.
"""
class Billing(object):
"""
This class define billing.
param: paymentTiming:
The pay time of the payment,
see more detail in https://bce.baidu.com/doc/BCC/API.html#Billing
param: reservationLength:
The duration to buy in specified... |
# python
# This file is generated by a program (mib2py).
import HP_SNTPclientConfiguration_MIB
OIDMAP = {
'1.3.6.1.4.1.11.2.14.11.1.8': HP_SNTPclientConfiguration_MIB.hpSntpConfigMod,
'1.3.6.1.4.1.11.2.14.11.1.8.1': HP_SNTPclientConfiguration_MIB.hpSntpConfig,
'1.3.6.1.4.1.11.2.14.11.1.8.2': HP_SNTPclientConfigurati... |
from __future__ import unicode_literals
import argparse
import glob
import logging
import os
import sys
import uuid
logger = logging.getLogger('Environment')
def _get_chrome_path():
if sys.platform == 'win32':
# First path includes fallback for Windows XP, because it doesn't have
# LOCALAPPDATA v... |
from django.contrib.auth.models import User
from django.test import TestCase
from os import path
from tardis.tardis_portal.models import Experiment, Dataset, Dataset_File
from ..integrity import IntegrityCheck
class IntegrityCheckTestCase(TestCase):
def _make_dataset(self, exp, filenames):
dataset = Dat... |
"""
Copyright (c) 2011-2013 "Johannes Findeisen and Rafael Timmerberg"
This file is part of Linspector (http://linspector.org).
Linspector 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 ... |
#!/usr/bin/env python
"""A script to prepare the source tree for building."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# This script must have no special requirements because it wont be able to
# import any GRR ... |
from django.contrib.auth.models import User, Group
from django.forms.models import model_to_dict
from common.response import json_response
import re
import logging
logger = logging.getLogger("newt."+__name__)
def get_user_info(user_name, uid):
"""Returns information about the user
Keyword arguments:
user_... |
import doctest
from datetime import datetime
from insights.parsers import ovirt_engine_log
from insights.tests import context_wrap
SERVER_LOG = """
2018-01-17 01:46:15,022+05 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0027: Starting deployment of "restapi.war" (runtime-name: "restapi.war"... |
import struct
from .streamer import Streamer
def parse_bc_int(f, v=None):
if v is None:
v = ord(f.read(1))
if v == 253:
v = struct.unpack("<H", f.read(2))[0]
elif v == 254:
v = struct.unpack("<L", f.read(4))[0]
elif v == 255:
v = struct.unpack("<Q", f.read(8))[0]
r... |
import sys
import Adafruit_DHT
# Parse command line parameters.
sensor_args = { '11': Adafruit_DHT.DHT11,
'22': Adafruit_DHT.DHT22,
'2302': Adafruit_DHT.AM2302 }
if len(sys.argv) == 3 and sys.argv[1] in sensor_args:
sensor = sensor_args[sys.argv[1]]
pin = sys.argv[2]
else:
... |
import importlib
import re
import pkgutil
module_cache = {}
NOT_2_STARS = re.compile(r'(?<!\*)(\*)(?!\*)')
def _get_cached_module(module_name):
if module_name not in module_cache:
try:
module_cache[module_name] = importlib.import_module(module_name)
except ImportError:
modu... |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from django.test import TestCase
from ..apps.base import AppBase
# since AppBase introspects its name based upon the django app which it
# is located in, if the module name changes, the tests fail. this would
# be misleading, since it's the renamed tests at fault, ... |
__all__ = [
'RedisError',
'ProtocolError',
'ReplyError',
'MaxClientsError',
'AuthError',
'PipelineError',
'MultiExecError',
'WatchVariableError',
'ChannelClosedError',
'ConnectionClosedError',
'ConnectionForcedCloseError',
'PoolClosedError',
'MasterNotFoundError',
... |
"""
K. H. Huarng, “Effective lengths of intervals to improve forecasting in fuzzy time series,”
Fuzzy Sets Syst., vol. 123, no. 3, pp. 387–394, Nov. 2001.
"""
import numpy as np
import math
import random as rnd
import functools, operator
from pyFTS.common import FuzzySet, Membership, Transformations
from pyFTS.partit... |
"""A tool to embedded tsv file into test binary for quality regression test."""
from __future__ import absolute_import
from __future__ import print_function
import codecs
import sys
import xml.dom.minidom
_DISABLED = 'false'
_ENABLED = 'true'
def ParseTSV(file):
for line in codecs.open(file, 'r', encoding='utf-... |
"This module contains convenience functions for using dbus-activated services."
from __future__ import absolute_import
import dbus
import dbus.service
from six import with_metaclass
from .._wrappers import _glib as GLib
from . import polkit
__all__ = ["Object", "InterfaceType", "set_mainloop"]
__mainloop__ = None... |
"""
Undo commands for Cheqlist.
:Copyright: © 2015-2021, Chris Warrick.
:License: BSD (see /LICENSE).
"""
try:
from PySide2.QtWidgets import QUndoCommand
from PySide2 import QtCore
except ImportError:
from PyQt5.QtWidgets import QUndoCommand
from PyQt5 import QtCore
__all__ = ('CommandAdd', 'CommandD... |
import numpy as np
import tempfile, os
def run_solvers(niter, solvers, disp_interval=10):
"""Run solvers for niter iterations, returning the loss and accuracy recorded each iteration. `solvers` is a list of (name, solver) tuples."""
blobs = ('loss', 'acc')
loss, acc = ({name: np.zeros(niter) for na... |
import eventlet
import os
import sys
from st2common import log as logging
from st2common.service_setup import setup as common_setup
from st2common.service_setup import teardown as common_teardown
from st2actions.notifier import config
from st2actions.notifier import notifier
from st2actions.notifier import scheduler
... |
#!/usr/bin/env python
"""Unpack a MIME message into a directory of files."""
import os
import sys
import email
import errno
import mimetypes
from optparse import OptionParser
def main():
parser = OptionParser(usage="""\
Unpack a MIME message into a directory of files.
Usage: %prog [options] msgfile
""")
p... |
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
# SECURITY WARNING: keep the... |
#!/usr/bin/env python
"""Handles encoding ogg vorbis files"""
import subprocess
from .. import config
HANDLES=['ogg']
def encode(inF, outF, options, meta):
#Get all the options to give to oggenc
cli_options = getCliOptions(inF, outF, options, meta)
#Do the actual encoding
st = subprocess.call(['oggenc... |
from .geom import geom
class geom_abline(geom):
"""
Line specified by slope and intercept
Parameters
----------
slope:
slope parameter for the line (think y = mx + b; remember, slope is m)
intercept:
intercept parameter for the line (think y = mx + b; remember, intercept is b)
... |
"""REST backend for the google analytics UI."""
import flask
import flask_babel
import flask_login
import flask_restful
import flask_sqlalchemy
import flask_user
import logging
app = flask.Flask(__name__)
app.config.from_object('backend.config')
api = flask_restful.Api(app)
babel = flask_babel.Babel(app)
db = flask... |
from distutils.version import StrictVersion
import re
from auslib.errors import BadDataError
class ModernMozillaVersion(StrictVersion):
"""A version class that is slightly less restrictive than StrictVersion.
Instead of just allowing "a" or "b" as prerelease tags, it allows any
alpha. This allows u... |
from django.conf.urls import url, include
from education_group.api.views.group import GroupDetail, GroupTitle
from education_group.api.views.group_element_year import TrainingTreeView, MiniTrainingTreeView, GroupTreeView
from education_group.api.views.hops import HopsList
from education_group.api.views.mini_training i... |
from django.contrib import admin
from collections import OrderedDict
from .base_model_admin import BaseModelAdmin
from edc_export.actions import export_as_csv_action
from ..actions import flag_as_reviewed, unflag_as_reviewed
from ..forms import ResultForm
from ..models import Result
class ResultAdmin(BaseModelAdmin... |
# -*- coding: utf-8 -*-
from openerp.tests import common
class TestOnChange(common.TransactionCase):
def setUp(self):
super(TestOnChange, self).setUp()
self.Discussion = self.env['test_new_api.discussion']
self.Message = self.env['test_new_api.message']
def test_default_get(self):
... |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
'''
Copyright 2014-2015 Teppo Perä
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
Un... |
import gtk
from interface import WidgetInterface, TranslateMixin
from tryton.config import CONFIG
try:
import gtkspell
except ImportError:
gtkspell = None
class TextBox(WidgetInterface, TranslateMixin):
def __init__(self, field_name, model_name, attrs=None):
super(TextBox, self).__init__(field_n... |
"""
Plugin actions
"""
from logging import getLogger
from bottle import request
from alignak_webui.utils.plugin import Plugin
# pylint: disable=invalid-name
logger = getLogger(__name__)
class PluginActions(Plugin):
""" Actions plugin """
def __init__(self, app, webui, cfg_filenames=None):
"""... |
# encoding: UTF-8
'''
vn.lhang的gateway接入
'''
import os
import json
from datetime import datetime
from time import sleep
import vnlhang
from vtGateway import *
SYMBOL_BTCCNY = 'BTCCNY'
SYMBOL_ZECCNY = 'ZECCNY'
SYMBOL_MAP = {}
SYMBOL_MAP['btc_cny'] = SYMBOL_BTCCNY
SYMBOL_MAP['zec_cny'] = SYMBOL_ZECCNY
SYMBOL_MAP_R... |
from __future__ import division
def sieve_of_eratosthenes(n):
"""
Sieve of Eratosthenes is used for finding prime number upto n.
This function returns a list of prime numbers. And did I mention that it is bloody fast?
Primes upto 13000 are calculated in 0.4 seconds in CPython. And don't even mention PyPy.
"""
... |
from nltk.sem import root_semrep, Expression
from nltk import parse
from nltk.inference import Mace, spacer, get_prover
from nltk.data import show_cfg
import os
"""
Module for incrementally developing simple discourses, and checking for semantic ambiguity,
consistency and informativeness.
Many of the ideas are based... |
"""
run this with ./manage.py test website
see http://www.djangoproject.com/documentation/testing/ for details
"""
from __future__ import unicode_literals
import mock
from django.conf import settings
from django.template.loader import render_to_string
from django.test import TestCase
from django.test.utils import over... |
import unittest
from pyflink.dataset import ExecutionEnvironment
from pyflink.testing.test_case_utils import PythonAPICompletenessTestCase
class ExecutionEnvironmentCompletenessTests(PythonAPICompletenessTestCase,
unittest.TestCase):
@classmethod
def python_class(... |
import inspect
import os
import shutil
import tempfile
try:
import unittest2 as unittest
except ImportError:
import unittest
import mock
from nectar.request import DownloadRequest
from pulp.common.plugins import importer_constants, reporting_constants
from pulp.plugins.config import PluginCallConfiguration
fr... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import signal
import sys
import termios
import time
import tty
from os import (
getpgrp,
isatty,
tcgetpgrp,
)
from ansible.errors import AnsibleError
from ansible.module_utils._text import to_text, to_n... |
import os
import unittest
def requires_database():
if os.environ.get("TKP_DISABLEDB", False):
return unittest.skip("Database functionality disabled in configuration")
return lambda func: func
def requires_data(*args):
for filename in args:
if not os.path.exists(filename):
ret... |
"""Tests for proxy_lagrangian_optimizer.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow.compat.v2 as tf
from tensorflow_constrained_optimization.python import graph_and_eager_test_case
from tensorflow_constrained... |
import os
import re
import sys
import urllib
"""Logpuzzle exercise
Given an apache logfile, find the puzzle urls and download the images.
Here's what a puzzle url looks like:
10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] "GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; e... |
import socket
import struct
import time
import sys
import re
# If you're using an old version of python that don't have json available,
# you can use simplejson instead: https://simplejson.readthedocs.org/en/latest/
#import simplejson as json
import json
class pyZabbixSender:
'''
This class allows you to sen... |
import os
import math
import collections
import json
import shutil
from org.transcrypt import utils
'''
A cascaded mini mapping is made as follows:
- First generated a non-cascaded pretty map
- After that have the minifier generate a shrink map and load that
- After that cascade the two to obt... |
import os
from pyface.constant import OK
from pyface.file_dialog import FileDialog
from pychron.envisage.resources import icon
from pychron.envisage.tasks.actions import PAction as Action, PTaskAction as TaskAction
from pychron.pychron_constants import DVC_PROTOCOL
class AddFluxMonitorAction(Action):
name = 'Ad... |
# coding: utf-8
from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..compat import (
compat_parse_qs,
compat_urlparse,
)
from ..utils import (
ExtractorError,
update_url_query,
)
class SafariBaseIE(InfoExtractor):
_LOGIN_URL = 'https://learning.... |
from discord.ext import commands
from datetime import datetime
import math
class Reset:
def __init__(self, bot):
self.bot = bot
@commands.command(description='Shows daily reset is.')
async def reset(self):
now = datetime.utcnow()
then = datetime.utcnow().replace(hour=23, minute=5... |
from openerp import models, fields, exceptions, api, _
class StockQuant(models.Model):
_inherit = "stock.quant"
@api.model
def create(self, vals):
if vals.get('negative_move_id') and vals.get('lot_id'):
del vals['lot_id']
return super(StockQuant, self).create(vals)
class St... |
import pytest
from mugen.events import Event, EventList, EventGroupList
class Beat(Event):
pass
class Silence(Event):
pass
@pytest.fixture
def events() -> EventList:
return EventList([Silence(6),
Beat(12),
Beat(18),
Beat(24),
... |
"""
Django settings for odm2testsite project.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ..... |
# -*- coding: utf-8 -*-
from baseScreen import BaseScreen
import mopidy.models
from ..graphic_utils import ListView
class BrowseScreen(BaseScreen):
def __init__(self, size, base_size, manager, fonts):
BaseScreen.__init__(self, size, base_size, manager, fonts)
self.list_view = ListView((0, 0), (
... |
INSERT_TESTS = {
'id': 'I',
'caption': 'Insert Tests',
'checkAttrs': False,
'checkStyle': False,
'Proposed': [
{ 'desc': '',
'command': '',
'tests': [
]
},
{ 'desc': 'insert <hr>',
'command': 'inserthorizontalrule',
'tests': ... |
import pygame, sys
from pygame.locals import *
screen_size = (500,600) # ustalamy rozmiar ekranu
class menu(object):
def __init__(self):
pygame.init()
flag = DOUBLEBUF # wlaczamy tryb podwojnego buforowania
# tworzymy bufor na grafike
self.surface = pyga... |
from tcga_encoder.utils.helpers import *
from tcga_encoder.data.data import *
from tcga_encoder.definitions.tcga import *
#from tcga_encoder.definitions.nn import *
from tcga_encoder.definitions.locations import *
#from tcga_encoder.algorithms import *
import seaborn as sns
from sklearn.manifold import TSNE, locally_li... |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Pedro Algarvio (<EMAIL>)`
tests.unit.utils.format_call_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test `salt.utils.format_call`
'''
# Import python libs
from __future__ import absolute_import
# Import Salt Testing libs
from salttesting import TestCase
fr... |
from django.test import TestCase, override_settings, RequestFactory
from django_hosts.resolvers import reverse
from headers.utils.functional import (
set_headers,
del_headers,
get_uwsgi_version,
get_gunicorn_version,
)
from headers.utils.decorators import (
with_headers,
without_headers,
via... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ActionCluster.year'
db.add_column(u'actionclusters_action... |
"""IdMap class definition and its derivatives."""
from subordinate.idrangeset import IdRangeSet
from subordinate.utils import BadIdFile, Config
class IdMap(object):
"""
IdMap(id_file) -> IdMap object
Returns a map between names and ids. This map can be loaded from
a file such as '/etc/subuid' or '/et... |
import paddle.fluid as fluid
from paddle.fluid import compiler
import unittest
import logging
import six
import os
os.environ['CPU_NUM'] = str(4)
class TestBase(unittest.TestCase):
def main(self,
network_func,
iter=10,
iter_per_pe=10,
use_gpu=True,
... |
import pytest
from airflow.providers.amazon.aws.example_dags.example_google_api_to_s3_transfer_advanced import (
S3_DESTINATION_KEY as ADVANCED_S3_DESTINATION_KEY,
)
from airflow.providers.amazon.aws.example_dags.example_google_api_to_s3_transfer_basic import (
S3_DESTINATION_KEY as BASIC_S3_DESTINATION_KEY,
)... |
from UaStateGeneric import UaStateGeneric
from CCEvents import CCEventDisconnect, CCEventRing, CCEventConnect, CCEventFail, CCEventRedirect
class UacStateUpdating(UaStateGeneric):
sname = 'Updating(UAC)'
triedauth = False
connected = True
def recvRequest(self, req):
if req.getMethod() == 'INVI... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import tensorflow as tf
from tensorforce import util
from tensorforce.core.optimizers import Optimizer
class Synchronization(Optimizer):
"""
The synchronization optimizer updates variables periodical... |
import urllib2
from lxml import html
from nose.tools import assert_equals
from lettuce import world, before, step
from lettuce.django import django_url
from django.test.client import Client
@before.all
def set_client():
world.browser = Client()
@step(r'I navigate to "(.*)"')
def given_i_navigate_to_group1(step, u... |
from datetime import date
from ..core import MON, TUE, WED, THU, FRI, SAT, SUN
from ..registry_tools import iso_register
from .core import UnitedStates
@iso_register('US-NC')
class NorthCarolina(UnitedStates):
"""North Carolina"""
include_good_friday = True
include_christmas_eve = True
include_thanks... |
from base import Knows
_EMPTY = object()
_knows = _EMPTY
_tests_to_run = []
def _init_knows(*args, **kwargs):
global _knows
if _knows is _EMPTY:
_knows = Knows(*args, **kwargs)
def pytest_addoption(parser):
group = parser.getgroup('knows', 'Knows Unit Test Mapping')
group.addoption(
... |
from .linked_service import LinkedService
class HubspotLinkedService(LinkedService):
"""Hubspot Serivce linked service.
:param additional_properties: Unmatched properties from the message are
deserialized this collection
:type additional_properties: dict[str, object]
:param connect_via: The inte... |
#! /usr/bin/env python
from openturns import *
from math import *
TESTPREAMBLE()
try :
# TEST NUMBER ZERO : DEFAULT & COPY CONSTRUCTORs AND STRING CONVERTER
print "test number zero : default & copy constructors and string converter"
vectR = NumericalPoint(1, 12.0)
testSample = NumericalSample(1, 1)
... |
import argparse
import struct
from PIL import Image
def encode(c):
return chr(c)
def encodeSigned (c):
if c<0:
return chr(256+c)
return chr(c)
def RllConvert(inName, outName):
im=Image.open(inName)
width,height=im.size
pixelData=list(im.getdata())
with open(outName, "wb") as out:
... |
from django.conf import settings
from django.utils.encoding import force_unicode
import os
import sys
__main__ = sys.modules.get('__main__')
_map_file_path = '_generated_media_names.py'
_media_dir = '_generated_media'
# __main__ is not guaranteed to have the __file__ attribute
if hasattr(__main__, '__file__'):
_r... |
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from selection.tests.instance import gaussian_instance
def test_MSE(signal=1, n=100, p=10, s=1):
ninstance = 1
total_mse = 0
nvalid_instance = 0
data_instance = gaussian_instance(n, p, s, signal)
tau = 1.
... |
import pytest
import sqlalchemy as sa
from postgresql_audit import jsonb_change_key_name
@pytest.mark.usefixtures('activity_cls', 'table_creator')
class TestJSONBChangeKeyName(object):
@pytest.mark.parametrize(
('data', 'old_key', 'new_key', 'expected'),
(
(
'{"key1": ... |
# -*- coding: utf-8 -*-
# Python stdlib
import unittest
# Python tfstate
from tfstate.exceptions import InvalidResource
from tfstate.base import Resource
from tfstate.provider.other.null_resource import NullResource
# Unit tests
from unit_tests.base import BaseResourceUnitTest
class NullResourceUnitTest(BaseResour... |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from konfera.forms import OrderedTicketsInlineFormSet
from konfera.models import (Receipt, Order, Location, Event, Sponsor, TicketType, DiscountCode, Ticket, Speaker, Talk,
Room, Schedule, Organizer, Em... |
"""
# parse incoming hdlc data
# handles stream framing and escaping.
# http://en.wikipedia.org/wiki/High-Level_Data_Link_Control
# paragraph: Asynchronous framing
usage:
import hdlc
# 000303320037017D
p1 = "\x00\x03\x03\x32\x00\x37\x01\x7D"
p2 = hdlc.add_checksum(p1)
p3 = hdlc.escape_delimit(p2)
p... |
"""
A stub SFTP server for loopback SFTP testing.
"""
import os
from paramiko import ServerInterface, SFTPServerInterface, SFTPServer, SFTPAttributes, \
SFTPHandle, SFTP_OK, AUTH_SUCCESSFUL, OPEN_SUCCEEDED
class StubServer (ServerInterface):
def check_auth_password(self, username, password):
# all ar... |
from __future__ import absolute_import
import json
from .rest import HTTPMethod, RestModel
from .. import errors
class ShardState(object):
"""
Shard state
"""
OPENING = 'OPENING'
ACTIVE = 'ACTIVE'
CLOSED = 'CLOSED'
CLOSING = 'CLOSING'
class Shard(object):
"""
Shard class
"""
... |
#!/usr/bin/env python
# coding=utf-8
"""
@package ion.services.mi.common Common classes for MI work
@file ion/services/mi/common.py
@author Steve Foley
@author Edward Hunter
@brief Common enumerations, constants, utilities used in the MI work
"""
__author__ = 'Steve Foley'
__license__ = 'Apache 2.0'
import yaml
impo... |
from numpy.testing import *
from numpy.lib import *
from numpy.core import *
class TestApplyAlongAxis(TestCase):
def test_simple(self):
a = ones((20,10),'d')
assert_array_equal(apply_along_axis(len,0,a),len(a)*ones(shape(a)[1]))
def test_simple101(self,level=11):
a = ones((10,101),'d')... |
from msrest.serialization import Model
class ApplicationGatewaySku(Model):
"""SKU of an application gateway.
:param name: Name of an application gateway SKU. Possible values include:
'Standard_Small', 'Standard_Medium', 'Standard_Large', 'WAF_Medium',
'WAF_Large'
:type name: str or :class:`Appl... |
from django.db import models
class TestMe(models.Model):
test_m2m = models.ManyToManyField('self', blank=True, help_text="Lorem dolor")
test_ip = models.GenericIPAddressField(help_text="Lorem dolor")
test_url = models.URLField(help_text="Lorem dolor")
test_int = models.IntegerField(help_text="Lorem do... |
from servers import Servers
from hosts import Hosts
from macs import Macs
from ribs import Ribs |
"""
Contains any classes used for tab completion.
Reference - http://stackoverflow.com/questions/5637124/tab-completion-in-pythons-raw-input
"""
# Import Modules
import readline
import commands
import re
import os
class none(object):
def complete(self, args):
return [None]
class MainMenuCompleter(obj... |
# -*- coding: utf-8 -*-
from django.db import migrations, models
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.db.utils import IntegrityError
def set_string_id_using_domain(apps: StateApps, schema_editor: DatabaseSchemaEditor... |
from datetime import datetime
from . import EFARequest, OdvParserMixin
class StopfinderRequest(EFARequest, OdvParserMixin):
"""
Executes a STOPFINDER_REQUEST (which can not only find stops)
"""
def __init__(self, api, location, coords=None, limit=None):
super().__init__(api)
post = {
... |
import logging
from ..core.indicator import Indicator, IndicatorState
from ..core.toolwindow import ToolWindow
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class Pilatus(ToolWindow):
required_devices = ['pilatus']
def __init__(self, *args, **kwargs):
self.indicators = {}
... |
from django.db import models
from django.contrib.auth.models import User
from django.contrib import admin
class Page(models.Model):
STATUS_CHOICES = (
('published', 'published'),
('draft', 'draft'),
('deleted', 'deleted'),
)
MARKUP_CHOICES = (
('html', 'html'),
('markdown', 'markdown'),
(... |
#!/usr/bin/env python
from setuptools import setup
# note: this is a repeat of the README, to evolve, good enough for now.
long_desc = """
Contributors welcome, either adding new functionality or fixing bugs.
See also: https://msdn.microsoft.com/en-us/library/bb417343.aspx
"""
setup(
name="cabarchive",
vers... |
import urlparse
import logging
import os
import sys
import random
import re
import dns.resolver
from twisted.web.http import Request
from twisted.web.http import HTTPChannel
from twisted.web.http import HTTPClient
from twisted.internet import ssl
from twisted.internet import defer
from twisted.internet import re... |
from .successors import SimSuccessors
from .engine import SimEngine
from .vex import SimEngineVEX
from .procedure import SimEngineProcedure
from .unicorn import SimEngineUnicorn
from .failure import SimEngineFailure
from .syscall import SimEngineSyscall
from .hook import SimEngineHook
from .hub import EngineHub, Engi... |
import hashlib
import json
import logging
from django_user_agents.utils import get_user_agent
from myuw.dao import get_userids
from myuw.dao.affiliation import get_all_affiliations
logger = logging.getLogger('session')
def log_session(request):
logger.info({**get_userids(request),
**_get_session... |
from ceilometer_infoblox import pollsters
class QPSPollster(pollsters.BaseNIOSPollster):
def __init__(self):
super(QPSPollster, self).__init__()
@property
def meter_dict(self):
return {
'name': 'nios.dns.qps',
'unit': 'queries/s',
'type': 'gauge',
... |
#!/bin/python
# *-* encoding=utf-8 *-*
'''
Image Priting Program Based on Haftoning
'''
import numpy, scipy
from scipy import ndimage
from scipy import misc
import matplotlib.pyplot as plt
ht_map = {
0: numpy.array([[0,0,0],
[0,0,0],
[0,0,0]]),
1: nu... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Registration.mom_passport_origin'
db.add_column(u'registr... |
#!/usr/bin/python
#SYSTEM IMPORTS
import logging
import sys
import os
import cv2
import time
#COMMOM IMPORTS
from cv_utils.ImageRW import ImageWriter
#TODO allow images to be displayed over webserver and possibly print statements
#list of loggers open
loggers = []
#get an logger by name
def get_logger(name = None):... |
import math
import cells
import random
__author__ = 'matthew harris'
class Helper:
def can_move(self, view, pos):
(mx, my) = view.get_me().get_pos()
(dx, dy) = pos
map = view.get_terr()
if map.in_range(mx, my) and map.in_range(dx, dy):
if (view.get_me().loaded and
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Extract GPS coordinates from ARSF Wild RC-10 TIFF images using exiftool
and save to CSV.
Requires exiftool to be installed from http://www.sno.phy.queensu.ca/~phil/exiftool/
Known Issues:
Author: Dan Clewley, NERC-ARF-DAN
Creation Date: 06/09/2016
Change history
14/... |
"""
Database Abstraction (DBA)
Simple wrapper for db connection pooling supporting multithreaded I/O,
without the anti-pattern of ORM.
A single instance of the Master object should be created and referenced to
get individual connections. Connections are pooled for performance through
this means.
Example:
dbm =... |
"""Supports checking WebKit style in png files."""
import os
import re
from webkitpy.common import read_checksum_from_png
from webkitpy.common.system.systemhost import SystemHost
from webkitpy.common.checkout.scm.detection import SCMDetector
class PNGChecker(object):
"""Check svn:mime-type for checking style"""
... |
"""
test_floating_ip_common
----------------------------------
Tests floating IP resource methods for Neutron and Nova-network.
"""
from mock import patch
from openstack.cloud import meta
from openstack.cloud import OpenStackCloud
from openstack.tests import fakes
from openstack.tests.unit import base
class TestFl... |
# -*- coding: utf-8 -*-
class Condition(object):
def __init__(self, left, right):
self.left = left
self.right = right
def __eq__(self, other):
return isinstance(other, self.__class__) and other.left == self.left and other.right == self.right
def __repr__(self):
return self.__str__()
class EqualsConditio... |
"""Raw representations of every data type in the AWS DynamoDB service.
See Also:
`AWS developer guide for DynamoDB
<https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/index.html>`_
This file is automatically generated, and should not be directly edited.
"""
from attr import attrib
from attr imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.