src stringlengths 721 1.04M |
|---|
#!/usr/bin/python
"""
@file async_tcp_client.py
@author Woong Gyu La a.k.a Chris. <juhgiyo@gmail.com>
<http://github.com/juhgiyo/pyserver>
@date March 10, 2016
@brief AsyncTcpClient Interface
@version 0.1
@section LICENSE
The MIT License (MIT)
Copyright (c) 2016 Woong Gyu La <juhgiyo@gmail.com>
Permission i... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
np.random.seed(2 ** 10)
# Prevent reaching to maximum recursion depth in `theano.tensor.grad`
# import sys
# sys.setrecursionlimit(2 ** 20)
from six.moves import range
from keras.datasets ... |
import sys
import re
TYPE_BATTLEFIELD = "Battlefield"
def print_usage():
print("""
Star Wars: Destiny trade list builder
Usage:
$>python destiny.py <target-file>
where <target-file> is the text-file to process.
This file should be generated by logging into swdestiny.com, going to 'My coll... |
"""
===================
Label image regions
===================
This example shows how to segment an image with image labelling. The following
steps are applied:
1. Thresholding with automatic Otsu method
2. Close small holes with binary closing
3. Remove artifacts touching image border
4. Measure image regions to fi... |
# Lint as: python3
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
"""The Rayleigh distribution."""
from equadratures.distributions.template import Distribution
import numpy as np
from scipy.stats import rayleigh
RECURRENCE_PDF_SAMPLES = 8000
class Rayleigh(Distribution):
"""
The class defines a Rayleigh object. It is the child of Distribution.
:param double scale:
Scal... |
#!/usr/bin/python
#######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
####################################... |
#!/usr/bin/env python3
from auto.config import ARM, GOPTS, RV32, SBT, TOOLS, X86
from auto.utils import cat, path, unique
class ArchAndMode:
def __init__(self, farch, narch, mode=None):
self.farch = farch
self.narch = narch
self.mode = mode
# get arch prefix string
def prefix(self... |
"""Run this with twistd -y."""
import os
from twisted.application import service, internet
from twisted.web.woven import page
from twisted.web import server, static
rootDirectory = os.path.expanduser("~/Pictures")
class DirectoryListing(page.Page):
templateFile = "directory-listing.html"
templateDirectory ... |
# -*- coding: utf-8 -*-
from gettext import gettext as _
NAME = _('Ecuador')
STATES = [
(_('Pichincha'), 254, 335, 210, 0),
(_('Guayas'), 253, 138, 472, 0),
(_('Azuay'), 252, 242, 622, 0),
(_('Manabí'), 251, 122, 316, 0),
(_('Esmeraldas'), 250, 234, 117, 0),
(_('El Oro'), 249, 158, 693, 0),
... |
#!/user/bin/python
from Tkinter import *
import tkMessageBox
from tkFileDialog import askopenfilename, asksaveasfilename
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from pdfminer.pdfpage import PDFPage
from cSt... |
import os
import subprocess
import pytest
from flexmock import flexmock
from devassistant import actions, exceptions
from devassistant.dapi import dapicli
from test.logger import LoggingHandler
class TestActions(object):
def setup_class(self):
self.ha = actions.HelpAction
def test_get_help_contain... |
# Copyright 2014 IBM Corp.
#
# 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 ... |
"""Tests for certbot.errors."""
import unittest
import mock
from acme import messages
from certbot import achallenges
from certbot.tests import acme_util
class FailedChallengesTest(unittest.TestCase):
"""Tests for certbot.errors.FailedChallenges."""
def setUp(self):
from certbot.errors import Fail... |
#!/usr/bin/env python
from mininet.topo import Topo
from mininet import net
from mininet.net import Mininet
POD_NUM = 4
class FatTreeTopoHardCode(Topo):
"""
A Simple FatTree Topo
"""
def __init__(self):
# Initialize topology
Topo.__init__(self)
# Create pod and core
#... |
# DEPRECATED - this file is dead, and should be removed by the end of the redesign project
from portality.formcontext.formhelper import FormHelperBS3
from portality.formcontext.choices import Choices
from copy import deepcopy
class Renderer(object):
def __init__(self):
self.FIELD_GROUPS = {}
self.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of rss_keyword_parser, a simple term extractor from rss feeds.
# Copyright © 2015 seamus tuohy, <stuohy@internews.org>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as p... |
# This file is part of eventmq.
#
# eventmq is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# eventmq is distributed in the ... |
class LetterIndexBimap:
def __init__(self):
self.char2index_dict = dict()
self.index2char_dict = dict()
for i in range(0, 25):
self.char2index_dict[chr(ord('a') + i)] = i
self.index2char_dict[i] = chr(ord('a') + i)
def char2index(self, ch):
return self.ch... |
# (C) British Crown Copyright 2014 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... |
#07_05_kitchen_sink.py
from tkinter import *
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()
Label(frame, text='Label').grid(row=0, column=0)
Entry(frame, text='Entry').grid(row=0, column=1)
Button(frame, text='Button').grid(row=0, column=2)
... |
import logging
from types import SimpleNamespace
from fontTools.misc.loggingTools import Timer
from ufo2ft.util import _GlyphSet, _LazyFontName
logger = logging.getLogger(__name__)
class BaseFilter:
# tuple of strings listing the names of required positional arguments
# which will be set as attributes of ... |
# coding=utf-8
# Copyright 2019 The Interval Bound Propagation 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 ... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Boostrap3AlertPlugin.icon'
db.add_column(u'aldryn_bootstr... |
"""Support to serve the Home Assistant API as WSGI application."""
from contextvars import ContextVar
from ipaddress import ip_network
import logging
import os
import ssl
from typing import Dict, Optional, cast
from aiohttp import web
from aiohttp.web_exceptions import HTTPMovedPermanently
import voluptuous as vol
fr... |
#!/usr/bin/env python
import os
from stat import *
def parent(path):
"""Return the parent of the specified directory"""
# Remove the trailing slash, if any
if path.endswith('/'):
return os.path.dirname(path[:-1])
else:
return os.path.dirname(path)
def create_and_set_permissions(di... |
# (C) British Crown Copyright 2010 - 2014, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... |
from .records import Record
from ..misc import utils
from .. import images
from ... import consts
import collections
def profile(acct, *, minimal=True, public=False):
''' Get the profile info for `acct` and return a `dict`
if minimal is truthy, skip processing country, website etc. '''
i... |
# coding: utf8
#
# Copyright (c) 2020, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and op... |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
from Util import Util
import Config
import struct
import json
import base64
import BCache
import User
import BRead
import BoardManager
import UserManager
import PostEntry
from Error import *
from Log import Log
from cstruct import CStruct
import fcntl
import time
im... |
#-
# Copyright (c) 2013 Michael Roe
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed to BER... |
import functools
import threading
from . import settings as media_settings
from .settings import (GLOBAL_MEDIA_DIRS, PRODUCTION_MEDIA_URL,
IGNORE_APP_MEDIA_DIRS, MEDIA_GENERATORS, DEV_MEDIA_URL,
GENERATED_MEDIA_NAMES_MODULE)
from django.conf import settings
from django.core.exceptions import ImproperlyConfigure... |
import numpy as np
import pandas as pd
def datetime64_to_microseconds(dt):
return dt.astype('uint64')
def travel_time(start_time, path, measurements_by_station, station_metadata, time_granularity=60*60):
"""Calculate the travel time along the given path at the given start time
Args:
path - list of station ... |
import types
class VectorList(list):
def get_vectors_by_interpreters(self, shells):
vect=[]
for v in self:
if v.interpreter in shells:
vect.append(v)
return vect
def get_vector_by_name(self, name):
for v in self:
if ... |
# -*- coding: UTF-8 -*-
# Copyright 2009-2019 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from lino.utils.instantiator import Instantiator
from lino_xl.lib.products.choicelists import ProductTypes
from lino.api import dd, _
def objects():
productcat = Instantia... |
#!/usr/bin/env python3
"""
This is a script to convert GenBank flat files to GFF3 format with a specific focus on
initially maintaining as much structural annotation as possible, then expanding into
functional annotation support.
This is not guaranteed to convert all features, but warnings will be printed wherever po... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 1 11:30:49 2012
@author: eba
"""
from numpy import *
from scipy import *
from matplotlib.pyplot import *
from MHFPython import *
from plotGaussians import *
def rotate(x,y,rot):
return [x*rot[0,0]+y*rot[0,1],x*rot[1,0]+y*rot[1,1]]
theta = arange(-pi,pi,0.01)
r... |
import csv
import datetime
import json
import logging
import urlparse
from io import BytesIO
from django.conf import settings
from django.core.exceptions import ValidationError as DjangoValidationError
from django.core.urlresolvers import reverse
from django.core.validators import validate_ipv4_address, validate_ipv46... |
import sys
from django.conf import settings
from django.core.exceptions import MiddlewareNotUsed
from django.core.signals import got_request_exception
from django.http import HttpResponse
from django.template import engines
from django.template.response import TemplateResponse
from django.test import RequestFa... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import io
import os
import unittest
from lxml import etree
from xmlunittest import XmlTestCase
DEFAULT_NS = 'https://www.w3.org/XML'
TEST_NS = 'https://docs.python.org/3.4/library/unittest.html'
class TestXmlTestCase(unittest.TestCase):
"""Test ... |
#! /usr/bin/env python
'''
Translates a set of JGI project IDs to their portal organism name. The
input is via python fileinput
(https://docs.python.org/2/library/fileinput.html).
@author: gaprice@lbl.gov
'''
from __future__ import print_function
import fileinput
import urllib2
import sys
# JGI_URL = 'http://genome.j... |
import httplib
from flask.ext.restful_swagger import swagger
from flask import request, make_response, session
from flask.ext.restful import Resource
from jsonpickle import encode
from Borg import Borg
from CairisHTTPError import MissingParameterHTTPError, MalformedJSONHTTPError
from tools.ModelDefinitions import Use... |
"""
:created: 17.09.2018 by Jens Diemer
:copyleft: 2018 by the django-cms-tools team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
from cms.models import Page
def get_public_cms_app_namespaces():
"""
:return: a tuple() with all cms app namespaces
... |
from gmapsbounds import utils
from gmapsbounds import constants
from gmapsbounds import llpx
from gmapsbounds import polygon
def get_nodes(rgb_image):
nodes = []
width, height = rgb_image.size
do_not_check = set()
menu_borders = utils.get_menu_borders(rgb_image)
for x in range(width):
for y... |
# -*- coding: utf-8 -*-
from django.utils.decorators import method_decorator
from django.contrib.admin.views.decorators import staff_member_required
from django.views.generic import TemplateView
from django.views.generic.edit import CreateView
try:
from django.urls import reverse, reverse_lazy
except ImportError:
... |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2013,2014,2016 Contributor
#
# 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... |
# Copyright (c) 2015 Presslabs SRL
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
import itertools
MAJORITY = 32 # out of 63
RESULTS = {'A': 4, 'C': 7, 'B': 8, 'D': 21, 'P': 10, 'S': 3, 'V': 10}
ALL = "".join(sorted(RESULTS.keys()))
def normalize(t):
"""
Get a sorted list of party letters for inserting into set/hash.
:param t: set of letters
:return: string with sorted letters
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017, Cabral, Juan; Luczywo, Nadia
# 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 retai... |
from __future__ import absolute_import
import pickle
from django.db import connection, models
from django.db.models import F
from django.test import TestCase
from bitfield import BitHandler, Bit, BitField
from bitfield.tests import BitFieldTestModel, CompositeBitFieldTestModel, BitFieldTestModelForm
from bitfield.co... |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
"""
The cluster module contains the definitions for retrieving and manipulating
cluster information.
"""
from qds_sdk.qubole import Qubole
from qds_sdk.resource import Resource
from argparse import ArgumentParser
from qds_sdk import util
import logging
import json
log = logging.getLogger("qds_cluster")
def str2boo... |
# -*- coding: utf-8 -*-
# See LICENSE.txt for licensing terms
__docformat__ = 'reStructuredText'
from copy import copy
import re
import sys
from xml.sax.saxutils import unescape
from reportlab.lib.enums import TA_CENTER, TA_RIGHT
from reportlab.lib.styles import ParagraphStyle
from reportlab.lib.units import cm
from... |
#!/usr/bin/env python
# Bootstrap installation of Distribute
import distribute_setup
distribute_setup.use_setuptools()
import os
from setuptools import setup
PROJECT = u'Functor'
VERSION = '0.1'
URL = ''
AUTHOR = u'Jonathan Strong'
AUTHOR_EMAIL = u'jonathan.strong@gmail.com'
DESC = "Implements a function-object pa... |
from distutils.core import setup
setup(name='zmqnumpy',
version='0.2',
author="Marco Bartolini",
author_email = "marco.bartolini@gmail.com",
url = "https://github.com/flyingfrog81/zmqnumpy/",
download_url = "",
license = "mit",
py_modules = ['zmqnumpy'],
requires = ["num... |
from flask import request
from flask_restplus import Resource
from skf.api.security import security_headers, validate_privilege
from skf.api.checklist.business import delete_checklist_item
from skf.api.checklist.serializers import message
from skf.api.kb.parsers import authorization
from skf.api.restplus import api
fro... |
#Save spiking:
saveSourceImage(output_firings, '.' + general_config_hash + config_hash + '.png')
for neuron in to_save:
stims = []
n = 0
for n in range(0, general_config.steps):
if n in config.step_input:
found = False
for s in config.step_input[n]:
if s[0] ==... |
#################### config.py ###################
## ##
## This file set differents constants ##
## ##
## Ce fichier initialise différentes constantes ##
## ##
##############... |
#!/usr/bin/python
# coding=utf-8
# Copyright 2012-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
# Copyright (c) 2015 Nicolas Iooss
#
# 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
... |
from datetime import datetime
from zipfile import ZipFile
from corehq.apps.app_manager.const import APP_V1, APP_V2
from couchdbkit.exceptions import ResourceNotFound, BadValueError
from dimagi.ext.couchdbkit import *
from corehq.apps.builds.fixtures import commcare_build_config
from corehq.apps.builds.jadjar import Jad... |
# -*- coding: utf-8 -*-
import logging
from django.contrib import messages
from ..db.ldap_db import LDAPConnection
logger = logging.getLogger(__name__)
class CheckLDAPBindMiddleware:
def process_response(self, request, response):
if not hasattr(request, "user") or "_auth_user_backend" not in request.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright (C) 2011-2013 Martijn Kaijser
Copyright (C) 2013-2014 Team-XBMC
Copyright (C) 2014-2019 Team Kodi
This file is part of service.xbmc.versioncheck
SPDX-License-Identifier: GPL-3.0-or-later
See LICENSES/GPL-3.0-or-later.tx... |
import urllib
import urllib2,json
import xbmcvfs
import requests,time
import os,xbmc,xbmcaddon,xbmcgui,re
addon = xbmcaddon.Addon('plugin.video.crachtvlistpro')
profile = xbmc.translatePath(addon.getAddonInfo('profile').decode('utf-8'))
cacheDir = os.path.join(profile, 'cachedir')
clean_cache=os.path.join(cacheDir,'cle... |
# Generated by Django 2.2.11 on 2020-03-13 07:54
import apps.images.handlers
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [("photos", "0003_auto_20200306_1424")]
operations = [
migrations.AlterModelOptions(
n... |
def get_ct(model, for_concrete_model=False):
from .models import ContentType
if isinstance(model, str):
ctype = ContentType.objects.get_by_identifier(model)
else:
ctype = ContentType.objects.get_for_model(
model, for_concrete_model=for_concrete_model
)
# get_for_m... |
import pytest
from advent.problem_04 import (acceptable_hash,
first_acceptable_hash,
generate_hash)
def test_acceptable_hash():
assert acceptable_hash('00000') == True
assert acceptable_hash('000001dbbfa') == True
assert acceptable_hash('000006... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Tonnikala documentation build configuration file, created by
# sphinx-quickstart on Tue May 12 08:17:19 2015.
#
# 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
# ... |
# -*- coding: utf-8 -*-
from openfisca_france.model.base import *
from numpy import datetime64
# Références juridiques - Code de la sécurité sociale
#
# Article L821-1 / 821-8
# https://www.legifrance.gouv.fr/affichCode.do;jsessionid=0E604431776A4B1ED8D2F8EB55A1A99C.tplgfr35s_1?idSectionTA=LEGISCTA000006141693&cidTe... |
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# Copyright (C) 2011 Khaled Ben Bahri - Institut Telecom
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundati... |
from wss import Server
from .FaceRecognition import FaceRecognition
import json
import trollius as asyncio
from base64 import b64decode, b64encode
import numpy as np
import cv2
from .recognitionprotocol import Messages, Signals, ErrorMessages
class CameraBase:
def __init__(self, name, maxsize=0):
self.imgQueue =... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'fie.ui'
#
# Created: Fri May 31 09:50:27 2013
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeEr... |
# coding=utf-8
import os
import platform
import unittest
import pytest
from parameterized import parameterized
from conans import MSBuild, tools
from conans.client.runner import ConanRunner
from conans.test.utils.mocks import MockSettings, MockConanfile, TestBufferConanOutput
from conans.test.utils.tools import Test... |
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any la... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-30 06:54
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('gaming', '0006_auto_20161029_2347'),
]
operations = [
... |
import cv2
import numpy as mp
from similarity import *
from hist import *
class PF_Tracker:
def __init__(self, model, search_space, num_particles=100, state_dims=2,
control_std=10, sim_std=20, alpha=0.0):
self.model = model
self.search_space = search_space[::-1]
s... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Netius System
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Netius System.
#
# Hive Netius System is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apache
# Foun... |
# coding: utf-8
from __future__ import unicode_literals, absolute_import
from datetime import timedelta
from django.utils import timezone
from lru import lru_cache_function
from common import wechat_client
def delta2dict( delta ):
"""Accepts a delta, returns a dictionary of units"""
delta = abs( delta )
... |
# -*- encoding: utf-8 -*-
"""Test class for Foreman Discovery Rules
@Requirement: Discoveryrule
@CaseAutomation: Automated
@CaseLevel: Acceptance
@CaseComponent: UI
@TestType: Functional
@CaseImportance: High
@Upstream: No
"""
from fauxfactory import gen_integer, gen_ipaddr, gen_string
from nailgun import entiti... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2009 Edgewall Software
# Copyright (C) 2006 Alec Thomas
# Copyright (C) 2007 Eli Carter
# Copyright (C) 2007 Christian Boos <cboos@edgewall.org>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part ... |
# (C) 2014-2015 Andrew Vaught
#
# 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 the following disclaimer.
# 2... |
# Copyright (c) 2008-2010, Michael Gorven, Stefano Rivera
# Released under terms of the MIT/X/Expat Licence. See COPYING for details.
import re
from datetime import datetime, timedelta
from random import choice
import logging
import ibid
from ibid.config import IntOption, ListOption, DictOption
from ibid.plugins impo... |
"""
Django settings for Proj project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... |
# -*-python-*-
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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, or (at your option) ... |
import numpy as np
import shap
model = lambda x: np.array([np.linalg.norm(x)])
X = np.array([[3, 4], [5, 12], [7, 24]])
y = np.array([5, 13, 25])
explainer = np.array([[-1, 2], [-4, 2], [1, 2]])
masker = X
def test_update():
""" This is to test the update function within benchmark/framework
"""
sort_ord... |
__author__ = 'tirthankar'
import pandas as pd
import xlrd as xl
import numpy as np
# straight read
pdata = pd.read_csv(
"Code/Miscellaneous/Data/pwt71_11302012version/pwt71_wo_country_names_wo_g_vars.csv")
# passing a string
pdata2 = pd.read_csv("Code/Miscellaneous/Data/pwt71_11302012version/pwt71_wo_country_nam... |
# 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
# distributed under the... |
import os
from django.core.management.base import NoArgsCommand
from django.utils.importlib import import_module
from mediagenerator import settings
class Command(NoArgsCommand):
help = 'Removes files from _generated_media not stored in _generated_media_file.pu'
files_removed = 0
def handle_noar... |
"""
To make callbacks work with instance methods some things need to happen.
The handler decorator attaches instances of MNDInfo to functions to enable
the dispatcher to work with classes and instances via the Handler metaclass.
At instance creation time the metaclass converts finds any handlers with
MNDFunction, rep... |
# Generated by Django 2.1.7 on 2019-05-07 04:22
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
('occurrence', '0033_auto_20190506_1347'),
]
operations = [
migrations.CreateModel(
n... |
import os
from os.path import join
from unittest import TestCase
import numpy as np
from scilmm import IBDCompute
class TestIBDCompute(TestCase):
def setUp(self):
self.ibd_compute = IBDCompute()
def test_compute_relationships(self):
pedigree, entries_list = self.ibd_compute.compute_relation... |
from app import db
# create Question model
class Question(db.Model):
questionID = db.Column(db.Integer, primary_key=True)
description = db.Column(db.String(300), unique=True)
categoryID = db.Column(db.Integer, db.ForeignKey('category.ID'))
userID = db.Column(db.Integer, db.ForeignKey('register... |
#!/usr/bin/python
#
# 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 ag... |
'''
Utility functions for tiff file handling.
'''
def imarray_from_files_in_directory(directory, pat=r'\w*.tif'):
'''
Returns an numpy array with the data in all files in directory matching a
regexp pattern.
'''
import numpy as np
from PIL import Image
from ..io import data_handler
dh... |
################################################################################
#
# Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks
# The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
#
# This file is part of MadAnalysis 5.
# Official website: <https://launchpad.net/madanalysis5>
#
# MadAnal... |
from sklearn.metrics import roc_auc_score
from mla.ensemble import RandomForestClassifier
from mla.ensemble.gbm import GradientBoostingClassifier
from mla.knn import KNNClassifier
from mla.linear_models import LogisticRegression
from mla.metrics import accuracy
from mla.naive_bayes import NaiveBayesClassifier
from mla... |
import belaylibs.models as bcap
from django.db import models
class BelayAccount(bcap.Grantable):
station_url = models.CharField(max_length=200)
class PendingLogin(bcap.Grantable):
# Key is for this server to trust the openID provider's request
key = models.CharField(max_length=36)
# ClientKey is a secret pro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Note: To use the 'upload' functionality of this file, you must:
# $ pip install twine
#
import os
import sys
from setuptools import find_packages, setup, Command
from shutil import rmtree
# Package meta-data.
NAME = 'hnqis-cli'
DESCRIPTION = 'Command-line tools for i... |
# Copyright 2005 Joe Wreschnig
# 2012 Christoph Reiter
# 2011-2020 Nick Boultbee
# 2014 Jan Path
#
# 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 th... |
# pylint: disable=I0011, C0111, too-few-public-methods, no-self-use
from collections import OrderedDict
from parsimonious.nodes import NodeVisitor
KEY_ORDER = {
"name" : 1,
"type" : 2,
"description" : 3,
"text" : 4,
"pos" : 5,
"chi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.