gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
import os
import pandas as pd
from dataactbroker.scripts import update_historical_duns
from dataactcore.config import CONFIG_BROKER
from dataactcore.utils.duns import DUNS_COLUMNS, EXCLUDE_FROM_API
from dataactcore.models.domainModels import DUNS, HistoricDUNS
def test_remove_existing_duns(database):
""" Testing... | |
"""
Copyright 2010-2018 University Of Southern California
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... | |
#!/usr/bin/env python
'''
Ansible module for zabbix graphs
'''
# vim: expandtab:tabstop=4:shiftwidth=4
#
# Zabbix graphs ansible module
#
#
# 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.
# Yo... | |
"""The tests for the automation component."""
import unittest
from datetime import timedelta
from unittest.mock import patch
from homeassistant.core import callback
from homeassistant.bootstrap import setup_component
import homeassistant.components.automation as automation
from homeassistant.const import ATTR_ENTITY_I... | |
import collections
import logging
from . import config
from . import engines
from . import util
from .. import exc
from .. import inspect
from ..engine import url as sa_url
from ..sql import ddl
from ..sql import schema
from ..util import compat
log = logging.getLogger(__name__)
FOLLOWER_IDENT = None
class regist... | |
# 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... | |
"""
A vtkTkImageViewerWidget for python, which is based on the
vtkTkImageWindowWidget.
Specify double=1 to get a double-buffered window.
Created by David Gobbi, Nov 1999
"""
from __future__ import absolute_import
import math, os, sys
import vtk
if sys.hexversion < 0x03000000:
# for Python2
import Tkinter as... | |
# Copyright (c) 2010-2013 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functiona... | |
# Copyright 2013 SolidFire 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... | |
from gym.spaces import Discrete
import numpy as np
from scipy.stats import entropy
import ray
from ray.rllib.agents.dqn.distributional_q_model import DistributionalQModel
from ray.rllib.agents.dqn.simple_q_policy import ExplorationStateMixin, \
TargetNetworkMixin
from ray.rllib.policy.sample_batch import SampleBat... | |
"""Testing for the boost module (sklearn.ensemble.boost)."""
import numpy as np
from sklearn.utils.testing import assert_array_equal, assert_array_less
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal, assert_true
from sklearn.utils.testing import assert_raises... | |
#
# Copyright 2014 Shahriyar Amini
#
# 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... | |
# -*- coding: utf-8 -*-
"""Test interact."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
from itertools import product
import numpy as np
from numpy.testing import assert_equal as ae
from n... | |
import pytest
import camoco as co
from camoco import cf
from camoco import Locus
import camoco.Tools as tools
from camoco.Exceptions import CamocoZeroWindowError
'''
Unit tests
'''
def test_from_ids(testRefGen):
random_genes = sorted(testRefGen.random_genes(n=10))
from_ids = sorted(testRefGen.from_ids([x... | |
#!/usr/bin/python3
#
# Copyright (c) 2013-2019 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | |
# 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... | |
""" Created by Max 9/22/2017 """
import random
import sys
import math
import copy
import numpy as np
import matplotlib.pyplot as plt
from customCsvReader import CustomCSVReader
from FischerScore import fisher_score
class KMeans:
def __init__(self, k):
"""
Init with K clusters
:param k: in... | |
# Test various flavors of legal and illegal future statements
import __future__
import ast
import unittest
from test import support
from test.support import import_helper
from textwrap import dedent
import os
import re
import sys
rx = re.compile(r'\((\S+).py, line (\d+)')
def get_error_location(msg):
mo = rx.sea... | |
import environ # http://django-environ.readthedocs.io/
import os
root = environ.Path(__file__) - 2
env = environ.Env(
DEBUG=(bool, False)
)
env.read_env(env_file=root('.env')) # reading .env file
BASE_DIR = root()
DEBUG = env('DEBUG') # False if not in os.environ
# Application definition
INSTALLED_APPS = [
... | |
from __future__ import unicode_literals
from reviewboard.hostingsvcs.errors import (AuthorizationError,
TwoFactorAuthCodeRequiredError)
from reviewboard.hostingsvcs.forms import HostingServiceAuthForm
from reviewboard.hostingsvcs.models import HostingServiceAccount
from revi... | |
from datetime import datetime, timedelta
from sqlalchemy import (
Column, DateTime, Enum, ForeignKey, Integer, String, Table, Text, desc,
Boolean, PrimaryKeyConstraint, Float
)
from sqlalchemy.orm import backref, relationship
from werkzeug.security import check_password_hash, generate_password_hash
from emcit.d... | |
"""The compiler step turns an AST into a planned query.
This step has a number of responsibilities:
-Validate that the expression is well-typed.
-Resolve all select fields to their aliases and types.
"""
from __future__ import absolute_import
import collections
import itertools
from tinyquery import exceptions
from ... | |
from protorpc import messages
from protorpc import message_types
class Status(messages.Enum):
NEW = 0
PENDING = 1
APPROVED = 2
REJECTED = 3
class UserMessage(messages.Message):
ident = messages.StringField(1)
name = messages.StringField(2)
email = messages.StringField(3)
domain = messages.StringFiel... | |
"""SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. 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
... | |
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import warnings
import time
import numpy as np
import tensorflow as tf
from deepchem.utils.save import log
from deepchem.metrics import to_one_hot
from deepchem.metrics import from_one_hot
from deepchem.nn im... | |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | |
#!MF_PYTHONBIN
# Copyright (C) 2011 The MITRE Corporation. See the toplevel
# file LICENSE for license terms.
import os, sys, glob, shutil
MAT_PKG_PYLIB = "MF_MAT_PKG_PYLIB"
sys.path.insert(0, MAT_PKG_PYLIB)
MAT_PKG_HOME = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# The point of this script is to... | |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | |
# Copyright 2016 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 writing... | |
"""Support for Microsoft face recognition."""
import asyncio
import json
import logging
import aiohttp
from aiohttp.hdrs import CONTENT_TYPE
import async_timeout
import voluptuous as vol
from homeassistant.const import CONF_API_KEY, CONF_TIMEOUT, ATTR_NAME
from homeassistant.exceptions import HomeAssistantError
from ... | |
"""
Support for ASUSWRT routers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.asuswrt/
"""
import logging
import re
import socket
import telnetlib
from collections import namedtuple
import voluptuous as vol
import homeassistant.helpers... | |
"""
For compatibility with numpy libraries, pandas functions or
methods have to accept '*args' and '**kwargs' parameters to
accommodate numpy arguments that are not actually used or
respected in the pandas implementation.
To ensure that users do not abuse these parameters, validation
is performed in 'validators.py' to... | |
# encoding: 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):
# Removing unique constraint on 'ProjectOption', fields ['project', 'value', 'key']
try:
db.delete_uni... | |
# Copyright 2015: Mirantis 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 b... | |
from collections import Sequence
from itertools import izip
import sys
from gtd.io import JSONPicklable
from gtd.utils import cached_property, UnicodeMixin
from strongsup.predicate import Predicate
from strongsup.utils import PredicateList
from strongsup.value import Value
from strongsup.world import World
class Ex... | |
# Copyright 2014 Mirantis 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... | |
#!/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... | |
from django.contrib.auth.models import User
from django.db import models
from myrig.computer.quantity import Quantity
from south.modelsinspector import add_introspection_rules
class SIIntegerField(models.PositiveIntegerField):
'''
Implements storage for a positive integer value of an SI unit
'''
_... | |
import json
import os
from bson.objectid import ObjectId
from flask import Flask
from flask_restful import reqparse, Api, Resource, request
from pymongo import MongoClient
from werkzeug.security import generate_password_hash, \
check_password_hash
import config
import utils
import utils.common
from utils.helpers ... | |
"""Provides functionality to interact with lights."""
import csv
from datetime import timedelta
import logging
import os
from typing import Dict, Optional, Tuple
import voluptuous as vol
from homeassistant.const import (
SERVICE_TOGGLE,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_ON,
)
import homeassista... | |
"""
A simple http cache that listens to cache invalidation messages.
TODO:
- cache invalidation
- look at handling standard headers like If-Modified-Since and
ETag and what not (research).
- potentially develop other headers.
- SSL and client cert support.
"""
import tornado.web
import tornado.httpclient
from tornad... | |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 2 17:10:19 2016
@author: tkc
"""
import pandas as pd
import numpy as np
import sys, glob
import scipy.stats
import matplotlib.pyplot as plt
import os
if 'C:\\Users\\tkc\\Documents\\Python_Scripts\\Augerquant\\Modules' not in sys.path:
sys.path.append('C:\\Users\\tkc\... | |
#!/usr/bin/env python3
import argparse
import base64
import importlib
import logging
import mako.template
import mako.lookup
import os
import os.path
import random
import re
import stat
import sys
import tarfile
class Storage:
def __init__(self, base_dir):
self.base_dir = base_dir
logging.debug("... | |
#!/usr/bin/env python3
# Copyright (c) 2014-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the importmulti RPC.
Test importmulti by generating keys on node0, importing the scriptPubKeys an... | |
"""Test the Logitech Harmony Hub config flow."""
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.harmony.config_flow import CannotConnect
from homeassistant.components.harmony.const import DOMAIN, PREVIOUS_ACTIVE_ACTIVITY
from homeassistant.const import CONF_HOST, CONF_NAM... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
A generic bot to do data ingestion (batch uploading).
usage:
python pwb.py data_ingestion -csvdir:local_dir/ -page:config_page
"""
#
# (C) Pywikibot team, 2013
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
__version__ ... | |
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
## Basic tests
@python_2_unicode_compatible
class Author(models.Model):
n... | |
from __future__ import print_function, division
import sys
import os
sys.path.append(os.path.abspath("."))
sys.dont_write_bytecode = True
from utils.lib import *
from utils.errors import absolute_errors, confidence
from optimizer.nsga2 import nsga2, NSGAPoint, make_roulette_map, roulette_wheel
def rand():
return r... | |
#!/usr/bin/env python
# Copyright 2017 The Kubernetes 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 appli... | |
import re
import operator
from functools import reduce
class ParseError(ValueError):
def __init__(self, message, data):
super(ParseError, self).__init__((message, data))
class SentenceTypeError(ParseError):
pass
class ChecksumError(ParseError):
pass
class NMEASentenceType(type):
sentence_t... | |
# mssql/pyodbc.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: mssql+pyodbc
:name: PyODBC
:dbapi: pyodbc
:connectstring:... | |
# -*- coding: utf-8 -*-
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://ete.cgenomics.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public ... | |
# -*- coding: utf-8 -*-
"""
XForms - Controllers
"""
module = request.controller
def create():
"""
Given a Table, returns an XForms to create an instance:
http://code.javarosa.org/wiki/buildxforms
http://www.w3schools.com/xforms/
http://oreilly.com/catalog/9780596003692/preview.html
Known... | |
# Copyright 2017,2018 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 agr... | |
#!/usr/bin python
"""
Domain model for NED, NewsReader project.
@author: U{Filip Ilievski<filipilievski.wordpress.com>}
@version: 0.1
@contact: U{f.ilievski@vu.nl<mailto:f.ilievski@vu.nl>}
@since: 08-Jul-2015
"""
__version__ = '0.1'
__modified__ = '08Jul2015'
__author__ = 'Filip Ilievski'
from KafNafParserPy impor... | |
from .test_helper import argv_kiwi_tests
import sys
import mock
from mock import patch
from mock import call
import azurectl
from azurectl.commands.compute_vm import ComputeVmTask
class TestComputeVmTask:
def setup(self):
sys.argv = [
sys.argv[0], '--config', '../data/config',
'co... | |
# -*- coding: utf-8 -*-
from nose.tools import * # noqa (PEP8 asserts)
from tests.factories import (
ProjectFactory,
UserFactory,
RegistrationFactory,
NodeFactory,
NodeLogFactory,
FolderFactory,
)
from tests.base import OsfTestCase
from framework.auth import Auth
from framework import utils ... | |
# vim:ts=4:sw=4:et:
# Copyright 2016-present Facebook, Inc.
# Licensed under the Apache License, Version 2.0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# no unicode literals
import WatchmanInstance
import WatchmanTestCase
try:
import grp
except Imp... | |
# 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... | |
# vim:fileencoding=utf-8:ts=2:sw=2:expandtab
#
# Copyright 2013 AppCove, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in ... | |
from datetime import datetime
from contextlib import contextmanager
from django.utils.timezone import now
from django.db.utils import IntegrityError
from unittest import mock
import pytest
import pytz
from awx.main.models import JobTemplate, Schedule, ActivityStream
from crum import impersonate
@pytest.fixture
def... | |
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://etetoolkit.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# t... | |
from copy import deepcopy
import datetime
from django.core.exceptions import MultipleObjectsReturned, FieldError
from django.db import models, transaction
from django.test import TestCase
from django.utils import six
from django.utils.translation import ugettext_lazy
from .models import (Article, Reporter, First, Thi... | |
#Last Update 09/11/2021 by AP
"""
ReadMe:
The workflow for xanes experiment is define below. This macro aims to use one flow for XANES of any given element.
This macro is designed to work with the GUI inputs as well.
To add a new element add the paramer file in the format given below
EXAMPLE OF USAGE:
For XANES ... | |
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merg... | |
# -*- coding: utf-8 -*-
"""
Various backend commands for resource models.
These are used by views and the API.
"""
from itertools import ifilter
from django.utils.translation import ugettext as _
from django.db import IntegrityError, DatabaseError
from transifex.txcommon.log import logger
from transifex.resources.mo... | |
import sys
from time import sleep
import pygame
from bullet import Bullet
from alien import Alien
def check_keydown_events(event, ai_settings, screen, ship, bullets):
"""Respond to keypresses."""
if event.key == pygame.K_RIGHT:
ship.moving_right = True
elif event.key == pygame.K_LEFT:
ship... | |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | |
"""Tests for Plex setup."""
import copy
from datetime import timedelta
import ssl
from unittest.mock import patch
import plexapi
import requests
import homeassistant.components.plex.const as const
from homeassistant.config_entries import (
ENTRY_STATE_LOADED,
ENTRY_STATE_NOT_LOADED,
ENTRY_STATE_SETUP_ERRO... | |
#!/usr/bin/env python
#
# Copyright (C) 2011, 2012 Strahinja Val Markovic <val@markovic.io>
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either ve... | |
from __future__ import division, print_function
from functools import partial
from itertools import product
import numpy as np
import scipy.sparse as sp
from sklearn.datasets import make_multilabel_classification
from sklearn.preprocessing import LabelBinarizer
from sklearn.utils.multiclass import type_of_target
fro... | |
from typing import Dict, List, Tuple
import requests
from CommonServerPython import *
from CommonServerUserPython import *
import demistomock as demisto
from datetime import datetime, timedelta
# Disable insecure warnings
requests.packages.urllib3.disable_warnings() # pylint: disable=no-member
''' CONSTANTS '''
D... | |
# Hidden Markov Model Implementation
import pylab as pyl
import numpy as np
import matplotlib.pyplot as pp
#from enthought.mayavi import mlab
import scipy as scp
import scipy.ndimage as ni
import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3')
import rospy
#import hrl_lib.mayavi2_util as mu
import hrl_lib.viz ... | |
# -*- coding: utf-8 -*-
"""
Ensures the Lookup classes work as expected.
"""
from drogulus.dht.lookup import Lookup
from drogulus.dht.contact import PeerNode
from drogulus.dht.node import Node
from drogulus.dht.routingtable import RoutingTable
from drogulus.dht.messages import FindNode, Nodes, FindValue, Value, OK
from... | |
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Config file for various nacl compilation scenarios
#
import os
import sys
TOOLCHAIN_CONFIGS = {}
class ToolchainConfig(object):
def __init_... | |
from django.core.paginator import Paginator, InvalidPage
from django.shortcuts import Http404
from django.utils.functional import cached_property
from rest_framework import serializers
from cms.common import mixins
from .models import (
Category, Article, ArticleImage, ContentModule, ArticlesModule,
Categorie... | |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 Matthew Good <trac@matt-good.net>
# Copyright (C) 2010-2012 Steffen Hoffmann <hoff.st@web.de>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# Author: Matthew Good <tra... | |
#
# Copyright (c) 2017 Intel 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 applicable law or agreed to... | |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# (c) Copyright 2013 Hewlett-Pa... | |
import logging
from django.apps import apps
from django.db.models.fields.related import ForeignKey
from sqlalchemy.exc import OperationalError
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.sql import text
from .annotation import update_content_metadata
from .channels import read_channel_metadata_from_db_... | |
## Copyright (c) 2010, Coptix, Inc. All rights reserved.
## See the LICENSE file for license terms and warranty disclaimer.
"""aio -- asynchronous IO"""
from __future__ import absolute_import
import socket, ssl, select, errno, logging, fcntl
from tornado.ioloop import IOLoop
__all__ = (
'TCPServer', 'TCPClient'... | |
# -*- coding: utf-8 -*-
import discord
from discord import Forbidden
#from discord.ext import commands
import random
from dict import DictionaryReader
from botkey import Key
from subprocess import call
import sys
from priestLogger import PriestLogger
from perspectiveHandler import PerspectiveHandler
import logging
imp... | |
# -*- coding: utf-8 -*-
import logging
from graphenestorage import SqliteConfigurationStore
log = logging.getLogger(__name__)
class AbstractGrapheneChain:
def define_classes(self):
raise NotImplementedError
def __init__(
self,
node="",
rpcuser="",
rpcpassword="",
... | |
# -*- coding: utf-8 -*-
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for goma_lib.py"""
from __future__ import print_function
import datetime
import getpass
import gzip
import json
imp... | |
from pydmrs.core import SortDictDmrs, span_pred_key, abstractSortDictDmrs
from pydmrs.matching.common import are_equal_links
# ------------------------------------------------------------------------
def match_nodes(nodes1, nodes2, excluded=[]):
"""
:param nodes1: A list of Nodes from the DMRS to be matched, ... | |
"""
Helper functions for dealing with Twisted deferreds
"""
import asyncio
import inspect
from asyncio import Future
from functools import wraps
from typing import (
Any,
Callable,
Coroutine,
Generator,
Iterable,
Union
)
from twisted.internet import defer
from twisted.internet.defer import Defe... | |
#
# This file is part of Python-AD. Python-AD is free software that is made
# available under the MIT license. Consult the file "LICENSE" that is
# distributed together with this file for the exact licensing terms.
#
# Python-AD is copyright (c) 2007 by the Python-AD authors. See the file
# "AUTHORS" for a complete ove... | |
# orm/base.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Constants and rudimental functions used throughout the ORM.
"""
import operator
fr... | |
"""Class to represent a device."""
import copy
class Device(object):
"""Represents a Device."""
def __init__(self, job=None, replica=None, task=None, device_type=None,
device_index=None):
"""Create a new device object.
Args:
job: string. Optional device job name.
replica: int... | |
# -*- coding: utf-8 -*-
# This file is part of the pymfony package.
#
# (c) Alexandre Quercia <alquerci@email.com>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
from __future__ import absolute_import;
import unittest;
from pymfony.compo... | |
import datetime
import hashlib
import json
import logging
import os
import shutil
import subprocess
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.urlresolvers import reverse
from django.template import Context, loader
from django.test.client import RequestFactor... | |
# -*- coding:utf-8 -*-
import logging
import math
import random
import pickle
import zlib
import base64
def flatten(lst):
for x in lst:
if isinstance(x, list):
for x in flatten(x):
yield x
else:
yield x
class NeuralNetwork:
def __init__(self, learnin... | |
"""
Test discovery functions.
"""
import os
import sys
from lit.TestingConfig import TestingConfig
from lit import LitConfig, Test
def dirContainsTestSuite(path, lit_config):
cfgpath = os.path.join(path, lit_config.site_config_name)
if os.path.exists(cfgpath):
return cfgpath
cfgpath = os.path.joi... | |
import os
import unittest
from datetime import datetime
from unittest.mock import patch
import duolingo
USERNAME = os.environ.get('DUOLINGO_USER', 'ferguslongley')
PASSWORD = os.environ.get('DUOLINGO_PASSWORD')
USERNAME2 = os.environ.get("DUOLINGO_USER_2", "Spaniard")
def _example_word(lang):
"""
Returns an... | |
#!/usr/bin/env python
import argparse
import yaml
import os
import os.path
from guessit import guessit
import re
import logging
import sys
from titlecase import titlecase
import transmissionrpc
import shutil
import subprocess
import copy
import sqlite3
import string
from pyxdameraulevenshtein import damerau_levenshtei... | |
"""Triangle plots"""
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__all__ = ["corner", "hist2d", "error_ellipse"]
__version__ = "0.1.1"
__author__ = "Dan Foreman-Mackey (danfm@nyu.edu)"
__copyright__ = "Copyright 2013 Daniel Foreman-Mackey"
__contributors__ = [
# Alphabetical by first name.
"Adrian Price-Wh... | |
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import faker
from .models import User, Address, Base
from datatables import DataTable, DataColumn
class TestDataTables:
def setup_method(self, method):
engine = create_engine('sqlite://', echo=True)
Base.metadata.create_... | |
"""
Record, playback, &c a given test.
"""
# Copyright (c) 2013 contributors; see AUTHORS.
# Licensed under the Apache License, Version 2.0
# https://www.apache.org/licenses/LICENSE-2.0
import operator
import time
from selenium.common.exceptions import WebDriverException
from gossamer.constant import states, modes,... | |
from six import text_type
def is_reserved_subdomain(subdomain):
# type: (text_type) -> bool
if subdomain in ZULIP_RESERVED_SUBDOMAINS:
return True
if subdomain[-1] == 's' and subdomain[:-1] in ZULIP_RESERVED_SUBDOMAINS:
return True
if subdomain in GENERIC_RESERVED_SUBDOMAINS:
re... | |
"""Defines the unit tests for the :mod:`colour.utilities.common` module."""
from __future__ import annotations
import numpy as np
import unittest
from functools import partial
from colour.hints import Any, Floating, Number, Tuple
from colour.utilities import (
CacheRegistry,
attest,
batch,
multiproce... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.