content stringlengths 4 20k |
|---|
"""Implementations of different data feeders to provide data for TF trainer."""
# Copyright 2015-present Scikit Flow Authors. All Rights Reserved.
#
# 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 Li... |
"""Coordinate system for pose-related logic."""
import collections
from typing import Optional, Union
import numpy as np
from transforms3d.quaternions import quat2mat
from robel.components.tracking.tracker import TrackerState
ObjectId = Union[str, int]
class CoordinateSystem:
"""Stores the most recently retur... |
#!/usr/bin/env python
from __future__ import print_function
from builtins import str
import sys
import pmagpy.pmag as pmag
def main():
"""
NAME
umich_magic.py
DESCRIPTION
converts UMICH .mag format files to magic_measurements format files
SYNTAX
umich_magic.py [command line o... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import * # noqa
import functools
import os
import time
from ycmd import handlers
fr... |
from __future__ import division
__all__ = ['Binomial']
import numpy as np
import scipy.stats as stats
import scipy.special as special
from warnings import warn
from pybasicbayes.abstractions import GibbsSampling, MeanField, \
MeanFieldSVI
class Binomial(GibbsSampling, MeanField, MeanFieldSVI):
'''
Model... |
import webob
from nova.api.openstack import api_version_request
from nova.api.openstack.compute.schemas import flavor_manage
from nova.api.openstack.compute.views import flavors as flavors_view
from nova.api.openstack import wsgi
from nova.api import validation
from nova.compute import flavors
from nova import excepti... |
from jnius import autoclass
from jnius import cast
from jnius import java_method
from jnius import PythonJavaClass
from plyer.platforms.android import activity
from plyer.facades import SpatialOrientation
Context = autoclass('android.content.Context')
Sensor = autoclass('android.hardware.Sensor')
SensorManager = autoc... |
# -*- 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):
# Adding field 'VariantEffect.hgvs_c'
db.add_column('variant_effect', 'hgvs_c',
self.g... |
"""
Authentication is implemented using flask_login and different environments can
implement their own login mechanisms by providing an `airflow_login` module
in their PYTHONPATH. airflow_login should be based off the
`airflow.www.login`
"""
from builtins import object
__version__ = "1.7.1.3"
import logging
import os
... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'window.ui'
#
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.... |
"""Unit tests for the events module."""
from collections import namedtuple
from datetime import datetime
from io import BytesIO
import logging
import os
import sys
import time
import pytest
from pydicom.dataset import Dataset
from pydicom.tag import BaseTag
from pydicom.uid import ImplicitVRLittleEndian
from pydicom... |
import matplotlib.pyplot as plt
decisionNode = dict(boxstyle="sawtooth", fc="0.8")
leafNode = dict(boxstyle="round4", fc="0.8")
arrow_args = dict(arrowstyle="<-")
def getNumLeafs(myTree):
numLeafs = 0
firstStr = list(myTree.keys())[0]
secondDict = myTree[firstStr]
for key in secondDict.keys():
... |
class UpdateCssMixin(object):
"""
Mixin for update css string in field widget attrs
"""
def _set_additional_css(self, css_data):
"""
:param css_data: dictionary, key - field name, value - additional css string
"""
for name, css_string in css_data.items():
se... |
from logging import handlers
from uuid import uuid4
import locale
import logging
import os.path
import sys
import time
import traceback
import warnings
import re
import tarfile
from CodernityDB.database_super_thread_safe import SuperThreadSafeDatabase
from argparse import ArgumentParser
from cache import FileSystemCac... |
import shutil
import tempfile
import webob
from manila import context
from manila import db
from manila import exception
from manila.openstack.common import jsonutils
from manila import test
from manila.tests.api import fakes
from manila.tests.api.v1 import stubs
def app():
# no auth, just let environ['manila.co... |
import logging
from insights.test import UITestCase
from insights.ui.navigator import Navigator
from insights.ui.session import Session
import time
LOGGER = logging.getLogger('insights_portal')
class RulestabTestCase(UITestCase):
rules_filters = ['Performance', 'Availability', 'Security', 'Stability']
def ... |
"""
.. currentmodule:: src.model.dataaccess.orm
This package contains the 'low-level' (not so deeply low, though) modules which
the Data Access Layer is built upon, i.e. the configuration of the mapping
between objects and database records, corresponding to the mapping module, and
the access to database files on disk ... |
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint, cstr, flt, get_first_day, get_last_day, has_common
from webnotes.model import db_exists
from webnotes.model.bean import copy_doclist
from webnotes import session, msgprint
import webnotes.defaults
sql = webnotes.conn.sql
from a... |
import tensorflow as tf
from constants.Constants import Constants as constants
class LearningRateFactory(object):
@classmethod
def createLearningRate(cls, optimizerParams, trainBatches, globalStepVar):
if optimizerParams.lr_params.decayPolicy == constants.LRPolicy.fixed:
learningRate = ... |
from core.generalized import GeneralizedModel
from utils.helpers import initialize_weights
import utils.functions as fns
import scipy as np
from scipy import sparse
from numpy.random import uniform
MODELFNS = { 'sigmoid': fns.sigmoid,
'tanh': np.tanh,
'linear': fns.linear }
GRADFNS = { 'si... |
import os
from setuptools import setup
import feedreader
version = feedreader.__version__
long_description = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
setup(
name = 'django-feedreader',
version = version,
packages = ['feedreader'],
include_package_data = True,
license = '... |
"""current schema
Revision ID: e3a246e0dc1
Revises:
Create Date: 2015-08-18 16:35:00.883495
"""
# revision identifiers, used by Alembic.
revision = 'e3a246e0dc1'
down_revision = None
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy import func
from sqlalchemy.eng... |
import sys
import os
import os.path
import json
import fnmatch
if sys.version_info[0] == 2:
import urllib
else:
import urllib.request as urllib
from ..dunya.makam import (get_makams, get_forms, get_usuls,
get_composers, get_artists, get_instruments)
from ..dunya.docserver im... |
from tornado import testing
from . import base
class HashTests(base.AsyncTestCase):
@testing.gen_test
def test_hset(self):
key, field, value = self.uuid4(3)
result = yield self.client.hset(key, field, value)
self.assertEqual(result, 1)
@testing.gen_test
def test_hset_return_... |
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
from past.utils import old_div
import json
import logging
import emission.an... |
from __future__ import absolute_import
import six
from sentry.plugins.bases.notify import NotifyPlugin
from sentry_plugins.base import CorePluginMixin
from sentry_plugins.utils import get_secret_field_config
from sentry.integrations import FeatureDescription, IntegrationFeatures
from .client import PushoverClient
... |
#! /usr/bin/env python
from __future__ import print_function
from openturns import *
TESTPREAMBLE()
try:
# The 1D interface
interval1D = Interval(-3, 5)
print("interval1D=", interval1D)
# The default interface
size = 2
defaultInterval = Interval(2)
print("defaultInterval=", repr(defaultIn... |
import logging
import uuid
from django.conf import settings
from django.db import models
from django.db.models import signals
try:
import json
except ImportError:
from django.utils import simplejson as json
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext... |
from CIM15.IEC61970.Core.IdentifiedObject import IdentifiedObject
class WorkFlowStep(IdentifiedObject):
"""A pre-defined set of work steps for a given type of work.A pre-defined set of work steps for a given type of work.
"""
def __init__(self, sequenceNumber=0, WorkTasks=None, status=None, Work=None, *ar... |
# -*- 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):
# Adding field 'ResourceFile.target_platforms'
db.add_column(u'ide_resour... |
import sys
import limix
from limix.core.covar import LowRankCov
from limix.core.covar import FixedCov
from limix.core.covar import FreeFormCov
from limix.core.gp import GP2KronSumLR
from limix.core.gp import GP2KronSum
import scipy as sp
import scipy.stats as st
from limix.mtSet.core.iset_utils import *
import numpy a... |
from __future__ import absolute_import, print_function, division
from collections import MutableSet
import types
import weakref
from six import string_types
def check_deterministic(iterable):
# Most places where OrderedSet is used, theano interprets any exception
# whatsoever as a problem that an optimizati... |
__author__ = "Vasyl Khomenko"
__copyright__ = "Copyright 2013, Qubell.com"
__license__ = "Apache"
__email__ = "<EMAIL>"
# from stories import base
# from stories.base import attr
#
# """
# GET /organizations$ctype<(\.json)?> boot.Boot.organizations.list(ctype)
# GET ... |
"""
Arduino
Arduino Framework allows writing cross-platform software to control
devices attached to a wide range of Arduino boards to create all
kinds of creative coding, interactive objects, spaces or physical experiences.
http://arduino.cc/en/Reference/HomePage
"""
from os import listdir, walk
from os.path import ... |
import sdl2.sdlmixer as SdlMixer
from gi.repository import Gio
from gi.repository import GObject
from gi.repository import Json
class SoundContext(GObject.GObject):
"""Plays sounds on a given context"""
__gtype_name__ = 'SoundContext'
__counter = 0
def __init__(self):
GObject.GObject.__init_... |
page_menu = [
('Home', '/'),
('Chat', '/chat'),
('Donate', '/donate'),
('Contact', '/contact-us')]
nav_for_authenticated_user = (
('Profile', '/profile'),
('Equipment', '/equipment'),
('Members', '/members'),
('Mailing List', '/mailing-list'),
('Logout', '/logout')
)
banner_images ... |
from __future__ import absolute_import, division, print_function, unicode_literals
class PluginRegistry(object):
"""A plugin registry
Custodian is intended to be innately pluggable both internally and
externally, for resource types and their filters and actions.
This plugin registry abstraction prov... |
#!/usr/bin/python
import os
import sys
import random
import time
sys.path.append(os.environ['BOREALISPATH'])
# write an experiment that creates a new control program.
from experiment_prototype.experiment_prototype import ExperimentPrototype
class BeamTest(ExperimentPrototype):
def __init__(self):
cpid ... |
import re
class GrubConfParser:
def __init__(self, contents):
self._contents = contents
@classmethod
def fromFile(cls, path):
with open(path) as f:
return cls(f.read())
def defaultKernelImage(self):
return self._entryKernelImage(self._entries()[self._defaultIndex(... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup script for PyGraphviz
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from glob import glob
import os
from setuptools import setup, Extension
import sys
from setup_commands import AddExtensionDeve... |
# coding: utf-8
from __future__ import unicode_literals
from ..util import get_doc, get_cosine, add_vecs_to_vocab
import numpy
import pytest
@pytest.fixture
def vectors():
return [("apple", [1, 2, 3]), ("orange", [-1, -2, -3])]
@pytest.fixture()
def vocab(en_vocab, vectors):
add_vecs_to_vocab(en_vocab, ve... |
import bjam
from b2.tools import common, rc
from b2.build import generators, type
from b2.build.toolset import flags
from b2.build.feature import feature
from b2.manager import get_manager
def init():
pass
type.register('MC', ['mc'])
# Command line options
feature('mc-input-encoding', ['ansi', '... |
"""Iris Classification Sample Cloud Runner.
"""
import argparse
import datetime
import os
import subprocess
import uuid
import apache_beam as beam
import tensorflow as tf
import trainer.model as iris
import google.cloud.ml as ml
import google.cloud.ml.dataflow.io.tfrecordio as tfrecordio
import google.cloud.ml.io as ... |
"""
A class for storing a tree graph. Primarily used for filter constructs in the
ORM.
"""
import copy
class Node(object):
"""
A single internal node in the tree graph. A Node should be viewed as a
connection (the root) with the children being either leaf nodes or other
Node instances.
"""
# ... |
from twisted.trial import unittest
from buildbot.process.properties import WithProperties
from buildbot.process.results import FAILURE
from buildbot.process.results import SUCCESS
from buildbot.process.results import WARNINGS
from buildbot.steps import cppcheck
from buildbot.test.fake.remotecommand import ExpectShell
... |
"""Testing the compatibility between AsyncIO stack and the old stack."""
import asyncio
import logging
import os
import random
import threading
import unittest
from concurrent.futures import ThreadPoolExecutor
from typing import Callable, Iterable, Sequence, Tuple
import grpc
from grpc.experimental import aio
from s... |
import os
import re
import sys
class CConverter():
"""
Convert C-code into BlocklyProp blocks
"""
def __init__(self):
# Initialize final component variables
self.final_variables = ""
self.final_includes = ""
self.final_content = ""
self.variable_category = "Blo... |
from operator import itemgetter
from textwrap import dedent
from openerp import tools, SUPERUSER_ID
from openerp.osv import fields, osv
class board_board(osv.osv):
_name = 'board.board'
_description = "Board"
_auto = False
_columns = {}
def create(self, cr, user, vals, context=None):
retu... |
import numpy as np
try:
import pandas as pd
except:
print('Pandas package not found.')
import sys
import warnings
import emcee
import matplotlib.pyplot as plt
from bioscrape.types import Model
from bioscrape.sbmlutil import import_sbml as sbmlutil_import_sbml
from bioscrape.simulator import ModelCSimInterface, ... |
# Dou Liu, March 14th 2017
# This file is to calculate the parameter with linear model via SVD
import numpy as np
import matplotlib.pyplot as plt
from sobol import sobol_rvs
import sample_0313
L=40
N=100
n=100
sigma=1
observe = (sobol_rvs(N,skip=1000)-0.5)*L
f = sample_0313.sample(observe,L)
xk = np.linspace(-L/2,L/... |
# -*- 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):
# Adding model 'CampusUserConfirmation'
db.create_table(u'accounts_campususerconfirmation', (
(u... |
from datetime import datetime
from pytz import UTC
from sqlalchemy.orm import joinedload, subqueryload
from uber.config import c
from uber.decorators import ajax, all_renderable, csrf_protected, department_id_adapter, render, xlsx_file
from uber.errors import HTTPRedirect
from uber.models import Attendee, Department,... |
from enigma import eServiceReference, getBestPlayableServiceReference
from ServiceReference import ServiceReference
from info import getInfo
from urllib import unquote, quote
import os
from Components.config import config
def getStream(session, request, m3ufile):
if "ref" in request.args:
sRef=unquote(unquote(reque... |
from toontown.toonbase import ToontownGlobals
from direct.interval.IntervalGlobal import Parallel, Sequence, Func, Wait
from pandac.PandaModules import Vec4, TransformState, NodePath, TransparencyAttrib
class HolidayDecorator:
def __init__(self):
self.dnaStore = base.cr.playGame.dnaStore
self.swap... |
# from UK crawler codebase
import unittest
from utils import package_utils
from utils.features import PackageFeature
import os
import logging
class PackageUtilsTest(unittest.TestCase):
def test_single_package_is_parsed(self):
input_file = os.path.join(os.path.dirname(__file__), 'single_package_apk_db'... |
import time
from six import string_types
from plumbery.polishers.base import NodeConfiguration
from plumbery.exception import ConfigurationError
from plumbery.plogging import plogging
class BackupConfiguration(NodeConfiguration):
__name__ = 'BackupConfiguration'
_element_name_ = 'backup'
_config... |
from genshi.builder import tag
from trac.core import implements,Component
from trac.ticket.api import ITicketActionController
from trac.ticket.default_workflow import ConfigurableTicketWorkflow
from trac.perm import IPermissionRequestor
from trac.config import Option, ListOption
revision = "$Rev: 11490 $"
url = "$URL... |
# akerl, 2013
# https://github.com/akerl/modlib
'''modlib maintains a stack of dynamically-loaded module objects
useful when you need to import dynamic modules with some degree of control
'''
from os.path import isfile, expanduser
from importlib import import_module
class Modstack(object):
'''formula is used by... |
from gi.repository import Gtk
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
from gramps.gen.const import URL_MANUAL_PAGE
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.transla... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
from . import api
class stock_packages(osv.osv):
_inherit = "stock.packages"
def cancel_postage(self, cr, uid, ids, context=None):
for package in self.browse(cr, uid, ids, context=context):
if package.shipping_compan... |
# -*- coding: utf-8 -*-
import os
import sys
import numpy as np
import time
import spectral_clustering_fd as scfd
from sklearn.cluster import SpectralClustering
from sklearn.datasets import make_blobs
import random
import sklearn.metrics as sm
@profile
def main():
n_samples = 2048
n_features = 16
n_cen... |
from behave import *
use_step_matcher("re")
@given("Mike is a nect tutor and has already established student dashboard")
def step_impl(context):
"""
:type context: behave.runner.Context
"""
assert False
@step("Mike is on tutor interface")
def step_impl(context):
"""
:type context: behave.ru... |
"""Test praw.models.redditor."""
from unittest import mock
import pytest
from prawcore import Forbidden
from praw.exceptions import RedditAPIException
from praw.models import Comment, Submission
from ... import IntegrationTest
class TestRedditor(IntegrationTest):
FRIEND = "PyAPITestUser3"
FRIEND_FULLNAME =... |
import array
import random
counts = []
for i in xrange(256):
t = 0
for j in xrange(8):
t = t + ((i >> j) & 1)
counts.append(chr(t))
counts = ''.join(counts)
class Bitfield(object):
def __init__(self, length, bitstring=None):
self.length = length
rlen, extra = divmod(length, 8)
... |
#!/usr/bin/env python
__author__ = 'Mike McCann,Duane Edgington,Reiko Michisaki'
__copyright__ = '2013'
__license__ = 'GPL v3'
__contact__ = 'duane at mbari.org'
__doc__ = '''
Master loader for glider CANON activities in September 2013
Mike McCann; Modified by Duane Edgington and Reiko Michisaki
MBARI 02 Sept... |
from rdflib import Graph
from schema_salad.jsonld_context import makerdf
from schema_salad.ref_resolver import ContextType
from typing import Any, Dict, IO, Text
from six.moves import urllib
from .process import Process
def gather(tool, ctx): # type: (Process, ContextType) -> Graph
g = Graph()
def visitor(... |
from unittest import mock
import os
import pytest
import http.client as httplib
from vcr import VCR, mode, use_cassette
from vcr.request import Request
from vcr.stubs import VCRHTTPSConnection
from vcr.patch import _HTTPConnection, force_reset
def test_vcr_use_cassette():
record_mode = mock.Mock()
test_vcr ... |
from azure.cognitiveservices.search.entitysearch import EntitySearchAPI
from msrest.authentication import CognitiveServicesCredentials
from azure_devtools.scenario_tests import ReplayableTest, AzureTestError
from devtools_testutils import mgmt_settings_fake as fake_settings
class EntitySearchTest(ReplayableTest):
... |
import requests
from django.conf import settings
import logging
import re
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
def get_item(item_name, item_args = '', offset = No... |
import unittest
import unittest.mock
import sys
import os
import configparser
import subprocess
import logging
sys.path.append(os.path.abspath(os.path.curdir))
import lib.config
import lib.flags
import lib.printer
import lib.worker
import lib.logsetup
import lib.ids
class Test_lib_config(unittest.TestCase):
def se... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import sys
from abc import abstractmethod
from colors import green
from pants.base.build_environment import get_buildroot
from pants.bin.goal_runner import... |
from netaddr import IPAddress
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
from neutron_dynamic_routing.api.rpc.agentnotifiers import bgp_dr_rpc_agent_api
from neutron_dynamic_routing.api.rpc.handlers import bgp_speaker_rpc as bs_rpc
from neutron.callbacks import e... |
#!/usr/bin/env python
import urllib2
import base64
import json
import xml
import sys
class RequestWithMethod(urllib2.Request):
def __init__(self, url, method, headers={}):
self._method = method
urllib2.Request.__init__(self, url, headers)
def get_method(self):
if self._method:
... |
# encoding: utf-8
from __future__ import unicode_literals
import os.path
import re
import json
import hashlib
import uuid
from .common import InfoExtractor
from ..utils import (
compat_urllib_parse,
compat_urllib_request,
ExtractorError,
url_basename,
int_or_none,
)
class SmotriIE(InfoExtractor)... |
"""
The file name should contain the representitive class/struct name.
If the file contains class/struct decls or defs, the file name should be
one of classes.
If the class/struct name starts with "C", "C" can be ommited in the file name.
== Vilolation ==
= a.h = <== Violation. It should contain class nam... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.playbook.attribute import Attribute, FieldAttribute
from ansible.playbook.base import Base
from ansible.playbook.become import Become
from ansible.playbook.conditional import Conditional
from ansible.playbook.helpers i... |
import lxml.etree
import webracer
import nose.plugins.attrib
from . import utils
from .apps import xml_app
utils.app_runner_setup(__name__, xml_app.app, 8042)
@nose.plugins.attrib.attr('client')
@webracer.config(host='localhost', port=8042)
class LxmlTest(webracer.WebTestCase):
def test_parse_xml(self):
s... |
# -*- coding: utf-8 -*-
import shutil
import os
import re
import requests
import urllib2
from pprint import pprint
from bs4 import BeautifulSoup
import html2text
import time
import argparse
import concurrent.futures
def escape_lt(html):
html_list = list(html)
for index in xrange(0, len(html) - 1):
if h... |
"""
Unit tests for edgelists.
"""
from nose.tools import assert_equal, assert_raises, assert_not_equal
import io
import tempfile
import os
import networkx as nx
from networkx.testing import (assert_edges_equal, assert_nodes_equal,
assert_graphs_equal)
class TestEdgelist:
def... |
"""
awot.util.write_kmz
========================
Functions to save AWOT data into KMZ file. These files may be displayed
for example with Google Earth.
Code was directely adapted from the NASA PyAMPR package by Timothy Lang.
https://github.com/nasa/PyAMPR/blob/master/pyampr/pyampr.py
This present method is proof of ... |
import itertools
from sympy import S, Tuple, diff, Basic
from sympy.core.compatibility import Iterable
from sympy.tensor.array import ImmutableDenseNDimArray
from sympy.tensor.array.ndim_array import NDimArray
from sympy.tensor.array.dense_ndim_array import DenseNDimArray
from sympy.tensor.array.sparse_ndim_array imp... |
# -*- coding: utf-8 -*-
"""This file contains a Symantec parser in plaso."""
from plaso.events import text_events
from plaso.lib import timelib
from plaso.parsers import manager
from plaso.parsers import text_parser
import pytz
__author__ = 'David Nides (<EMAIL>)'
class SymantecEvent(text_events.TextEvent):
"""... |
# coding: utf-8
from flask import request, abort
from flaskcms.view import CommonView
from flaskcms.lib import db
from .model import Post, Category
from flaskcms import cache
import re
class PostView(CommonView):
model = Post
category = "post"
channels = ['detail', 'list']
def get_contents(self, cha... |
#!/usr/bin/env python
# Lint as: python3
import ipaddress
import socket
from absl import app
from grr_response_core.lib import utils
from grr_response_server import ip_resolver
from grr.test_lib import test_lib
class IPResolverTest(test_lib.GRRBaseTest):
def testIPInfo(self):
args = []
def MockGetName... |
"""Utility functions used in XLNet model."""
from __future__ import absolute_import
from __future__ import division
# from __future__ import google_type_annotations
from __future__ import print_function
import json
import os
import tensorflow as tf
def create_run_config(is_training, is_finetune, flags):
"""Helpe... |
from .. import ChangesNotifier
class Parameter(ChangesNotifier):
def __init__(self, name, reboot_needed=False):
ChangesNotifier.__init__(self)
self.reboot_needed = reboot_needed
self._active = False
self.name = name
self._value = ''
@property
def active(self):
... |
import glob
import os
import re
import sys
import time
import urllib
import urllib2
from urllib2 import URLError
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'
class Cache(object):
def __init__(self, url):
home = os.en... |
'''
Highlight code snippets with highlightjs_.
**Required extensions**: :mod:`lux.extensions.ui`
Usage
=========
Include ``lux.extensions.code`` into the :setting:`EXTENSIONS` list in your
:ref:`config file <parameters>`::
EXTENSIONS = [
...
'lux.extensions.ui',
'lux.extensions.code'
... |
"""
Example DAG demonstrating the usage of BranchPythonOperator with depends_on_past=True, where tasks may be run
or skipped on alternating runs.
"""
from airflow import DAG
from airflow.operators.dummy import DummyOperator
from airflow.operators.python import BranchPythonOperator
from airflow.utils.dates import days_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import dns_failover
import logging
import logging.handlers
import os
# DNS name used by the round-robin setup
fqdn = 'sub.example.com'
# IP addresses used by the round-robin setup
ip_addresses = ['1:2:3:4', '5:6:7:8', '9:10:11:12']
# CloudFlare DNS configuration
cloudfl... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', ... |
import logging
import os
import re
import types
import neo4j_schema
log = logging.getLogger('rhizi')
class RZ_Config(object):
"""
rhizi-server configuration
TODO: config option documentation
listen_address
listen_port
log_level: upper/lower case log level as specified by the... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import argparse
from helper import check_file_existence, check_dir_existence
from qa import get_answer
import logging
import time
import json
logFormatter = logging.Formatter("%(asctime)s [%(levelname)-5.5s] %... |
"""
This module provides optional access to the csp::Object classes
registered by cspsim. To load successfully, cspsim must have been
built in the current workspace. If the cspsim module cannot be
loaded, none of the functions defined in this module will be
available.
"""
import os
import os.path
# Users of this mo... |
"""Support for Melnor RainCloud sprinkler water timer."""
from datetime import timedelta
import logging
from raincloudy.core import RainCloudy
from requests.exceptions import ConnectTimeout, HTTPError
import voluptuous as vol
from homeassistant.const import (
ATTR_ATTRIBUTION,
CONF_PASSWORD,
CONF_SCAN_INT... |
from django.utils import translation
from elasticsearch_dsl import F, query
from elasticsearch_dsl.filter import Bool
from rest_framework import serializers
from rest_framework.filters import BaseFilterBackend
from olympia import amo
from olympia.constants.categories import CATEGORIES, CATEGORIES_BY_ID
from olympia.v... |
from datetime import datetime, timedelta
from uuid import uuid4
from dateutil.tz import tzutc
from twisted.python import log
from twisted.python.reflect import safe_str
from twisted.internet.defer import maybeDeferred
from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET
from txaws.ec2... |
import hashlib
import base64
import json
from pprint import pformat
from xml.etree import ElementTree as etree # noqa
from xml.dom import minidom
from twisted.internet.protocol import Protocol
from twisted.internet import defer
from twisted.web.iweb import IBodyProducer
from zope.interface import implements
class ... |
from __future__ import print_function
import sys
import cv2
from rh_renderer.tilespec_affine_renderer import TilespecAffineRenderer
import argparse
import utils
from bounding_box import BoundingBox
from rh_renderer import models
import numpy as np
import json
from scipy.spatial import distance
from scipy import spatial... |
# -*- coding: utf-8 -*-
import json
from pyload.core.utils import parse
from ..base.multi_downloader import MultiDownloader
class OverLoadMe(MultiDownloader):
__name__ = "OverLoadMe"
__type__ = "downloader"
__version__ = "0.20"
__status__ = "testing"
__pattern__ = r"https?://.*overload\.me/.+"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.