text stringlengths 12 6.59M |
|---|
# Built-in modules #
import os, sh
# First party modules #
from seqsearch.databases import Database
from plumbing.autopaths import DirectoryPath, AutoPaths
from plumbing.cache import property_cached
from fasta import FASTA
# Constants #
home = os.environ['HOME'] + '/'
################################################... |
# -*- coding: utf-8 -*-
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# Thomas Cokelaer <thomas.cokelaer@pasteur.fr>
# Dimitri Desvillechabrol <dimitri.desvillechabrol@pasteur.fr>,
# <d.desvillechabrol@gmail.com>
#
# Distributed un... |
#!/usr/bin/env python
#
# RUINBot 0.33 (Morrizv2)
# (C) 2012 Sam van Kampen
#
# Some of the main code copied from Kitn (as there is no Oyoyo documentation)
# That code (C) 2011 Amber Yust =)
#
# https://github.com/svkampen/RUINBot/wiki/About
#
from oyoyo.client import IRCClient, IRCApp
from oyoyo.cmdhandler import De... |
import collections
import hashlib
import pytest
from pip._internal.utils.urls import path_to_url
from tests.lib import (
PipTestEnvironment,
create_basic_sdist_for_package,
create_basic_wheel_for_package,
)
_FindLinks = collections.namedtuple(
"_FindLinks",
"index_html sdist_hash wheel_hash",
)
... |
import sys
import json
import socket
from cgi import parse_header
from collections import namedtuple
from http.cookies import SimpleCookie
from httptools import parse_url
from urllib.parse import parse_qs, urlunparse
try:
from ujson import loads as json_loads
except ImportError:
if sys.version_info[:2] == (3, ... |
#SPDX-License-Identifier: MIT
"""
Augur library script for generating a config file
"""
import os
import click
import json
ENVVAR_PREFIX = "AUGUR_"
default_config = {
"Database": {
"name": "augur",
"host": "localhost",
"key": "key",
"password": "augur",
... |
# -*- coding: utf-8 -*-
# © 2016 Roméo Guillot Roméo Guillot (http://www.opensource-elanz.fr).
# © 2016 Elico Corp (https://www.elico-corp.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from openerp.osv import fields, osv
from openerp.tools.safe_eval import safe_eval
from openerp.tools.trans... |
# Copyright 2016 Goekcen Eraslan
#
# 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 writi... |
import autonetkit.ank as ank
import itertools
import netaddr
import os
from collections import defaultdict
import string
from datetime import datetime
import autonetkit.log as log
import autonetkit.plugins.naming as naming
import autonetkit.config
settings = autonetkit.config.settings
from autonetkit.ank_utils import a... |
import os
import sys # noqa: F401
from datetime import date, datetime, timedelta # noqa: F401
import asyncio
import discord
from discord.ext import commands
from cogs.utils.dataIO import dataIO
from .utils import checks
class AutoRooms:
"""
auto spawn rooms
"""
__author__ = "mikeshardmind"
__ver... |
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
import copy
import json
import re
import logging
from collections import OrderedDict
from dateutil import rrule
# PyYAML
import yaml
# Django
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.model... |
from saml2.saml import AuthnContext, AuthnContextClassRef
from saml2.samlp import RequestedAuthnContext
__author__ = 'rolandh'
from saml2 import extension_elements_to_elements
UNSPECIFIED = "urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified"
INTERNETPROTOCOLPASSWORD = \
'urn:oasis:names:tc:SAML:2.0:ac:classes:... |
import base64
from urllib import quote, quote_plus
from datetime import datetime
from txaws.util import hmac_sha256, get_utf8_value
from txaws.client.base import BaseClient
from txaws.service import AWSServiceEndpoint
from txaws.sqs.connection import SQSConnection
from txaws.sqs.errors import RequestParamError
from tx... |
#!/usr/bin/env python
""" SGA-ICE
SGA Iteratively Correcting Errors
"""
__author__ = ["Juliana Roscito, Katrin Sameith, Michael Hiller"]
import os
import stat
import sys
import argparse
def __parse_arguments():
"""Read arguments from the command line.
Returns an argument object containing all input paramete... |
# 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 python3
"""
Created on 5 Dec 2016
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
DESCRIPTION
The particulates_sampler utility reads a set of values from the Alphasense optical particle counter (OPC). The reported
values are:
* per - the period of time between the previous reading and this... |
"""
The dataset class used in this package.
Datasets consists of data used for training, represented by a list of
(feature, label) tuples.
May be exported in different formats for application on other libraries.
"""
from __future__ import unicode_literals
import random
import numpy as np
import scipy.sparse as sp
fro... |
import logging
import dbus
import telepathy
import tp
import util.go_utils as gobject_utils
import util.misc as misc_utils
_moduleLogger = logging.getLogger(__name__)
class CallChannel(
tp.ChannelTypeStreamedMedia,
tp.ChannelInterfaceGroup,
tp.ChannelInterfaceCallState,
tp.ChannelInterfaceHold,
):
def ... |
# 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):
using_mysql = db.backend_name == 'mysql'
db.rename_table('easy_thumbnails_storagenew', 'easy_thumbnails_storage')
... |
#!/home/jneal/anaconda3/bin/python
"""Select optimal/non-optimal spectra in regards to specification.
Median and norm Combine spectra after
"""
from __future__ import division, print_function
import os
import sys
import logging
import argparse
import numpy as np
from tqdm import tqdm
from typing import Any
from astro... |
"""Support for Tellstick sensors."""
import logging
from collections import namedtuple
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import TEMP_CELSIUS, CONF_ID, CONF_NAME
from homeassistant.helpers.entity import Entity
import homeassistant.helpers.conf... |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2017 SML
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... |
from __future__ import unicode_literals
import copy
import logging
import sys
import warnings
from django.conf import compat_patch_logging_config, LazySettings
from django.core import mail
from django.test import TestCase, RequestFactory
from django.test.utils import override_settings
from django.utils.encoding impor... |
import logging
import re
import json
import webapp2
from gap.utils.decorators import as_view
def slugify(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1-\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1-\2', s1).lower()
class BaseResourceHandler(webapp2.RequestHandler):
resource_class = None
def _key... |
# Lint as: python3
# Copyright 2019 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 agr... |
"""
The dataset class used in this package.
Datasets consists of data used for training, represented by a list of
(feature, label) tuples.
May be exported in different formats for application on other libraries.
"""
import random
import numpy as np
class Dataset(object):
def __init__(self, X=[], y=[]):
... |
"""
ZWave Thermostat.
"""
# Because we do not compile openzwave on CI
# pylint: disable=import-error
from homeassistant.components.thermostat import DOMAIN
from homeassistant.components.thermostat import ThermostatDevice
from homeassistant.components.zwave import (
ATTR_NODE_ID, ATTR_VALUE_ID, NETWORK,
ZWaveD... |
"""
Portions of this file are copied from the Django project. Relevant portions are
Copyright (c) Django Software Foundation and individual contributors.
Licensed under BSD license, see full license for details:
https://github.com/django/django/blob/4696078832f486ba63f0783a0795294b3d80d862/LICENSE
"""
from uber.common... |
__version__ = '1.0'
|
# -*- coding: utf-8 -*-
# (c) 2013-2016 Andreas Motl, Elmyra UG
import logging
from StringIO import StringIO
from zipfile import ZipFile, ZIP_DEFLATED
from pyramid.httpexceptions import HTTPError
from elmyra.ip.access.uspto.image import get_images_view_url
from elmyra.ip.util.numbers.common import decode_patent_number
... |
# Copyright 2020 The TensorFlow Probability 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... |
""" Test using enterprise marathon on marathon (MoM-EE). The individual steps
to install MoM-EE are well documented here:
https://wiki.mesosphere.com/display/DCOS/MoM+1.4
"""
import os
from common import *
from shakedown import *
from dcos import http
from urllib.parse import urljoin
MOM_EE_NAME = 'marathon-... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011 - 2012 -- Lars Heuer <heuer[at]semagia.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain th... |
import numpy as np
from candidate_selection.models.lazy_indexer import LazyIndexer
class HypergraphBatchPreprocessor:
entity_indexer = None
relation_indexer = None
in_batch_indices = None
in_batch_labels = None
graph_counter = None
def __init__(self):
self.entity_indexer = LazyInde... |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), ... |
#!/usr/bin/env python
"""
twitter-repeater is a bot that automatically retweets any tweets in which its name
is "mentioned" in. In order for a tweet to be retweeted, the bot account must be
following the original user who tweeted it, that user must not be on the ignore
list, and the tweet must pass some basic quality ... |
import requests
import os
os.system("ifconfig wlan0 | grep inet > myIp.txt")
os.system("iwconfig wlan0 | grep ESSID > myESSID.txt")
ipAddr = ""
givenESSID=""
with open("myIp.txt") as IPText:
for line in IPText:
if "inet" in line:
print line
lineDic = line.split(" ")
for word in lineDic:
print word
... |
import datetime
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core import mail
from django.core.urlresolvers import reverse
from django.test import TestCase
from registration.forms import RegistrationForm
from registration.models ... |
import unittest
import attr
from seashore import executor
@attr.s
class DummyShell(object):
_env = attr.ib(default=attr.Factory(dict))
def clone(self):
return attr.assoc(self, _env=dict(self._env))
def setenv(self, key, value):
self._env[key] = value
def batch(self, *args, **kwarg... |
from random import choice
import string
import uuid
from db_op import DB_op
class DBO_random_data_generation(DB_op):
def __init__(self, lim_n=128, lim_r=256, prob_link_create=0.3):
"""
generate random DB data
@return: tuple consisting of the random node,link labels generated
... |
# -*- coding: utf-8 -*-
import asyncio
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
# profiling
from pympler import tracker
import sys
import os
import ast
import time
import re
import traceback
import logging
from random import SystemRandom
random = SystemRandom()
import discord
import ext... |
import datetime
import pytz
from juliabox.cloud import Compute
from juliabox.jbox_tasks import JBoxAsyncJob
from juliabox.jbox_util import JBoxCfg
from juliabox.jbox_container import BaseContainer
from juliabox.vol import VolMgr, JBoxVol
import docker.utils
from docker.utils import Ulimit
import time
class SessConta... |
# -*- coding: utf-8 -*-
import asyncio
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
# profiling
from pympler import tracker
import sys
import time
import re
import traceback
import logging
from random import SystemRandom
random = SystemRandom()
import discord
import josecommon as jcommon
im... |
# -*- coding: utf-8 -*-
import asyncio
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
# profiling
from pympler import tracker
import time
import re
import traceback
import logging
from random import SystemRandom
random = SystemRandom()
import discord
import josecommon as jcommon
import ext.jo... |
import binascii
import json
import six
from collections import Mapping
from jose.jwk import get_algorithm_object
from jose.constants import ALGORITHMS
from jose.exceptions import JWSError
from jose.exceptions import JWSSignatureError
from jose.utils import base64url_encode
from jose.utils import base64url_decode
d... |
##########################################################################
#
# Copyright (c) 2009, Image Engine Design 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:
#
# * Redistribu... |
from os import makedirs
from os.path import isfile, isdir, getmtime, dirname, splitext, getsize
from PIL import Image, ImageFilter
from methods import autocrop, resize_and_crop
def byteprefix(b):
"""
Given an integer as number of bytes it returns a tuple of
(bytes, kilobytes, megabytes).
"""
mb = r... |
# Copyright 2012 the rootpy developers
# distributed under the terms of the GNU General Public License
from __future__ import absolute_import
import os
import re
import shutil
from glob import glob
import ROOT
from . import log; log = log[__name__]
from ...memory.keepalive import keepalive
from ...utils.silence impo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# Copyright 2017 ROBOTIS CO., LTD.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... |
import webapp2
import json
import logging
import musicdb.model
from apptools.data_handler import DataHandler
from google.appengine.api import users
from musicdb.music_data_handler import VenueHandler
from musicdb.music_data_handler import ArtistHandler
from musicdb import tools
logger = logging.getLogger("resource")
... |
"""
Copyright 2016 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/LICENSE-2.0
Unless required by applicable law or agreed... |
# 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 ... |
# 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 is a very quick and dirty code for David so he can work on its
# sikuli agent and report as nsca the results.
#
# This need to be clean a lot, it's still a server and should be a
# client class :) I can do it after my "new baby holidays" are
# finished ;)
#
# J. Gabes
import time
import select
import socket
imp... |
import openpnm as op
import scipy as sp
import openpnm.models.geometry.throat_seed as mods
class ThroatSeedTest:
def setup_class(self):
self.net = op.network.Cubic(shape=[5, 5, 5])
self.geo = op.geometry.GenericGeometry(network=self.net,
pores=self.ne... |
#!/usr/bin/env python3
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
import argparse
import sys
def transform(discard_stdstreams: bool,
cmdlist_path: str,
makefile_path: str) -> None:
... |
import subprocess, os, ssl, hashlib, socket, time
from pyasn1.type import univ, constraint, char, namedtype, tag
from pyasn1.codec.der.decoder import decode
import OpenSSL
import utils
CERT_SLEEP_TIME = 1
CERT_EXPIRY = str(365 * 3)
def create_ca():
key = OpenSSL.crypto.PKey()
key.generate_key(OpenSSL.crypto.... |
#!/usr/bin/env python
# Copyright 2009 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... |
"""
The stacks.common module. This module contains the common Stages required for
all other Stacks.
"""
import contextlib
import os
from libpb import env, event, job, mk, pkg
from libpb.stacks import base, mutators
__all__ = ["Config", "Depend"]
class Lock(object):
"""A simple Uniprocessor lock."""
def _... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from sublime import active_window
from os import path
from json import loads
from glob import glob
from threading import Th... |
from __pyjamas__ import JS
class HTTPRequest:
# also callable as: asyncPost(self, url, postData, handler)
def asyncPost(self, user, pwd, url, postData=None, handler=None):
if postData == None:
return self.asyncPostImpl(None, None, user, pwd, url)
return self.asyncPostImpl(user, pwd,... |
from pprint import pprint
from pyquery import PyQuery as pq
import json
import datetime
import collections
import sys
# Where to write to.
OUTFILE = "resto/1.0/menu/{}/{}.json"
# Languages
TYPES = ['nl', 'en', 'nl-sintjansvest']
# The url containing the list of weekmenu's.
WEEKMENU_URL = {
"nl": "http://www.uge... |
from __future__ import absolute_import
import os, signal, subprocess, sys
import re
import platform
import tempfile
import lit.ShUtil as ShUtil
import lit.Test as Test
import lit.util
from lit.util import to_bytes, to_string
class InternalShellError(Exception):
def __init__(self, command, message):
self.c... |
from __future__ import absolute_import
import difflib
import errno
import functools
import io
import itertools
import getopt
import os, signal, subprocess, sys
import re
import stat
import platform
import shutil
import tempfile
import threading
try:
from StringIO import StringIO
except ImportError:
from io imp... |
import os
import sys
sys.path.append('..')
import subprocess
import ovf2vtk
# set version variqble
version = ovf2vtk.__version__.__version__
from ovf2vtk import winovf2vtk as win
"""all the tests developed for the winovf2vtk.py script for ovf2vtk stored in
one place. By Harry Wilson. Last updated 15/04/16"""
# ... |
from __future__ import absolute_import
from __future__ import unicode_literals
import errno
import fcntl
import os
import time
from subprocess import PIPE
from subprocess import Popen
import service_configuration_lib
from behave import given
from behave import then
from kazoo.exceptions import NodeExistsError
from p... |
import logging
import logging.config
from django.core.management.base import NoArgsCommand
from django.utils import timezone
from package.models import Package
logger = logging.getLogger(__name__)
class Command(NoArgsCommand):
help = "Updates all the packages in the system focusing on repo data"
def hand... |
"""
MMRadar.py
"""
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, LineAsset
from ggame import ImageAsset, PolygonAsset, Frame, Sound, SoundAsset, TextAsset
import time
import random
import math
SCREEN_WINDOWX = 1000
SCREEN_WINDOWY = 1000
# colors
red = Color(0xff0000, 1.0... |
"""
MMRadar.py
"""
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, LineAsset
from ggame import ImageAsset, PolygonAsset, Frame, Sound, SoundAsset, TextAsset
import time
import random
import math
'''
weather = int(input("Any weather? (1 for custom, 0 for none)"))
if weather =... |
class Register(object):
def __init__(self, name, bitwidth):
self.name = name
self.value = 0
self.past = [0] # maybe for rewind?
self.symbVal = [z3.BitVec(self.name, bitwidth)] # maybe for
# symbolic
... |
import sip
sip.setapi('QVariant', 2)
import sys, os
from blocks.WorkspaceController import WorkspaceController
from generators.PythonGen import PythonGen
from PyQt4 import QtGui,QtCore, uic
from PyQt4.QtCore import Qt
from PyQt4.QtGui import QDockWidget
class MainWnd(QtGui.QMainWindow):
instance = None
de... |
#!/usr/bin/env python
from __future__ import with_statement
import os, sys
import ntr
p0=os.path.dirname(sys.argv[0])
p1=os.path.abspath(os.path.join(p0, "..", "dom", "automation"))
sys.path.append(p1)
import detect_assertions, detect_malloc_errors, detect_interesting_crashes
# Levels of unhappiness.
# These are ... |
import urllib
import tornado.httpserver
import tornado.ioloop
import tornado.web
import os
import certifi
import json
import peewee
import tornado
import psycopg2
from models import *
import subprocess
"""Handles User Login Requests"""
class BaseHandler(tornado.web.RequestHandler):
def get_current_user(self):
... |
try:
from json_field.fields import JSONField
except ImportError:
pass # fails when imported by setup.py, no worries
__version__ = '0.4.1'
|
"""
An implementation of JSON Schema for Python
The main functionality is provided by the validator classes for each of the
supported JSON Schema versions.
Most commonly, :func:`validate` is the quickest way to simply validate a given
instance under a schema, and will create a validator for you.
"""
from jsonschema... |
from django.conf.urls import url
from django.contrib import admin
from django.core.exceptions import PermissionDenied
from django.db import connection, transaction
from django.db.models import Q, TextField
from django.forms import ModelForm, ModelMultipleChoiceField
from django.http import Http404, HttpResponseRedirect... |
"""Support for ASUSWRT routers."""
from __future__ import annotations
from homeassistant.components.device_tracker import SOURCE_TYPE_ROUTER
from homeassistant.components.device_tracker.config_entry import ScannerEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import callback
from h... |
# pylint:disable=no-member
from ...protos import cfg_pb2
from ...serializable import Serializable
class MemoryDataSort:
Unspecified = None
Unknown = "unknown"
Integer = "integer"
PointerArray = "pointer-array"
String = "string"
UnicodeString = "unicode"
SegmentBoundary = "segment-boundary"... |
from __future__ import print_function, division, absolute_import #, unicode_literals # not casa compatible
from builtins import bytes, dict, object, range, map, input#, str # not casa compatible
from future.utils import itervalues, viewitems, iteritems, listvalues, listitems
from io import open
import distributed
from... |
'''
The MIT License (MIT)
Copyright (c) 2013-2014 Robert H Chase
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,... |
# coding: utf-8
"""JupyterLab command handler"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import contextlib
from distutils.version import LooseVersion
import errno
from glob import glob
import hashlib
import itertools
import json
import logging
import os
impo... |
#!/usr/bin/env python
# Thanks a lot to nemo_ on irc.gnome.org for help on this and Kuleshov Alexander for undostack!
import pygtk, gtk, os, re, sys, gobject, imp, pango, enchant, undostack
pygtk.require('2.0')
if not os.path.exists(os.path.join(os.path.expanduser('~'), '.smartte', 'Default.conf')):
os.makedirs(os... |
# coding: utf-8
"""JupyterLab command handler"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import contextlib
from distutils.version import LooseVersion
import errno
import glob
import hashlib
import json
import logging
import os
import os.path as osp
import re... |
import unittest
import ConvexHull
from PointUtils import *
from Geometry import Point as P, Line
from pyhull.convex_hull import ConvexHull as pyConvexHull
#Test convex hull results against pyhull's ConvexHull
class ConvexHullTest(unittest.TestCase):
def test_oneLine(self):
pointA = getRandomPoint()
poi... |
#!/usr/bin/env python
# Setup script for the PyGreSQL version 3
# created 2000/04 Mark Alexander <mwa@gate.net>
# tweaked 2000/05 Jeremy Hylton <jeremy@cnri.reston.va.us>
# win32 support 2001/01 Gerhard Haering <gerhard@bigfoot.de>
# requires distutils; standard in Python 1.6, otherwise download from
# http://www.pyt... |
import json
import sys
try:
from collections import MutableMapping
except ImportError:
from collections.abc import MutableMapping
PY3 = sys.version_info[0] >= 3
if PY3:
from urllib import parse as urlparse
from urllib.parse import unquote
from urllib.request import urlopen
unicode = str
else:... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2010 Prof. William H. Green (whgreen@mit.edu) and the
# RMG Team (rmg_dev@mit.edu)
#
# Permission is hereby granted, free of c... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Mayo Clinic
# 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
# ... |
import time
import logging
import numpy as np
from collections import deque
try:
import theano
import theano.tensor as T
import lasagne
from sgmcmc.theano_mcmc import SGLDSampler, SGHMCSampler
from sgmcmc.utils import floatX
from sgmcmc.bnn.priors import WeightPrior, LogVariancePrior
from ... |
__version__ = "3.1.0"
|
def n_connected_subgraphs(nodes, edges):
"""
Given a set of nodes and undirected edges, assigns each node
to a subgraph and returns the number of connected subgraphs
which are not connected to each other
Arguments: int nodes, (int,int)[] edges
Returns: int
"""
assignments = {}
... |
"""
===========================================
Ledoit-Wolf vs Covariance simple estimation
===========================================
The usual covariance maximum likelihood estimator can be regularized
in order to reduce its variance. This, in turn, introduces some bias.
This example illustrates a regularization me... |
#!/usr/bin/env python
"""
Modal analysis of a linear elastic block in 2D or 3D.
The dimension of the problem is determined by the length of the vector
in ``--dims`` option.
The default material properties correspond to aluminium in the following units:
- length: m
- mass: kg
- stiffness / stress: Pa
- density: kg / ... |
"""
===================================================================
Multi-output Decision Tree Regression
===================================================================
An example to illustrate multi-output regression with decision tree.
The :ref:`decision trees <tree>`
is used to predict simultaneously the ... |
#============================================================================
#
# Copyright (c) Kitware 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... |
from decimal import Decimal
from django.http import JsonResponse
from django.shortcuts import render
from cashtag.models import CashTag
from users.models import CashTagUser
from visa_api.util import pull, push
def test_push_pull_view(request):
# from_username = request.GET.get('from_username')
cashtag_id = r... |
from collections import OrderedDict
from django.db.models import Sum
from .forms import MatchForm, FinalMatchForm
from .models import Entry, Score
BYE = 'BYE'
class BaseCategory(object):
max_entries = 48
first_round_groups = 8
second_round_groups = 4
third_round_groups = 2
second_round_layout ... |
from common import modelzoo
import mxnet as mx
import os
import logging
import math
import argparse
def train_imagenet(args):
# arguments to change
num_epoch = args.num_epoch
batch_size = args.batch_size
lr = args.lr
lr_steps = [int(i) for i in args.lr_steps.split(',')]
lr_factor = args.lr_fac... |
import os
import glob
import shutil
from django.conf import settings
from django.contrib.gis.db import models
from django.core.cache import cache
from django.template.defaultfilters import slugify
from django.utils.html import escape
from django.db.models.signals import post_delete
from django.dispatch.dispatcher impor... |
import os
import sys
import glob
import h5py
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib as mpl
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker, contains_eager
from bokeh.layouts import row, widgetbox
from bokeh.plotting import curdoc, fig... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.