gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
# -*- mode: python; coding: utf-8 -*-
# Copyright 2018 the HERA Collaboration
# Licensed under the 2-clause BSD license.
"""
Keep track of geo-located stations.
Top modules are generally called by external (to CM) scripts.
Bottom part is the class that does the work.
"""
import copy
import warnings
from sqlalchemy i... | |
"""mrecords
Defines the equivalent of recarrays for maskedarray.
Masked arrays already support named fields, but masking works only by records.
By comparison, mrecarrays support masking individual fields.
:author: Pierre Gerard-Marchant
"""
#!!!: * We should make sure that no field is called '_mask','mask','_fieldmas... | |
from django.db import models
from django.utils import timezone
from abstract import AbstractVote
from core import Makey, Tutorial
# from interactions import UserInteraction, Interaction
from review import ProductReview, ShopReview, SpaceReview
class VoteProductReview(AbstractVote):
review = models.ForeignKey(Pro... | |
#!/usr/bin/env python2.7
# Copyright 2015, Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this lis... | |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of th... | |
# 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
"""
Module for writing PREMIS metadata
"""
import os
import io
import uuid
from datetime import datetime
import xml.etree.ElementTree as ET
import pytz
from lxml import etree
from isolyzer import isolyzer
from . import config
from .mdaudio import getAudioMetadata
from .shared import makeHumanRe... | |
import datetime
import json
import re
import time
from functools import wraps
from hashlib import md5
from textwrap import wrap
from django.contrib.auth.decorators import permission_required
from django.core import validators
from django.http import (
HttpResponse,
HttpResponseBadRequest,
HttpResponseRedir... | |
# Copyright (c) 2012 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.
"""A wrapper for subprocess to make calling shell commands easier."""
import codecs
import logging
import os
import pipes
import select
import signal
imp... | |
"""The tests for the automation component."""
import asyncio
import logging
from unittest.mock import Mock, patch
import pytest
from homeassistant.components import logbook
import homeassistant.components.automation as automation
from homeassistant.components.automation import (
ATTR_SOURCE,
DOMAIN,
EVENT... | |
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... | |
# --input_dir=/home/torch/cleverhans/toolkit/dataset/images --output_dir=output --max_epsilon=16
from os.path import join
import numpy as np
from os import listdir
import argparse
from time import time
from keras.layers import Input, Dense, Reshape, Lambda, Add, Activation
from keras.models import Model
import keras.... | |
#!/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.
"""Provisions Android devices with settings required for bots.
Usage:
./provision_devices.py [-d <device serial number>]
"""
... | |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# CREATED:2015-02-14 19:13:49 by Brian McFee <brian.mcfee@nyu.edu>
'''Unit tests for time and frequency conversion'''
import os
try:
os.environ.pop('LIBROSA_CACHE_DIR')
except KeyError:
pass
import matplotlib
matplotlib.use('Agg')
import librosa
import numpy as... | |
# Copyright 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.
"""
Bitmap is a basic wrapper for image pixels. It includes some basic processing
tools: crop, find bounding box of a color and compute histogram of color va... | |
#!/usr/bin/env python
"""Web server for the Trendy Lights application.
The overall architecture looks like:
server.py script.js
______ ____________ _________
| | | | | |
| EE | <-> | App Engine | <-> | Browser |
|______| |____________| |___... | |
# Copyright 2019 The TensorNetwork 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 applicable law or agreed ... | |
# Copyright 2013 Metacloud, 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 functools
import os
from django import http
from django.db.models import Q
from django.shortcuts import get_object_or_404, redirect
import commonware.log
import jingo
import caching.base as caching
from tower import ugettext_lazy as _lazy, ugettext as _
import amo
from amo import messages
import sharing.views... | |
"""Tests for tools for manipulating of large commutative expressions. """
from sympy import (S, Add, sin, Mul, Symbol, oo, Integral, sqrt, Tuple, I,
Interval, O, symbols, simplify, collect, Sum, Basic, Dict,
root, exp, cos, sin, oo, Dummy, log)
from sympy.core.exprtools import (de... | |
#
# Copyright (c) SAS Institute 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 w... | |
from math import isnan
import warnings
import unittest
from unittest.mock import MagicMock
import numpy as np
from numpy.testing import assert_array_equal
from Orange.data import \
Instance, Domain, Unknown, Value, \
DiscreteVariable, ContinuousVariable, StringVariable
class TestInstance(unittest.TestCase):... | |
# -*- coding: utf-8 -*-
"""
lantz.drivers.ni.daqmx.channels
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Implementation of specialized channel classes.
:copyright: 2015 by Lantz Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from .base import Channel, Task
from .consta... | |
import re
import sys
import argparse
from IPython.nbformat.v3.rwbase import NotebookReader
from IPython.nbformat.v3.nbjson import JSONWriter
import IPython.nbformat.v3.nbbase as nbbase
class MarkdownReader(NotebookReader):
"""Import markdown to IPython Notebook.
The markdown is split into blocks: code and ... | |
#!/usr/bin/env python
# arguments are:
# - cluster scope
# - cluster role
# - master connection string
# for the AWS, the folliowing environment variables should be defined:
# - WALE_ENV_DIR: directory where WAL-E environment is kept
# - WAL_S3_BUCKET: a name of the S3 bucket for WAL-E
# - WALE_BACKUP_THRESHOLD_... | |
#
# 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... | |
from solr import Solr
import os, sys
reload(sys)
sys.setdefaultencoding('UTF8') # making UTF8 as default encoding
from argparse import ArgumentParser
from indexer import parse_lpsc_from_path
import re
from utils import canonical_name, canonical_target_name
# Functions to perform reference removal (assumes [n] referenc... | |
from __future__ import annotations
from typing import List, Tuple, Callable, Optional
import pytest
from itertools import product
from numpy.testing import assert_allclose, suppress_warnings
from scipy import special
from scipy.special import cython_special
bint_points = [True, False]
int_points = [-10, -1, 1, 10]
r... | |
# Copyright (c) 2015-2016 Cisco Systems
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | |
import re
import pytest
from aiohttp import web
async def test_middleware_modifies_response(loop, test_client):
async def handler(request):
return web.Response(body=b'OK')
@web.middleware
async def middleware(request, handler):
resp = await handler(request)
assert 200 == resp.st... | |
from symbol.builder import FasterRcnn as Detector
from symbol.builder import add_anchor_to_arg
from models.FPN.builder import MSRAResNet50V1FPN as Backbone
from models.FPN.builder import FPNNeck as Neck
from models.FPN.builder import FPNRpnHead as RpnHead
from models.FPN.builder import FPNRoiAlign as RoiExtractor
from ... | |
# -*- coding: utf-8 -*-
#
# Copyright 2015 MarkLogic Corporation
#
# 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 appli... | |
# Copyright 2013 Google Inc. 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
#
# Unless required by applicable law or ag... | |
from __future__ import print_function
from ctypes import py_object
class Array():
"""
ctypes array
"""
def __init__(self, *args, **kwargs):
if 'size' in kwargs:
self.size = kwargs['size']
else:
self.size = len(args)
if len(args) > self.size:
... | |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 OpenStack Foundation
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use t... | |
# Copyright (C) 2014 VA Linux Systems Japan K.K.
# Copyright (C) 2014 Fumihiko Kakuma <kakuma at valinux co jp>
# Copyright (C) 2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
# All Rights Reserved.
#
# Based on test for openvswitch agent(test_ovs_neutron_agent.py).
#
# Copyright (c) 2012 OpenStack Foundation.
#
# ... | |
'''
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2016, Telestax Inc and individual contributors
* by the @authors tag.
*
* This 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; ei... | |
# Copyright 2015 Google Inc. 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
#
# Unless required by applicable law or ag... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#==============================================================================
# main file for creating a database of all the experiments' runs
#==============================================================================
import os
import numpy as np
import pandas
from ... | |
# -*- coding:utf-8 -*-
import re, time
from gjqyxyxxcxxt.util._time import get_current_date
def get_url(key, param):
url_dic = {
'list_url': 'http://www.tianyancha.com/v2/search/%s.json?',
'czxx_url': 'http://www.tianyancha.com/expanse/holder.json?id=%s&ps=100&pn=1',
'ryxx_url': 'http://www.... | |
import re
class Pattern(object):
def __init__(self, name, regex):
self.name = name
self.pattern = re.compile(regex)
def match(self, input, index):
return self.pattern.match(input, index)
class Terminal(object):
def __init__(self, name, value):
self.name = name... | |
import copy
import random
from six import iteritems
try:
long()
except Exception:
long = int
from .JediTaskSpec import JediTaskSpec
from . import JediCoreUtils
from pandacommon.pandalogger.PandaLogger import PandaLogger
logger = PandaLogger().getLogger(__name__.split('.')[-1])
# class for input
class Input... | |
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import loadmat
from openmdao.api import Problem
from wakeexchange.OptimizationGroups import OptAEP
from wakeexchange.gauss import gauss_wrapper, add_gauss_params_IndepVarComps
from wakeexchange.floris import floris_wrapper, add_floris_params_IndepVarCom... | |
# -*- coding: utf-8 -*-
"""
weppy.dal.models
----------------
Provides model layer for weppy's dal.
:copyright: (c) 2015 by Giovanni Barillari
:license: BSD, see LICENSE for more details.
"""
from collections import OrderedDict
from .._compat import iteritems, with_metaclass
from .apis import com... | |
# -*- coding: utf-8 -*-
__author__ = 'anewbigging'
from rwslib.extras.rwscmd import data_scrambler
from rwslib.extras.rwscmd.odmutils import E_ODM, A_ODM
import unittest
import datetime
from lxml import etree
from six import string_types
class TestDuckTyping(unittest.TestCase):
def setUp(self):
self.valu... | |
import re
import datetime
from django.db.migrations import operations
from django.db.migrations.migration import Migration
from django.db.migrations.questioner import MigrationQuestioner
class MigrationAutodetector(object):
"""
Takes a pair of ProjectStates, and compares them to see what the
first would ... | |
###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary for... | |
# As a test suite for the os module, this is woefully inadequate, but this
# does add tests for a few functions which have been determined to be more
# portable than they had been thought to be.
import os
import errno
import unittest
import warnings
import sys
import signal
import subprocess
import sysconfig
import te... | |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | |
# 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 logging
from django.contrib.sites.models import Site
from django.contrib.sites.shortcuts import get_current_site
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import NoReverseMatch, reverse
from django.http import HttpResponseRedirect
from oscar.core.loading import get_cla... | |
# The MIT License (MIT)
#
# Copyright (c) 2018 Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... | |
#
# 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, software
# ... | |
"""
Soft Voting/Majority Rule classifier.
This module contains a Soft Voting/Majority Rule classifier for
classification estimators.
"""
# Authors: Sebastian Raschka <se.raschka@gmail.com>,
# Gilles Louppe <g.louppe@gmail.com>
#
# Licence: BSD 3 clause
import numpy as np
from ..base import BaseEstimator
f... | |
#!/usr/bin/python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# not... | |
# Copyright 2012 Hewlett-Packard Development Company, L.P.
# Copyright 2012 Varnish Software AS
#
# 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
... | |
""" Commandline scripts """
import argparse
import getpass
import gzip
import json
import logging
import os
import sys
from base64 import b64encode
import transaction
from jinja2 import Template
from pkg_resources import resource_string # pylint: disable=E0611
from pyramid.paster import bootstrap
from pypicloud.acce... | |
#!/usr/bin/python -u
import sys
import os
import subprocess
import time
from datetime import datetime
import shutil
import tempfile
import hashlib
import re
import logging
import argparse
################
#### Telegraf Variables
################
# Packaging variables
PACKAGE_NAME = "telegraf"
INSTALL_ROOT_DIR = "/us... | |
"""
pghoard
Copyright (c) 2015 Ohmu Ltd
See LICENSE for details
"""
from __future__ import print_function
from .common import lzma_decompressor, lzma_open_read, default_log_format_str
from .errors import Error
from psycopg2.extensions import adapt
from requests import Session
import argparse
import datetime
import log... | |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | |
##
# Copyright 2009-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... | |
#!/usr/bin/env python
#
# rbssh.py -- A custom SSH client for use in Review Board.
#
# This is used as an ssh replacement that can be used across platforms with
# a custom .ssh directory. OpenSSH doesn't respect $HOME, instead reading
# /etc/passwd directly, which causes problems for us. Using rbssh, we can
# work arou... | |
'''Tests for VCDWriter.'''
import os
import sys
import timeit
import pytest
from vcd.writer import (
CompoundVectorVariable,
ScopeType,
TimescaleMagnitude,
TimescaleUnit,
Variable,
VCDPhaseError,
VCDWriter,
VectorVariable,
)
def split_lines(capsys):
return capsys.readouterr()[0]... | |
'''@file trainer.py
neural network trainer environment'''
import os
import time
import cPickle as pickle
from abc import ABCMeta, abstractmethod
from math import ceil
import tensorflow as tf
from tensorflow.python.client import device_lib
from nabu.processing import input_pipeline
from nabu.neuralnetworks.trainers imp... | |
import cgi
from owslib.etree import etree
from datetime import datetime
from urllib import urlencode
from owslib import ows
from owslib.crs import Crs
from owslib.fes import FilterCapabilities
from owslib.util import openURL, testXMLValue, nspath_eval, nspath, extract_time
from owslib.namespaces import Namespaces
def ... | |
#!/usr/bin/env python
# 6.034 Lab 5
# Neural Net
# - In this file we have an incomplete skeleton of
# a neural network implementation. Follow the online instructions
# and complete the NotImplemented methods below.
#
import math
import random
class ValuedElement(object):
"""
This is an abstract class that al... | |
from __future__ import unicode_literals
import logging
from oauthlib.common import generate_token, urldecode
from oauthlib.oauth2 import WebApplicationClient, InsecureTransportError
from oauthlib.oauth2 import TokenExpiredError, is_secure_transport
import requests
log = logging.getLogger(__name__)
class TokenUpdat... | |
from os import path
import torch.autograd as autograd
import torch.cuda.comm as comm
from torch.autograd.function import once_differentiable
from torch.utils.cpp_extension import load
_src_path = path.join(path.dirname(path.abspath(__file__)), "src")
_backend = load(name="inplace_abn",
extra_cflags=["... | |
# -*- coding: utf8 -*-
from __future__ import print_function
import ast
import re
import warnings
import yaml # use yaml instead of json to get non unicode (works with ascii only data)
from rlp.utils import decode_hex, encode_hex
from ethereum import utils
from ethereum.utils import (
big_endian_to_int, ceil32,... | |
#!/usr/bin/env python
from datetime import datetime, timedelta
import logging
from optparse import OptionParser
import os
import re
from pheme.util.config import Config, configure_logging
from pheme.util.datefile import Datefile
from pheme.util.util import parseDate
from pheme.util.pg_access import AlchemyAccess, Dire... | |
# text_type is 'unicode' for py2 and 'str' for py3
from napalm_base.utils.py23_compat import text_type
alive = {
'is_alive': bool
}
facts = {
'os_version': text_type,
'uptime': int,
'interface_list': list,
'vendor': text_type,
'serial_number': text_type,
'model': text_type,
'hostname'... | |
# 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, software
# d... | |
import asyncio
import logging
import uuid
import os
from functools import partial
from typing import Any, List, Optional, Text, Union, Dict
import rasa.core.utils
from rasa.shared.exceptions import RasaException
import rasa.shared.utils.common
import rasa.utils
import rasa.utils.common
import rasa.utils.io
from rasa i... | |
#!/usr/bin/env python3
# The MIT License
# Copyright (c) 2016 Estonian Information System Authority (RIA), Population Register Centre (VRK)
#
# 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 ... | |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# 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 copyrigh... | |
# Copyright (c) 2006-2009 Sippy Software, Inc. All rights reserved.
#
# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA.
#
# SIPPY 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 ... | |
from xml.etree import ElementTree
from vistas.core.color import RGBColor
from vistas.core.graphics.feature import FeatureFactory
from vistas.core.graphics.terrain import TerrainTileFactory
from vistas.core.legend import StretchedLegend, CategoricalLegend
from vistas.core.plugins.data import DataPlugin
from vistas.core... | |
from six import BytesIO
from vcr.filters import (
remove_headers, replace_headers,
remove_query_parameters, replace_query_parameters,
remove_post_data_parameters, replace_post_data_parameters,
decode_response
)
from vcr.compat import mock
from vcr.request import Request
import gzip
import json
import zl... | |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:8791")
else:
access = Ser... | |
import re
from builtins import object, range
from . import exceptions
class Purl(object):
def __init__(self, url, **options):
super(Purl, self).__init__()
self.param_interpolate = {
'start': ':',
'end': ''
}
for opt in options:
if opt == 'interpolate' and len(options[opt]):
... | |
#!/usr/bin/env python
#
# Copyright 2007 The Closure Linter Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | |
# Copyright (c) 2013 OpenStack Foundation
# 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
#
# Unless ... | |
# -*- encoding: utf-8 -*-
from google.appengine.ext import ndb
from google.appengine.ext.blobstore import BlobInfo
class DuplicatedContainerName(Exception):
pass
class Container(ndb.Model):
name = ndb.StringProperty(required = True)
help = ndb.StringProperty(required = True, indexed = False)
order = n... | |
#!/usr/bin/env python
"""This file contains common grr jobs."""
import gc
import logging
import pdb
import threading
import time
import traceback
import psutil
from grr.client import client_utils
from grr.lib import config_lib
from grr.lib import flags
from grr.lib import rdfvalue
from grr.lib import registry
from... | |
#!/usr/bin/python3.4
# vim:ts=4:sw=4:softtabstop=0:smarttab
DOC = """
Master builder (custom script).
This top-level setup script helps with dealing with all sub-packages at
once. It also provides an installer for a simplify setting up developer mode.
Invoke it like a standard setup.py script. However, Any names aft... | |
'''
Inspector
=========
.. versionadded:: 1.0.9
.. warning::
This module is highly experimental, use it with care.
The Inspector is a tool for finding a widget in the widget tree by clicking or
tapping on it.
Some keyboard shortcuts are activated:
* "Ctrl + e": activate / deactivate the inspector view
... | |
# -*- coding: utf-8 -*-
# Copyright 2017 Novo Nordisk Foundation Center for Biosustainability,
# Technical University of Denmark.
#
# 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... | |
import sys, py
from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.rlib import jit
from rpython.rlib.rarithmetic import ovfcheck
from rpython.rlib.rstring import StringBuilder
class TestLLtype(LLJitMixin):
def test_dont_record_repeated_guard_class(self):
class A:
pass
... | |
import datetime
from fjord.base.tests import eq_, TestCase
from fjord.feedback.config import TRUNCATE_LENGTH
from fjord.feedback.models import (
Product,
Response,
ResponseEmail,
ResponseContext,
ResponsePI,
ResponseMappingType,
purge_data
)
from fjord.feedback.tests import (
ResponseFa... | |
# Copyright (C) 2006-2007 Robey Pointer <robeypointer@gmail.com>
# Copyright (C) 2012 Olle Lundberg <geek@nerd.sh>
#
# This file is part of paramiko.
#
# Paramiko 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 F... | |
import pytest
import capnp
import os
import math
this_dir = os.path.dirname(__file__)
@pytest.fixture
def addressbook():
return capnp.load(os.path.join(this_dir, 'addressbook.capnp'))
def test_addressbook_message_classes(addressbook):
def writeAddressBook(fd):
message = capnp._MallocMessageBuilder()... | |
# This is a small chunk of code from the skimage package. It is reproduced
# here because all we need is a couple color conversion routines, and adding
# all of skimage as dependecy is really heavy.
# Copyright (C) 2019, the scikit-image team
# All rights reserved.
# Redistribution and use in source and binary form... | |
"""
Statistical functions and tests, following scipy.stats.
Some differences
- We don't handle missing values at all
"""
# This is lightly adapted from scipy.stats 0.19
# https://github.com/scipy/scipy/blob/v0.19.0/scipy/stats/stats.py
# The original copyright notice follows:
# Copyright 2002 Gary Strangman. All r... | |
##
# Copyright (c) 2005-2015 Apple Inc. 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
#
# Unless required by applicable l... | |
# "Copyright (c) 2000-2003 The Regents of the University of California.
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose, without fee, and without written agreement
# is hereby granted, provided that the above copyright notice, the follow... | |
# Copyright (c) 2005-2010 Canonical
#
# Author: Michael Vogt <michael.vogt@ubuntu.com>
#
# 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 opti... | |
import pprint
import pickle
import socket
import exceptions
import time
import uuid
import numpy as np
import threading
import os
import sys
import cStringIO
import io
import base64
import traceback
import gc
import json
import obspy
import datetime
from obspy.core import read,UTCDateTime,Stream,Trace
import multiproce... | |
# Copyright 2014 MongoDB, 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 writing, so... | |
import sys
import os
import time
import math
import torch
import numpy as np
from PIL import Image, ImageDraw, ImageFont
from torch.autograd import Variable
import struct # get_image_size
import imghdr # get_image_size
def sigmoid(x):
return 1.0/(math.exp(-x)+1.)
def softmax(x):
x = torch.exp(x - torch.max(x... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.