content stringlengths 4 20k |
|---|
"""ryu
This retroactively provides migration support for
https://review.openstack.org/#/c/11204/
Revision ID: 5a875d0e5c
Revises: 2c4af419145b
Create Date: 2012-12-18 12:32:04.482477
"""
# revision identifiers, used by Alembic.
revision = '5a875d0e5c'
down_revision = '2c4af419145b'
# Change to ['*'] if this migra... |
import tensorflow as tf
class TextCNN(object):
"""
A CNN for text classification.
Uses an embedding layer, followed by a convolutional, max-pooling and softmax layer.
"""
def __init__(self, sequence_length, num_classes, vocab_size,
embedding_size, filter_sizes, num_filters, l2_reg... |
import time
from functools import partial
from openerp.osv import osv
from openerp.report import report_sxw
from common_report_header import common_report_header
class tax_report(report_sxw.rml_parse, common_report_header):
def set_context(self, objects, data, ids, report_type=None):
new_ids = ids
... |
#!/usr/bin/env python
#
# Example manticore script to solve a crackme.
#
from manticore import Manticore
m = Manticore('static.out')
chars_read = 0
chars_written = 0
flag = []
# call fgetc
@m.hook(0x4012c5)
def input_hook(state):
global chars_read, flag
print("Reading character #{}".format(char... |
import os
import pendulum
import click
from tabulate import tabulate
from termcolor import colored
from pyscores import config
from pyscores import api_wrapper
try:
API_KEY = os.environ['PYSCORES_KEY']
except KeyError:
API_KEY = ''
print("Warning: No API key found. You will be limited to 50 API calls per... |
##
## Airways
## Converts json to dat for use in IF
##
import datetime
import sys
import json
## create array for lines
lines = []
## add headers
lines.append("I")
lines.append("810 Version - Generated using airways.py on Travis")
lines.append(" ")
## read json
with open('Airways.json') as data_file:
data ... |
import datetime
import logging
# Django
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.http import (
HttpResponse,
HttpResponseForbidden,
HttpResponseRedirect,
)
from django.shortcuts import (
get_object_or_404,
r... |
import torch
def cublas_dgmm(A, x, out=None):
if out is not None:
assert out.is_contiguous() and out.size() == A.size()
else:
out = A.new(A.size())
assert x.dim() == 1
assert x.numel() == A.size(-1) or x.numel() == A.size(0)
assert A.type() == x.type() == out.type()
assert A.is... |
# coding=utf-8
import unittest
from smallinvoice.accounts import Account
from smallinvoice.tests import get_smallinvoice
def generate_account():
return Account(title='Testaccount',
institute='Familie Test',
number='Number123',
iban='Iban123',
... |
from traits.api import *
from traitsui.api import *#View, Item, ButtonEditor, Group, HSplit,
from traitsui.menu import *
import pylab as plb
import skrf as rf
from plotTool import PlotTool
class TouchstonePlotter(HasTraits):
cur_dir = Directory('')
ntwk_dict = Property(depends_on = 'cur_dir')
available_n... |
"""
Define steps for instructor dashboard - data download tab
acceptance tests.
"""
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from lettuce import world, step
from nose.tools import assert_in, assert_regexp_matches # pylint: disable=no-name-in-module
from terrain.steps import reload_t... |
from core import *
class Message(object):
@classmethod
def _makeiconstyle(cls, icon):
assert icon in ['info', 'question', 'warning', 'error']
if icon == 'info' :
return MB_ICONASTERISK
elif icon == 'question':
return MB_ICONQUESTION
elif i... |
import sys
import unittest
import math
from geotools import Quaternion, Vector
class test_Quaternion(unittest.TestCase):
def test_init_and_accessors(self):
q = Quaternion()
self.assertTrue(q.w == 1.0)
self.assertTrue(q.x == 0.)
self.assertTrue(q.y == 0.)
self.assertTrue(q.... |
from auxiliaries import datetime_from_epoch
from auxiliaries import set_verbosity
from globalvalues import ANSI_RESET, ANSI_YEL, ANSI_GR, ANSI_RED
from globalvalues import DEFAULT_DATA_BACKLOG_FILE_D3S
from globalvalues import SPECTRA_DISPLAY_TEXT
from globalvalues import strf
from collections import deque
import socke... |
import numpy as np
import hipsternet.regularization as reg
import hipsternet.utils as util
def regularization(model, reg_type='l2', lam=1e-3):
reg_types = dict(
l1=reg.l1_reg,
l2=reg.l2_reg
)
if reg_type not in reg_types.keys():
raise Exception('Regularization type must be either ... |
"""
if i.defs:
i is defined, possibly more than once.
Typical for vairable references.
if i.defs is None:
i is a definition (lhs)
if i.defs == set():
i is used but not defined.
Typical for function calls.
symtab is a temporary variable, which maps
variable names (strings) to sets of ident
instanc... |
"""Support for configuring multihost testing via environment variables
This is here to support tests configured for Beaker,
such as the ones at https://github.com/freeipa/tests/
"""
import os
import json
import collections
from ipapython import ipautil
from ipatests.test_integration.config import Config, Domain
TES... |
#!/usr/bin/env python
from trackhub_utils import *
import sys
import argparse
import csv
def change_precision(input, output, precision, source_index=COL_VALUE):
"""
Changes the precision of the value at source_index to precision
value of one column by a factor
:param input: An input stream or open fi... |
import re
from django.utils.translation import ugettext_lazy as _
from django import forms
from config import settings
from allauth.account.adapter import DefaultAccountAdapter
from urlparse import urlsplit, urlunsplit
class OCLAccountAdapter(DefaultAccountAdapter):
"""
A custom adapter for django-allauth so... |
import cv2
import datetime
import math
import numpy
import random
import re
import subprocess
import sys
import caffe
import tempfile
def duration_string_to_timedelta(s):
[hours, minutes, seconds] = map(int, s.split(':'))
seconds = seconds + minutes * 60 + hours * 3600
return datetime.timedelta(seconds=sec... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import copy
from ansible import constants as C
from ansible.module_utils._text import to_text
from ansible.module_utils.connection import Connection
from ansible.plugins.action.normal import ActionModule as _ActionModul... |
""" Demonstration of how to register event callbacks using an adaptation
of the color_scatter example from the bokeh gallery
"""
import numpy as np
from bokeh.io import show, output_file
from bokeh.plotting import figure
from bokeh import events
from bokeh.models import CustomJS, Div, Button
from bokeh.layouts import... |
from fermi_blind_search.database import Database
import pytest
def test_setup(configuration):
db = Database(configuration)
# create the tables so deleting them does not fail
db.create_tables()
# drop the tables to make sure they are empty when we start testing
db.delete_results_table()
db.d... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# streamondemand.- XBMC Plugin
# Canal para southparkita.altervista.org
# http://www.mimediacenter.info/foro/viewforum.php?f=36
# ------------------------------------------------------------
import re
from core import config
from co... |
import json
import pytest
from django.utils import timezone
from rest_framework_json_api import serializers, views
from rest_framework_json_api.renderers import JSONRenderer
from example.models import Author, Blog, Comment, Entry
# serializers
class RelatedModelSerializer(serializers.ModelSerializer):
blog = s... |
# -*- coding: utf-8 -*-
"""
Generators and functions for bipartite graphs.
"""
# Copyright (C) 2006-2011 by
# Aric Hagberg <<EMAIL>>
# Dan Schult <<EMAIL>>
# Pieter Swart <<EMAIL>>
# All rights reserved.
# BSD license.
import math
import random
import networkx
from functools import reduce
import ne... |
"""
Module implementing base classes used by the various class browsers.
"""
from __future__ import unicode_literals
class _ClbrBase(object):
"""
Class implementing the base of all class browser objects.
"""
def __init__(self, module, name, file, lineno):
"""
Constructor
... |
# -*- coding: utf-8 -*-
"""
hyper/compat
~~~~~~~~~
Normalizes the Python 2/3 API for internal use.
"""
from contextlib import contextmanager
import sys
import zlib
try:
from . import ssl_compat
except ImportError:
# TODO log?
ssl_compat = None
_ver = sys.version_info
is_py2 = _ver[0] == 2
is_py2_7_9_or_l... |
from . import base # noqa
from . import cx_oracle # noqa
from . import zxjdbc # noqa
from .base import BFILE
from .base import BINARY_DOUBLE
from .base import BINARY_FLOAT
from .base import BLOB
from .base import CHAR
from .base import CLOB
from .base import DATE
from .base import DOUBLE_PRECISION
from .base import ... |
from SipGenericHF import SipGenericHF
class SipSupported(SipGenericHF):
hf_names = ('supported',)
caps = None
def __init__(self, body = None, caps = None):
SipGenericHF.__init__(self, body)
if body == None:
self.parsed = True
self.caps = caps[:]
def parse(self)... |
import sys
import string
import time
import scriptcomm
# email communication
import smtplib
# try pre 4.0 email version
try:
from email.mime.text import MIMEText
except:
from email.MIMEText import MIMEText
from datetime import datetime
class FlatAttempt:
"""Class used to log attempts to produce flat... |
#!/usr/bin/env python
from boomslang import Bar, Line, Scatter, Plot, PlotLayout
from ImageComparisonTestCase import ImageComparisonTestCase
import unittest
class LayoutTest(ImageComparisonTestCase, unittest.TestCase):
def __init__(self, testCaseName):
super(LayoutTest,self).__init__(testCaseName)
... |
"""Uproot -- ROOT I/O in pure Python and Numpy.
Basic cheat-sheet
-----------------
Open ROOT files with uproot3.open (for reading) or uproot3.create (for read-write).
file = uproot3.open("/path/to/my/file.root")
file = uproot3.open("root://path/to/my/file.root")
file = uproot3.open("http://path/to/my/fi... |
from test.test_support import run_unittest, verbose
import unittest
import locale
import sys
import codecs
enUS_locale = None
def get_enUS_locale():
global enUS_locale
if sys.platform == 'darwin':
import os
tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US")
if int(os.uname()[2].split... |
# encoding: utf-8
"""
Support for draft-heitz-idr-large-community-03
Copyright (c) 2016 Job Snijders <<EMAIL>>
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
from exabgp.bgp.message.update.attribute import Attribute
from struct import pack
from struct import unpack
class LargeCommunity (Attribute):... |
# coding:utf-8
from . import *
from talon import utils as u
import cchardet
def test_get_delimiter():
eq_('\r\n', u.get_delimiter('abc\r\n123'))
eq_('\n', u.get_delimiter('abc\n123'))
eq_('\n', u.get_delimiter('abc'))
def test_unicode():
eq_ (u'hi', u.to_unicode('hi'))
eq_ (type(u.to_unicode('... |
from __future__ import division
from __future__ import unicode_literals
#
# Copyright 2005 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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 Fo... |
"""Text wrapping and filling.
"""
# Copyright (C) 1999-2001 Gregory P. Ward.
# Copyright (C) 2002, 2003 Python Software Foundation.
# Written by Greg Ward <<EMAIL>>
__revision__ = "$Id: textwrap.py 2847 2004-11-13 13:45:38Z wiemann $"
import string, re
import types
# Do the right thing with boolean values for all k... |
from django import forms
from ..hooks import hookset
from ..models import Field, FieldChoice, OrdinalScale, Page, Survey
class SurveyCreateForm(forms.ModelForm):
class Meta:
model = Survey
fields = [
"name",
]
def __init__(self, *args, **kwargs):
self.user = kwar... |
import logging
import tornado.auth
import tornado.escape
import tornado.ioloop
import tornado.web
import os.path
import uuid
from tornado import gen
from tornado.options import define, options, parse_command_line
define("port", default=5000, help="run on the given port", type=int)
class MessageBuffer(object):
d... |
'''
Layout
======
Layouts are used to calculate and assign widget positions.
The :class:`Layout` class itself cannot be used directly.
You should use one of the following layout classes:
- Anchor layout: :class:`kivy.uix.anchorlayout.AnchorLayout`
- Box layout: :class:`kivy.uix.boxlayout.BoxLayout`
- Float layout: :... |
'''
JSON related utilities.
This module provides a few things:
1) A handy function for getting an object down to something that can be
JSON serialized. See to_primitive().
2) Wrappers around loads() and dumps(). The dumps() wrapper will
automatically use to_primitive() for you if needed.
3) Th... |
# vim:fileencoding=utf-8
import warnings
import os, sys, io
import json
import beretta.plugin.http
__doc__ = '''
beretta slack(https://slack.com/) incoming webhook plugin command
'''
class Plugin(beretta.plugin.http.Plugin):
ICON = ':snake:'
CHANNEL = '#general'
USER = 'beretta bot'
def initi... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
from ansible.module_utils.a10 import (axapi_call, a10_argument_spec, axapi_aut... |
"""Test cases for traceback module"""
from _testcapi import traceback_print
from StringIO import StringIO
import sys
import unittest
from test.test_support import run_unittest, is_jython, Error
import traceback
try:
raise KeyError
except KeyError:
type_, value, tb = sys.exc_info()
file_ = StringIO()
... |
from calculation import Calculation
from ..models.curve import AdaptableCurve
## Top-level class
class CurveGenerator(object):
def __init__(self, indepunits, depenunit):
self.indepunits = indepunits
self.depenunit = depenunit
def get_curve(self, *args, **kw):
"""Returns an object of ty... |
# encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from tempfile import mkdtemp
SECRET_KEY = "Please do not spew DeprecationWarnings"
# Haystack settings for running tests.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
... |
#!/usr/bin/python2
"""
Copyright 2017 The Trustees of Princeton University
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 ... |
from datetime import date, datetime, timedelta
import csv
import requests
import itertools
from slugify import slugify
def escape(html):
"""Returns the given HTML with ampersands, quotes and carets encoded."""
return html.replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"').re... |
import ast
import functools
import inspect
import operator
import re
import textwrap
from plover.formatting import Formatter
from plover.steno import normalize_steno
from plover.steno_dictionary import StenoDictionary
from plover.translation import Translator
from .output import CaptureOutput
from .steno import steno... |
import json
import unittest
import mock
import requests
from six.moves import http_client
class TestConnection(unittest.TestCase):
@staticmethod
def _get_target_class():
from google.cloud._http import Connection
return Connection
def _make_one(self, *args, **kw):
return self._g... |
import locale, os
deflang = 'en'
lang = None
if os.name == 'posix':
try:
locale.setlocale(locale.LC_ALL,'')
except:
loc,enc = locale.getdefaultlocale()
else:
loc, enc = locale.getlocale()
# Windows locales are named differently, e.g. German_Austria instead of de_AT
# Fortunately, w... |
from typing import Any, Dict, List, Optional, Tuple, Union
from memsource import constants, models, api_rest
class Project(api_rest.BaseApi):
# Document: https://cloud.memsource.com/web/docs/api#tag/Project
def create(
self,
name: str,
source_lang: str,
target_langs: Union[Lis... |
# project/server/__init__.py
import os
from flask import Flask, render_template
from flask_login import LoginManager
from flask_bcrypt import Bcrypt
from flask_debugtoolbar import DebugToolbarExtension
from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
#... |
import asyncio
import aiozmq
import zmq
class ZmqDealerProtocol(aiozmq.ZmqProtocol):
transport = None
def __init__(self, queue, on_close):
self.queue = queue
self.on_close = on_close
def connection_made(self, transport):
self.transport = transport
def msg_received(self, msg... |
"""Pulls down the current dart sdk to third_party/dart-sdk/.
You can manually force this to run again by removing
third_party/dart-sdk/STAMP_FILE, which contains the URL of the SDK that
was downloaded. Rolling works by updating LINUX_64_SDK to a new URL.
"""
import os
import shutil
import subprocess
import sys
# How... |
# -*- coding: utf-8 -*-
"""
Nodular's RevisionedNodeMixin base class helps make models with revisioned
content.
"""
__all__ = ['RevisionedNodeMixin']
from werkzeug.utils import cached_property
from sqlalchemy import Column, ForeignKey, UniqueConstraint, Unicode
from sqlalchemy.ext.declarative import declared_attr
fr... |
from django.conf import settings
from django.http import HttpResponseRedirect
from django.utils.cache import patch_cache_control
LOGIN_REQUIRED_PREFIXES = getattr(settings, 'LOGIN_REQUIRED_PREFIXES', ())
NO_LOGIN_REQUIRED_PREFIXES = getattr(settings, 'NO_LOGIN_REQUIRED_PREFIXES', ())
class LoginRequiredMiddleware(obj... |
from trac.core import Component, implements
from trac.admin import IAdminCommandProvider
from bhsolr.schema import SolrSchema
class BloodhoundSolrAdmin(Component):
implements(IAdminCommandProvider)
# IAdminCommandProvider methods
def get_admin_commands(self):
yield ('bhsolr generate_schema', '<pa... |
# -*- coding: utf-8 -*-
"""
EFS-related classes and functions
"""
from opinel.utils.aws import get_name, handle_truncated_response
from AWSScout2.configs.regions import RegionalServiceConfig, RegionConfig, api_clients
########################################
# EFSRegionConfig
#######################################... |
import os
import file
import platform
import tempfile
import glob
import getpass
import shutil
def get_default_remote_folder():
platform_system = platform.system()
if 'Windows' in platform_system:
network_base_folder = '//192.168.222.199/AShareData/'
elif 'Linux' in platform_system:
network... |
import math
import sys
import os
import xml.etree.ElementTree as ET
from pygame.locals import Color
sys.path.append(os.path.join(os.path.dirname(__file__), "..", ".."))
from src.xml_parse.Exceptions import XMLFormatError
from src.xml_parse.Constants import IMPORT_ROAD_TOLERANCE, LANE_WIDTH, TEMPLATE_PAIR_FREQ_DEFAULT... |
from ansible.module_utils.basic import *
from ansible.module_utils.pycompat24 import get_exception
import shlex
def main():
module = AnsibleModule(
argument_spec={
'name': {'required': True},
'state': {'default': 'present', 'choices': ['present', 'absent']},
'params': {... |
"""Profile a Tornado application via REST."""
import cProfile
import logging
import pstats
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import tornado.web
import yappi
from operator import itemgetter
__author__ = "Megan Kearl Patten <<EMAIL>>"
logger = logging.getLogger(__... |
import unittest
import uuid
import json
from bitmovin import Bitmovin, Response, Stream, StreamInput, EncodingOutput, ACLEntry, Encoding, \
FMP4Muxing, MuxingStream, ClearKeyDRM, SelectionMode, ACLPermission
from bitmovin.errors import BitmovinApiError
from tests.bitmovin import BitmovinTestCase
class ClearKeyDRM... |
"""
Module exports :class:`AkkarEtAl2013`.
"""
from __future__ import division
import warnings
from openquake.hazardlib.gsim.akkar_2014 import AkkarEtAlRjb2014
class AkkarEtAl2013(AkkarEtAlRjb2014):
"""
To ensure backwards compatibility with existing seismic hazard models,
the call AkkarEtAl2013 is retain... |
from __future__ import absolute_import, division, unicode_literals
import logging
import Queue
import threading
import time
from sqlalchemy.exc import ProgrammingError, OperationalError
from flexget.task import TaskAbort
log = logging.getLogger('task_queue')
class TaskQueue(object):
"""
Task processing th... |
class Voice(object):
opening = '{\n'
closing = '\n } \n'
def __init__(self, name=None, measures=None):
self.name=name
self.measures=measures
@property
def music_events(self):
result = []
for measure in self.measures:
for elt in measure.elements:
... |
from envisage.ui.tasks.task_extension import TaskExtension
from pyface.tasks.action.schema_addition import SchemaAddition
# ============= standard library imports ========================
from traits.api import List
from pychron.envisage.tasks.base_task_plugin import BaseTaskPlugin
from pychron.geochron.geochron_servi... |
from __future__ import print_function
from datetime import date
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.resources import INLINE
from bokeh.util.browser import view
from bokeh.models import ColumnDataSource
from bokeh.models.layouts import Column, Row, Tabs, Panel
from bokeh.mo... |
import uuid
from keystone.assignment import controllers
from keystone import tests
from keystone.tests import default_fixtures
_ADMIN_CONTEXT = {'is_admin': True, 'query_string': {}}
class TenantTestCase(tests.TestCase):
"""Tests for the V2 Tenant controller.
These tests exercise :class:`keystone.assignme... |
from functools import partial
from operator import methodcaller
from evergreen import futures, patcher
# Monkey-patch.
requests = patcher.import_patched('requests')
__version__ = '0.0.1'
__all__ = ['map', 'imap', 'get', 'options', 'head', 'post', 'put', 'patch', 'delete', 'request', '__version__']
# Export same it... |
"""
Purpose:
-----------------------------------------------------------
This script creates graphs for t-test for 4 conditions
For each subject each run each condition, plot the t statistics
-----------------------------------------------------------
"""
import sys, os
sys.path.append(os.path.join(os.path.dirname(_... |
from . import res_company_ldap
from . import res_company_ldap_field_mapping
from . import res_users
from . import res_partner |
{
"name": "Romania - Bank Statement Operations",
"version": "1.0",
"author": "FOREST AND BIOMASS SERVICES ROMANIA ",
"website": "http://www.forbiom.eu",
"category": "Romania Adaptation",
"depends": ['account', 'l10n_ro_config', 'account_statement_operation_multicompany', 'l10n_ro_currency_reeval... |
from __future__ import absolute_import, division, print_function
from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper
from ..util import tagre
from ..helpers import bounceStarter, joinPathPartsNamer, xpath_class
from .common import _WPNavi
class ZapComic(_ParserScraper):
url = 'htt... |
# -*- coding: UTF8 -*-
__kupfer_name__ = _("GNOME Session Management")
__kupfer_sources__ = ("GnomeItemsSource", )
__description__ = _("Special items and actions for GNOME environment")
__version__ = "2012-10-16"
__author__ = "Ulrik Sverdrup <<EMAIL>>"
"""
Changes:
2012-10-16 Karol Będkowski:
+ support Gnome3; clos... |
import logging
logger = logging.getLogger("pylorax.imgutils")
import os, tempfile
from os.path import join, dirname
from subprocess import Popen, PIPE, CalledProcessError
import sys
import traceback
import multiprocessing
from time import sleep
from pylorax.sysutils import cpfile
from pylorax.executils import execWit... |
#!/usr/bin/env python3
from typing import List, Optional, Tuple, Union
import torch
from ..lazy import InterpolatedLazyTensor, lazify
from ..models.exact_prediction_strategies import InterpolatedPredictionStrategy
from ..utils.broadcasting import _mul_broadcast_shape
from ..utils.grid import create_grid
from ..utils... |
from .exception import InflateError, DeflateError, RequiredProperty
from datetime import datetime, date
import os
import types
import pytz
import json
import sys
import functools
import logging
logger = logging.getLogger(__name__)
if sys.version_info >= (3, 0):
unicode = lambda x: str(x)
def display_for(key):
... |
import numpy as np
from petsc4py import PETSc
from pySDC.core.Errors import ParameterError
from pySDC.core.Problem import ptype
from pySDC.implementations.datatype_classes.petsc_dmda_grid import petsc_data, rhs_2comp_petsc_data, rhs_imex_petsc_data
class Fisher_full(object):
"""
Helper class to generate resi... |
# -*- coding: utf-8 -*-
"""
Test suite for codestream oddities
"""
# Standard library imports ...
try:
import importlib.resources as ir
except ImportError: # pragma: no cover
# before 3.7
import importlib_resources as ir
from io import BytesIO
import struct
import unittest
import warnings
# Local import... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
UniqueValues.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**************************... |
"""
.. moduleauthor:: Edwin Tye <<EMAIL>>
The different loss types. Such as thought based on
parametric distributions.
"""
__all__ = [
'Square',
'Normal',
'Poisson'
]
import numpy as np
from pygom.model._model_errors import InitializeError
from pygom.model.ode_utils import check_array_... |
import socket
from oslo_config import cfg
from oslo_log import log as logging
from magnum.common import config
from magnum.i18n import _
service_opts = [
cfg.StrOpt('host',
default=socket.getfqdn(),
help=_('Name of this node. This can be an opaque identifier. '
... |
# pylint: disable=no-init
# pylint: disable=too-few-public-methods
from django.contrib import admin
from django.contrib.auth.models import User
from forms_builder.forms.models import FormEntry, FieldEntry
from image_cropping import ImageCroppingMixin
from import_export import resources
from import_export.admin import ... |
import myio
import logging, sys, os
import set_params
import p
import covar3d_all
'''
Copyright (c) Columbia University Hstau Liao 2018 (python version)
'''
import time
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
def op(*argv):
'''op = 0 one projection at a time, RRt is approximated by... |
#!/usr/bin/env python
import argparse
import subprocess
def parallel_link_jobs():
try:
import multiprocessing
cpus = multiprocessing.cpu_count()
return max(cpus / 4, 2)
except:
return 2
parser = argparse.ArgumentParser(
description=
"CMake configuration options are r... |
#!/usr/bin/env python3
import re, json, time
from os import path
from datetime import datetime
import recurrent
import dateutil.rrule
from ..utilities import BasePlugin
# use this with a command like "botty remind #music every monday at 3pm: :fire: :fire: :fire: NEW NOON PACIFIC MIXTAPE IS OUT :fire: :fire: :fire:"... |
from nose.tools import eq_
import validator.testcases.chromemanifest as tc_chromemanifest
from validator.errorbundler import ErrorBundle
from validator.chromemanifest import ChromeManifest
def test_pass():
"""Test that standard category subjects pass."""
c = ChromeManifest('category foo bar', 'chrome.manife... |
from __future__ import unicode_literals
"""
Patch courtesy of:
https://marmida.com/blog/index.php/2012/08/08/monkey-patching-assert_raises/
"""
# code for monkey-patching
import nose.tools
# let's fix nose.tools.assert_raises (which is really unittest.assertRaises)
# so that it always supports context management
# i... |
#for more info and material (source codes )about lr please visit: https://github.com/PhenixI/machine-learning/tree/master/2-Logistic%20Regression
#load dataset
from sklearn import datasets
import numpy as np
iris = datasets.load_iris()
X= iris.data[:,[2,3]]
y = iris.target
#split the dataset into separate training ... |
import numpy as np
def kappa_simple(k,RH, n = None, inverse = False):
"""Returns the growth factor as a function of kappa and RH.
This function is based on the simplified model introduced by Rissler et al. (2006).
It ignores the curvature effect and is therefore independend of the exact particle diameter.
... |
import json
import re
from oslo_config import cfg
from oslo_log import log as logging
import requests
LOG = logging.getLogger(__name__)
# Number of seconds the repsonse for the request sent to
# vpsa is expected. Else the request will be timed out.
# Setting it to 300 seconds initially.
vpsa_timeout = 300
# Common... |
"""Functions for communicating with Google Cloud Storage."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import subprocess
from tensorflow.python.platform import tf_logging as logging
# All GCS paths should start with this.
PATH_PREFIX = 'gs:... |
"""Tests for utilities working with arbitrarily nested structures."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import numpy as np
from tensorflow.python.data.util import nest
from tensorflow.python.framework import constant_op
fr... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetServiceStatus(Choreography):
def __init__(self, temboo_session):
"""
Creat... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'}
DOCUMENTATION = r'''
---
module: debug
short_description: Print statements during executio... |
'''calibration simulation command handling'''
from __future__ import division, print_function
import math
from pymavlink import quaternion
import random
import time
from MAVProxy.modules.lib import mp_module
class CalController(object):
def __init__(self, mpstate):
self.mpstate = mpstate
self.act... |
"""
Holds data relating to session endpoints for storage in the session object.
@author: rwilkinson
"""
import logging
log = logging.getLogger(__name__)
class SessionEndpointData:
idMapKey = 'SESSION_ENDPOINT_ID_MAP'
def __init__(self, session):
self.session = session
def getIdMap(self):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.