gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
"""
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction... | |
# -*- coding: utf-8 -*-
"""
github3.models
==============
This module provides the basic models used in github3.py
"""
from __future__ import unicode_literals
from json import dumps, loads
from requests.compat import urlparse, is_py2
from datetime import datetime
from logging import getLogger
from . import exceptio... | |
"""Versioned mixin class and other utilities."""
import datetime
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import event
from sqlalchemy import ForeignKeyConstraint
from sqlalchemy import Integer
from sqlalchemy import Table
from sqlalchemy import util
from sqlalchemy.ext.declarativ... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
from os.path import abspath, exists
import tornado
from concurrent.fu... | |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import http.client
import locale
import logging
import os
import sys
from contextlib import contextmanager
from io import BufferedReader, TextIOWrapper
from logging import Formatter, LogRe... | |
# Py3 compatibility
from __future__ import print_function
from __future__ import unicode_literals
import os
from cmd import Cmd
import traceback
import pkg_resources
from .util import read_file, write_file, create_md5_backup, bold, red, green
from .network import Network, DirectoryRepo, UnknownRepoError
from .constant... | |
# -*- coding: utf-8 -*-
"""
Shortest path algorithms for unweighted graphs.
"""
__author__ = """Aric Hagberg (hagberg@lanl.gov)"""
# Copyright (C) 2004-2015 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
__... | |
import rnn
import perceptron
from nyse import *
import nn
import classification_performance as cp
from plotting import *
def fs():
input_length = 100
hidden_cnt = 50
data = get_test_data(input_length)
rnn_nn = nn.NeuralNetwork(nn=rnn.RNN(input_length, hidden_cnt, data.x.shape[2], data.y.shape[1]),
... | |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Author: Endre Karlson <endre.karlson@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 License at
#
# http://www.apache.org/lice... | |
"""Shivali Chandra
Restructured code that takes coordinates of sides and axes of rotation, and rotates the sides
until they meet, forming a closed 3D shape. As of 5/3/15 can fold cubes, square pyramids, and
other prisms with square bases.
"""
import numpy as np
import math
import collections
def find_intersection_d... | |
# -*- coding: utf-8 -*-
"""
Django settings for Django Todo List project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, un... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | |
"""
Utils.
"""
import inflection
from django.core import urlresolvers
from django.conf import settings
from django.utils import six, encoding
from django.utils.translation import ugettext_lazy as _
from rest_framework.serializers import BaseSerializer, ListSerializer, ModelSerializer
from rest_framework.relations impor... | |
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import atexit
import platform
import re
from os import getenv, listdir, remove, sep, walk
from os.path import basename, dirname, isdir, isfile, join, normpath
from time import sleep
from SCons.Script import Exit, SConscript, SConscriptChdir
fro... | |
from copy import deepcopy
from django.utils.translation import gettext as _
from django.conf import settings
from django.core.exceptions import ValidationError
from django.forms.models import inlineformset_factory
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.bootstrap import ... | |
# 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... | |
#! /usr/bin/env python
from optparse import OptionParser
import os
import sys
import shutil
import codecs
class DirHelper(object):
def __init__(self, is_dir, list_dir, walk, rmtree):
self.is_dir = is_dir
self.list_dir = list_dir
self.walk = walk
self.rmtree = rmtree
class File... | |
from random import randrange
# Validation - Forces User to input an integer only.
def force_int(n):
try:
return int(n)
except ValueError:
return force_int(input("Sorry, not a number. Try again:"))
# Generates a random number, outside of excluded set. This should probably be a method in the B... | |
# Copyright (c) 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 writ... | |
""" Tests for belief_manager.py. """
from collections import deque
import numpy as np
from belief_manager import BeliefManager
from kalman import Kalman
import statistics
import tests
class _TestingBeliefManager(BeliefManager):
""" A class for testing the belief manager. """
def __init__(self, initial_positio... | |
#!/usr/bin/python
#---------------------------------------------------------------------------------------------------
# Script to review all samples which are kept in our database and take approriate action to get
# them into the processing queues.
#
# Author: C.Paus ... | |
import json
import time
import bitjws
import pytest
def _encode_header(newheader, origraw):
mod = bitjws.base64url_encode(json.dumps(newheader).encode('utf8'))
result = mod.decode('utf8') + origraw[origraw.find('.'):]
return result
def test_payload_expired():
key = bitjws.PrivateKey()
print(bitjws... | |
#!/usr/bin/env python
import io
import time
from nose import SkipTest
from nose.tools import *
import networkx as nx
class TestGEXF(object):
@classmethod
def setupClass(cls):
try:
import xml.etree.ElementTree
except ImportError:
raise SkipTest('xml.etree.ElementTree no... | |
"""
tests.unit.utils.cache_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test the salt cache objects
"""
import time
import pytest
import salt.config
import salt.loader
import salt.payload
import salt.utils.cache as cache
import salt.utils.data
import salt.utils.files
def test_sanity():
"""
Make sure you ca... | |
from __future__ import print_function
from __future__ import unicode_literals
import logging
import re
import signal
import sys
from inspect import getdoc
from operator import attrgetter
import dockerpty
from docker.errors import APIError
from requests.exceptions import ReadTimeout
from .. import __version__
from ..... | |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
from .._abstract.abstract import BaseAGSServer, BaseGPObject
from ..common.spatial import featureclass_to_json, recordset_to_json
from ..common.general import local_time_to_online
from ..security import security
import urllib
import json
import time
import datetime
####################################################... | |
# Copyright 2020 Department of Computational Biology for Infection Research - Helmholtz Centre for Infection Research
#
# This program 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 Li... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
threeslides is a live presentation/slide manager.
Copyright (c) 2015, J. Michael Caine.
License: MIT (see LICENSE for details)
"""
import _meta
__author__ = _meta.author
__version__ = _meta.version
__license__ = _meta.license
# gevent (first!)
#NEED YET?: from gevent ... | |
"""Support to embed Plex."""
import asyncio
import functools
from functools import partial
import json
import logging
import plexapi.exceptions
from plexapi.gdm import GDM
from plexwebsocket import (
SIGNAL_CONNECTION_STATE,
SIGNAL_DATA,
STATE_CONNECTED,
STATE_DISCONNECTED,
STATE_STOPPED,
PlexW... | |
import unittest
import imp
import os
import errno
import sys
import glob
import re
from distutils.errors import *
def unlink(path):
try:
os.unlink(path)
except OSError, exc:
if exc.errno != errno.ENOENT:
raise
class BrokenTest(unittest.TestCase.failureException):
def __repr__... | |
"""
*****
Pajek
*****
Read graphs in Pajek format.
This implementation handles directed and undirected graphs including
those with self loops and parallel edges.
Format
------
See http://vlado.fmf.uni-lj.si/pub/networks/pajek/doc/draweps.htm
for format information.
"""
# Copyright (C) 2008-2014 by
# Aric Hagber... | |
import unittest
import pysal
import numpy as np
#from pysal.spreg import error_sp as SP
import scipy
from scipy import sparse
from functools import partial
from pysal.contrib.handler import Model
GM_Error = partial(Model, mtype='GM_Error')
GM_Endog_Error = partial(Model, mtype='GM_Endog_Error')
GM_Combo = partial(Mod... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistrib... | |
#!/usr/bin/env python
# PyRadmon - Python Radiance Monitoring Tool
# Copyright 2014 Albert Huang.
#
# 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... | |
# -*- coding: utf-8 -*-
u"""Handles dispatching of uris to server.api_* functions
:copyright: Copyright (c) 2017 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkcollections
from pyke... | |
__version__ = '1.1'
__author__ = 'Juan Batiz-Benet <juan@benet.ai>'
__doc__ = '''
filesystem datastore implementation.
Tested with:
* Journaled HFS+ (Mac OS X 10.7.2)
'''
import os
import datastore.core
def ensure_directory_exists(directory):
'''Ensures `directory` exists. May make `directory` and intermediat... | |
# Copyright (c) 2013-2014 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
#
# Un... | |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | |
from __future__ import annotations
import bz2
from functools import wraps
import gzip
from typing import (
Any,
Callable,
)
import zipfile
from pandas._typing import (
FilePathOrBuffer,
FrameOrSeries,
)
from pandas.compat import (
get_lzma_file,
import_lzma,
)
import pandas as pd
from pandas.... | |
"""Tests for certbot.util."""
import argparse
import errno
import os
import shutil
import stat
import unittest
import mock
import six
from six.moves import reload_module # pylint: disable=import-error
from certbot import errors
import certbot.tests.util as test_util
class RunScriptTest(unittest.TestCase):
"""T... | |
from __future__ import print_function, absolute_import
import contextlib
import functools
from . import instructions, types, values
_CMP_MAP = {
'>': 'gt',
'<': 'lt',
'==': 'eq',
'!=': 'ne',
'>=': 'ge',
'<=': 'le',
}
def _binop(opname, cls=instructions.Instruction):
def wrap(fn):
... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Sonos-GUI-URI
This is the first attempt to create a window to stream a URI to the Sonos Speakers.
Author: Jim Scherer
"""
import Tkinter as tk
import ttk
# from ttk import Frame, Style, Label, Button, Entry
import tkMessageBox as mbox
import time
import soco as sonosLib... | |
#----------------------------------------------------------------------
# Copyright (c) 2011-2015 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | |
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
- 1. This model has 1,068,298 paramters and TWN compression strategy(weight:1,0,-1, output: float32),
after 500 epoches' training with GPU,accurcy of 80.6% was found.
- 2. For simplified CNN layers see "Convolutional layer (Simplified)"
in read the docs website.
- 3. Da... | |
"""VideoCapture.py
by Markus Gritsch <gritsch@iue.tuwien.ac.at>
"""
import vidcap
from PIL import Image, ImageFont, ImageDraw
import time, string
default_textpos = 'bl' # t=top, b=bottom; l=left, c=center, r=right
textcolor = 0xffffff
shadowcolor = 0x000000
def now():
"""Returns a string containing the curre... | |
# Copyright 2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | |
import os
import unittest
import socket
import json
from ray.autoscaler.local.coordinator_server import OnPremCoordinatorServer
from ray.autoscaler._private.providers import _NODE_PROVIDERS, \
_get_node_provider
from ray.autoscaler._private.local.node_provider import LocalNodeProvider
from ray.autoscaler._private.... | |
#
# Copyright (c) SAS Institute 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 w... | |
from __future__ import absolute_import, division, unicode_literals
from pip.vendor.six import text_type
import re
from . import _base
from .. import ihatexml
from .. import constants
from ..constants import namespaces
from ..utils import moduleFactoryFactory
tag_regexp = re.compile("{([^}]*)}(.*)")
def getETreeBui... | |
# -*- coding: utf-8 -*-
"""Tests for imfusion.insertions.aligners.star module."""
# pylint: disable=wildcard-import,redefined-builtin,unused-wildcard-import
from __future__ import absolute_import, division, print_function
from builtins import *
# pylint: enable=wildcard-import,redefined-builtin,unused-wildcard-import
... | |
#!/usr/bin/env python
"""\
Test Game engine tests all game engine relevant matters.
"""
import unittest
from tuqqna.core.game import Game
from tuqqna.core.player import Player
from tuqqna.core.errors.board import NoMoreSlotsInColumn
from tuqqna.core.errors.game import InvalidPlayerId
from tuqqna.core.errors.game im... | |
# Copyright 2012 Grid Dynamics
# Copyright 2013 Inktank Storage, Inc.
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.or... | |
from django import test
from django.conf import settings
from django.core import mail
from django.core.mail import EmailMessage
from django.template import Context as TemplateContext
from django.utils import translation
import mock
from nose.tools import eq_
import users.notifications
from amo.models import FakeEmail... | |
"""
# Database schema for benchbuild
The schema should initialize itself on an empty database. For now, we do not
support automatic upgrades on schema changes. You might encounter some
roadbumps when using an older version of benchbuild.
Furthermore, for now, we are restricted to postgresql databases, although we
alr... | |
# -*- coding: utf-8 -*-
"""Util functions for different things. For example: format time or bytesize correct."""
from flask import request, Response
from functools import wraps
from jinja2.filters import FILTERS
import os
import maraschino
from maraschino import app, logger
from maraschino.models import Setting, XbmcS... | |
# -*- coding: utf-8 -*-
from django.template import loader, Context
import re
from . import WidgetBase
from . import FontAwesomeIcon as FAIcon
from . import Label
class SidebarItem(WidgetBase):
def is_active(self):
return False
def is_hidden(self):
return False
class SidebarMenuItem(Sideba... | |
#! /usr/bin/env python
"""Create masks in native functional space from a variety of sources."""
import sys
import json
import time
import os.path as op
import argparse
from textwrap import dedent
from lyman.maskfactory import MaskFactory
def main(arglist):
# Parse command line arguments
args = parse_args(ar... | |
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | |
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 7 10:31:00 2016
@author: roel
"""
from opengrid import ureg
import pandas as pd
from dateutil import rrule
import datetime as dt
from itertools import groupby, count
import pytz
def parse_date(d):
"""
Return a pandas.Timestamp if possible.
Parameters... | |
#!/usr/bin/env python3
# genramsey.py
# Glenn G. Chappell
# Date: 26 Aug 2016
# Requires Python 3.
"""Functions for finding generalized Ramsey numbers & related extremal
graphs.
CONVENTIONS
See isograph.py for our graph representation. A set is represented as a
sorted list or tuple of its elements.
*Predicates* in... | |
# Copyright 2014 Kontron Europe GmbH
#
# 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 w... | |
# -*- coding: utf-8 -*-
# Copyright 2015 Metaswitch Networks
#
# 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 applicab... | |
from __future__ import division
import warnings
import numpy as np
from matplotlib.patches import Circle, Ellipse
from ..base import model_domain, Domain
from ...models import MDP
from ...representation import ControllerGraph
__all__ = [
'SocialNavigationWorld',
'CGSocialNavigationMDP',
'GridSocialNa... | |
# 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/python2.5
import ode
import threading, time, re
class Physics :
def __init__(self) :
# Create a world object
self.world = ode.World()
self.world.setGravity((0,0,-3.0))
self.world.setERP(0.1) # error correction each time step
self.world.setCFM(0.0) # rigi... | |
# 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/python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Example run from the server2/ directory:
# $ converter.py ../static/ ../../api templates/articles/ templates/intros/
# templates/pu... | |
"""Let's Encrypt client API."""
import logging
import os
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa
import OpenSSL
import zope.component
from acme import client as acme_client
from acme import jose
from acme import messages
from letsencrypt impo... | |
import pytest
from datetime import datetime
import pandas.util.testing as tm
from pandas import compat
from pandas import DatetimeIndex
from pandas.tseries.holiday import (USFederalHolidayCalendar, USMemorialDay,
USThanksgivingDay, nearest_workday,
... | |
''' Tests for netcdf '''
import os
from os.path import join as pjoin, dirname
import shutil
import tempfile
import warnings
from io import BytesIO
from glob import glob
from contextlib import contextmanager
import numpy as np
from numpy.testing import (assert_, assert_allclose, assert_equal,
... | |
# A test suite for pdb; not very comprehensive at the moment.
import doctest
import pdb
import sys
import types
import unittest
import subprocess
import textwrap
from test import support
# This little helper class is essential for testing pdb under doctest.
from test.test_doctest import _FakeInput
class PdbTestInpu... | |
############################################################################
# Joshua R. Boverhof, LBNL
# See Copyright for copyright notice!
# $Id: $
###########################################################################
import os, sys, types, inspect
from StringIO import StringIO
# twisted & related imports
fro... | |
"""Process RT mentions
MIT License (MIT)
Copyright (c) 2015 Julien BLEGEAN <julien.blegean@aalto.fi>
"""
import networkx as nx
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import re
import datetime
import redis
import string
import numpy as np
import m... | |
import shelve
import os
import numpy as np
resultsDb = 'resultsDb'
dbRepoDir = 'db'
unionSym = '$'
dbEntyKeysToSkip = ['metadata']
def getDbRepoDir():
filepath = os.path.abspath(__file__)
modulesdir = os.path.dirname(filepath)
root, tdir = os.path.split(modulesdir)
rootparent, tdir = os.path.split(ro... | |
import scrapy
from scrapy.spiders import Spider
from scrapy.http import Request
DOMAIN = 'www.crtc.gc.ca/eng/dno.htm'
URL = 'http://%s' % DOMAIN
class LinkSpider(Spider):
name = DOMAIN
download_delay = 5
allowed_domains = [DOMAIN]
start_urls = [
'http://www.crtc.gc.ca/eng/8045/d2017.htm',
'http://www.crtc.gc.ca... | |
# mininode.py - Energi P2P network half-a-node
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# This python code was modified from ArtForz' public domain half-a-node, as
# found in the mini-node branch of http://github.co... | |
"""
pygments.lexers.textfmts
~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for various text formats.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexers import guess_lexer, get_lexer_by_name
from pygments.lexer import Re... | |
"""Valve IPv4/IPv6 routing implementation."""
# 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 und... | |
''' General matrix and other utilities for statistics '''
import numpy as np
import numpy.linalg as npl
import scipy.interpolate
__docformat__ = 'restructuredtext'
def pos_recipr(X):
""" Return element-wise reciprocal of array, setting `X`>=0 to 0
Return the reciprocal of an array, setting all entries ... | |
# 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 ... | |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# 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
# ... | |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Taskmaster-2 implementation for ParlAI.
No official train/valid/test splits are available as of 2020-05-18, so we m... | |
#!/usr/bin/python
#
# Copyright (C) 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 required by applicable law ... | |
# Copyright 2018, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | |
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from models import Restaurant, Base, MenuItem
engine = create_engine('sqlite:///restaurantmenu.db')
# Bind the engine to the metadata of the Base class so that the
# declaratives can be accessed through a DBSession instance
Base.metadata.bin... | |
# Copyright (c) 2016 by Tegile Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | |
import numpy as np
import scipy.sparse as sps
class CanonicalConstraint(object):
"""Canonical constraint to use with trust-constr algorithm.
It represents the set of constraints of the form::
f_eq(x) = 0
f_ineq(x) <= 0
Where ``f_eq`` and ``f_ineq`` are evaluated by a single function, se... | |
# 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... | |
#-*- coding: utf-8 -*-
from django import forms
from django import template
from django.core.exceptions import ValidationError
from django.contrib.admin import helpers
from django.contrib.admin.util import quote, unquote, capfirst
from django.contrib import messages
from django.utils.http import urlquote
from filer.adm... | |
# coding: utf-8
""" Test cases for misc plot functions """
import pytest
from pandas import DataFrame
from pandas.compat import lmap
import pandas.util.testing as tm
import pandas.util._test_decorators as td
import numpy as np
from numpy import random
from numpy.random import randn
import pandas.plotting as plotti... | |
from django.db import models
from django.conf import settings
from django.utils import timezone
from django.views.decorators.debug import sensitive_variables
from django.contrib.auth.models import AbstractUser
from lib import ldap_utils
import ldapdb.models.fields as ldap_fields
import ldapdb.models
import logging
impo... | |
# (c) 2009-2014 Martin Wendt and contributors; see WsgiDAV https://github.com/mar10/wsgidav
# Original PyFileServer (c) 2005 Ho Chun Wei.
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
"""
WSGI container, that handles the HTTP requests. This object is passed to the
WSGI server and... | |
from Products.CMFPlone.utils import _createObjectByType, safe_unicode
from bika.lims import bikaMessageFactory as _
from bika.lims.utils import t
from bika.lims.browser.bika_listing import BikaListingView
from bika.lims.config import PROJECTNAME
from bika.lims.idserver import renameAfterCreation
from bika.lims.interfac... | |
import os
import utils
import logging
import pipeline
from itertools import product
from third_party import platforms
from third_party import CMAKELIB_URL
from third_party import HTTP_URL_NPSERVER
from third_party import get_identifier
def search_cmakelib():
# compilando desde cmaki_generator
cmakelib_dir = os... | |
import datetime
import difflib
from flask import redirect, render_template, render_template_string, Blueprint, flash
from flask import request, url_for, jsonify
from flask_user import current_user, login_required, roles_accepted
from flask_login.mixins import AnonymousUserMixin
from flask_mail import Mail, Message
fro... | |
# Copyright (c) 2013-2014 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2014 Vlad Temian <vladtemian@gmail.com>
# Copyright (c) 2014-2016 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2015 Cezar <celnazli@bitdefender.com>
# Copyright (c) 2015 Chris Rebert <code@rebertia.com>
# Licensed under... | |
import numpy
try:
import pylab
pylabok = True
except:
pylabok = False
print "Pylab could not be imported; plotting functions will be disabled"
try:
import scipy.special
scipyok = True
except:
scipyok = False
print "Scipy could not be imported."
from numpy import pi
pc = 3.086e18 # cm
c... | |
import datetime
import pytest
from pykechain.enums import Category, Classification, Multiplicity, PropertyType
from pykechain.exceptions import APIError, IllegalArgumentError, MultipleFoundError, NotFoundError
from pykechain.models import Part, PartSet
from tests.classes import TestBetamax
class TestParts(TestBetam... | |
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.trial import unittest
# system imports
import os, shutil, time
# twisted imports
from twisted.python import logfile
class LogFileTestCase(unittest.TestCase):
"""Test the rotating log file."""
def setUp(sel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.