src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# @author: Quentin Gigon <gigon.quentin@gmail.com>
#
# The licence is in the file __manifest__.py
#
############################################... |
#!/usr/bin/env python3
#
# Copyright (c) 2014 Shubham Chaudhary <me@shubhamchaudhary.in>
#
# 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 License, or
# (at you... |
"""
Copyright (C) 2017 Open Source Robotics Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... |
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn import metrics
from sklearn import tree
import numpy as np
import os
import random
import timeit
import yaml
import load_data
import utilities
def main():
# Load data
X_train,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Time-stamp: <2013-04-04 16:18:40 vk>
from memacs.git import GitMemacs
PROG_VERSION_NUMBER = "0.1"
PROG_VERSION_DATE = "2011-12-20"
PROG_SHORT_DESCRIPTION = "Memacs for git files "
PROG_TAG = "git"
PROG_DESCRIPTION = """
This class will parse files from git rev-parse ou... |
#!/usr/bin/env python3
"""Advent of Code 2015, Day 7: Some Assembly Required"""
class Circuit:
"""A set of wires connected with bitwise logic gates"""
def __init__(self, instructions):
"""Parse instructions into a circuit layout
instructions should be the text from the puzzle input without
... |
#!/usr/bin/python3
"""Get Google Contacts
Usage: google_contacts.py [--noauth_local_webserver]
Options:
--noauth_local_webserver passed on to google auth
"""
import docopt
import httplib2
import subprocess
import unidecode
from apiclient import discovery
from argparse import Namespace
from oauth... |
"""Tests for the forms of the ``user_tags`` app."""
from django.test import TestCase
from django.contrib.contenttypes.models import ContentType
from django_libs.tests.factories import UserFactory
from user_tags.tests.test_app.forms import DummyModelForm
from user_tags.models import TaggedItem, UserTag, UserTagGroup
... |
import os
import datetime
class Filesystem(object):
"""Wrapper of filesystem access functionality such as that implemented by
the os package in the standard library.
"""
def __init__(self):
self.open = open
def fileExists(self, path):
return os.path.isfile(path)
def walk(s... |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2014 IBM Corp.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you... |
# Copyright 2013 Yahoo! Inc. All Rights Reserved
# Copyright 2013 OpenStack Foundation
# 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 m... |
# cython: auto_cpdef=True
"""Python code for writing AVRO files"""
# This code is a modified version of the code at
# http://svn.apache.org/viewvc/avro/trunk/lang/py/src/avro/ which is under
# Apache 2.0 license (http://www.apache.org/licenses/LICENSE-2.0)
import json
from io import BytesIO
from os import urandom, S... |
### This sample will show how programmatically create and post an annotation into document. How to delete the annotation
# Import of classes from libraries
from pyramid.renderers import render_to_response
from groupdocs.ApiClient import ApiClient
from groupdocs.AntApi import AntApi
from groupdocs.GroupDocsRequestSign... |
# -*- coding: utf-8 -*-
#----------------------------------------------------------
# OpenERP HTTP layer
#----------------------------------------------------------
import ast
import collections
import contextlib
import datetime
import functools
import hashlib
import hmac
import inspect
import logging
import mimetypes
... |
#!/usr/bin/env python
import sys, tempfile, os, shutil, imp
import unittest
import logging
import warnings
from xml.dom import minidom
from io import BytesIO
warnings.filterwarnings("ignore", message = 'The CObject type')
# Catch silly mistakes...
os.environ['HOME'] = '/home/idontexist'
os.environ['LANGUAGE'] = 'C'
s... |
'''
Created on Jun 18, 2012
@package ebf
@author mpaegert
@version \$Revision: 1.8 $
@date \$Date: 2013/08/07 15:22:06 $
create and write to sqlite databases
$Log: dbwriter.py,v $
Revision 1.8 2013/08/07 15:22:06 paegerm
add fetchall and orclause, addinf generic create_index function
Revision 1.7 2013/07... |
from redwind import hooks
from redwind.models import Post
from redwind.tasks import get_queue, async_app_context
from bs4 import BeautifulSoup
import re
import requests
import urllib
from flask import current_app, request, jsonify, Blueprint
from flask.ext.login import login_required
wm_sender = Blueprint('wm_sender'... |
"""
Django settings for learning_log project.
Generated by 'django-admin startproject' using Django 1.11.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
impo... |
# browsershots.org - Test your web design in different browsers
# Copyright (C) 2007 Johann C. Rocholl <johann@browsershots.org>
#
# Browsershots 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 ... |
"""
This module provides a user interface for changing configuration
variables.
Example usage:
import preferences
...
prefs = preferences.Preferences()
prefs.on_prefs_real(self.window, self.prefs_window_response, tab callbacks...)
"""
import gettext
import gtk
from consts import consts
from config import Config
fro... |
# -*- coding: utf-8 -*-
#
# STARLING PROJECT
# (based on HARPIA PROJECT)
#
# S2i - Intelligent Industrial Systems
# DAS - Automation and Systems Department
# UFSC - Federal University of Santa Catarina
# LIRIS - Laboratoire d'InfoRmatique en Image et Systèmes d'information
#
# Copyright: 2006 - 2007 Luis Carlos Dill ... |
# 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 ... |
import click
from tabulate import tabulate
from time import sleep
import webbrowser
import sys
from shutil import copyfile
import os
import floyd
from floyd.cli.utils import (
get_module_task_instance_id,
normalize_job_name,
get_namespace_from_name
)
from floyd.client.experiment import ExperimentClient
fro... |
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
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... |
# -*- coding: utf-8 -*-
"""The FileVault Drive Encryption (FVDE) path specification implementation."""
from dfvfs.lib import definitions
from dfvfs.path import factory
from dfvfs.path import path_spec
class FVDEPathSpec(path_spec.PathSpec):
"""Class that implements the FVDE path specification.
Attributes:
e... |
from common_fixtures import * # NOQA
from test_storage_nfs_driver import check_for_nfs_driver
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
if_certs_available = pytest.mark.skipif(
not os.path.isdir(SSLCERT_SUBDIR),
reason='ssl cert file directory not found')
dom_list = readDataFile(SS... |
"""
Name: parameters_in
Purpose: Importing cars using the parameters.txt file
Description:
Imports entire cars using the carinfo module.
"""
if "bpy" in locals():
import imp
imp.reload(common)
imp.reload(carinfo)
imp.reload(prm_in)
import os
import bpy
import bmesh
from mathutil... |
import logging
import time
import unittest
import threading
import apiritif
from apiritif import http, transaction, transaction_logged, smart_transaction
target = http.target('https://httpbin.org')
target.keep_alive(True)
target.auto_assert_ok(False)
target.use_cookies(True)
class TestRequests(unittest.TestCase):
... |
'''
recurrent tree networks
author: bcm
'''
from __future__ import absolute_import, print_function
from keras.layers import Recurrent, time_distributed_dense, LSTM
import keras.backend as K
from keras import activations, initializations, regularizers
from keras.engine import Layer, InputSpec
import ikelos.backend.th... |
"""
Display a list of ligand structures in file
"""
import os
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
from TreeParser import *
from NodeReference import *
IMAGE_DIR = "./Image"
def ReturnFileDir(ligandname):
return os.path.join(IMAGE_DIR, ligandname)
def IndexOfLigands():
infile... |
"""
Installs and configures neutron
"""
import logging
import os
import re
import uuid
from packstack.installer import utils
from packstack.installer import validators
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
# Controller object will be initialized from main flow
controlle... |
from django.db import models
from mptt.models import MPTTModel, TreeForeignKey
class Product(MPTTModel) :
name = models.CharField(
max_length=200,
default=None,
unique=True,
)
group = TreeForeignKey('self',
null=True,
blank=True,
related_name='subgroups',
default=None,
)
class MPTTMeta:
pare... |
#! /usr/bin/python
# Copyright 2004 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
db = {
"QPtrVector<FX::FXWindow>" : "QPtrVectorOfFXWindow"
, "QMemArray<unsigned char>" : "QMemArrayOfU... |
from typing import List, Tuple
def kruskal(num_nodes: int, num_edges: int, edges: List[Tuple[int, int, int]]) -> int:
"""
>>> kruskal(4, 3, [(0, 1, 3), (1, 2, 5), (2, 3, 1)])
[(2, 3, 1), (0, 1, 3), (1, 2, 5)]
>>> kruskal(4, 5, [(0, 1, 3), (1, 2, 5), (2, 3, 1), (0, 2, 1), (0, 3, 2)])
[(2, 3, 1), (... |
import logging
from rest_framework import decorators, permissions, status
from rest_framework.renderers import JSONRenderer
from rest_framework.response import Response
from readthedocs.builds.constants import LATEST
from readthedocs.builds.models import Version
from readthedocs.projects.models import Project, Projec... |
from django.conf import settings
from django.core import signals
from django.test.client import Client, WSGIRequest, close_connection, BaseHandler, curry, store_rendered_templates, got_request_exception, TemplateDoesNotExist, signals as test_signals
from django.utils.importlib import import_module
class TestHandler(B... |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Author: Federico Ceratto <federico.ceratto@hpe.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.o... |
from nltk import metrics
class LevenshteinReduce(object):
def __init__(self, phrase, tracks):
"""
:param phrase: (str) phrase or ngram
:param tracks: (list) tacks to perform best string matching with
:return: Returns the track from the list of tracks best matching the given phrase... |
# Copyright 2013 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/LICENSE-2... |
import os
import sys
import time
from multiprocessing import Process
from wikitools import wiki, category, page
import json
VCF_FILE = 'data/example.vcf'
OUTPUT_TEMPLATE = 'snpediaMap'
LOCAL_SNPEDIA = 'data/localsnpedia.json'
LOCAL_RSNUMS = 'data/localrsnums.txt'
NUM_OF_PROCESSES = 10
if(not os.path.isfi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from codecs import open
import sys
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import bild
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
requirements = [
'requ... |
# coding: utf8
import socket
import urllib2
import json
from plugin import Plugin
class Temperature(Plugin):
def __init__(self, config=None):
try:
self.wunderground = config.get('Temperature', 'wunderground')
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
print "Temperature w... |
class number() :
key = 0
bit_list = []
cnt = 0
def num_init(array) :
if array is None :
return;
num_array = []
for i in range(0, len(array)) :
cls_num = number()
tmp = array[i]
cnt = 1
while tmp > 10 :
bit_list = bit_list + [tmp % 10]
... |
import os
import re
import sys
import Tkinter, tkFileDialog
from zipfile import ZipFile, ZIP_DEFLATED
########
# Author: David <david@edeca.net>
# Date: 22nd February 2014
# URL: http://edeca.net
# Source: https://github.com/edeca/Electronics
#
# This script renames Proteus ARES output ZIP files so they are suita... |
# 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 ... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
# Copyright (c) 2012 dput authors
#
# 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 2 of the License... |
#! ../env/bin/python
# -*- coding: utf-8 -*-
__author__ = 'Darin Sikanic'
__email__ = 'dsikanic@brocade.com'
__version__ = '1.0'
from flask import Flask
from webassets.loaders import PythonLoader as PythonAssetsLoader
from www.controllers.main import main
from www import assets
from www.extensions import (
cach... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
The modelgen module provides classes for specifying designs for individual
subject analysis of task-based fMRI experiments. In particular it also includes
algorithms for generati... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This module is also sponsored by E.T.A.I. (www.etai.fr)
# 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... |
# Copyright (c) 2010-2013 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
from django.contrib import admin
from .models import Team, Mentor, Meetup, Coworking, Post, Event, Application, \
ImageMedia, About, OkthessMeetup, ResourceCategory, Resource, ApplyText, Partner, WeekendApplication
admin.site.register(Team)
admin.site.register(Mentor)
admin.site.register(Meetup)
admin.site.regist... |
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... |
"""
Scrapper thinking on produce an "API" fot the WebSVN portal.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from .exceptions import InvalidWebSVN
from .escrapper import _BaseScrapper
class WebSVN(_BaseScrapper):
""""WebSVN class, a way to produce an interface to WebSVN port... |
import unittest
from zen import *
class TestSynonymModularity(unittest.TestCase):
def test_small_graph_modularity(self):
graph=Graph()
graph.add_node('1')
graph.add_node('2')
graph.add_node('3')
graph.add_node('4')
graph.add_node('5')
graph.add_node('6')
graph.add_edge('1','2')
graph.add_edge('3'... |
from django.conf.urls import include, url
from django.views.generic.base import RedirectView
from . import views
from . import settings
from . import versioning
default_version = versioning.decimal_version_to_url_path(settings.REST_FRAMEWORK['DEFAULT_VERSION'])
# Please keep URLs alphabetized for auto-generated docu... |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # No logging TF
import tensorflow as tf
import numpy as np
import time
import sys
from mann import memory_augmented_neural_network
from Utils.mimic_gen import MimicGenerator
from Utils.Metrics import accuracy_instance2
from Utils import label_encoder as le
NUM_GPU=... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import pickle
import numpy as np
import scipy.signal
import matplotlib.pyplot as plt
import seaborn as sns
from antlia import filter as ff
from antlia import plot_braking as braking
from antlia import plot_steering as steering
from antlia import path
from antlia... |
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# 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, merge... |
from collections import MutableMapping, Container
from datetime import datetime, timedelta
from pyvalid import accepts
class LimitedTimeTable(MutableMapping, Container):
def __init__(self, time_span):
self.__storage = dict()
self.__time_span = None
self.time_span = time_span
@propert... |
from ...signals import _request_list_commands, _list_commands
from .. import BaseResponder
from ..lib import parse_command
class Meta(BaseResponder):
"""Displays basic info about this bot."""
ignore_help = False
ibip_repo = 'https://github.com/boreq/botnet'
def __init__(self, config):
super(... |
#
# Copyright 2001 - 2006 Ludek Smid [http://www.ospace.net/]
#
# This file is part of IGE - Outer Space.
#
# IGE - Outer Space 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 2 of the Lice... |
#! /usr/bin/env python
###############################################################################
# #
# Copyright (C) 2014-2015 Troels E. Linnet, SBiNLab, Copenhagen University #
# Copyright (C) 2014-2015 Kaare Teilum, SBiNLab, Copenha... |
import sys
import pandas as pd
#import numpy as np
from sklearn import svm
from sklearn.linear_model import LogisticRegression
from sklearn.cross_validation import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.grid_search import GridSearchCV
from sklearn import tree
from sklearn.ense... |
"""
session_view
~~~~~~~~~~~~
"""
import tkinter as tk
import tkinter.ttk as ttk
import open_cp.gui.tk.util as util
_text = {
"none" : "No recent sessions found",
"cancel" : "Cancel",
}
class SessionView(ttk.Frame):
def __init__(self, parent, controller, model):
super().__init__(parent)
... |
#! /usr/bin/env python
import re
import socket
import optparse
HTTP_PROXY_HOST = "dev1"
HTTP_PROXY_PORT = 8889
HTTP_PROXY_HOST = "localhost"
HTTP_PROXY_PORT = 9891
HTTP_PROXY_UNAME = "rps"
HTTP_PROXY_PASSWD = "secret"
class HTTPTunnelPorxy(object):
pattern = re.compile("^HTTP\/1\.\d ([0-9]{3}) .*")
def __... |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... |
from __future__ import absolute_import, division, print_function, unicode_literals
from echomesh.base import MakeEmptyProject
from echomesh.base import Platform
import getpass
import os
import os.path
import sys
# If ECHOMESH_EXTERNALS_OVERRIDE_SYSTEM_PACKAGES is True, you want Echomesh to
# use its own external pac... |
#-*-coding:utf-8-*-
import random
import time
import sys
import re
import restful
import init
import common
import mythread
class WrtGateway:
# class varaiable
s_hwid = ''
s_mwid = ''
s_first_time_add_dev = False
def __init__(self,mail):
self.hwid = ''
self.mwid = ''
self.mail = mail
def reg_hwid(self... |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid and World Bank
- **GUI Test Cases.**
Contact : ole.moller.nielsen@gmail.com
.. note:: 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 Fre... |
"""
utils for discovery cluster
"""
from distutils.version import StrictVersion
from django.utils.encoding import smart_text
import re
from telnetlib import Telnet
class WrongProtocolData(ValueError):
"""
Exception for raising when we get something unexpected
in telnet protocol
"""
def __init__(se... |
# -*- coding: utf-8 -*-
from flask import Blueprint, render_template, request, redirect, url_for, flash, abort
from comport.utils import flash_errors
from flask.ext.login import login_required
from .forms import NewDepartmentForm, NewInviteForm, EditUserForm, EditExtractorForm
from comport.department.models import Depa... |
import theano
import numpy as np
from sklearn.preprocessing import OneHotEncoder
from sklearn import cross_validation, metrics, datasets
from neupy import algorithms, layers, environment
environment.reproducible()
theano.config.floatX = 'float32'
mnist = datasets.fetch_mldata('MNIST original')
target_scaler = OneHo... |
#-*- coding: utf-8 -*-
"""
Tests for panedr
"""
from __future__ import print_function, division
import six
import os
import sys
import unittest
import pytest
import contextlib
import numpy
import pandas
import panedr
import re
# On python 2, cStringIO is a faster version of StringIO. It may not be
# available on im... |
#!/usr/bin/env python2
from fabtotum.loaders import gerber
from fabtotum.loaders.gerber.render import *
from fabtotum.toolpath import *
from fabtotum.gcode import *
import os,sys
import argparse
import json
import shapely.geometry as sg
from shapely import affinity
################################ DEBUG ##########... |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.views.generic.base import View
# TODO: don't import errors like this
from oauthlib.oauth2.draft25 import error... |
# Copyright (C) 2009-2010 Raul Jimenez
# Released under GNU LGPL 2.1
# See LICENSE.txt for more information
from nose.tools import ok_, eq_, assert_raises
from socket import inet_aton
import node
import logging, logging_conf
import test_const as tc
import bencode
import message as m
import message_tools as mt
logg... |
# -*- coding: utf-8 -*-
#
# csfrd documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 20 15:45:40 2014.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... |
# pylint: disable=len-as-condition
from os.path import basename, dirname, join
from shutil import copy
import numpy as np
from .. import os as xm_os
from ..imprt import preset_import
from ..log import get_logger
logger = get_logger()
class Obj:
"""Wavefront .obj Object.
Face, vertex, or other indices here... |
import logging
from homeassistant.helpers.entity import Entity
from .const import DOMAIN
from homeassistant.const import (
ATTR_BATTERY_LEVEL,
DEVICE_CLASS_TEMPERATURE,
TEMP_CELSIUS
)
_LOGGER = logging.getLogger(__name__)
PROTECT_SENSOR_TYPES = [
"co_status",
"smoke_status",
"battery_health... |
from mlxtend.evaluate import plot_learning_curves
from sklearn import datasets
from sklearn.cross_validation import train_test_split
from sklearn.tree import DecisionTreeClassifier
import numpy as np
def test_training_size():
iris = datasets.load_iris()
X = iris.data
y = iris.target
X_train, X_test,... |
# Copyright 2016 Tesora, 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 ... |
'''
Runs a distributable job on multiple processors. Returns the value of the job.
See SamplePi.py for examples.
'''
from fastlmm.util.runner import *
import os
import logging
try:
import dill as pickle
except:
logging.warning("Can't import dill, so won't be able to clusterize lambda expressions. If you try,... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [
migrations.CreateModel(
... |
from __future__ import absolute_import, division, print_function
from collections import Iterable, Iterator, defaultdict
from functools import wraps, partial
import itertools
import math
import os
import types
import uuid
from random import Random
from warnings import warn
from distutils.version import LooseVersion
f... |
# -*- 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... |
import random
import console.Combat
import DD.person
class battle(object):
class hit(object):
def __init__(self,value,attacker,attackee):
self.value = value
self.attacker = attacker
self.attackee = attackee
def __str__(self):
return "%s hit %s for %i"%... |
"""
Xunit for the nose_gevented_multiprocess plugin
The xunit plugin works by keeping ongoing stats on the test run as it
progresses, with hooks that are run before/after each test to update
the stats.
Unfortunately, when those hooks are called in subprocesses, it doesn't
work.
There's a nose_xunitmp plugin which cl... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 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 BIP66 changeover logic
#
from test_framework.test_framework import DankcoinTestFramework
fr... |
# Parsec Cloud (https://parsec.cloud) Copyright (c) AGPLv3 2016-2021 Scille SAS
import re
from unicodedata import normalize
from typing import Union, TypeVar, Type, NoReturn
from uuid import uuid4
from collections import namedtuple
from email.utils import parseaddr
from parsec.serde import fields
UserIDTypeVar = Ty... |
"""Detect structural variation in genomes using high-throughput sequencing data.
"""
import collections
import copy
import operator
import toolz as tz
from bcbio.pipeline import datadict as dd
from bcbio.structural import (battenberg, cn_mops, cnvkit, delly,
lumpy, manta, metasv, priorit... |
"""
Django settings for aninstance project.
"""
import os
# # # GENERAL
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'ewt7vvulgjq=hdn8(s15sqqzu&fa4+igtr57*-1-3#1$!h%tpz'
DOCKERIZED = True # Note: Remember to change to True for docker deployment!
DEBUG = False # Note: Remember ... |
import os
import stat
from datetime import datetime
from ._compat import _get_argv_encoding
from ._compat import filename_to_ui
from ._compat import get_filesystem_encoding
from ._compat import get_strerror
from ._compat import open_stream
from .exceptions import BadParameter
from .utils import LazyFile
from .utils im... |
import os
import settings
import subprocess
import shlex
from logger import Logger
'''Wrapper around rdiff-backup
This module provides facilites for centrally managing a large set of
rdiff-backup backup jobs. Backup job management is built around common tools
like cron, run-parts, and xargs. The base features incl... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import models
# Create your models here.
from user_management.models import Language, Location
DIRECTION_CHOICES = (
(0, "required to known"),
(1, "known to required"),
(2, "both"),
)
TYPE_CHOICES = (
(0, "visit authorities"),... |
import numpy as np
from collections import defaultdict
results = '/Users/tdmeeste/workspace/inferbeddings/logs/synth/synth_paper_iterative_aggregated.txt'
models_lst = ['DistMult', 'ComplEx']
clauses_lst = ['symm', 'impl', 'impl_inv', 'trans_single', 'trans_diff']
confs_lst = ['0.0']
versions_lst = ['v0', 'v1', 'v2'... |
import fenics
from cbc.common import create_dirichlet_conditions
class FunctionSpace_U():
"""
Discrete function space for the displacement U
"""
def __init__(self, mesh, element_type, element_degree, pbc=None):
if not pbc:
self.space = fenics.VectorFunctionSpace(mesh, element_type... |
"""
Public views
"""
from django.conf import settings
from django.shortcuts import redirect
from django.utils.http import urlquote_plus
from waffle.decorators import waffle_switch
from common.djangoapps.edxmako.shortcuts import render_to_response
from ..config import waffle
__all__ = ['register_redirect_to_lms', '... |
"""
An example SNOPTB problem.
"""
import numpy as np
from snopt import snoptb, SNOPT_options
def hexCon(mode,x,fCon,gCon,nState):
two = 2.0
fCon[ 0] = x[0]**2 + x[5]**2
fCon[ 1] = (x[1] - x[0])**2 + (x[6] - x[5])**2
fCon[ 2] = (x[2] - x[0])**2 + x[5]**2
fCon[ 3] = (x[0]... |
#The MIT License (MIT)
#
#Copyright (c) 2014 Robert Abela
#
#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... |
"""
Terminal size utility
---------------------
"""
from __future__ import division, print_function, absolute_import
import os
import platform
import warnings
from struct import Struct
def get_terminal_size(default=(80, 25)):
"""
Get width and height of console; works on linux, os x, windows and cygwin
A... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.