content
stringlengths
4
20k
""" Figaro password manager database plugin """ import os from xml.dom import minidom from string import strip from Crypto.Cipher import Blowfish from Crypto.Hash import MD5 from random import randint from kedpm.exceptions import WrongPassword from kedpm.passdb import PasswordDatabase, DatabaseNotExist from kedpm.p...
import eg from NewItem import NewItem class NewFolder(NewItem): """ Create a new FolderItem if the user has choosen to do so from the menu or toolbar. """ name = eg.text.MainFrame.Menu.AddFolder.replace("&", "") @eg.AssertInMainThread @eg.LogIt def Do(self, selection): document...
ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'} import sys # noqa import json import re API_BASE = 'https://api.github.com' class GitHubResponse(object): def __init__(self, response, info): self.content = response.read()...
from datetime import datetime, timedelta import os import jwt import json import requests from functools import wraps from urlparse import parse_qs, parse_qsl from urllib import urlencode from flask import Flask, g, send_file, request, redirect, url_for, jsonify from flask.ext.sqlalchemy import SQLAlchemy from werkzeug...
""" Create a population of iaf_psc_alpha neurons on a 4x3 grid ----------------------------------------------------------- BCCN Tutorial @ CNS*09 Hans Ekkehard Plesser, UMB """ import nest import matplotlib.pyplot as plt nest.ResetKernel() l1 = nest.Create('iaf_psc_alpha', positions=nest.spatial.gr...
#!/usr/local/bin/python-2.5/bin/python Info=""" Module name: cfg2lammps.py Author: (c) Andres Jaramillo-Botero California Institute of Technology <EMAIL> Project: pEFF Version: August 2009 Reads in an eff .cfg file and produces the corresponding lammps data and input files NOTE: Unsupported functions will be report...
import jinja2 import os import webapp2 from google.appengine.api import users from google.appengine.ext import ndb # We set a parent key on the 'Transactions' to ensure that they are all in the same # entity group. Queries across the single entity group will be consistent. # However, the write rate should be...
import pygtk pygtk.require('2.0') import gtk # noqa import pango # noqa import gobject # noqa from matplotlib.figure import Figure # noqa from matplotlib.backends.backend_gtkagg import \ FigureCanvasGTKAgg as FigureCanvas # noqa import matplotlib.gridspec as gridspec # ...
"""Tests for checkpoints tools.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import tensorflow as tf def _create_checkpoints(sess, checkpoint_dir): checkpoint_prefix = os.path.join(checkpoint_dir, "model") checkpoint_state_name = "che...
# -*- coding: utf-8 -*- """ flask.ctx ~~~~~~~~~ Implements the objects required to keep the context. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import sys from functools import update_wrapper from werkzeug.excep...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: scaleway_organization_facts short_description: Gather fact...
"""Tests for HomematicIP Cloud switch.""" from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN from homeassistant.components.homematicip_cloud.device import ( ATTR_GROUP_MEMBER_UNREACHABLE, ) from homeassistant.components.switch import ( ATTR_CURRENT_POWER_W, ATTR_TODAY_ENERGY_KWH, ...
""" API views for badges """ from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey from rest_framework import generics from rest_framework.exceptions import APIException from openedx.core.djangoapps.user_api.permissions import is_field_shared_factory from openedx.core.lib.api.authenticatio...
from __future__ import unicode_literals, division, absolute_import from builtins import * # pylint: disable=unused-import, redefined-builtin import io import os import re import logging from sqlalchemy import Column, Integer, Unicode from flexget import options, plugin from flexget.db_schema import versioned_base f...
import time from openerp.osv import osv from openerp.report import report_sxw class analytic_account_budget_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(analytic_account_budget_report, self).__init__(cr, uid, name, context=context) self.localcontext.update( { ...
'''Logging module for python-gnupg.''' from __future__ import absolute_import from __future__ import print_function from datetime import datetime from functools import wraps import logging import sys import os try: from logging import NullHandler except: class NullHandler(logging.Handler): def han...
""" Implements a special view that displays an editable diff of unstaged changes. """ import os import sys import sublime from sublime_plugin import WindowCommand, TextCommand from ...common import util from ..git_command import GitCommand from ..exceptions import GitSavvyError TITLE = "GIT-ADD: {}" class GsAddE...
"""Unittests for the various HTTPServer modules. Written by Cody A.W. Somerville <<EMAIL>>, Josip Dzolonga, and Michael Otteneder for the 2007/08 GHOP contest. """ import os import sys import re import base64 import shutil import urllib import httplib import tempfile import unittest import CGIHTTPServer from BaseHT...
import json class InspectorMemoryException(Exception): pass class InspectorMemory(object): """Communicates with the remote inspector's Memory domain.""" def __init__(self, inspector_backend): self._inspector_backend = inspector_backend self._inspector_backend.RegisterDomain( 'Memory', s...
from openerp.osv import fields, osv class res_partner(osv.osv): _name = "res.partner" _inherit = "res.partner" _columns = { 'nrc' : fields.char('NRC', help='Registration number at the Registry of Commerce'), } def _auto_init(self, cr, context=None): result = super(res_partner, self...
from __future__ import absolute_import, division, print_function, unicode_literals from c7n.manager import resources from c7n.query import QueryResourceManager @resources.register('gamelift-build') class GameLiftBuild(QueryResourceManager): class resource_type(object): service = 'gamelift' enum_...
#!/usr/bin/python3 import sys import os import argparse as argp import subprocess as subproc if __name__ == '__main__': parse = argp.ArgumentParser(description = 'Sort input integer data ' + 'file for performance ' + 'assessment.')...
"""Tests for Monte Carlo Ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.contrib import distributions as distributions_lib from tensorflow.contrib import layers as layers_lib from tensorflow.contrib.bayesflow.pyth...
from azure.mgmt.containerinstance.models import AzureFileVolume, Volume from airflow.hooks.base_hook import BaseHook class AzureContainerVolumeHook(BaseHook): """ A hook which wraps an Azure Volume. :param wasb_conn_id: connection id of a Azure storage account of which file shares should be moun...
import random import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy.orm import exc from sqlalchemy.orm import joinedload from neutron.common import constants as q_const from neutron.common import utils as n_utils from neutron.db import agents_db from neutron.db import l3_agentschedulers_db as l3agent_sch...
""" Get API information encoded in C files. See ``find_function`` for how functions should be formatted, and ``read_order`` for how the order of the functions should be specified. """ from __future__ import division, absolute_import, print_function import sys, os, re try: import hashlib md5new = hashlib.md5 ...
from osv import fields, osv from tools.translate import _ class account_fiscalyear_close(osv.osv_memory): """ Closes Account Fiscalyear and Generate Opening entries for New Fiscalyear """ _name = "account.fiscalyear.close" _description = "Fiscalyear Close" _columns = { 'fy_id': fields.ma...
import re import os import subprocess import sublime import sublime_plugin class PhpBeautifierCommand(sublime_plugin.TextCommand): def run(self, edit): # Test environment if self.view.is_scratch(): return if self.view.is_dirty(): return sublime.status_message("Ple...
#!/usr/bin/env python """ Utilities for epitopepredict Created March 2013 Copyright (C) Damien Farrell """ from __future__ import absolute_import, print_function import os, math, csv, string import shutil import numpy as np import pandas as pd from Bio import SeqIO from Bio.SeqRecord import SeqRecord from...
"""Python version compatibility support for minidom.""" # This module should only be imported using "import *". # # The following names are defined: # # NodeList -- lightest possible NodeList implementation # # EmptyNodeList -- lightest possible NodeList that is guaranteed to # remain empty...
import os import rhsm.connection as connection import subscription_manager.injection as inj from subscription_manager.cli import system_exit from subscription_manager.cli_command.cli import CliCommand, handle_exception from subscription_manager.i18n import ugettext as _ class RedeemCommand(CliCommand): def __i...
#!/usr/bin/python3 # -*- coding: utf-8 -*- try: import pathConfig except ImportError: pass #external imports import json import sys import optparse #internal imports import subuserlib.version import subuserlib.commandLineArguments import subuserlib.profile from subuserlib.classes.user import User def parseCliArgs...
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse_lazy from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms from horizon import tabs from horizon.utils import memoized from horizon import workflows from openstack_dashb...
"""Functions called by the generated code to execute an eager-mode op.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import six from google.protobuf import text_format from tensorflow.core.framework import tensor_pb2 from tensorflow.python import pywr...
from __future__ import unicode_literals import re import warnings from django.core.exceptions import ImproperlyConfigured from django.core.mail import send_mail from django.core import validators from django.db import models from django.db.models.manager import EmptyManager from django.utils.crypto import get_random_s...
import logging from telemetry.value import scalar from telemetry.web_perf.metrics import mainthread_jank_stats from telemetry.web_perf.metrics import timeline_based_metric from telemetry.web_perf import timeline_interaction_record as tir_module class ResponsivenessMetric(timeline_based_metric.TimelineBasedMetric): ...
from openerp.osv import fields, osv from openerp.tools import float_compare from openerp.tools.translate import _ import openerp.addons.decimal_precision as dp class stock_move_consume(osv.osv_memory): _name = "stock.move.consume" _description = "Consume Products" _columns = { 'product_id': fields...
#!/usr/bin/env python """ upoad plugin Plugin read by omero.cli.Cli during initialization. The method(s) defined here will be added to the Cli class for later use. Copyright 2007 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import sys, re fr...
from numpy import arcsin, arctan2, array, cos, sin, sqrt from skyfield.constants import tau def dots(v, u): """Given one or more vectors in `v` and `u`, return their dot products. This works whether `v` and `u` each have the shape ``(3,)``, or whether they are each whole arrays of corresponding x, y, and ...
from __future__ import unicode_literals import sys import types PY3 = sys.version_info[0] == 3 if PY3: # pragma: no cover text_type = str byte_type = bytes import io StringIO = io.BytesIO basestring = (str, bytes) class BaseClass(object): def __repr__(self): return self....
""" This module has the mock object definitions used to hold reference geometry for the GEOS and GDAL tests. """ import json import os from django.utils.functional import cached_property # Path where reference test data is located. TEST_DATA = os.path.join(os.path.dirname(__file__), 'data') def tuplize(seq): "T...
# # test_codecencodings_kr.py # Codec encoding tests for ROK encodings. # from test import support from test import multibytecodec_support import unittest class Test_CP949(multibytecodec_support.TestBase, unittest.TestCase): encoding = 'cp949' tstring = multibytecodec_support.load_teststring('cp949') co...
"""Module for cloud ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os # pylint: disable=line-too-long,wildcard-import,g-import-not-at-top from tensorflow.contrib.cloud.python.ops.bigquery_reader_ops import * from tensorflow.contrib.cloud.py...
from __future__ import unicode_literals import frappe import re def execute(): """Fix relative urls for image src="files/" to src="/files/" in DocTypes with text editor fields""" doctypes_with_text_fields = frappe.get_all("DocField", fields=["parent", "fieldname"], filters={"fieldtype": "Text Editor"}) done = []...
from grid.cell import Cell from grid.vertex import Vertex from grid.triangle import Triangle import numpy import matplotlib.pyplot as plt class Mesh(object): ''' Description: (Quad) Mesh object Attributes: bounding_box: [xmin, xmax, ymin, ymax] children: Cell, list of cel...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from textwrap import dedent from pants.backend.codegen.antlr.java.java_antlr_library import JavaAntlrLibrary from pants.build_graph.build_file_aliases import BuildFil...
import argparse import json import os import shutil def main(args): data_manager_entry = {} data_manager_entry['value'] = args.database.lower() data_manager_entry['name'] = args.database data_manager_entry['path'] = '.' data_manager_json = dict(data_tables=dict(kraken_databases=data_manager_entry)...
"""Unit tests for shp. """ import os import tempfile from nose import SkipTest from nose.tools import assert_equal import networkx as nx class TestShp(object): @classmethod def setupClass(cls): global ogr try: from osgeo import ogr except ImportError: raise Sk...
''' III. You have the following four lines from 'show ip bgp': entry1 = "* 1.0.192.0/18 157.130.10.233 0 701 38040 9737 i" entry2 = "* 1.1.1.0/24 157.130.10.233 0 701 1299 15169 i" entry3 = "* 1.1.42.0/24 157.130.10.233 0 701 9505 17408 2.1465 i" entry4 = "* 1.0.192.0/19 157.130.10.233 ...
# Work isValidSolution() into stage 1 not stage 0... May not work because I need to know which blue_paths are a valid start -- which involves doing all the work anyways. from collections import deque from time import time class Path(): def __init__(self, path): if isinstance(path, list): self.path = path ...
from django import forms from django.forms.formsets import BaseFormSet, DELETION_FIELD_NAME from django.forms.util import ErrorDict, ErrorList from django.forms.models import modelform_factory, inlineformset_factory, modelformset_factory, BaseModelFormSet from django.test import TestCase from models import User, UserS...
""" ===================================================== Optimization and root finding (:mod:`scipy.optimize`) ===================================================== .. currentmodule:: scipy.optimize Optimization ============ Local Optimization ------------------ .. autosummary:: :toctree: generated/ minimiz...
"""BibIndexFilenameTokenizer: 'tokenizes' finds file names. Tokenizer is adapted to work with bibfield and its get_record function. """ from invenio.modules.indexer.tokenizers.BibIndexRecJsonTokenizer import BibIndexRecJsonTokenizer class BibIndexFilenameTokenizer(BibIndexRecJsonTokenizer): """ Token...
from sys import version_info from pyflakes import messages as m from pyflakes.test import harness class Test(harness.Test): def test_unusedImport(self): self.flakes('import fu, bar', m.UnusedImport, m.UnusedImport) self.flakes('from baz import fu, bar', m.UnusedImport, m.UnusedImport) def te...
import argparse, os, random from generator.parser import parse_types, parse_cards from generator.utils import get_image_size from PIL import Image def generate(): parser = argparse.ArgumentParser( description='Generate game cards.', formatter_class=argparse.ArgumentDefaultsHelpFormatter ) ...
# Since Mon Mar 2 17:00:43 CST 2015 """ https://oj.leetcode.com/problems/length-of-last-word/ Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word does not exist, return 0. Note: A word is defined as a character sequen...
from oslo_config import cfg from nova.tests.functional.v3 import test_servers CONF = cfg.CONF CONF.import_opt('osapi_compute_extension', 'nova.api.openstack.compute.extensions') class ServersIpsJsonTest(test_servers.ServersSampleBase): extends_name = 'core_only' sample_dir = 'server-ips' ...
#!/usr/bin/python import os, logging, pysam, vcf def open_new_vcf(new_vcf_name): vcf_out_reader = vcf.Reader(open(new_vcf_name, 'r')) vcf_out_writer = vcf.Writer(open(new_vcf_name, 'w'), vcf_out_reader) return vcf_out_writer def create_tmp_vcf(filter_modus, filename, outdir, vcf_path, variant, variant_...
from __future__ import unicode_literals from functools import total_ordering from django.contrib.gis.geos import ( LinearRing, LineString, Point, Polygon, fromstr, ) from django.utils import six from django.utils.encoding import python_2_unicode_compatible from django.utils.html import html_safe @html_safe @pyt...
#!/usr/bin/python # This is a simple example showing how you can send 2 button events # to XBMC in a queued fashion to shut it down. # Queued button events are not repeatable. # The basic idea is to create single packets and shoot them to XBMC # The provided library implements some of the support commands and # take...
# -*- coding: utf-8 -*- import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class TwoSharedCom(SimpleHoster): __name__ = "TwoSharedCom" __type__ = "hoster" __version__ = "0.14" __status__ = "testing" __pattern__ = r'http://(?:www\.)?2shared\.com/(accou...
# part of JPype1; author Martin K. Scherer; 2014 try: import unittest2 as unittest except ImportError: import unittest import mock from jpype._jvmfinder import * from jpype._linux import * from jpype._darwin import * import sys class JVMFinderTest(unittest.TestCase): """ test some methods to obtain a...
# -*- encoding: utf-8 -*- from app import app from flask import Flask, render_template, jsonify import pandas as pd import makerlabs.fablabs_io as fio from werkzeug.routing import Rule # import global variables for Z2N from .scripts.app_vars import title, metas, description, subtitle, version, authors, license, sta...
"""An implementation of the Zephyr Abstract Syntax Definition Language. See http://asdl.sourceforge.net/ and http://www.cs.princeton.edu/~danwang/Papers/dsl97/dsl97-abstract.html. Only supports top level module decl, not view. I'm guessing that view is intended to support the browser and I'm not interested in the br...
""" Scrapy Item See documentation in docs/topics/item.rst """ from pprint import pformat from collections import MutableMapping from abc import ABCMeta import six from scrapy.utils.trackref import object_ref class BaseItem(object_ref): """Base class for all scraped items.""" pass class Field(dict): ...
from openerp.osv import fields, osv class mrp_workcenter_load(osv.osv_memory): _name = 'mrp.workcenter.load' _description = 'Work Center Load' _columns = { 'time_unit': fields.selection([('day', 'Day by day'),('week', 'Per week'),('month', 'Per month')],'Type of period', required=True), 'm...
#!/usr/bin/env python import os import shutil import glob import time import sys import subprocess import string from optparse import OptionParser, make_option SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) PKG_NAME = os.path.basename(SCRIPT_DIR) PARAMETERS = None #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=...
"""Self-test for cipher modules""" __revision__ = "$Id$" def get_tests(config={}): tests = [] from Crypto.SelfTest.Cipher import test_AES; tests += test_AES.get_tests(config=config) from Crypto.SelfTest.Cipher import test_ARC2; tests += test_ARC2.get_tests(config=config) from Crypto.SelfTest....
"""Support for showing values from Dweet.io.""" from datetime import timedelta import json import logging import dweepy import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( CONF_DEVICE, CONF_NAME, CONF_UNIT_OF_MEASUREMENT, CONF_VALUE_TE...
"""This module provides a threaded queue for lint requests.""" from queue import Queue, Empty import threading import traceback import time from . import persist, util class Daemon: """ This class provides a threaded queue that dispatches lints. The following operations can be added to the queue: ...
# -*- coding: utf-8 -*- from __future__ import print_function from argparse import Action import keyword import sys import dj_database_url from .data import DRIVERS class DbAction(Action): def __call__(self, parser, namespace, values, option_string): parsed = dj_database_url.parse(values) if pa...
#!/usr/bin/env python3 import sys import psycopg2 import config SELECT_ARTIST_RELATIONS_QUERY = ''' SELECT count, arr.artist_0, a0.name AS artist_name_0, arr.artist_1, a1.name AS artist_name_1 FROM relations.artist_artist_relations arr JOIN artist a0 ON arr.artist_0 = a0.id JOIN artist a1 ON a...
# -*- coding: utf-8 -*- ''' Exodus Add-on Copyright (C) 2016 Exodus This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any l...
from openerp.osv import fields, osv class knowledge_config_settings(osv.osv_memory): _name = 'knowledge.config.settings' _inherit = 'res.config.settings' _columns = { 'module_document': fields.boolean('Manage documents', help='Document indexation, full text search of attachements.\n' ...
""" Tests for source4/dsdb/samdb/ldb_modules/password_hash.c These tests need to be run in an environment in which io->ac->gpg_key_ids != NULL, so that the gpg supplemental credentials are generated. The functional level needs to be >= 2008 so that the kerberos newer keys are generated. """ from samba.tests.password_...
import os import sys import unittest from appengine_url_fetcher import AppEngineUrlFetcher from fake_fetchers import ConfigureFakeFetchers from file_system import FileNotFoundError from rietveld_patcher import RietveldPatcher from svn_constants import EXTENSIONS_PATH import url_constants class RietveldPatcherTest(unit...
from django.core import urlresolvers from django.contrib.sitemaps import Sitemap class GeoRSSSitemap(Sitemap): """ A minimal hook to produce sitemaps for GeoRSS feeds. """ def __init__(self, feed_dict, slug_dict=None): """ This sitemap object initializes on a feed dictionary (as would b...
from json import loads from unittest import TestCase from tapioca.spec import SwaggerSpecification, APISpecification, \ Resource, Path, Method, Param class SwaggerGenerationTestCase(TestCase): def apply_generation(self, api, resource=None): result = SwaggerSpecification(api).generate(resource) ...
""" ======================== Random Number Generation ======================== ==================== ========================================================= Utility functions ============================================================================== random_sample Uniformly distributed floats over ``[0, 1)`...
from __future__ import absolute_import from django.core.urlresolvers import reverse from exam import fixture from sentry.models import Organization from sentry.testutils import APITestCase class OrganizationsListTest(APITestCase): @fixture def path(self): return reverse('sentry-api-0-organizations')...
# -*- coding: utf-8 -*- # This is a management command, rather than a migration script, for two primary reasons: # 1. It makes no changes to database structure (e.g. AlterField), only database content. # 2. It may need to be ran more than once, as it skips failed registrations. from __future__ import unicode_liter...
import sys import os import pyoppai def print_pp(acc, pp, aim_pp, speed_pp, acc_pp): print( "\n%.17g aim\n%.17g speed\n%.17g acc\n%.17g pp\nfor %.17g%%" % (aim_pp, speed_pp, acc_pp, pp, acc) ) def print_diff(stars, aim, speed): print( "\n%.17g stars\n%.17g aim stars\n%.17g spee...
"""The qmake plugin is useful for building qmake-based parts. These are projects that are built using .pro files. This plugin uses the common plugin keywords as well as those for "sources". For more information check the 'plugins' topic for the former and the 'sources' topic for the latter. Additionally, this plugin...
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.connection import Connection from ansible.module_utils.network.ios.providers import providers from ansible.module_utils._text import to_text class NetworkModule(AnsibleModule): fail_on_missing_provider = True def __init__(self, c...
# -*- coding: utf-8 -*- # Scrapy settings for scrape_dogs project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # http://doc.scrapy.org/en/latest/topics/settings.html # http://scrapy.readthedocs.org/en/la...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Script to migrate addongithubusersettings and create and attach addongithuboauthsettings. Log: Executed on production by SL on 2014-10-05 at 23:11 EST. 269 AddonGithubUserSettings records were successfully migrated. 3 records with invalidated credentials were s...
""" Authentication backend classes for Desktop. These classes should implement the interface described at: http://docs.djangoproject.com/en/1.0/topics/auth/#writing-an-authentication-backend In addition, the User classes they return must support: - get_groups() (returns a list of strings) - get_home_directory() (...
''' example gladevcp handler class to start your own no persistence support ''' import glib class HandlerClass: def on_button_press(self,widget,data=None): print "on_button_press" def on_destroy(self,obj,data=None): print "on_destroy" def _on_timer_tick(self,userdata=None): ...
import plyvel import ast import hashlib import os import sys from processor import print_log, logger from utils import bc_address_to_hash_160, hash_160_to_pubkey_address, hex_to_int, int_to_hex, Hash global GENESIS_HASH GENESIS_HASH = '0000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f' """ Patricia ...
from lxml import etree from tempest.common.rest_client import RestClientXML from tempest import exceptions from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common impor...
#!-*- coding:utf-8 -*- __author__= 'huafeng' import re import sys from urlparse import urlparse def format_str(unformat_str, split_by=":"): """ :arg unformat_str:待格式化字符串,一般为Request Header或者Post Parameters split_by: key,value切割符 :return 字典格式的参数 格式化""" header_kv_param_list ...
#!/usr/bin/env python2 ############################################################################### # ------------------------- Description --------------------------------------- ############################################################################### # This script will be used to generate daily met fields ...
"""Middleware classes for third_party_auth.""" from social_django.middleware import SocialAuthExceptionMiddleware from . import pipeline class ExceptionMiddleware(SocialAuthExceptionMiddleware): """Custom middleware that handles conditional redirection.""" def get_redirect_uri(self, request, exception): ...
#!/usr/bin/env python import argparse import numpy as np import numpy.ma as ma import h5py import qusp import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt # def sum_chunk(x, chunk_size, axis=-1): # shape = x.shape # if axis < 0: # axis += x.ndim # shape = shape[:axis] + (-1, ...
from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist from django.template import resolve_variable from django.core.cache import cache from django.utils.encoding import force_unicode from django.utils.http import urlquote from django.utils.hashcompat import md5_constructor ...
from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import date_diff, getdate, formatdate, cint from frappe.model.document import Document from erpnext.hr.utils import get_holidays_for_employee class PayrollPeriod(Document): def validate(self): self.validate_dates() self.v...
from django.urls import path, register_converter from django.urls.converters import StringConverter from django.views.generic import RedirectView from . import views class EmailConverter(StringConverter): regex = r"[\w.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}" class UsernameConverter(StringConverter): regex = r...
#!/usr/bin/env python # This example demonstrates the use of vtk3DSImporter. # vtk3DSImporter is used to load 3D Studio files. Unlike writers, # importers can load scenes (data as well as lights, cameras, actors # etc.). Importers will either generate an instance of vtkRenderWindow # and/or vtkRenderer or will use th...
from metrics import power from telemetry.core.platform import tracing_category_filter from telemetry.core.platform import tracing_options from telemetry.page import page_test from telemetry.timeline import model from telemetry.value import scalar class ImageDecoding(page_test.PageTest): def __init__(self): sup...
from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import compat_str from ..utils import ( ExtractorError, int_or_none, parse_duration, try_get, unified_timestamp, urlencode_postdata, ) class MedialaanIE(InfoExtractor): _VALID_URL = r'''(?x)...