gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
# -*- coding: utf-8 -*-
from datetime import date
class CVList():
def __init__(self, **kwargs):
self.items = {}
self.order = {}
for (k, v) in kwargs.items():
self.add_item(k, v)
def add_item(self, item_name, item_value):
v = self.__prepare_value(item_value)
... | |
import numpy as np
from numcodecs import (BZ2, AsType, Blosc, Categorize, Delta, FixedScaleOffset,
PackBits, Quantize, Zlib)
from numpy.testing import assert_array_almost_equal, assert_array_equal
from zarr.creation import array
compressors = [
None,
Zlib(),
BZ2(),
Blosc(),
]
t... | |
import numpy as np
import pandas as pd
import json
class TrafficServer:
"""Emulates the data plane of a communication system
TrafficServer can provide certain service for the traffic generated by a
TrafficEmulator. It is essentially the data-plane of a communication
system, and decide service under t... | |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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... | |
###############################################################################
##
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary forms, with or without
## modification, ... | |
# -*- coding: utf-8 -*-
import os
from threading import Thread, Lock
from time import sleep
from urllib import quote_plus
import xbmc, xbmcgui, xbmcaddon
from kodi65.actionhandler import ActionHandler
from .customhomemenu import CUSTOM_MENU
from .image_cache import ImageCache
from .pylms.callbackserver import Callbac... | |
import os
import json
from contextlib import asynccontextmanager
from urllib.parse import urlencode
from .http import connect_unix, connect_tcp
from .auth import read_config, server_name, resolve_auth, encode_header
from .utils import cached_property
CHUNK_SIZE = 65535
_TCP_PROTO = 'tcp://'
_UNIX_PROTO = 'unix://'... | |
# Copyright 2016 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.
from page_sets.system_health import platforms
from page_sets.system_health import story_tags
from page_sets.system_health import system_health_story
from pa... | |
# coding: utf-8
# # Porting Tensorflow tutorial "Deep MNIST for Experts" to polygoggles
#
# based on https://www.tensorflow.org/versions/r0.7/tutorials/mnist/pros/index.html
# In[21]:
import math
import tensorflow as tf
import datasets
import make_polygon_pngs
def get_data_sets_and_params(use_MNIST_instead_of_o... | |
from data.entities import Entity
import random
class Mob(Entity):
def init(self):
super(Mob,self).init()
self.set_attributes('01100')
self.char = '@'
self.name = 'mob'
self.fgcol = (0,255,255)
self.dead = 0
def collide(self, id):
ent = self.parent[id]
... | |
import pytest
import sqlalchemy as sa
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy_utils.relationships import select_correlated_expression
@pytest.fixture
def group_user_tbl(Base):
return sa.Table(
'group_user',
Base.metadata,
sa.Column('user_id', sa.Integer, sa.Forei... | |
# Re-aligner small RNA sequence from SAM/BAM file (miRBase annotation)
from __future__ import print_function
import os.path as op
import re
import shutil
import pandas as pd
import pysam
import argparse
from seqcluster.libs import do
from seqcluster.libs.utils import file_exists
import seqcluster.libs.logger as mylog... | |
from __future__ import unicode_literals
import json
import warnings
from django import forms
from django.conf import settings
from django.contrib.admin.utils import (
display_for_field, flatten_fieldsets, help_text_for_field, label_for_field,
lookup_field,
)
from django.core.exceptions import ObjectDoesNotExi... | |
# Copyright 2012-2016 Luke Dashjr
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the standard MIT license. See COPYING for more details.
sizeof_workid = 8
import base58 as _base58
from binascii import b2a_hex as _b2a_hex
from hashlib import sha256 as _sha256
from str... | |
from . import moog
from .star import Star
import numpy as np
import datetime
import logging
from scipy import interpolate
import os
from .config import *
from .tools import read_csv
from collections import OrderedDict
from bokeh.plotting import *
from bokeh.models import HoverTool
logger = logging.getLogger(__name__)
... | |
from __future__ import division
import unittest
from fontTools.pens.pointPen import AbstractPointPen
from fontMath.mathFunctions import addPt, mulPt
from fontMath.mathGlyph import (
MathGlyph, MathGlyphPen, FilterRedundantPointPen,
_processMathOneContours, _processMathTwoContours, _anchorTree,
_pairAnchors,... | |
# 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 ... | |
from unittest import mock
from .tools import run_object
from contexts.plugin_interface import PluginInterface, EXAMPLES, SETUP, ACTION, ASSERTION, TEARDOWN
from contexts import assertion
class WhenRunningAParametrisedSpec:
def given_a_parametrised_test(self):
class ParametrisedSpec:
initialise... | |
# 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... | |
# Copyright 2016 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | |
# Copyright (c) Moshe Zadka
# See LICENSE for details.
"""Test ncolony.schedulelib"""
from __future__ import division
import os
import unittest
import sys
import six
from zope.interface import verify
from twisted.python import failure
from twisted.internet import defer
from twisted.internet import interfaces as ... | |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | |
from __future__ import division
import pygame
from pygame.locals import Color
from pygame import key
import Scene
import math
import cairo
import rsvg
import array
class ControlsScreen(Scene.Scene):
def __init__(self, size):
super(ControlsScreen, self).__init__()
screen = pygame.display.set_mode(... | |
# Copyright 2016 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... | |
import entity
from utils import Point, rand
def move_north(agent=None, entities=None, environment=None):
"""
Behavior that causes an agent to move north one unit.
:param agent: The agent to perform the behavior.
:param entities: A list of entities in the simulation.
:param environment: The envir... | |
#!/usr/bin/env python
import sys
import unittest
import seqan.dox.sig_parser as sig_parser
class TestParseEnum(unittest.TestCase):
def testValid(self):
txt = 'enum EnumName'
parser = sig_parser.SigParser(txt)
entry = parser.parse()
self.assertEqual(entry.kind, 'enum')
sel... | |
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | |
# -*- coding: utf-8 -*-
import 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 'Photo.user'
db.alter_column('vkontakte_photos_photo', 'user_id', self.gf('django.db.model... | |
# 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 req... | |
"""Extend the basic Accessory and Bridge functions."""
from datetime import timedelta
from functools import partial, wraps
from inspect import getmodule
import logging
from pyhap.accessory import Accessory, Bridge
from pyhap.accessory_driver import AccessoryDriver
from pyhap.const import CATEGORY_OTHER
from homeassis... | |
# 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... | |
#!/usr/bin/env python
"""Import Google Cloud Platform projects into an organization."""
import argparse
import re
import sys
from lib.google import Google
def add_project_to_org(admin, project):
"""Add the project to the organization."""
output = []
project_id = project['projectId']
body = project.... | |
# Copyright (c) 2012 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 requi... | |
# 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... | |
# 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 required by applicable ... | |
# 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... | |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
#
# Copyright (c) 2012 NTT DOCOMO, INC
# Copyright (c) 2011 University of Southern California / ISI
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the Licens... | |
# Copyright (C) 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | |
from __future__ import unicode_literals, division, absolute_import
import os
import logging
import re
import urlparse
import xmlrpclib
from flexget import plugin
from flexget.event import event
from flexget.entry import Entry
from flexget.utils.template import RenderError
from flexget.plugin import get_plugin_by_name
... | |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import unittest
from telemetry import page as page_module
from telemetry.page import page_set
from telemetry import value
class TestBase(unittest... | |
import fnmatch
import os.path
import re
import unittest
import pydev_runfiles_unittest
from pydevd_constants import * #@UnusedWildImport
import time
from pydev_runfiles_coverage import StartCoverageSupport
#===============================================================================================================... | |
# -*- coding: utf-8 -*-
from bda.plone.orders.interfaces import IGlobalNotificationText
from bda.plone.orders.interfaces import IItemNotificationText
from bda.plone.orders.interfaces import IOrdersExtensionLayer
from bda.plone.shop import message_factory as _
from collective.z3cform.datagridfield import DataGridFieldFa... | |
#MenuTitle: Stitcher
# -*- coding: utf-8 -*-
__doc__="""
Turn your paths into dotted lines, and specify a component as dot, i.e. stitch components onto paths in selected glyphs. Respects origin anchor in your source component.
"""
from GlyphsApp import MOVE
import math, vanilla, traceback
def deleteAllComponents( thi... | |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2018 The Machinecoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Machinec... | |
#!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Usage: %prog [options] [<commitref>]*
If no <commitref>'s are supplied, it defaults to HEAD.
Calculates the generation number for ... | |
##########################################################################
#
# Copyright 2008-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"), to deal
# in the Software withou... | |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Internal utilities for managing I-Spy test results in Google Cloud Storage.
See the ispy.client.chrome_utils module for the external API.
"""
import col... | |
# Copyright 2012 OpenStack Foundation
# Copyright 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/licenses/LIC... | |
# Copyright 2011-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 applicable law or agreed to in ... | |
import numpy
from chainer import cuda
from chainer import function
from chainer.functions.math import matmul as _matmul
from chainer import utils
from chainer.utils import type_check
from chainer import variable
def _convert_value_to_string(value):
if isinstance(value, variable.Variable):
value = value.d... | |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Copyright (c) 2015-2016 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test BIP68 implementation
#
from test_fra... | |
import json
import re
import itertools
from .common import InfoExtractor
from ..utils import (
compat_urllib_parse,
compat_urllib_request,
clean_html,
get_element_by_attribute,
ExtractorError,
std_headers,
)
class VimeoIE(InfoExtractor):
"""Information extractor for vimeo.com."""
# _... | |
"""
Copyright (c) 2011-2012 Fredrik Ehnbom
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applicati... | |
#!/usr/bin/python
# The purpose of this script is only to allow to parse SVN (could be extended to GIT quite easily).
# Redmine supports this by default, so in case you wonder why I did this, there are two reasons to use this script:
# * Administrative: Your administrators don't have the time/will to set it up
# * Sec... | |
"""This section introduces the Formula class."""
from variable_assignment import VariableAssignment
class Formula(object):
"""
Formula class. Formula objects are defined over some Vocabulary
:math:`\Sigma`. Formula objects are immutable.
:ivar vocabulary: The underlying Vocabulary object :math:`\Sig... | |
import re
from random import randint
from django.db import connections
class Handler:
def __init__(self, queryset):
self.open = False
self.db = queryset.db
self._model = queryset.model
self._table_name = self._model._meta.db_table
self._handler_name = self._construct_nam... | |
import logging
import re
from postprocessing.chebi_resolution import find_chebi_term3
from text.entity import Entity
from config import config
element_base = {
# number: name symbol ions
"H": ["Hydrogen", 1],
"He": ["Helium", 2],
"Li": ["Lithium", 3],
"Be": ["Beryllium", 4],
"B": ["Boron", 5],... | |
# coding: utf-8
#
# Copyright 2017 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... | |
# -*- coding:utf-8 -*-
#
# Copyright 2016 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
#
# Unl... | |
# -*- coding: utf-8 -*-
import io
import pytest
from layeredconfig import LayeredConfig
from layeredconfig import DictSource, Environment, INIFile
from layeredconfig import strategy
def test_raise_keyerrors_on_empty_multilayer_config():
config = LayeredConfig()
with pytest.raises(KeyError):
assert ... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
# Copyright 2016 Howard Liu
#
# 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... | |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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 ... | |
#!/usr/bin/env python
"""
Contains player and NPC-classes.
"""
import os
import numpy as np
import pygame
import logging
from Placeable import Placeable
from Item import Item
from Text import TextDialog
from FindPath import Maze
DEFAULT_HEALTH = 100
DEFAULT_FEAR = 75
DEFAULT_HATE = 25
class Person(Placeable):
""... | |
import os
import re
import unittest
import json
import zlib
from bs4 import BeautifulSoup
from moto import mock_dynamodb2
from itsdangerous import base64_decode
from sdc.crypto.key_store import KeyStore
from app.keys import KEY_PURPOSE_AUTHENTICATION, KEY_PURPOSE_SUBMISSION
from app.setup import create_app
from tes... | |
"""
homeassistant.components.mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MQTT component, using paho-mqtt.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/mqtt/
"""
import logging
import os
import socket
import time
from homeassistant.exceptions import HomeAssis... | |
"""Support for Broadlink remotes."""
import asyncio
from base64 import b64encode
from collections import defaultdict
from datetime import timedelta
from itertools import product
import logging
from broadlink.exceptions import (
AuthorizationError,
BroadlinkException,
NetworkTimeoutError,
ReadError,
... | |
import os
import re
import urllib
from datetime import datetime
from urlparse import urljoin
from flask import Flask, render_template, make_response, url_for, \
request as flask_request
from werkzeug.contrib.cache import SimpleCache, MemcachedCache
import requests
from bs4 import BeautifulSoup
app = 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 us... | |
#!/usr/bin/python2 -u
import os
import sys
import json
import socket
import getopt
from collections import Counter
import nmap
import ipaddr
import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib import mlab, pyplot as plt
def _delta(a):
return a[1] - a[0]
def _bar_label(rects, artist, offs... | |
# -*- coding: utf-8 -*-
"""
Abstract interface to bounce windows and moratoria.
"""
__author__ = 'Jathan McCollum, Mark Thomas, Michael Shields'
__maintainer__ = 'Jathan McCollum'
__email__ = 'jathan.mccollum@teamaol.com'
__copyright__ = 'Copyright 2006-2012, AOL Inc.'
# Imports
from datetime import datetime, timede... | |
from direct.distributed import DoHierarchy
import re
#hack:
BAD_DO_ID = BAD_ZONE_ID = 0 # 0xFFFFFFFF
BAD_CHANNEL_ID = 0 # 0xFFFFFFFFFFFFFFFF
class DoCollectionManager:
def __init__(self):
# Dict of {DistributedObject ids: DistributedObjects}
self.doId2do = {}
# (parentId, zoneId) to dict o... | |
from functools import partial
from typing import Any, List, Optional, Type, Union
from torchvision.prototype.transforms import ImageClassificationEval
from torchvision.transforms.functional import InterpolationMode
from ....models.quantization.resnet import (
QuantizableBasicBlock,
QuantizableBottleneck,
... | |
from simulatorutils import *
from extra.schedule import Schedule
from extra.printer import pprint, YELLOW, RED, GREEN, CYAN
class Simulator(object):
def __init__(self, plant):
self.plant = plant
self.graph = []
self.createGraph()
self.printing = False
self.numOfOrdersFinished = 0
self.inSchedule = None... | |
"""Flask extension of Flask-Principal for handling
authentication/authorization.
"""
from flask import session, current_app
from flask_principal import (
Principal,
identity_loaded,
identity_changed,
Identity,
AnonymousIdentity,
Permission,
RoleNeed,
TypeNeed
)
# pylint: disable=inval... | |
import glob
import os
import shutil
import sys
import unittest
from test.support import (TESTFN, skip_unless_symlink,
can_symlink, create_empty_file, change_cwd)
class GlobTests(unittest.TestCase):
def norm(self, *parts):
return os.path.normpath(os.path.join(self.tempdir, *part... | |
#! /usr/bin/env python
#
# Matasano Crypto Pals
# Set 1
#
import binascii
import base64
from freqs import *
from Crypto.Cipher import AES
def hex2base64(a):
'''Convert a string in hex to a string in base64.'''
data = binascii.unhexlify(a)
return base64.b64encode(data)
def fixedXOR(b1, b2):
int1 = int(b1.enc... | |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
import argparse
import os
from abc import ABC, abstractmethod
from datetime import d... | |
#!/usr/bin/env python
import argparse
import cfp_common
import collections
import datetime
import math
import nltk
import re
import Queue
import random
import scipherd
import sys
import time
import zmq
####
# from http://bytes.com/topic/python/answers/828486-ascii-binary-conversion
def a2b(a, mask):
ord_a = ord(... | |
import numpy as np
from numpy.testing import assert_allclose
import pytest
from .. import hmm
from . import assert_log_likelihood_increasing, make_covar_matrix, normalized
class GaussianHMMTestMixin:
covariance_type = None # set by subclasses
@pytest.fixture(autouse=True)
def setup(self):
self.... | |
# Copyright 2021 DeepMind Technologies 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 law or agree... | |
"""Search task tests"""
# pylint: disable=redefined-outer-name,unused-argument
from django.conf import settings
from praw.exceptions import PRAWException
from prawcore.exceptions import PrawcoreException, NotFound
import pytest
from channels.factories.models import CommentFactory, PostFactory
from channels.models imp... | |
"""Tests related to file-writing functionality."""
import shutil
import os
from os.path import join, exists, islink, dirname
import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from bids.layout.writing import build_path, _PATTERN_FIND
from bids.tests import get_test_data_path
f... | |
# 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... | |
"""
xbee.py
By Paul Malmsten, 2010
Inspired by code written by Amit Synderman and Marco Sangalli
pmalmsten@gmail.com
XBee superclass module
This class defines data and methods common to all XBee modules.
This class should be subclassed in order to provide
series-specific functionality.
"""
import struct, threading,... | |
'''
Action Bar
==========
.. versionadded:: 1.8.0
.. image:: images/actionbar.png
:align: right
The ActionBar widget is like Android's ActionBar, where items are stacked
horizontally.
The :class:`ActionBar` will contain one :class:`ActionView` and many
:class:`ContextualActionView`\s.
An :class:`ActionView` wil... | |
"""Functions shared between different beamformer types."""
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Roman Goj <roman.goj@gmail.com>
# Britta Westner <britta.wstnr@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
from scipy import linalg
from ..io.constants i... | |
# Copyright (C) 2003-2005 Peter J. Verveer
#
# 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 conditions and the following d... | |
# This library is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either
# version 3 of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful... | |
# -*- coding: utf-8 -*-
import logging
import httplib
import httplib as http # TODO: Inconsistent usage of aliased import
from dateutil.parser import parse as parse_date
from django.utils import timezone
from django.core.exceptions import ValidationError
from flask import request
import mailchimp
from framework impo... | |
########################################################################
# amara/xpath/locationpaths/predicates.py
"""
A parsed token that represents a predicate list.
"""
from __future__ import absolute_import
from itertools import count, izip
from amara.xpath import datatypes
from amara.xpath.expressions.basics impo... | |
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | |
# Copyright 2014 Dirk Pranke. 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 sys
import json
import time
import core.theme
import core.event
import util.format
def dump_json(obj):
return obj.dict()
def assign(src, dst, key, src_key=None, default=None):
if not src_key:
if key.startswith("_"):
src_key = key
else:
src_key = key.replace("... | |
# -*- coding: utf-8 -*-
"""
The database schema .
There are four entities:
ScraperSearch: Represents a search job.
SearchEngineResultsPage: Represents a SERP result page of a search_engine
Link: Represents a LINK on a SERP
Proxy: Stores all proxies and their statuses.
"""
import datetime
from urllib.pa... | |
# Copyright 2009-2013, Peter A. Bigot
#
# 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 agree... | |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from datetime import timedelta
from django.contrib.auth.models import User, Permission
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.core.management import call_command
from django.core import management
fr... | |
import datetime
from operator import methodcaller
from django.forms import CheckboxSelectMultiple
import django_filters
from accounts.models import ROLE_PARTNER, CtsUser
from reports.models import DonorCategoryData, DonorShipmentData
from shipments.models import PackageDBView, ShipmentDBView, PackageItemDBView, Ship... | |
"""NRF24L01 driver for Micro Python
"""
import pyb
# nRF24L01+ registers
CONFIG = const(0x00)
EN_RXADDR = const(0x02)
SETUP_AW = const(0x03)
SETUP_RETR = const(0x04)
RF_CH = const(0x05)
RF_SETUP = const(0x06)
STATUS = const(0x07)
RX_ADDR_P0 = const(0x0a)
TX_ADDR = const(0x10)
RX_PW_P0 ... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Alex Wallar <aw204@st-andrews.ac.uk>"
import sys
import random
import math as np
import pygame
class PolyObstacle:
"""
Object that represents the an obstacle represented
by a series of points (in the node list) which make up a
set of lines.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.