gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Passes Python2.7's scanner suite and incorporates all the latest updates.
# Copyright 2009 Raymond Hettinger, released under the MIT License.
# http://code.activestate.com/recipes/576693/
try:
from thread import get_ident as _get_i... | |
#!/usr/bin/env python3
import os
import sys
import logging
import argparse
import platform
import subprocess
import glob
import hashlib
os.environ["PYTHONUNBUFFERED"] = "y"
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(ZULIP_PATH)
from scripts.lib.zulip_too... | |
# -*- coding: utf-8 -*-
#
# -----------------------------------------------------------------------------------
# Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softw... | |
#!/usr/bin/env python
# IMAP Grab
# Version 0.1.4
ig_version_short="0.1.4"
# Copyleft:
# This program was first written by Daniel Roesler (diafygi) in
# January 2009. It is released under the Gnu Public License v2
# (GPLv2) as Free Software. Enjoy.
# <http://www.gnu.org/licenses/gpl-2.0.txt>
# Contact:
# di... | |
import json
from unittest.mock import patch
from django.test import TestCase
from draftjs_exporter.dom import DOM
from draftjs_exporter.html import HTML as HTMLExporter
from wagtail.admin.rich_text.converters.contentstate import (
ContentstateConverter,
persist_key_for_block,
)
from wagtail.embeds.models impo... | |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | |
# Natural Language Toolkit: Interface to Weka Classsifiers
#
# Copyright (C) 2001-2013 NLTK Project
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Classifiers that make use of the external 'Weka' package.
"""
from __future__ import p... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: token_container.py
Copyright 2017 Vai Technologies, 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... | |
import unittest
import proxy
from proxy import *
from proxy import bytes_, text_
class TestChunkParser(unittest.TestCase):
def setUp(self):
self.parser = ChunkParser()
def test_chunk_parse(self):
self.parser.parse(b''.join([
b'4\r\n',
b'Wiki\r\n',
b'5\r\n'... | |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 Yahoo! 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... | |
# 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... | |
"""
Views for the Projects App
"""
import datetime
import subprocess
import sys
from django.http import StreamingHttpResponse, HttpResponseRedirect
from django.db.models.aggregates import Count
from django.contrib import messages
from django.views.generic import CreateView, UpdateView, DetailView, View, DeleteView, R... | |
from sympy.core.basic import Basic, S, C, sympify
from sympy.core.function import Function, Lambda
from sympy.core.cache import cacheit
from sympy.functions.elementary.miscellaneous import sqrt
from sympy.utilities.decorator import deprecated
##########################################################################... | |
#!/usr/bin/env python
def get_help_data_12577():
"""
Alerts and Alarms help.
Data store of information to be presented when a help request is made for port 12577.
Returns a list of dictionaries associated with various requests supported on that port.
"""
help_data = [
{
... | |
import imp
from inspect import getmembers
import sys
from venusian.compat import iter_modules
from venusian.compat import is_nonstr_iter
from venusian.advice import getFrameInfo
ATTACH_ATTR = '__venusian_callbacks__'
class Scanner(object):
def __init__(self, **kw):
self.__dict__.update(kw)
def scan(... | |
# Copyright 2013 Big Switch Networks
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | |
from builtins import str
from builtins import range
import os
import shutil
import tempfile
from uuid import uuid4
import ethereum.tools.keys
from ethereum.slogging import get_logger
from ethereum.utils import (
encode_hex,
decode_hex,
remove_0x_head,
)
from devp2p.app import BaseApp
import pytest
from pyet... | |
# -*- coding:utf-8 -*-
#
# Copyright (C) 2008 The Android Open Source Project
#
# 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 re... | |
"""
kombu.transport.redis
=====================
Redis transport.
"""
from __future__ import absolute_import
from __future__ import with_statement
import socket
from bisect import bisect
from contextlib import contextmanager
from time import time
from Queue import Empty
from anyjson import loads, dumps
from kombu.... | |
'''
Created on Oct 17, 2013
@author: moreno and kanaan
'''
#!/usr/bin/env python
"""
=============================================
Diffusion MRI Probabiltic tractography on NKI_enhanced.
This script uses FSL and MRTRIX algorithms to generate probabilstic tracts, tract density images
and a 3D trackvis file of NKI_en... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file lib_nrf24.py is a slightly tweaked version of Barraca's "pynrf24".
# So this is my tweak for Raspberry Pi and "Virtual GPIO" ...
# ... of Barraca's port to BeagleBone python ... (Joao Paulo Barraca <jpbarraca@gmail.com>)
# ... of maniacbug... | |
#!/usr/bin/env python
from __future__ import print_function
from configobj import ConfigObj
import sys
import os
from subprocess import call
def lower_to_sep(string, separator='='):
line=string.partition(separator)
string=str(line[0]).lower()+str(line[1])+str(line[2])
return string
if (len(sys.argv) < 2):
print(... | |
import operator
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.arrays import BooleanArray
from pandas.core.ops.mask_ops import (
kleene_and,
kleene_or,
kleene_xor,
)
from pandas.tests.extension.base import BaseOpsUtil
class TestLogicalOps(BaseOpsUtil):
... | |
# 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... | |
"""
A set of functions for setuping up GROMACS simulations
"""
########################################################################
# #
# This script was written by Thomas Heavey in 2017. #
# theavey@bu.edu thomasjhe... | |
import csv
import datetime
import json
import logging
import urlparse
from io import BytesIO
from django.conf import settings
from django.core.exceptions import ValidationError as DjangoValidationError
from django.core.urlresolvers import reverse
from django.core.validators import validate_ipv4_address, validate_ipv46... | |
#/***********************************************************************
# * Licensed Materials - Property of IBM
# *
# * IBM SPSS Products: Statistics Common
# *
# * (C) Copyright IBM Corp. 1989, 2014
# *
# * US Government Users Restricted Rights - Use, duplication or disclosure
# * restricted by GSA ADP Schedule Co... | |
__all__ = [
'BASE_IMAGE_RELEASE_CODE_NAME',
# Pod.
'PodConfig',
'generate_machine_name',
'generate_pod_id',
'validate_pod_id',
'validate_pod_name',
'validate_pod_version',
# XAR.
'validate_xar_name',
# App.
'validate_app_name',
# Image.
'validate_image_id',
'v... | |
# 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 ... | |
# ----------------------------------------------------------------------------
# Copyright 2014 Nervana 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.o... | |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import re
import html5lib
from html5lib.sanitizer import HTMLSanitizer
from html5lib.serializer.htmlserializer import HTMLSerializer
from . import callbacks as linkify_callbacks
from .encoding import force_unicode
from .sanitizer import B... | |
import asyncio
import os
import sys
import copy
import shutil
import tempfile
from unittest import mock
import pytest
from tornado import testing
from tornado.platform.asyncio import AsyncIOMainLoop
from waterbutler.core import metadata
from waterbutler.core import provider
from waterbutler.server.app import make_app... | |
"""BGP implementation for FAUCET."""
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2019 The Contributors
#
# Licensed under the Ap... | |
#!/usr/bin/env python
# Copyright (c) 2011-2018, wradlib developers.
# Distributed under the MIT License. See LICENSE.txt for more info.
"""
Miscellaneous Data I/O
^^^^^^^^^^^^^^^^^^^^^^
.. autosummary::
:nosignatures:
:toctree: generated/
write_polygon_to_text
to_pickle
from_pickle
get_radiosonde
... | |
# Copyright 2011 Piston Cloud Computing, 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
#
# Unle... | |
"""
TODO:
* Move producer, consumer into their own files
* ZKUtil should be broken up into two pieces -- one with path info, the rest
to get folded into consumer and producer as necessary.
FIXME: Extract the logic for testing how the brokers get partitioned so we can
test them in simple unit tests without in... | |
# 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
# d... | |
#!/usr/bin/env python
"""
@package ion.agents.platform.rsn.rsn_platform_driver
@file ion/agents/platform/rsn/rsn_platform_driver.py
@author Carlos Rueda
@brief The main RSN OMS platform driver class.
"""
__author__ = 'Carlos Rueda'
__license__ = 'Apache 2.0'
from pyon.public import log, CFG
from pyon.core.exc... | |
#!/usr/bin/python
import os
import sys
import random
import time
from itertools import product
import Tkinter as tk
import tkFont
import tkSimpleDialog
import tkMessageBox
from PIL import ImageTk, Image
class Card:
FACES = {11: 'Jack', 12: 'Queen', 13: 'King', 14: 'Ace'}
SUITS = {'Hearts': 1, 'Diamonds': ... | |
# 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 ... | |
# Importing random (for question generating) and sys (for program termination)
import random, sys
# Sets the global variables for later use within the program
question_position = 0
user_score = 0
# startup function - Basic inputs (name, class etc)
def main(question_position, user_score):
print()
print("... | |
#this code contributed by Kyle Macfarlane see
#https://bitbucket.org/rptlab/reportlab/issues/69/implementations-of-code-128-auto-and-data
__all__= ('ECC200datamatrix',)
FACTORS = {
5: (228, 48, 15, 111, 62),
7: (23, 68, 144, 134, 240, 92, 254),
10: (28, 24, 185, 166, 223, 248, 116, 255, 110, 61),
11: (1... | |
# Copyright (c) 2012 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 ... | |
# Copyright 2020 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | |
import numpy as np
from scipy._lib._util import check_random_state
from scipy.special import ndtr, ndtri
from scipy._lib._util import rng_integers
from dataclasses import make_dataclass
from ._common import ConfidenceInterval
from scipy.stats.stats import _broadcast_concatenate
def _vectorize_statistic(statistic):
... | |
"""The main config file for Superset
All configuration in this file can be overridden by providing a superset_config
in your PYTHONPATH as there is a ``from superset_config import *``
at the end of this file.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_functi... | |
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
#
# This document should comply with PEP-8 Style Guide
# Linter: pylint
"""
Interface for setting up and creating a model in Tensorflow.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
im... | |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import gpxpy
import gpxpy.gpx
import json
import time
from pokemongo_bot.base_task import BaseTask
from pokemongo_bot.cell_workers.utils import distance
from pokemongo_bot.cell_workers.utils import format_dist
from pokemongo_bot.cell_workers.utils import i... | |
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
from sys import version_info
import numpy as np
from scipy import interpolate, sparse
from copy import deepcopy
from sklearn.datasets import load_boston
from sklearn.utils.testing ... | |
import base64
import datetime
import hashlib
import json
import logging
import math
import sys
import requests
from dateutil import parser
from django.core.serializers.json import DjangoJSONEncoder
from django.db import connection
from django.db import transaction
from django.db.models import Count
from django.db.mode... | |
"""
printing tools
"""
import sys
from pandas.core.dtypes.inference import is_sequence
from pandas import compat
from pandas.compat import u
from pandas.core.config import get_option
def adjoin(space, *lists, **kwargs):
"""
Glues together two sets of strings using the amount of space requested.
The idea ... | |
import os
import re
from datetime import datetime, timedelta
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.db import transaction
from django.utils.encoding import force_str
from django_statsd.clients import statsd
from multidb import get_replica
import ... | |
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (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.mozilla.org/MPL/
#
# Softwa... | |
"""
Support to use flic buttons as a binary sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.flic/
"""
import logging
import threading
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.... | |
import numpy as np
from numba.cuda.testing import unittest, CUDATestCase, skip_on_cudasim
from numba.tests.support import skip_unless_py37_or_later
from numba.np import numpy_support
from numba import cuda, float32, float64, int32, vectorize, void, int64
import math
def math_acos(A, B):
i = cuda.grid(1)
B[i] ... | |
#!/bin/env python3
# -*- coding: utf-8 -*-
"""
DEPRECATION WARNING
Visualization / network analysis in factnet.py will is no longer supported or maintained in this package as it is not part of the core functionality, and will be removed.
Provides basic network plotting functions for a CProject.
"""
# import networ... | |
# Line too long - pylint: disable=C0301
# Copyright (c) Greenplum Inc 2011. All Rights Reserved.
from optparse import OptionGroup
import os
import sys
import tarfile
try:
from gppylib import gplog, pgconf
from gppylib.commands import gp
from gppylib.commands.base import Command, ExecutionError
from gp... | |
# Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import re
import os
import json
import shutil
import tempfile
import time
import unittest
import itertools
import urllib
import mock
import flask
from gevent import monkey
monkey.patch_all()
from bs4 import BeautifulSoup
import PIL.Image
from urlpar... | |
# -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.
""" module that provides a Document object that allows you
to map CouchDB document in Python statically, dynamically or both
"""
from . import properties as p
from .properties import value... | |
# -*- coding: utf-8 -*-
"""
Moves a trainer to a Pokemon.
Events:
move_to_map_pokemon_fail
When the worker fails.
Returns:
message: Failure message.
move_to_map_pokemon_updated_map
When worker updates the PokemonGo-Map.
Returns:
lat: Latitude
... | |
# -*- coding: utf-8 -*-
import datetime
import os
import json
import logging
from django.db import models
from django.forms import ModelForm, Textarea
from django.utils.html import escape
from django.utils.translation import ugettext as _
import seaserv
from seaserv import seafile_api, ccnet_api
from seahub.base.fie... | |
import cuttsum.events
import cuttsum.judgements
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.feature_extraction.text import TfidfVectorizer
import numpy as np
import corenlp
from cuttsum.misc import english_stopwords
dom2type = {
"accidents": set(["accident"]),
"natural-disasters": set([... | |
from __future__ import print_function
from . import __version__
import sys
import os
import ConfigParser
import json
from fdbops import FdbOps
import geotri
MEALTAGS = [u'BREAKFAST', u'SMALL PLATES, APPS & SIDES',
u'SOUPS', u'SALADS', u'BURGERS & SANDWICHES',
u'PASTA, PIZZA & NOODLES', u'MEATL... | |
# Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Low-level logic for a certificate authority.
We have three categories of certificates:
1. Control service, used by AMP and REST API servers. Needs to be
validated over HTTP by 3rd party clients, as well as by AMP clients.
2. Node agents, used by AMP cl... | |
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
import logging
import numpy
import pytz
from corehq.apps.indicators.models import DynamicIndicatorDefinition, CombinedCouchViewIndicatorDefinition
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColu... | |
"""
Base file upload handler classes, and the built-in concrete subclasses
"""
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files.uploadedfile import TemporaryUplo... | |
# Adopted from https://github.com/KiroSummer/A_Syntax-aware_MTL_Framework_for_Chinese_SRL
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
from hanlp.components.srl.span_rank.util import block_orth_normal_initializer
def get_tensor_np(t):
... | |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... | |
# Copyright (c) 2012 Rackspace Hosting
# All Rights Reserved.
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/license... | |
#!/usr/bin/env python3
"""
Parts of this file were taken from the pyzmq project
(https://github.com/zeromq/pyzmq) which have been permitted for use under the
BSD license. Parts are from lxml (https://github.com/lxml/lxml)
"""
import argparse
from distutils.sysconfig import get_config_vars
from distutils.version impor... | |
"""
.. module: lemur.common.utils
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
import base64
import json
import random
import re
import socket
import ssl
import string
i... | |
# -*- coding: utf-8 -*-
"""
conftest
~~~~~~~~
Test fixtures and what not
:copyright: (c) 2017 by CERN.
:license: MIT, see LICENSE for more details.
"""
import os
import tempfile
import time
from datetime import datetime
import pytest
from flask import Flask, render_template
from flask_mail impor... | |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import functools
import numpy as np
from hypothesis import assume, given
import hypothesis.strategies as st
from caffe2.proto import caffe2_pb2
from caffe2.python import brew, core, workspa... | |
import redis
import unittest
import datetime
import threading
import time
from distutils.version import StrictVersion
class ServerCommandsTestCase(unittest.TestCase):
def get_client(self):
return redis.Redis(host='localhost', port=6379, db=9)
def setUp(self):
self.client = self.get_client()
... | |
import decimal
import os.path
import re
import textwrap
import typing
import unittest
from django.test import TestCase as DjangoTestCase
import kirppu.provision_dsl.interpreter as dsl
from kirppu.provision_dsl.interpreter import Error, ErrorType
from kirppu.models import Item
from kirppu.tests.factories import ItemFac... | |
# Copyright (c) 2012 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.
"""A class for managing the Linux cgroup subsystem."""
import contextlib
import errno
import os
import signal
import time
from chromite.lib import c... | |
"""
A simple tool for converting JSON to an HTML table.
This is based off of the `json2html` project.
Their code can be found at https://github.com/softvar/json2html
"""
from __future__ import division, print_function, absolute_import
import json
__all__ = ["convert"]
def convert(json_input, build_direction="LEFT_TO... | |
#!/usr/bin/python
# (c) 2016, Dag Wieers <dag@wieers.com>
#
# This file is part of Ansible
#
# Ansible 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 version 3 of the License, or
# (at your option) an... | |
##
# Copyright (c) 2006-2017 Apple 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 l... | |
import theano
import theano.tensor as T
from lasagne.layers import Layer
from lasagne import init
from lasagne import nonlinearities
# original source at:
# https://github.com/f0k/Lasagne/blob/batchnorm/lasagne/layers/normalization.py
# this has not yet been released in Lasagne's master branch, so temporarily
# has ... | |
#YZ JavaScript Django Template Compiler
#Copyright (c) 2010 Weiss I Nicht <KeineAhnung@atliva.com>
#(sha-1: 90f01291285340bf03c2d41952c4b21b3d338907)
from django.template import Template
import django.template
from django.template.loader import get_template
from django.utils.html import strip_spaces_between_tags
impo... | |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ApiKey.allowed_origins'
db.add_column(
'sentry... | |
#
# Copyright 2013 NEC Corporation. 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 (c) 2015 Duke University.
# This software is distributed under the terms of the MIT License,
# the text of which is included in this distribution within the file
# named LICENSE.
#
# Portions of this software are derived from the "rest_router" controller
# application included with Ryu (http://osrg.github.i... | |
"""Tests for options manager for :class:`Poly` and public API functions. """
from sympy.polys.polyoptions import (
Options, Expand, Gens, Wrt, Sort, Order, Field, Greedy, Domain,
Split, Gaussian, Extension, Modulus, Symmetric, Strict, Auto,
Frac, Formal, Polys, Include, All, Gen, Symbols, Method)
from sym... | |
# Copyright (c) 2019 UAVCAN Consortium
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
from __future__ import annotations
import copy
import typing
import asyncio
import logging
import warnings
import dataclasses
import pyuavcan.transport
from pyuavcan.tra... | |
#!/bin/env python2.7
import sys
import os
import os.path
import glob
import copy
import traceback
import time
import re
import csv
import tempfile
import urllib.request, urllib.parse, urllib.error
import shutil
import atexit
import subprocess
import time
import math
from collections import defaultdict
from os.path impo... | |
"""
This module gathers tree-based methods, including decision, regression and
randomized trees. Single and multi-output problems are both handled.
"""
# Authors: Gilles Louppe <g.louppe@gmail.com>
# Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Brian Holt <bdholt1@gmail.com>
# Noel Da... | |
# -*- coding: utf-8 -*-
try:
# Python 2.7
from collections import OrderedDict
except:
# Python 2.6
from gluon.contrib.simplejson.ordered_dict import OrderedDict
from gluon import current
from gluon.storage import Storage
from gluon.validators import IS_NOT_EMPTY, IS_EMPTY_OR, IS_IN_SET
from s3 import... | |
"""Observer based yaw rate controller with integral action.
"""
from parameters import rear, w
import scipy.io as sio
from scipy.signal import cont2discrete, bode, lti, ss2tf, dstep, freqz, ss2zpk
from scipy.optimize import curve_fit
import numpy as np
from numpy import pi, dot
from numpy.matlib import zeros, empty, e... | |
# 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):
# Adding model 'WelcomeEmailRecipient'
db.create_table('canvas_welcomeemailrecipient', (
('id'... | |
"""
Tools for drawing Python object reference graphs with graphviz.
You can find documentation online at https://mg.pov.lt/objgraph/
Copyright (c) 2008-2017 Marius Gedminas <marius@pov.lt> and contributors
Released under the MIT licence.
"""
# Permission is hereby granted, free of charge, to any person obtaining a
#... | |
"""
Table property for providing information about table.
"""
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import sys
import os
from contextlib import contextmanager
from inspect import isclass
import numpy as np
from astropy.utils.data_info import DataInfo
__all__ = ['table_info', 'TableInfo', 'se... | |
"""
This module contains all kinds of functions needed for execution of the notebook
"""
import scipy
import os
import json
import pandas as pd
import itertools
import numpy as np
import warnings
import requests
from matplotlib import cm
from matplotlib import pyplot as plt
from matplotlib.gridspec import GridSpec
imp... | |
#! /usr/bin/env python
"""Catch moment when tables are in sync on master and slave.
"""
import sys, time, os, subprocess
import pkgloader
pkgloader.require('skytools', '3.0')
import skytools
class TableRepair:
"""Checks that tables in two databases are in sync."""
def __init__(self, table_name, log):
... | |
import os
import os.path as op
from werkzeug import secure_filename
from werkzeug.datastructures import FileStorage
from wtforms import ValidationError, fields
from wtforms.widgets import HTMLString, html_params
try:
from wtforms.fields.core import _unset_value as unset_value
except ImportError:
from wtforms... | |
import json
import unittest
import webtest
import os
import test_utils
from api.src import main
from google.appengine.ext import ndb
from google.appengine.ext import testbed
from sets import Set
class AppTest(unittest.TestCase):
def setUp(self):
os.environ['AUTH_DOMAIN'] = 'testbed'
self.testbed = testbed.... | |
# take the guardian articles and generate a csv
# import guardian articles
import os
import json
import csv
import re
from elasticsearch import Elasticsearch
from elasticsearch_dsl.connections import connections
connections.create_connection(hosts=['http://controcurator.org:80/ess'])
es = Elasticsearch(
['h... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.