content stringlengths 4 20k |
|---|
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
RETURNS = '''
aos_session:
description: Authenticated session information
returned: always
type: dict
sample: { 'url': <str>, 'headers': {...} }
'''
from ansible.module_u... |
__author__ = 'api.jscudder (Jeff Scudder)'
import urlparse
import urllib
DEFAULT_PROTOCOL = 'http'
DEFAULT_PORT = 80
def parse_url(url_string):
"""Creates a Url object which corresponds to the URL string.
This method can accept partial URLs, but it will leave missing
members of the Url unset.
"""
par... |
from gm_base.polygons.polygons import PolygonDecomposition
import gm_base.polygons.merge as merge
import numpy as np
import pytest
# def test_deep_copy(self):
# print("===== test deep_copy")
# da = PolygonDecomposition()
# da.add_line((0, 0), (1,0))
# sb, = da.add_line((0, 0), (0, 1))
# da.add_line(... |
"""
Test module for Entrance Exams AJAX callback handler workflows
"""
import json
from mock import patch
from django.conf import settings
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from contentstore.tests.utils import AjaxEnabledTestClient, CourseTestCase
from contentst... |
"""A fast event management system.
This module provides a fast event management system as well as related
event classes and interfaces to make python objects easily event
capable.
"""
from EventManager import EventManager
from Signals import Event, EventCallback
from INotifyable import INotifyable
from Subject impor... |
from common.statistical_analyzer import StatisticalAnalyzer
from common.statistical_analyzer import PrintColors
class LidarEndToEndAnalyzer(object):
"""
Control analyzer
"""
def __init__(self):
"""
Init
"""
self.control_endtoend_latency = []
self.control_unproc... |
"""
Utility functions for capa.
"""
import bleach
from decimal import Decimal
from calc import evaluator
from cmath import isinf, isnan
import re
from lxml import etree
#-----------------------------------------------------------------------------
#
# Utility functions used in CAPA responsetypes
default_tolerance = '0... |
import htcondor
import redis
import time
import json
import classad
def setup_redis_connection():
r = redis.StrictRedis(host="htcs-master.heprc.uvic.ca", port=6379, db=0, password=~NEED THE PW HERE~)
return r
def import_condor_info():
try:
redis_con = setup_redis_connection()
condor_reso... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: java_cert
version_added: '2.3'
short_description: Uses keyto... |
"""Test that the clang modules cache directory can be controlled."""
import unittest2
import os
import shutil
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ObjCModulesTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
myd... |
"""Simple script to convert CSV output from rf_benchmark to Markdown format.
The input CSV should have the following fields:
- CNN
- input resolution
- end_point
- RF size hor
- RF size ver
- effective stride hor
- effective stride ver
- effective padding hor
- effective padding ver
Since usually in all cases the par... |
"""Misc threading module tests
Made for Jython.
"""
from __future__ import with_statement
import random
import subprocess
import sys
import threading
import time
import unittest
from subprocess import PIPE, Popen
from test import test_support
from threading import Condition, Lock, Thread
from java.lang import Thread... |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... |
import os
import sys
def main():
testing = False
if len(sys.argv) > 1 and sys.argv[1] == 'test':
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")
testing = True
else:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "squad.settings")
from django.core.management i... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import hosting.validators
class Migration(migrations.Migration):
dependencies = [
('hosting', '0002_auto_20140924_0745'),
]
operations = [
migrations.AlterField(
model_na... |
from __future__ import absolute_import
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from zerver.lib.actions import send_referral_event
from zerver.models import get_user_profile_by_email
class Command(BaseCommand):
help = """Grants a user invites... |
"""
A sub-package for efficiently dealing with polynomials.
Within the documentation for this sub-package, a "finite power series,"
i.e., a polynomial (also referred to simply as a "series") is represented
by a 1-D numpy array of the polynomial's coefficients, ordered from lowest
order term to highest. For example, a... |
import json
import os
from decimal import Decimal
from django.core.urlresolvers import reverse
from django.test import TestCase
from scampcat.scamp.models import Annotation, Scamp
here = lambda *x: os.path.join(os.path.dirname(os.path.realpath(__file__)), *x)
class ScampTest(TestCase):
"""Test our scamps man..... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.become import BecomeBase
class BecomeModule(BecomeBase):
name = 'dzdo'
# messages for detecting prompted password issues
fail = ('Sorry, try again.',)
def build_become_command(self, cmd, sh... |
import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Werror',
'-Wno-long-long',
'-Wno-variadic-macros',
'-Wno-missing-... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import Permission
class Migration(DataMigration):
depends_on = (
("guardian", "0005_auto... |
import logging
import json
import sys
from jobbrowser.apis.base_api import Api, MockDjangoRequest, _extract_query_params, is_linkable, hdfs_link_js
from liboozie.oozie_api import get_oozie
if sys.version_info[0] > 2:
from django.utils.translation import gettext as _
else:
from django.utils.translation import uget... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.plugins.lookup import LookupBase
from ansible.module_utils._text import to_text
try:
from __main__ import display
except ImportError:
from ansible.ut... |
"""embrane_lbaas_driver
Revision ID: 33dd0a9fa487
Revises: 19180cf98af6
Create Date: 2014-02-25 00:15:35.567111
"""
# revision identifiers, used by Alembic.
revision = '33dd0a9fa487'
down_revision = '19180cf98af6'
from alembic import op
import sqlalchemy as sa
from neutron.db import migration
def upgrade():
... |
from invenio.legacy.dbquery import run_sql
depends_on = ['invenio_release_1_1_0']
def info():
return "Adds table to log citation dict changes"
def do_upgrade():
run_sql("""
CREATE TABLE IF NOT EXISTS rnkCITATIONLOG (
id int(11) unsigned NOT NULL auto_increment,
citee int(10) unsigned NOT NULL,
citer ... |
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import status
from django.utils.translation import ugettext as _
from seaserv import seafile_a... |
import os
import logging
import sys
from autotest.client import test
from autotest.client import utils
from autotest.client.shared import git, error, software_manager
class kernelinstall(test.test):
version = 1
sm = software_manager.SoftwareManager()
def _kernel_install_rpm(self, rpm_file, kernel_deps_rp... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_unzip
version_added: "2.0"
short_description: Unzips compressed files and archives on the Windows node
description:
- Unzips compressed files a... |
""" Test functions for the sparse.linalg.eigen.lobpcg module
"""
from __future__ import division, print_function, absolute_import
import itertools
import platform
import numpy as np
from numpy.testing import (assert_almost_equal, assert_equal,
assert_allclose, assert_array_less)
import pyt... |
import os
from testscenarios.testcase import TestWithScenarios
from testtools import TestCase
from jenkins_jobs.modules import parameters
from tests.base import get_scenarios, BaseTestCase
class TestCaseModuleParameters(TestWithScenarios, BaseTestCase, TestCase):
fixtures_path = os.path.join(os.path.dirname(__fil... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author Jonas Ohrstrom <<EMAIL>>
import sys
import time
import os
import socket
import string
import logging
import logging.config
import atexit
import socket
import threading
import SocketServer
from optparse import *
from configobj import Confi... |
from __future__ import unicode_literals
import datetime
import uuid
from django.db import models
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Author(models.Model):
name = models.CharField(max_length=100)
class Meta:
or... |
#!/usr/bin/python -u
#
# this test exercise the XPath basic engine, parser, etc, and
# allows to detect memory leaks
#
import sys
import libxml2
instance="""<?xml version="1.0"?>
<tag xmlns:foo='urn:foo' xmlns:bar='urn:bar' xmlns:baz='urn:baz' />"""
def namespaceDefs(node):
n = node.nsDefs()
while n:
... |
microcode = '''
def macroop FLDL2E {
lfpimm ufp1, 1.44269504089
movfp st(-1), ufp1, spm=-1
};
def macroop FLDL2T {
lfpimm ufp1, 3.32192809489
movfp st(-1), ufp1, spm=-1
};
def macroop FLDLG2 {
lfpimm ufp1, 0.30102999566
movfp st(-1), ufp1, spm=-1
};
def macroop FLDLN2 {
lfpimm ufp1, 0.69... |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006 (ita)
"intltool support"
import os, re
import Configure, TaskGen, Task, Utils, Runner, Options, Build, config_c
from TaskGen import feature, before, taskgen
from Logs import error
"""
Usage:
bld(features='intltool_in', source='a.po b.po', podir='po', cache... |
import uuid
import redis
from rq import Connection, Queue
import ml.cnn_mnist
import ml.code1 as code1
import ml.code2 as code2
import ml.mnist_softmax as mnist_softmax
import sandbox.fib
from util.config import config
from util.log import log
from util.singleton import SingletonMixin
train_actions = {
'fib': sa... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
try:
from f5.bigip.contexts import TransactionContextManager
from f5.bigip import ManagementRoot
from icontrol.session import iControlUnexpectedHTTPError
HAS_F5SDK... |
"""Parse the report output of the llvm test suite or regression tests,
filter out known failures, and check for new failures
pnacl/scripts/parse_llvm_test_report.py [options]+ reportfile
"""
import csv
import logging
import optparse
import os
import sys
import StringIO
# exclude these tests
EXCLUDES = {}
def Pa... |
import random
import pygame
import entity
import global_vars as g
EVENT_NONE = 0
EVENT_FODDER = 1
EVENT_SINE = 2
EVENT_GRUNT = 3
EVENT_SENTRY = 4
EVENT_HPUP = 5
EVENT_SCOPE = 6
EVENT_AS = 7
enemySpawn = {EVENT_FODDER: [], EVENT_SINE: [],
EVENT_GRUNT: [], EVENT_SENTRY: []}
buffSpawn = {... |
from . import indexstoredb
from . import product
class SourceKitLSP(product.Product):
@classmethod
def product_source_name(cls):
return "sourcekit-lsp"
@classmethod
def is_build_script_impl_product(cls):
return False
def should_build(self, host_target):
return True
d... |
"""
Completer providing completions in a Q(Plain)TextEdit.
"""
from PyQt5.QtCore import QEvent, QModelIndex, Qt
from PyQt5.QtGui import QKeySequence, QTextCursor
from PyQt5.QtWidgets import QCompleter
class Completer(QCompleter):
"""A QCompleter providing completions in a Q(Plain)TextEdit.
Use setWidge... |
from pyqrllib.pyqrllib import hstr2bin
from unittest import TestCase
from qrl.core.misc import logger
from qrl.core.AddressState import AddressState
from qrl.core.MultiSigAddressState import MultiSigAddressState
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.txs.multisig.MultiSigCreate ... |
"""
Tests for offline_gradecalc.py
"""
import json
from mock import patch
from courseware.models import OfflineComputedGrade
from student.models import CourseEnrollment
from student.tests.factories import UserFactory
from xmodule.graders import Score
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modules... |
#!/usr/bin/env python
import sys
import getopt
import pkg_resources
pkg_resources.require('Trac')
from trac.config import Configuration
from trac.ticket.default_workflow import parse_workflow_config
_debug = True
def debug(s):
if _debug:
sys.stderr.write(s)
def readconfig(filename):
"""Returns a li... |
"""text_file
provides the TextFile class, which gives an interface to text files
that (optionally) takes care of stripping comments, ignoring blank
lines, and joining lines with backslashes."""
__revision__ = "$Id$"
import sys
class TextFile:
"""Provides a file-like object that takes care of all the things yo... |
__version__ = '3.0.0a3' |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
make_code_info.py
Makes the document entries for the documents section.
See the README.md file for more information.
http://researchinschools.org
"""
#...for the Operating System stuff.
import os
#...for parsing the arguments.
import argparse
#...for the lo... |
r"""plistlib.py -- a tool to generate and parse MacOSX .plist files.
The property list (.plist) file format is a simple XML pickle supporting
basic object types, like dictionaries, lists, numbers and strings.
Usually the top level object is a dictionary.
To write out a plist file, use the writePlist(rootObject, pathO... |
"""Fake RPC implementation which calls proxy methods directly with no
queues. Casts will block, but this is very useful for tests.
"""
import inspect
import time
import eventlet
from nova.openstack.common import jsonutils
from nova.openstack.common.rpc import common as rpc_common
CONSUMERS = {}
class RpcContext(... |
from __future__ import unicode_literals, division, absolute_import
import copy
import logging
from path import path
from flexget import plugin
from flexget.event import event
from flexget.config_schema import one_or_more
from flexget.utils.log import log_once
from flexget.utils.template import RenderError
from flexge... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import getpass
import json
from ansible.errors import AnsibleError, AnsibleOptionsError
from ansible.module_utils.six.moves import input
from ansible.module_utils.six.moves.urllib.parse import quote as urlquote, urlparse
from ansi... |
#
# shift_jis_2004.py: Python Unicode Codec for SHIFT_JIS_2004
#
# Written by Hye-Shik Chang <<EMAIL>>
#
import _codecs_jp, codecs
import _multibytecodec as mbc
codec = _codecs_jp.getcodec('shift_jis_2004')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEncoder(mbc.M... |
import re
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.comments import signals
from django.contrib.comments.models import Comment
from regressiontests.comment_tests.models import Article, Book
from regressiontests.comment_tests.tests import CommentTestCase
post_redir... |
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import QLabel, QDialog, QWidget, QGridLayout
from PyQt5.Qsci import QsciScintilla, QsciScintillaBase, QsciLexerPython, QsciAPIs
class Calltip(QLabel):
def __init__(self, editor, lpos, parent=None):
self.lpos = lpos
self.edi... |
class Status:
SEEN = u'\\Seen'
ANSWERED = u'\\Answered'
DELETED = u'\\Deleted'
RECENT = u'\\Recent'
FLAGS_TO_STATUSES = {
SEEN: 'read',
ANSWERED: 'replied',
RECENT: 'recent'
}
@staticmethod
def from_flag(flag):
return Status.FLAGS_TO_STATUSES[flag]
... |
from panda3d.core import *
from string import lower
class DirectLight(NodePath):
def __init__(self, light, parent):
# Initialize the superclass
NodePath.__init__(self)
# Record light and name
self.light = light
# Attach node to self
self.assign(parent.attach... |
from collections import defaultdict
from openerp.tools import mute_logger
from openerp.tests import common
UID = common.ADMIN_USER_ID
class TestORM(common.TransactionCase):
""" test special behaviors of ORM CRUD functions
TODO: use real Exceptions types instead of Exception """
def setUp(self):... |
""" Fixer for itertools.(imap|ifilter|izip) --> (map|filter|zip) and
itertools.ifilterfalse --> itertools.filterfalse (bugs 2360-2363)
imports from itertools are fixed in fix_itertools_import.py
If itertools is imported as something else (ie: import itertools as it;
it.izip(spam, eggs)) method calls w... |
from __future__ import print_function, absolute_import
import czmq
from ._malamute_ctypes import MlmClient
try:
range = xrange
except NameError:
pass
class MalamuteError(Exception):
pass
def _list_to_zmsg(parts):
assert isinstance(parts, (list, tuple))
zmsg = czmq.Zmsg()
for p in parts:
... |
"""Make sure that existing Koogeek P1EU support isn't broken."""
from homeassistant.helpers import device_registry as dr, entity_registry as er
from tests.components.homekit_controller.common import (
Helper,
setup_accessories_from_file,
setup_test_accessories,
)
async def test_koogeek_p1eu_setup(hass):... |
from __future__ import unicode_literals
from datetime import date
from django.test import TestCase
from .models import Article
class MethodsTests(TestCase):
def test_custom_methods(self):
a = Article.objects.create(
headline="Parrot programs in Python", pub_date=date(2005, 7, 27)
)
... |
from __future__ import absolute_import
from __future__ import unicode_literals
from .. import mock
from .testcases import DockerClientTestCase
from compose.project import Project
from compose.service import ConvergenceStrategy
class ResilienceTest(DockerClientTestCase):
def setUp(self):
self.db = self.cr... |
microcode = '''
def macroop PSRLW_XMM_XMM {
msrl xmmh, xmmh, xmmlm, size=2, ext=0
msrl xmml, xmml, xmmlm, size=2, ext=0
};
def macroop PSRLW_XMM_M {
ldfp ufp1, seg, sib, disp, dataSize=8
msrl xmml, xmml, ufp1, size=2, ext=0
msrl xmmh, xmmh, ufp1, size=2, ext=0
};
def macroop PSRLW_XMM_P {
rdip... |
"""Validate dependencies."""
import pathlib
import re
from typing import Dict
import voluptuous as vol
from voluptuous.humanize import humanize_error
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import config_validation as cv
from homeassistant.util.yaml import load_yaml
from .m... |
"""Support for Tellstick lights using Tellstick Net."""
import logging
from homeassistant.components import light, tellduslive
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .entry ... |
"""Parsing TRANSFAC files
"""
from Bio import motifs
from Bio.Alphabet import IUPAC
__docformat__ = "restructuredtext en"
class Motif(motifs.Motif, dict):
"""A Bio.motifs.transfac.Motif stores the information in one TRANSFAC
motif. This class inherits from the Bio.motifs.Motif base class, as well
as from a Pytho... |
"""Module :mod:`sklearn.kernel_ridge` implements kernel ridge regression."""
# Authors: Mathieu Blondel <<EMAIL>>
# Jan Hendrik Metzen <<EMAIL>>
# License: BSD 3 clause
import numpy as np
from .base import BaseEstimator, RegressorMixin
from .metrics.pairwise import pairwise_kernels
from .linear_model.ridge ... |
# -*- coding: utf-8 -*-
from rest_framework import serializers
from .models import (
NestedRouterMixinUserModel as UserModel,
NestedRouterMixinGroupModel as GroupModel,
NestedRouterMixinPermissionModel as PermissionModel,
NestedRouterMixinTaskModel as TaskModel,
NestedRouterMixinBookModel as BookMo... |
"""This module contains the various challenge types"""
from maproulette.models import Challenge
from flask.ext.restful import fields
challenge_types = {}
# The default challenge type. Other challenge types should
# inherit from this.
class Default(Challenge):
"""The default challenge class"""
# the allowe... |
# -*- coding: utf-8 -*-
#
# LICENCE MIT
#
# DESCRIPTION Callgraph operators ast nodes.
#
# AUTHOR Michal Bukovsky <<EMAIL>>
#
from callgraph.ast_tree import Node
from callgraph.symbols import ConstantSymbol, merge_symbols
class UnaryOpBaseNode(Node):
def load(self, printer, ctx):
return sel... |
from Base import BaseRepository
from offlineimap import folder
from offlineimap.ui import getglobalui
import os
from stat import *
class MaildirRepository(BaseRepository):
def __init__(self, reposname, account):
"""Initialize a MaildirRepository object. Takes a path name
to the directory holding a... |
import multiprocessing as mp
import time
import gym
import IPython
import pickle
import numpy as np
from joblib import Parallel, delayed
from keras.layers import Dense
from keras.models import Input, Model, Sequential, clone_model
from keras.optimizers import Adam
import argparse
import matplotlib.pyplot as plt
import ... |
from __future__ import unicode_literals
from guessit import UnicodeMixin, s, u, base_text_type
from guessit.language import Language
from guessit.country import Country
import json
import datetime
import logging
log = logging.getLogger(__name__)
class Guess(UnicodeMixin, dict):
"""A Guess is a dictionary which h... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import hypothesis.strategies as st
from hypothesis import given
import numpy as np
from caffe2.python import core
import caffe2.python.hypothesis_test_uti... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from units.compat.mock import patch
from ansible.module_utils.six.moves import builtins
# Functions being tested
from ansible.module_utils.basic import get_platform
from ansible.module_utils.basic import get_all_subc... |
"""Code for making a service.TestService more amenable to use in tests."""
import collections
import threading
import six
# test_control, _service, and test_interfaces are referenced from specification
# in this module.
from grpc.framework.common import cardinality
from grpc.framework.common import style
from grpc.f... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.ansible_tower import TowerModule, tower_auth_config, tower_check_... |
import os
import optparse
from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
from webkitpy.layout_tests.layout_package.bot_test_expectations import BotTestExpectationsFactory
from webkitpy.layout_tests.models.test_expectations import TestExpectationParser, TestExpectationsModel, TestExpectations
from... |
"""The tests for the MQTT switch platform."""
import pytest
from homeassistant.components import switch
from homeassistant.const import ATTR_ASSUMED_STATE, STATE_OFF, STATE_ON
import homeassistant.core as ha
from homeassistant.setup import async_setup_component
from .test_common import (
help_test_availability_wh... |
#!/usr/bin/env python
from numpy.random import seed
seed(42)
parameter_list=[[7],[8]]
def kernel_custom_modular (dim=7):
from numpy.random import rand, seed
from numpy import array, float32, int32
from modshogun import RealFeatures
from modshogun import CustomKernel
from modshogun import IndexFeatures
seed(17)... |
from openerp.osv import orm, fields
class SaleOrder(orm.Model):
"""Add text comment"""
_inherit = "sale.order"
_columns = {
'comment_template1_id': fields.many2one(
'base.comment.template',
'Top Comment Template'),
'comment_template2_id': fields.many2one(
... |
from katello.client.api.base import KatelloAPI
from katello.client.lib.utils.encoding import u_str
# pylint: disable=R0904
class DistributorAPI(KatelloAPI):
"""
Connection class to access environment calls
"""
def create(self, name, version, org, environment_id, cp_type='candlepin'):
if environ... |
"""Hook for Telegram"""
from typing import Optional
import telegram
import tenacity
from airflow.exceptions import AirflowException
from airflow.hooks.base import BaseHook
class TelegramHook(BaseHook):
"""
This hook allows you to post messages to Telegram using the telegram python-telegram-bot library.
... |
from django.conf import settings
from . import defaults
__title__ = 'fobi.contrib.plugins.form_elements.fields.' \
'select_multiple_model_objects.conf'
__author__ = 'Artur Barseghyan <<EMAIL>>'
__copyright__ = '2014-2017 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = ('get_setting',)
def g... |
import socket
import fcntl
import gobject
import struct
import subprocess
from blueman.Lib import get_net_address
class DhcpClient(gobject.GObject):
__gsignals__ = {
#arg: interface name eg. ppp0
'connected' : (gobject.SIGNAL_NO_HOOKS, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)),
'error-occurred' : (gobject.S... |
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import (assert_array_almost_equal, assert_less,
assert_equal, assert_not_equal,
assert_raises)
from sklearn.decomposition import PCA, KernelPCA
from sklearn.datasets import mak... |
from __future__ import print_function
# Copyright (c) 2014 Intel Corporation.
#
# 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 ... |
import sqlalchemy
def upgrade(migrate_engine):
meta = sqlalchemy.MetaData(bind=migrate_engine)
user_creds = sqlalchemy.Table('user_creds', meta, autoload=True)
user_creds.c.service_user.drop()
user_creds.c.service_password.drop()
def downgrade(migrate_engine):
meta = sqlalchemy.MetaData(bind=m... |
"""Importer for an exported TensorFlow model.
This module provides a function to create a SessionBundle containing both the
Session and MetaGraph.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from tensorflow.contrib.session_bundle import c... |
# Module to calculate PN strain waveforms. The output will be members of the gwylm class.
'''
References
[1] "Comparison of post-Newtonian templates ... "
Buonanno, Iyer, Ochsner et al
https://arxiv.org/pdf/0907.0700.pdf
** NONSPINNING
[2] https://arxiv.org/pdf/1502.01747v1.pdf
** GENERAL SPINS
PLAN... |
"""SCons.Warnings
This file implements the warnings framework for SCons.
"""
__revision__ = "src/engine/SCons/Warnings.py 2014/09/27 12:51:43 garyo"
import sys
import SCons.Errors
class Warning(SCons.Errors.UserError):
pass
class WarningOnByDefault(Warning):
pass
# NOTE: If you add a new warning clas... |
if __name__<>"package":
from gui import *
class ErrorDialog:
def __init__(self, sErrorMsg, sErrorHelpMsg="", sTitle="Error Message"):
self.win = DBModalDialog(50, 50, 150, 90, sTitle)
self.win.addFixedText("lblErrMsg", 5, 5, 190, 25, sErrorMsg)
self.win.addFixedText("lblErrHelpMsg", 5, 3... |
# Dictionaries of Dictionaries (of Dictionaries)
# The next several questions concern the data structure below for keeping
# track of Udacity's courses (where all of the values are strings):
# { <hexamester>, { <class>: { <property>: <value>, ... },
# ... },
# ... }
# For ... |
import time
import contextlib
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
)
sessionmaker_ = sessionmaker
@contextlib.contextmanager
def no_context(q):
yield q
@contextlib.contextmanager
def close_session_connection(query):
try:
yield query
finally:
try:
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from copy import deepcopy
class Attribute:
def __init__(self, isa=None, private=False, default=None, required=False, listof=None, priority=0, always_post_validate=False):
self.isa = isa
self.private = private... |
"""
Surface helpers.
"""
from math import cos, sin, tan, atan2, radians
from . import cairo
from .units import size
# Python 2/3 management
# pylint: disable=C0103
try:
Error = cairo.Error
except AttributeError:
Error = SystemError
# pylint: enable=C0103
class PointError(Exception):
"""Exception raise... |
"""
Transforms related to document parts.
"""
__docformat__ = 'reStructuredText'
import re
import sys
from docutils import nodes, utils
from docutils.transforms import TransformError, Transform
class SectNum(Transform):
"""
Automatically assigns numbers to the titles of document sections.
It is possi... |
"""
Functions for creating an Android.mk from already created dictionaries.
"""
import os
def write_group(f, name, items, append):
"""Helper function to list all names passed to a variable.
Args:
f: File open for writing (Android.mk)
name: Name of the makefile variable (e.g. LOCAL_CFLAGS)
items: list... |
"""
Storing files according to a custom storage system
``FileField`` and its variations can take a ``storage`` argument to specify how
and where files should be stored.
"""
import os
import random
import tempfile
from django.db import models
from django.core.files.storage import FileSystemStorage
temp_storage_loca... |
"""Checks third-party licenses for the purposes of the Android WebView build.
The Android tree includes a snapshot of Chromium in order to power the system
WebView. This tool checks that all code uses open-source licenses compatible
with Android, and that we meet the requirements of those licenses. It can also
be use... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.