gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from segwit import send_to_witness
from test_framework.test_framework import BitcoinTestFramework
from test_fr... | |
import os
import shutil
import unittest
import tempfile
import struct
from pyoram.storage.block_storage import \
BlockStorageTypeFactory
from pyoram.storage.block_storage_file import \
BlockStorageFile
from pyoram.storage.block_storage_mmap import \
BlockStorageMMap
from pyoram.storage.block_storage_ram ... | |
# --------------------------------------------------------------------------------- #
# MULTIDIRDIALOG wxPython IMPLEMENTATION
#
# Andrea Gavana, @ 07 October 2008
# Latest Revision: 28 Sep 2012, 21.00 GMT
#
#
# TODO List
#
# 1) Implement an meaningful action for the "Make New Folder" button, but this
# requires a s... | |
# Copyright 2018 The TensorFlow 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
#
# Unless required by applicab... | |
"""Common Shell Utilities."""
import os
from subprocess import Popen, PIPE
from multiprocessing import Process
from threading import Thread
from ..core.meta import MetaMixin
from ..core.exc import FrameworkError
def cmd(command, capture=True, *args, **kwargs):
"""
Wrapper around ``exec_cmd`` and ``exec_cmd2`... | |
# -*- coding: utf-8 -*-
"""Algorithms for directed acyclic graphs (DAGs)."""
# Copyright (C) 2006-2011 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
from fractions import gcd
import networkx as nx
from net... | |
# Copyright 2014
# The Cloudscaling Group, 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... | |
# Copyright 2015-2016 Dietrich Epp.
#
# This file is part of Kitten Teleporter. The Kitten Teleporter source
# code is distributed under the terms of the MIT license.
# See LICENSE.txt for details.
import base64
import collections
import hashlib
import json
import os
import pipes
import subprocess
import sys
class Bu... | |
"""
unmatcher :: Regular expression reverser for Python
"""
__version__ = "0.1.4-dev"
__author__ = "Karol Kuczmarski"
__license__ = "Simplified BSD"
import random
import re
import string
import sys
# Python 2/3 compatibility shims
IS_PY3 = sys.version[0] == '3'
if IS_PY3:
imap = map
unichr = chr
xrange ... | |
import re
import sys
from decimal import Decimal
from django.contrib.gis.db.backends.base import BaseSpatialOperations
from django.contrib.gis.db.backends.utils import SpatialOperation, SpatialFunction
from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter
from django.contrib.gis.geometry.back... | |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
from iptest.assert_util import *
skiptest("win32")
from iptest.console_util import IronPythonInstance
remove... | |
#! /usr/bin/env python3
'''
pygnstats
==============================================================================
Author: Ferdinand Saufler <mail@saufler.de>
Version: 0.27.0
Date: 21.12.2014
For documentation please visit https://github.com/derwilly/pyngstats
=================================================... | |
from django.test import TestCase
from django.contrib.auth.models import Group
from hs_access_control.models import UserResourceProvenance, UserResourcePrivilege, \
GroupResourceProvenance, GroupResourcePrivilege, \
UserGroupProvenance, UserGroupPrivilege, \
PrivilegeCodes
from hs_core import hydroshare
fr... | |
"""
SimpleConfigParser
Simple configuration file parser: Python module to parse configuration files
without sections. Based on ConfigParser from the standard library.
Author: Philippe Lagadec
Project website: http://www.decalage.info/python/configparser
Inspired from an idea posted by Fredrik Lundh:
http://mail.pyt... | |
import io
import threading
import synapse.link as s_link
import synapse.async as s_async
import synapse.daemon as s_daemon
import synapse.neuron as s_neuron
import synapse.common as s_common
import synapse.telepath as s_telepath
import synapse.lib.session as s_session
from synapse.common import *
from synapse.tests.... | |
# Copyright 2019 The TensorFlow 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
#
# Unless required by applica... | |
#!/usr/bin/env python2
'''
Unit tests for yedit
'''
import unittest
import os
# Removing invalid variable names for tests so that I can
# keep them brief
# pylint: disable=invalid-name,no-name-in-module
# Disable import-error b/c our libraries aren't loaded in jenkins
# pylint: disable=import-error
from yedit import... | |
"""
Functions for acting on a axis of an array.
"""
from __future__ import division, print_function, absolute_import
import numpy as np
def axis_slice(a, start=None, stop=None, step=None, axis=-1):
"""Take a slice along axis 'axis' from 'a'.
Parameters
----------
a : numpy.ndarray
The array ... | |
# +--------------------------------------------------------------------------+
# | Licensed Materials - Property of IBM |
# | |
# | (C) Copyright IBM Corporation 2009-2013. |
# +-... | |
"""
Utility classes and functions for the polynomial modules.
This module provides: error and warning objects; a polynomial base class;
and some routines used in both the `polynomial` and `chebyshev` modules.
Error objects
-------------
.. autosummary::
:toctree: generated/
PolyError base class for... | |
import pymc
import numpy as np
from numpy import exp, log
import moments, jacobians, defaults, istat
import warnings
"""
Bayesian Distribution Selection
===============================
:author: David Huard
:date: May 7, 2008
:institution: McGill University, Montreal, Qc, Canada
Introduction
------------
This modu... | |
#!/usr/bin/env python
'''
/**************************************************************************
*
* Copyright 2009 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), ... | |
# Copyright (c) 2006-2007 The Regents of The University of Michigan
# Copyright (c) 2009 Advanced Micro Devices, 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 co... | |
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn import linear_model, datasets
diabetes = datasets.load_diabetes()
X, y = diabetes.data, diabetes.target
# TODO: use another dataset that has multiple drops
def test_simple():
"""
Principle of Lars is to keep covariances tie... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, print_function
import subprocess
import sys
import pytest
try:
import unittest2 as unittest
except ImportError:
import unittest
try:
from mock import patch, Mock, MagicMock
except ImportError:
from... | |
from urllib.parse import unquote
import re
import os
import glob
import time
import shutil
import tempfile
import logging
from math import floor
import lxml.etree
import collections
from indra.databases import go_client, mesh_client
from indra.statements import *
from indra.databases.chebi_client import get_chebi_id_... | |
#!/usr/bin/env python
# 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 ... | |
# Copyright 2015 The TensorFlow 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
#
# Unless required by applica... | |
"""Module otsun.materials for treating materials
The module relies on a basic class `Material` with two subclasses
`VolumeMaterial` and `SurfaceMaterial`, and several subclasses of them
for specific materials.
"""
import json
import zipfile
from FreeCAD import Base
from .optics import Phenomenon, OpticalState, reflec... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2010 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#... | |
"""
Functions for identifying peaks in signals.
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy._lib.six import xrange
from scipy.signal.wavelets import cwt, ricker
from scipy.stats import scoreatpercentile
__all__ = ['argrelmin', 'argrelmax', 'argrelextrema', 'fin... | |
# 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)
import os
import uni... | |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -------------------------------------------------------------------------... | |
import datetime
import os
import django.utils.copycompat as copy
from django.conf import settings
from django.db.models.fields import Field
from django.core.files.base import File, ContentFile
from django.core.files.storage import default_storage
from django.core.files.images import ImageFile, get_image_dimensions
fr... | |
"""Unit tests for tftpy."""
# vim: ts=4 sw=4 et ai:
# -*- coding: utf8 -*-
import logging
import os
import threading
import time
import unittest
from contextlib import contextmanager
from errno import EINTR
from multiprocessing import Queue
from shutil import rmtree
from tempfile import mkdtemp
import tftpy
log = lo... | |
# Copyright 2018 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Utility functions for google.protobuf.field_mask_pb2.FieldMask.
Supports advanced field mask semantics:
- Refer to fields and map keys using .... | |
import numpy as np
import torch
from torch import nn
import os
import os.path as osp
from collections import OrderedDict
from torch.autograd import Variable
import itertools
from ..util import util as util
from .base_model import BaseModel
from . import networks_basic as networks
from scipy.ndimage import zoom
import f... | |
from itertools import izip_longest, islice
import re
from letters import is_vowell, to_tipa, to_order_tuple
class WordParseError(Exception):
pass
class Word(object):
def __init__(self, morphemes, syllables, category):
self._morphemes = tuple(morphemes)
self._syllables = tuple(syllables)
self._categ... | |
from django.core import validators
from django.core.exceptions import PermissionDenied
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.conf import settings
from django.utils.translation import ugettext, ungettext
from django.utils.encoding import smart_unicode, force_unico... | |
import time
import random
import hashlib
import six
from social.utils import setting_name, module_member
from social.store import OpenIdStore, OpenIdSessionWrapper
from social.pipeline import DEFAULT_AUTH_PIPELINE, DEFAULT_DISCONNECT_PIPELINE
class BaseTemplateStrategy(object):
def __init__(self, strategy):
... | |
'''
Given input of a fixed k, checks whether the cop number of a graph,
G, is less than or equal to k.
'''
import networkx as nx
from copy import deepcopy
def kproduct(graph):
'''
Applies the tensor product to graph k-1 times.
INPUT:
graph: A networkx graph
OUTPUT
tensor: The graph on which t... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | |
import datetime
import requests
class Forecast():
def __init__(self, data, url, headers):
self.url = url
self.http_headers = headers
self.json = data
def update(self):
r = requests.get(self.url)
self.data = r.json()
self.http_headers = r.headers
def curren... | |
r"""
SANS Resolution Simulator
=========================
Propagate a neutron from an isotropic source through a source and sample
pinhole and onto a detector. For each pixel on the detector, compute the
effective resolution.
Usage
=====
Modify instrument geometry, target pixels and number of neutrons at the
bottom ... | |
# Copyright 2020 The TensorFlow 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
#
# Unless required by applica... | |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from wagtai... | |
# Copyright (c) 2011 Sam Rushing
#
# key.py - OpenSSL wrapper
#
# This file is modified from python-bitcoinlib.
#
"""ECC secp256k1 crypto routines
WARNING: This module does not mlock() secrets; your private keys may end up on
disk in swap! Use with caution!
"""
import ctypes
import ctypes.util
import hashlib
import ... | |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'Authenticator', fields ['user', 'type']
db... | |
# Copyright 2012 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 ... | |
# Libraries
import sys
import os
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from sqlalchemy import *
from sqlalchemy.orm import *
# My Imports
from databaseschema import *
from genericdelegates import *
from functions import *
import modelsandviews
import ui_forms.ui_prodprepform
# if pack in volume are cha... | |
import hashlib
import random
import string
import transaction
from cryptacular.bcrypt import BCRYPTPasswordManager
from pyramid.threadlocal import get_current_request
from pyramid.util import DottedNameResolver
from sqlalchemy import (Column,
ForeignKey,
Index,
... | |
import json
import uuid
import jsonschema
import anchore_engine.configuration.localconfig
from anchore_engine.apis.context import ApiRequestContextProxy
from anchore_engine.clients.services import http, internal_client_for
from anchore_engine.clients.services.simplequeue import SimpleQueueClient
from anchore_engine.d... | |
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 re... | |
# 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 ... | |
import json
import os
import time
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from elasticsearch.exceptions import NotFoundError
import olympia.core.logger
from olympia.addons.indexers import AddonIndexer
from olympia.amo.celery import task
from olympia.amo.sea... | |
# Copyright (c) 2010 Aldo Cortesi
# Copyright (c) 2011 Florian Mounier
# Copyright (c) 2011 oitel
# Copyright (c) 2011 Kenji_Takahashi
# Copyright (c) 2011 Paul Colomiets
# Copyright (c) 2012, 2014 roger
# Copyright (c) 2012 nullzion
# Copyright (c) 2013 Tao Sauvage
# Copyright (c) 2014-2015 Sean Vig
# Copyright (c) 20... | |
# Copyright 2016 The TensorFlow 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
#
# Unless required by applica... | |
import wx
import wx.grid as gridlib
import wx.combo
from pprint import PrettyPrinter
import json
import os
from CreatorView.RelativePaths import relative_music_path,relative_dependencies_path
from uuid import uuid4
import traceback
import re
class CreatorView(wx.Panel):
def __init__(self, parent, size, name, musi... | |
from __future__ import absolute_import, print_function
import cython
from .. import __version__
import collections
import re, os, sys, time
from glob import iglob
try:
import gzip
gzip_open = gzip.open
gzip_ext = '.gz'
except ImportError:
gzip_open = open
gzip_ext = ''
import shutil
import subpro... | |
"""
Module providing easy API for working with remote files and folders.
"""
import hashlib
import re
import os
import six
from functools import partial
from fabric.context_managers import hide, settings
from fabric.operations import put, run, sudo
from fabric.state import env
from fabric.utils import abort, apply_l... | |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
from __future__ import unicode_literals
from future.builtins import *
import os
import sys
import pickle
from past.builtins import basestring
import streamsx.ec as ec
from streamsx.topology.schema import StreamSchema
try:
import dil... | |
#!/usr/bin/env python
#-
# Copyright (c) 2006 Verdens Gang AS
# Copyright (c) 2006-2015 Varnish Software AS
# All rights reserved.
#
# Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
# Author: Martin Blix Grydeland <martin@varnish-software.com>
#
# Redistribution and use in source and binary forms, with or without
# mod... | |
# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... | |
import pickle
import time
import string
# import os
from math import pi, sqrt, sin, copysign, floor, ceil
from functools import partial
import warnings
import numpy as np
import pandas as pd
import scipy.stats as ss
import scipy.optimize as so
import scipy.integrate as si
# from scipy.stats.kde import gaussian_kde
imp... | |
__author__ = 'rcj1492'
__created__ = '2017.06'
__license__ = 'MIT'
'''
deploy to heroku
deploy to EC2
TODO: deploy to other platforms (azure, gcp, bluemix, rackspace, openshift)
'''
_deploy_details = {
'title': 'Deploy',
'description': 'Deploys a service to a remote platform. Deploy is currently only availab... | |
from fabric import colors
from fabric import api as fab
from fabric import decorators
from fabric.contrib import files
import os, getpass
fab.env.colors = True
OS_COMMANDS = ('sudo apt-get install aptitude',
'sudo aptitude update',
'sudo aptitude install python-dev -y',
'... | |
from __future__ import print_function
import ast
import copy
import logging
import re
import time
import urllib.parse
import uuid
from pprint import pformat
from typing import Optional, Tuple
import demisto_client
import requests.exceptions
import urllib3
from demisto_client.demisto_api import DefaultApi
from demisto... | |
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django_dynamic_fixture import G, N
from entity.models import Entity, EntityRelationship, EntityKind
from mock import patch
from entity_subscription.models import Medium, Source, Subscription, Unsubscribe
class Subscripti... | |
from __future__ import print_function
import unittest
import numpy as np
import sqaod as sq
import sqaod.common as common
from tests.example_problems import *
from math import log, exp
class TestBipartiteGraphAnnealerBase:
def __init__(self, anpkg, dtype) :
self.anpkg = anpkg
self.dtype = dtype
... | |
# Copyright 2018 The TensorFlow 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
#
# Unless required by applica... | |
"""
Collection of utilities to manipulate structured arrays.
Most of these functions were initially implemented by John Hunter for matplotlib.
They have been rewritten and extended for convenience.
"""
import sys
import itertools
import numpy as np
import numpy.ma as ma
from numpy import ndarray, recarray
from nump... | |
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
from gzip import GzipFile
import os.path as op
import re
import time
import uuid
import numpy as np
from scipy import linalg
from .constants import FIFF
from ..uti... | |
from pytest import raises
from desmod.queue import PriorityItem, PriorityQueue, Queue
def test_mq(env):
queue = Queue(env, capacity=2)
def producer(msg, wait):
yield env.timeout(wait)
yield queue.put(msg)
def consumer(expected_msg, wait):
yield env.timeout(wait)
msg = yi... | |
import os
import sys
import math
import platform
import numpy as np
from common.numpy_fast import clip, interp
from common.kalman.ekf import FastEKF1D, SimpleSensor
# radar tracks
SPEED, ACCEL = 0, 1 # Kalman filter states enum
rate, ratev = 20., 20. # model and radar are both at 20Hz
ts = 1./rate
freq_v_lat = ... | |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
from pytest import raises as assert_raises
from scipy.sparse.csgraph import (shortest_path, dijkstra, johnson,
bellman_ford, construct_dist_matrix, NegativeCyc... | |
import nibabel as nib
import numpy as np
import numpy.testing as npt
from dipy.core.sphere import HemiSphere, unit_octahedron
from dipy.core.gradients import gradient_table
from dipy.data import get_data
from dipy.tracking.local import (LocalTracking, ThresholdTissueClassifier,
Direct... | |
"""Constants for the opentherm_gw integration."""
import pyotgw.vars as gw_vars
from homeassistant.const import (
DEVICE_CLASS_TEMPERATURE,
TEMP_CELSIUS,
TIME_HOURS,
TIME_MINUTES,
UNIT_PERCENTAGE,
)
ATTR_GW_ID = "gateway_id"
ATTR_LEVEL = "level"
ATTR_DHW_OVRD = "dhw_override"
CONF_CLIMATE = "clim... | |
"""Parser of the Daily Summary Message (DSM)."""
import re
from datetime import datetime, timedelta
from metpy.units import units
from pyiem.nws.product import TextProduct
from pyiem.util import utc
from pyiem.reference import TRACE_VALUE
PARSER_RE = re.compile(
r"""^(?P<station>[A-Z][A-Z0-9]{3})\s+
DS\s+
... | |
#!/usr/bin/env python
from __future__ import absolute_import, print_function, division
from os.path import join
import contextlib
import os
import shutil
import subprocess
import re
import shlex
import runpy
import zipfile
import tarfile
import platform
import click
import pysftp
import fnmatch
# https://virtualenv.py... | |
"""
This module provides access to the OSVR ClientKit C API via the foreign function interface ctypes.
Each class defines the struct of the same name in the C API. Likewise, each method defines the function of the same name in the C API.
For reference, view the C API documentation at http://resource.osvr.com/docs/OSVR... | |
from geo import *
INVALID = 0
CHECK = 1
CHECK_MATE = 2
PROMOTION = 3
TAKE = 4
DRAW = 5
VALID = 6
ENPASANT = 7
KING_CASTLE = 8
QUEEN_CASTLE = 9
WHITE_WIN = 10
BLACK_WIN = 11
WHITE = 12
BLACK = 13
class Piece(object):
def __init__(self, board, colo... | |
import numpy as np
import ray.experimental.array.remote as ra
import ray
from . import core
__all__ = ["tsqr", "modified_lu", "tsqr_hr", "qr"]
@ray.remote(num_returns=2)
def tsqr(a):
"""Perform a QR decomposition of a tall-skinny matrix.
Args:
a: A distributed matrix with shape MxN (suppose K = min... | |
""" Dictionary learning
"""
# Author: Vlad Niculae, Gael Varoquaux, Alexandre Gramfort
# License: BSD
import time
import sys
import itertools
import warnings
from math import sqrt, floor, ceil
import numpy as np
from scipy import linalg
from numpy.lib.stride_tricks import as_strided
from ..base import BaseEstimator... | |
# Copyright 2018 The TensorFlow 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
#
# Unless required by applica... | |
from datetime import date, datetime, timedelta
import json
from django.core.cache import cache
from nose.tools import eq_
from kitsune.customercare.tests import reply
from kitsune.kpi.cron import update_contributor_metrics
from kitsune.kpi.models import (
Metric, AOA_CONTRIBUTORS_METRIC_CODE, KB_ENUS_CONTRIBUTOR... | |
#!/usr/bin/env python
from ..debugging import bacpypes_debugging, ModuleLogger
from ..capability import Capability
from ..object import FileObject
from ..apdu import AtomicReadFileACK, AtomicReadFileACKAccessMethodChoice, \
AtomicReadFileACKAccessMethodRecordAccess, \
AtomicReadFileACKAccessMethodStreamAcces... | |
# The MIT License (MIT)
#
# Copyright (c) 2021 Samuel Bear Powell
#
# 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, co... | |
"""Disables an account"""
from baseCmd import *
from baseResponse import *
class disableAccountCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "true"
"""If true, only lock the account; else disable the account"""
"""Required"""
self.lock = None
self.typ... | |
#
# 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... | |
# -*- coding: utf-8 -*-
"""
Yelp API v2.0 code sample.
This program demonstrates the capability of the Yelp API version 2.0
by using the Search API to query for businesses by a search term and location,
and the Business API to query additional information about the top result
from the search query.
Please refer to ht... | |
#!/usr/bin/python
#
# To make our hack work, we change CC and LD to point at this script, and this
# script will swap out all the OSX-specific flags for iOS-specific flags.
#
import glob
import os
import re
import subprocess
import sys
def get_developer_dir():
if 'DEVELOPER_DIR' in os.environ:
return os.... | |
#!/usr/bin/env python
# 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 tool to extract size information for chrome, executed by buildbot.
When this is run, the current directory (cwd) should be ... | |
"""Support for Flux lights."""
import logging
import random
from flux_led import BulbScanner, WifiLedBulb
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_EFFECT,
ATTR_HS_COLOR,
ATTR_WHITE_VALUE,
EFFECT_COLORLOOP,
EFFECT_RANDOM,
... | |
# -*- coding: utf-8 -*-
# File: trainers.py
import multiprocessing as mp
import os
import sys
import tensorflow as tf
from tensorpack.compat import tfv1
from ..callbacks import CallbackFactory, RunOp
from ..graph_builder.distributed import DistributedParameterServerBuilder, DistributedReplicatedBuilder
from ..graph_b... | |
# Copyright (c) 2018 PaddlePaddle 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
#
# Unless required by app... | |
import scrapy
import hashlib
import random
from random import randint
from games.items import Game
from games.items import Platform
from games.items import Screenshot
from games.items import Shot
class ShotSpider(scrapy.Spider):
name = "shots"
start_url = "http://www.mobygames.com"
saida = No... | |
#!/usr/bin/python
# Copyright (c) 2006-2008 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.
# chrome_tests.py
''' Runs various chrome tests through valgrind_test.py.
This file is a copy of ../purify/chrome_tests.py. Even... | |
"""
Object for isochrone storage and basic calculations.
NOTE: only absolute magnitudes are used in the Isochrone class
ADW: There are some complicated issues here. As we are generally using a
forward-folding likelihood technique, what we would like to do is to
convolve the isochrone model with the survey response fu... | |
#!/usr/bin/env python
import numpy as np
import tables as tb
# This class is accessible only for the examples
class Small(tb.IsDescription):
var1 = tb.StringCol(itemsize=4, pos=2)
var2 = tb.Int32Col(pos=1)
var3 = tb.Float64Col(pos=0)
# Define a user record to characterize some kind of particles
class... | |
# position/views_admin.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .controllers import positions_import_from_master_server, refresh_cached_position_info_for_election, \
refresh_positions_with_candidate_details_for_election, \
refresh_positions_with_contest_office_details_for_election,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.