gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
#!/usr/bin/env python2
#This is the main Bolinas script that runs the parser.
import sys
import fileinput
import math
import pprint
from argparse import ArgumentParser
# Bolinas imports
from config import config
from common.hgraph.hgraph import Hgraph
from common import log
from common import output
from common.exce... | |
"""SCons.Tool.mslink
Tool-specific initialization for the Microsoft linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Fo... | |
#!/usr/bin/env python
"""Yet another HTTP Server (YaHS)
Provides simple decorator API to quickly create and test RESTful APIs
"""
__author__ = 'Tim Sullivan'
__version__ = '1.1'
__license__ = 'MIT'
import sys
import os
import signal
import socket
import threading
import ssl
import logging
import re
import collection... | |
"""
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 this ... | |
import difflib
import filecmp
import os.path
import sys
import tempfile
import unittest
def _get_parent_dir(path):
"""utility function to get parent dir
"""
return os.path.abspath(os.path.join(os.path.abspath(path), os.pardir))
root_dir = _get_parent_dir(_get_parent_dir(__file__))
test_dir = _get_paren... | |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The American Gut Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Dag Wieers (@dagwieers) <dag@wieers.com>
# 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_ve... | |
#!/usr/bin/env python3
# Copyright (c) 2014-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the pruning code.
WARNING:
This test uses 4GB of disk space.
This test takes 30 mins or more (up ... | |
#!/usr/bin/env 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.
'''Unit tests for grit.gather.rc'''
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.dirnam... | |
# encoding: utf-8
# Copyright 2013 maker
# License
# 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 field 'TicketRecord.updaterecord_ptr'
db.add_... | |
from PyQt4 import QtCore
from PyQt4 import QtGui
from PyQt4 import QtWebKit
from renderers import MessageRenderer
from qtx import ClickableQLabel, IdleTimer, RowPushButton, SpellTextEditor
class AboutDialog(QtGui.QDialog):
def __init__(self, mainFrame):
super(AboutDialog, self).__init__(mainFrame)
... | |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applica... | |
# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
# See LICENSE for details.
import pickle, time, weakref, gc
from twisted.trial import unittest, util
from twisted.python import threadable, failure, context
from twisted.internet import reactor, interfaces
from twisted.internet.defer import Deferred
#
# See the... | |
# 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... | |
#!/bin/env python
# Copyright (C) 2012,2013,2014,2015 Seven Watt <info@sevenwatt.com>
# <http://www.sevenwatt.com>
#
# This file is part of Plugwise-2-py.
#
# Plugwise-2-py 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... | |
from .maybeerror import MaybeError as M
from . import functions
class ConsList(object):
'''
A data structure that supports constant-time first/rest slicing.
The input sequence is never copied or modified -- all the slicing
does is increment a position counter and create a new wrapper.
'''
de... | |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Product.sku'
db.add_column('shop_product', 'sku',
self.gf('cartridge.s... | |
'''
Created on Apr 8, 2014
@author: cmills
'''
from tasr_test import TASRTestCase
import unittest
import time
import tasr.app
from tasr import AvroSchemaRepository
from tasr.group import InvalidGroupException
APP = tasr.app.TASR_APP
APP.set_config_mode('local')
HOST_PORT = r'%s:%s' % (APP.config.host, APP.config.po... | |
#!/bin/sh
# sudoku3.py
# SudokuSolver
#
# Created by joe yuan on 3/6/11.
# Copyright 2011 __MyCompanyName__. All rights reserved.
import time
import sys
def rowbyrow():
d = []
for i in range(9):
x = INPUT_PROCESS(i)
d.append(x)
for k,i in enumerate(d):
for j,c in enumerate(i):
... | |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import shlex
import unittest
from pants.option.arg_splitter import (ArgSplitter, NoGoalH... | |
# -*- coding: utf-8 -*-
"""The extractor class definitions.
An extractor is a class used to extract information from "raw" data.
"""
import copy
import pysigscan
from dfvfs.helpers import file_system_searcher
from dfvfs.lib import definitions as dfvfs_definitions
from dfvfs.lib import errors as dfvfs_errors
from df... | |
#
# This file is part of python-dbusx. Python-dbusx is free software
# available under the terms of the MIT license. See the file "LICENSE" that
# was provided together with this source file for the licensing terms.
#
# Copyright (c) 2012-2013 the python-dbusx authors. See the file "AUTHORS"
# for a complete list.
imp... | |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
from django.core.urlresolvers import reverse
from exam import fixture
from social_auth.models import UserSocialAuth
from sentry.models import UserOption, LostPasswordHash, User
from sentry.testutils import TestCase
class AppearanceSettings... | |
# Copyright 2018 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, ... | |
"""
WSGI Middleware apps that haven't gotten around to being extracted to
their own modules.
"""
import logging
import time
import urllib
from tiddlyweb.model.policy import UserRequiredError, ForbiddenError
from tiddlyweb.store import Store
from tiddlyweb.web.http import HTTP403, HTTP302
from tiddlyweb.web.util impor... | |
# Copyright 2013 Josh Durgin
# Copyright 2013 Red Hat, 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-... | |
# 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.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | |
from epynet import Network, epanet2
from nose.tools import assert_equal, assert_almost_equal
import pandas as pd
class TestGeneratedNetwork(object):
@classmethod
def setup_class(self):
self.network = Network()
@classmethod
def teadown(self):
self.network.ep.ENclose()
def test00_b... | |
import os
import pandas as pd
import pytest
import pickle
import numpy as np
import string
import dask
import dask.dataframe as dd
from dask.threaded import get as threaded_get
from dask.multiprocessing import get as mp_get
from dask.dataframe.shuffle import (shuffle,
partitioning_i... | |
from __future__ import absolute_import
import six
from datetime import datetime, timedelta
import pytest
from django.db.models import ProtectedError
from django.utils import timezone
from sentry import tagstore
from sentry.models import (
Group, GroupRedirect, GroupSnooze, GroupStatus, Release, get_group_with_r... | |
#!/usr/bin/env python3
# Copyright (c) 2009-2019 The Bitcoin Core developers
# Copyright (c) 2014-2019 The DigiByte Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test digibyted with different proxy configuratio... | |
"""Test UniFi config flow."""
import socket
from unittest.mock import patch
import aiounifi
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.unifi.config_flow import async_discover_unifi
from homeassistant.components.unifi.const import (
CONF_ALLOW_BANDWIDTH_SENSORS,... | |
#
# Secret Labs' Regular Expression Engine
#
# various symbols used by the regular expression engine.
# run this script to update the _sre include files!
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support modul... | |
#
# Created as part of the StratusLab project (http://stratuslab.eu),
# co-funded by the European Commission under the Grant Agreement
# INFSO-RI-261552."
#
# Copyright (c) 2011, SixSq Sarl
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | |
#!/usr/bin/env python
# Author: Willem Thiart <himself@willemthiart.com>
# Copyright: Willem Thiart 2014
import locale
import re
from docutils import nodes, writers
from docutils.core import publish_cmdline, default_description
import codecs
import collections
import subprocess
try:
locale.setlocale(locale.LC_ALL... | |
import re
from Vintageous import PluginLogger
from Vintageous.vi.utils import modes
from Vintageous.vi import cmd_base
from Vintageous.plugins import plugins
from Vintageous.vi import variables
_logger = PluginLogger(__name__)
class mapping_scopes:
"""
Scopes for mappings.
"""
DEFAULT = 0
... | |
from django.conf import settings
from eulxml import xmlmap
from eulxml.xmlmap import teimap
from lxml import etree
import os
'''
:class:`eulxml.xmlmap.XmlObject` subclasses for dealing with TEI,
particularly for the TEI facsimile used for positional OCR data for
readux pages and for generating annotated TEI for export... | |
#!/usr/bin/env jython
# SenSafety.MidTerm.CEPengine provides the Esper based complex event processing
# engine for the mid-term SenSafety demo.
# Main.py registers the query lists defined in this module.
# Query lists are returned by functions that accept configurable parameters.
# Marc de Lignie, Politie IV-organis... | |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | |
#!/usr/bin/env python
"""Class for finding Youtube influencers"""
__author__ = "Peter J Usherwood"
__python_version__ = "3.6"
import pandas as pd
import csv
import json
import os
from scipy.stats import percentileofscore
import progressbar
from usherwood_ds.data_imports.youtube_api.api_class import YoutubeAPI
from... | |
# Copyright 2015 Chelsio Communications 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... | |
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation, NearTestCase
setOutDir(__name__)
import unittest
from reportlab.pdfgen.canvas import Canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase import pdfutils
from repo... | |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test fee estimation code
#
from test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy... | |
from __future__ import print_function, division
from sympy.core import S, sympify, diff
from sympy.core.function import Function, ArgumentIndexError
from sympy.core.relational import Eq
from sympy.core.logic import fuzzy_not
from sympy.polys.polyerrors import PolynomialError
from sympy.functions.elementary.complexes i... | |
# -*- 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 npyscreen import BoxBasic, MultiLineEdit, FormBaseNew, MultiLine, notify_confirm
import curses
import weakref
class LogForm(FormBaseNew):
def create(self):
self.log = self.add(LogView, max_height=self.lines-15, name="Messages", scroll_exit=True)
self.optionBox = self.add(FixTextBox, name="Options", editable=... | |
# -*- coding: utf-8 -*-
# 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... | |
# 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... | |
from SimPEG.utils import ndgrid, mkvc, sdiag
import discretize
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
def casing_currents(j, mesh, model_parameters):
"""
Compute the current (A) within the casing
:param numpy.ndarray j: current density
:param discre... | |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 16 11:19:03 2015
@author: ibackus
"""
import warnings
import logging
import os
import glob
import fnmatch
import numpy as np
import pynbody as pb
SimArray = pb.array.SimArray
import logging
def configparser(fname,ftype='auto'):
"""
------------------------------... | |
""" @package antlr3.tree
@brief ANTLR3 runtime package, treewizard module
A utility module to create ASTs at runtime.
See <http://www.antlr.org/wiki/display/~admin/2007/07/02/Exploring+Concept+of+TreeWizard> for an overview. Note that the API of the Python implementation is slightly different.
"""
# begin[licence]
#... | |
## 1. Equal interval scales ##
car_speeds = [10,20,30,50,20]
earthquake_intensities = [2,7,4,5,8]
mean_car_speed = sum(car_speeds)/len(car_speeds)
mean_earthquake_intensities = sum(earthquake_intensities)/len(earthquake_intensities)
## 2. Discrete and continuous scales ##
day_numbers = [1,2,3,4,5,6,7]
snail_crawl_le... | |
from __future__ import division, print_function
import numpy as np
import numpy.ctypeslib as npc
from ctypes import cast, POINTER, Structure, c_int, c_float, c_double
c_float_p = POINTER(c_float)
c_double_p = POINTER(c_double)
from .vl_ctypes import LIB, c_to_np_types
from .utils import as_float_image
np_float = c_... | |
# 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... | |
import pandas as pd
# smart frame functions (to make dataframes themselves 'smart')
def is_smart_frame(df):
return hasattr(df, '__sf_is_smart_frame')
def make_df_smart(df, suffix):
try:
if is_smart_frame(df):
print('WHOA THIS DATAFRAME IS ALREADY SMART')
return df
except:
... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2020 EMBL - European Bioinformatics Institute
#
# 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... | |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | |
# Copyright 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... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import redis
import connection
from scrapy.http import Request
from scrapy.spider import Spider
from unittest import TestCase
from dupefilter import RFPDupeFilter
from queue import SpiderQueue, SpiderPriorityQueue, SpiderStack
from scheduler import Scheduler
... | |
# Copyright 2018 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... | |
# -*- coding: utf-8 -*-
"""
Document Library
"""
module = "doc"
#==============================================================================
resourcename = "document"
tablename = "doc_document"
table = db.define_table(tablename,
Field("name", length=128, notnull=True, unique=True, label... | |
# 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... | |
# Copyright 2019 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... | |
"""
Allow to create a user in a database.
Contain a model class for users and a manager for this model.
:copyright: (c) 2017 by Ol'ha Leskovs'ka
"""
from django.contrib.auth.base_user import BaseUserManager
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import PermissionsMixin
... | |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from contextlib import contextmanager
from unittest import skip
from corehq.apps.fixtures.models import FixtureDataType, FixtureTypeField... | |
# -*- coding: utf-8 -*-
"""
TraceView API library
:copyright: (c) 2016 by Daniel Riti.
:license: MIT, see LICENSE for more details.
"""
__title__ = 'traceview'
__version__ = '0.7.0'
__author__ = 'Daniel Riti'
__license__ = 'MIT'
from .annotation import Annotation
from .api import Api
from .app import App, Assign
... | |
# Copyright 2019 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
# --------------------------------------------------------------------------
# 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 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation t... | |
# -*- coding: utf-8 -*-
import healpy as hp
import numpy as np
from mocpy import MOC
from math import log
from .lvc_skymap import LVCskymap
import time
from .aladinSAMP import AladinScriptCommands
aladin = AladinScriptCommands()
class MOC_confidence_region(object):
"""Multi-Order coverage map (MOC) o... | |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... | |
# 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... | |
from enum import Enum
import string
from io import IOBase
from ..errors import *
#
# Constants
#
Node = None
class Node:
links = None
token_type = None
verify = None
def __init__(self, links:[(Node, "func"),] = None, token_type = None, verify = None):
links = links or []
self.links =... | |
from auth_helper import *
from bulk_service_manager_helper import *
from output_helper import *
# You must provide credentials in auth_helper.py.
def main(authorization_data):
try:
# The Bing Merchant Center Store Id cannot be retrieved via the Bulk service,
# so we'll use the Campaign Manageme... | |
import itertools
import os
import re
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.statemachine import ViewList
from sphinx import addnodes
from sphinx.directives import ObjectDescription, Directive
from sphinx.domains import Domain, ObjType
from sphinx.domains.python import PyOb... | |
#
#
# Copyright (C) 2012 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and ... | |
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2014, OVH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import logging
from saml2.mdstore import MetadataStore, name
from saml2 import BINDING_HTTP_REDIRECT, BINDING_SOAP, BINDING_HTTP_POST
from saml2.config import SPConfig, IdPConfig, Config
from py.test import raises
from saml2 import root_logger
from pathutils ... | |
"""
Serializers for Stone data types.
Currently, only JSON is officially supported, but there's an experimental
msgpack integration. If possible, serializers should be kept separate from the
RPC format.
This module should be dropped into a project that requires the use of Stone. In
the future, this could be imported ... | |
# Write the benchmarking functions here.
# See "Writing benchmarks" in the asv docs for more information.
# sequence based similarity measures
from py_stringmatching.similarity_measure.affine import Affine
from py_stringmatching.similarity_measure.bag_distance import BagDistance
from py_stringmatching.similarity_measu... | |
# 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... | |
#!/usr/bin/python3
#
# Average bandwidth monitoring script. Run periodically via NM db.sync to
# enforce a soft limit on daily bandwidth usage for each slice. If a
# slice is found to have transmitted 80% of its daily byte limit usage,
# its instantaneous rate will be capped at the bytes remaning in the limit
# over th... | |
###############################################################################
##
## Copyright 2011-2013 Tavendo 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:... | |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | |
# Block Breaker Game
# Chapter 9
import sys, time, random, math, pygame
from pygame.locals import *
from MyLibrary import *
levels = (
(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1,... | |
#!/usr/bin/python
'''
The MIT License (MIT)
Copyright (c) 2016 Charles Lin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, c... | |
# The StringAccessor class defined below is an adaptation of the
# pandas string methods source code (see pd.core.strings)
# For reference, here is a copy of the pandas copyright notice:
# (c) 2011-2012, Lambda Foundry, Inc. and PyData Development Team
# All rights reserved.
# Copyright (c) 2008-2011 AQR Capital Man... | |
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
# Copyright 2013 IBM Corp.
# Copyright 2013 eNovance <licensing@enovance.com>
# Copyright Ericsson AB 2013. All rights reserved
# Copyright 2014 Hewlett-Packard Company
# Copyright 2015 Huawei Technologies Co., Ltd.
#
# Licensed under the Apache License, Version 2.0... | |
"""CherryPy is a pythonic, object-oriented HTTP framework.
CherryPy consists of not one, but four separate API layers.
The APPLICATION LAYER is the simplest. CherryPy applications are written as
a tree of classes and methods, where each branch in the tree corresponds to
a branch in the URL path. Each method is a 'pa... | |
import inspect as _inspect
import sys as _sys
import unittest as _unittest
try:
import wrapt as _wrapt
except ImportError as e:
_wrapt = None
_wrapt_error = e
import bes.trace as _bes_trace
def skip_if_missing_wrapt(obj):
if _wrapt is None:
return _unittest.skip(str(_wrapt_error))(obj)
r... | |
import collections
import datetime
import re
import click
import pygal
import app.filter
import app.input
class Burndown():
def __init__(self, sprint, commitment, report, issues, customfield):
self.sprint = sprint
self.commitment = commitment
self.report = report
self.issues = ... | |
"""Sensor for checking the status of London air."""
from datetime import timedelta
import logging
import requests
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import HTTP_OK
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers... | |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for model evaluation.
Compare the results of some models with other programs.
"""
import pickle
import pytest
import numpy as np
from numpy.testing import utils
from .example_models import models_1D, models_2D
from .. import fitting, models
f... | |
from django.db.models.sql import compiler
from datetime import datetime
import re
from django.db.models.base import Model
REV_ODIR = {
'ASC': 'DESC',
'DESC': 'ASC'
}
SQL_SERVER_8_LIMIT_QUERY = \
"""SELECT *
FROM (
SELECT TOP %(limit)s *
FROM (
%(orig_sql)s
ORDER BY %(ord)s
) AS %(table)s
ORDER... | |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gym
import numpy as np
import pickle
import unittest
import ray
from ray.rllib.agents.ppo import PPOTrainer
from ray.rllib.policy.rnn_sequencing import chop_into_sequences, \
add_time_dimension
from... | |
#!/usr/bin/env python
r"""Training a sentiment analysis binary classifier on the IMDB dataset,
with or without pretrained GloVe word embeddings.
Downloading and extracting the various models and datasets involved is done
in parallel, along with running various make files and scripts.
"""
from __future_... | |
#!/usr/bin/env python
# Copyright 2016 DIANA-HEP
#
# 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... | |
"""
Wrap the internal caffe C++ module (_caffe.so) with a clean, Pythonic
interface.
"""
from collections import OrderedDict
try:
from itertools import izip_longest
except:
from itertools import zip_longest as izip_longest
import numpy as np
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \... | |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | |
import os
import yaml
import copy
import types
import ciw.dists
from .network import *
def get_distribution(dist):
"""
For use when parameters are read in from a .yml file.
Returns instances of the distribution classes that
correspond to the indicator string in the .yml file.
"""
if dist[0] == ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.