content string |
|---|
from openerp import report
from . import wizard
from . import mod340
from . import res_partner
from . import account_invoice
from . import account |
"""Exceptions used by Arista ML2 Mechanism Driver."""
from neutron.common import exceptions
class AristaRpcError(exceptions.NeutronException):
message = _('%(msg)s')
class AristaConfigError(exceptions.NeutronException):
message = _('%(msg)s')
class AristaServicePluginRpcError(exceptions.NeutronException)... |
"""Keras callback classes."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.keras.python.keras.callbacks import BaseLogger
from tensorflow.contrib.keras.python.keras.callbacks import Callback
from tensorflow.contrib.keras.python.ke... |
import trep
from trep import tx,ty,tz,rx,ry,rz
import time
import trep.visual as visual
dt = 0.01
tf = 10.0
def simulate_system(system):
# Now we'll extract the current configuration into a tuple to use as
# initial conditions for a variational integrator.
q0 = system.q
# Create and initialize the va... |
""" This file contains instance of the net-rpc server
"""
import logging
import select
import socket
import sys
import threading
import traceback
import openerp
import openerp.netsvc as netsvc
import openerp.tiny_socket as tiny_socket
import openerp.tools as tools
_logger = logging.getLogger(__name__)
class Tin... |
from __future__ import print_function
import sys, os, time
startTime = time.time()
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, rdb_workload_common, scenario_common, utils, vcoptparse
op = vcoptparse.OptParser()
scenario_common.prepare_option_par... |
"""DEPRECATED: Declares the RPC service interfaces.
This module declares the abstract interfaces underlying proto2 RPC
services. These are intended to be independent of any particular RPC
implementation, so that proto2 services can be used on top of a variety
of implementations. Starting with version 2.3.0, RPC imp... |
import cgi
from mod_pywebsocket import msgutil
def web_socket_do_extra_handshake(request):
r = request.ws_resource.split('?', 1)
if len(r) == 1:
return
param = cgi.parse_qs(r[1])
if 'protocol' in param:
request.ws_protocol = param['protocol'][0]
def web_socket_transfer_data(request):... |
# -*- coding: utf-8 -*-
from cms.models import Page
from cms.models.titlemodels import Title
from cms.utils import i18n
from collections import defaultdict
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.cache import cache
from django.db.models.signals import post_save, po... |
from __future__ import absolute_import
from django import forms
from django.db import transaction, IntegrityError
from sentry.models import (
AuditLogEntry, AuditLogEntryEvent, OrganizationMember,
OrganizationMemberType
)
class InviteOrganizationMemberForm(forms.ModelForm):
class Meta:
fields = ... |
"""namebench: DNS service benchmarking tool."""
__author__ = '<EMAIL> (Thomas Stromberg)'
import os
import platform
import sys
# Check before we start importing internal dependencies
if sys.version < '2.4':
your_version = sys.version.split(' ')[0]
print '* Your Python version (%s) is too old! Please upgrade to ... |
"""Defines the public namespace for SQL expression constructs.
Prior to version 0.9, this module contained all of "elements", "dml",
"default_comparator" and "selectable". The module was broken up
and most "factory" functions were moved to be grouped with their associated
class.
"""
__all__ = [
'Alias', 'Claus... |
import unittest2 as unittest
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.common.system.user import User
class UserTest(unittest.TestCase):
example_user_response = "example user response"
def test_prompt_repeat(self):
self.repeatsRemaining = 2
def mock_raw_inp... |
"""Common tags used for graphs in SavedModel.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.util.all_util import remove_undocumented
# Tag for the `serving` graph.
SERVING = "serve"
# Tag for the `training` graph.
TRAINING = ... |
from openerp.osv import fields,osv
from openerp.osv import orm
from openerp.tools.translate import _
def _get_answers(cr, uid, ids):
"""
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of crm profiling’s IDs """
... |
from gnuradio import gr, gr_unittest
import digital_swig
class test_lms_dd_equalizer(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
def tearDown(self):
self.tb = None
def transform(self, src_data, gain, const):
SRC = gr.vector_source_c(src_data, False)
EQU = digital_sw... |
from __future__ import division, absolute_import, print_function
import sys
import numpy as np
from numpy.ctypeslib import ndpointer, load_library
from numpy.distutils.misc_util import get_shared_lib_extension
from numpy.testing import TestCase, run_module_suite, dec
try:
cdll = load_library('multiarray', np.cor... |
from django import forms
from django.forms.models import modelformset_factory
from django.utils.translation import ugettext_lazy as _
from . import handler
from . import models
class DeliveryMethodForm(forms.ModelForm):
delivery_type = forms.ChoiceField(label=_('Delivery method'), choices=[])
class Meta:
... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
class change_production_qty(osv.osv_memory):
_name = 'change.production.qty'
_description = 'Change Quantity of Products'
_columns = {
'product_qty': fields.float('Product Qty', ... |
"""View functions for the LMS Student dashboard"""
from django.http import Http404
from edxmako.shortcuts import render_to_response
from django.db import connection
from student.models import CourseEnrollment
from django.contrib.auth.models import User
def dictfetchall(cursor):
'''Returns a list of all rows from... |
import os
import bisect
from pygments.token import Token
from pygments.lexers import get_lexer_by_name, get_lexer_for_filename, \
ClassNotFound
# TODO: these really have to be moved to another file and it should be made
# to be pluggable
def isbacktracetoken_default(ttype, tvalue):
return not ttype in Token.... |
"""
Manually schedule the removal of one or more documents from the document API.
"""
from collections import namedtuple
from django.core.management.base import BaseCommand, CommandError
from kuma.api.tasks import unpublish
class Command(BaseCommand):
args = '<document_path document_path ...>'
help = 'Rem... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from contextlib import contextmanager
import mock
from pex.package import EggPackage, Package, SourcePackage
from pex.resolver import Unsatisfiable, resolve... |
# -*- coding: utf-8 -*-
import os
from setuptools import setup, Command, find_packages
class CleanCommand(Command):
"""Custom clean command to tidy up project root."""
# http://stackoverflow.com/questions/3779915/
user_options = []
def initialize_options(self):
pass
def finalize_options(sel... |
from openerp.osv import fields, osv
CODE_EXEC_DEFAULT = '''\
res = []
cr.execute("select id, code from account_journal")
for record in cr.dictfetchall():
res.append(record['code'])
result = res
'''
class accounting_assert_test(osv.osv):
_name = "accounting.assert.test"
_order = "sequence"
_columns = ... |
# -*- coding: utf-8 -*-
"""
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
"""
from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
:para... |
"""
Command to load course overviews.
"""
import logging
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from xmodule.modulestore.django import modulestore
from openedx.core.djangoapps... |
import unittest, time, sys
import h2o
class TestJUnit(unittest.TestCase):
def test_A_all_junit(self):
try:
h2o.build_cloud(node_count=2, java_heap_GB=3)
# we don't have the port or ip configuration here
# that util/h2o.py does? Keep this in synch with spawn_h2o there.
... |
from cgi import escape
import gzip as gzip_module
import re
import time
import types
import uuid
from cStringIO import StringIO
def resolve_content(response):
rv = "".join(item for item in response.iter_content())
if type(rv) == unicode:
rv = rv.encode(response.encoding)
return rv
class Pipeline... |
import theano
import theano.tensor as T
import numpy as np
import matplotlib.pyplot as plt
plt.ion()
import load
# load data
x_train, t_train, x_test, t_test = load.cifar10(dtype=theano.config.floatX)
labels_test = np.argmax(t_test, axis=1)
# visualize data
plt.imshow(x_train[0].reshape(32, 32), cmap=plt.cm.gray)
... |
from django.contrib import admin
from django.contrib.contenttypes.models import ContentType
from recipebook.models import (
Ingredient, Recipe, RecipeIngredient, IngredientLine
)
class IngredientLineInline(admin.TabularInline):
model = IngredientLine
def get_formset(self, request, obj=None, **kwargs):
... |
"""SignatureDef utility functions implementation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def get_signature_def_by_key(meta_graph_def, signature_def_key):
"""Utility function to get a SignatureDef protocol buffer by its key.
Args:
meta_... |
from __future__ import unicode_literals
from django.contrib.sites.models import Site
from django.core.urlresolvers import get_script_prefix
from django.db import models
from django.utils.encoding import iri_to_uri, python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_... |
from .module_definition import ModuleDefinition
from .link_type import LinkType
class Calls(ModuleDefinition):
@property
def name(self):
return 'Calls'
@property
def contacts_link_type(self):
return LinkType.RELATIONSHIP
@property
def contacts_link_name(self):
return... |
""" Custom script for The notify-osd"""
__id__ = ""
__version__ = ""
__date__ = ""
__copyright__ = "Copyright (c) 2009 Eitan Isaacson"
__license__ = "LGPL"
import orca.messages as messages
import orca.scripts.default as default
import orca.settings as settings
import orca.speech as speech
import orca.... |
from flask import *
from flask_wtf import FlaskForm
from flask_bootstrap import Bootstrap
from wtforms import validators, TextField, IntegerField, SubmitField, SelectField, SelectMultipleField
from datetime import datetime
import psycopg2
import os
import urllib.parse as urlparse
import subprocess
import time
from math... |
import unittest
import logging
import StringIO
import random
import xxd
from subprocess import Popen, PIPE
logger = logging.getLogger(__name__)
LENGTH = 1024*10 # 10KB
class XxdTest(unittest.TestCase):
def test_mask_not_alphanumeric(self):
self.assertEquals( (1, ". X"), xxd.mask_not_alphanumeric("\n X"))
... |
"""Filter imported files using a regular expression.
"""
import re
from beets import config
from beets.plugins import BeetsPlugin
from beets.importer import SingletonImportTask
class FileFilterPlugin(BeetsPlugin):
def __init__(self):
super(FileFilterPlugin, self).__init__()
self.register_listener... |
""" Defines the generator function for field test cases """
from django.test import TestCase
from tastytools.test.client import Client, MultiTestCase, create_multi_meta
from datetime import datetime
from helpers import prepare_test_post_data
import random
class FieldNotSupportedException(Exception):
pass
def g... |
#!/opt/conda/default/bin/python3
import json
import os
import subprocess as sp
import sys
import errno
from subprocess import check_output
assert sys.version_info > (3, 0), sys.version_info
if sys.version_info >= (3, 7):
def safe_call(*args, **kwargs):
sp.run(args, capture_output=True, check=True, **kwarg... |
r"""Beam pipeline to create TFRecord files from JPEG files stored on GCS.
These are the TFRecord format expected by the resnet and amoebanet models.
Example usage:
python -m preprocess.py \
--train_csv gs://cloud-ml-data/img/flower_photos/train_set.csv \
--validation_csv gs://cloud-ml-data/img/flower_ph... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleError
from ansible.utils.debug import debug
class Group:
''' a group of ansible hosts '''
#__slots__ = [ 'name', 'hosts', 'vars', 'child_groups', 'parent_groups', 'depth', '_hosts_cache' ... |
#!/usr/bin/env python2
from __future__ import print_function
import os
import os.path
import pkgutil
import shutil
import sys
import tempfile
__all__ = ["version", "bootstrap"]
_SETUPTOOLS_VERSION = "18.4"
_PIP_VERSION = "7.1.2"
# pip currently requires ssl support, so we try to provide a nicer
# error message w... |
from gnuradio import gr, gr_unittest, digital, blocks
class test_map(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
def tearDown(self):
self.tb = None
def helper(self, symbols):
src_data = [0, 1, 2, 3, 0, 1, 2, 3]
expected_data = map(lambda x: symbols[x]... |
# -*- coding: utf-8 -*-
from anaf.sales.api import handlers
from django.conf.urls import url, patterns
from anaf.core.api.auth import auth_engine
from anaf.core.api.doc import documentation_view
from anaf.core.api.resource import CsrfExemptResource
ad = {'authentication': auth_engine}
# sales resources
saleStatusRes... |
# Webhooks for external integrations.
from typing import Dict, Any, Text
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.lib.actions import check_send_stream_message
from zerver.lib.response import json_success, json_error
from zerver.decorator import REQ... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from units.mock.procenv import ModuleTestCase
from units.compat.mock import patch, MagicMock
from ansible.module_utils.six.moves import builtins
realimport = builtins.__import__
class TestOtherFilesystem(ModuleTestCase):
def ... |
# -*- coding: utf-8 -*-
from fabric import api
import os
import shutil
from fabric import colors
PORT = 8000
PROJECT_NAME = 'ymir'
DOC_ROOT = os.path.dirname(__file__)
SRC_ROOT = os.path.dirname(DOC_ROOT)
GEN_PATH = os.path.join(DOC_ROOT, 'ymir')
DEPLOY_PATH = "~/code/ghio/{0}".format(PROJECT_NAME)
DEPLOY_PATH = os.pa... |
"""
Test the pipeline module.
"""
import numpy as np
from scipy import sparse
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_true
from skle... |
# Backport of selectors.py from Python 3.5+ to support Python < 3.4
# Also has the behavior specified in PEP 475 which is to retry syscalls
# in the case of an EINTR error. This module is required because selectors34
# does not follow this behavior and instead returns that no dile descriptor
# events have occurred rath... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_file_version
version_added: "2.1"
short_description: Get DLL or EXE file build version
description:
- Get DLL or EXE file build version.
note... |
from webob import exc
from nova import compute
from nova import quota
from nova import wsgi
from nova.api.openstack import common
from nova.api.openstack import faults
class Controller(common.OpenstackController):
""" The server metadata API controller for the Openstack API """
def __init__(self):
s... |
"""MySQLdb - A DB API v2.0 compatible interface to MySQL.
This package is a wrapper around _mysql, which mostly implements the
MySQL C API.
connect() -- connects to server
See the C API specification and the MySQL documentation for more info
on other items.
For information on how MySQLdb handles type conv... |
"""Django models related to teams functionality."""
from datetime import datetime
from uuid import uuid4
import pytz
from model_utils import FieldTracker
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.models import User
from django.db import models
from django.dispatch import receiver
... |
# run doom process on a series of maps
# can be used for regression testing, or to fetch media
# keeps a log of each run ( see getLogfile )
# currently uses a basic stdout activity timeout to decide when to move on
# using a periodic check of /proc/<pid>/status SleepAVG
# when the sleep average is reaching 0, issue a ... |
#-- Imports --------------------------------------------------------------------
from traits.api \
import HasTraits, File, Button
from traitsui.api \
import View, HGroup, Item
from traitsui.file_dialog \
import open_file, FileInfo, TextInfo, ImageInfo
#-- FileDialogDemo Class --------------------------... |
"""
Release:
- Concatenates autostart modules, application modules' module.json descriptors,
and the application loader into a single script.
- Concatenates all workers' dependencies into individual worker loader scripts.
- Builds app.html referencing the application script.
Debug:
- Copies the module direc... |
from openstack.identity import identity_service
from openstack import resource
class Policy(resource.Resource):
resource_key = 'policy'
resources_key = 'policies'
base_path = '/policies'
service = identity_service.IdentityService()
# capabilities
allow_create = True
allow_get = True
a... |
import os
def load_data(path):
input_file = os.path.join(path)
with open(input_file, "r", encoding='utf-8', errors='ignore') as f:
data = f.read()
return data
def extract_vocab(data):
special_words = ['<pad>', '<unk>', '<s>', '<\s>']
set_words = set([word for line in dat... |
__author__ = '<EMAIL> (Jeff Scudder)'
import atom.core
ATOM_TEMPLATE = '{http://www.w3.org/2005/Atom}%s'
APP_TEMPLATE_V1 = '{http://purl.org/atom/app#}%s'
APP_TEMPLATE_V2 = '{http://www.w3.org/2007/app}%s'
class Name(atom.core.XmlElement):
"""The atom:name element."""
_qname = ATOM_TEMPLATE % 'name'
class E... |
"""
EFI Platform Initialization Firmware Volume parser.
Author: Alexandre Boeglin
Creation date: 08 jul 2007
"""
from lib.hachoir_parser import Parser
from lib.hachoir_core.field import (FieldSet,
UInt8, UInt16, UInt24, UInt32, UInt64, Enum,
CString, String, PaddingBytes, RawBytes, NullBytes)
from lib.hachoir... |
import unittest
from scrapy.linkextractors.regex import RegexLinkExtractor
from scrapy.http import HtmlResponse
from scrapy.link import Link
from scrapy.linkextractors.htmlparser import HtmlParserLinkExtractor
from scrapy.linkextractors.sgml import SgmlLinkExtractor, BaseSgmlLinkExtractor
from tests import get_testdata... |
import sys
from yaku.scheduler \
import \
run_tasks
from yaku.context \
import \
get_bld, get_cfg
from yaku.conftests.fconftests \
import \
check_fcompiler, check_fortran_verbose_flag, \
check_fortran_runtime_flags, check_fortran_dummy_main, \
check_fortran_mangling... |
from MemObject import MemObject
from m5.SimObject import SimObject
from m5.params import *
from m5.proxy import *
class MemChecker(SimObject):
type = 'MemChecker'
cxx_header = "mem/mem_checker.hh"
class MemCheckerMonitor(MemObject):
type = 'MemCheckerMonitor'
cxx_header = "mem/mem_checker_monitor.hh"
... |
# Description: Shows how to use orange.Domain for example conversion. Also shows how to add meta-attributes to domain descriptors and use them.
# Category: basic classes, meta-attributes
# Classes: Domain
# Uses: monk1
# Referenced: Domain.htm
import orange
data = orange.ExampleTable("monk1")
d2 = ora... |
#!/usr/bin/env python
"""
Camera action scheduler.
"""
__author__ = "Daniel Casner <www.danielcasner.org>"
import time
import scheduler
import control
SEEK_TIME = 20.0
class CameraAction:
"""A general class for camera actions to queue"""
def __init__(self, foscam, expire=None):
"""Store basic ac... |
from openerp.osv import fields, orm
class stock_picking(orm.Model):
_inherit = "stock.picking"
_columns = {
'claim_id': fields.many2one('crm.claim', 'Claim'),
}
def create(self, cr, uid, vals, context=None):
if ('name' not in vals) or (vals.get('name') == '/'):
sequence_... |
"""
Tests for network implementation
:author: Fenja Kollasch, 06/2017
"""
import sys
sys.path.append('../')
import networks as n
import objects as o
# Model the big dipper as unordered graph... because you can observe a constellation only from left to right... or so
big_dipper = n.AstroNetwork("big dipper")
alkaid = ... |
if __name__ == "__main__":
raise Exception("This script is a plugin for xsconsole and cannot run independently")
from XSConsoleStandard import *
class XSFeatureLogInOut:
@classmethod
def StatusUpdateHandler(cls, inPane):
if Auth.Inst().IsAuthenticated():
inPane.AddTitleField(Lang("... |
import os
from django.conf import settings
from django.test import TestCase, Client
class FlatpageCSRFTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
self.client = Client(enforce_csrf_checks=True)
self.old_MIDDLEWARE_CLASSES = ... |
from heat.api.aws import exception as aws_exception
from heat.api.aws import utils as api_utils
from heat.common import exception as common_exception
from heat.tests import common
class AWSCommonTest(common.HeatTestCase):
'''
Tests the api/aws common components
'''
# The tests
def test_format_resp... |
from .resource import Resource
class NodeResource(Resource):
"""A Node Resource.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource Manager Resource ID.
:vartype id: str
:ivar type: Resource Manager Resource Type.
:vartype type: str... |
#
# This file is part of Dragonfly.
# (c) Copyright 2007, 2008 by Christo Butcher
# Licensed under the LGPL.
#
# Dragonfly is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the ... |
from openerp.osv import fields, osv
class actions_server(osv.Model):
""" Add email option in server actions. """
_name = 'ir.actions.server'
_inherit = ['ir.actions.server']
def _get_states(self, cr, uid, context=None):
res = super(actions_server, self)._get_states(cr, uid, context=context)
... |
#!/usr/bin/python
#
# This tool goes through every file in the 'man' directory and automatically makes the example \dontrun.
#
import sys
import os
import re
import shutil
STATE_NONE = 1
STATE_IN_EXAMPLES = 2
STATE_IN_CRAN_EXAMPLES = 3
STATE_IN_DONTRUN = 4
class Example:
def __init__(self, dir_name, file_name... |
import numpy as np
from scipy.signal import argrelextrema
from hyperspy.external.astroML.histtools import histogram
class HistogramSegmenter(object):
"""Historam Segmenter strategy of the SAMFire. Uses histograms to estimate
parameter distribusions, and then passes the most frequent values as
the startin... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
DOCUMENTATION = r'''
---
module: bigip_profile_udp
short_description: Manage UDP profiles on... |
import re
from urlparse import urlparse, parse_qs
from braceexpand import braceexpand
import requests
def get_abs_url(url, base_url):
try:
if url.pattern.startswith('/'):
# url is a compiled regular expression pattern
return re.compile(''.join([re.escape(base_url), url.pattern]))
... |
from lxml import etree
from pcs.common import report_codes
from pcs.lib import reports
from pcs.lib.cib.nvpair import (
append_new_instance_attributes,
append_new_meta_attributes,
get_value,
get_nvset_as_dict,
)
from pcs.lib.cib.resource.operations import(
prepare as prepare_operations,
create_... |
{
"name": "Panama Localization Chart Account",
"version": "1.0",
"description": """
Panamenian accounting chart and tax localization.
Plan contable panameño e impuestos de acuerdo a disposiciones vigentes
Con la Colaboración de
- AHMNET CORP http://www.ahmnet.com
""",
"author": "Cubic ERP",
... |
#!/usr/bin/env python
import numpy as np
import sys
import numpy.polynomial.polynomial as poly
from scipy import interpolate
from scipy.optimize import fmin
arg = sys.argv;
#print arg
def readorb(filename):
with open(filename, "r") as ins:
array = []
mode = "search"
for line in ins:
... |
from __future__ import print_function
import os
import sys
import tempfile
# Get file directory path
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
CFG_DIR = os.path.dirname(TEST_DIR)
sys.path.append(CFG_DIR)
import mconfigfmt # nopep8: E402 module level import not at top of file
def run_test(name, expected... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import codecs
from PySide2 import QtGui
from .core_threads import UpdateAutocompleter
from ..methods.decorators import Decorator
# from ..tools.code_navigator import self
from ..methods.dialogs import Dialogs
####################################################... |
"""
Support for Google travel time sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.google_travel_time/
"""
from datetime import datetime
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components... |
"""Validate manifests."""
import pathlib
import sys
from .model import Integration, Config
from . import codeowners, config_flow, dependencies, manifest, services, ssdp, zeroconf
PLUGINS = [codeowners, config_flow, dependencies, manifest, services, ssdp, zeroconf]
def get_config() -> Config:
"""Return config.""... |
import tempfile
import re
import shutil
import requests
import io
import urllib
from mitmproxy.net import tcp
from mitmproxy.test import tutils
from pathod import language
from pathod import pathoc
from pathod import pathod
from pathod import test
def treader(bytes):
"""
Construct a tcp.Read object fro... |
from nova.api.openstack import extensions
class Extended_floating_ips(extensions.ExtensionDescriptor):
"""Adds optional fixed_address to the add floating IP command."""
name = "ExtendedFloatingIps"
alias = "os-extended-floating-ips"
namespace = ("http://docs.openstack.org/compute/ext/"
... |
"""Generate java source files from protobufs
Usage:
protoc_java.py {protoc} {proto_path} {java_out} {stamp_file} {proto_files}
This is a helper file for the genproto_java action in protoc_java.gypi.
It performs the following steps:
1. Deletes all old sources (ensures deleted classes are not part of new jars).
2.... |
"""
=======================
Remap MEG channel types
=======================
In this example, MEG data are remapped from one channel type to another.
This is useful to:
- visualize combined magnetometers and gradiometers as magnetometers
or gradiometers.
- run statistics from both magnetometers and gradi... |
__all__ = ["RHEL3Handler"]
from pykickstart import commands
from pykickstart.base import BaseHandler
from pykickstart.version import RHEL3
class RHEL3Handler(BaseHandler):
version = RHEL3
commandMap = {
"auth": commands.authconfig.FC3_Authconfig,
"authconfig": commands.authconfig.FC3_Authconf... |
import angr
import claripy
import sys
def main(argv):
path_to_binary = argv[1]
project = angr.Project(path_to_binary)
initial_state = ???
# An under-constrained (unconstrained) state occurs when there are too many
# possible branches from a single instruction. This occurs, among other ways,
# when the i... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Script for packing and unpacking skin textures
"""
import argparse
from pygame import image, Surface, Rect, transform
from pygame.locals import SRCALPHA
from utils import add_vecs
HEAD = Rect(0, 0, 10, 10)
STRAIGHT1 = Rect(20, 20, 10, 10)
STRAIGHT2 = Rect(30, 20, 10... |
from chaco.abstract_overlay import AbstractOverlay
from chaco.plot_label import PlotLabel
from chaco.scatterplot import render_markers
from traits.api import Color, Instance, Str, Float, Int, Any
# ============= standard library imports ========================
# ============= local library imports ==================... |
import warnings
from datetime import datetime
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import FieldDoesNotExist
from django.core.exceptions import ImproperlyConfigured
from model_utils.... |
import os
import os.path
import logging
from logging import warning as warn
import collections
import yaml
from jinja2 import Environment, DictLoader
from servi.exceptions import MasterNotFound, ServiError
'''
Global configuration for servi files
Use as import config as c
Note - this will also read in additional va... |
# -*- 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):
# Changing field 'MashingTempLog.degrees'
db.alter_column('brew_mashingtemplog', 'degrees', self.gf('django... |
from datetime import timedelta
class _TzSingleton(type):
def __init__(cls, *args, **kwargs):
cls.__instance = None
super(_TzSingleton, cls).__init__(*args, **kwargs)
def __call__(cls):
if cls.__instance is None:
cls.__instance = super(_TzSingleton, cls).__call__()
... |
from django.db.models import Q
from django.apps import apps
from taiga.front.templatetags.functions import resolve
from .base import Sitemap
class EpicsSitemap(Sitemap):
def items(self):
epic_model = apps.get_model("epics", "Epic")
# Get epics of public projects OR private projects if anon user... |
"""CIFAR100 small image classification dataset.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
from tensorflow.python.keras._impl.keras import backend as K
from tensorflow.python.keras._impl.keras.datasets.cifar import loa... |
"""Finds Fuchsia browsers that can be started and controlled by telemetry."""
from telemetry.core import fuchsia_interface
from telemetry.core import platform
from telemetry.internal.backends.chrome import fuchsia_browser_backend
from telemetry.internal.browser import browser
from telemetry.internal.browser import pos... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.