gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
# -*- coding: utf-8 -*-
"""Test the functionality of the Manager."""
from datetime import datetime
from ocspdash.manager import Manager
from ocspdash.models import Chain, Result
from .constants import (
TEST_BAD_CERTIFICATE_CHAIN_UUID,
TEST_KEY_ID,
TEST_LOCATION_NAME,
TEST_PUBLIC_KEY,
)
def test_co... | |
# Fall 2012 6.034 Lab 2: Search
from search import *
## The graphs you will use for the problem set.
## The heuristic values
## are lower bounds on the distance to the node with the id of
## "Common Area"
GRAPH1 = Graph(edgesdict = \
[{NAME:'e1', VAL: 5, NODE1:'Common Area', NODE2:'Stairs'},
... | |
import HTMLParser
import cookielib
import json
import os
import re
import sys
import urllib
import urllib2
import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin
import time
import socket, ssl
import m3u8
#import requests
## Settings
settings = xbmcaddon.Addon(id='plugin.video.digi-online')
login_User = settin... | |
# -*- coding: utf-8 -*-
#
# 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
... | |
import datetime
from django import forms
from django.shortcuts import render, redirect, get_object_or_404
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from djangopress.blog.models import Blog, Entry, Tag, Category, Comment, Flag
from django.utils.translation import ugettext as _
from django.conf... | |
# Copyright (c) 2012 NetApp, 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... | |
# -*- coding: utf-8 -*-
import boto3
import json
import os
import re
import requests
import six
import threading
from six.moves import range
from girder import events
from girder.models.assetstore import Assetstore
from girder.models.file import File
from girder.models.folder import Folder
from girder.models.upload im... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A module that contains various classifiers"""
import cv2
import numpy as np
from abc import ABCMeta, abstractmethod
from matplotlib import pyplot as plt
__author__ = "Michael Beyeler"
__license__ = "GNU GPL 3.0 or later"
class Classifier:
"""
Abstract b... | |
"""
Tests for the throttling implementations in the permissions module.
"""
from __future__ import unicode_literals
import pytest
from django.contrib.auth.models import User
from django.core.cache import cache
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest
from django.test ... | |
# Scramble Solver v0.1.1_TE
# =========================
import solver
import os
import time
import csv
from sys import argv
LOG_STATS = True
class StatGetter:
def __init__(self):
self.sourcedir = os.getcwd()
self.datadir = self.sourcedir + "/solutiondata/"
os.chdir(self.datadir)
self.statfile = open('stats.... | |
# Lint as: python2, python3
# 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
#
... | |
# $Id: PC.py 31 2010-01-12 15:44:40Z tlev $
# -*- coding: iso-8859-1 -*-
'''
Created on 20. okt. 2009
@author: levin
'''
from math import *
import SEMBA as S
#Create empty dictionaries to load emission data in
Vehicle_Types = {}
def create_vehicle_list():
for k,v in S.H_PC.items():
k=0
Vehicle_Types[v[0... | |
__author__ = 'rencui'
from afinn import Afinn
import subprocess
import numpy
import utilities
from textstat.textstat import textstat
from sklearn.feature_extraction.text import *
from nltk.stem.porter import *
from sklearn.model_selection import train_test_split
from tokenizer import simpleTokenize
from scipy.sparse im... | |
# Copyright (c) 2010-2012 OpenStack, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | |
# -*- coding: utf-8 -*-
"""
nuage_acl_learner is a tool which can be used in a clean test environment to create a set of ACL rules which are being used by the applications running in that environment.
After you configured your VRS's to point their flow logs to the IP of the server where you run this tool, you can star... | |
# Copyright 2009 Brian Quinlan. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
import logging
import threading
import time
from collections import namedtuple
__author__ = 'Brian Quinlan (brian@sweetapp.com)'
FIRST_COMPLETED = 'FIRST_COMPLETED'
FIRST_EXCEPTION = 'FIRST_EXCEPTION'
ALL_COMPLETE... | |
import os
import requests
from webstore_manager import logging_helper, util
from webstore_manager.constants import ErrorCodes
from webstore_manager.store.store import Store
logger = logging_helper.get_logger(__file__)
class ChromeStore(Store):
"""
Class representing Chrome Webstore. Holds info about the cli... | |
"""Provide access to Python's configuration information. The specific
configuration variables available depend heavily on the platform and
configuration. The values may be retrieved using
get_config_var(name), and the list of variables is available via
get_config_vars().keys(). Additional convenience functions are a... | |
"""
Two-dimensional pattern generators drawing from various random distributions.
$Id$
"""
__version__='$Revision$'
import numpy
from numpy.oldnumeric import zeros,floor,where,choose,less,greater,Int,random_array
import param
from param.parameterized import ParamOverrides
from patterngenerator import PatternGener... | |
import logging
from django.conf import settings
from djconnectwise.utils import RequestSettings
import re
import requests
from retrying import retry
class ConnectWiseAPIError(Exception):
"""Raise this, not request exceptions."""
pass
class ConnectWiseRecordNotFoundError(ConnectWiseAPIError):
"""The rec... | |
#!/usr/bin/env python
#
# nucmer_to_crunch.py
#
# USAGE: Usage: nucmer_to_crunch.py [-h] [-o OUTFILENAME] [-i INFILENAME] [-v]
#
# optional arguments:
# -h, --help show this help message and exit
# -o OUTFILENAME, --outfile OUTFILENAME
# Output .crunch file
# -i INFILENAME, --in... | |
#!/usr/bin/python
#
# Copyright 2014 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 or a... | |
#!/usr/bin/env python
#
# Azure Linux extension
#
# Copyright (c) Microsoft Corporation
# All rights reserved.
# MIT License
# 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 restrictio... | |
"""
base execnet gateway code send to the other side for bootstrapping.
NOTE: aims to be compatible to Python 2.5-3.X, Jython and IronPython
:copyright: 2004-2015
:authors:
- Holger Krekel
- Armin Rigo
- Benjamin Peterson
- Ronny Pfannschmidt
- many others
"""
from __future__ import with_statement... | |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals, absolute_import
import frappe
import json
from email.utils import formataddr, parseaddr
from frappe.utils import get_url, get_formatted_email, cint, validate_email_add, split_ema... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Module for super cell.
"""
from copy import deepcopy
import numpy as np
import catplot.descriptors as dc
from catplot.grid_components import extract_plane
class SuperCell(object):
""" Abstract base class for supercell.
"""
def __init__(self, nodes, edg... | |
import tkinter as tk
from tkinter import Button
import time
import numpy as np
from PIL import ImageTk, Image
PhotoImage = ImageTk.PhotoImage
UNIT = 100 # pixels
HEIGHT = 5 # grid height
WIDTH = 5 # grid width
TRANSITION_PROB = 1
POSSIBLE_ACTIONS = [0, 1, 2, 3] # up, down, left, right
ACTIONS = [(-1, 0), (1, 0), (... | |
#!/usr/bin/env python
# Copyright (c) 2014, Paessler AG <support@paessler.com>
# 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 not... | |
"""Caches are used for multiple things:
- To speed up asset building. Filter operations every step
of the way can be cached, so that individual parts of a
build that haven't changed can be reused.
- Bundle definitions are cached when a bundle is built so we
can determine whether they have ch... | |
# Copyright 2011 Justin Santa Barbara
# 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... | |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | |
import sfh_tests_multi_proc
import numpy as np
import ResolvedStellarPops as rsp
import galaxy_tests
import os
import tables
import matplotlib.pylab as plt
from TPAGBparams import snap_src
import logging
logger = logging.getLogger()
angst_data = rsp.angst_tables.AngstTables()
import model_plots
fontlarge = 24
fontmid ... | |
'''
.. _motionevent:
Motion Event
============
The :class:`MotionEvent` is the base class used for every touch and non-touch
event. This class defines all the properties and methods needed to handle 2D and
3D movements but has many more capabilities.
.. note::
You never create the :class:`MotionEvent` yourself:... | |
from jsonrpc import ServiceProxy
import sys
import string
# ===== 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:61142")
else:
access = Se... | |
# 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... | |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | |
import logging
import networkx
import functools
from collections import deque
from typing import Optional, Tuple
logger = logging.getLogger(__name__)
def with_initialize(func):
@functools.wraps(func)
def wrapper(obj, *args, **kwargs):
if not obj._initialized:
obj.initialize()
retu... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""subcmd_extract.py
Provides the extract subcommand for pdp.py
(c) The James Hutton Institute 2017-2019
Author: Leighton Pritchard
Contact: leighton.pritchard@hutton.ac.uk
Leighton Pritchard,
Information and Computing Sciences,
James Hutton Institute,
Errol Road,
Inve... | |
#!/usr/bin/env python
##===--- swift-bench.py -------------------------------*- coding: utf-8 -*-===##
##
## This source file is part of the Swift.org open source project
##
## Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
## Licensed under Apache License v2.0 with Runtime Library Exception
##
## S... | |
#!/usr/bin/env python3
# Copyright (c) 2011 Collabora Ltd. <http://www.collabora.co.uk/>
# 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 2 of the License, or (at your opt... | |
# encoding: utf-8
"""Object instance and class helper functions."""
import logging
import inspect
import pkg_resources
from collections import defaultdict
from functools import partial
from marrow.util.compat import binary, unicode
def flatten(x):
"""flatten(sequence) -> list
Returns a single, flat list ... | |
from snappy import Manifold
from cypari import *
from multiprocessing import *
import copy
import sys
from ManifoldIterators import *
from VolumeUtilities import *
def prepare_pvolume_file(maniter, ofilenm, append = False, engine = 'magma', max_secs = 20, sln = 2, retrieve = True, period = 100, separator = ';'):
... | |
# -*- coding: utf-8 -*-
#
# Author: Wan Xiaolin <wanxiaolin@mail.bnu.edu.cn>
"""Neural Computer Module
"""
import collections
import functools
import itertools
import math
import numpy
import tensorflow
from tensorflow import (concat, expand_dims, reverse, scatter_nd, shape,
split, stack, sq... | |
# Copyright 2016 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 2012 Tsutomu Uchino
#
# 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 ... | |
#!/usr/bin/env python
"""Registry for filters and abstract classes for basic filter functionality."""
import collections
import glob
import itertools
import os
import yaml
import logging
from grr.lib import config_lib
from grr.lib import registry
from grr.lib.aff4_objects import collections as collections_aff4
from ... | |
"""Test PurePNG against PIL native plugin"""
import unittest
import pngsuite
from PIL import Image
from io import BytesIO
from PIL import PngImagePlugin as pilpng
from png import PngImagePlugin as purepng
def safe_repr(obj, short=False):
"""Truncated output of repr(obj)"""
_MAX_LENGTH = 80
try:
r... | |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Author: Endre Karlson <endre.karlson@hp.com>
# Author: Dave Tucker <dave.j.tucker@hp.com>
#
# 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 L... | |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright (c) 2019 The ungoogled-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.
"""
Substitute domain names in the source tree with blockable strings.
"""
from pathlib import ... | |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for plugins."""
import inspect
import io
import os.path
from xml.etree import ElementTree
import pytest
import coverage
from coverage import env
from co... | |
"""Certbot client interfaces."""
from abc import ABCMeta
from abc import abstractmethod
from argparse import ArgumentParser
import sys
from types import ModuleType
from typing import Any
from typing import Union
from typing import cast
from typing import Iterable
from typing import List
from typing import Optional
from... | |
# Copyright 2012, Nachi Ueno, NTT MCL, 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
#
# Unles... | |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2020 Hewlett Packard Enterprise Development LP
#
# 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
... | |
import unittest
import json
from nose.plugins.skip import SkipTest
from dummyserver.server import HAS_IPV6
from dummyserver.testcase import (HTTPDummyServerTestCase,
IPv6HTTPDummyServerTestCase)
from urllib3.poolmanager import PoolManager
from urllib3.connectionpool import port_by_sch... | |
# Copyright 2014 Huawei Technologies Co. 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
#
# Unless required by applicable law or agreed... | |
#!/usr/bin/env python3
import argparse
import datetime
import errno
import hashlib
import logging
import os
import pwd
import re
import shutil
import subprocess
import sys
import time
import json
import uuid
if False:
from typing import Sequence, Set, Text, Any
DEPLOYMENTS_DIR = "/home/zulip/deployments"
LOCK_DIR... | |
#!/usr/bin/python
# pylint: disable=too-many-lines
# -*- coding: utf-8 -*-
# vim: expandtab:tabstop=4:shiftwidth=4
# Reason: Disable pylint too-many-lines because we don't want to split up this file.
# Status: Permanently disabled to keep this module as self-contained as possible.
"""Ansible module for retrieving and ... | |
from django.conf.urls import include, url
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import LoginView
from django.contrib.auth.views import LogoutView
from django.views.i18n import JavaScriptCatalog
from django.views.static import serve
from devices.views import *
from netw... | |
import pytest
import types
from boto import ec2
from moto import mock_ec2, mock_s3
from mangrove.declarative import ServiceDeclaration, ServicePoolDeclaration
from mangrove.constants import WILDCARD_ALL_REGIONS
from mangrove.exceptions import InvalidServiceError, DoesNotExistError
class TestServiceDeclaration:
... | |
# Copyright (c) 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | |
# 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 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... | |
import numpy as np
import os
import cv2
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import glob
# Import everything needed to process video clip for later
from moviepy.editor import VideoFileClip
from IPython.display import HTML
# Load in the chessboard calibration images to a list
cal_image_loc ... | |
# 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 ... | |
# -*- coding: utf-8 -*-
"""
@file
@brief Defines runpython directives.
See `Tutorial: Writing a simple extension
<https://www.sphinx-doc.org/en/master/development/tutorials/helloworld.html>`_
"""
import sys
import os
from contextlib import redirect_stdout, redirect_stderr
import traceback
import warnings
from io import... | |
# pylint: disable=star-args, locally-disabled, too-few-public-methods, no-self-use, invalid-name
"""test_cmds.py - Unittests related to command implementations."""
import sys, os, unittest
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
from haproxy import cmds
class TestCommands(unittest.TestCa... | |
# 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... | |
# -*- coding: utf-8 -*-
import arcpy
import mds
import mds.messages
import numpy
import netCDF4
import os.path
#
# LIMITATIONS:
# > Attributes:
# Attribute values are copied wholesale from the original variable. Hence,
# if these values describe the the values in the new variable, i.e. as with
# valid_range, a... | |
# 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 use ... | |
import json
from unittest import mock
import colander
import pytest
import requests_mock
from redis import RedisError
from requests.exceptions import RequestException
from ichnaea.api.exceptions import LocationNotFound
from ichnaea.api.locate.constants import DataSource
from ichnaea.api.locate.fallback import (
E... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated by generateDS.py.
#
import sys
import getopt
import re as re_
etree_ = None
Verbose_import_ = False
( XMLParser_import_none, XMLParser_import_lxml,
XMLParser_import_elementtree
) = range(3)
XMLParser_import_library = None
try:
# lxml
fro... | |
'''
All primary_storage operations for test.
@author: Youyk
'''
import apibinding.api_actions as api_actions
import zstackwoodpecker.test_util as test_util
import account_operations
import apibinding.inventory as inventory
def create_primary_storage(primary_storage_option, session_uuid=None):
if primary_storage... | |
#!/usr/bin/env python
# IMPORT python base modules
import argparse
import glob
import subprocess
import sys
import os
from PySide.QtCore import *
from PySide.QtGui import *
# IMPORT custom modules
import BasketGlobals as config
import BasketBuilder
import gui.GUI_Launch as LauncherGUI
import utils.appconfig as appco... | |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from collections import OrderedDict, Mapping
from .copyutils import do_copy
import numpy as np
from astropy import log
from astropy.extern.six ... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not... | |
# Each setting is documented at:
# https://docs.djangoproject.com/en/1.9/ref/settings/
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
import os
from datetime import timedelta
from django.utils.translation import ugettext_lazy as _... | |
"""Hypergeometric and Meijer G-functions"""
from __future__ import print_function, division
from sympy.core import S, I, pi, oo, ilcm, Mod, C
from sympy.core.function import Function, Derivative, ArgumentIndexError
from sympy.core.containers import Tuple
from sympy.core.compatibility import reduce, range
from sympy.c... | |
import datetime
import os
import tempfile
from dateutil import relativedelta
import netCDF4
import numpy as np
import pytest
# constants
_UNITS_STD_TIME = "days since 1990-01-01"
_CALENDAR_NO_LEAP = "noleap"
_DATESTR_FORMAT_MONTHLY = "Foo.bar.ha.%Y-%m.nc"
@pytest.fixture(scope="module")
def cleandir():
newpath ... | |
#!/usr/bin/env python
# fibaro_motion_sensor_a.py
# Copyright (C) ContinuumBridge Limited, 2014-2015 - All Rights Reserved
# Written by Peter Claydon
#
ModuleName = "fibaro_motion_sensor"
BATTERY_CHECK_INTERVAL = 10800 # How often to check battery (secs) = 3 hours
SENSOR_POLL_INTERVAL = 600 ... | |
# Copyright 2016 CityGrid Media, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | |
from collections import Counter
from bottle_inject import inject, Injector, InjectError, Plugin
import unittest
import functools
def as_implicit(ip):
ip.implicit = True
return ip
class TestInjector(unittest.TestCase):
def setUp(self):
self.seq = range(10)
def test_inject_compare(self):
... | |
#!/usr/bin/env python
"""
--------------------------------------------------------------------------
Routine to perform aperture photometry on CHIMERA science frames.
Usage: python photometry.py [options] image coords
Author:
Navtej Saini
Orga... | |
#!/usr/bin/python2.4
#
# Unit tests for Mox.
#
# Copyright 2008 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 requ... | |
3#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 15 13:47:44 2018
@author: BallBlueMeercat
"""
import random
import numpy as np
import zodesolve
import tools
def redshift_picks(zmin, zmax, n):
"""
Takes in:
zmin = integer lowest redshift;
zmax = integer highest redshift;
... | |
from nose.tools import assert_equal, assert_true, assert_false, assert_raises
import networkx as nx
from networkx.algorithms import flow
from networkx.algorithms.connectivity import minimum_st_edge_cut
from networkx.algorithms.connectivity import minimum_st_node_cut
from networkx.utils import arbitrary_element
flow_f... | |
###############################################################################
##
## 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, ... | |
#!/usr/bin/env python3
import os
import shutil
import unittest
import create_and_write_file
import mvtools_test_fixture
import path_utils
import mvtools_envvars
import dsl_type20
def getcontents(filename):
if not os.path.exists(filename):
return None
contents = ""
with open(filename) as f:
... | |
#! /usr/bin/env python
"""Check design."""
import os
import sys
import luigi
import shutil
from luigi import LocalTarget
from luigi.util import inherits, requires
import pandas as pd
import gffutils
import glob
DIR = os.path.dirname(os.path.realpath(__file__))
script_dir = os.path.abspath(os.path.join(DIR, "../../scri... | |
""" Modified version of build_ext that handles fortran source files.
"""
import os
import subprocess
from glob import glob
from distutils.dep_util import newer_group
from distutils.command.build_ext import build_ext as old_build_ext
from distutils.errors import DistutilsFileError, DistutilsSetupError,\
DistutilsE... | |
# written by John Gregoire
# edited by Allison Schubauer and Daisy Hernandez
# 6/26/2013
# first version of figure of merit functions for automated
# data processing
from intermediatefunctions_firstversion import numpy
import intermediatefunctions_firstversion as inter
# this dictionary is required to know which fi... | |
# pylint: disable=g-bad-file-header
# 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/LICENS... | |
"""Support for MQTT sensors."""
from __future__ import annotations
from datetime import timedelta
import functools
import logging
import voluptuous as vol
from homeassistant.components import sensor
from homeassistant.components.sensor import (
DEVICE_CLASSES_SCHEMA,
STATE_CLASSES_SCHEMA,
SensorEntity,
)... | |
from flask import render_template, flash, redirect, url_for, request
from webapp import app, db
from webapp.forms import SignUpForm
from webapp.models import Monkey, Friendship, BestFriend
from config import PER_PAGE
@app.route('/', methods=['GET', 'POST'])
def home():
form = SignUpForm()
if form.validate_on_... | |
# Copyright 2013-2017 The Meson development team
# 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... | |
# Python Version: 2.7
import sys
import socket
import urlparse
from bs4 import BeautifulSoup
# GLOBAL CONSTANTS
CRLF = '\r\n'
# HEADER NAMES
HEADER_HOST = 'Host: '
HEADER_LOCATION = 'Location: '
HEADER_SET_COOKIE = 'Set-Cookie: '
HEADER_COOKIE = 'Cookie: '
HEADER_CONTENT_LENGTH = 'Content-Length: '
HEADER_CONNECT... | |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
from canvas.models import UserRedis
for ui in orm['canvas.UserInfo'].objects.all():
ui.follower_count = Us... | |
import re
import logging
import xmltodict
from share.transform.chain import ChainTransformer, ctx, links as tools
from share.transform.chain.exceptions import InvalidIRI
from share.transform.chain.links import GuessAgentTypeLink
from share.transform.chain.parsers import Parser
from share.transform.chain.utils import ... | |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | |
"""
Introduction
============
SqlSoup provides a convenient way to access database tables without
having to declare table or mapper classes ahead of time.
Suppose we have a database with users, books, and loans tables
(corresponding to the PyWebOff dataset, if you're curious). For
testing purposes, we'll create this... | |
"""Color util methods."""
import math
import colorsys
from typing import Tuple, List, Optional
import attr
# Official CSS3 colors from w3.org:
# https://www.w3.org/TR/2010/PR-css3-color-20101028/#html4
# names do not have spaces in them so that we can compare against
# requests more easily (by removing spaces from th... | |
#
# Copyright 2015 Quantopian, 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 wr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.