gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
"""A module for dynamic, incremental ctypes code generation.
See the 'include' function for usage information.
"""
import sys
import os
import time
import bz2
import cPickle
import tempfile
try:
# md5 is deprecated in Python 2.5, so use hashlib if available
from hashlib import md5
except ImportError:
from ... | |
#!/usr/bin/env python
"""
EVENNIA SERVER LAUNCHER SCRIPT
This is the start point for running Evennia.
Sets the appropriate environmental variables and launches the server
and portal through the evennia_runner. Run without arguments to get a
menu. Run the script with the -h flag to see usage information.
"""
from __f... | |
#!/usr/bin/python
import re, json, copy, sys
from main import *
### Hex to bin converter and vice versa for objects
def json_is_base(obj, base):
alpha = get_code_string(base)
if isinstance(obj, (str, unicode)):
for i in range(len(obj)):
if alpha.find(obj[i]) == -1:
return ... | |
# 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... | |
#
# Copyright 2015 Red Hat. 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 a... | |
"""
"""
import tensorflow as tf
from six.moves import range
def leaky_relu(flow, slope):
"""
"""
return tf.maximum(flow, flow * slope)
def build_c_layer(flow, name, num_outputs=3, activation_fn=tf.nn.relu):
"""
arXiv:1703.10593v1
c7s1-32
"""
with tf.variable_scope(name):
wei... | |
# coding=utf-8
# Copyright 2022 The init2winit 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 la... | |
# 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... | |
# -*- coding: utf-8 -*-
from collections import OrderedDict
from .platform import Platform
from .keywords.sqlite_keywords import SQLiteKeywords
from ..table import Table
from ..index import Index
from ..column import Column
from ..identifier import Identifier
from ..foreign_key_constraint import ForeignKeyConstraint
f... | |
# 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 u... | |
import sys
from django import http
from django.core import signals
from django.utils.encoding import force_unicode
from django.utils.importlib import import_module
from django.utils.log import getLogger
logger = getLogger('django.request')
class BaseHandler(object):
# Changes that are always applied to a respon... | |
import unittest
from test import support
from random import random
from math import atan2, isnan, copysign
import operator
from sys import platform
INF = float("inf")
NAN = float("nan")
# These tests ensure that complex math does the right thing
class ComplexTest(unittest.TestCase):
def assertAlmostEqual(self, ... | |
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.db import transaction
from tastypie import fields
from tastypie.resources import ModelResource
from tastypie.authorization import Authorization
from tastypie.api import Api
from core.utils import locked_function
from mozdns.utils impor... | |
import os
import sys
import re
from pprint import pprint
import datetime
import dateutil
from dateutil import parser
from glob import glob
import calendar
from collections import namedtuple
import argparse
import textwrap
import codecs, locale
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
... | |
#!/usr/bin/env python
# Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Softwar where
# it's copied from other people. In these cases, that will normally be
# ... | |
import pydocstring.utils
def test_remove_indent():
"""Test pydocstring.utils.remove_indent."""
# string input
assert (pydocstring.utils.remove_indent(' fx\n gx\n hx') == ' fx\n gx\nhx')
assert (pydocstring.utils.remove_indent(' fx\n gx\n hx',
... | |
# Copyright (c) 2013, Felix Kolbe
# All rights reserved. BSD License
#
# 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 list of condit... | |
#######################################################################
#
# Copyright 2009-2010 by Ullrich Koethe
#
# This file is part of the VI... | |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import glob
import os
import re
import subprocess
from functools import wraps
from unittest import skip
from zipfile import ZipFile
from pants.backend.native.subsystems.native_build_step ... | |
from cloudify import ctx
from cloudify.exceptions import NonRecoverableError
from cloudify.state import ctx_parameters as inputs
import subprocess
import os
import re
import sys
import time
import threading
import platform
from StringIO import StringIO
from cloudify_rest_client import CloudifyClient
from cloudify im... | |
"""
:copyright: (c) 2014 Building Energy Inc
:license: see LICENSE for more details.
"""
import csv
import datetime
import hashlib
import math
import tempfile
# import time
import sys
from urllib import unquote
try:
import simplejson as json
except ImportError:
import json
from django.contrib.contenttypes.mode... | |
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from setup import Base, User, Category, Item
engine = create_engine('sqlite:///whitemarketgames.db')
# Bind the engine to the metadata of the Base class so that the
# declaratives can be accessed through a DBSession instance
Base.metadata.bi... | |
# pylint: disable=C0103, R0902
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#
#modification, are permitted provided that the following con... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#from __future__ import unicode_literals
from google.appengine.api import taskqueue
#from google.appengine.ext.ndb import Rollback
from widget import W
import models as m
from Libs.user_agents import parse as ua_parse
import basehandler as b
import datetime as d
import logging... | |
from __future__ import absolute_import, division, print_function
import logging
from time import time
import numpy as np
from ginga.misc import Bunch
from ginga.util import wcsmod
from ginga import AstroImage, BaseImage
from glue.core.util import split_component_view
from glue.core.exceptions import IncompatibleAttr... | |
# encoding: utf-8
"""
CXML graph objects created by the parser and that provide the XML generation
behavior.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
nsmap = {
'a': ('http://schemas.openxmlformats.org/drawingml/2006/main'),
'c': ('http://schemas.openx... | |
# Copyright 2012 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 requ... | |
"""
This module contains a CAB io implementation in TkInter.
"""
# External library imports.
import math
import sys
import tkinter
# Internal Simulation System component imports.
import cab.ca.ca_hex as cab_ca
import cab.util.io_interface as cab_io
import cab.util.logging as cab_log
__author__ = 'Michael Wagner'
c... | |
# Copyright 2015 Rackspace US, 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 wri... | |
# -*- encoding: utf-8 -*-
import re
import operator
from datetime import datetime
try:
from functools import reduce
except ImportError:
pass
import django
from django.db import models
from django.db.models import Model, Manager, Q
from django.core.exceptions import FieldDoesNotExist
from django.core.exception... | |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB 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... | |
"""
Basic functions for working with images.
"""
from __future__ import division, print_function, absolute_import
import itertools as itr
import numpy as np
def _import_skimage():
"""Import scikit-image, with slightly modified `ImportError` message"""
try:
import skimage
except ImportError:
... | |
#!/usr/bin/python3
import itertools
import operator
import bisect
import sys
class ModelLeaf(object):
def __init__(self, scale):
self.symbols = {}
self.exit = 0
self.scale = scale
def addSymbol(self, symbol, count):
if symbol not in self.symbols:
self.symbols[symbol] = 0
self.symbols[symbol] += count
... | |
import abc
import luigi
from luigi import configuration
from luigi.s3 import S3Target, S3PathTask
from mortar.luigi import mongodb
from mortar.luigi import mortartask
from mortar.luigi import target_factory
"""
This luigi pipeline runs the Last.fm example, pulling data from mongo and putting the
results in mongo. ... | |
'''
Basic processing procedures for analog signals (e.g., performing a z-score of a signal, or filtering a signal).
:copyright: Copyright 2014-2015 by the Elephant team, see AUTHORS.txt.
:license: Modified BSD, see LICENSE.txt for details.
'''
from __future__ import division, print_function
import numpy as np
import ... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright 2010-2012 OpenStack Foundation
#
# 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
#
# ... | |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import codecs
import datetime
import feedparser
import json
# import notify2
import os
import requests
import urlparse
# ------------------------------------------------------------------------------
class Podcatcher(object):
def __init__(self, *args, **kwargs):
... | |
# Copyright 2012 OpenStack Foundation
#
# 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... | |
# Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | |
# encoding=utf8
import re
import sys
import xlrd
import time
reload(sys)
sys.setdefaultencoding('utf8')
class ParseXls:
def __init__(self, xls_full_path_name):
self.xls_full_path_name = xls_full_path_name
self.staitc_file_name = ''
self.col_size = 0
self.row_size = 0
self.type = []
self.name = []
sel... | |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | |
from datetime import timedelta
from textwrap import dedent
from nose_parameterized import parameterized
from pandas import DataFrame
from catalyst import TradingAlgorithm
from catalyst.assets import Equity, Future
from catalyst.errors import IncompatibleCommissionModel
from catalyst.finance.commission import (
Co... | |
# Copyright (C) 2014 Universidad Politecnica de Madrid
# 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... | |
# Copyright 2014 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 a... | |
from __future__ import absolute_import, division, print_function
import pytest
pymysql = pytest.importorskip('pymysql')
from datashape import var, DataShape, Record, dshape
import itertools
from odo.backends.csv import CSV
from odo import resource, odo
import sqlalchemy
import sqlalchemy as sa
import os
import sys
i... | |
# Copyright (C) 2014 Nippon Telegraph and Telephone 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 2015 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 agre... | |
# Copyright (c) 2015 Yubico AB
# 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
# notice, this list of conditi... | |
from django.test import TestCase
from django.core.urlresolvers import reverse
from common.factories import UserFactory
import contacts as contact_constants
from contacts import factories
from contacts import models
class ContactModelTests(TestCase):
def setUp(self):
self.book = factories.BookFactory.crea... | |
"""pypyr context class. Dictionary ahoy."""
from collections import namedtuple
from collections.abc import Mapping, Set
from pypyr.dsl import SpecialTagDirective
from pypyr.errors import KeyInContextHasNoValueError, KeyNotInContextError
from pypyr.formatting import RecursiveFormatter
from pypyr.moduleloader import _Ch... | |
#
# Copyright (c) 2011-2014 The developers of Aqualid project - http://aqualid.googlecode.com
#
# 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 limitati... | |
"""
@package mi.instrument.noaa.ooicore.driver
@file marine-integrations/mi/instrument/noaa/ooicore/driver.py
@author Pete Cable
@brief BOTPT
Release notes:
"""
import json
import re
import time
import datetime
import ntplib
from mi.core.driver_scheduler import DriverSchedulerConfigKey, TriggerType
from mi.core.instru... | |
<<<<<<< HEAD
<<<<<<< HEAD
"""Unittests for test.script_helper. Who tests the test helper?"""
import subprocess
import sys
from test import script_helper
import unittest
from unittest import mock
class TestScriptHelper(unittest.TestCase):
def test_assert_python_expect_success(self):
t = script_helper._as... | |
#!/usr/bin/python
# Copyright (c) 2009 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.
"""Docbuilder for extension docs."""
import os
import os.path
import shutil
import sys
import time
import urllib
from subprocess impo... | |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from ...unittest import TestCase
from oauthlib.oauth2.draft25 import Client, PasswordCredentialsClient
from oauthlib.oauth2.draft25 import UserAgentClient, WebApplicationClient
from oauthlib.oauth2.draft25 import ClientCredentialsClient
f... | |
import numpy as np
import numpy.linalg as npl
import sys
npf64_zero = np.float64(0.)
npf64_one = np.float64(1.)
class Chain(object):
def __init__(self):
self.matrix = None
self.states = {}
self.states_by_label = {}
def _create_matrix(self):
"""
Create a 1x1 matrix with... | |
import pytest
from collections import namedtuple
from chalice.utils import OSUtils
from chalice.compat import pip_no_compile_c_env_vars
from chalice.compat import pip_no_compile_c_shim
from chalice.deploy.packager import Package
from chalice.deploy.packager import PipRunner
from chalice.deploy.packager import Subproce... | |
from __future__ import print_function
from itertools import product
import os
import os.path as op
import warnings
from nose.tools import assert_raises, assert_true
import numpy as np
from numpy.testing import (assert_equal, assert_allclose)
from mne.datasets import testing
from mne.io import read_raw_fif, read_raw_... | |
#
# 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
# ... | |
# -*- coding: utf-8 -*-
"""
Created on 26-04-2015
@author: Diogo Silva
Analysis on the influence of the number of prototypes K.
# TODO:
- make it work for EAC with KNN and K methods
- validate arguments
"""
import numpy as np
import eac
import K_Means3
from timeit import default_timer as timer # timing
import deter... | |
# Copyright 2006, 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 list of conditions and the f... | |
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
"""
The ``Pan`` plugin provides a small panning image that gives an overall
"birds-eye" view of the channel image that last had the focus. If the
channel image is zoomed in 2X or greater, then the pan region... | |
# 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... | |
#
# Copyright 2014 Rackspace, 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 2016 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | |
import os
from cPickle import load, dump
import logging
from skimage.transform import resize
from sklearn.metrics import recall_score, auc_score
import numpy as np
def lon_offset(x, y):
"""Return angular separation between two offsets which possibly
straddle l=0
>>> lon_offset(0, 1)
1
>>> lon_of... | |
import numpy as np
import tensorflow as tf
slim = tf.contrib.slim
DEFAULT_PADDING = 'SAME'
def layer(op):
'''Decorator for composable network layers.'''
def layer_decorated(self, *args, **kwargs):
# Automatically set a name if not provided.
name = kwargs.setdefault('name', self.get_unique_na... | |
# Copyright 2006 James Tauber and contributors
#
# 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 agre... | |
import mock
import mpi4py.MPI
import numpy as np
import pytest
import unittest
import chainer
import chainer.initializers
import chainer.links
import chainer.testing
import chainer.testing.attr
import chainermn
import chainerx
from chainermn.communicators import _communication_utility
from chainermn.communicators.flat... | |
# python 2
from __future__ import absolute_import
# builtins
from unittest import TestCase, main
# custom
from blowdrycss.classparser import ClassExtractor
from blowdrycss.utilities import unittest_file_path
class TestClassExtractor(TestCase):
# raw_class_list
def test_raw_class_list_js(self):
expec... | |
"""
This module exposes :class:`Cacher` and :class:`CacheStamp` classes, which
provide a simple API for on-disk caching.
The :class:`Cacher` class is the simplest and most direct method of caching. In
fact, it only requires four lines of boilderplate, which is the smallest
general and robust way that I (Jon Crall) hav... | |
# Copyright 2014-2017 Insight Software Consortium.
# Copyright 2004-2009 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
"""
defines classes, that describes C++ classes
This modules contains definition for next C++ declarations:
- class defi... | |
# 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, print_function, unicode_literals
import os
import sys
from builtins import open, range
import markdown
from docutils.core... | |
# Copyright 2014 - Rackspace
#
# 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,... | |
# Demo program for wrapping a Vamp plugin to visualize sound data.
# Uses the 'qm-transcription' Vamp plugin to turn an audio file into
# a sequence of notes (time of occurence, duration and midi key).
# This is visualized as a keyboard with each midi note represented by
# one key.
# Usage keyboard_demo.py <sound-file... | |
from ..libmp.backend import xrange
from .calculus import defun
#----------------------------------------------------------------------------#
# Polynomials #
#----------------------------------------------------------------------------#
# XXX: extra preci... | |
import mock
import pytest
import furl
import pytz
import datetime
from urlparse import urlparse
from nose.tools import * # flake8: noqa
from addons.wiki.models import WikiPage, WikiVersion
from addons.wiki.tests.factories import (
WikiFactory,
WikiVersionFactory,
)
from api.base.settings.defaults import API_... | |
# coding=utf-8
import xbmcaddon, xbmc, xbmcgui, xbmcplugin
import os, sys
import common
import xml.etree.ElementTree as ET
import resources.lib.fscache as fscache
import series as hdout_series
import xml.dom.minidom
import json
request_all_episodes_it = fscache.FSCache(xbmc.translatePath('special://temp/plugin.video.r... | |
import argparse
import glob
import json
import os
import socket
import threading
SERVER_ADDRESS = '/tmp/py3status_uds'
MAX_SIZE = 1024
REFRESH_EPILOG = """
examples:
refresh:
# refresh all instances of the wifi module
py3-cmd refresh wifi
# refresh multiple modules
py3-cmd refresh... | |
#
# This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2015. It is licensed under
# the three-clause BSD license; see LICENSE.
# Contact: khmer-project@idyll.org
#
# pylint: disable=C0111,C0103
import khmer
import khmer_tst_utils as utils
from nose.pl... | |
import sys
sys.path[0:0] = [""]
import unittest
from mongoengine import *
from mongoengine.queryset import Q
from mongoengine.queryset import transform
__all__ = ("TransformTest",)
class TransformTest(unittest.TestCase):
def setUp(self):
connect(db='mongoenginetest')
def test_transform_query(self... | |
"""
"""
#STL
import os, inspect, sys, math
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
#kivy
from kivy.properties import NumericProperty, ObjectProperty, ListProperty, BooleanProperty
from kivy.clock import... | |
# 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 list of conditions and the f... | |
# Copyright (c) 2013 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... | |
#!/usr/bin/env python
#
# Copyright 2012 the V8 project 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:
#
# * Redistributions of source code must retain the above copyright
# noti... | |
from collections import defaultdict
import datetime
import json
import re
from snoopy.helpers import default_json_serializer
TRACE_KEY_REGEX = r"([^:]+)::([^:]+):([\d]+)"
PYTHON_DATEFORMAT = "%Y-%m-%dT%H:%M:%S.%f"
TRACE_THRESHOLD = 0 # Bring config for this in the future
class FunctionCall(object):
def __ini... | |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Module for interfacing with phonopy, see https://atztogo.github.io/phonopy/
"""
from typing import Dict, List, Any
import numpy as np
from monty.dev import requires
from monty.serialization import loadfn
from scipy.interp... | |
"""
Helpers for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/integrations/zha/
"""
from __future__ import annotations
import asyncio
import binascii
from collections.abc import Callable, Iterator
from dataclasses import dataclass
import ... | |
# 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... | |
"""This script walks through how to use the Python API.
Covered here: importing GPUdb, instantiating Kinetica, creating a type,
creating a table, inserting records, retrieving records, filtering records,
aggregating/grouping records, and deleting records.
"""
from __future__ import print_function
import collections
... | |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | |
#!/usr/bin/env python
#
# Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""Fetch user client device / server operation logs.
"""
__author__ = 'spencer@emailscrubbed.com (Spencer Kimball)'
import datetime
import gzip
import heapq
import iso8601
import logging
import os
import re
import sys
import time
from col... | |
import datetime
import time
import bisect
import json
import sys
import subprocess
def parse_timestamp(raw_str):
tokens = raw_str.split()
if len(tokens) == 1:
if tokens[0].lower() == 'never':
return 'never';
else:
raise E... | |
#
# 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... | |
import os
import re
import time
import xbmc
import xbmcvfs
import xbmcgui
import urllib2
import bjsonrpc
from bjsonrpc.handlers import BaseHandler
from quasar.addon import ADDON, ADDON_PATH
from quasar.logger import log
from quasar.config import JSONRPC_EXT_PORT, QUASARD_HOST
from quasar.osarch import PLATFORM
from qua... | |
'''
Created on Mar 1, 2016
@author: zjl
'''
import numpy as np
import _pickle as pickle
# import preprocess
import timeit
import tables
import theano
import theano.tensor as T
from sklearn.metrics import f1_score, accuracy_score, confusion_matrix, precision_score, recall_score
from sklearn.cross_validation import S... | |
# ===============================================================================
# Copyright 2012 Jake Ross
#
# 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/licens... | |
"""
Implementation of Red-Black tree.
"""
class RBNode:
def __init__(self, val, is_red, parent=None, left=None, right=None):
self.val = val
self.parent = parent
self.left = left
self.right = right
self.color = is_red
class RBTree:
def __init__(self):
self.root... | |
from common_fixtures import * # NOQA
import requests
from requests.auth import HTTPBasicAuth
import urlparse
import json
RESOURCE_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)),
'resources')
@pytest.fixture(scope='module')
def transform_url(client):
return urlparse.ur... | |
'''
Compound Selection Behavior
===========================
The :class:`~kivy.uix.behaviors.compoundselection.CompoundSelectionBehavior`
`mixin <https://en.wikipedia.org/wiki/Mixin>`_ class implements the logic
behind keyboard and touch selection of selectable widgets managed by the
derived widget. For example, it can... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.