content
stringlengths
4
20k
# Test uasyncio TCP server and client using start_server() and open_connection() try: import uasyncio as asyncio except ImportError: try: import asyncio except ImportError: print("SKIP") raise SystemExit PORT = 8000 async def handle_connection(reader, writer): # Test that pee...
from temboo.core.choreography import Choreography from temboo.core.choreography import InputSet from temboo.core.choreography import ResultSet from temboo.core.choreography import ChoreographyExecution import json class CreateAudioPostWithURL(Choreography): def __init__(self, temboo_session): """ ...
"""Basic regular expression demostration facility (Perl style syntax).""" from Tkinter import * import re class ReDemo: def __init__(self, master): self.master = master self.promptdisplay = Label(self.master, anchor=W, text="Enter a Perl-style regular expression:") self.p...
try: import uctypes except ImportError: print("SKIP") raise SystemExit S1 = {} assert uctypes.sizeof(S1) == 0 S2 = {"a": uctypes.UINT8 | 0} assert uctypes.sizeof(S2) == 1 S3 = { "a": uctypes.UINT8 | 0, "b": uctypes.UINT8 | 1, } assert uctypes.sizeof(S3) == 2 S4 = { "a": uctypes.UINT8 | 0, ...
"""Unittest for symbolize.py. This test uses test libraries generated by the Android g++ toolchain. Should things break you can recreate the libraries and get the updated addresses and demangled names by running the following: cd test/symbolize/ make nm -gC *.so """ import sys import StringIO import unittest ...
from __future__ import absolute_import, division, unicode_literals # pylint:disable=wrong-import-position import os import sys import codecs import glob import xml.sax.handler base_path = os.path.split(__file__)[0] test_dir = os.path.join(base_path, 'testdata') sys.path.insert(0, os.path.abspath(os.path.join(base_p...
import time import unittest import config import mle import network_layer import node LEADER = 1 ROUTER1 = 2 SNIFFER = 3 class Cert_5_1_05_RouterAddressTimeout(unittest.TestCase): def setUp(self): self.nodes = {} for i in range(1, 3): self.nodes[i] = node.Node(i) self.nodes...
# -*- coding: utf-8 -*- '''Base TestCase class for OSF unittests. Uses a temporary MongoDB database.''' import os import re import shutil import logging import unittest import functools import datetime as dt from flask import g import blinker import httpretty from webtest_plus import TestApp import mock from faker im...
# -*- coding: iso-8859-1 -*- #------------------------------------------------------------ # seriesly - XBMC Plugin # http://blog.tvalacarta.info/plugin-xbmc/seriesly/ #------------------------------------------------------------ import urlparse,urllib2,urllib,re import sys from core import config from core import log...
def main(): # set default values Sensitivity = 0.0005 Invert = -1 Capped = False # get controller controller = bge.logic.getCurrentController() # get the object this script is attached to obj = controller.owner # get the size of the game screen gameScreen = gameWindow() # get mouse movement move ...
import json import logging import boto3 import botocore.exceptions from botocore.client import Config import floto.api import floto.specs logger = logging.getLogger(__name__) class Swf(object): def __init__(self, region_name=None, profile_name=None): self.init_client(region_name, profile_name) ...
# encoding: utf8 from django.test import TestCase from django.db.migrations.optimizer import MigrationOptimizer from django.db import migrations from django.db import models class OptimizerTests(TestCase): """ Tests the migration autodetector. """ def optimize(self, operations): """ ...
from __future__ import unicode_literals, absolute_import import csv import ast from datetime import datetime from django import forms from django.conf.urls import patterns, url from django.db import models from django.db.models.loading import get_model from django.contrib import admin from django.contrib.admin import ...
""" The vyos lldp_interfaces fact class It is in this file the configuration is collected from the device for a given resource, parsed, and the facts tree is populated based on the configuration. """ from __future__ import absolute_import, division, print_function __metaclass__ = type from re import findall, search...
import time from openerp.osv import osv from openerp.report import report_sxw class pos_payment_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(pos_payment_report, self).__init__(cr, uid, name, context=context) self.total = 0.0 self.localcontext.update({ ...
from __future__ import unicode_literals import frappe from frappe import msgprint, _ def execute(filters=None): if not filters: filters = {} lab_test_list = get_lab_test(filters) columns = get_columns() if not lab_test_list: msgprint(_("No record found")) return columns, lab_test_list data = [] for lab_te...
# Test 64-bit COMPARE AND BRANCH in cases where the sheer number of # instructions causes some branches to be out of range. # RUN: python %s | llc -mtriple=s390x-linux-gnu | FileCheck %s # Construct: # # before0: # conditional branch to after0 # ... # beforeN: # conditional branch to after0 # main: # 0xffcc by...
#!/usr/bin/env python # -*- coding: utf-8 -*- '''common mavproxy utility functions''' import math import os # Some platforms (CYGWIN and others) many not have this library has_wxpython = False try: import wx has_wxpython = True except ImportError, e: pass radius_of_earth = 6378100.0 # in meters def gps_...
"""module for generating mock classes/objects for testing purposes""" import socket from heron.instance.src.python.network import (REQID, OutgoingPacket, IncomingPacket, StatusCode, SocketOptions) from heron.instance.src.pyth...
from __future__ import division, print_function import os import genapi from genapi import \ TypeApi, GlobalVarApi, FunctionApi, BoolValuesApi import numpy_api # use annotated api when running under cpychecker h_template = r""" #if defined(_MULTIARRAYMODULE) || defined(WITH_CPYCHECKER_STEALS_REFERENCE_TO_AR...
#!/usr/bin/env python # encoding: utf-8 import mock import unittest import httpretty from os.path import join as join_path from json import dumps from nose.tools import * # noqa import httplib as http from tests.base import OsfTestCase from tests.factories import ProjectFactory, AuthUserFactory from tests.test_add...
"""Provisions Android devices with settings required for bots. Usage: ./provision_devices.py [-d <device serial number>] """ import optparse import os import re import subprocess import sys import time from pylib import android_commands from pylib import constants def KillHostHeartbeat(): ps = subprocess.Popen(...
""" This module collects helper functions and classes that "span" multiple levels of MVC. In other words, these functions/classes introduce controlled coupling for convenience's sake. """ from django.template import loader, RequestContext from django.http import HttpResponse, Http404 from django.http import HttpRespons...
""" Middleware to check for obedience to the WSGI specification. Some of the things this checks: * Signature of the application and start_response (including that keyword arguments are not used). * Environment checks: - Environment is a dictionary (and not a subclass). - That all the required keys are in the...
"""Tests for polynomial module. """ from __future__ import division, absolute_import, print_function import numpy as np import numpy.polynomial.polynomial as poly from numpy.testing import ( TestCase, assert_almost_equal, assert_raises, assert_equal, assert_, run_module_suite) def trim(x): return poly.p...
from __future__ import print_function # from bokeh.util.browser import view # from bokeh.document import Document # from bokeh.embed import file_html from bokeh.plotting import show, save, output_file from bokeh.models.glyphs import Circle from bokeh.models import ( GMapPlot, Range1d, ColumnDataSource, Pan...
import maya.cmds import IECore import IECoreMaya __dagMenuCallbacks = [] ## Registers a callback to be used when creating the right click dag # menu for scene shapes. Callbacks should have the following signature : # # callback( menu, sceneShape ). def addDagMenuCallback( callback ) : if not callback in __dagMenuCa...
import json import sys import os import time import uuid import warnings if sys.version > '3': basestring = str unicode = str long = int from pyspark import SparkContext, since from pyspark.ml.common import inherit_doc from pyspark.sql import SparkSession from pyspark.util import VersionUtils def _jvm()...
from django.http import HttpResponse, HttpResponseRedirect from django.template import RequestContext from django.contrib.auth.decorators import login_required from django.contrib.contenttypes.models import ContentType from django.contrib.auth.models import User from django.shortcuts import render_to_response, get_obje...
import gc import os import socket import sys from tempfile import NamedTemporaryFile import threading from pyspark.cloudpickle import print_exec from pyspark.java_gateway import local_connect_and_auth from pyspark.serializers import ChunkedStream from pyspark.util import _exception_message if sys.version < '3': i...
# -*- coding: utf-8 -*- import os import platform import fnmatch import zipfile from paver.easy import * def get_extlibs(): if platform.system() == "Windows": return 'extlibs_windows' if platform.system() == "Darwin": return 'extlibs_macos' if platform.system() == "Linux": return...
from abc import ABCMeta, abstractmethod # noinspection PyPackageRequirements import wx import eos.config from eos.saveddata.fit import Fit from eos.saveddata.targetProfile import TargetProfile from eos.utils.spoolSupport import SpoolOptions, SpoolType from graphs.wrapper import BaseWrapper from gui.bitmap_loader impo...
#!/usr/bin/env python __author__ = 'greg' import pymongo from aggregation import base_directory from penguinAggregation import PenguinAggregation import os import sys import numpy as np import matplotlib.pyplot as plt import urllib import matplotlib.cbook as cbook # add the paths necessary for clustering algorithm and...
import sys from itcc.molecule import read from itcc.tools import conffile def read_corr(ifile): res = [] for line in conffile(ifile): res.append([int(x)-1 for x in line.split()]) assert len(res[-1]) == 2 return res def verify_correspoding(mol1, mol2, corr): d = [None] * len(corr) ...
import os from PyQt4.QtGui import * from BWizardPage import * import bertos_utils from const import * class BCreationPage(BWizardPage): def __init__(self): BWizardPage.__init__(self, UI_LOCATION + "/project_creation.ui") self.setTitle(self.tr("Project summary")) self.setSubTitle(self.tr("Your project...
import logging from scap.Model import Model from scap.model.oval_5.sc.ItemType import ItemType logger = logging.getLogger(__name__) class FileHashItemElement(ItemType): MODEL_MAP = { 'elements': [ {'tag_name': 'filepath', 'class': 'scap.model.oval_5.sc.EntityItemType', 'min': 0, 'max': 1}, ...
import os import sys import ast import yaml import traceback from collections import MutableMapping, MutableSet, MutableSequence from ansible.plugins import fragment_loader # modules that are ok that they do not have documentation strings BLACKLIST_MODULES = [ 'async_wrapper', 'accelerate', 'async_status' ] def g...
"""Unit tests for pytree.py. NOTE: Please *don't* add doc strings to individual test methods! In verbose mode, printing of the module, class and method name is much more helpful than printing of (the first line of) the docstring, especially when debugging a test. """ # Testing imports from . import support # Local i...
""" Represents an DBSubnetGroup """ class DBSubnetGroup(object): """ Represents an RDS database subnet group Properties reference available from the AWS documentation at http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DeleteDBSubnetGroup.html :ivar status: The current status of th...
from io import BytesIO class CallbackFileWrapper(object): """ Small wrapper around a fp object which will tee everything read into a buffer, and when that file is closed it will execute a callback with the contents of that buffer. All attributes are proxied to the underlying file object. Thi...
from HTMLComponent import HTMLComponent from GUIComponent import GUIComponent from config import KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS, ConfigElement, ConfigText, ConfigPassword from Components.ActionMap import NumberActionMap...
# -*- coding: utf-8 -*- # uft.py --- Unitary fourier transform """Function of unitary fourier transform and utilities This module implements the unitary fourier transform, also known as the ortho-normal transform. It is especially useful for convolution [1], as it respects the Parseval equality. The value of the null...
"""Runs AmberScript tests on Android devices.""" import argparse import sys from pathlib import Path from typing import List, Optional from gfauto import android_device, binaries_util, settings_util from gfauto.settings_pb2 import Settings def main() -> None: # pylint: disable=too-many-statements, too-many-locals,...
from __future__ import unicode_literals import copy import os import re import subprocess import tempfile from cryptography.hazmat.primitives import serialization as crypto_serialization from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.backends import default_backend as crypto_defaul...
""" This object provides quoting for GEOS geometries into PostgreSQL/PostGIS. """ from psycopg2 import Binary from psycopg2.extensions import ISQLQuote class PostGISAdapter(object): def __init__(self, geom): "Initializes on the geometry." # Getting the WKB (in string form, to allow easy pickling ...
import os import sys import fnmatch import subprocess import datetime import argparse import logging import re def isLeapYear(year): '''Returns TRUE if the given year (int) is leap and FALSE otherwise''' leapyear = False if year % 4 != 0: leapyear = False elif year % 100 != 0: leapyear = True elif year % 400...
from spack import * class PySncosmo(PythonPackage): """SNCosmo is a Python library for high-level supernova cosmology analysis.""" homepage = "http://sncosmo.readthedocs.io/" url = "https://pypi.io/packages/source/s/sncosmo/sncosmo-1.2.0.tar.gz" version('1.2.0', '028e6d1dc84ab1c17d2f3b6378b2cb1e...
""" Disk management utilities. """ # Authors: Gael Varoquaux <gael dot varoquaux at normalesup dot org> # Lars Buitinck <<EMAIL>> # Copyright (c) 2010 Gael Varoquaux # License: BSD Style, 3 clauses. import errno import os import shutil import sys import time def disk_used(path): """ Return the disk us...
import sys try: from django.conf import settings settings.configure( DEBUG=True, LANGUAGE_CODE='en-us', USE_TZ=True, DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'connected_accounts', } ...
#------------------------------------------------------------------------- # Copyright (c) Microsoft. All rights reserved. # # 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://w...
from django.utils.translation import ugettext_lazy as _ # noqa import horizon from openstack_dashboard.dashboards.admin import dashboard class Users(horizon.Panel): name = _("Users") slug = 'users' dashboard.Admin.register(Users)
#!/usr/bin/env python # This example shows how to color an isosurface with other # data. Basically an isosurface is generated, and a data array is # selected and used by the mapper to color the surface. import vtk from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # Read some data. The importa...
# -*- coding: utf-8 -*- ''' Production Configurations - Use djangosecure - Use Amazon's S3 for storing static files and uploaded media - Use mailgun to send emails - Use Redis on Heroku - Use sentry for error logging - Use opbeat for error reporting ''' from __future__ import absolute_import, unicode_literals fro...
import sys sys.path.append('libs') import hashlib import base58 import ed25519djb as ed25519 import os # get a 32 byte random number. This is the raw ed25519 private key ECprivatekey = os.urandom(32) # if using an existing private key, uncomment and add your key here #ECprivatekey = "0000000000000000000000000000000...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os from contextlib import contextmanager from textwrap import dedent from pants.util.contextutil import temporary_dir from pants_test.pants_run_integration_tes...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'network'} import re from copy import deepcopy from time import sleep from ansible.module_utils.basic i...
import os import signal from typing import Optional from airflow.configuration import conf from airflow.exceptions import AirflowException from airflow.jobs.base_job import BaseJob from airflow.models.taskinstance import TaskInstance from airflow.stats import Stats from airflow.task.task_runner import get_task_runner ...
from ctypes import * from ctypes.test import need_symbol import unittest # IMPORTANT INFO: # # Consider this call: # func.restype = c_char_p # func(c_char_p("123")) # It returns # "123" # # WHY IS THIS SO? # # argument tuple (c_char_p("123"), ) is destroyed after the function # func is called, but NOT before ...
from numpy import * import Block from PyQt4.QtGui import * from PyQt4.QtCore import * from Connexion import * import Tools import time import csv class CSVPlayer(Block.Block,QWidget): """ this class describes a block """ def __init__(self,members): Block.Block.__init__(self) QWidget.__init...
from openerp.osv import osv class portal_project(osv.Model): """ Update of mail_mail class, to add the signin URL to notifications. """ _inherit = 'project.project' def _get_visibility_selection(self, cr, uid, context=None): """ Override to add portal option. """ selection = super(portal_...
from oslo_log import log as logging from designate.api.admin.views import base as base_view LOG = logging.getLogger(__name__) class QuotasView(base_view.BaseView): """Model a Quota API response as a python dictionary""" _resource_name = 'quota' _collection_name = 'quotas' def show_basic(self, con...
from setuptools import setup from glob import glob __version__ = "0.1.0-dev" classes = """ Development Status :: 3 - Alpha License :: OSI Approved :: BSD License Topic :: Scientific/Engineering :: Bio-Informatics Topic :: Software Development :: Libraries :: Application Frameworks Topic :: Softwar...
'Exeptions may be silently swallowed' from __future__ import print_function __revision__ = None def insidious_break_and_return(): """I found you !""" for i in range(0, -5, -1): my_var = 0 print(i) try: my_var += 1.0/i if i < -3: break # :D ...
"""Pylint plugin: check that tests have used super() properly.""" import astroid from pylint.checkers import BaseChecker, utils from pylint.checkers.classes import _ancestors_to_call from pylint.interfaces import IAstroidChecker from .common import BASE_ID, check_visitors, usable_class_name def register_checkers(li...
from __future__ import absolute_import from django.conf import settings import pika import logging import ujson import random import time import threading import atexit from collections import defaultdict from zerver.lib.utils import statsd # This simple queuing library doesn't expose much of the power of # rabbitmq...
from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import setup class CycleTagTests(SimpleTestCase): @setup({'cycle01': '{% cycle a %}'}) def test_cycle01(self): with self.assertRaises(TemplateSyntaxError): self.engine.get_template('cycle0...
from unittest import TestCase from mock import Mock, patch from base import Task as TestTask, TaskResult as TestReport from pulp_node.handlers.strategies import * from pulp_node.error import * from pulp_node.handlers.model import Repository from pulp_node.handlers.reports import SummaryReport, HandlerProgress class ...
__license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' import re, binascii, cPickle, ssl, json from future_builtins import map from threading import Thread, Event from PyQt5.Qt import (QObject, pyqtSignal, Qt, QUrl, QDialog, QGridLayout, QLabel, QCheckBox, QDialogButtonBox, QIc...
import unittest """solution to the array pair sum problem""" def array_pair_sum_iterative(arr, k): """ returns the array of pairs using an iterative method. complexity: O(n^2) """ result = [] for i in range(len(arr)): for j in range(i + 1, len(arr)): if arr[i] + arr[j] ==...
import datetime import unittest from airflow import DAG, configuration from airflow.contrib.operators.file_to_wasb import FileToWasbOperator try: from unittest import mock except ImportError: try: import mock except ImportError: mock = None class TestFileToWasbOperator(unittest.TestCase)...
import numpy as np import scipy.sparse as sparse from itertools import izip as zip # Uses the output of nodal_projection_matrix.py to aggregate signals # into the nodal domain. def calc_rel_area_of_grid(lats, lons): Dlons = np.diff(np.deg2rad(lons), axis=1) Dlats = -np.diff(np.sin(np.deg2rad(lats)), axis=0) ...
from __future__ import division import numpy as np import scipy as sp from warnings import warn from scipy.sparse import issparse import numbers from ..externals import six from ..tree import ExtraTreeRegressor from ..utils import check_random_state, check_array from .bagging import BaseBagging __all__ = ["Isolati...
from airflow.models import BaseOperator from airflow.utils import apply_defaults from airflow.exceptions import AirflowException from airflow.contrib.hooks.emr_hook import EmrHook class EmrAddStepsOperator(BaseOperator): """ An operator that adds steps to an existing EMR job_flow. :param job_flow_id: id ...
from __future__ import unicode_literals from weboob.tools.test import BackendTest class EkwateurTest(BackendTest): MODULE = 'ekwateur' def test_document(self): subscriptions = list(self.backend.iter_subscription()) assert subscriptions for sub in subscriptions: docs = l...
import os import sys import re import sublime st_version = 2 if sublime.version() == '' or int(sublime.version()) > 3000: st_version = 3 if (st_version == 2): from pybeautifier import Beautifier else: #from .pybeautifier import Beautifier print('CodeFormatter: formatting python files on ST3 not supported.') cl...
#!/usr/bin/env python # coding=utf-8 """ Combinatoric selections Problem 53 There are exactly ten ways of selecting three from five, 12345: 123, 124, 125, 134, 135, 145, 234, 235, 245, and 345 In combinatorics, we use the notation, 5C3 = 10. In general, nCr = n!/r!(n−r)!, where r ≤ n, n! = n×(n−1)×...×3×2×...
""" Unit test for Date parameters. """ import unittest import datetime as dt import param class TestDateParameters(unittest.TestCase): def test_initialization_out_of_bounds(self): try: class Q(param.Parameterized): q = param.Date(dt.datetime(2017,2,27), ...
from __future__ import print_function # python >= 2.6 from os.path import dirname, join, abspath, relpath from sys import stderr, exit as sys_exit def scan_file(file_path): cur_token = '' token_idx = 0 args = [] fd = open(file_path, 'r') for line in fd: line = line.strip() if lin...
""" Filesystem-based interprocess mutex. """ __metaclass__ = type import errno, os from time import time as _uniquefloat def unique(): return str(long(_uniquefloat() * 1000)) from os import rename try: from os import kill from os import symlink from os import readlink from os import remove as r...
import matplotlib.pyplot as plt import pathlib import typing class Plot: def __init__ (self, *, row_count:int, col_count:int, size:float) -> None: self.fig, self.axis_vv = plt.subplots( row_count, col_count, squeeze=False, figsize=(size*col_count,size*row_cou...
"""A tool to generate symbols for a binary suitable for breakpad. Currently, the tool only supports Linux, Android, and Mac. Support for other platforms is planned. """ import errno import optparse import os import Queue import re import shutil import subprocess import sys import threading CONCURRENT_TASKS=4 def ...
from notifyme_social import TwitterService import sys number_argv = len(sys.argv) if number_argv <2: print "Please select a service" sys.exit() if sys.argv[1] == 'twitter': print "Selecting twitter service" if number_argv < 3: print "Please give NotifyMe a command (Expected command arguments...
# ################################ # ######## Imports ################# # ################################ from urllib import unquote, urlencode from sys import exit try: from owslib.wmts import WebMapTileService from owslib.util import ServiceException import owslib print("Depencencies - owslib vers...
from __future__ import division import warnings import numpy as np import scipy.sparse as sp from .base import BaseEstimator, ClassifierMixin, RegressorMixin from .utils import check_random_state from .utils.validation import check_array from .utils.validation import check_consistent_length from .utils.random import ...
#!/usr/bin/env python """ nbody_fix_ttree_assignments.py This is an ugly little script which was not intended to be run by end users. Typical usage: nbody_fix_ttree_assignments.py "angles" new_Angles.template \ < ttree_assignments.txt > ttree_assigmnents_new.txt What it does: In this example, this progra...
from distutils.core import setup README = """Python Google Voice ==================== Joe McCall & Justin Quick Exposing the Google Voice "API" to the Python language ------------------------------------------------------- Google Voice for Python Allows you to place calls, send sms, download voicemail, and check t...
from django.db import migrations def popit_to_db(apps, schema_editor): Person = apps.get_model("popolo", "person") LoggedAction = apps.get_model("candidates", "loggedaction") for la in LoggedAction.objects.all(): if la.popit_person_id: try: la.person = Person.objects.ge...
"""passlib.exc -- exceptions & warnings raised by passlib""" #============================================================================= # exceptions #============================================================================= class MissingBackendError(RuntimeError): """Error raised if multi-backend handler ha...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os import unittest from contextlib import contextmanager from pants.base.build_file import BuildFile from pants.base.file_system_project_tree import FileSystem...
from servicenow import Utils ttl_cache=0 class Base(object): __table__ = None def __init__(self, Connection): self.Connection = Connection @Utils.cached(ttl=ttl_cache) def list_by_query(self, query, **kwargs): return self.format(self.Connection._list_by_query(self.__table__, query, ...
import sophia, shutil, sys, tempfile import timeit, random, threading if sys.version_info.major < 3: def get_rand_k(): return str(random.randint(0, 10000000)) else: def get_rand_k(): return str(random.randint(0, 10000000)).encode() def get_rand_p(): return get_rand_k(), get_rand_k() class...
"""Add portbindings db Revision ID: 176a85fc7d79 Revises: f489cf14a79c Create Date: 2013-03-21 14:59:53.052600 """ # revision identifiers, used by Alembic. revision = '176a85fc7d79' down_revision = 'f489cf14a79c' # Change to ['*'] if this migration applies to all plugins migration_for_plugins = [ 'neutron.plug...
from __future__ import with_statement import os.path import re import sqlite3 import time import threading import sickbeard from sickbeard import encodingKludge as ek from sickbeard import logger from sickbeard.exceptions import ex db_lock = threading.Lock() def dbFilename(filename="sickbeard.db", suffix=None): ...
import gdata.webmastertools.service import gdata.service try: from xml.etree import ElementTree except ImportError: from elementtree import ElementTree import atom import getpass username = '' password = '' username = raw_input('Please enter your username: ') password = getpass.getpass() client = gdata.webmaste...
"""SMTP email backend class.""" import smtplib import ssl import threading from django.conf import settings from django.core.mail.backends.base import BaseEmailBackend from django.core.mail.message import sanitize_address from django.core.mail.utils import DNS_NAME class EmailBackend(BaseEmailBackend): """ A...
import time import unittest import node LEADER = 1 ROUTER = 2 ED1 = 3 SED1 = 4 class Cert_5_6_6_NetworkDataExpiration(unittest.TestCase): def setUp(self): self.nodes = {} for i in range(1,5): self.nodes[i] = node.Node(i) self.nodes[LEADER].set_panid(0xface) self.nodes...
from oslo_serialization import jsonutils from oslo_utils import timeutils from neutron.common import constants as const from neutron.db import agents_db from neutron.db import common_db_mixin as base_db from neutron.db import models_v2 from neutron.plugins.ml2.drivers.l2pop import constants as l2_const from neutron.pl...
import os from ctypes import CDLL from ctypes.util import find_library from django.conf import settings # Creating the settings dictionary with any settings, if needed. GEOIP_SETTINGS = {key: getattr(settings, key) for key in ('GEOIP_PATH', 'GEOIP_LIBRARY_PATH', 'GEOIP_COUNTRY', 'GEOIP_CITY') ...
import time, sys from dateutil.parser import parse # get meta data ids, events, locations = {}, {}, {} # mapping file_meta = open("GC.meta", 'r') num_people = int(file_meta.readline()) for i in range(num_people): tokens = file_meta.readline().rstrip('\n').split(' ') index, id = int(tokens[0]), int(tokens[1]) ids...
#!/usr/bin/env python3 from tkinter import Canvas, HORIZONTAL, VERTICAL from tkinter import ttk from PIL import ImageTk from markers.marker import Marker from markers.marker_utilities import MarkerUtilities from markers.shapes import Shapes class Main_gui: ''' Class for creating main part of the window inte...