content
string
from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'd. F Y' TIME_FORMAT = 'H:i:s' DATETIME_FORMAT = 'j. F Y. H:i' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j. F' SHORT_DATE_FORMAT = ...
import os import sys # Add parent folder to sys.path, so we can import boot. # App Engine causes main.py to be reloaded if an exception gets raised # on the first request of a main.py instance, so don't add project_dir # multiple times. project_dir = os.path.abspath( os.path.dirname(os.path.dirname(os.path.dirnam...
"""API for working with Nvim windows.""" from pynvim.api.common import Remote __all__ = ('Window') class Window(Remote): """A remote Nvim window.""" _api_prefix = "nvim_win_" @property def buffer(self): """Get the `Buffer` currently being displayed by the window.""" return self.re...
import contextlib import itertools import mock import testtools from webob import exc from neutron import context from neutron.db import models_v2 from neutron.extensions import external_net as external_net from neutron import manager from neutron.openstack.common import log as logging from neutron.openstack.common i...
import time from datetime import datetime from dateutil.relativedelta import relativedelta from openerp.osv import fields, osv from openerp.tools.translate import _ class account_aged_trial_balance(osv.osv_memory): _inherit = 'account.common.partner.report' _name = 'account.aged.trial.balance' _description...
import subprocess from subprocess import PIPE import time from selenium.common.exceptions import WebDriverException from selenium.webdriver.common import utils class Service(object): """ Object that manages the starting and stopping of the IEDriver """ def __init__(self, executable_path, port=0, host=...
from __future__ import unicode_literals import logging import sys import types import warnings from django import http from django.conf import settings from django.core import signals, urlresolvers from django.core.exceptions import ( MiddlewareNotUsed, PermissionDenied, SuspiciousOperation, ) from django.db impo...
#!/usr/bin/env python from __future__ import print_function import glob import os from PIL import Image hdrs = [] data = [] imgs = [] def encode_pixels(img): r = '' img = [ (x[0] + x[1] + x[2] > 384 and '1' or '0') for x in img] for i in range(len(img) // 8): c = ''.join(img[i * 8 : i * 8 + 8]) r += '0x%02x, '...
import type_analysis def all_tests(): basic_tests() def basic_tests(): # basic addition with variables assert type_analysis.analyze_type_safety("x = 1; y = 1; z = x + y") == True assert type_analysis.analyze_type_safety("x = 'r'; y = 'r'; z = x + y") == True assert type_analysis.analyze_type_safet...
from __future__ import print_function """ This script updates the filesystem and database structure WRT icons. In particular it will move all the icons information out of bibdoc_bibdoc tables and into the normal bibdoc + subformat infrastructure. """ import sys from datetime import datetime from invenio.utils.text ...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting model 'CourseRegistration' db.delete_table('student_courseregistration') # Adding model ...
import pathlib import pygraphviz def task_imports(): """find imports from a python module""" return { 'file_dep': ['projects/requests/requests/models.py'], 'targets': ['requests.models.deps'], 'actions': ['python -m import_deps %(dependencies)s > %(targets)s'], 'clean': True, ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community' } from ansible.module_utils.keycloak import KeycloakAPI, camel, keycloak_argument_spec from ansible.module_utils.basic im...
""" Pants http://www.pants-lang.org/ IR types """ __author__ = "JT Olds" __author_email__ = "<EMAIL>" __all__ = ["Identifier", "Expression", "Assignment", "ObjectMutation", "ReturnValue", "Value", "Field", "Variable", "Integer", "String", "Float", "Function", "OutArgument", "PositionalOutArgument", "Nam...
""" Time how long it takes to open a VCF. Run as: python -m profile -s cumtime %(prog)s to get profiling output. """ import argparse import time import varcode parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( "path", help="Path or URL to VCF") parser.add_argument( "--profile...
#!/usr/bin/env python # -*- encoding: utf-8 -*- # vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8: # http://binux.me # Created on 2015-01-24 13:44:10 from httpbin import app @app.route('/pyspider/test.html') def test_page(): return ''' <a href="/404">404 <a href="/links/10/0">0 <a href="/links/10/1">1 <a hr...
""" Item Exporters are used to export/serialize items into different formats. """ import csv import sys import pprint import marshal import six from six.moves import cPickle as pickle from xml.sax.saxutils import XMLGenerator from scrapy.utils.serialize import ScrapyJSONEncoder from scrapy.item import BaseItem __all...
""" Tests the example specification validator. """ import json from . import TestCase from package_verify.validator import _Validator, error from package_verify.validator.validators import devspec data = { "name": "name", "version": "1.0.0", "release": "1", "license": "GPLv3", "summary": "A thi...
""" System tests for `jenkinsapi.jenkins` module. """ import logging import pytest from jenkinsapi.node import Node from jenkinsapi.credential import SSHKeyCredential from jenkinsapi_tests.test_utils.random_strings import random_string log = logging.getLogger(__name__) def test_online_offline(jenkins): """ C...
from django.http import HttpResponse from django.template import engines from django.template.response import TemplateResponse from django.test import RequestFactory, SimpleTestCase from django.utils.decorators import classproperty, decorator_from_middleware class ProcessViewMiddleware(object): def process_view(s...
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains th...
import os import sys sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitcoinrpc")) from decimal import Decimal import json import shutil import subprocess import time from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from util import * START_P2P_PORT=11000 START_RPC...
import numpy as np import cv2 import tkinter as tk from PIL import Image, ImageTk import os.path as op VIDEODIR = '/media/degoldschmidt/DATA_DENNIS_002/working_data/0007_KPEG' VIDEOFILE = op.join(VIDEODIR, 'cam01_2018-04-18T15_39_08.avi') START_FRAME = 4000 #Set up GUI window = tk.Tk() #Makes main window window.wm_...
import itk from sys import argv itk.auto_progress(2) edges = itk.imread(argv[1], itk.F) houghF = itk.HoughTransform2DLinesImageFilter[itk.F, itk.F].New() houghF.SetInput(edges) houghF.SetAngleResolution(100) houghF.SetNumberOfLines(2) houghF.Update() detected_lines = houghF.GetLines() # Check that we detected 2 lines...
from googleapiclient import discovery from tinydb import TinyDB from core.utility import get_gcloud_creds db = TinyDB('entities.json') group_table = db.table('Instance Groups') template_table = db.table('Instance Templates') credentials = GoogleCredentials.get_application_default() from oauth2client.file import Stora...
""" Module with classes and methods to perform implicit regional modelling based on the potential field method. Tested on Ubuntu 14 Created on 10/10 /2016 @author: Miguel de la Varga """ from __future__ import division import os from os import path import sys # This is for sphenix to find the packages sys.path.appe...
import logging import re from rules import rule class LogUrl(rule.Rule): """Logs the request URL.""" def __init__(self, url, stop=False): r"""Initializes with a url pattern. Args: url: a string regex, e.g. r'example\.com/id=(\d{6})'. stop: boolean ApplyRule should_stop value, defaults to T...
import sys import logging from django.core.management.base import BaseCommand def run_appcfg(): # import this so that we run through the checks at the beginning # and report the appropriate errors import appcfg # We don't really want to use that one though, it just executes this one from google.appengine....
import mock from oslo_config import cfg from oslo_serialization import jsonutils from nova.api.openstack import wsgi as os_wsgi from nova import compute from nova import exception from nova import objects from nova import test from nova.tests.unit.api.openstack import fakes NAME_FMT = cfg.CONF.instance_name_template...
from __future__ import unicode_literals from __future__ import absolute_import import mock from compose.project import Project from .testcases import DockerClientTestCase class ResilienceTest(DockerClientTestCase): def setUp(self): self.db = self.create_service('db', volumes=['/var/db'], command='top') ...
from neutron.common import constants as os_constants from neutron.db import common_db_mixin from neutron.db import external_net_db from neutron.db import extraroute_db from neutron.db import l3_db from neutron.db import models_v2 from neutron.db import securitygroups_db from neutron.plugins.nuage import nuage_models ...
from clang.cindex import Index, CursorKind from coalib.bears.LocalBear import LocalBear from coalib.results.Result import Result from coalib.results.SourceRange import SourceRange from coalib.bearlib import deprecate_settings from bears.c_languages.ClangBear import clang_available, ClangBear class ClangComplexityBea...
import unittest import sys import _ast from test import test_support import textwrap class TestSpecifics(unittest.TestCase): def test_no_ending_newline(self): compile("hi", "<test>", "exec") compile("hi\r", "<test>", "exec") def test_empty(self): compile("", "<test>", "exec") def...
"""Unit test for the gtest_xml_output module""" __author__ = '<EMAIL> (Sean Mcafee)' import errno import os import sys from xml.dom import minidom, Node import gtest_test_utils import gtest_xml_test_utils GTEST_OUTPUT_FLAG = "--gtest_output" GTEST_DEFAULT_OUTPUT_FILE = "test_detail.xml" GTES...
import unittest from compose.config.interpolation import BlankDefaultDict as bddict from compose.config.interpolation import interpolate from compose.config.interpolation import InvalidInterpolation class InterpolationTest(unittest.TestCase): def test_valid_interpolations(self): self.assertEqual(interpol...
ANSIBLE_METADATA = {'status': ['deprecated'], 'supported_by': 'community', 'version': '1.0'} import ansible.module_utils.openswitch from ansible.module_utils.netcfg import NetworkConfig, dumps from ansible.module_utils.network import NetworkModule from ansible.module_utils.open...
""" SQS Message A Message represents the data stored in an SQS queue. The rules for what is allowed within an SQS Message are here: http://docs.amazonwebservices.com/AWSSimpleQueueService/2008-01-01/SQSDeveloperGuide/Query_QuerySendMessage.html So, at it's simplest level a Message just needs to allow a develope...
"Misc. utility functions/classes for admin documentation generator." import re from email.errors import HeaderParseError from email.parser import HeaderParser from django.core.urlresolvers import reverse from django.utils.encoding import force_bytes from django.utils.safestring import mark_safe try: import docut...
#!/usr/bin/env python """ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License")...
from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j. F Y' TIME_FORMAT = 'H:i' DATETIME_FORMAT = 'j. F Y H:i' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j. F' SHORT_DATE_FORMAT = 'd....
""" Tutorial - Object inheritance You are free to derive your request handler classes from any base class you wish. In most real-world applications, you will probably want to create a central base class used for all your pages, which takes care of things like printing a common page header and footer. """ import cherr...
""" Models for testing various aspects of the djang.contrib.admindocs app """ from django.db import models class Company(models.Model): name = models.CharField(max_length=200) class Group(models.Model): name = models.CharField(max_length=200) class Family(models.Model): last_name = models.CharField(m...
from . import invoice
""" This module houses the GoogleMap object, used for generating the needed javascript to embed Google Maps in a Web page. Google(R) is a registered trademark of Google, Inc. of Mountain View, California. Example: * In the view: return render_to_response('template.html', {'google' : GoogleMap(key="...
""" Copied from: https://code.djangoproject.com/browser/django/ trunk/django/utils/datastructures.py#L99 BSD license """ import copy from types import GeneratorType import bisect class SortedDict(dict): """ A dictionary that keeps its keys in the order in which they're inserted. """ def _...
from google.appengine.ext import ndb from endpoints_proto_datastore.ndb import EndpointsModel from endpoints_proto_datastore.ndb import EndpointsAliasProperty from endpoints_proto_datastore.ndb import EndpointsVariantIntegerProperty from endpoints_proto_datastore.ndb import EndpointsComputedProperty from datetime impor...
"""Base class for network namespace controller. """ import logging import os import subprocess from silk.device.system_call_manager import SystemCallManager from silk.node.base_node import BaseNode import silk.postprocessing.ip as silk_ip def create_link_pair(interface_1, interface_2): command = "sudo ip link a...
import os import shutil import tempfile import unittest from swift.common.swob import Request, Response from swift.common.middleware import healthcheck class FakeApp(object): def __call__(self, env, start_response): req = Request(env) return Response(request=req, body='FAKE APP')( env...
""" Tests for credit requirement display on the progress page. """ import ddt import six from django.conf import settings from django.urls import reverse from mock import patch from course_modes.models import CourseMode from openedx.core.djangoapps.credit import api as credit_api from openedx.core.djangoapps.credit....
#!/usr/bin/env python # encoding: utf-8 """PGEM test configuration model. Default connect to configuration.db which save the test items settings. """ __version__ = "0.1" __author__ = "@fanmuzhi, @boqiling" __all__ = ["PGEMConfig", "TestItem"] from sqlalchemy.ext.declarative import declarative_base from sqlalchemy imp...
import os import platform from collections import defaultdict from itertools import imap from synchronousdeluge.exceptions import DelugeRPCError from synchronousdeluge.protocol import DelugeRPCRequest, DelugeRPCResponse from synchronousdeluge.transfer import DelugeTransfer __all__ = ["DelugeClient"] RPC_RESPONSE =...
import pytest import re from tests.hs2.hs2_test_suite import HS2TestSuite, needs_session from TCLIService import TCLIService, constants from TCLIService.ttypes import TTypeId # Simple test to make sure all the HS2 types are supported for both the row and # column-oriented versions of the HS2 protocol. class TestFetch(...
import unittest import mock from pulp.server.db.model.consumer import Consumer from pulp.server.db.model.dispatch import ScheduledCall from pulp.server.exceptions import MissingResource, MissingValue, InvalidValue from pulp.server.managers.factory import initialize from pulp.server.managers.schedule.consumer import (...
from openerp.osv import fields, osv from openerp.tools.translate import _ import openerp.addons.decimal_precision as dp class change_standard_price(osv.osv_memory): _name = "stock.change.standard.price" _description = "Change Standard Price" _columns = { 'new_price': fields.float('Price', required=...
#!/usr/bin/env python # File created on 20 Dec 2009. from __future__ import division __author__ = "Greg Caporaso" __copyright__ = "Copyright 2011, The QIIME Project" __credits__ = ["Greg Caporaso", "Jesse Stombaugh"] __license__ = "GPL" __version__ = "1.9.1-dev" __maintainer__ = "Greg Caporaso" __email__ = "<EMAIL>" ...
"""The tests for the Cast Media player platform.""" # pylint: disable=protected-access import unittest from unittest.mock import patch from homeassistant.components.media_player import cast class FakeChromeCast(object): """A fake Chrome Cast.""" def __init__(self, host, port): """Initialize the fake...
from test import test_support import time import unittest class TimeTestCase(unittest.TestCase): def setUp(self): self.t = time.time() def test_data_attributes(self): time.altzone time.daylight time.timezone time.tzname def test_clock(self): time.clock() ...
import argparse, random from pygtsa.structure import Assembly from pygtsa.histogram import EVHistogram from pygtsa.cgraph import mc_simulate_energies_EV if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('structure', type=str, help="path to input structure file") parser.add_...
"""empty message Revision ID: 9913b58c2640 Revises: ddc941500bd2 Create Date: 2016-07-29 23:23:27.324000 """ # revision identifiers, used by Alembic. revision = '9913b58c2640' down_revision = 'ddc941500bd2' from alembic import op import sqlalchemy as sa import sqlalchemy_utils def upgrade(): ### commands auto...
"""Tensorflow layers with added variables for parameter masking. Branched from tensorflow/contrib/layers/python/layers/layers.py """ # pylint: disable=missing-docstring from __future__ import absolute_import from __future__ import division from __future__ import print_function import six from tensorflow.contrib.fram...
""" "Safe weakrefs", originally from pyDispatcher. Provides a way to safely weakref any function, including bound methods (which aren't handled by the core weakref module). """ import traceback import weakref def safeRef(target, onDelete = None): """Return a *safe* weak reference to a callable target target...
# -*- coding: utf-8 -*- "Basic example to test PyFPDF" #PyFPDF-cover-test:format=PDF #PyFPDF-cover-test:fn=simple.pdf #PyFPDF-cover-test:hash=1fd821a42cb5029a51727a6107b623ec #PyFPDF-cover-test:pil=yes #PyFPDF-cover-test:res=../tutorial/logo.png #PyFPDF-cover-test:res=flower2.jpg #PyFPDF-cover-test:res=lena.gif impo...
""" ========================== SGD: convex loss functions ========================== A plot that compares the various convex loss functions supported by :class:`sklearn.linear_model.SGDClassifier` . """ print(__doc__) import numpy as np import matplotlib.pyplot as plt def modified_huber_loss(y_true, y_pred): z ...
""" This script exists to work around severe performane problems when WPA or other Windows Performance Toolkit programs try to load the symbols for the Chrome web browser. Some combination of the enormous size of the symbols or the enhanced debug information generated by /Zo causes WPA to take about twenty minutes...
from django.utils.translation import ugettext_lazy as _ import netaddr from horizon import exceptions from horizon import forms from horizon.utils import validators from horizon import workflows from openstack_dashboard import api port_validator = validators.validate_port_or_colon_separated_port_range class AddRul...
# coding: UTF-8 """ Tests for support views. """ from datetime import datetime, timedelta import itertools import json import re import ddt from django.core.urlresolvers import reverse from nose.plugins.attrib import attr from pytz import UTC from course_modes.models import CourseMode from course_modes.tests.factori...
#!/usr/bin/env python # -*- coding: utf-8 -*- from jolla import server from jolla import plugins from jolla import session from jolla import HTTP404Error from jolla import SessionError session = session() def index(request): return plugins.render('index.html') def chinese(request): try: if reques...
import datetime import time from _sqlite3 import * paramstyle = "qmark" threadsafety = 1 apilevel = "2.0" Date = datetime.date Time = datetime.time Timestamp = datetime.datetime def DateFromTicks(ticks): return Date(*time.localtime(ticks)[:3]) def TimeFromTicks(ticks): return Time(*time.localtime(ticks...
from chareditor import CharEditorScreen from Title import Title from game import GameScreen from game import GameSetupScreen # Constant screen names TITLE = 'title' CHAR_EDITOR = 'character editor' GAME = 'game' GAME_SETUP = 'game setup' CONFIG = 'config' __all__ = ["TITLE", "CHAR_EDITOR", "GAME", "GAME_SETUP", "CON...
""" This code was taken from https://github.com/ActiveState/appdirs and modified to suit our purposes. """ from __future__ import absolute_import import os import sys from pip.compat import WINDOWS, expanduser def user_cache_dir(appname): r""" Return full path to the user-specific cache dir for this applica...
import abc import unittest class FinderTests(unittest.TestCase, metaclass=abc.ABCMeta): """Basic tests for a finder to pass.""" @abc.abstractmethod def test_module(self): # Test importing a top-level module. pass @abc.abstractmethod def test_package(self): # Test importi...
from __future__ import unicode_literals import re from .mtv import MTVServicesInfoExtractor class SpikeIE(MTVServicesInfoExtractor): _VALID_URL = r'https?://(?:[^/]+\.)?spike\.com/[^/]+/[\da-z]{6}(?:[/?#&]|$)' _TESTS = [{ 'url': 'http://www.spike.com/video-clips/lhtu8m/auction-hunters-can-allen-ride...
# encoding: UTF-8 __author__ = 'CHENXY' from sgit_data_type import * def main(): """主函数""" fcpp = open('SgitFtdcUserApiStruct.h', 'r') fpy = open('sgit_struct.py', 'w') fpy.write('# encoding: UTF-8\n') fpy.write('\n') fpy.write('structDict = {}\n') fpy.write('\n') for no, line in en...
import numpy as np from astropy.table import Table import pytest from ..simulator import KeepCol, Sequence, BaseContainer from ...optics import FlatDetector f1 = FlatDetector() f2 = FlatDetector() f3 = FlatDetector() s_l2 = Sequence(elements=[f2, f3]) mission = Sequence(elements=[f1, s_l2]) def test_seach_all(): ...
import roslib; roslib.load_manifest('hlpr_manipulation_utils') from sensor_msgs.msg import JointState from vector_msgs.msg import JacoCartesianVelocityCmd, LinearActuatorCmd, GripperCmd, GripperStat from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint from wpi_jaco_msgs.msg import AngularCommand, Carte...
import stock_move import stock_return_picking import stock_change_product_qty import make_procurement_product import orderpoint_procurement import stock_transfer_details
### Author: David Nicklay <david-d$nicklay,com> ### Modified from disk-util: Dag Wieers <dag$wieers,com> class dstat_plugin(dstat): """ The average service time (in milliseconds) for I/O requests that were issued to the device. Warning! Do not trust this field any more. """ def __init__(self)...
import sys import socket import json import os import hashlib import hmac import tempfile import time import base64 from StringIO import StringIO from Crypto.Cipher import AES from gzip import GzipFile # TODO: dual-stack UDP_IP = "0.0.0.0" UDP_PORT = 23042 # TODO: support unique keys per client key = hashlib.sha256...
from __future__ import unicode_literals from datetime import datetime from operator import attrgetter from django.test import TestCase from .models import ( CustomMembership, Employee, Event, Friendship, Group, Ingredient, Invitation, Membership, Person, PersonSelfRefM2M, Recipe, RecipeIngredient, Relati...
#!/usr/bin/env python3 # import sys, json import numpy as np import matplotlib.pyplot as plt from collections import defaultdict def semver2int (semver): if semver == 'trunk': semver = '0.10.0.0' vi = 0 i = 0 for v in reversed(semver.split('.')): vi += int(v) * (i * 10) i += 1...
import unittest from ansible.utils.shlex import shlex_split class TestSplit(unittest.TestCase): def test_trivial(self): self.assertEqual(shlex_split("a b c"), ["a", "b", "c"]) def test_unicode(self): self.assertEqual(shlex_split(u"a b \u010D"), [u"a", u"b", u"\u010D"]) def test_quoted(...
from __future__ import absolute_import import logging from pip._vendor import pkg_resources from pip.basecommand import Command from pip.exceptions import DistributionNotFound from pip.index import FormatControl, fmt_ctl_formats, PackageFinder, Search from pip.req import InstallRequirement from pip.utils import get_...
#!/usr/bin/env python # # Use the raw transactions API to spend bitcoins received on particular addresses, # and send any change back to that same address. # # Example usage: # spendfrom.py # Lists available funds # spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00 # # Assumes it will talk to a bitcoind or Bit...
import os from . import swagger_client as swagger from .swagger_client.models.v1_pod import V1Pod from .swagger_client.models.v1_pod_spec import V1PodSpec from .swagger_client.models.v1_object_meta import V1ObjectMeta from .swagger_client.models.v1_container import V1Container from .swagger_client.models.v1_container_...
from collections.abc import Mapping, MutableMapping import pytest from multidict import MultiMapping, MutableMultiMapping from multidict._compat import USE_CYTHON from multidict._multidict_py import CIMultiDict as PyCIMultiDict from multidict._multidict_py import CIMultiDictProxy as PyCIMultiDictProxy from multidict....
try: from urllib.parse import urlencode except ImportError: from urllib import urlencode from django.conf import settings from django.contrib import messages from django.contrib.auth import login as auth_login, logout as auth_logout from django.contrib.auth.decorators import login_required from django.contrib....
from django.core.urlresolvers import reverse from taiga.base.utils import json from .. import factories as f import pytest pytestmark = pytest.mark.django_db ######################################################### # Task Custom Attributes ######################################################### def test_task_cu...
"""A clone of the default copy.deepcopy that doesn't handle cyclic structures or complex types except for dicts and lists. This is because gyp copies so large structure that small copy overhead ends up taking seconds in a project the size of Chromium.""" class Error(Exception): pass __all__ = ["Error", "deepcopy"] ...
#!/usr/bin/env python ''' ''' __docformat__ = 'restructuredtext' __version__ = '$Id$' from pyglet.gl import * from pyglet.event import * from layout.css import * from layout.content import * from layout.frame import * from layout.locator import * from layout.view import * from layout.gl.device import * from layout....
from core import perf_benchmark from telemetry import benchmark from telemetry.page import legacy_page_test from telemetry.value import list_of_scalar_values from telemetry.value import scalar from measurements import media import page_sets class _MSEMeasurement(legacy_page_test.LegacyPageTest): def __init__(sel...
import re from avocado.utils import process class Network(): def __init__(self, brname=None): self.brname = brname self.interfaces=[] process.run("modprobe veth", shell=True) if self.brname and self.checkifbridgeexist(): print "adding bridge " + self.brname ...
import hashlib import json import base64 import pyaes from pkcs7 import PKCS7Encoder import os, urllib2,urllib import cookielib def evpKDF(passwd, salt, key_size=8, iv_size=4, iterations=1, hash_algorithm="md5"): target_key_size = key_size + iv_size derived_bytes = "" number_of_derived_words = 0 b...
from dumper import * def qdump__boost__bimaps__bimap(d, value): #leftType = d.templateArgument(value.type, 0) #rightType = d.templateArgument(value.type, 1) size = int(value["core"]["node_count"]) d.putItemCount(size) if d.isExpanded(): d.putPlainChildren(value) def qdump__boost__optional...
#!/usr/bin/env python # # Generate seeds.txt from Pieter's DNS seeder # NSEEDS=512 MAX_SEEDS_PER_ASN=2 MIN_BLOCKS = 337600 # These are hosts that have been observed to be behaving strangely (e.g. # aggressively connecting to every node). SUSPICIOUS_HOSTS = set([ "130.211.129.106", "178.63.107.226", "83.81.1...
import rules from frequencia.accounts.rules import is_gestor, is_bolsista from frequencia.vinculos.utils import get_setores #Predicates @rules.predicate def is_justificativa_author(user, justificativa): try: return justificativa.vinculo in user.vinculos.all() except: return None @rules.predicate def is_justifi...
import sys from dolfin import * from dolfin_adjoint import * f = Expression("x[0]*(x[0]-1)*x[1]*(x[1]-1)") mesh = UnitSquareMesh(4, 4) V = FunctionSpace(mesh, "CG", 1) def main(ic, annotate=True): u = TrialFunction(V) v = TestFunction(V) u_0 = Function(V, name="Solution") u_0.assign(ic, annotate=Fal...
from __future__ import unicode_literals import os import sys from subprocess import PIPE, Popen from django.apps import apps as installed_apps from django.utils import six from django.utils.crypto import get_random_string from django.utils.encoding import DEFAULT_LOCALE_ENCODING, force_text from .base import Command...
from django_filters import rest_framework as filters from entitlements.models import CourseEntitlement class CharListFilter(filters.CharFilter): """ Filters a field via a comma-delimited list of values. """ def filter(self, qs, value): # pylint: disable=method-hidden if value not in (None, ''): ...
"""Helper utility to save parameter dict""" import tvm _save_param_dict = tvm.get_global_func("nnvm.compiler._save_param_dict") _load_param_dict = tvm.get_global_func("nnvm.compiler._load_param_dict") def save_param_dict(params): """Save parameter dictionary to binary bytes. The result binary bytes can be lo...
""" SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. """ version = "0.20" from xml.sax._exceptions import * from xml.sax.handler import feature_validation, feature_namespaces from xml.sax.handler import feature_namespace_prefixes from xml.sax.handler import feature_external_...