content string |
|---|
import sys
import os
import subprocess
import shutil
import glob
import urllib2
import tarfile
import re
import numpy
from setuptools import setup, find_packages, Extension
"""
This file builds and installs the NuPIC binaries.
"""
NUPIC_CORE_BUCKET = (
"https://s3-us-west-2.amazonaws.com/artifacts.numenta.org/numen... |
import os
import pyauto_functional # must be imported before pyauto
import pyauto
class CroshTest(pyauto.PyUITest):
"""Tests for crosh."""
def setUp(self):
"""Close all windows at startup."""
pyauto.PyUITest.setUp(self)
for _ in range(self.GetBrowserWindowCount()):
self.CloseBrowserWindow(0)
... |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... |
"""Integration tests for Git."""
import github3
from .helper import IntegrationHelper
class TestTree(IntegrationHelper):
"""Integration tests for methods on the Test class."""
def test_inequality(self):
"""Test that a tree and its recursed tree are not equal."""
cassette_name = self.cassette... |
import collections
import mmap
import math
import os
import struct as _struct
import string
import srddl.core.helpers as sch
import srddl.exceptions as se
from srddl.core.fields import BoundValue
from srddl.core.offset import Offset, Size
class Data:
class MappedData(dict):
def __getitem__(self, key):
... |
from magnum.tests.functional import python_client_base as base
class TestKubernetesAPIs(base.BaseK8sTest):
baymodel_kwargs = {
"tls_disabled": False,
"network_driver": 'flannel',
"volume_driver": 'cinder',
"fixed_network": '192.168.0.0/24'
}
"""
NB : Bug1504379. This i... |
# Origin Date: 8/8/2017
# marketing twitter bot
import tweepy
import time
from credentials import settings
from twitter_stream import twstream
def reply(api, tweet):
"""
replies to all captured tweets
:param api: tweepy api method
:param tweet: [[username, msg, id]]
:return: None
"""
for... |
from __future__ import absolute_import
import numpy as np
from schematics.types.base import BaseType
from schematics.exceptions import ValidationError, ConversionError
class NumpyArrayType(BaseType):
"""A numpy field type. Accepts list, tuple or numpy.ndarray types.
Non numpy.ndarray types will be converted... |
r"""A simple logistics regression model for immunization prediction.
The following features are used in this model:
1. age of the patient
2. BMI
3. smoker
We are predicting the possibility of the patient getting a disease.
Note that this model is part of an end-to-end demo which shows how
to leverage the Google Clo... |
def pcStatGen():
'''Generates player details, like name, age, occupation, etc. This data is
stored in a save file afterwards.
'''
player_stats = {'Name': '', 'Age': '', 'Birthsign': '', 'Occupation': ''}
player_name = input('What is your name, traveler? ')
player_stats['Name'] = player_name
player... |
# vim: set encoding=utf-8
from itertools import takewhile
import re
# These node types represent categories of paragraphs/nodes within the
# regulation tree.
# APPENDIX - Auxiliary material at the end of the regulation
APPENDIX = u'appendix'
# INTERP - A special type of appendix dedicated to agency interpretations of
... |
#!/usr/bin/python
import argparse
import subprocess
import json
import re
import config
import collections
from datetime import datetime, timedelta
import time
from pprint import pprint
from slacker import Slacker
slack = Slacker(config.token)
option_age = ""
option_owner = None
option_protocol = 'slack'
option_ss... |
from operator import itemgetter
import numpy as np
import warnings
warnings.filterwarnings("ignore")
def random_sample(distribution, size=1):
"""
Random samples method
Returns:
samples given a pdf
"""
cdf = np.cumsum(distribution)
random_ = np.random.uniform(size=size)
samples = [np.where(cdf >= ran)[... |
"""Worker CLI."""
import os
import signal
from oslo_log import log as logging
from asciipic.cli import base as cli_base
from asciipic.common import constant
from asciipic.common import exception
from asciipic import config as asciipic_config
from asciipic.worker import worker as asciipic_worker
LOG = logging.getLog... |
from unit_test_common import execute_csv2_request, initialize_csv2_request, ut_id, sanity_requests, parameters_requests
from sys import argv
# lno: CV - error code identifier.
def main(gvar):
if not gvar:
gvar = {}
if len(argv) > 1:
initialize_csv2_request(gvar, selections=argv[1])
... |
"""Module docstring goes here."""
__metaclass__ = type
from doctest import (
DocTestSuite,
ELLIPSIS,
NORMALIZE_WHITESPACE,
)
from unittest import TestSuite
from lp.testing.layers import LaunchpadFunctionalLayer
from lp.testing.systemdocs import (
setUp,
tearDown,
)
def test_suite():
... |
#-*- encoding: utf8 -*-
# This file is part of odometer by Håvard Gulldahl <<EMAIL>>
# (C) 2011
import json
import urllib
import urllib2
import wave
from cStringIO import StringIO
def echonest(audiodata):
# http://developer.echonest.com/docs/v4/track.html#upload
# get 30" audio from filename
# sub... |
"""
A component which allows you to send data to an Influx database.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/influxdb/
"""
import logging
import voluptuous as vol
from homeassistant.const import (
EVENT_STATE_CHANGED, CONF_HOST, CONF_PORT, ... |
'''
optic/links2exons.py -
======================================================
:Author: Andreas Heger
:Release: $Id$
:Date: |today|
:Tags: Python
Purpose
-------
.. todo::
describe purpose of the script.
Usage
-----
Example::
python optic/links2exons.py --help
Type::
python optic/links2exons.py --h... |
import numpy as np
from itertools import chain
from pymaptools.containers import clusters_to_labels
from clustering_metrics.ranking import RocCurve, LiftCurve, dist_auc, \
aul_score_from_clusters, aul_score_from_labels, roc_auc_score
from nose.tools import assert_almost_equal
from pymaptools.sample import discrete_... |
"""Class representing an X.509 certificate chain."""
from .utils import cryptomath
from .utils.tackwrapper import *
class X509CertChain:
"""This class represents a chain of X.509 certificates.
@type x509List: list
@ivar x509List: A list of L{tlslite.x509.X509} instances,
starting with the end-entity ... |
import json
from flask import Blueprint
from flask import Response
from flask import request
from flask.ext.cors import cross_origin
from pgeo.error.custom_exceptions import PGeoException
from pgeomodis.core import modis_core as m
modis = Blueprint('modis', __name__)
@modis.route('/')
@cross_origin(origins='*')
def... |
# This Python file uses the following encoding: utf-8
from dimensioning import *
import previewDimension, selectionOverlay
from dimensionSvgConstructor import arrowHeadSVG, numpy, directionVector
d = DimensioningProcessTracker()
d.registerPreference( 'arrowL1')
d.registerPreference( 'arrowL2')
d.registerPreference( ... |
import math
import warnings
import numpy
import chainer
from chainer.backends import cuda
from chainer import function_node
from chainer import utils
from chainer.utils import type_check
_erf_cpu = None
class Erf(function_node.FunctionNode):
@property
def label(self):
return 'erf'
def check_... |
from pymoku import Moku
from pymoku.instruments import *
import time, logging
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
logging.getLogger('pymoku').setLevel(logging.DEBUG)
# Use Moku.get_... |
# lineflux.py
"""
tool to estimate line flux and line flux error using trapz integral
"""
import numpy as np
def calc_line_flux(spec, ws, ivar, w0, w1, u_flux):
""" calculate the flux and flux error of the line within the range w0 and w1 using trapz rule"""
u_spec = spec.unit
u_ws = ws.unit
ivar = ivar.to(1./(u_... |
# -*- encoding: utf-8 -*-
from django.conf.urls import url
from apps.user_dashboard.views import package_edit
from apps.user_dashboard.views import script_create
from .views import package_list, package_script_view, review_tour, \
package_create, script_review_request, package_view
urlpatterns = [
url(r'^$',... |
from hashlib import md5
from stacker.blueprints.base import Blueprint
from troposphere import (
Ref,
Output,
GetAtt,
Join,
Region,
route53,
)
import logging
logger = logging.getLogger(__name__)
# reference: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-... |
from __future__ import print_function
from __future__ import unicode_literals
import os
import sys
import re
import argparse
from io import open
# regular expression for matching Kconfig files
RE_KCONFIG = r'^Kconfig(?:\.projbuild)?$'
# ouput file with suggestions will get this suffix
OUTPUT_SUFFIX = '.new'
# ignore... |
# -*- coding: utf-8 -*-
from mamba import settings, formatters, reporter, runners, example_collector, loader
from mamba.infrastructure import is_python3
class ApplicationFactory(object):
def __init__(self, arguments):
self._instances = {}
self.arguments = arguments
def create_settings(self)... |
import datetime as dt
import configparser
import logging
from flask import current_app
from flask import app
from flask import Blueprint, flash, redirect, render_template, request, url_for
from flask import Markup
from flask_login import fresh_login_required, current_user
from authmgr.utils import flash_errors, write... |
#! /usr/bin/env python
"""
Author: Phuc Tran Truong, Marcus Ding
Date: 19.07.2016
What it is supposed to do:
1. chop up the user input (tokenize)
2. extract location (NERTagger), datetime and type of request (check in dictionary), get a default argument if something is missing
3. send back the arguments
"""
import n... |
"""
Plugins not fully converted but simply "wrapped" as plugins.
"""
from packages import (directions_to, forecast, mapps, near_me,
timeIn, weather_pinpoint, weatherIn)
from plugin import plugin, require
@require(network=True)
@plugin("check time")
def check_time(self, s):
"""
checks th... |
from django.db import models
from django.db.models.deletion import ProtectedError
from .verse import Verse
from .language import Language
class CommentaryVerse(models.Model):
id = models.AutoField(
primary_key=True,
editable=False)
verse = models.ForeignKey(
Verse, db_column='verse_id... |
# $language = "python"
# $interface = "1.0"
import os
import sys
import logging
import csv
# Add script directory to the PYTHONPATH so we can import our modules (only if run from SecureCRT)
if 'crt' in globals():
script_dir, script_name = os.path.split(crt.ScriptFullName)
if script_dir not in sys.path:
... |
# -*- coding: utf8 -*-
"""
Laby, par Mehdi Cherti 2010(mehdidc):
- generation d'un labyrinthe
- utilisation de l'algorithme astar pour trouver le a_path le plus court(selection de la destination avec la souris)
Laby, 2010 by Mehdi Cherti(mehdidc):
- Generation of a labyrinth
- Use of astar algorithm to find t... |
"""
botogram's tasks file
You should use this with invoke
Copyright (c) 2015 Pietro Albini <<EMAIL>>
Released under the MIT license
"""
# Version check, ensure it's run with Python 3
import sys
import os
if sys.version_info[0] < 3:
print("Hey! It seems you installed invoke for Python 2!")
prin... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('social_service', '0004_auto_20150505_1220'),
]
operations = [
migrations.CreateModel(
name='SocialService',
... |
# -*- coding: utf-8 -*-
#
import os
import sys
sys.path.insert(0, os.path.abspath('../readthedocs'))
import settings.sqlite
from django.core.management import setup_environ
setup_environ(settings.sqlite)
sys.path.append(os.path.abspath('_ext'))
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
... |
import fileinput, os, shutil, time, xbmc, xbmcgui, zipfile
Root_Directory = xbmc.translatePath("Special://root/")[:-8]
zip_file = os.path.join(Root_Directory, 'updater/Update Files/update-files.zip')
zip_file_emus = os.path.join(Root_Directory, 'updater/Update Files/update-files-emus.zip')
xbmc.executebuiltin('Skin... |
# -*- encoding: utf-8 -*-
'''
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
'''
class Solution(object):
def maximalRectangle(self, matrix):
"""
:type matrix: List[List[str]]
:rtype: int
"""
if not matri... |
"""Test form i18n
$Id: test_i18n.py 69217 2006-07-20 03:56:26Z baijum $
"""
import unittest
from zope.testing import doctest
from persistent import Persistent
from zope.interface import Interface, implements
from zope.schema import TextLine, Text, Int, List
from zope.i18nmessageid import MessageFactory
from zope.app.t... |
"""
Fake pools used for development.
This pool pretends to manage a pool of Resources which are merely pretend
ResourceS which do not exist.
"""
import logging
import testpool.core.ext
import testpool.core.algo
from testpooldb import models
LOGGER = logging.getLogger(__name__)
def _do_pool_remove(args):
""" Rem... |
import string
def rot13(str):
tran_list=[]
alphabet_lower = string.lowercase
alphabet_upper = string.uppercase
test_table = []
new_str = ''.join([char for char in str if char in (alphabet_lower + alphabet_upper)])
for i in range (len(str)):
if str[i] in alphabet_lower:
x = a... |
r"""
Power Law
---------
Anticipatory collision avoidance algorithm introduced in *Universal power law
governing pedestrian interactions* [Karamouzas2014b]_. Algorithm is derived from
real world data from the behaviour movement of people in crowds.
Force affecting agent can be derived by taking spatial gradient of th... |
#!/usr/bin/env python
from __future__ import print_function
import locale
import os.path
import subprocess
import tempfile
from distutils.spawn import find_executable
__all__ = [
'edit',
'get_editor',
'EditorError',
]
class EditorError(RuntimeError):
pass
def get_default_editors():
# TODO: Ma... |
import psycopg2
# -*- coding: utf-8 -*-
def run_query(query=''):
#conn_string = "host='localhost' dbname='postgres' user='postgres' password='chucho'"
conn_string = "host='127.0.0.1' dbname='docker' user='docker' password='docker' port='49153'"
conn = psycopg2.connect(conn_string) # Conectar a la base de ... |
import os
import string
from sys import stderr as STDERR
from re import search
def read_paml (source, obj=None, header_delimiter="\t", fix_duplicates=True):
""" Reads a collection of sequences econded in PAML format... that is, something between PHYLIP and fasta
3 6
seq1
ATGATG
seq2
ATGATG
... |
# -*- coding: utf-8 -*-
"""Module with the Graphviz drawing calls."""
#
# (C) Pywikibot team, 2006-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
#
import threading
try:
import pydot
except ImportError as e:
pydot = e
... |
from __future__ import absolute_import, unicode_literals
import datetime
from sqlalchemy import (
Column, Integer, String, Text, DateTime,
Sequence, Boolean, ForeignKey, SmallInteger,
)
from sqlalchemy.orm import relation
from sqlalchemy.ext.declarative import declarative_base, declared_attr
from sqlalchemy.s... |
# -*- coding: utf-8 -*-
"""Tests for trello plugin."""
import logging
import os
import pytest
from trello import TrelloClient
from unittest.mock import MagicMock
from pomito.pomodoro import Pomodoro
from pomito.plugins.task.trello import TrelloTask
from pomito.test import PomitoTestFactory
@pytest.fixture(scope="m... |
""" Caching tests
:Author: Jonathan Karr <<EMAIL>>
:Date: 2018-03-31
:Copyright: 2018, Karr Lab
:License: MIT
"""
import capturer
import collections
import os
import shutil
import tempfile
import time
import unittest
import wc_utils.cache
class CacheTestCase(unittest.TestCase):
def setUp(self):
self.dir... |
#!/usr/bin/env python
# encoding: utf-8
from decimal import Decimal
import unittest
from geolocation.distance_matrix.client import DistanceMatrixApiClient
from geolocation.main import GoogleMaps
TEST_API_KEY = 'AIzaSyDNvdrZ_HEtfsuPYHV9UvZGc41BSFBolOM'
class GeolocationTest(unittest.TestCase):
def setUp(self):
... |
#coding: utf-8
from __future__ import division, absolute_import, print_function, unicode_literals
from kasaya.conf import settings
from kasaya.core import exceptions
from kasaya.core.lib import LOG
import struct
from decimal import Decimal
import datetime
__all__ = ("SingletonSerializer",)
def _load_passwd():
i... |
#!/usr/bin/env python3
import collections
class Solution:
def findLUSlength(self, strs):
cnt = collections.Counter(strs)
unique_strs = sorted([s for s in cnt if cnt[s] == 1], key=len, reverse=True)
print(unique_strs)
def isSubSeq(s1, s2):
if len(s1) > len(s2):
... |
#!/usr/bin/env python
import functools
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]
def initialize_options(self):
TestCommand.initialize_options(self)
... |
import logging
from datetime import datetime
from datetime import timedelta
import json
import tarfile
import io
from tornado import gen
from tornado import web
from bson import objectid
from opnfv_testapi.common.config import CONF
from opnfv_testapi.common import message
from opnfv_testapi.common import raises
from ... |
import json
import urllib2
from pprint import pprint
import datetime
from dateutil import tz
import pytz
import random
import time
import tweepy
def creds():
with open('creds.json') as data_file:
data = json.load(data_file)
consumer_key = data['creds'][0]['consumer_key']
consumer_secret = data['creds'][0]['cons... |
from odoo.exceptions import AccessError
from odoo.tests import TransactionCase
class TestResUsers(TransactionCase):
def setUp(self):
super(TestResUsers, self).setUp()
self.immutable = self.env.ref('user_immutable.group_immutable')
self.user = self.env.ref('base.user_demo')
self.us... |
from __future__ import division
from math import ceil
from django.conf import settings
from django import http
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.short... |
import sys
import xbmc
import xbmcplugin
import xbmcgui
from resources.lib.process import start_info_actions
from resources.lib.Utils import *
from resources.lib.TheMovieDB import check_login
class Main:
def __init__(self):
xbmc.log("version %s started" % ADDON_VERSION)
xbmc.executebuiltin('SetPro... |
from mldb import mldb, MldbUnitTest, ResponseException
import unittest
class LabelFeatureValidationTest(MldbUnitTest):
@classmethod
def setUpClass(self):
mldb.put("/v1/procedures/csv_proc", {
"type": "import.text",
"params": {
'dataFileU... |
"""Zope's HTTP-specific Publisher interfaces.
$Id: http.py 25177 2004-06-02 13:17:31Z jim $
"""
from zope.component.interfaces import IPresentation
from zope.component.interfaces import IView
class IHTTPPresentation(IPresentation):
"""HTTP presentations are for interaction with users using Web HTTPs
"""
cla... |
"""Python NTP library.
Implementation of client-side NTP (RFC-1305), and useful NTP-related
functions.
"""
import datetime
import socket
import struct
import time
class NTPException(Exception):
"""Exception raised by this module."""
pass
class NTP:
"""Helper class defining constants."""
_SYSTEM_... |
import os
import select
import subprocess
import string
from linuxband.glob import Glob
import logging
class MidiGenerator(object):
def __init__(self, config):
self.__config = config
def check_mma_syntax(self, mma_data):
"""
< -1 other error, = -1 MMA error unknown line, 0 is OK, > 0... |
import logging
from pathlib import Path
from pants.engine.internals import native_engine
from pants.init.logging import initialize_stdio
from pants.testutil.option_util import create_options_bootstrapper
from pants.testutil.rule_runner import mock_console
from pants.util.contextutil import temporary_dir
from pants.uti... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import redis
from hashlib import md5
from sasila.settings import default_settings
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf-8')
class SimpleHash(object):
def __init__(self, cap, seed):
self.cap = cap
self... |
import sys
import subprocess
from .common import get_tfvars_file, replace_tfvars
def update_sonarqube_terraform(sonarelb, sonaruserpass, sonarip):
replace_tfvars('sonar_server_elb', sonarelb, get_tfvars_file())
replace_tfvars('sonar_username', sonaruserpass[0], get_tfvars_file())
replace_tfvars('sonar_pas... |
#!python
from __future__ import with_statement
import glob
import os.path
import shutil
import zipfile
def isFileEntry(s):
return s[-1] != '/'
def readFile(fname):
with open(fname, 'rb') as f:
return f.read()
def writeFile(fname, data):
with open(fname, 'wb') as fo:
fo.write(data)
def mkdirs(path):
try:
... |
from __future__ import print_function
import PyKCS11
import getinfo
if __name__ == "__main__":
import getopt
import sys
def usage():
print("Usage:", sys.argv[0], end=" ")
print("[-p pin][--pin=pin] (use 'NULL' for pinpad)", end=" ")
print("[-c lib][--lib=lib]", end=" ")
pr... |
"""Test class for concurrent Synchronization
:Requirement: Pulp sync
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: OTHER
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import csv
from robottelo.config import settings
from robottelo.decorators import skip_if_not_set
from robo... |
# -*- coding: utf-8 -*
import json
from django.core.serializers.json import DjangoJSONEncoder
from django.db.models import Q
from django.forms.models import model_to_dict
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from pets.models import Pet
def json_response(q):... |
import unittest
import numpy
import six
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
class TestSoftmax(unittest.TestCase):
def setUp(self):
self... |
""" Tests for Range initialization. """
# isort: STDLIB
import unittest
from fractions import Fraction
# isort: THIRDPARTY
from hypothesis import given, settings, strategies
# isort: LOCAL
from justbytes import UNITS, Range
class InitializerTestCase(unittest.TestCase):
""" Test conversions. """
@given(
... |
"""
SQLAlchemy models for cinder data.
"""
from sqlalchemy import Column, Integer, String, Text, schema
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import ForeignKey, DateTime, Boolean
from sqlalchemy.orm import relationship, backref
from oslo.config import cfg
from cinder.openstack.comm... |
from django.contrib import admin
from sms.models import SmsMessage
from voice.models import Call
from deterrence.admin import DeterrenceMessageInline
from .models import Contact
admin.site.site_header = "Demand Deterrence Platform"
admin.site.site_title = admin.site.site_header
admin.site.index_title = "Dashboard"
... |
"""
<Module Name>
functions.py
<Author>
Santiago Torres-Arias <<EMAIL>>
<Started>
Nov 15, 2017
<Copyright>
See LICENSE for licensing information.
<Purpose>
publicly-usable functions for exporting public-keys, signing data and
verifying signatures.
"""
import logging
import time
from securesystemslib im... |
'''
This module implements a MySQL client as a WorkerBee.
'''
import re
import random
import socket
import sys
import cPickle
import MySQLdb
import apiary
import optparse
import warnings
class MySQLWorkerBee(apiary.WorkerBee):
"""A WorkerBee that sends transactions to MySQL"""
COMMON_ERRORS = {
... |
import os, logging
# ----- LOGGING ----- #
DEBUG = True
LOG_FILE = 'logfile.log'
# 1 DEBUG - detailed info
# 2 INFO - confirmation that things according to plan
# 3 WARNING - something unexpected
# 4 ERROR - some function failed
# 5 CRITICAL - application failure
LOG_LEVEL = logging.DEBUG
logging.basi... |
from __future__ import absolute_import
from rest_framework.response import Response
from sentry.api.base import DocSection
from sentry.api.bases.project import ProjectEndpoint
from sentry.api.serializers import serialize
from sentry.models import Event
class ProjectEventDetailsEndpoint(ProjectEndpoint):
doc_sec... |
from dataclasses import dataclass
from enum import unique, Enum
from typing import NamedTuple, List
from randovania.game_description.requirements import Requirement
@unique
class DockType(Enum):
DOOR = 0
MORPH_BALL_DOOR = 1
OTHER = 2
PORTAL = 3
@dataclass(frozen=True, order=True)
class DockWeakness... |
"""
Support for IP Webcam, an Android app that acts as a full-featured webcam.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/android_ip_webcam/
"""
import asyncio
import logging
from datetime import timedelta
import voluptuous as vol
from homeassista... |
from enigma import iServiceInformation
from Components.Converter.Converter import Converter
from Components.Element import cached
from Poll import Poll
import time
import os
class EcmInfoLine(Poll, Converter, object):
Auto = 0
PreDefine = 1
Format = 2
Crypt = 3
def __init__(self, type):
Converter.__init__(self... |
"""
World define space and objects contained in.
It provides an API used by the Actions subclasses.
"""
import itertools
import random
from collections import defaultdict
import neural_world.default as default
import neural_world.commons as commons
import neural_world.observer as observer
from neural_world.space impo... |
"""
Please consult file tutorial.html under the doc directory
for an introduction on how to use this class.
"""
import sys
import config
from PTools import PToolsError, PythonCycError
if 'IPython' in sys.modules:
from IPython.display import display, HTML
def convertLispIdtoPythonId(s):
"""
Conver... |
from enum import Enum, Flag
# Also have a look at this: https://sourceware.org/git/?p=binutils.git;a=blob_plain;f=include/elf/common.h
# Also see: https://github.com/lattera/glibc/blob/master/elf/elf.h
EI_CLASS = Enum('EI_CLASS', 'ELFCLASSNONE ELFCLASS32 ELFCLASS64', start=0)
EI_DATA = Enum('EI_DATA', 'ELFDATANONE EL... |
import numpy as np
import json
from nanonet.currennt_to_pickle import network_to_numpy
from ..scripts.pickle_to_currennt import numpy_to_network
NANONET_NN = "nanomod/test/data/r9_template.npy"
SERIAL_JSON = "nanomod/test/data/serial.json"
def assert_network_equivalence(n1, n2):
assert(len(n1.layers) == len(n2.laye... |
from tempest import clients
from tempest import config
from tempest.lib.services import clients as cli
CONF = config.CONF
class Manager(clients.Manager):
def __init__(self, credentials=None):
super(Manager, self).__init__(credentials)
class Clients(cli.ServiceClients):
"""Tempest stable service cli... |
class ForumUser:
def __init__(self, userdata):
self.member_id = None
self.forum_name = None
self.forum_primary_group = None
self.forum_secondary_groups = []
self.discord_id = None
self.ckey = None
self.auths = []
self.parse(userdata)
def __eq__(s... |
import gtk
import sys
class ErrorMessage(object):
def __init__(self, message):
self._message_ = message
def display(self):
# display to console
print "ERROR:", self._message_
# create a dialog
dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_P... |
import os
from settings import *
class Pages(object):
"""
A namespace containing several blog pages and meta pages (comments, tags, etc.)
Combines blog posts and static pages. Static pages have page.meta.static == True.
"""
def __init__(self, content_folder, environment):
self.pages = {}... |
from __future__ import absolute_import
from collections import OrderedDict
from plotly.graph_objs import (Data, Figure, Layout, Line, Margin, Marker,
Scatter, XAxis, YAxis)
def test_get_ordered():
fig = Figure(
data=Data([
Scatter(
x=[52698, 4311... |
def listAllSnapshots(self, flags: int = 0) -> List['virDomainSnapshot']:
"""List all snapshots and returns a list of snapshot objects"""
ret = libvirtmod.virDomainListAllSnapshots(self._o, flags)
if ret is None:
raise libvirtError("virDomainListAllSnapshots() failed")
return... |
from twisted.internet.protocol import Protocol, Factory
from twisted.internet import reactor
from twisted.protocols import policies, basic
import mx.DateTime, os, pickle, csv
from pyIEM import mesonet
# Load datastore from file, if possible
sites = {}
config = csv.DictReader( open('sites.txt') )
for row in config:
... |
# -*- coding: utf-8 -*-
import re
from module.plugins.Account import Account
class YibaishiwuCom(Account):
__name__ = "YibaishiwuCom"
__type__ = "account"
__version__ = "0.01"
__description__ = """115.com account plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "<EM... |
import os
from .wooey_settings import *
# Whether to allow anonymous job submissions, set False to disallow 'guest' job submissions
WOOEY_ALLOW_ANONYMOUS = True
## Celery related options
INSTALLED_APPS += (
'django_celery_results',
)
WOOEY_CELERY = True
CELERY_RESULT_BACKEND = 'django-db'
CELERY_BROKER_URL = 'am... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'fyabc'
from cocos.tiles import load
from cocos.layer import ScrollingManager
from cocos.director import director
from cocos.scene import Scene
# This code might seem odd as there are no classes or functions or anything...
# That's because when we load a map, ... |
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy
from utils.country_field import COUNTRIES
from utils.gravatar import get_gravatar_img_link, gravatar_exists
from django.db.models.signals import post_save
from rest_framework.authtoken.models impo... |
# coding=utf-8
from __future__ import unicode_literals
import os
from django.forms import widgets
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from django.conf import settings
HTML = (
'<div class="s3direct" data-url="{policy_url}">'
' <div class="link-controls">... |
from ige import *
import ige
from Database import Database
from Transaction import Transaction
from Index import Index
from Const import *
import os, os.path, time
import log
from IObject import IDataHolder
from Scheduler import Scheduler
from ClientMngr import Session
import xmlrpclib
class GameMngr:
def __init__(s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.