gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
# Copyright 2012 Locaweb.
# 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 appl... | |
# Copyright (c) 2013, Nathan Dunsworth - NFXPlugins
# 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... | |
# Copyright 2014 OpenStack, LLC
# 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 b... | |
import unittest
import os
import os.path
from robot.utils import abspath, normpath, get_link_path, WINDOWS, PY3
from robot.utils.robotpath import CASE_INSENSITIVE_FILESYSTEM
from robot.utils.asserts import assert_equal, assert_true
if PY3:
unicode = str
class TestAbspathNormpath(unittest.TestCase):
def te... | |
# 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... | |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | |
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Passes Python2.7's test suite and incorporates all the latest updates.
# From http://code.activestate.com/recipes/576693/
try:
from thread import get_ident as _get_ident
except ImportError:
from dummy_thread import get_ident ... | |
from django.db import models
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from datetime import datetime, date, timedelta
from pendulum import utils
try:
"""
if the app is installed from the start of a site, the sites table does
not exist and it causes problems. ... | |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... | |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | |
from django import forms
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
import pytz
from rest_framework import fields, permissions, serializers
from rest_framework.authentication import SessionAuthentication, CSRFCheck
from rest_f... | |
from __future__ import absolute_import, division, print_function
import atexit
import os
import logging
import socket
import select
import signal
import platform
import requests
import socket
from subprocess import Popen, PIPE, call
import struct
import time
import weakref
from .conf import get_config, DEFAULT_KNIT_H... | |
import re
import textwrap
import logging
import MySQLdb
from MySQLdb import OperationalError
from MySQLdb.constants.CLIENT import INTERACTIVE
__all__ = [
'connect',
'MySQLClient',
'OperationalError',
'ProgrammingError',
'DatabaseError'
]
LOGGER = logging.getLogger(__name__)
class MySQLClient(obje... | |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2012-2013 IBM Corp.
# 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/li... | |
# coding=utf-8
# Copyright 2020 The HuggingFace Team. 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 requir... | |
# -*- coding: utf-8 -*-
import markupsafe
from modularodm import fields
from framework.auth.decorators import Auth
from framework.exceptions import HTTPError
from website.addons.base import exceptions
from website.addons.base import AddonOAuthUserSettingsBase, AddonOAuthNodeSettingsBase
from website.addons.base impo... | |
"""
A widget containing a grid of clickable actions/buttons.
"""
from collections import namedtuple, deque
from PyQt4.QtGui import (
QFrame, QAction, QToolButton, QGridLayout, QFontMetrics,
QSizePolicy, QStyleOptionToolButton, QStylePainter, QStyle
)
from PyQt4.QtCore import Qt, QObject, QSize, QVariant, QEv... | |
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db.models import Prefetch, QuerySet
from django.db.models.query import get_prefetcher, prefetch_related_objects
from django.test import TestCase, override_setting... | |
# Copyright 2014 Donald Stufft
#
# 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 hashlib
import os
import urllib
import warnings
from typing import Any, Union, List
from pkg_resources import packaging
import torch
from PIL import Image
from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize
from tqdm import tqdm
from .model import build_model
from .simple_tokeni... | |
# 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... | |
#!/usr/bin/env python
import os
import argparse
import yaml
from fabric.api import run, task, cd, hide, abort, settings, lcd, local, env, execute
from fabric.utils import puts
from fabric.contrib.files import exists
from fabric.colors import cyan
from GitNotified import GitNotified
class GitSync:
local_path =... | |
# 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 python
# -*- encoding: utf-8 -*-
'''Unit tests for the display module'''
# For testing purposes, clobber the rcfile
import matplotlib
matplotlib.use('Agg') # nopep8
import matplotlib.pyplot as plt
import numpy as np
# Import the hacked image comparison module
from mpl_ic import image_comparison
fro... | |
"""
============================
``ctypes`` Utility Functions
============================
See Also
---------
load_library : Load a C library.
ndpointer : Array restype/argtype with verification.
as_ctypes : Create a ctypes array from an ndarray.
as_array : Create an ndarray from a ctypes array.
References
----------... | |
# -*- coding: utf-8 -*-
import cherrypy
import mako
import mimetypes
import os
import girder.events
from girder import constants, logprint, __version__, logStdoutStderr, _setupCache
from girder.models.setting import Setting
from girder import plugin
from girder.settings import SettingKey
from girder.utility import con... | |
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2008, Frank Scholz <coherence@beebits.net>
from datetime import datetime
import urllib
from twisted.internet import reactor, defer
from twisted.python import failure, util
from twisted.python.filepath import FilePath
from... | |
# Built-in
# import warnings
# Common
import numpy as np
# import scipy.interpolate as scpinterp
# import scipy.integrate as scpintg
# from inspect import signature as insp
# local
from . import _GG
_APPROX = True
_ANISO = False
_BLOCK = True
_LTYPES = [int, float, np.int_, np.float_]
############################... | |
# -*- 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):
# Changing field 'StaticPlaceholder.site'
db.alter_column(u'cms_staticpl... | |
# 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 functools
imp... | |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import logging
from typing import TYPE_CHECKING, cast
import six
from azure.core.exceptions import HttpResponseError
from azure.core.tracing.decorator import distribute... | |
'''
Reads the contents of a git repository and write a DOT graph file to stdout.
'''
import dulwich.repo
import dulwich.index
import dulwich.objects
import pydot
import subprocess
DEFAULT_FONTNAME = 'Monaco'
DEFAULT_FONTSIZE = '8'
BLOB_CONTENT_LIMIT = 200 # show at most this many bytes of blob content
DEFAULT_FONT ... | |
"""
This module contains the 'base' GEOSGeometry object -- all GEOS Geometries
inherit from this object.
"""
from __future__ import unicode_literals
from ctypes import addressof, byref, c_double
from django.contrib.gis import gdal
from django.contrib.gis.geometry.regex import hex_regex, json_regex, wkt_regex
from d... | |
#!/usr/bin/env/python3
#
# Copyright (c) Facebook, Inc. and its affiliates.
# 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 2014 Nervana Systems 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 applicabl... | |
import glob
import h5py
import mahotas as mh
import matplotlib.pyplot as plt
import numpy as np
import partition_comparison
import os
from scipy import ndimage as nd
import skimage.measure
import tifffile as tif
class Util(object):
@staticmethod
def read_cremi_section(DATADIR, z, verbose=True):
image = sort... | |
import aes.utils as U
import argparse
import keras.backend as K
import logging
import numpy as np
import os
import pickle as pk
from aes.models import Models
import keras.optimizers as opt
from keras.preprocessing import sequence
from keras.utils.vis_utils import plot_model
from time import time
os.environ['CUDA_VISIB... | |
# 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... | |
"""
Core MozTrap models (Product).
"""
import uuid
from django.core.exceptions import ValidationError
from django.db import models
from pkg_resources import parse_version
from preferences.models import Preferences
from ..environments.models import HasEnvironmentsModel
from ..mtmodel import MTModel, MTManager, TeamM... | |
import operator
import re
import sqlalchemy as sa
from .. import config
from .. import engines
from .. import eq_
from .. import expect_warnings
from .. import fixtures
from .. import is_
from ..provision import temp_table_keyword_args
from ..schema import Column
from ..schema import Table
from ... import event
from .... | |
#
# 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... | |
# Copyright 2017 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... | |
"""The tests for the MQTT statestream component."""
from unittest.mock import ANY, call, patch
from homeassistant.setup import setup_component
import homeassistant.components.mqtt_statestream as statestream
from homeassistant.core import State
from tests.common import (
get_test_home_assistant,
mock_mqtt_comp... | |
from __future__ import absolute_import
from django import forms
from django.conf import settings
from django.conf.urls import url
from django.contrib import admin, messages
from django.contrib.auth.forms import UserCreationForm, UserChangeForm, AdminPasswordChangeForm
from django.core.exceptions import PermissionDenie... | |
import unittest
from reactivex import Observable
from reactivex.disposable import SerialDisposable
from reactivex.operators import filter, filter_indexed
from reactivex.testing import ReactiveTest, TestScheduler, is_prime
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.... | |
import requests
import bs4
import datetime
import json
import sys
parser = ''
try:
import lxml
parser = 'lxml'
except ImportError:
parser = 'html.parser'
try:
with open(sys.path[0] + '/proxy.config', 'r') as f:
proxies = f.read()
proxy_dict = {"http": proxies,
"http... | |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import json
import functools
import itertools
import resource
import contextlib
import time
import sys
import lupa
from splash.browser_tab import JsError
from splash.lua_runner import (
BaseScriptRunner,
ScriptError,
ImmediateR... | |
import logging
import re
import sys
import time
import warnings
from contextlib import contextmanager
from functools import wraps
from unittest import skipIf, skipUnless
from xml.dom.minidom import Node, parseString
from django.apps import apps
from django.conf import UserSettingsHolder, settings
from django.core impo... | |
'''
Video player
============
.. versionadded:: 1.2.0
The video player widget can be used to play video and let the user control the
play/pausing, volume and position. The widget cannot be customized much because
of the complex assembly of numerous base widgets.
.. image:: images/videoplayer.jpg
:align: center
... | |
# Copyright 2011 Dorgival Guedes
# Copyright 2013 James McCauley
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import click
import os, sys
import subprocess
import rackman
VERSION = rackman.__version__
RELEASE = 'trusty'
basedir = os.path.realpath('.')
@click.group(chain=True)
def cli():
"""Building script for Rackman"""
pass
@cli.command()
def build_deb():
"""Build... | |
# Tests command line execution of scripts
import unittest
import os
import os.path
import test.test_support
from test.script_helper import (run_python,
temp_dir, make_script, compile_script,
make_pkg, make_zip_script, make_zip_pkg)
verbose = test.test_su... | |
import decimal
import json
import unittest
import uuid
from django import forms
from django.contrib.postgres.fields import ArrayField
from django.contrib.postgres.forms import SimpleArrayField, SplitArrayField
from django.core import exceptions, serializers
from django.core.management import call_command
from django.d... | |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | |
# 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... | |
from molmass.molmass import Formula
from scipy.stats import mode
import numpy
import re
class mass_isotopomer_distributions():
def __init__(self):
return;
def build_precursorSpectrumFromMRMs(self,peakSpectrum_I,blankSpectrum_I):
'''extract maximum intensity peak'''
# Input:
... | |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2014, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -------------------------------------------------------------------------... | |
import socket
import warnings
class TransportSocket:
"""A socket-like wrapper for exposing real transport sockets.
These objects can be safely returned by APIs like
`transport.get_extra_info('socket')`. All potentially disruptive
operations (like "socket.close()") are banned.
"""
__slots__... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Radware LTD.
#
# 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
#
#... | |
"""Games, or Adversarial Search. (Chapters 6)
"""
from utils import *
import random
#______________________________________________________________________________
# Minimax Search
def minimax_decision(state, game):
"""Given a state in a game, calculate the best move by searching
forward all the way to the... | |
import json
import io
import freezegun
import pytest
from FeedMandiant import MandiantClient
def mock_client():
MandiantClient._get_token = lambda x: 'token'
client = MandiantClient('url', 'username', 'password', False, False, 60, '90 days', 1, ['Malware'])
return client
def util_load_json(path):
wi... | |
#!/usr/bin/env python
# Copyright 2015-2016 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | |
# -*- coding: utf-8 -*-
#
# pip documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 22 22:08:49 2008
#
# This file is execfile()d with the current directory set to its containing dir
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All confi... | |
# vim: expandtab:tabstop=4:shiftwidth=4
"""This module comprises Aws specific utility functions."""
import os
import re
import subprocess
from distutils.version import LooseVersion
import ruamel.yaml as yaml
# Buildbot does not have multi_inventory installed
#pylint: disable=no-name-in-module
from openshift_tools.in... | |
#!/usr/bin/env python
# standard library
import numbers
import shutil
import sys
# third party
import numpy as np
# treeCl
from .partition import Partition
from .tree import Tree
from . import errors
from .utils import fileIO, print_and_return
class Simulator(object):
"""
Simulate alignments from several t... | |
# 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... | |
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Tickformatstop(_BaseLayoutHierarchyType):
# class properties
# --------------------
_parent_path_str = "layout.ternary.baxis"
_path_str = "layout.ternary.baxis.tickformatstop"
_valid_pr... | |
#!/usr/bin/env python
##
## Copyright 2009 Adriana Lukas & Alec Muffett
##
## 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 requi... | |
import select
import urllib.parse
import socket
import http.client
import time
import os
import utils
import ssl
class Connection():
def __init__(self, sock):
self.sock = sock
self.create_time = time.time()
def close(self):
self.sock.close()
class BaseResponse(object):
def __in... | |
from jsonrpc import ServiceProxy
import sys
import string
import getpass
# ===== 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:5432")
e... | |
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.models import Permission, Group, User
from django.contrib.auth import authenticate, login as django_login, logout as django_logout
from django.contrib.contenttypes.models import ContentType
from django.shortcuts import render,... | |
#!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
r"""
autosummary_generate.py OPTIONS FILES
Generate automatic RST source files for items referred to in
autosummary:: directives.
Each generated RST file contains a single auto*:: di... | |
"""
LLDB AppKit formatters
part of The LLVM Compiler Infrastructure
This file is distributed under the University of Illinois Open Source
License. See LICENSE.TXT for details.
"""
# example summary provider for NSArray
# the real summary is now C++ code built into LLDB
import lldb
import ctypes
import lldb.runtime.obj... | |
# Copyright 2011 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... | |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | |
import math
import warnings
from fractions import Fraction
from typing import List, Tuple, Dict, Optional, Union
import torch
from ..extension import _load_library
try:
_load_library("video_reader")
_HAS_VIDEO_OPT = True
except (ImportError, OSError):
_HAS_VIDEO_OPT = False
default_timebase = Fraction(... | |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
#!/usr/bin/python
import os
import datetime
import copy
import sys
from lxml import etree as et
import pcbmode.config as config
from . import messages as msg
from . import svg
from . import utils
from . import place
try:
# Python 3
import html.parser as HTMLParser
except:
# Python 2
import HTMLParse... | |
from textwrap import dedent
import jinja2
import pytest
import salt.serializers.configparser as configparser
import salt.serializers.json as json
import salt.serializers.msgpack as msgpack
import salt.serializers.plist as plist
import salt.serializers.python as python
import salt.serializers.toml as toml
import salt.s... | |
# Copyright 2012 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 required by applicable law... | |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | |
import copy
from hearthbreaker.tags.base import Status, Action, Aura, Condition, AuraUntil, CardQuery, \
CARD_SOURCE, Effect, Buff, BuffUntil, Amount, Picker, Selector
from hearthbreaker.tags.condition import IsSecret
from hearthbreaker.tags.selector import AllPicker, ConstantSelector
class Give(Action):
def ... | |
from unittest import mock
import pytest
from aiohttp import errors, parsers
@pytest.fixture
def stream():
return mock.Mock()
@pytest.fixture
def buf():
return parsers.ParserBuffer()
def test_feed_data(buf):
buf.feed_data(b'')
assert len(buf) == 0
buf.feed_data(b'data')
assert len(buf) =... | |
# Copyright 2019 Google LLC. 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... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/... | |
#!/usr/bin/env python
''':command:`streamcorpus_pipeline` is the command-line entry point to the
pipeline.
.. This software is released under an MIT/X11 open source license.
Copyright 2012-2014 Diffeo, Inc.
.. program:: streamcorpus_pipeline
The supplied configuration must have a :mod:`streamcorpus_pipeline`
sect... | |
# /usr/bin/env python
'''
Written by Kong Xiaolu and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
'''
import os
import scipy.io as sio
import numpy as np
import time
import torch
import CBIG_pMFM_basic_functions as fc
def get_init(gradient_data, highest_order, init_para):
'... | |
# 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... | |
"""
An entity tracker
"""
from spockbot.mcdata.utils import Info
from spockbot.plugins.base import PluginBase, pl_announce
class MCEntity(Info):
eid = 0
status = 0
nbt = None
metadata = None
class MovementEntity(MCEntity):
x = 0
y = 0
z = 0
yaw = 0
pitch = 0
on_ground = True
... | |
#!/usr/bin/python
'''
/******************************************************************
*
* Copyright 2018 Samsung Electronics 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 ... | |
# Copyright 2013 The Swarming 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.
"""Provides functions: get_native_path_case(), isabs() and safe_join().
This module assumes that filesystem is not changing while current pro... | |
"""archvyrt domain module"""
# stdlib
import logging
# 3rd-party
import libvirt
# archvyrt
from archvyrt.libvirt import LibvirtDomain
from archvyrt.libvirt import LibvirtDisk
from archvyrt.libvirt import LibvirtNetwork
from archvyrt.libvirt import LibvirtRng
LOG = logging.getLogger(__name__)
class Domain:
"""
... | |
import logging
import xml.etree.ElementTree as ET
from .metadata import TDSCatalogMetadata
from .http_util import create_http_session, urlopen
try:
from urlparse import urljoin
except ImportError:
# Python 3
from urllib.parse import urljoin
log = logging.getLogger("siphon.catalog")
log.setLevel(logging.W... | |
# 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 ... | |
class DomainHelper(object):
pass
class NullDomainHelper(DomainHelper):
pass
class CppDomainHelper(DomainHelper):
def __init__(self, definition_parser, substitute):
self.definition_parser = definition_parser
self.substitute = substitute
self.duplicates = {}
def check_cache... | |
# Copyright (C) 2006-2013 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
import networkx as nx
__author__ = """\n""".join(['Aric Hagberg <aric.hagberg@gmail.com>',
'Pieter Swart (s... | |
# 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 ... | |
"""
Tests the models of the stock app
"""
from collections import namedtuple
import datetime
from unittest import mock, TestCase
import pytest
from stocks.historical import create_stock
from stocks.models import DailyStockQuote, InvestmentBucket, InvestmentStockConfiguration, Stock
from django.db.models.signals import ... | |
import wsgiref.handlers
from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from google.appengine.api import users
from google.appengine.api import images
from google.appengine.api.labs import taskqueue
from google.appengine.api.urlfetch import Do... | |
# 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 logging
impor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.