content stringlengths 4 20k |
|---|
"""Methods to allow generator of dict with numpy arrays (deprecated).
This module and all its submodules are deprecated. See
[contrib/learn/README.md](https://www.tensorflow.org/code/tensorflow/contrib/learn/README.md)
for migration instructions.
"""
from __future__ import absolute_import
from __future__ import divis... |
import GemRB
from GUIDefines import *
from ie_stats import *
import CharGenCommon
import GUICommon
import CommonTables
RaceWindow = 0
TextAreaControl = 0
DoneButton = 0
RacialEnemyTable = 0
RaceCount = 0
TopIndex = 0
#the size of the selection list
LISTSIZE = 6
def DisplayRaces():
global TopIndex
TopIndex=GemRB.Ge... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
las2lasPro_filter.py
---------------------
Date : October 2014
Copyright : (C) 2014 by Martin Isenburg
Email : martin near rapidlasso point com
*********... |
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... |
# -*- coding: utf-8 -*-
#
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from django.db import transaction
from django.utils import timezone
from rest_framework.renderers import JSONRenderer
from rest_framework.request import Request
from jumpserver.utils import curre... |
import json
from django.utils.translation import ugettext as _
from desktop.lib.django_util import JsonResponse
from desktop.lib.exceptions_renderable import PopupException
from filebrowser.views import display, listdir_paged
def _get_acl_name(acl):
return ('default:' if acl['isDefault'] else '') + acl['type'] + ... |
"""
Clef OAuth support.
This contribution adds support for Clef OAuth service. The settings
SOCIAL_AUTH_CLEF_KEY and SOCIAL_AUTH_CLEF_SECRET must be defined with the
values given by Clef application registration process.
"""
from social.backends.oauth import BaseOAuth2
class ClefOAuth2(BaseOAuth2):
"""Clef OAut... |
import sys
import traceback
import urllib2
from Util import Util as MarketplaceUtil
from stratuslab.Exceptions import InputException, ExecutionException
from stratuslab.ManifestInfo import ManifestInfo
import stratuslab.Util as Util
from stratuslab import Defaults
from stratuslab.ConfigHolder import ConfigHolder
from ... |
#!/usr/bin/env python
# encoding: utf-8
'''
Created on January 4, 2019
@author: David Moss
'''
# Push notification sound library
PUSH_SOUND_ALARM = "alarm.wav"
PUSH_SOUND_BEEP = "beep.wav"
PUSH_SOUND_BELL = "bell.wav"
PUSH_SOUND_BIRD = "bird.wav"
PUSH_SOUND_BLING = "bling.wav"
PUSH_SOUND_CAMERA = "camera_shutter.wav"
... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
orderedSet,
unescapeHTML,
)
class StanfordOpenClassroomIE(InfoExtractor):
IE_NAME = 'stanfordoc'
IE_DESC = 'Stanford Open ClassRoom'
_VALID_URL = r'https?://openclassroom... |
import gdb
import re
class CallerIs(gdb.Function):
"""Check the calling function's name.
Usage:
$_caller_is(name [, number_of_frames])
Arguments:
name: The name of the function to search for.
number_of_frames: How many stack frames to traverse back from the currently
selected frame to compare with. ... |
"""Unit test utilities for gtest_xml_output"""
__author__ = '<EMAIL> (Sean Mcafee)'
import re
from xml.dom import minidom, Node
import gtest_test_utils
GTEST_OUTPUT_FLAG = '--gtest_output'
GTEST_DEFAULT_OUTPUT_FILE = 'test_detail.xml'
class GTestXMLTestCase(gtest_test_utils.TestCase):
"""
Base class f... |
from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.comments.models import Comment
from django.utils.translation import ugettext_lazy as _, ungettext_lazy
from django.contrib.comments import get_model
from django.contrib.comments.v... |
"""deCONZ lock platform tests."""
from unittest.mock import patch
from homeassistant.components.lock import (
DOMAIN as LOCK_DOMAIN,
SERVICE_LOCK,
SERVICE_UNLOCK,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
STATE_LOCKED,
STATE_UNAVAILABLE,
STATE_UNLOCKED,
)
from .test_gateway impo... |
# -*- coding: utf-8 -*-
import random
import copy
dMaxPerturbation = 0.3
iNumCopiesElite = 1
iNumElite = 4
class SGenome(object):
def __init__(self, w, f=0.0):
self._vecWeights = w
self._dFitness = f
def __lt__(self, rhs):
return self._dFitness < rhs._dFitness
class CGenAlg(object):
def __init__(... |
import gc
import logging
import os
import platform
import time
class MemoryProfileDumper(object):
def __init__(self, settings):
self.settings = settings
self.last_memory_dump = 0
self.memory_dump_counter = 0
self.started = time.time()
def dump_memory_profile(self, msg):
... |
"""Demo of the tfdbg curses UI: A TF v2 network computing Fibonacci sequence."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
import absl
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
impo... |
from __future__ import absolute_import, division, print_function, with_statement
__all__ = ['Condition', 'Event', 'Semaphore', 'BoundedSemaphore', 'Lock']
import collections
from tornado import gen, ioloop
from tornado.concurrent import Future
class _TimeoutGarbageCollector(object):
"""Base class for objects t... |
import os
import stat
import mutlib
import rpl_admin
from mysql.utilities.exception import MUTLibError
_LOGNAME = "temp_log.txt"
class test(rpl_admin.test):
"""test replication administration commands
This tests checks handling of accessibility of the log file (BUG#14208415)
"""
def check_prerequisit... |
import json
import os
import random
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
# List of configuration experiments for correctness fuzzing.
# List of <probability>, <1st config name>, <2nd config name>, <2nd d8>.
# Probabilities must add up to 100.
with open(os.path.join(THIS_DIR, 'v8_fuzz_experiments.json... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Call Web2py scheduler in app models context and run a specified task using
# its scheduled arguments. Two options for running this script:
#
# cd web2py
# python applications/<app>/static/scripts/tools/run_scheduler_tasks.py --app=<app> --task=<task>
# -- or --
# export... |
"""Class representing an X.509 certificate chain."""
from .utils import cryptomath
from .utils.tackwrapper import *
from .utils.pem import *
from .x509 import X509
class X509CertChain(object):
"""This class represents a chain of X.509 certificates.
@type x509List: list
@ivar x509List: A list of L{tlslite... |
"""Tests for dispatch module."""
import os
import unittest
import set_sys_path # Update sys.path to locate mod_pywebsocket module.
from mod_pywebsocket import dispatch
from mod_pywebsocket import handshake
from test import mock
_TEST_HANDLERS_DIR = os.path.join(
os.path.split(__file__)[0], 'testdata', 'h... |
#!/usr/bin/env python2.5
##
# Dynamically overloaded functions.
#
# This is an implementation of (dynamically, or run-time) overloaded
# functions; also known as generic functions or multi-methods.
#
# This module is from Python SVN,
# http://svn.python.org/view/sandbox/trunk/overload/overloading.py
##
"""Dynamically... |
"""
Copyright (C) 2014, 申瑞珉 (Ruimin Shen)
This program 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 License, or
(at your option) any later version.
This program is distributed i... |
"""Tests of `multi_worker_training_state.py` utilities."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
from absl.testing import parameterized
from tensorflow.python.distribute import combinations
from tensorflow.python.distribute imp... |
import random
import gevent
from zerorpc import zmq
import zerorpc
from testutils import teardown, random_ipc_endpoint
def test_sub_events():
endpoint = random_ipc_endpoint()
server_events = zerorpc.Events(zmq.ROUTER)
server_events.bind(endpoint)
server = zerorpc.ChannelMultiplexer(server_events)
... |
import tornado.ioloop
import tornado.web
import os
import pandas as pd
import numpy as np
import json
import pickle as pk
class DayInfo(object):
def __init__(self,Name,Date,Visitors,Mvts,SampleRate):
self.Name = Name
self.Date = Date
self.Visitors = Visitors
self.TotalVisits = Visito... |
""" Python 'bz2_codec' Codec - bz2 compression encoding
Unlike most of the other codecs which target Unicode, this codec
will return Python string objects for both encode and decode.
Adapted by Raymond Hettinger from zlib_codec.py which was written
by Marc-Andre Lemburg (<EMAIL>).
"""
import... |
from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtGui import QStandardItem, QStandardItemModel
from PyQt5 import QtCore
from UI.ui_main import Ui_MainWindow
from UI.settings import SettingsUI
from UI.sequence import SequenceUI
from UI.updater import UpdaterUI
from database import Settings, Data
from thread_controlle... |
from ctypes import byref, c_double
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope
from django.contrib.gis.gdal.error import (
GDALException, OGRIndexError, SRSException,
)
from django.contrib.gis.gdal.feature import Feature
from django.contrib.g... |
#!/usr/bin/env python
'''
Copyright (C) 2010 Nick Drobchenko, <EMAIL>
Copyright (C) 2005 Aaron Spike, <EMAIL>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at y... |
import os
import subprocess
import click
import boto3
from botocore.exceptions import ClientError
class CreateBucketIfNotExistsDeployStepAction(object):
def __init__(self, full_config, step_config):
self.bucket_name_prefix = step_config.get("BucketNamePrefix", "")
def run(self):
... |
from config_common.rhn_log import log_debug, die
import handler_base
import sys
class Handler(handler_base.HandlerBase):
def run(self):
log_debug(2)
r = self.repository
files = r.list_files()
if not files:
die(1, "No managed files.")
label = "Config Channel"
... |
#!/usr/bin/python
"""
Create the database and the user/role, associate it in case,
the database does not exists.
"""
import sys
import psycopg2
import logging
from datetime import datetime, timedelta
import time
from pyramid.paster import get_appsettings, setup_logging
from sqlalchemy.engine.url import make_url
con... |
"""Error codes for PostgresSQL
This module contains symbolic names for all PostgreSQL error codes.
"""
# psycopg2/errorcodes.py - PostgreSQL error codes
#
# Copyright (C) 2006-2010 Johan Dahlin <<EMAIL>>
#
# psycopg2 is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser Genera... |
'''
Created on 15/03/2011
@author: gerson
'''
from django.contrib.auth.models import User, AnonymousUser
from tardis.tardis_portal.models import UserProfile, UserAuthentication
def get_or_create_user_with_username(request, username, auth_key):
isDjangoAccount = True
try:
# check if the given usern... |
#! /usr/bin/env python
"""
A CLI tool for summarizing sequence length information.
The program will generate a brief summary (min, max, mean, variance) of the
length of sequences found in one or more files.
"""
import os
import sys
import argparse
from Bio import SeqIO
from seqsift.utils import FILE_FORMATS, VALID_... |
from oslo_policy import policy
from nova.policies import base
POLICY_ROOT = 'os_compute_api:os-availability-zone:%s'
availability_zone_policies = [
policy.DocumentedRuleDefault(
POLICY_ROOT % 'list',
base.RULE_ADMIN_OR_OWNER,
"List availability zone information without host information"... |
#!/usr/bin/env python
# coding: utf-8
from pyscsi.pyscsi.scsi import SCSI
from pyscsi.pyscsi.scsi_enum_command import spc
from pyscsi.pyscsi import scsi_enum_modesense as MODESENSE6
from pyscsi.pyscsi.scsi_cdb_modesense6 import ModeSense6
class MockModeSense6(object):
def execute(self, cdb, dataout, datain, sens... |
"""
# Majic
# Copyright (C) 2014 CEH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This pr... |
import numpy.testing as npt
import os
from pymc3.tests import backend_fixtures as bf
from pymc3.backends import ndarray, sqlite
import tempfile
DBNAME = os.path.join(tempfile.gettempdir(), 'test.db')
class TestSQlite0dSampling(bf.SamplingTestCase):
backend = sqlite.SQLite
name = DBNAME
shape = ()
class... |
import eucadmin.describerequest
class DescribeStorageControllers(eucadmin.describerequest.DescribeRequest):
ServiceName = 'StorageController'
Description = 'List StorageController services.' |
"""Implementation of JSONDecoder
"""
import re
import sys
import struct
from .scanner import make_scanner
def _import_c_scanstring():
try:
from ._speedups import scanstring
return scanstring
except ImportError:
return None
c_scanstring = _import_c_scanstring()
__all__ = ['JSONDecoder']... |
# -*- coding: utf-8 -*-
"""
babel.localedata
~~~~~~~~~~~~~~~~
Low-level locale data access.
:note: The `Locale` class, which uses this module under the hood, provides
a more convenient interface for accessing the locale data.
:copyright: (c) 2013 by the Babel Team.
:license: BSD, s... |
import xlsxwriter
import sys
import unicodecsv
import os
import urllib2
import time
import datetime
output_dir = os.environ.get('VUORO2XLS_OUTPUT','.')
TMP_PATH = os.environ.get('VUORO2XLS_TMP','.')
url = 'https://koontikartta.navici.com/tiedostot/vuoro.csv'
if len(sys.argv) == 2:
url = sys.argv[1]
outfn = os.pat... |
import os
from twisted.trial import unittest
from scrapy.utils.iterators import csviter, xmliter
from scrapy.contrib_exp.iterators import xmliter_lxml
from scrapy.http import XmlResponse, TextResponse, Response
from scrapy.tests import get_testdata
class XmliterTestCase(unittest.TestCase):
xmliter = staticmetho... |
import os
from sickbeard import logger
import sickbeard
# This module tries to deal with the apparently random behavior of python when dealing with unicode <-> utf-8
# encodings. It tries to just use unicode, but if that fails then it tries forcing it to utf-8. Any functions
# which return something should always ret... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import requests
from datetime import datetime, date
import django
from django.test import TestCase
from django.db import models
from . import utils
class MockedResponse(object):
def __init__(self, status_code, content, headers=None):
if he... |
from gnuradio import gr, blocks
import socket
import os
def _get_sock_fd(addr, port, server):
"""
Get the file descriptor for the socket.
As a client, block on connect, dup the socket descriptor.
As a server, block on accept, dup the client descriptor.
Args:
addr: the ip address string
... |
"""
Scheduler Service
"""
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_serialization import jsonutils
from oslo_service import periodic_task
from oslo_utils import importutils
from nova import exception
from nova import manager
from nova import quota
L... |
import argparse
import os
import sys
import tarfile
import buildbot_common
def main(args):
parser = argparse.ArgumentParser()
parser.add_argument('--install-dir',
help='Install Directory',
dest='install_dir',
default='naclmono')
parser.add_argument('-... |
import mock
from neutron.api.v2 import attributes
from neutron.extensions import securitygroup as ext_sg
from neutron import manager
from neutron.tests.unit import test_extension_security_group as test_sg
from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
PLUGIN_NAME = ('neutron.plugins.openvswitc... |
# -*- coding: utf-8 -*-
from openerp.osv import osv
from openerp import tools
from openerp.tools.translate import _
from openerp.tools.safe_eval import safe_eval as eval
from openerp.addons.website.models.website import slug
class MailGroup(osv.Model):
_inherit = 'mail.group'
def message_get_email_values(sel... |
"""GCI org proposal processing mapreduce."""
from mapreduce import context
from mapreduce import operation
from melange.request import links
from soc.logic import org_app as org_app_logic
# MapReduce requires import of processed model classes.
# pylint: disable=unused-import
from soc.models.site import Site
from so... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
parse_iso8601,
xpath_with_ns,
xpath_text,
int_or_none,
)
class ZapiksIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?zapiks\.(?:fr|com)/(?:(?:[a-z]{2... |
"""Test module for the LabHandler handler."""
import json
import mock
import tornado
import urls
import handlers.response
from handlers.tests.test_handler_base import TestHandlerBase
class TestLabHandler(TestHandlerBase):
def get_app(self):
return tornado.web.Application([urls._LAB_URL], **self.settin... |
#!/usr/bin/env python3
import torch
from ..utils import sparse
from ..utils.broadcasting import _pad_with_singletons
from ..utils.getitem import _noop_index
from ..utils.interpolation import left_interp, left_t_interp
from .lazy_tensor import LazyTensor
from .non_lazy_tensor import NonLazyTensor, lazify
from .root_la... |
from _msi import *
import os, string, re, sys
AMD64 = "AMD64" in sys.version
Itanium = "Itanium" in sys.version
Win64 = AMD64 or Itanium
# Partially taken from Wine
datasizemask= 0x00ff
type_valid= 0x0100
type_localizable= 0x0200
typemask= 0x0c00
type_long= 0x0000
type_short= 0x0... |
"""Helper library for sharding during TPU compilation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.python.framework import tensor_shape
_DEFAULT_NUMBER_OF_SHARDS = 1
... |
VERSION = (0, 1, 'beta')
def get_version_string():
"""
return the version string for the library
"""
if VERSION[2] is not None:
version = "%d.%d_%s" % VERSION
else:
version = "%d.%d" % VERSION[:2]
return version
from trml2pdf.parser import parse_string, parseString, ParserErro... |
from openerp.osv import osv
import datetime
import time
class account_period(osv.osv):
_inherit = 'account.period'
def _get_period_days(self, cr, uid, init_period, last_period,
context=None):
context = context and dict(context) or {}
# TODO: ERASE LINE BEFORE GO-LIVE
... |
import time
import dcm.agent.plugins.api.base as plugin_base
class CountSleepExample(plugin_base.Plugin):
protocol_arguments = {
"count": ("The number of times to loop and sleep", True, int, 10),
"sleepTime": ("The number of seconds to sleep ever iteration",
True, float, 1.0... |
import shlex
from coalib.bearlib.abstractions.Linter import linter
from coalib.bears.requirements.GoRequirement import GoRequirement
@linter(executable='golint',
output_format='regex',
output_regex=r'.+:(?P<line>\d+):(?P<column>\d+): (?P<message>.*)')
class GoLintBear:
"""
Checks the code usi... |
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#-------------------------------------------------------------------------
#
# Gramps modules
#
#-------------------------------------------------------------------------
from .._isprivate import IsPrivate
#--------------------------------... |
from manifest_submodule import SubmoduleManifest
from manifest_xml import XmlManifest
def ParseManifest(repodir, type=None):
if type:
return type(repodir)
if SubmoduleManifest.Is(repodir):
return SubmoduleManifest(repodir)
return XmlManifest(repodir)
_manifest = None
def GetManifest(repodir, reparse=Fa... |
#!/usr/bin/env python
"""
Written by Dejanira Araiza-Illan, May 2015
"""
import rospy
import inspect
import sys
import robot #change here
import os
import re
overhead = 0
#Discount classes (smach) -> 3 lines each
classes_number=0
for name, obj in inspect.getmembers(robot): #change here
if inspect.isclass(obj) an... |
import base64
import json
import pycurl
import StringIO
import gss
DEFAULT_SERVER = 'https://roost-api.mit.edu'
DEFAULT_SERVICE = '<EMAIL>'
class Error(Exception):
def __init__(self, code, contents):
self.code = code
self.contents = contents
def __str__(self):
return self.contents
de... |
def fail_acquire_settings(log_printer, settings_names_dict, section):
"""
This method throws an exception if any setting needs to be acquired.
:param log_printer: Printer responsible for logging the messages.
:param settings: A dictionary with the settings name as key and
... |
"""Test HexGraph and DualHexGraph."""
from nose.tools import (assert_true, assert_false, assert_equal,
assert_almost_equal)
from numpy.testing import assert_array_equal, assert_array_almost_equal
from scipy.spatial import Voronoi
import numpy as np
from landlab.graph import HexGraph, DualHexGra... |
from django.db import (
DEFAULT_DB_ALIAS, DatabaseError, Error, ProgrammingError, connections,
)
from django.utils.decorators import ContextDecorator
class TransactionManagementError(ProgrammingError):
"""
This exception is thrown when transaction management is used improperly.
"""
pass
def get_... |
# -*- coding: utf-8 -*-
from south.db import db
from django.db import models
from cms.plugins.text.models import *
class Migration:
def forwards(self, orm):
"Write your forwards migration here"
def backwards(self, orm):
"Write your backwards migration here"
models =... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'findandreplacedlg.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _from... |
def main(request, response):
if "base" in request.GET:
return [("Content-Type", "text/html")], "OK"
type = request.GET.first("type")
if type == "normal":
response.status = 302
response.headers.append("Location", "redirect-redirected.html")
response.headers.append("Custom-Hea... |
"""Test the pyzor.engines.gdbm_ module."""
import unittest
from datetime import datetime
import pyzor.engines.redis_v0
import pyzor.engines.common
class EncodingRedisTest(unittest.TestCase):
"""Test the RedisDBHandle class"""
r_count = 24
wl_count = 42
entered = datetime(2014, 4, 23, 15, 41, 30)
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update version in GitExtension source files
"""
import argparse, sys
import glob
import re
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--version',
help='numeric product version')
parser.ad... |
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import workflows
from openstack_dashboard import api
from openstack_dashboard.dashboards.admin.aggregates import constants
class SetAggregateInfoAction(workflows.Action):
name = forms.Ch... |
import gst
import gtk
from fcntl import ioctl
import os
from time import time
from gettext import gettext as _
from plugins.camera_sensor.tacamera import Camera
from plugins.camera_sensor.v4l2 import v4l2_control, V4L2_CID_AUTOGAIN, \
VIDIOC_G_CTRL, VIDIOC_S_CTRL
from plugins.plugin import Plugin
from TurtleArt... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import base64
import json
import os
from ansible.errors import AnsibleError, AnsibleParserE... |
# -*- coding: utf-8 -*-
import os
import datetime
import logging
import io
import yaml
import uuid
import smtplib
import mimetypes
import ldap
import re
from logging import Formatter, FileHandler
from strgen import StringGenerator as SG
from logging.handlers import RotatingFileHandler
from email.mime.text import MIMETe... |
from msrest.serialization import Model
class RetentionPolicyParameters(Model):
"""Parameters that define the retention policy for flow log.
:param days: Number of days to retain flow log records. Default value: 0 .
:type days: int
:param enabled: Flag to enable/disable retention. Default value: False... |
import random
class Pista:
def __init__(self, nombre: str, favorita: bool, duracion: float, genero):
self.nombre = nombre
self.favorita = favorita
self.duracion = duracion
self.genero = genero
def __str__(self):
return f"Cancion: {self.nombre}, favorita: {self.fav... |
# default separator (whitespace)
print("a b".rsplit())
#print(" a b ".rsplit(None))
#print(" a b ".rsplit(None, 1))
#print(" a b ".rsplit(None, 2))
#print(" a b c ".rsplit(None, 1))
#print(" a b c ".rsplit(None, 0))
#print(" a b c ".rsplit(None, -1))
# empty separator should fail... |
from django.db.migrations.operations.base import Operation
class TestOperation(Operation):
def __init__(self):
pass
def deconstruct(self):
return (
self.__class__.__name__,
[],
{}
)
@property
def reversible(self):
return True
d... |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals
import json
import os
from flexmock import flexmock
import pytest
from atomic_reactor.core import ... |
"""SNLI data loader."""
import typing
from pathlib import Path
import pandas as pd
import keras
import matchzoo
_url = "https://nlp.stanford.edu/projects/snli/snli_1.0.zip"
def load_data(
stage: str = 'train',
task: str = 'classification',
target_label: str = 'entailment',
return_classes: bool = F... |
#!/usr/bin/python2 -tt
import glob
import json
import os.path
from distutils.version import LooseVersion
from ansible.module_utils.urls import open_url
basedir = os.path.dirname(__file__)
for filename in glob.glob(os.path.join(basedir, '../lib/ansible/compat/*/__init__.py')):
if 'compat/tests' in filename:
... |
"""
codec implementing the PDF codec described in Appendix D of the Adobe PDF
Reference v1.7
"""
from __future__ import unicode_literals
import codecs
import six
__all__ = ['register_codec']
ENCODING_NAME = 'pdf_doc'
# See Appendix D.2 in the Reference. Note that these are UTF-16BE encodings
DEC_TABLE = {
0x00:... |
from ctypes import *
import unittest, sys
from ctypes.test import is_resource_enabled
################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.
from _ctypes import PyObj_FromPtr
###########################################################... |
DOCBOOK_XSL_VERSION = "1.75.2"
DOCBOOK_DTD_VERSION = "4.2"
FOP_VERSION = "0.94"
FOP_JDK_VERSION="1.4"
# FOP_MIRROR = "http://mirrors.ibiblio.org/pub/mirrors/apache/xmlgraphics/fop/binaries"
FOP_MIRROR = "http://archive.apache.org/dist/xmlgraphics/fop/binaries/"
SOURCEFORGE_DOWNLOAD = "http://sourceforge.net/projects/do... |
import unittest
from rpclib.client.http import HttpClient
from rpclib.test.interop._test_soap_client_base import RpclibClientTestBase
from rpclib.test.interop.server.soap_http_basic import soap_application
from rpclib.util.etreeconv import root_dict_to_etree
class TestRpclibHttpClient(RpclibClientTestBase, unittest.T... |
from xml.dom import minidom
import mock
from oslo_i18n import fixture as i18n_fixture
from oslo_serialization import jsonutils
import webob.dec
from cinder.api import common
from cinder.api.openstack import wsgi
from cinder.i18n import _
from cinder import test
class TestFaults(test.TestCase):
"""Tests covering... |
__all__ = ("Utf8Validator",)
# DFA transitions
UTF8VALIDATOR_DFA = (
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 00..1f
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 20..3f
0, 0, 0, 0, 0, 0, 0, 0, 0... |
from odoo import api, fields, models
from odoo.models import expression
from odoo.tools.safe_eval import safe_eval
class FleetRouteStop(models.Model):
_name = 'fleet.route.stop'
_description = 'Route Stop'
_order = 'route_id, sequence, estimated_time'
name = fields.Char(string='Description', required... |
"""Common docstring snippets for plot.
"""
BASE_PLOT_DOCSTRING_PARAMETERS = \
"""navigator : str, None, or :py:class:`~hyperspy.signal.BaseSignal` (or subclass)
Allowed string values are ``'auto'``, ``'slider'``, and ``'spectrum'``.
If ``'auto'``:
- If `navigation_dimension` > 0... |
# coding: utf-8
"""
This module provides a Loader class for locating and reading templates.
"""
import os
import sys
from pystache import common
from pystache import defaults
from pystache.locator import Locator
# We make a function so that the current defaults take effect.
# TODO: revisit whether this is necessa... |
""" Unit tests for websocketproxy """
import os
import logging
import select
import shutil
import stubout
import subprocess
import tempfile
import time
import unittest
from websockify import websocketproxy
class MockSocket(object):
def __init__(*args, **kwargs):
pass
def shutdown(*args):
pas... |
from decimal import Decimal
import json
import caching
from django.core.cache import cache
from django.conf import settings
from django.db import models
import amo
import amo.models
from amo.urlresolvers import reverse
from applications.models import AppVersion
from files.models import File
class Config(caching.ba... |
import sys, zipfile, xml.dom.minidom
from namespaces import nsdict
from elementtypes import *
IGNORED_TAGS = [
'draw:a'
'draw:g',
'draw:line',
'draw:object-ole',
'office:annotation',
'presentation:notes',
'svg:desc',
] + [ nsdict[item[0]]+":"+item[1] for item in empty_elements]
INLINE_TAGS... |
import json
from pysvg.filter import *
from pysvg.gradient import *
from pysvg.linking import *
from pysvg.script import *
from pysvg.shape import *
from pysvg.structure import *
from pysvg.style import *
from pysvg.text import *
from pysvg.builders import *
from constants import *
from patternbase import pBase
clas... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.