src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
# Copyright (c) 2006
# Colin Dewey (University of Wisconsin-Madison)
# cdewey@biostat.wisc.edu
#
# 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 Li... |
"""
Copyright (c) 2013, XLAB D.O.O.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following... |
ECG_MIN = 850
ECG_MAX = 1311
NCOLS = 2048
NCELLS = 4
HZ=360
AHEAD=1
DATA_FILE=u'file://./inputdata.csv'
ITERATIONS=15000 # or -1 for whole dataset #override for swarming
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, ... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Avanzosc - Avanced Open Source Consulting
# Copyright (C) 2011 - 2012 Avanzosc <http://www.avanzosc.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... |
"""Utilities to support packages."""
# NOTE: This module must remain compatible with Python 2.3, as it is shared
# by setuptools for distribution with Python 2.3 and up.
import os
import sys
import imp
import os.path
from types import ModuleType
from org.python.core import imp as _imp, BytecodeLoader
__all__ = [
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2008, Konstantin Merenkov <kmerenkov@gmail.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 cod... |
import unittest
import random
import sympy as sp
import numpy as np
import sys
import os
sys.path.append('.')
import stats.methods as methods
from stats.utils import *
class TestBasicMrt(unittest.TestCase):
def setUp(self):
self.num_vals = 20 # number of source values
def test_linear_k(... |
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2008-2009, James Vega
# 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 c... |
# Licensed under a 3-clause BSD style license - see PYFITS.rst
import gzip
import io
from ..file import _File
from .base import NonstandardExtHDU
from .hdulist import HDUList
from ..header import Header, _pad_length
from ..util import fileobj_name
from ....extern.six import string_types
from ....utils import lazypro... |
#!/usr/bin/env python
import argparse
import Bio.SeqIO
import sys
def get_args():
parser = argparse.ArgumentParser(
description="""Make the BoulderIO formatter config file for primer3 to direct guide sequences against a reference.
Typical usage:
./zebraguide.py sample2.fasta | primer3_core -format_outpu... |
#!/usr/bin/env python
'''
Bulk add docs to an elasticsearch index.
'''
import sys
import os
import json
import logging
import subprocess
#import time
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.INFO)
LOGGER.addHandler(logging.StreamHandler(sys.stderr))
#def shell(cmd, max_attempts=7):
def shell(cm... |
"""load template into primary storage"""
from baseCmd import *
from baseResponse import *
class prepareTemplateCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "false"
"""template ID of the template to be prepared in primary storage(s)."""
"""Required"""
self.te... |
"""
http://neuralnetworksanddeeplearning.com/chap1.html#implementing_our_network_to_classify_digits
http://numericinsight.com/uploads/A_Gentle_Introduction_to_Backpropagation.pdf
https://ayearofai.com/rohan-lenny-1-neural-networks-the-backpropagation-algorithm-explained-abf4609d4f9d
"""
#### Libraries
# Standard libr... |
from pyVmomi import vim
from pyVmomi import vmodl
import utils
import virtual_machine
import vmpie_exceptions
class Datastore(object):
def __init__(self, datastore_name, _pyVmomiDatastore=None):
# Name of the datastore
self.name = datastore_name
if isinstance(_pyVmomiDat... |
"""Event-related management commands."""
import sys
import arrow
from flask import current_app
from flask_script import Command, prompt, prompt_bool
from werkzeug.datastructures import MultiDict
from pygotham.core import db
from pygotham.forms import EventForm
from pygotham.models import Event
class CreateEvent(Co... |
'''
Created on Dec 12, 2013
@author: george
'''
import sys
from PyQt4 import QtCore, QtGui
from PyQt4.Qt import *
from common_wizard_pages.funnel_page import FunnelPage
class EditFunnelPlotForm(QDialog):
def __init__(self, funnel_params, parent=None):
super(EditFunnelPlotForm, self).__init__(parent)
... |
# -*- coding:Utf-8 -*-
from django.utils.translation import ugettext_lazy as _, pgettext, ugettext
from django.utils.timezone import now as datetime_now
from mongoengine import fields
from decimal import Decimal
import datetime
import uuid
from vosae_utils import SearchDocumentMixin
from pyes import mappings as searc... |
import os
import time
import pylidc as pl
import pytest
from config import Config
from . import get_timeout
from ..algorithms.identify.prediction import load_patient_images
from ..algorithms.segment.trained_model import predict
from ..preprocess.lung_segmentation import save_lung_segments, get_z_range
def test_cor... |
import sys
from browser import console
def _restore_current(exc):
"""Restore internal attribute current_exception, it may have been modified
by the code inside functions of this module.
"""
__BRYTHON__.current_exception = exc
def print_exc(file=sys.stderr):
exc = __BRYTHON__.current_exception
... |
## Copyright (C) 2013 ABRT team <abrt-devel-list@redhat.com>
## Copyright (C) 2013 Red Hat, Inc.
## 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 yo... |
from .. import BaseProvider
localized = True
class Provider(BaseProvider):
# Format: (code, name)
currencies = (
("AED", "United Arab Emirates dirham"),
("AFN", "Afghan afghani"),
("ALL", "Albanian lek"),
("AMD", "Armenian dram"),
("ANG", "Netherlands Antillean guilder... |
#!/usr/bin/env python
# coding=utf-8
import pygraphviz as pgv
from pdb import *
gdata = [
['A', '->', 'B',1],
['A', '->', 'C',1],
['B', '->', 'C',1],
['B', '->', 'D',1],
['C', '->', 'D',1],
['D', '->', '',1],
]
graph = {
'A': ['B', 'C'],
'B': ['C', 'D'],
'C': ['D'],
'D':[]
}
def... |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
from cryptography import utils
from cryptography.exceptions import (
... |
# -*- coding: utf-8 -*-
# Copyright 2017 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import date, timedelta
from odoo.tests import common
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
from odoo.exceptions import ValidationError
clas... |
# -*- coding: utf-8 -*-
"""
requests.models
~~~~~~~~~~~~~~~
This module contains the primary objects that power Requests.
"""
import collections
import datetime
import sys
from io import UnsupportedOperation
from ._internal_utils import to_native_string, unicode_is_ascii
from .auth import HTTPBasicAuth
from .compat... |
# Copyright 2015-2017 Espressif Systems (Shanghai) PTE 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 copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
"""Core of the Nemris tool, APK extractor."""
import argparse
import os
# Custom modules necessary for Nemris to work
from modules import apkutils
from modules import configutils
from modules import dirutils
from modules import pkgutils
from modules import utils
##########
# Path of the configuratipn file and defau... |
import os, sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))
#
import math
from math import pi, atan
import cPickle
import glob
from optparse import OptionParser
import pyglet
from pyglet.gl import *
from pyglet.window import key
import cocos
from cocos.director import director
from cocos.sprit... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 21 22:28:48 2017
@author: ruobingwang
"""
import spacy
import pandas as pd
from nltk import data
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from dateparser import parse
import time
from gat.service import file_io
from gat.dao impor... |
import openvoronoi as ovd # https://github.com/aewallin/openvoronoi
import ovdvtk # for VTK visualization, https://github.com/aewallin/openvoronoi
import truetypetracer as ttt # https://github.com/aewallin/truetype-tracer
import offset2vtk # vtk visualization helper https://github.com/aewallin/openvoronoi
import t... |
#! /usr/bin/env python
"""Unit tests for germinate.archive."""
# Copyright (C) 2012 Canonical Ltd.
#
# Germinate 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, or (at your option) any
# lat... |
#!/usr/bin/env python
#import argparse
#from glob import glob
#-s test_samples.txt
#-b /mnt/lfs2/hend6746/devils/reference/sarHar1.fa
#-k /mnt/lfs2/hend6746/taz/filtered_plink_files/export_data_150907/seventy.1-2.nodoubletons.noparalogs.noX.plink.oneperlocus.vcf
from os.path import join as jp
from os.path import absp... |
#
# 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
# ... |
import web
from social.strategies.base import BaseStrategy, BaseTemplateStrategy
class WebpyTemplateStrategy(BaseTemplateStrategy):
def render_template(self, tpl, context):
return web.template.render(tpl)(**context)
def render_string(self, html, context):
return web.template.Template(html)(*... |
""" :mod: TransformationCleaningAgent
=================================
.. module: TransformationCleaningAgent
:synopsis: clean up of finalised transformations
"""
# # imports
import re
from datetime import datetime, timedelta
# # from DIRAC
from DIRAC import S_OK, S_ERROR
from DIRAC.Core.Base.AgentModule... |
"""
Celery config for tiny_hands_pac project.
For more information on this file, see
http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html
Run your celery worker(s) as `djcelery`, which is an alias for
`celery -A tiny_hands_pac worker --loglevel=info`.
A celerybeat scheduler can be started toge... |
'''
Compare results to scikit-learn's ElasticNetCV function.
Note that the lambda/alpha parameters are different in sklearn's objective function.
Scikit alpha_ = lambda * (2-alpha) / 2
Scikit l1_ratio_ = alpha / (2-alpha)
'''
import numpy as np
import matplotlib.pyplot as plt
import elastic_net
from sklearn.linear_m... |
# -*- coding: utf-8 -*-
import gxf
@gxf.register()
class Disassemble(gxf.DataCommand):
'''
Disassemble a specified section of memory.
'''
def setup(self, parser):
parser.add_argument("what", type=gxf.LocationType())
parser.add_argument("until", type=gxf.LocationType(), nargs='?')
... |
from Screens.MessageBox import MessageBox
from Components.ActionMap import ActionMap, NumberActionMap
from Components.MenuList import MenuList
from Components.Button import Button
from Components.Label import Label
from Components.Pixmap import Pixmap
from Components.ActionMap import NumberActionMap, ActionMap
from Com... |
""" Normal-Gamma density."""
import numpy as np
from scipy.special import gammaln, psi
class NormalGamma(object):
"""Normal-Gamma density.
Attributes
----------
mu : numpy.ndarray
Mean of the Gaussian density.
kappa : float
Factor of the precision matrix.
alpha : float
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2021 Jose Antonio Chavarría <jachavar@gmail.com>
# Copyright (c) 2015-2021 Alberto Gacías <alberto@migasfree.org>
#
# 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 Softw... |
'''
Copyright (C) 2018 Alex Barry
aostreetart9@gmail.com
Created by Alex Barry
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 your option) an... |
"""DDNS without TSIG"""
# pylint: disable=invalid-name,line-too-long
import pytest
import misc
import srv_control
import srv_msg
@pytest.mark.v4
@pytest.mark.ddns
@pytest.mark.tsig
@pytest.mark.forward_reverse_remove
def test_ddns4_tsig_sha1_forw_and_rev_release():
misc.test_setup()
srv_control.config_srv... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/SearchParameter) on 2017-03-22.
# 2017, SMART Health IT.
from . import domainresource
class SearchParameter(domainresource.DomainResource):
""" Search Parameter for a resource.
A ... |
# 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 Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be use... |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
import random
import time
def input_number(prompt):
while True:
try:
print(prompt)
number=int(input("> "))
break
except ValueError:
print("Oops! That wasn't a valid number. Try again.")
return number
def ask_times_table(num1, num2):
answer=in... |
from __future__ import absolute_import
from __future__ import unicode_literals
import django
from django.test import TestCase
from django.utils.timezone import now
from mock import MagicMock, patch
from error.models import reset_error_cache
from job.execution.manager import job_exe_mgr
from job.models import JobExecu... |
# -*- coding: utf-8 -*-
#
# formatter.py - format html from cplusplus.com to groff syntax
#
# Copyright (C) 2010 - 2015 Wei-Ning Huang (AZ) <aitjcize@gmail.com>
# All Rights reserved.
#
# This file is part of cppman.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the G... |
##
# Copyright 2016-2020 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... |
# coding: utf-8
# In[1]:
import os
import rasterio
from math import floor, ceil
import numpy as np
# In[24]:
class VirtualRaster():
def __init__(self, shape, transformation = None, proj4_crs = None):
self.height = shape[0]
self.width = shape[1]
self.transform = transformation
s... |
__author__ = 'Sharon Lev'
__email__ = 'sharon_lev@yahoo.com'
__date__ = '10/25/16'
import sys
from StringIO import StringIO
from unittest import TestCase
from logging import root
from json import dumps
class OutputSetter(TestCase):
"""
"""
temp_stdout = None
@classmethod
def setUpClass(cls):
... |
# Copyright (C) 2019 Christopher Gearhart
# chris@bblanimation.com
# http://bblanimation.com/
#
# 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 your opt... |
'''
Created on Sep 18, 2014
@author: David Zwicker <dzwicker@seas.harvard.edu>
'''
from __future__ import division
import glob
import logging
import itertools
import os
import pprint
import time
import numpy as np
from ..algorithm.parameters import PARAMETERS_DEFAULT
from ..simple import load_result_file
import vi... |
import pid_controller
from utils import json_config
from utils import channel
class HeaterServer(object):
def __init__(self):
# Read Config
self.config = json_config.parse_json('config.json')
# Create PID controller
self.pid_controller = pid_controller.PIDController(self.config)
... |
# -*- coding: utf-8 -*-
import gtk
import os
from random import randint
from db import db
from Timetableasy import app
global interface_course
class CourseInterface(object):
def __init__(self):
from GtkMapper import GtkMapper
mapper = GtkMapper('graphics/dialog_course.glade', self, app.debug)
self.action_ad... |
'''
Created on 16/04/2013
@author: henar
'''
import httplib
import sys
import os
from xml.dom.minidom import parse, parseString
from xml.dom.minidom import getDOMImplementation
from xml.etree.ElementTree import Element, SubElement, tostring
import md5
import httplib, urllib
import utils
domine = "130.206.80.119"
por... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import json
import typing
from mitmproxy.coretypes import serializable
from mitmproxy.utils import typecheck
class StateObject(serializable.Serializable):
"""
An object with serializable state.
State attributes can either be serializable types(str, tuple, bool, ...)
or StateObject instances themselv... |
spork = 'hi every1 im new!!!!!!! holds up spork my name is katy but u can call me t3h PeNgU1N oF d00m!!!!!!!! lol…as ' \
'u can see im very random!!!! thats why i came here, 2 meet random ppl like me _… im 13 years old (im mature ' \
'4 my age tho!!) i like 2 watch invader zim w/ my girlfreind (im bi if... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
System functions
"""
from __future__ import unicode_literals
from __future__ import absolute_import
from mathics.core.expression import Expression, String, strip_context
from mathics.builtin.base import Builtin, Predefined
from mathics import version_string
class V... |
# -*- coding: utf-8 -*-
from django import forms
from django.utils.translation import ugettext_lazy as _
from .models import( Column,
DJANGOCMS_GRID_LG_CHOICES,
DJANGOCMS_GRID_MD_CHOICES,
DJANGOCMS_GRID_SM_CHOICES,
DJANGOCMS_GRID_XS_CHO... |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Herald HTTP transport servlet
:author: Thomas Calmant
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.3
:status: Alpha
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
yo... |
import tensorflow as tf
class Model(object):
"""Abstracts a Tensorflow graph for a learning task.
We use various Model classes as usual abstractions to encapsulate tensorflow
computational graphs. Each algorithm you will construct in this homework will
inherit from a Model object.
"""
def add_... |
from hashlib import md5
import mistune
from django.contrib.auth.models import User
from django.db import models
class RedditUser(models.Model):
user = models.OneToOneField(User)
first_name = models.CharField(max_length=35, null=True, default=None,
blank=True)
last_name =... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import random
from collections import Counter
errors = {
"vn_parsing": [],
"vn_missing": [],
"frame_without_slot": [],
"frame_with_slot": [],
"impossible_role_matching": [],
"ambiguous_role": []
}
debug_data = []
def log_vn_missing(frame):
... |
#!/bin/env python
""" Beginners' example: random movement
- random movement
- output to visual player, which is executed as child process
- you may try the other commented monitor examples - you can choose a single or multiple monitors
"""
import sys
sys.path.append("..")
import time
import random
from m... |
#!/usr/bin/python
import sys, os, string, time
ROOT = os.path.abspath(os.getcwd() + "/../")
SCRIPTS = ROOT + "/scripts"
RESULTS_DUMP_FILE_PREFIX = "result_dump_one_on_one"
# RESULTS_DUMP_FILE = ROOT + "/result_dump.txt"
TEAM_REPORT_TEMPLATE = SCRIPTS + "/report_tex_q.tpl"
## TODO: get it from sysargs
GROUP_FOLDER ... |
"""Test the Netatmo config flow."""
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.netatmo import config_flow
from homeassistant.components.netatmo.const import (
DOMAIN,
OAUTH2_AUTHORIZE,
OAUTH2_TOKEN,
)
from homeassistant.helpers import config_entry_oauth2_f... |
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: Tix.py,v 1.7 2001/12/13 04:53:07 fdrake Exp $
#
# Tix.py -- Tix widget wrappers.
#
# For Tix, see http://tix.sourceforge.net
#
# - Sudhir Shenoy (sshenoy@gol.com), Dec. 1995.
# based on an idea of Jean-Marc Lugrin (lug... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import find_packages, setup
from djangocms_link import __version__
REQUIREMENTS = [
'django-cms>=3.2.0',
'djangocms-attributes-field>=0.1.1',
]
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environmen... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
from setuptools.command.install import install
import os
import subprocess
from urllib2 import urlopen
import zipfile
import sys
import time
def parse_requirements(filename):
return list(filter(lambda line: (line.strip())[0] != '#',
... |
# Raghav Gupta
# AI/Mixed Reality Lab
# Next Tech Lab
import pandas as pd
import numpy as np
from TheanoNN import NN
import theano.tensor as T
import theano
# from sklearn.ensemble import ExtraTreesClassifier
rng = np.random.RandomState(1234)
f = open("Pokemon.csv")
dataset = pd.read_csv(f)
# Below co... |
# -*- coding: utf-8 -*-
"""
----------
Macafin basic report module
----------
This module implements basic financial report generation.
:copyright: (c) 2017 by Aguiar, Vitoriano.
:license: GNU GPL 3, see LICENSE for more details.
"""
import numpy as np
import pandas as pd
import locale
from os... |
#!/usr/bin/env python3
import argparse
import logging
import sys
import json
from invokust.aws_lambda import LambdaLoadTest, results_aggregator
def print_stat(type, name, req_count, median, avg, min, max, rps):
return "%-7s %-50s %10s %9s %9s %9s %9s %10s" % (
type,
name,
req_count,
... |
from django.db import models
from django.utils.html import escape, format_html
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from djangocms_text_ckeditor.fields import HTMLField
from repanier_v2.const import *
from repanier_v2.tools import cap
class Notificatio... |
# Copyright (c) 2016-2017, the ElectrumX authors
#
# All rights reserved.
#
# See the file "LICENCE" for information about the copyright
# and warranty status of this software.
'''Backend database abstraction.'''
import os
from functools import partial
import electrumx.lib.util as util
def db_class(name):
'''R... |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
"""Use blog post test to test user permissions logic"""
import frappe
import frappe.defaults
import unittest
test_records = frappe.get_test_records('Event')
class TestEvent(unittest.TestCase):
# def setUp(self):
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import typing
import unittest
import streamtologger
__author__ = "Patrick Hohenecker"
__copyright__ = (
"Copyright (c) 2017 Patrick Hohenecker\n"
"\n"
"Permission is hereby granted, free of charge, to any person obtaining a... |
# -*- coding: UTF-8 -*-
import os,sys
import datetime
import time
from redis_client import RedisClient
import types
import logging
#加载配置
import setting
from setting import logger
try:
from functools import wraps, update_wrapper
except ImportError:
from django.utils.functional import wraps, update_wrapper # Pyt... |
#!/usr/bin/python
# Copyright (c) 2014-2015 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# 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 your opti... |
# coding=utf-8
# Copyright 2020 The TensorFlow GAN 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 applicabl... |
#!/usr/bin/env python
#-*-coding:utf-8-*-
import math
from number import Number
class Vector(object):
# 验证是否为向量
@classmethod
def is_vector(cls,vector):
if hasattr(vector,'get_value'):
return True
else:
return False
def __init__(self,x=0,y=0,z=0):
if has... |
# -*- coding: utf-8 -*-
# Copyright 2016 Juca Crispim <juca@poraodojuca.net>
# This file is part of mongomotor.
# mongomotor 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, ... |
# vim: expandtab shiftwidth=8 softtabstop=8 tabstop=8
#
# (c) 2010
# envyseapets@gmail.com
# grindlay@gmail.com
# langdalepl@gmail.com
# massimo.mund@googlemail.com
# bethebunny@gmail.com,
# 2012-2015 lotan_rm@gmx.de
#
# This file is part of the Rhythmbox Ampache plugin.
#
# The Rhythmbox ... |
import feedparser as fp
from . import parse_feeds
def feedinfo(feed: parse_feeds.FEEDTUP) -> None:
"""Print the contents of the FeedTup of the Rss feed."""
# Based on RSS 2.0 Spec
# https://cyber.harvard.edu/rss/rss.html
print('\n----- Feed Info -----')
# Common elements
print(f'Feed Title: ... |
import numpy as np
import nibabel as nb
import os
import sys
import nighresjava
from ..io import load_volume, save_volume
from ..utils import _output_dir_4saving, _fname_4saving, \
_check_topology_lut_dir, _check_available_memory
def mp2rage_dura_estimation(second_inversion, skullstrip_mask,
... |
import parser
import mercury.util
import re
_STD_MODULES = ['re', 'random', 'itertools', 'string']
_IMPORT_1_REGEX = re.compile(r'^import (\S+)')
_IMPORT_2_REGEX = re.compile(r'^from (\S+) import (\S+)')
_INDENT_REGEX = re.compile(r'^(\s*).*')
def execute(code, buff):
code_lines = code.split("\n")
last_exp... |
from flask.ext.wtf import Form
from wtforms import TextField, BooleanField, TextAreaField, PasswordField
from wtforms.validators import Required, Length, Email
class LoginForm(Form):
user_name = TextField('user_name', validators = [Required()])
password = PasswordField('password', validators = [Required()])
... |
#!/usr/bin/python
import sys
import string
rootDeprel = u'ROOT' # the dependency relation for the root
emptyFeatsString = u'_' # if no morphological features exist (only PoS)
featsJoiner = u'|' # to join morphological features into one string
emptyProjColumnString = u'_' # if no PHEAD or PDEPREL available
class... |
# Prints a tree of all items in the configuration
# vim: tabstop=4 shiftwidth=4 expandtab
import kconfiglib
import sys
# Integers representing symbol types
UNKNOWN, BOOL, TRISTATE, STRING, HEX, INT = range(6)
# Strings to use for types
TYPENAME = {UNKNOWN: "unknown", BOOL: "bool", TRISTATE: "tristate",
S... |
"""The Microsoft Visual C++ Compiler.
@see: Cake Build System (http://sourceforge.net/projects/cake-build)
@copyright: Copyright (c) 2010 Lewis Baker, Stuart McMahon.
@license: Licensed under the MIT license.
"""
import os
import os.path
import re
import threading
import cake.filesys
import cake.path
import cake.sys... |
# -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('entries', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Arrow',
fields=[
('id', models.AutoField(verbose_n... |
# ======================================================================
#
# Brad T. Aagaard, U.S. Geological Survey
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copyright (c) 2010-2017 University of California, Davis
#
# See COPYING for license... |
import sys
from abc import ABCMeta, abstractmethod
class ModulusList:
'''
Maintains a list of (host, modulus, e) tuples.
'''
__metaclass__ = ABCMeta
def __init__(self):
self._modulusList = []
def addModulusList(self, other):
for i in range(0, other.length()):
item = other[i]
self.add(item[0], item[... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals
import os
import io
import re
import codecs
# カレントディレクトリのディレクトリ名
DIRECTORY_NAME = os.path.split(os.getcwd())[1]
#
def write_base_lyx_code(wf):
wf.write("""#LyX 2.2 created this file. For more info see http://www.lyx.org/
\\lyxf... |
from django.test import TestCase
from django.db import models
from automatic_timestamps.models import TimestampModel
from time import sleep
class GenericTimestampTestModel(TimestampModel):
"""A generic, boring model to test timestamp creation against."""
pass
class TimestampModelTest(TestCase):
def tes... |
"""Main product initializer
"""
from zope.i18nmessageid import MessageFactory
from uwosh.dropcard import config
from Products.Archetypes import atapi
from Products.CMFCore import utils
# Define a message factory for when this product is internationalised.
# This will be imported with the special name "_" in most mod... |
#!/usr/bin python2
# -*- coding: UTF-8 -*- #
"""def get_tree_graph():
#return graph
pass
According to POX wiki ,method spanning_tree returns it as dictionary like
{s1:([(s2,port1),(s3,port2),...]),s2:([(s1,port),...]),...}
#port refers to the port of s1 which connects to s2
A graph example for path searc... |
from sympy.physics.pring import wavefunction, energy
from sympy import pi, integrate, sqrt, exp, simplify, I
from sympy.abc import m, x, r
from sympy.physics.quantum.constants import hbar
def test_wavefunction():
Psi = {
0: (1/sqrt(2 * pi)),
1: (1/sqrt(2 * pi)) * exp(I * x),
2: (1/sqrt(2 *... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.