gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
# Copyright 2012 Anton Beloglazov
#
# 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 writ... | |
import logging
import time
from logging.handlers import SMTPHandler
import stripe
from flask import g, request, render_template
from werkzeug.contrib.fixers import ProxyFix
from jinja2 import ChoiceLoader, FileSystemLoader
from catwatch.lib.http_method_override_middleware import \
HTTPMethodOverrideMiddleware
fro... | |
# Copyright (c) 2013 Mirantis Inc.
#
# 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 writ... | |
import unittest
import pysal
import numpy as np
from pysal.spreg import error_sp_het as HET
from pysal.common import RTOL
class TestBaseGMErrorHet(unittest.TestCase):
def setUp(self):
db=pysal.open(pysal.examples.get_path("columbus.dbf"),"r")
y = np.array(db.by_col("HOVAL"))
self.y = np.res... | |
# This file is part of the MapProxy project.
# Copyright (C) 2013 Omniscale <http://omniscale.de>
#
# 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... | |
from collections import Counter
from ceph_medic import metadata, daemon_types
from ceph_medic.util import configuration, str_to_int
#
# Utilities
#
def get_fsid(data):
# FIXME: might want to load this thing into ConfigParser so that we can fetch
# information. ceph-deploy is a good example on how to do this.... | |
from __future__ import print_function
from acq4.util import Qt
import math
from acq4.util.HelpfulException import HelpfulException
import numpy as np
import pyqtgraph as pg
import acq4.analysis.tools.functions as fn
import scipy
Ui_Form = Qt.importTemplate('.SpatialCorrelatorCtrlTemplate')
class SpatialCorrelator(Qt... | |
"""A setuptools based setup module.
"""
from __future__ import print_function
import os
import fnmatch
import re
import sys
import subprocess
import yaml
# Always prefer setuptools over distutils
from setuptools import setup, Command
from setuptools_lint.setuptools_command import PylintCommand
from six import string... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC
#
# 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 requ... | |
import codecs
import logging
import os
import sys
from collections import namedtuple
import six
import yaml
from .errors import CircularReference
from .errors import ComposeFileNotFound
from .errors import ConfigurationError
from .interpolation import interpolate_environment_variables
from .validation import validate... | |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "L... | |
#!/usr/bin/env python
#! This file is a literate Python program. You can compile the documentation
#! using mylit (http://pypi.python.org/pypi/mylit/).
## title = "glitter Example: OpenCL"
## stylesheet = "pygments_style.css"
# <h1><i>glitter</i> Example: OpenCL</h1>
# <h2>Summary</h2>
# This program will open a GL... | |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | |
import sys
from ..pakbase import Package
class Mt3dAdv(Package):
"""
MT3DMS Advection Package Class.
Parameters
----------
model : model object
The model object (of type :class:`flopy.mt3d.mt.Mt3dms`) to which
this package will be added.
mixelm : int
MIXELM is an intege... | |
"""Base classes for cursors.
These classes centralize common code.
"""
from vtdb import dbexceptions
class BasePEP0249Cursor(object):
"""Cursor with common PEP0249 implementations."""
def __init__(self):
self._clear_common_state()
self._conn = None
def callproc(self):
"""For PEP 0249."""
rai... | |
#!/usr/bin/env python
#
# Electrum - Lightweight Bitcoin Client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... | |
from collections.abc import Callable
from copy import deepcopy
from io import StringIO
import openmc.checkvalue as cv
from openmc.mixin import EqualityMixin
from .data import EV_PER_MEV
from .endf import get_cont_record, get_list_record, get_tab1_record, Evaluation
from .function import Function1D, Tabulated1D, Polyno... | |
#!/usr/bin/env python
import warnings
# Dropping a table inexplicably produces a warning despite
# the "IF EXISTS" clause. Squelch these warnings.
warnings.simplefilter("ignore")
import json
import logging
import os
import signal
from subprocess import PIPE
import threading
import time
import unittest
import urllib
i... | |
# -*- coding: utf-8 -*-
"""
Document Library - Controllers
"""
module = request.controller
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
# =============================================================================
def index():
"Module's Home Page"
modul... | |
#!/usr/bin/env python3
import functools
from math import exp
from os import path
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data as mnist_data
from tensor_functions import bias_variable, weight_variable, \
embedding_initializer, build_mnist_embeddings
def run():
"""
Co... | |
#
# Copyright (c) 2011, Regents of the University of California
# BSD license, See the COPYING file for more information
# Written by: Derek Kulinski <takeda@takeda.tk>
# Jeff Burke <jburke@ucla.edu>
#
from . import _pyndn
import utils
class ContentType(utils.Enum):
_prefix = "pyndn"
CONTENT_DATA = Cont... | |
#!/usr/bin/env python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
#
# analytics_uvetest.py
#
# UVE and Alarm tests
#
import sys
builddir = sys.path[0] + '/../..'
import threading
threading._DummyThread._Thread__stop = lambda x: 42
import signal
import gevent
from gevent import monkey
monkey.... | |
"""
PHP date() style date formatting
See http://www.php.net/date for format strings
Usage:
>>> import datetime
>>> d = datetime.datetime.now()
>>> df = DateFormat(d)
>>> print(df.format('jS F Y H:i'))
7th October 2003 11:39
>>>
"""
import calendar
import datetime
import time
from email.utils import format_datetime as ... | |
#!/usr/bin/env python
#
# Copyright 2014 Corgan Labs
# See LICENSE.txt for distribution terms
#
import os
import hmac
import hashlib
import ecdsa
import struct
import Base58
from hashlib import sha256
from ecdsa.curves import SECP256k1
from ecdsa.ecdsa import int_to_string, string_to_int
from ecdsa.numbertheory impor... | |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | |
#!/usr/bin/env python
__author__ = "waroquiers"
import os
import random
import shutil
import unittest
import numpy as np
from monty.tempfile import ScratchDir
from pymatgen.analysis.chemenv.coordination_environments.voronoi import (
DetailedVoronoiContainer,
)
from pymatgen.core.lattice import Lattice
from pym... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | |
"""
pygments.lexers.basic
~~~~~~~~~~~~~~~~~~~~~
Lexers for BASIC like languages (other than VB.net).
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, bygroups, default, words, include
f... | |
# Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import os.path
import tempfile
import shutil
from cStringIO import StringIO
import unittest
import platform
import Queue
from collections import Counter
import shutil
import nose.tools
import mock
import PIL.Image
import numpy as np
from . import c... | |
#!/usr/bin/env python
__author__ = "Kishori M Konwar"
__copyright__ = "Copyright 2013, MetaPathways"
__credits__ = ["r"]
__version__ = "1.0"
__maintainer__ = "Kishori M Konwar"
__status__ = "Release"
"""Contains general utility code for the metapaths project"""
from shutil import rmtree
from os import getenv, maked... | |
#!/usr/bin/env python
import sys
import os
import rospy
import rospkg
from threading import Thread
from python_qt_binding import loadUi
from python_qt_binding import QtGui
from python_qt_binding.QtGui import QWidget
from trainergui import Ui_MainWindow
from inmoov_msgs.msg import MotorStatus
from inmoov_msgs.msg im... | |
#!/usr/bin/python
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for pushimage.py"""
from __future__ import print_function
import logging
import mock
import os
import sys
sys.path.i... | |
"""
Test breakpoint names.
"""
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class BreakpointNames(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = True
@add_test_categories(['pyapi']... | |
# -*- coding: utf-8 -*-
import logging
import httplib
import httplib as http # TODO: Inconsistent usage of aliased import
from dateutil.parser import parse as parse_date
from django.utils import timezone
from flask import request
import markupsafe
import mailchimp
from modularodm.exceptions import ValidationError, No... | |
u'''
Created on Oct 5, 2010
Refactored from ModelObject on Jun 11, 2011
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
from __future__ import with_statement
import os, io, logging
from arelle import XmlUtil, XbrlConst, ModelValue
from arelle.ModelObject import Model... | |
"""Tasks related to projects, including fetching repository code, cleaning
``conf.py`` files, and rebuilding documentation.
"""
import fnmatch
import os
import shutil
import json
import logging
import socket
import requests
import datetime
from celery import task
from django.conf import settings
from django.core.urlre... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: ardydedase
# @Date: 2015-08-30 11:19:30
# @Last Modified by: ardydedase
# @Last Modified time: 2015-09-24 19:36:51
import time
import requests
import logging
import sys
from requests.exceptions import ConnectionError
try:
import lxml.etree as etree
exc... | |
# Copyright 2017 Taylor DeHaan
#
# 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 writing... | |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | |
# Simple binary linear classifier with synthetic data.
#
# Eli Bendersky (http://eli.thegreenplace.net)
# This code is in the public domain
from __future__ import print_function
import argparse
import matplotlib.pyplot as plt
import numpy as np
from timer import Timer
import sys
from regression_lib import *
def gene... | |
# Obtained from http://pypi.python.org/pypi/webcolors/
# To be removed from Weekview package.
"""
A simple library for working with the color names and color codes
defined by the HTML and CSS specifications.
An overview of HTML and CSS colors
----------------------------------
Colors on the Web are specified in `the... | |
import datetime
import logging
from ..fields import (
Base64Field,
BodyContentAttributedValueField,
BooleanField,
CharField,
Choice,
ChoiceField,
DateTimeBackedDateField,
DateTimeField,
EmailAddressAttributedValueField,
EmailAddressesField,
EmailAddressField,
EWSElementF... | |
import os
import sys
import tempfile
from pecan.tests import PecanTestCase
from six import b as b_
__here__ = os.path.dirname(__file__)
class TestConf(PecanTestCase):
def test_update_config_fail_identifier(self):
"""Fail when naming does not pass correctness"""
from pecan import configuration
... | |
#
# Copyright 2012 Red Hat, Inc
#
# 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 writi... | |
# Copyright (c) 2010-2012 OpenStack, LLC.
#
# 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 ... | |
import math
import string
import sys
import struct
import numpy as np
import scipy.ndimage
import scipy.stats as ss
import scipy.signal
import scipy as sp
import scipy.odr as odr
import glob
import os
import gzip
import tarfile
import shutil
import congrid
import astropy.io.ascii as ascii
import warnings
import subproc... | |
#!/usr/bin/env python
#
# Copyright 2011-2012 Andreas Wundsam
# Copyright 2011-2012 James McCauley
#
# 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/LICE... | |
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Eduard Broecker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that
# the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this lis... | |
#
# Copyright 2017 Vitalii Kulanov
#
# 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 ... | |
# Copyright 2013 Intel Corp.
#
# 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... | |
"""Old stat file parser, kept as legacy code and unmaintained due to the files no longer being generated."""
import re
from datetime import datetime
from typing import Text
from flask import current_app
from werkzeug import LocalProxy
from app import models
logger = LocalProxy(lambda: current_app.logger)
db = LocalP... | |
# -!- encoding: utf-8 -!-
import os
from utils import Toggler, infinity
def gen_player_links(players, team_id):
ps = list()
for p in players:
if hasattr(p, 'team_id') and p.team_id == team_id:
ps.append('<a href="#%s">%s</a>' % (p.slug_nick, p.nick))
return ", ".join(ps)
def pluralize(number, unit, emph_bound... | |
import unittest
import urllib2, urlparse
from StringIO import StringIO
import json
import webapp2
from markupsafe import Markup, escape
import webtest
from google.appengine.api import mail
from google.appengine.ext import testbed
import server.lib.formValidation as formValidation
from server.controllers.contact impo... | |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
# Copyright (c) 2012 X.commerce, a business unit of eBay Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")... | |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | |
""" Cisco_IOS_XR_ncs1k_mxp_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR ncs1k\-mxp package configuration.
This module contains definitions
for the following management objects\:
hardware\-module\: NCS1k HW module config
Copyright (c) 2013\-2016 by Cisco Systems, Inc.
All rights rese... | |
# Introduction
# ============
# A regular expression is a special type of pattern that is usually used find and replace
# parts of strings. They are related to other constructs of theoretical computer science
# like (regular) grammars and (finite) automata, which you could look up to understand
# more behind the motiva... | |
#! /usr/bin/env python2
"""
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 applicabl... | |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... | |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | |
#!/usr/bin/env python3
# Copyright 2020 The Pigweed Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | |
from Avatar import Avatar
from direct.actor.DistributedActor import DistributedActor
from direct.distributed import DistributedNode
from direct.interval.IntervalGlobal import *
from direct.showbase import PythonUtil
from direct.task import Task
from otp.ai.MagicWordGlobal import *
from otp.nametag.Nametag import Nameta... | |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from textwrap import... | |
from mock import patch
from mock import Mock
from lasagne.layers import Conv2DLayer
from lasagne.layers import DenseLayer
from lasagne.layers import MaxPool2DLayer
from lasagne.layers import InputLayer
from lasagne.nonlinearities import softmax
from lasagne.updates import nesterov_momentum
import pytest
from nolearn._... | |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | |
from __future__ import division
from collections import defaultdict
import sys, os
import json
import math
import string
from math import log, pow
#import pandas as pd
class MeasureAccuracy:
"""
Measure the accuracy of the output of tagged tweets with respect to the expected tags.
Expected and actual both have ... | |
"""Convert dictionaries to other objects"""
__author__ = 'thorwhalen'
import itertools
import re
from collections import namedtuple as _namedtuple
from collections import Counter
from warnings import warn
def kv_tuple_list(d):
"""
Transforms a dict into a list of (key, val) tuples.
This tuple_list can re... | |
# Copyright (C) [2015-2017] [Thomson Reuters LLC]
# Copyright (C) [2015-2017] [Panos Kittenis]
# 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... | |
import mock
import unittest2 as unittest
from quantum.agent import netns_cleanup_util as util
class TestNetnsCleanup(unittest.TestCase):
def test_setup_conf(self):
conf = util.setup_conf()
self.assertFalse(conf.force)
def test_kill_dhcp(self, dhcp_active=True):
conf = mock.Mock()
... | |
from collections import abc
from datetime import datetime, time
from functools import partial
import numpy as np
from pandas._libs import tslib, tslibs
from pandas._libs.tslibs import Timestamp, conversion, parsing
from pandas._libs.tslibs.parsing import ( # noqa
DateParseError, _format_is_iso, _guess_datetime_f... | |
import numpy as np
import pandas as pd
class DescriptionVars:
"""Class for generating, storing and retrieving the individual description
of each one of the variables of the dataset.
There are different types of description fomats in this class:
* Raw data: Plots, images and artificial description... | |
# for python 3
# You'll need to customize this according to your needs. Proper orientation of
# the kinect is vital; if participants are able to maintain their head or wrists
# continuously inside the word rects, they will repeatedly trigger the collision
# detection
from pykinect2 import PyKinectV2
from pykinect2.PyKi... | |
import os
import re
from bs4 import BeautifulSoup
from django.core.exceptions import ObjectDoesNotExist
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db import models
from django.db.models import Case, Count, Q, Value, When
from django.utils.encoding import python_2_unicode_compa... | |
"""Undocumented Module"""
__all__ = ['FourState']
from direct.directnotify import DirectNotifyGlobal
#import DistributedObject
import ClassicFSM
import State
class FourState:
"""
Generic four state ClassicFSM base class.
This is a mix-in class that expects that your derived class
is a Distributed... | |
from datetime import datetime, timedelta
from django.test.utils import override_settings
from mock import Mock, patch
from nose.tools import eq_, ok_
import mkt
import mkt.site.tests
from mkt.constants.payments import PROVIDER_BANGO, PROVIDER_REFERENCE
from mkt.developers.models import (ActivityLog, AddonPaymentAcco... | |
#!/usr/bin/env python
import argparse
import base64
import re
import logging
import time
from hashlib import sha1
from urlparse import parse_qs
from Cookie import SimpleCookie
import subprocess
import os
from saml2 import server
from saml2 import BINDING_HTTP_ARTIFACT
from saml2 import BINDING_URI
from saml2 import ... | |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | |
#!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import re
import unittest
from tvcm import parse_html_deps
from tvcm import html_generation_controller
class ParseTests(unittest... | |
'''More Goodness of fit tests
contains
GOF : 1 sample gof tests based on Stephens 1970, plus AD A^2
bootstrap : vectorized bootstrap p-values for gof test with fitted parameters
Created : 2011-05-21
Author : Josef Perktold
parts based on ks_2samp and kstest from scipy.stats
(license: Scipy BSD, but were completely... | |
# -*- coding: utf-8 -*-
'''ordering test mixins'''
class stooges: #@IgnorePep8
name = 'moe'
age = 40
class stoog2: #@IgnorePep8
name = 'larry'
age = 50
class stoog3: #@IgnorePep8
name = 'curly'
age = 60
class stoog4: #@IgnorePep8
name = 'beastly'
age = 969
class MathMixin... | |
"""
String Constants used in Hops-Util: Environment variables, Kafka Config, SSL Config etc.
"""
class HTTP_CONFIG:
"""
HTTP String constants
"""
HTTP_CONTENT_TYPE = "Content-type"
HTTP_APPLICATION_JSON = "application/json"
HTTP_AUTHORIZATION = "Authorization"
HTTP_POST = "POST"
HTTP_P... | |
"""
.. Provide some widely useful utilities. Safe for "from utils import *".
.. moduleauthor:: Peter Norvig, Luca Gilardi
"""
# from __future__ import print_function
import operator, math, random, copy, sys, os.path, bisect
import collections
from os.path import basename
from pprint import pprint
from itertools imp... | |
#!/usr/bin/env python
#
# PyGab - Python Jabber Framework
# Copyright (c) 2008, Patrick Kennedy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must r... | |
# -*- coding: utf-8 -*-
'''
Manage and query NPM packages.
'''
from __future__ import absolute_import
try:
from shlex import quote as _cmd_quote # pylint: disable=E0611
except ImportError:
from pipes import quote as _cmd_quote
# Import python libs
import json
import logging
import distutils.version # pylint:... | |
from unittest import TestCase
import copy
import io
import yaml
import itertools
from dax.processor_parser import ProcessorParser
from dax.processors import AutoProcessor
from dax.tests import unit_test_entity_common as common
from dax.tests import unit_test_common_processor_yamls as yamls
from dax import yaml_doc
... | |
# -*- coding: utf-8 -*-
import logging
from datetime import datetime
import pymongo
from bson.objectid import ObjectId
from pymongo import ReturnDocument
LOG = logging.getLogger(__name__)
class ClinVarHandler(object):
"""Class to handle clinvar submissions for the mongo adapter"""
def create_submission(sel... | |
"""Backing implementation for InstallRequirement's various constructors
The idea here is that these formed a major chunk of InstallRequirement's size
so, moving them and support code dedicated to them outside of that class
helps creates for better understandability for the rest of the code.
These are meant to be used... | |
from contextlib import suppress
import http.client
import os
import tempfile
from unittest import TestCase
from app.common.build_artifact import BuildArtifact
from app.util import fs, log
from app.util.conf.base_config_loader import BaseConfigLoader
from app.util.conf.configuration import Configuration
from app.util.p... | |
#!/usr/bin/env python
import argparse
import hashlib
import httplib
import json
import os
import re
import shutil
import sys
import tarfile
import tempfile
import time
import urllib
import urlparse
import zipfile
REST_ENDPOINT = "http://fsurf.ci-connect.net/freesurfer_test"
VERSION = 'PKG_VERSION'
STAGE_OPTIONS = ['-a... | |
#
# PluginManagerQt.py -- Simple class to manage plugins.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import sys
import threading
import traceback
from ginga.qtw.Qt... | |
import imp
import logging
import os
import sys
from mock import *
from gp_unittest import *
from gppylib.gpcatalog import GPCatalogTable
class GpCheckCatTestCase(GpTestCase):
def setUp(self):
# because gpcheckcat does not have a .py extension, we have to use imp to import it
# if we had a gpcheck... | |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from flask import Blueprint
from flask.ext.restplus import fields, Api
from . import TestCase
class FieldTestCase(TestCase):
def setUp(self):
super(FieldTestCase, self).setUp()
blueprint = Blueprint('api', __name__)
self.api... | |
import bs4
import logging
import random
import requests
import threading
import time
from modules.l2_miner.common import HEADERS
from modules.l2_miner.common import SERVER_ADDR
from modules.l2_miner.common import URL_PREFIX
from modules.utils import UnimplementedMethodCalled
from modules.utils import get_exception_msg... | |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016, Giacomo Cariello. 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | |
#
# 1337ris -- main.py
# Henry Weiss
#
# The backbone of the game. Has many roles and responsibilities, but that is
# the most succint way of putting it. In more detail:
#
# - Runs the event loop and coordinates communication between other controller
# objects.
# - Manages the game state, and any transitioning/commun... | |
##########################################################################
#
# Copyright (c) 2018, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | |
"""
Unit tests of Path types.
"""
import numpy as np
from holoviews import Dataset, Ellipse, Box, Polygons, Path
from holoviews.core.data.interface import DataError
from holoviews.element.comparison import ComparisonTestCase
class PathTests(ComparisonTestCase):
def test_multi_path_list_constructor(self):
... | |
from input import *
import numpy as np
from os import path
import skimage.io as skimgio
import PIL.Image
from PIL import Image
import imghdr
import random
import skimage as sk
import skimage.transform as sktf
from skimage.transform import SimilarityTransform
from skimage.transform import warp as skwarp
from img2d_utils... | |
"""Example training a memory neural net on the bAbI dataset.
References Keras and is based off of https://keras.io/examples/babi_memnn/.
"""
from __future__ import print_function
from tensorflow.keras.models import Sequential, Model, load_model
from tensorflow.keras.layers import Embedding
from tensorflow.keras.laye... | |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Class for bitcoind node under test"""
import contextlib
import decimal
import errno
from enum import E... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.