content
string
#!/usr/bin/env python # -*- coding: utf-8 -*- from future.standard_library import install_aliases install_aliases() import os import re from operator import attrgetter from urllib.request import urlretrieve from io import open from PIL import Image from jinja2 import Environment, FileSystemLoader, StrictUndefined f...
from . import ServiceBase from ..exceptions import ServiceError from ..language import language_set, Language from ..subtitles import get_subtitle_path, ResultSubtitle from ..utils import get_keywords, split_keyword from ..videos import Episode, Movie from bs4 import BeautifulSoup import logging import urllib logger ...
import xlwt from datetime import datetime from openerp.osv import orm from openerp.report import report_sxw from openerp.addons.report_xls.report_xls import report_xls from openerp.addons.report_xls.utils import rowcol_to_cell, _render from openerp.tools.translate import translate, _ import logging _logger = logging.ge...
import logging import re import sys logging.basicConfig(format='%(asctime)s %(name)s: %(message)s', level=logging.INFO) logger = logging.getLogger('check-whitespace') CR_RE = re.compile(r'\r') LEADING_WHITESPACE_RE = re.compile(r'\s+') TRAILING_WHITESPACE_RE = re.compile(r'\s+\n\Z') NO_NEWLINE_RE...
#!/usr/bin/env python # encoding:utf-8 import os import sys import requests import MySQLdb from bs4 import BeautifulSoup from bs4 import SoupStrainer from config import * base_url = 'http://download.kaoyan.com' status = [] def get_soup(url, parse_only=None): content = requests.get(url).content return Beau...
# -*- coding: utf-8 -*- """ ################################################################################ # Copyright (c) 2010, Ilgar Mashayev # # E-mail: <EMAIL> # Website: http://github.com/ilgarm/pyzimbra ################################################################################ # This file is part of pyzi...
#! /usr/bin/env python ## ## standard configuration of the FEC HLVDS for the use ## with the pALPIDE with the Padua Proximity board V1 ## import sys import os import SlowControl # slow control code import biasDAC # special code to setup up the voltage biases m = SlowControl.SlowControl(0) # HLVDS FEC (master) # w...
import sys import os import marshal import imp import struct import time import unittest from test import test_support from test.test_importhooks import ImportHooksBaseTestCase, test_src, test_co # some tests can be ran even without zlib try: import zlib except ImportError: zlib = None from zipfile import Zi...
import pickle import math import random def arrow(n): return str(n)+"--> " def isPositive(aNumber): return aNumber > 0 def abs(aNumber): if aNumber >= 0: return aNumber return -aNumber def main2(): """ test two build in high order functions: map and filter functions""" ...
from __future__ import unicode_literals import re from .common import InfoExtractor class IGNIE(InfoExtractor): """ Extractor for some of the IGN sites, like www.ign.com, es.ign.com de.ign.com. Some videos of it.ign.com are also supported """ _VALID_URL = r'https?://.+?\.ign\.com/(?P<type>video...
# -*- coding: utf-8 -*- import base64 from openerp import SUPERUSER_ID from openerp import http from openerp.tools.translate import _ from openerp.http import request from openerp.addons.website.models.website import slug class website_hr_recruitment(http.Controller): @http.route([ '/jobs', '/job...
# pylint: disable-msg=W0611, W0612, W0511,R0201 """Tests suite for maskedArray statistics. :author: Pierre Gerard-Marchant :contact: pierregm_at_uga_dot_edu """ from __future__ import division, print_function, absolute_import __author__ = "Pierre GF Gerard-Marchant ($Author: backtopop $)" import numpy as np import ...
import math import logging import numpy as np logger = logging.getLogger('mne') # one selection here used across mne-python logger.propagate = False # don't propagate (in case of multiple imports) def random_permutation(n_samples, random_state=None): """Helper to emulate the randperm matlab function. It re...
# -*- coding: utf-8 -*- from __future__ import print_function import os import sys import imp import subprocess ## Python 2.6 subprocess.check_output compatibility. Thanks Greg Hewgill! if 'check_output' not in dir(subprocess): def check_output(cmd_args, *args, **kwargs): proc = subprocess.Popen( ...
"""Argument-less script to select what to run on the buildbots.""" import filecmp import os import shutil import subprocess import sys if sys.platform in ['win32', 'cygwin']: EXE_SUFFIX = '.exe' else: EXE_SUFFIX = '' BUILDBOT_DIR = os.path.dirname(os.path.abspath(__file__)) TRUNK_DIR = os.path.dirname(BUILDBO...
from collections import deque import numpy as np import skimage.draw from PIL import Image from qtpy import QtCore from math import sqrt, atan2, cos, sin from .util.cosmics import cosmicsimage class MaskModel(object): def __init__(self, mask_dimension=(2048, 2048)): self.mask_dimension = mask_dimension ...
"""Tests for compression.""" from apitools.base.py import compression from apitools.base.py import gzip import six import unittest2 class CompressionTest(unittest2.TestCase): def setUp(self): # Sample highly compressible data (~50MB). self.sample_data = b'abc' * 16777216 # Stream of the...
from fabric.api import cd, run, env, local, sudo, require from fabric.operations import _prefix_commands, _prefix_env_vars from lib.fabric_helpers import * import os import string env.hosts = ['djtut2.example.com'] env.code_dir = '/srv/www/djtut2' env.virtualenv = '/srv/www/djtut2/.virtualenv' env.code_repo = '<EMAIL...
from __future__ import print_function from color import Coloring from command import PagedCommand class Overview(PagedCommand): common = True helpSummary = "Display overview of unmerged project branches" helpUsage = """ %prog [--current-branch] [<project>...] """ helpDescription = """ The '%prog' command is u...
from datetime import timedelta import json import unittest from urllib.parse import quote_plus from airflow import configuration from airflow.api.common.experimental.trigger_dag import trigger_dag from airflow.models import DagBag, DagModel, DagRun, Pool, TaskInstance from airflow.settings import Session from airflow....
# -*- coding: utf-8 -*- """ jinja2.testsuite.debug ~~~~~~~~~~~~~~~~~~~~~~ Tests the debug system. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import unittest from jinja2.testsuite import JinjaTestCase, filesystem_loader from jinja2 import Environment,...
try: from cs import CloudStack, CloudStackException, read_config has_lib_cs = True except ImportError: has_lib_cs = False # import cloudstack common from ansible.module_utils.cloudstack import * class AnsibleCloudStackLBRule(AnsibleCloudStack): def __init__(self, module): super(AnsibleCloudSt...
"""Serializer/Deserializer objects for usage with SQLAlchemy query structures, allowing "contextual" deserialization. Any SQLAlchemy query structure, either based on sqlalchemy.sql.* or sqlalchemy.orm.* can be used. The mappers, Tables, Columns, Session etc. which are referenced by the structure are not persisted in ...
# -*- coding: utf-8 -*- # __ # /__) _ _ _ _ _/ _ # / ( (- (/ (/ (- _) / _) # / """ requests HTTP library ~~~~~~~~~~~~~~~~~~~~~ Requests is an HTTP library, written in Python, for human beings. Basic GET usage: >>> import requests >>> r = requests.get('https://www.python.org') >>> ...
from alembic.operations import ops from alembic.util import Dispatcher from alembic.util import rev_id as new_rev_id from neutron.db.migration import cli _ec_dispatcher = Dispatcher() def process_revision_directives(context, revision, directives): if cli._use_separate_migration_branches(context.config): ...
from __future__ import division import pytest import os from bayesian.gaussian import MeansVector, CovarianceMatrix from bayesian.gaussian_bayesian_network import * from bayesian.examples.gaussian_bayesian_networks.river import ( f_a, f_b, f_c, f_d) def pytest_funcarg__river_graph(request): g = build_graph(...
from galaxy.visualization.data_providers.basic import ColumnDataProvider from galaxy.visualization.data_providers import genome from galaxy.model import NoConverterException from galaxy.visualization.data_providers.phyloviz import PhylovizDataProvider from galaxy.datatypes.tabular import Tabular, Vcf from galaxy.dataty...
"""Check by which hostblock list a host was blocked.""" import sys import io import os import os.path import configparser import urllib.request from PyQt5.QtCore import QStandardPaths sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir)) from qutebrowser.browser import adblock def main(): """C...
""" ============================================== Feature agglomeration vs. univariate selection ============================================== This example compares 2 dimensionality reduction strategies: - univariate feature selection with Anova - feature agglomeration with Ward hierarchical clustering Both metho...
import autocomplete_light from geonode.maps.models import Map from geonode.base.forms import ResourceBaseForm class MapForm(ResourceBaseForm): class Meta(ResourceBaseForm.Meta): model = Map exclude = ResourceBaseForm.Meta.exclude + ( 'zoom', 'projection', 'cen...
ANSIBLE_METADATA = { 'status': ['preview'], 'supported_by': 'community', 'metadata_version': '1.0' } from ansible.module_utils.f5_utils import ( AnsibleF5Client, AnsibleF5Parameters, HAS_F5SDK, F5ModuleError, iControlUnexpectedHTTPError ) class Parameters(AnsibleF5Parameters): api...
from __future__ import absolute_import, unicode_literals from django.apps import apps from django.core.urlresolvers import reverse from django.http import Http404 from django.shortcuts import get_object_or_404, redirect, render from django.utils.text import capfirst from django.utils.translation import ugettext as _ ...
import errno import logging import os import blivet import blivet.formats import blivet.formats.fs import blivet.size from blivet.devices import LVMVolumeGroupDevice from blivet.devices import LVMThinPoolDevice from blivet.devices import LVMLogicalVolumeDevice from blivet.devices import LVMThinLogicalVolumeDevice from...
# -*- coding: utf-8 -*- """ jinja2.testsuite.security ~~~~~~~~~~~~~~~~~~~~~~~~~ Checks the sandbox and other security features. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import pytest from jinja2 import Environment from jinja2.sandbox import Sandboxe...
"""Add adult panels and tables Revision ID: e1d3c11eb9dd Revises: 1f862611ba04 Create Date: 2018-06-21 23:06:32.678061 """ # revision identifiers, used by Alembic. revision = 'e1d3c11eb9dd' down_revision = '1f862611ba04' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa try: ...
from django import forms from django.db.models import Q from django.utils.translation import ugettext_lazy as _ from datetime import date from tagging.models import Tag from models import (Vote, Bill, KnessetProposal, BillBudgetEstimation, CONVERT_TO_DISCUSSION_HEADERS) from vote_choices import (ORD...
"""HTTP endpoints for interacting with refunds.""" import logging from django.contrib.auth import get_user_model from django.db import transaction from django.utils.decorators import method_decorator from oscar.core.loading import get_model from rest_framework import generics, status from rest_framework.exceptions i...
""" A pure python (slow) implementation of rijndael with a decent interface To include - from rijndael import rijndael To do a key setup - r = rijndael(key, block_size = 16) key must be a string of length 16, 24, or 32 blocksize must be 16, 24, or 32. Default is 16 To use - ciphertext = r.encrypt(plaintext) plai...
#!/usr/bin/env python # -*- coding: utf8 -*- import wx import sys, os sys.path.append(os.getcwd()) import library.constants as CO from library.utils import utils as UT from library.client.ABCAppInterface import ABCAppInterface class ApplicationList(wx.Frame, ABCAppInterface): def __init__(self, parent, id, tit...
"Test InteractiveConsole and InteractiveInterpreter from code module" import sys import unittest from contextlib import ExitStack from unittest import mock from test import support code = support.import_module('code') class TestInteractiveConsole(unittest.TestCase): def setUp(self): self.console = code....
""" mbed SDK Copyright (c) 2011-2013 ARM Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wr...
import os from optparse import make_option from django.core.management.base import BaseCommand, CommandError from django.core.management.color import color_style from django.template.base import add_to_builtins from django.template.loaders.filesystem import Loader from django_extensions.utils import validatingtemplatet...
import re, unicodedata, sys if sys.maxunicode == 65535: raise RuntimeError("need UCS-4 Python") def gen_category(cats): for i in range(0, 0x110000): if unicodedata.category(chr(i)) in cats: yield(i) def gen_bidirectional(cats): for i in range(0, 0x110000): if unicodedata.bidir...
import logging from django.utils.translation import ugettext_lazy as _ from horizon import tabs from openstack_dashboard.api import sahara as saharaclient LOG = logging.getLogger(__name__) class GeneralTab(tabs.Tab): name = _("General Info") slug = "job_details_tab" template_name = ("project/data_proc...
import datetime from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.test import TestCase from .testmodels import FieldsWithOptionsModel, OrderedModel, \ SelfReferenceModel class NonReturnSetsTest(TestCase): floats = [5.3, 2.6, 9.1, 1.58, 2.4] emails = ['<EMAIL>', '...
from gnuradio import gr, blks2 from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser class my_top_block(gr.top_block): def __init__(self): gr.top_block.__init__(self) parser = OptionParser(option_class=eng_option) parser.add_option("-I", "...
from django.core.checks.caches import E001 from django.test import SimpleTestCase from django.test.utils import override_settings class CheckCacheSettingsAppDirsTest(SimpleTestCase): VALID_CACHES_CONFIGURATION = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', ...
DATE_FORMAT = r'j \de N \de Y' TIME_FORMAT = 'H:i' DATETIME_FORMAT = r'j \de N \de Y à\s H:i' YEAR_MONTH_FORMAT = r'F \de Y' MONTH_DAY_FORMAT = r'j \de F' SHORT_DATE_FORMAT = 'd/m/Y' SHORT_DATETIME_FORMAT = 'd/m/Y H:i' FIRST_DAY_OF_WEEK = 0 # Sunday # The *_INPUT_FORMATS strings use the Python strftime format syntax,...
#!/usr/bin/env python # encoding: utf-8 # Baptiste Lepilleur, 2009 from __future__ import print_function from dircache import listdir import re import fnmatch import os.path # These fnmatch expressions are used by default to prune the directory tree # while doing the recursive traversal in the glob_impl method of gl...
""" This model contains a domain logic for users application. """ from django.apps import apps from django.db.models import Q from django.conf import settings from django.utils.translation import ugettext as _ from easy_thumbnails.files import get_thumbnailer from easy_thumbnails.exceptions import InvalidImageFormatE...
import json import requests # To add # - Identity Delegation # - Streams (in dev by app.net) # - Filters (in dev by app.net) class Appdotnet: ''' Once access has been given, you don't have to pass through the client_id, client_secret, redirect_uri, or scope. These are just to get the authentication token....
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException...
import github.GithubObject class Permissions(github.GithubObject.NonCompletableGithubObject): """ This class represents Permissionss as returned for example by http://developer.github.com/v3/todo """ @property def admin(self): """ :type: bool """ return self._admin...
import json from django.core.urlresolvers import reverse from django.test import TestCase from core.factories.core_factories import MatchdayFactory, FinanceFactory from users.models import OFMUser class OFMFinancesViewTestCase(TestCase): def setUp(self): self.matchday = MatchdayFactory.create() ...
from __future__ import absolute_import import time import os from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout, AlreadyLocked) class SymlinkLockFile(LockBase): """Lock access to a file using symlink(2).""" def __init__(self, path, threaded=True, timeout=None): # s...
# -*- coding: utf-8 -*- from openerp import SUPERUSER_ID from openerp.addons.web import http from openerp.addons.web.http import request from openerp.addons.website_sale.controllers.main import website_sale class website_sale_options(website_sale): @http.route(['/shop/product/<model("product.template"):product>'...
import sys sys.path.insert(0, ".") import unittest from coalib.bearlib.abstractions.SectionCreatable import SectionCreatable from coalib.settings.Section import Section, Setting class TestObject(SectionCreatable): def __init__(self, setting_one: int, raw_setting, ...
""" # Definition for a Node. class Node(object): def __init__(self, val=0, left=None, right=None, next=None): self.val = val self.left = left self.right = right self.next = next """ # 核心思路 # 递归处理,因为题目已经说过递归调用栈不算extra space # 对于每一个节点,首先找到这个节点的不为空的,最靠右的孩子节点,作为下一层连接操作的左端 # 然后在这一层往右扫描,找...
from django import template register = template.Library() @register.inclusion_tag('admin/prepopulated_fields_js.html', takes_context=True) def prepopulated_fields_js(context): """ Creates a list of prepopulated_fields that should render Javascript for the prepopulated fields for both the admin form and in...
import time from datetime import timedelta import psycopg2 import psycopg2.extras from testutils import unittest, ConnectingTestCase, skip_before_postgres from testutils import skip_if_no_namedtuple class ExtrasDictCursorTests(ConnectingTestCase): """Test if DictCursor extension class works.""" def setUp(sel...
""" This is code that I find I use a LOT while debugging or analyzing. """ import audiosegment import math import matplotlib.pyplot as plt import numpy as np import os import sys ################################################# #### These are the parameters I have been using # #######################################...
import fsui from launcher.cd_manager import CDManager from launcher.floppy_manager import FloppyManager from launcher.i18n import gettext from launcher.option import Option from launcher.ui.behaviors.platformbehavior import ( AMIGA_PLATFORMS, CDEnableBehavior, FloppyEnableBehavior, ) from launcher.ui.floppy...
""" PLA This is a partial implementation of the Berkeley PLA format. See extension/espresso/html/espresso.5.html for details. Exceptions: Error Interface Functions: parse """ # Disable 'no-name-in-module', b/c pylint can't look into C extensions # pylint: disable=E0611 import re from pyeda.boolalg.espre...
from django.conf.urls import patterns from django.conf.urls import url from openstack_dashboard.dashboards.project.images.images import views VIEWS_MOD = 'openstack_dashboard.dashboards.project.images.images.views' urlpatterns = patterns( VIEWS_MOD, url(r'^create/$', views.CreateView.as_view(), name='creat...
#! /usr/bin/env python import os import itertools as it import sys import textwrap #import gtk import numpy as np import sympy as sy import sympy.stats import odespy as ode import matplotlib import matplotlib.pyplot as plt import sympy.physics.mechanics as mech """ Pretty plotting code. """ _all_spines = ["top", "r...
import sys import os import unittest from array import array from weakref import proxy import io import _pyio as pyio from test.support import TESTFN, run_unittest from collections import UserList class AutoFileTests: # file tests for which a test file is automatically set up def setUp(self): self.f...
from __future__ import absolute_import from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.tests.utils import HAS_SPATIAL_DB, mysql, oracle, no_mysql, no_oracle, no_spatialite from django.test import TestCase from django.utils.unittest import skipUnless if HAS_GEOS: from django.contrib.gis.db.mod...
# -*- coding: utf-8 -*- """ The idea of MultilingualManager is taken from django-linguo by Zach Mathew https://github.com/zmathew/django-linguo """ from django.db import models from django.db.models import FieldDoesNotExist from django.db.models.fields.related import RelatedField, RelatedObject from django.db.models.s...
import datetime import json import os import random import re import string import unittest from mock import patch, Mock from six import string_types import payjp NOW = datetime.datetime.now() DUMMY_CARD = { 'number': '4242424242424242', 'exp_month': NOW.month, 'exp_year': NOW.year + 4 } DUMMY_CHARGE ...
# -*- coding: utf-8 -*- """ Message module holds all methods to work with message files """ import sys import os import array from struct import pack from struct import unpack import uuid import hashlib import keymanagement import yaml import ownbase32 from util import hashSum L2RHEADER = bytearray([222, 210, 7, 163, ...
from __future__ import unicode_literals import os import sys import tempfile from os.path import abspath, dirname, isabs, join, normcase, normpath, sep from django.core.exceptions import SuspiciousFileOperation from django.utils import six from django.utils.encoding import force_text if six.PY2: fs_encoding = sy...
# 2014-12-17 # build by qianqians # deletenote def deletenote(filestr): genfilestr = [] count = 0 errornote = "" for i in xrange(len(filestr)): str = filestr[i] while(1): if count == 1: indexafter = str.find("*/") if indexafter is not -1: ...
import logging from django.contrib import messages from django.contrib.auth.decorators import login_required, permission_required from django.shortcuts import render, redirect from allianceauth.services.forms import ServicePasswordForm from .manager import SmfManager from .models import SmfUser from .tasks import Smf...
import glob import os import sys # Number of arguments N = len(sys.argv) if N < 3: print "make_docs.py src_root destination_root" sys.exit(1) src_dir = sys.argv[1] + "/docs/source" build_root = sys.argv[2] cache_dir = build_root + "/doctrees" html_dir = build_root + "/html" # Called from Command Line if N...
""" SoftLayer.sshkey ~~~~~~~~~~~~~~~~ SSH Key Manager/helpers :license: MIT, see LICENSE for more details. """ from SoftLayer import utils class SshKeyManager(utils.IdentifierMixin, object): """Manages account SSH keys. :param SoftLayer.API.Client client: an API client instance """ ...
""" Test the partitions and partitions service """ import json from django.conf import settings import django.test from mock import patch from nose.plugins.attrib import attr from unittest import skipUnless from courseware.masquerade import handle_ajax, setup_masquerade from courseware.tests.test_masquerade import S...
#!/usr/bin/env python from DIRAC.Core.Base import Script Script.setUsageMessage( """ Get status of the available Storage Elements Usage: %s [<options>] """ % Script.scriptName ) Script.parseCommandLine() import DIRAC from DIRAC import gConfig,gLogger from DIRAC.Resour...
""" Trigger plugin that triggers in a configurable interval. """ from __future__ import unicode_literals import logging import threading import time from spreads.config import OptionTemplate from spreads.plugin import HookPlugin, TriggerHooksMixin logger = logging.getLogger('spreadsplug.intervaltrigger') class In...
""" Author: Alex Alemi Some utility routines for python players """ import logging import socket import os import sys from random import randrange ship_sizes = {"A": 5, "B": 4, "D": 3, "S": 3, "P": 2} def board_str(board): """ Return the many lined string for a board """ boardstr = "" for i in xrange(10):...
from selenium.webdriver import Chrome def test_network_conditions_emulation(): driver = Chrome() driver.set_network_conditions( offline=False, latency=56, # additional latency (ms) throughput=789) conditions = driver.get_network_conditions() assert conditions['offline'] is Fal...
from datetime import datetime from openerp import pooler from openerp.report import report_sxw from openerp.tools.translate import _ from .common_partner_balance_reports \ import CommonPartnerBalanceReportHeaderWebkit from .webkit_parser_header_fix import HeaderFooterTextWebKitParser class PartnerBalanceWebkit(r...
from operator import itemgetter from django.contrib.auth.decorators import login_required from django.contrib import messages from django.shortcuts import render from itkufs.common.decorators import limit_to_group, limit_to_owner from itkufs.accounting.models import Account, Group @login_required @limit_to_group de...
""" .. dialect:: oracle+zxjdbc :name: zxJDBC for Jython :dbapi: zxjdbc :connectstring: oracle+zxjdbc://user:pass@host/dbname :driverurl: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html. """ import decimal import re from sqlalchemy import sql, types as sqltypes, util from sqlal...
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> file Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> file NameError: name 'file' is not defined >>> RESTART: Z:\Coding Cl...
# coding: utf-8 from argparse import ArgumentParser, FileType from contextlib import closing from io import open as copen from json import dumps from math import ceil import re from os.path import basename, dirname, exists, join from struct import unpack from subprocess import Popen from sys import platform, prefix, ...
import os import shutil import fixtures from tempest.cmd import init from tempest.tests import base class TestTempestInit(base.TestCase): def test_generate_testr_conf(self): # Create fake conf dir conf_dir = self.useFixture(fixtures.TempDir()) init_cmd = init.TempestInit(None, None) ...
"""Updates the various BadMessage enums in histograms.xml file with values read from the corresponding bad_message.h files. If the file was pretty-printed, the updated version is pretty-printed too. """ import sys from update_histogram_enum import UpdateHistogramEnum if __name__ == '__main__': if len(sys.argv) > ...
''' Clipboard ========= Core class for accessing the Clipboard. If we are not able to access the system clipboard, a fake one will be used. Usage example: .. code-block:: kv #:import Clipboard kivy.core.clipboard.Clipboard Button: on_release: self.text = Clipboard.paste() Cl...
""" Grady Williams January 28, 2013 This module provides functions for displaying graphs of the Riemann-Theta function. There are 12 different graphs that can be generated, 10 of them correspond to the graphics shown on the Digital Library of Mathematical Functions page for Riemann Theta (dlmf.nist.gov/21.4) and the ...
from bokeh.io import vplot from bokeh.models import ColumnDataSource, DataRange1d, Plot, LinearAxis, Grid, Circle, HoverTool, BoxSelectTool from bokeh.models.widgets import DataTable, TableColumn, StringFormatter, NumberFormatter, StringEditor, IntEditor, NumberEditor, SelectEditor from bokeh.embed import file_html fro...
from ctypes import c_char_p, c_int, c_void_p, POINTER from django.contrib.gis.gdal.libgdal import lgdal, std_call from django.contrib.gis.gdal.prototypes.generation import \ const_string_output, double_output, int_output, \ srs_output, string_output, void_output ## Shortcut generation for routines with known p...
from urllib import urlencode import six from requests_oauthlib import OAuth1 from social.backends.oauth import BaseOAuth2 class NKOAuth2(BaseOAuth2): """NK OAuth authentication backend""" name = 'nk' AUTHORIZATION_URL = 'https://nk.pl/oauth2/login' ACCESS_TOKEN_URL = 'https://nk.pl/oauth2/token' ...
import urlparse import urllib class URLPath: def __init__(self, scheme='', netloc='localhost', path='', query='', fragment=''): self.scheme = scheme or 'http' self.netloc = netloc self.path = path or '/' self.query = query self.fragment = fragment _qpat...
from __future__ import print_function import json import struct import re import base64 import httplib import sys settings = {} class BitcoinRPC: def __init__(self, host, port, username, password): authpair = "%s:%s" % (username, password) self.authhdr = "Basic %s" % (base64.b64encode(authpair)) self.conn = ht...
""" =========================================================== Plot Ridge coefficients as a function of the regularization =========================================================== Shows the effect of collinearity in the coefficients of an estimator. .. currentmodule:: sklearn.linear_model :class:`Ridge` Regressi...
import random from fractions import gcd def RSA(plainText): # Generate Key # p, q is 2 random large prime (512 bit) p = generateLargePrime(512) q = generateLargePrime(512) while p == q: q = generateLargePrime(512) n = p * q totientN = (p - 1) * (q - 1) # PublicKey = random in (...
import logging.config logging.getLogger('scapy.runtime').setLevel(logging.ERROR) from threading import Thread from scapy.all import * import time logger = logging.getLogger(name='elchicodepython.honeycheck') def exec_array( array, **kwargs): for object, method in array: method(object, **kwargs) # == ob...
from __future__ import absolute_import from __future__ import division import itertools import sys from signal import signal, SIGINT, default_int_handler import time import contextlib import logging from pip.compat import WINDOWS from pip.utils import format_size from pip.utils.logging import get_indentation from pip...
"""Test case base for testing proto operations.""" # Python3 preparedness imports. from __future__ import absolute_import from __future__ import division from __future__ import print_function import ctypes as ct import os from tensorflow.core.framework import types_pb2 from tensorflow.python.kernel_tests.proto impor...
import logging import os from urllib import getproxies from urlparse import urlparse log = logging.getLogger(__name__) def set_no_proxy_settings(): """ Starting with Agent 5.0.0, there should always be a local forwarder running and all payloads should go through it. So we should make sure that we pas...