src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lic... |
import sqlite3
from sqlite3 import Error
import pandas as pd
def create_connection(db_file):
""" create a database connection to the SQLite database
specified by db_file
:param db_file: database file
:return: Connection object or None
"""
try:
conn = sqlite3.connect(db_file)
... |
#
# Copyright (C) 2016-2017 Kamran Mackey and contributors
#
# 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) any later version.
import re
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This experiment was created using PsychoPy2 Experiment Builder (v1.90.1),
on Tue May 8 15:02:31 2018
Created 5/8/18 by DJ.
Updated 5/8/18 by DJ - added NetStationEEG code from https://github.com/imnotamember/PyNetstation (per Pete's instructions)
Updated 6/8/18 by... |
# -*- coding: utf-8 -*-
"""
flask_security.decorators
~~~~~~~~~~~~~~~~~~~~~~~~~
Flask-Security decorators module
:copyright: (c) 2012 by Matt Wright.
:license: MIT, see LICENSE for more details.
"""
import re
from collections import namedtuple
from functools import wraps
from flask import (abort... |
#This file is part of ChiVO, the Chilean Virtual Observatory
#A project sponsored by FONDEF (D11I1060)
#Copyright (C) 2015 Universidad Tecnica Federico Santa Maria Mauricio Solar
# Marcelo Mendoza
# Universidad de Chile Die... |
# -*- coding: utf-8 -*-
#
# one_neuron_with_noise.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 L... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module contains functions for computing RNAkb potential
It seems that this is impossible to run RNAkb in full atom mode. So this works only in 5 pt (5 points/atom per residue) mode.
https://gromacs.bioexcel.eu/t/fatal-error-an-input-file-contains-a-line-longer-tha... |
from __future__ import (absolute_import, division, print_function)
import unittest
import mantid
from sans.gui_logic.models.state_gui_model import StateGuiModel
from sans.user_file.settings_tags import (OtherId, event_binning_string_values, DetectorId, det_fit_range)
from sans.common.enums import (ReductionDimensiona... |
nodetype = 'x3455'
scalapack = True
compiler = 'gcc'
libraries =[
'gfortran',
'scalapack',
'mpiblacs',
'mpiblacsCinit',
'openblaso',
'hdf5',
'xc',
'mpi',
'mpi_f77',
]
library_dirs =[
'/home/opt/el6/' + nodetype + '/openmpi-1.6.3-' + nodetype + '-tm-gfortran-1/lib',
'/home... |
from warnings import catch_warnings
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import DataFrame, Series
import pandas._testing as tm
from pandas.tests.io.pytables.common import ensure_clean_path, ensure_clean_store
from pandas.io.pytables import read_h... |
import IsotopeDataExporting as ided
import os
import glob
import time
import sys
import renormalize as renorm
def function(option):
#Exports data requested by the user into text files (necessary to generate plots)
userInput = ided.datExp(option,True,True)
#Prints the user input allowing user to make su... |
import uuid, sys
from twisted.python import log
from twisted.internet import reactor
from twisted.web.server import Site
from twisted.web.wsgi import WSGIResource
from autobahn.twisted.resource import WebSocketResource, \
WSGIRootResource
from wsgi_app import make_app
from ws_protocol import BroadcastServerFactor... |
# robotframework-tools
#
# Python Tools for Robot Framework and Test Libraries.
#
# Copyright (C) 2013-2016 Stefan Zimmermann <zimmermann.code@gmail.com>
#
# robotframework-tools 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 Sof... |
"""
Django settings for campaignserver 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, ... |
# noinspection PyPackageRequirements
import wx
from .helpers import AutoListCtrl
from service.price import Price as ServicePrice
from service.market import Market
from service.attribute import Attribute
from gui.utils.numberFormatter import formatAmount
class ItemCompare(wx.Panel):
def __init__(self, parent, stu... |
#!/usr/bin/python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... |
#!/usr/bin/python
from __future__ import division
import numpy as np
from Tkinter import *
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
from matplotlib import pyplot as plt
from PIL import Image
from PIL import PngImagePlugin
impo... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@ecdsa.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... |
# -*- coding: utf-8 -*-
import datetime
import functools
import logging
from bleach import linkify
from bleach.callbacks import nofollow
from website.models import NodeLog
import markdown
from markdown.extensions import codehilite, fenced_code, wikilinks
from modularodm import fields
from framework.forms.utils impo... |
#Дана возрастающая последовательность целых чисел 1, 2, 4, 5, 7, 9, 10, 12, 14, 16, 17, ...
# Она сформирована следующим образом: берется одно нечетное число, затем два четных,
# затем три нечетных и так далее. Выведите N-й элемент этой последовательности.
def next_chet(x):
if x % 2 == 0:
return x + 2
... |
from cpython cimport pythread
from cpython.exc cimport PyErr_NoMemory
cdef class FastRLock:
"""Fast, re-entrant locking.
Under uncongested conditions, the lock is never acquired but only
counted. Only when a second thread comes in and notices that the
lock is needed, it acquires the lock and notifies... |
#!/usr/bin/env python
import os
import sys
import glob
__requires__ = ['SQLAlchemy >= 0.7']
import pkg_resources
sys.path.append( os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'lib') )
from ansiblereport import __version__, __author__, __name__
from distutils.core import setup
data_files = []
plugi... |
from Errors import CompileError, error
import ExprNodes
from ExprNodes import IntNode, NameNode, AttributeNode
import Options
from Code import UtilityCode, TempitaUtilityCode
from UtilityCode import CythonUtilityCode
import Buffer
import PyrexTypes
import ModuleNode
START_ERR = "Start must not be given."
STOP_ERR = "A... |
#!/usr/bin/env python3
"""Setup for MobSF."""
from setuptools import (
find_packages,
setup,
)
from pathlib import Path
def read(rel_path):
init = Path(__file__).resolve().parent / rel_path
return init.read_text('utf-8', 'ignore')
def get_version():
ver_path = 'mobsf/MobSF/init.py'
for li... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import datetime
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
m... |
import io
from setuptools import setup, find_packages
setup(
name='sphinx-autoapi',
version='1.2.0',
author='Eric Holscher',
author_email='eric@ericholscher.com',
url='http://github.com/rtfd/sphinx-autoapi',
license='BSD',
description='Sphinx API documentation generator',
packages=fin... |
# -*- coding: utf-8 -*-
#
# Read the Docs Template documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 26 14:19:49 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
# autogenera... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import nltk.classify.util
from nltk.classify import NaiveBayesClassifier
from nltk.corpus import movie_reviews
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.corpus import wordnet
# In[2]:
stopwords.words('english')[:16]
# In[3... |
import datetime
import decimal
import uuid
from functools import lru_cache
from itertools import chain
from django.conf import settings
from django.core.exceptions import FieldError
from django.db import utils
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.models import aggregates... |
'''
@author: doug@neverfear.org
'''
from MatrixArithmetic import *
import unittest
class TestScale(unittest.TestCase):
def setUp(self):
self.A = [
[1,2],
[3,4]
]
self.mA = Matrix(self.A)
def tearDown(self):
de... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... |
import os
import pysam
import unittest
from TestUtils import checkFieldEqual
import copy
SAMTOOLS = "samtools"
WORKDIR = "pysam_test_work"
DATADIR = "pysam_data"
class ReadTest(unittest.TestCase):
def buildRead(self):
'''build an example read.'''
a = pysam.AlignedSegment()
a.query_name ... |
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.functional import cached_property
from .managers import ActivityItemManager
class Activity(models.Model):
"""... |
import re
import shortcodes.parsers
from django.core.cache import cache
def import_parser(name):
mod = __import__(name)
components = name.split('.')
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
def parse(value):
ex = re.compile(r'\[(.*?)\]')
groups = ex.findall(val... |
from pydomo.Transport import DomoAPITransport
from pydomo.datasets import DataSetClient
from pydomo.datasets import DataSetRequest
from pydomo.datasets import Schema
from pydomo.datasets import Column
from pydomo.datasets import ColumnType
from pydomo.groups import GroupClient
from pydomo.pages import PageClient
from p... |
"""
acreroad_1420 Receiver software
Software designed to receive signals through the 1420MHz telescope at Acre Road observatory.
Parameters
----------
serial : str
The serial number of the ettus device being used.
"""
# The large number of imports required for GNURadio
import os
import sys
sys.path.append(os.e... |
#!/usr/bin/env python
import subprocess
import tempfile
import shutil
import os
import re
import fasta_statter
"""
Assembly Dispatch bindings for SPAdes Single-Cell assembler (Bankevitch et al,
J Comput Biol, 2012), a de Brujin graph assembler for paired-end single-cell
sequencing.
Trying something new here... |
""" authority urls
"""
#from django.conf import settings
from django.conf.urls import patterns, url
from haystack.query import SearchQuerySet
from haystack.views import SearchView
from apps.browser.forms import ModelSearchForm
urlpatterns = patterns('apps.authority.views',
# Both `display_authorities` and `search... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Authority.languages'
db.add_column('portal_authority', 'languages', self.gf('jsonfield.fie... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
################################################################################
#
# 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 __future__ import print_function
import io
import os.path
import re
from distutils.text_file import TextFile
from setuptools import find_packages, setup
home = os.path.abspath(os.path.dirname(__file__))
missing = object()
def read_description(*files, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
... |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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... |
from flask import request, jsonify
from common.mongo import Schedules
from routes.base import BaseRoute
from common.schemas.parameters import SkipLimit500Schema
class LanguagesRoute(BaseRoute):
rule = "/"
name = "languages"
methods = ["GET"]
def get(self, *args, **kwargs):
"""return a list o... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
from pearce.emulator import OriginalRecipe, ExtraCrispy, SpicyBuffalo, LemonPepperWet
from pearce.mocks import cat_dict
import numpy as np
from os import path
from SloppyJoes import lazy_wrapper
training_file = '/scratch/users/swmclau2/xi_zheng07_cosmo_lowmsat/PearceRedMagicXiCosmoFixedNd.hdf5'
em_method = 'gp'
fixed_... |
"""
Transform Stage_I_factors.csv (written by the stage1.py script) and
benefit_growth_rates.csv into growfactors.csv (used by Tax-Calculator).
"""
import numpy as np
import pandas as pd
import os
# pylint: disable=invalid-name
CUR_PATH = os.path.abspath(os.path.dirname(__file__))
first_benefit_year = 2014
inben_file... |
# -*- coding: utf-8 -*-
from django.test import TestCase
from BeautifulSoup import BeautifulSoup
from cm.models import *
from django.core.cache import cache
# python manage.py test
#
# python manage.py test cm.CommentPositioningTest
def create_comment(start_wrapper=0, end_wrapper=0, start_offset=0, end_offse... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017 Palo Alto Networks, 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... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'aftertouches/about.ui'
#
# Created: Sat Apr 19 21:32:18 2014
# by: pyside-uic 0.2.15 running on PySide 1.2.1
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_Dialog(object):
def se... |
import datetime
import time
import zlib
import hashlib
import redis
import re
import mongoengine as mongo
import random
import requests
import HTMLParser
from collections import defaultdict
from pprint import pprint
from BeautifulSoup import BeautifulSoup
from mongoengine.queryset import Q
from django.conf import setti... |
# Generated by Django 3.1.5 on 2021-01-28 15:52
from django.db import migrations, models
def backwards(apps, schema_editor):
print("Migration backward will not restore your `JSONField`s to `CharField`s.")
class Migration(migrations.Migration):
dependencies = [
('cmsplugin_cascade', '0028_cascade_c... |
# author : Johann-Mattis List
# email : mattis.list@uni-marburg.de
# created : 2014-10-22 16:52
# modified : 2014-10-22 16:52
"""
convert tppsr data to qlc table for easy editing possibilities
"""
__author__="Johann-Mattis List"
__date__="2014-10-22"
from lingpyd import *
import json
# get places first
orte = ... |
from jflow.db.trade.models import Position
from jflow.core.finins import finins
from logger import log
from basejson import extract, listpop, positionBase
from marketrisk import MarketRiskPosition, MarketRiskPortfolio
POSITION_STATUS = 'all'
class MktPositionInterface(object):
'''
Interface fo... |
############### DESCRIPTION ###############
#Save a video record to use without robot #
# #
# BY Hugo #
# #
############### DESCRIPTION ###############
import cv2
import numpy as np
import sys
#Receive and c... |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2015 Star2Billing S.L.
#
# The primar... |
# Copyright 2013, Red Hat, 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 applicable law or agr... |
import logging
import boto3
import datetime
logger = logging.getLogger()
logger.setLevel(logging.INFO)
simulate = False
def get_instance_tag(id, tag_name):
res_ec2 = boto3.resource('ec2')
tags = res_ec2.Instance(id).tags
if tags is not None:
for tag in tags:
if tag['Key'] == tag_name:... |
# encoding:utf-8
import re
degree_str1 = u"(初中|高中|职高|中专|技校|大专|本科|硕士研究生|在职研究生|工程硕士|专业硕士|博士研究生|博士在读|MBA硕士|MBA|EMBA|工商管理硕士|工学学士|访问学者|博士后|研究生|硕士|博士|学士)"
degree_pattern1 = re.compile(degree_str1)
# 抽取学位信息,并将日期按照顺序排列存入list
def degree_extract(str):
result_list = []
school_list = degree_pattern1.findall(str)
for ... |
# Create your views here.
from django.apps import apps
get_model = apps.get_model
from django.db import models
from django.shortcuts import render_to_response
from django.conf import settings
from dojango.util import to_dojo_data, json_encode
from dojango.decorators import json_response
from dojango.util import to_doj... |
from django import template
from ..models import Area
register = template.Library()
@register.assignment_tag(takes_context=True)
def get_site_root(context):
return context['request'].site.root_page
@register.inclusion_tag("home/navbar/navbar.html", takes_context=True)
def display_navbar(context):
parent = ... |
#!/usr/bin/python
import additional
import al
import animal
import audit
import configuration
import db
import diary
import log
import media
import utils
from i18n import _, after, now, python2display, subtract_years, add_days, date_diff
def get_waitinglist_query():
"""
Returns the SELECT and JOIN commands ne... |
"""
Support for Anthem Network Receivers and Processors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.anthemav/
"""
import logging
import voluptuous as vol
from homeassistant.components.media_player import (
MediaPlayerDevice, PLATFO... |
# -*- coding: utf-8 -*-
"""Redis client
.. module:: network.dbi.nosql.redis_client
:platform: Unix
:synopsis: Redis client
.. moduleauthor:: Petr Rašek <bowman@hydratk.org>
"""
"""
Events:
-------
dbi_before_connect
dbi_after_connect
dbi_before_exec_command
dbi_after_exec_command
"""
from hydratk.core.master... |
import sys
import requests
import json
from pytaxize.refactor import Refactor
class NoResultException(Exception):
pass
def parse(names):
"""
Uses the Global Names Index to parse scientific names
:param names: List of scientific names.
Usage::
from pytaxize import gn
gn.gni... |
#
# Copyright 2013 Red Hat, 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 applicable law or agreed to in writing... |
#!/usr/bin/python
#
# Copyright (C) 2012 Google 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 your option) any later version.
#
# This program... |
# rectangular
# Created by Rains Jordan
# Last updated 12/4/14
#
# Non-standard shortcuts:
# Ctrl+Home, Ctrl+End: Move to start/end of playlist column view, if the window size is
# too small.
#
# Notes:
# This is a simple demonstration of a sample kea interface, using a standard windowed interface
# with a track ... |
from collections import OrderedDict
from django.utils.translation import ugettext_lazy as _lazy
# The number of answers per page.
ANSWERS_PER_PAGE = 20
# The number of questions per page.
QUESTIONS_PER_PAGE = 20
# Highest ranking to show for a user
HIGHEST_RANKING = 100
# Special tag names:
ESCALATE_TAG_NAME = 'es... |
#!usr/bin/env python
# -*- coding: utf-8 -*-
"""Final Project"""
def print_menu():
"""Welcome To Your Phonebook
Args: None
Returns: None
Examples:
>>> Enter your choice (1-4) here: 1
>>> Enter new contact name: chris
>>> Enter contact phone number: 347192456
...You entered your fir... |
import constants as c
class BruteForce(object):
def __init__(self):
self.break_range = tuple(i for i in range(0, 9, 2))
self.windows = [c.WINDOW_NONE, c.WINDOW_HANNING, c.WINDOW_HAMMING, c.WINDOW_BLACKMAN, c.WINDOW_BARTLETT]
self.interpolation = [c.INTERPOLATE_LINEAR, c.INTERPOLATE_NEAREST... |
from datetime import datetime
from dateutil.tz import tzutc
import json
from klein import Klein
from math import ceil
import os
import re
import treq
from twisted.internet.defer import inlineCallbacks, returnValue
import uuid
from vumi.application import ApplicationWorker
from vumi.components.session import SessionMana... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/scrubber.py
#
# 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 li... |
# -*- coding: utf-8 -*-
from datetime import timedelta
from django.db.models import Count
from django.utils.translation import ugettext_lazy as _
try:
from django.utils.timezone import now
except ImportError:
from datetime import datetime
now = datetime.now
from qsstats import QuerySetStats
from admin_tool... |
#-*- coding: utf8 -*
#
# Max E. Kuznecov ~syhpoon <syhpoon@syhpoon.name> 2008
#
# This file is part of XYZCommander.
# XYZCommander is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the Licens... |
#!/usr/bin/python3
import os.path
from kivy.resources import resource_add_path
KV_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__)))
resource_add_path(KV_PATH)
print(KV_PATH)
#import kivy
#kivy.require('1.7.1')
from kivy.lang import Builder
Builder.load_file('H808E.kv')
from kivy.app import App
from kiv... |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
# Copyright 2017, National University of Ireland and The James Hutton Insitute
# Author: Nicholas Waters
#
# This code is part of the riboSeed package, and is governed by its licence.
# Please see the LICENSE file that should have been included as part of
# this package.
"... |
import errno
import os
import socket
import sys
import time
import warnings
import eventlet
from eventlet.hubs import trampoline, notify_opened, IOClosed
from eventlet.support import get_errno, six
__all__ = [
'GreenSocket', '_GLOBAL_DEFAULT_TIMEOUT', 'set_nonblocking',
'SOCKET_BLOCKING', 'SOCKET_CLOSED', 'CO... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# fix these up
import os, stat, mimetypes
import django
from django.utils.http import http_date
from django.conf import settings
from django.contrib.staticfiles import finders
import logging
logger = logging.getLogger('splunk')
class BlockIterator(object):
# Vlada Mac... |
__author__ = 'hiroki'
import numpy as np
import theano
import theano.tensor as T
from nn_utils import sigmoid, tanh, sample_weights
class LSTM(object):
def __init__(self,
w,
d,
n_layer,
vocab_size,
n_in,
n_hid... |
## Copyright (C) 2012 by Kevin L. Mitchell <klmitch@mit.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 3 of the
## License, or (at your option) any later version.
##
#... |
# @lint-avoid-pyflakes2
# @lint-avoid-python-3-compatibility-imports
import asyncio
import functools
import logging
from io import BytesIO
import struct
import warnings
from .TServer import TServer, TServerEventHandler, TConnectionContext
from thrift.Thrift import TProcessor
from thrift.transport.TTransport import TM... |
import numpy as np
from .Geometry import Geometry
class Solver:
geometry: Geometry
V = np.zeros((1,))
M = np.zeros((1,))
T = np.zeros((1,))
def __init__(self, geometry: Geometry):
self.geometry = geometry
self.V = np.zeros((geometry.axle.size,))
self.M = np.zeros((geometr... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
# Copyright (c) 2015 Intel Corporation
#
# 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 ... |
#! /usr/bin/env python3
import sys, os
import unittest
import yaml
import json
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import tammy
class PeerJ(unittest.TestCase):
def test_pubtype(self):
self.assertRaises(ValueError, tammy.from_peerj, 200, 'paper')
def test_argtype(self):
... |
#coding:utf8
import sys
import traceback
import os
from aliyunsdkcore.client import AcsClient
from aliyunsdkros.request.v20150901 import DescribeRegionsRequest, CreateStacksRequest
from aliyunsdkros.request.v20150901 import DescribeResourcesRequest
from aliyunsdkros.request.v20150901 import DeleteStackRequest
from aliy... |
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponseRedirect, Http404
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django... |
#!/data/project/nullzerobot/python/bin/python
from flask.ext.wtf import Form
import wtforms.validators as v
from wtforms import TextField, TextAreaField, HiddenField, SubmitField
from messages import msg
class WikiTranslatorForm(Form):
pass
def getForm():
FormCl = WikiTranslatorForm
FormCl.title = TextFi... |
import os
import sys
from pathlib import Path
import pytest
from betamax import Betamax
from flask_dance.consumer.storage import MemoryStorage
from flask_dance.contrib.google import google
toplevel = Path(__file__).parent.parent
sys.path.insert(0, str(toplevel))
from google import app as flask_app, google_bp
GOOGLE... |
from typing import List, Set, Dict, Union, TextIO
import arrow
import datetime
from .data import Region, Queue, Season, Tier, Division, Position
from .core import Champion, Summoner, ChampionMastery, Rune, Item, Match, Map, SummonerSpell, Realms, ProfileIcon, LanguageStrings, CurrentMatch, ShardStatus, Versions, Match... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import unittest
from web import users_rest, home
from mock import Mock
from usuario.model import Usuario
from make_test import prepare_to_test
class IntegrationTests(unittest.TestCase):
def setUp(self):
prepare_to_test()
... |
import sys
from math import log, ceil
def set_config(rounds, teams, closeness, slots):
global NUMROUNDS, NUMTEAMS, CLOSENESS, NUMSLOTS
NUMROUNDS = rounds # How many rounds to schedule in the competition
NUMTEAMS = teams # The number of teams taking part
CLOSENESS = closeness # Minimum number... |
# -*- coding: utf-8 -*-
#
# AWL simulator - System-blocks
#
# Copyright 2012-2015 Michael Buesch <m@bues.ch>
#
# 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... |
# encoding: utf-8
"""
@author: gallupliu
@contact: gallup-liu@hotmail.com
@version: 1.0
@license: Apache Licence
@file: models.py
@time: 2018/1/12 23:19
"""
from data.util import unique_items
class MetadataItem(object):
def __init__(self):
self.metadata = dict()
class Token(MetadataItem):
def _... |
#!/usr/bin/python
import os
import subprocess as sp
import shutil as sh
import argparse
parser = argparse.ArgumentParser(
description = 'Copies and converts drawio XML and PDF files from Dropbox'
)
parser.add_argument('-s', '--src_dir',
help = 'The src directory containing the drawio XML and PDF files',
d... |
from django.core.exceptions import ObjectDoesNotExist, SuspiciousFileOperation
from rest_framework import exceptions
import os
from app import models
def get_and_check_project(request, project_pk, perms=('view_project',)):
"""
Django comes with a standard `model level` permission system. You can
check whe... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) The James Hutton Institute 2016-2019
# (c) University of Strathclyde 2019-2020
# Author: Leighton Pritchard
#
# Contact:
# leighton.pritchard@strath.ac.uk
#
# Leighton Pritchard,
# Strathclyde Institute for Pharmacy and Biomedical Sciences,
# 161 Cathedral Street,
# ... |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# 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
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.