content stringlengths 4 20k |
|---|
from matplotlib.collections import LineCollection
import matplotlib.pyplot as plt
import numpy as np
from bokeh import mpl
from bokeh.plotting import output_file, show
# Simulate a series of ocean current profiles, successively
# offset by 0.1 m/s so that they form what is sometimes called
# a "waterfall" plot or a "... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import os
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._... |
import unittest
import ctypes
try:
ctypes.c_wchar
except AttributeError:
pass
else:
import _ctypes_test
class UnicodeTestCase(unittest.TestCase):
def test_wcslen(self):
dll = ctypes.CDLL(_ctypes_test.__file__)
wcslen = dll.my_wcslen
wcslen.argtypes = [ctypes... |
"""
MicroPython Remote - Interaction and automation tool for MicroPython
MIT license; Copyright (c) 2019-2021 Damien P. George
This program provides a set of utilities to interact with and automate a
MicroPython device over a serial connection. Commands supported are:
mpremote -- auto-det... |
import struct
from sulley import blocks, primitives, sex
########################################################################################################################
class dns_hostname (blocks.block):
def __init__ (self, name, request, value, options={}):
blocks.block.__init__(self, nam... |
from robotide import utils
from robotide.spec.iteminfo import LocalVariableInfo
def LocalNamespace(controller, namespace, row=None):
if row is not None: # can be 0!
return LocalRowNamespace(controller, namespace, row)
return LocalMacroNamespace(controller, namespace)
class LocalMacroNamespace(object... |
from numbers import Integral
from eos.const.eos import ModAggregateMode
from eos.const.eos import ModDomain
from eos.const.eos import ModOperator
from eos.util.repr import make_repr_str
from .base import BaseModifier
from .exception import ModificationCalculationError
class DogmaModifier(BaseModifier):
"""Define... |
# -*- coding: utf-8 -*-
"""
jinja2
~~~~~~
Jinja2 is a template engine written in pure Python. It provides a
Django inspired non-XML syntax but supports inline expressions and
an optional sandboxed environment.
Nutshell
--------
Here a small example of a Jinja2 template::
{% ... |
import sys
from osgeo import gdal
def CopyBand(srcband, dstband):
for line in range(srcband.YSize):
line_data = srcband.ReadRaster(0, line, srcband.XSize, 1)
dstband.WriteRaster(0, line, srcband.XSize, 1, line_data,
buf_type=srcband.DataType)
def Usage():
print("... |
import pytest
import numpy as np
from matmodlab2 import *
from testing_utils import *
@pytest.mark.material
@pytest.mark.expansion_model
@pytest.mark.parametrize('itemp', np.random.uniform(0., 100., 1))
@pytest.mark.parametrize('dtemp', np.random.uniform(10., 50., 1))
@pytest.mark.parametrize('alpha', np.random.unifo... |
from . import grammar, token, tokenize
class PgenGrammar(grammar.Grammar):
pass
class ParserGenerator(object):
def __init__(self, filename, stream=None):
close_stream = None
if stream is None:
stream = open(filename)
close_stream = stream.close
self... |
import os
import gettext
import pkg_resources
try:
# First, try to get our version out of PKG-INFO. If we're installed,
# this'll let us find our version without pulling in pbr. After all, if
# we're installed on a system, we're not in a Git-managed source tree, so
# pbr doesn't really buy us anything... |
import pytest
from unittest.mock import patch
from web3 import Web3
from ens.constants import EMPTY_ADDR_HEX
from ens.main import UnauthorizedError
'''
API at: https://github.com/carver/ens.py/issues/2
'''
TEST_ADDRESS = "0x000000000000000000000000000000000000dEaD"
@pytest.mark.parametrize(
'name, full_name, ... |
"""
Python module 'process_NCEI_03_aux.py'
by Matthew Garcia, PhD student
Dept. of Forest and Wildlife Ecology
University of Wisconsin - Madison
<EMAIL>
Copyright (C) 2015-2016 by Matthew Garcia
Licensed Gnu GPL v3; see 'LICENSE_GnuGPLv3.txt' for complete terms
Send questions, bug reports, any related requests to <EMA... |
"""Implements (a subset of) Sun XDR -- eXternal Data Representation.
See: RFC 1014
"""
import struct
from io import BytesIO
__all__ = ["Error", "Packer", "Unpacker", "ConversionError"]
# exceptions
class Error(Exception):
"""Exception class for this module. Use:
except xdrlib.Error as var:
# var h... |
import os
from stream import plugin
LIBRARY_PATHS = {
"Stream Movies": {
"strContent": "movies",
"strScraper": "metadata.themoviedb.org",
"useFolderNames": 0,
"strSettings": """<settings><setting id="RatingS" value="TMDb" /><setting id="TrailerQ" value="No" /><setting id="certprefi... |
'''
Copyright 2013 Cosnita Radu Viorel
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute... |
import atexit
import sys
from .ansitowin32 import AnsiToWin32
orig_stdout = sys.stdout
orig_stderr = sys.stderr
wrapped_stdout = sys.stdout
wrapped_stderr = sys.stderr
atexit_done = False
def reset_all():
AnsiToWin32(orig_stdout).reset_all()
def init(autoreset=False, convert=None, strip=None, wrap=True):
... |
from collections import defaultdict
from .on_set import OnSetPlugin
from .config import Config
from uzbl.arguments import splitquoted, is_quoted
from uzbl.ext import PerInstancePlugin
class ModePlugin(PerInstancePlugin):
CONFIG_SECTION = 'mode'
def __init__(self, uzbl):
super(ModePlugin, self).__ini... |
#!/usr/bin/env python
import io, os, re, sys, subprocess
import hashlib
from scriptCommon import catchPath
from releaseCommon import Version
print(catchPath)
default_path = '../vcpkg/ports/catch2/'
def adjusted_path(path):
return os.path.join(catchPath, path)
def get_hash(path):
BUFF_SIZE = 65536
sha5... |
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import StateData
import CogHQLoader, MintInterior
from toontown.toonbase import ToontownGlobals
from direct.gui import DirectGui
from toontown.toonbase import TTLocalizer
from toontown.toon import Toon
from direct.fsm import State
import CashbotHQExteri... |
data = (
'jjyim', # 0x00
'jjyib', # 0x01
'jjyibs', # 0x02
'jjyis', # 0x03
'jjyiss', # 0x04
'jjying', # 0x05
'jjyij', # 0x06
'jjyic', # 0x07
'jjyik', # 0x08
'jjyit', # 0x09
'jjyip', # 0x0a
'jjyih', # 0x0b
'jji', # 0x0c
'jjig', # 0x0d
'jjigg', # 0x0e
'jjigs', # 0x0f
'jjin',... |
import datetime
from horizon.test import utils
class DummyBackend(object):
_user = utils.ObjDictWrapper(
id="1",
nam='test_user',
email='<EMAIL>',
password='password',
token=utils.ObjDictWrapper(
expires=datetime.datetime.now() + datetime.timedelta(30)),
... |
# -*- coding: utf-8 -*-
"""
Fake payment page for use in acceptance tests.
This view is enabled in the URLs by the feature flag `ENABLE_PAYMENT_FAKE`.
Note that you will still need to configure this view as the payment
processor endpoint in order for the shopping cart to use it:
settings.CC_PROCESSOR['CyberSource... |
# -*- coding: utf-8 -*-
# See the "Code officiel géographique" on the INSEE website <www.insee.fr>.
DEPARTMENT_CHOICES = (
# Metropolitan departments
('01', u'01 - Ain'),
('02', u'02 - Aisne'),
('03', u'03 - Allier'),
('04', u'04 - Alpes-de-Haute-Provence'),
('05', u'05 - Hautes-Alpes'),
(... |
import re
from itertools import islice
from geopy import util, units, format
from core.backports.six import string_types as basestring
class Point(object):
"""
A geodetic point with latitude, longitude, and altitude.
Latitude and longitude are floating point values in degrees.
Altitude is a floati... |
'''
UART (Universal Asynchronous Receiver Transmitter) is a simple serial
communication protocol which allows two devices to talk to each other.
This decoder should work on all "UART-like" async protocols with one
start bit (0), 5-9 databits, an (optional) parity bit, and one or more
stop bits (1), in this order.
It ... |
#!/usr/bin/env python
from setuptools import setup
import loopix
setup(name='loopix',
version=loopix.VERSION,
description='The Loopix mix system.',
author='Ania Piotrowska (UCL Information Security)',
author_email='<EMAIL>',
url=r'https://pypi.python.org/pypi/loopix/',
packages=['... |
from gi.repository import Gdk
from gi.repository import SugarExt
from gi.repository import SugarGestures
from sugar3.graphics import style
_instance = None
class GestureHandler(object):
'''Handling gestures to show/hide the frame
We use SugarExt.GestureGrabber to listen for
gestures on the root window... |
import mock
from neutron.agent.linux import pd
from neutron.tests import base as tests_base
class FakeRouter(object):
def __init__(self, router_id):
self.router_id = router_id
class TestPrefixDelegation(tests_base.DietTestCase):
def test_remove_router(self):
l3_agent = mock.Mock()
r... |
"""Classes to represent arbitrary sets (including sets of sets).
This module implements sets using dictionaries whose values are
ignored. The usual operations (union, intersection, deletion, etc.)
are provided as both methods and operators.
Important: sets are not sequences! While they support 'x in s',
'len(s)', a... |
"""
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and ... |
import os
class Config:
"""
Parses Python configuration files; all variables in the file are
assigned to class attributes.
"""
def __init__(self, file = "/etc/planetlab/plc_config"):
try:
exec(compile(open(file).read(), file, 'exec'), self.__dict__)
except:
... |
"""
Regression tests for Model inheritance behavior.
"""
from __future__ import unicode_literals
import datetime
from operator import attrgetter
from unittest import expectedFailure
from django import forms
from django.test import TestCase
from .models import (
ArticleWithAuthor, BachelorParty, BirthdayParty, Bu... |
"""
Django settings for MetaGetServer project.
Generated by 'django-admin startproject' using Django 1.10.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
imp... |
'''
This decoder stacks on top of the 'spi' PD and decodes the xx25 series
SPI (NOR) flash chip protocol.
It currently supports the MX25L1605D/MX25L3205D/MX25L6405D.
Details:
http://www.macronix.com/QuickPlace/hq/PageLibrary4825740B00298A3B.nsf/h_Index/3F21BAC2E121E17848257639003A3146/$File/MX25L1605D-3205D-6405D-1.5... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import contextlib
import inspect
import os
import random
import subprocess
import sys
import tempfile
import time
import uuid
import unittest
def execute(cmd_string, check_error=True, return_code=0, input=None,
block=True, error_msg='Error executing cmd'):
... |
"""floatingip_status
Revision ID: 2eeaf963a447
Revises: f44ab9871cd6
Create Date: 2014-01-14 11:58:13.754747
"""
# revision identifiers, used by Alembic.
revision = '2eeaf963a447'
down_revision = 'f44ab9871cd6'
# This migration is applied to all L3 capable plugins
migration_for_plugins = [
'neutron.plugins.big... |
import os.path
import subprocess
import time
updateChannel = "unknown"
hashCommit = "unknown"
outBranchName = subprocess.check_output(
["git", "branch", "--show-current"]).strip().decode()
out = subprocess.check_output(
["git", "status", "--porcelain"]).strip().decode()
if not out.strip():
label = subprocess.check_... |
"""Tests for google.protobuf.pyext behavior."""
__author__ = '<EMAIL> (Anuraag Agrawal)'
import os
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp'
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION'] = '2'
# We must set the implementation version above before the google3 imports.
# pylint: disab... |
""" Lexer for PPAPI IDL
The lexer uses the PLY library to build a tokenizer which understands both
WebIDL and Pepper tokens.
WebIDL, and WebIDL regular expressions can be found at:
http://www.w3.org/TR/2012/CR-WebIDL-20120419/
PLY can be found at:
http://www.dabeaz.com/ply/
"""
import os.path
import sys
#
# T... |
"""Validation tests for the job."""
import unittest
from pinball.workflow.event import Event
from pinball.workflow.job import ShellJob
from pinball.workflow.job_executor import ExecutionRecord
__author__ = 'Pawel Garbacki'
__copyright__ = 'Copyright 2015, Pinterest, Inc.'
__credits__ = [__author__]
__license__ = 'Ap... |
"""Utilities related to the PowerVM management partition.
The management partition is a special LPAR that runs the PowerVM REST API
service. It itself appears through the REST API as a LogicalPartition of type
aixlinux, but with the is_mgmt_partition property set to True.
The PowerVM Nova Compute service runs on the ... |
import paddle.fluid as fluid
__all__ = ['many_times', 'prog_scope']
def many_times(times):
def __impl__(fn):
def __fn__(*args, **kwargs):
for _ in range(times):
fn(*args, **kwargs)
return __fn__
return __impl__
def prog_scope():
def __impl__(fn):
de... |
"""Tests for keras.layers.preprocessing.reduction."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
import numpy as np
from tensorflow.python import keras
from tensorflow.python.keras import keras_parameterized
fro... |
from test_framework import ComparisonTestFramework
from util import *
from mininode import CTransaction, NetworkThread
from blocktools import create_coinbase, create_block
from binascii import hexlify, unhexlify
import cStringIO
from comptool import TestInstance, TestManager
from script import CScript
import time
# A ... |
from gettext import gettext as _
RESPONSE_ACCEPTED = 'accepted'
RESPONSE_POSTPONED = 'postponed'
RESPONSE_REJECTED = 'rejected'
STATE_ACCEPTED = 'accepted'
STATE_RUNNING = 'running'
STATE_WAITING = 'waiting'
STATE_FINISHED = 'finished'
STATE_ERROR = 'error'
STATE_CANCELED = 'canceled'
STATE_SKIPPED = 'skipped'
COMP... |
import unittest
from test import test_support
import resource
import time
# This test is checking a few specific problem spots with the resource module.
class ResourceTest(unittest.TestCase):
def test_args(self):
self.assertRaises(TypeError, resource.getrlimit)
self.assertRaises(TypeError, resou... |
"""PCLED: Control your Arduino's LED strip through your PC"""
import sys
from glob import glob
from setuptools import setup, find_packages
NAME = "pcled"
VERSION = "0.1"
def read(filename):
import os
BASE_DIR = os.path.dirname(__file__)
filename = os.path.join(BASE_DIR, filename)
with op... |
import collections
import socket
import struct
from syslog import *
from typing import List
SETSTATE = b's'
GETSTATE = b'g'
GETCOUNT = b'c'
GETNAME = b'n'
GETDESCR = b'd'
GETTAGS = b't'
class Device(collections.namedtuple('device', ('name', 'description', 'tags', 'host', 'port', 'dev_id'))):
'''
A device on ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import gzip
import os
import struct
import tempfile
import unittest
from io import BytesIO, StringIO
from django.core.files import File
from django.core.files.base import ContentFile
from django.core.files.move import file_move_safe
from django.core.file... |
class ModuleDocFragment(object):
# Parameters for VMware modules
DOCUMENTATION = '''
options:
hostname:
description:
- The hostname or IP address of the vSphere vCenter.
required: True
username:
description:
- The username of the vSphere vCenter.
r... |
from openerp import models, api
from ..base_suspend_security import BaseSuspendSecurityUid, SUSPEND_METHOD
class IrRule(models.Model):
_inherit = 'ir.rule'
@api.model
def domain_get(self, model_name, mode='read'):
if isinstance(self.env.uid, BaseSuspendSecurityUid):
return [], [], ['"... |
"""
Isotonic Regression Example.
"""
from __future__ import print_function
from pyspark import SparkContext
# $example on$
import math
from pyspark.mllib.regression import LabeledPoint, IsotonicRegression, IsotonicRegressionModel
from pyspark.mllib.util import MLUtils
# $example off$
if __name__ == "__main__":
s... |
class ChineseCheckersBoard:
def __init__(self):
self.squareList = []
for x in xrange(121):
self.squareList.append(CheckersSquare(x))
self.squareList[0].setAdjacent([None,
1,
2,
None,
None,
None])
self.squareList[1].setAdjacen... |
categories = ["arithmetic",
"cache_and_memory_management",
"compare_and_test",
"control_transfer",
"data_conversion",
"data_transfer",
"flags",
"input_output",
"load_effective_address",
"load_se... |
#!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_spkir_abj_dcl
@file marine-integrations/mi/dataset/parser/test/test_spkir_abj_dcl.py
@author Steve Myerson
@brief Test code for a spkir_abj_dcl data parser
In the following files, Metadata consists of 4 records.
There is 1 group of Sensor Data records for... |
from __future__ import absolute_import, division, print_function, unicode_literals
import datetime
from ..azure_common import BaseTest, arm_template
from c7n_azure.session import Session
from dateutil import tz as tzutils
from mock import patch
from c7n.testing import mock_datetime_now
from c7n.utils import local_se... |
from __future__ import absolute_import
import xmlrpclib
import uuid
from .certificate import Certificate
from ..util.faults import GidInvalidParentHrn, GidParentHrn
from ..util.sfalogging import logger
from ..util.xrn import hrn_to_urn, urn_to_hrn, hrn_authfor_hrn
##
# Create a new uuid. Returns the UUID as a string... |
'''
Run this script every time you change one of the png files. Using pngcrush, it will optimize the png files, remove various color profiles, remove ancillary chunks (alla) and text chunks (text).
#pngcrush -brute -ow -rem gAMA -rem cHRM -rem iCCP -rem sRGB -rem alla -rem text
'''
import os
import sys
import subproces... |
import os
import fnmatch
def get_filenames(root_dir, pattern, include_root=True):
"""Gets a list of files of a given directory matching a
specified pattern, by using a resursive search.
Parameters
----------
root_dir: str
The directory to recursively look into.
pattern: str
... |
import socorro.lib.ver_tools as vtl
phs = vtl._padding_high_string
pl = vtl._padding_list
tests = [('3', [3, phs, 0, phs] + pl * 3, '3'),
('3.', [3, phs, 0, phs] + pl * 3, '3'),
('3.0', [3, phs, 0, phs] + pl * 3, '3'),
('3.0.0', [3, phs, 0, phs] + pl * ... |
"""
Helper views for the debug toolbar. These are dynamically installed when the
debug toolbar is displayed, and typically can do Bad Things, so hooking up these
views in any other way is generally not advised.
"""
import os
import django.views.static
from django.conf import settings
from django.db import connection
f... |
"""
This modules implements the CrawlSpider which is the recommended spider to use
for scraping typical web sites that requires crawling pages.
See documentation in docs/topics/spiders.rst
"""
import copy
from scrapy.http import Request, HtmlResponse
from scrapy.utils.spider import iterate_spider_output
from scrapy.... |
#!/usr/local/bin/python2.7
import fileinput
import glob
import os
import sys
import datetime
class Cmd_arithmetic:
def __init__(self, code):
self.code = code
self.counter = -1
def generate(self):
self.counter += 1
return self.code.replace('%d', str(self.counter))
class Cmd_p... |
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 = dict((key, getattr(settings, key))
for key in ('GEOIP_PATH', 'GEOIP_LIBRARY_PATH', 'GEOIP_COUNTRY', 'GEOIP_CITY... |
"""Basic word2vec example."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import math
import os
import random
from tempfile import gettempdir
import zipfile
import numpy as np
from six.moves import urllib
from six.moves import xrange... |
#!/usr/bin/env python3
# api.py test
import unittest
from t2db_worker.parser import statusTweet
from t2db_worker.parser import statusUser
from t2db_worker.parser import getElement
from t2db_worker.parser import getRaw
from t2db_worker.parser import ParserStatus
from t2db_worker.tests.test_api import createApiStreami... |
"""
WSGI config for simplecmdb project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION... |
from __future__ import print_function
import fnmatch
import os
import sys
import json
def get_gomod_dependencies(rootdir, components):
all_dependencies = {}
for component in components:
with open(os.path.join(rootdir, component, "go.mod")) as f:
print(component + " dependencies")
... |
"""BibFormat element - Prints imprint publication place
"""
__revision__ = "$Id$"
def format_element(bfo):
"""
Prints the imprint publication place as HTML
@see: date.py, publisher.py, reprints.py, imprint.py, pagination.py
"""
place = bfo.field('260__a')
if place != "sine loco":
retur... |
"""engine.SCons.Tool.sunar
Tool-specific initialization for Solaris (Forte) ar (library archive). If CC
exists, static libraries should be built with it, so that template
instantians can be resolved.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic S... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtSvg.py
---------------------
Date : March 2016
Copyright : (C) 2016 by Juergen E. Fischer
Email : jef at norbit dot de
********************************... |
from fabric.api import task, env
from cloudferrylib.scheduler.namespace import Namespace
from cloudferrylib.scheduler.scheduler import Scheduler
import cfglib
from cloudferrylib.utils import utils as utl
from cloudferrylib.utils import utils
from cloudferrylib.scheduler.scenario import Scenario
from cloud import cloud_... |
"""Fix job.product_id type
Revision ID: 41763e5d07cb
Revises: 2c03c52950bf
Create Date: 2014-10-10 13:22:26.918643
"""
# revision identifiers, used by Alembic.
revision = '41763e5d07cb'
down_revision = '2c03c52950bf'
from alembic import op
import sqlalchemy as sa
def upgrade():
column_info, = [info for info in... |
#!/usr/bin/env python
""" MultiQC module to parse output from STAR """
from __future__ import print_function
from collections import OrderedDict
import logging
import re
from multiqc import config, BaseMultiqcModule
# Initialise the logger
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
... |
"""test for actions_db module."""
import os
import unittest
from StringIO import StringIO
try: # py3
from unittest import mock
except ImportError: # py2
import mock
import pytest
import sqlite3
def test_simple_import():
"""test simple import.
the first error raised because IO is disable when testi... |
"""Support for NuHeat thermostats."""
import logging
import voluptuous as vol
from homeassistant.const import CONF_USERNAME, CONF_PASSWORD, CONF_DEVICES
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers import discovery
_LOGGER = logging.getLogger(__name__)
DOMAIN = 'nuheat'
CONF... |
import struct
import re
import inspect
from tracetool import _read_events, Event
from tracetool.backend.simple import is_string
header_event_id = 0xffffffffffffffff
header_magic = 0xf2b177cb0aa429b4
dropped_event_id = 0xfffffffffffffffe
log_header_fmt = '=QQQ'
rec_header_fmt = '=QQII'
def read_header(fobj, hfmt):... |
from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.DistributionRequirement import (
DistributionRequirement)
from dependency_management.requirements.AnyOneOfRequirements import (
AnyOneOfRequirements)
from dependency_management.requirements.CabalRequirement import (
... |
# coding=utf-8
from __future__ import absolute_import
__author__ = "Gina Häußge <<EMAIL>>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
from flask import request, make_res... |
PARANOIA = 1 # default: security model of xml_pickle-0.51
def setParanoia(val):
global PARANOIA
PARANOIA = val
def getParanoia(): return PARANOIA
# 0: Put refs in XML when ident objs found, instead of entire objs
# 1: never put references in XML
DEEPCOPY = 0
def setDeepCopy(val):
global DEEPCOPY... |
import BoostBuild
###############################################################################
#
# test_folder_with_dot_in_name()
# ------------------------------
#
###############################################################################
def test_folder_with_dot_in_name(t):
"""
Regression test: t... |
"""Test node responses to invalid network messages."""
import struct
from test_framework import messages
from test_framework.mininode import P2PDataStore
from test_framework.test_framework import BitcoinTestFramework
class msg_unrecognized:
"""Nonsensical message. Modeled after similar types in test_framework.me... |
# coding=utf-8
__author__ = 'PyBeaner'
import os
import fnmatch
total_lines = 0
code_lines = 0
empty_lines = 0
comment_lines = 0
def count_line(line):
line = line.lstrip()
global comment_lines, empty_lines, total_lines, code_lines
total_lines += 1
if line.startswith("#"):
comment_lines += 1
... |
import argparse
import sys
from common_includes import *
class Preparation(Step):
MESSAGE = "Preparation."
def RunStep(self):
# TODO(machenbach): Remove after the git switch.
if self.Config("PERSISTFILE_BASENAME") == "/tmp/v8-auto-tag-tempfile":
print "This script is disabled until after the v8 gi... |
from beautifulhue.libs.http import Request
class Light:
def __init__(self, bridge, user, debug):
self.bridge = bridge
self.user = user
self.debug = debug
def get(self, resource, debug=False):
"""
@summary: Get all lights, get new lights, or get a specific light... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Reference.value'
db.alter_column(u'rules_reference', '... |
"""Helper class to quickly write a loop over all standard input files.
Typical use is:
import fileinput
for line in fileinput.input():
process(line)
This iterates over the lines of all files listed in sys.argv[1:],
defaulting to sys.stdin if the list is empty. If a filename is '-' it
is also replace... |
__source__ = 'https://leetcode.com/problems/path-sum-ii/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/path-sum-ii.py
# Time: O(n)
# Space: O(h), h is height of binary tree
# DFS
#
# Description: Leetcode # 113. Path Sum II
#
# Given a binary tree and a sum, find all root-to-leaf paths where each path's s... |
from pyscf.pbc.dft.gen_grid import UniformGrids, BeckeGrids
from pyscf.pbc.dft import rks
from pyscf.pbc.dft import uks
from pyscf.pbc.dft import roks
from pyscf.pbc.dft import krks
from pyscf.pbc.dft import kuks
from pyscf.pbc.dft import kroks
UKS = uks.UKS
ROKS = roks.ROKS
KRKS = krks.KRKS
KUKS = kuks.KUKS
KROKS = ... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['deprecated'],
'supported_by': 'community'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.modu... |
"""
Various exceptions that are specific to the SES module.
"""
from boto.exception import BotoServerError
class SESError(BotoServerError):
"""
Sub-class all SES-related errors from here. Don't raise this error
directly from anywhere. The only thing this gets us is the ability to
catch SESErrors separa... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = r'''
---
module: win_psexec
version_added: '2.3'
short_description: Runs commands (remotely) as another (privileged) user
description:
- Run commands (remotely) through the ... |
"""Factory functions for `Predictor`s."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.predictor import contrib_estimator_predictor
from tensorflow.contrib.predictor import core_estimator_predictor
from tensorflow.contrib.predicto... |
import logging
from pip._vendor import requests
from pip._vendor.cachecontrol.adapter import CacheControlAdapter
from pip._vendor.cachecontrol.cache import DictCache
from pip._vendor.cachecontrol.controller import logger
from argparse import ArgumentParser
def setup_logging():
logger.setLevel(logging.DEBUG)
... |
# -*- coding: utf-8 -*-
""" Sahana Eden Staff Module Automated Tests
@copyright: 2011-2012 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to de... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from past.builtins import basestring
import collections
import logging
from jsonschema.compat import str_types
from flexget import plugin
from flexget.config_schema import one... |
from prometheus_client import Counter
from django_prometheus.conf import NAMESPACE
model_inserts = Counter(
"django_model_inserts_total",
"Number of insert operations by model.",
["model"],
namespace=NAMESPACE,
)
model_updates = Counter(
"django_model_updates_total",
"Number of update operati... |
"""
This script will list all the adapter connected to the system.
"""
import os
import time
from avocado import Test
from avocado.utils import process
class Avago3008(Test):
"""
This script lists all the LSI adapters attached on the machine
"""
def setUp(self):
"""
Lists all avail... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.