src stringlengths 721 1.04M |
|---|
# encoding=utf8
import datetime
from distutils.version import StrictVersion
import hashlib
import os.path
import random
from seesaw.config import realize, NumberConfigValue
from seesaw.externalprocess import ExternalProcess
from seesaw.item import ItemInterpolation, ItemValue
from seesaw.task import SimpleTask, LimitCo... |
# -*- coding: utf-8 -*-
# Copyright (C) 2009 Rocky Bernstein
#
# 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 vers... |
#
# ArgParser.py
#
# by Victor Hanson-Smith
# victorhansonsmith@gmail.com
#
# This is a super useful class to include in your Python project that
# needs many command-line options passed to the program.
#
# Usage in your code:
#
# 1. Instantiate an instance of this class:
# ap = ArgParser(sys.argv)
#
# 2.... |
#!/usr/bin/env python
# encoding: utf-8
#
# partially based on boost.py written by Gernot Vormayr
# written by Ruediger Sonderfeld <ruediger@c-plusplus.de>, 2008
# modified by Bjoern Michaelsen, 2008
# modified by Luca Fossati, 2008
# rewritten for waf 1.5.1, Thomas Nagy, 2008
# rewritten for waf 1.6.2, Sylvain Rouquet... |
#
# GingaQt.py -- Qt display handler for the Ginga FITS tool.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
# stdlib imports
import sys, os
import traceback
# TEMP:
i... |
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
import watson.routing
name = 'watson-routing'
description = 'Process and route HTTP Request messages.'
version = watson.routing.__version__
def read(filename, as_list=False):
with open(os.path.join(os.path.dirname(__file__), filename))... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import unittest
from nepalicalendar import TITHIS, NepDate, NepCal
from datetime import date, timedelta
from random import randint
class TithisTestCase(unittest.TestCase):
"""
Test case for the tithis
"... |
# Copyright (C) 2017,2018,2019,2020 Luiz Felippe S. Rodrigues <luizfelippesr@alumni.usp.br>
#
# This file is part of GalMag.
#
# GalMag 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 L... |
# -*- coding: utf-8 -*-
import logging
import os
from courses.models import Course
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from groups.models import Group
from mail.models import Message
from users.model_user_status import UserStatus
from... |
# -*- coding: UTF-8 -*-
import unittest
from geopy.compat import u
from geopy.point import Point
from geopy.geocoders import Photon
from test.geocoders.util import GeocoderTestBase
class PhotonTestCase(GeocoderTestBase): # pylint: disable=R0904,C0111
@classmethod
def setUpClass(cls):
cls.geocoder =... |
import os.path
import paste.fileapp
from pylons.middleware import error_document_template, media_path
from eyvind.lib.base import *
class ErrorController(BaseController):
"""Generates error documents as and when they are required.
The ErrorDocuments middleware forwards to ErrorController when error
rela... |
# -*- coding: utf-8 -*-
"""
Copyright 2016 Randal S. Olson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import argparse
import codecs
import logging
import os
import os.path
import re
import shutil
import subprocess
import sys
import t... |
# -*- coding: utf-8 -*-
#
# 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
#... |
from gradient_descent import get_data
def select_data():
done = False
while not done:
try:
print('Select input data set:')
print(' 1 Mars half year')
print(' 2 Mars full (whole year measured every Earth month)')
print(' 3 Mars small (every fourth... |
"""
Pycrust
A collection of CherryPy extensions
See also the following submodules:
pycrust.auth
pycrust.saplugin
pycrust.satool
pycrust.tools
"""
__author__ = 'Michael Stella <pycrust@thismetalsky.org>'
__version__ = '1.0.0'
import inspect, logging, os, sys
import cherrypy
import codecs
class Ba... |
import mdtraj as md
import numpy as np
from . import Featurizer, TrajFeatureUnion
class BaseSubsetFeaturizer(Featurizer):
"""Base class for featurizers that have a subset of active features.
n_features refers to the number of active features. n_max refers to the
number of possible features.
Paramet... |
from __future__ import print_function
import numpy as np
import cntk
from cntk.ops.functions import load_model
def LoadData(fn,is_training):
n=".\\Data\\"+fn
datainp=cntk.io.StreamDef("features",30)
dataout=cntk.io.StreamDef("labels",4)
dataall=cntk.io.StreamDefs(features=datainp,labels=dataout)
st... |
import lapie
import pickle
import sys
def main():
udb = sys.argv[1]
# Get actual routed path using Tcl
nets = lapie.list_nets(udb)
routing = lapie.get_routing(udb, nets)
# (source, sink) -> pips
arc2pips = {}
# Keep track of fanout - we'll need this later!
wire_fanout = {}
for ne... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = '7sDream'
from .common import *
class Topic:
"""答案类,请使用``ZhihuClient.topic``方法构造对象."""
@class_common_init(re_topic_url)
def __init__(self, url, name=None, session=None):
"""创建话题类实例.
:param url: 话题url
:param name: 话题名称... |
# Dormbase -- open-source dormitory database system
# Copyright (C) 2012 Alex Chernyakhovsky <achernya@mit.edu>
# Drew Dennison <dennison@mit.edu>
# Isaac Evans <ine@mit.edu>
# Luke O'Malley <omalley1@mit.edu>
#
# This program is free software... |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Analysis Preservation Framework.
# Copyright (C) 2020 CERN.
#
# CERN Analysis Preservation Framework 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... |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
from enum import Enum
import scrapy
class MemberofParliament(scrapy.Item):
"""
Data structure to define Member of Parliament information
"""
mp_id = s... |
# Chopper is a diagnostic tool that explores file systems for unexpected
# behaviors. For more details, see paper Reducing File System Tail
# Latencies With Chopper (http://research.cs.wisc.edu/adsl/Publications/).
#
# Please send bug reports and questions to jhe@cs.wisc.edu.
#
# Written by Jun He at University of Wis... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-08-12 01:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('medgointranet', '0024_especialidaddoctor_is_doctor'),
]
operations = [
migr... |
# Copyright 2016 Nathan Sommer and Ben Coleman
#
# 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.
#
# This program is dis... |
# Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
# ==============================================================================
# Hivent represents a significant historical happening (historical event).
# It is the only representation of the temporal dimension in the data model
# and therefore the main organisational dimension.
# An Hivent may contain one or many E... |
import logging
import rdflib
import sys
from pyramid.threadlocal import get_current_request
from pyramid.events import subscriber
from pyramid.events import BeforeRender
log = logging.getLogger(__name__)
class Cleanup:
def __init__(self, request):
self.request = request
def __del__(self):
pa... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import datetime as dt
from autoslug import AutoSlugField
from autoslug.utils import slugify
from django.core.exceptions import ValidationError
from django.db import models
from django.template.defaultfilters import trunca... |
#!/usr/bin/python
# coding: UTF-8
# Driver for Winstar WEH001602A 16x2 OLED display on the RPi
# Written by: Ron Ritchey
# Derived from Lardconcepts
# https://gist.github.com/lardconcepts/4947360
# Which was also drived from Adafruit
# http://forums.adafruit.com/viewtopic.php?f=8&t=29207&start=15#p163445
#
# Ultimatel... |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2016
# Leandro Toledo de Souza <leandrotoledodesouza@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# th... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-21 02:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('organizer', '0001_initial'),
]
operations = [
migration... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
#!/usr/bin/python
"""
PyMOL plugin that provides show_contacts command and GUI
for highlighting good and bad polar contacts.
Factored out of clustermols by Matthew Baumgartner.
The advantage of this package is it requires many fewer dependencies.
Modified: Marcin Magnus 2020
Source <https://pymolwiki.org/index.p... |
# 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 ... |
#
# Copyright 2012-2014 John Whitlock
#
# 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 pyvex
from .s_errors import SimSlicerError
class SimSlicer(object):
"""
A super lightweight single-IRSB slicing class.
"""
def __init__(self, statements, target_tmps=None, target_regs=None, inslice_callback=None, inslice_callback_infodict=None):
self._statements = statements
se... |
"""
Functions to read your force and event data
"""
__author__ = 'Oliver Lindemann'
import os
import sys
import gzip
from collections import OrderedDict
import numpy as np
TAG_COMMENTS = "#"
TAG_UDPDATA = TAG_COMMENTS + "UDP"
TAG_DAQEVENTS = TAG_COMMENTS + "T"
def _csv(line):
return list(map(lambda x: x.strip(... |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... |
# Copyright 2019, OpenCensus Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
# Copyright 2018 SAS Project 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 requ... |
import sys
__author__ = 'Will Hart'
from collections import OrderedDict
class DataContainer(object):
"""
A class for saving and managing data that can be used in the interface. It
also provides an interface for adding DataTransform objects which can be used
to apply filters (i.e. moving average, mu... |
"""empty message
Revision ID: 15045c53040
Revises: 80bab4f8ff
Create Date: 2016-01-07 10:21:05.812275
"""
# revision identifiers, used by Alembic.
revision = '15045c53040'
down_revision = '80bab4f8ff'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2006 ACYSOS S.L. (http://acysos.com)
# Pedro Tarrafeta <pedro@acysos.com>
# Copyright (c) 2008 Pablo Rocandio. All Rights Res... |
"""we_are_social URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cl... |
#This program is distributed WITHOUT ANY WARRANTY; without even the implied
#warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
#
#This file contains a Python version of Carl Rasmussen's Matlab-function
#minimize.m
#
#minimize.m is copyright (C) 1999 - 2006, Carl Edward Rasmussen.
#Python adaptation ... |
import os
from acceptance_tests.utils import str2bool
ACCESS_TOKEN = os.environ.get('ACCESS_TOKEN')
if ACCESS_TOKEN is None:
raise RuntimeError('A valid OAuth2 access token is required.')
HONOR_COURSE_ID = os.environ.get('HONOR_COURSE_ID')
VERIFIED_COURSE_ID = os.environ.get('VERIFIED_COURSE_ID')
if not all([HON... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from .mininode import *
from .blockstore import BlockStore, TxStore
from .util import p2p_port
'''
This ... |
from datetime import datetime
from hjlog import db
# Tag helper table
tags = db.Table(
'tags',
db.Column('tag_id', db.Integer, db.ForeignKey('tag.id')),
db.Column('post_id', db.Integer, db.ForeignKey('post.id')))
class Post(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Colum... |
# -*- coding: utf8 -*-
# XML Helper for GEdit
#
# Copyright (c) 2007 Matej Cepl <matej@ceplovi.cz>
# Additional Author : Ajith Sen G. S. <ajithsengs@gmail.com>
# Additional Author : Oliver Sauder <os@esite.ch>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
:copyright: (c) 2008-2017 Sigasi
:license: BSD, see LICENSE for more details.
"""
import os
from SigasiProjectCreator.ArgsAndFileParser import ArgsAndFileParser
from SigasiProjectCreator.Creator import SigasiProjectCreator
from SigasiProjectCreator import VhdlVersi... |
# encoding=utf8
import datetime
from distutils.version import StrictVersion
import hashlib
import os.path
import random
from seesaw.config import realize, NumberConfigValue
from seesaw.item import ItemInterpolation, ItemValue
from seesaw.task import SimpleTask, LimitConcurrent
from seesaw.tracker import GetItemFromTrac... |
#!/usr/bin/env python
import sqlite3
import argparse
import sys
import time
from player_class import Player, Fore, randint
from bot_player_class import BotPlayer
from dealer_class import Dealer
from deck_class import Deck
"""
Global Game Functions
"""
def create_players(p, bots, minimum, maximum):
""" Create and ap... |
__author__ = "Jon Dawson"
__copyright__ = "Copyright (C) 2012, Jonathan P Dawson"
__version__ = "0.1"
import os.path
import subprocess
from chips.compiler.exceptions import C2CHIPError
operators = [
"!", "~", "+", "-", "*", "/", "//", "%", "=", "==", "<", ">", "<=", ">=",
"!=", "|", "&", "^", "||", "&&", "("... |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 13 17:29:27 2011
@author: Ashley Milsted
TODO:
- Clean up CG code: Create nice interface?
- Split out excitations stuff?
"""
import numpy as np
import scipy as sp
import scipy.linalg as la
import scipy.sparse.linalg as las
import scipy.optimize as opti
import td... |
import gensim
import sys
import collections
import codecs
import re
import math
from copy import deepcopy
bins = 100
def compare(models):
words = {}
counts = {}
sim = {}
rel = {}
for i in range(len(models)):
models[i] = gensim.models.Word2Vec.load_word2vec_format(
models[i], b... |
#!/usr/bin/env python
# -*- coding: latin-1; py-indent-offset:4 -*-
################################################################################
#
# Copyright (C) 2014 Daniel Rodriguez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Lice... |
import json
import sys
civs = ['Greek', 'Egyptian', 'Norse', 'Atlantean']
resources = {'F': 'food', 'G': 'gold', 'W': 'wood', 'Fv': 'favor'}
units = []
for civ in civs:
f = open('CSV/' + civ + '-Table 1.csv', 'r')
print "Parsing", civ
# Top Header
for i in range(3):
f.readline()
columns = f.readline... |
# (C) Fractal Industries, Inc. 2016
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# project
from utils.service_discovery.abstract_config_store import AbstractConfigStore
from utils.service_discovery.abstract_config_store import CONFIG_FROM_AUTOCONF, CONFIG_FR... |
#!/usr/bin/python3.3
# coding=utf-8
"""
Module for K nearest neighbours.
"""
__author__ = 'Hossein Noroozpour Thany Abady'
#from math3d import sqrt
import numpy
class HNearestNeighboursClassifier():
"""
Class for K nearest neighbors algorithm.
"""
def __init__(self, n_neighbors=5, weight_function=l... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Load required packages
from psychopy import core, event, misc
from iViewXAPI import*
from iViewXAPIReturnCodes import*
import threading
import my_Ring_Buffer as my_rb
import datetime
import numpy as np
epoch = datetime.datetime(2015, 9, 1, 2)
... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script to setup the environment to run unit tests.
Modifies PYTHONPATH to automatically include parent, common and pylibs
directories.
"""
import os... |
import libtcodpy as libtcod
import math
from random import randrange
import time
import pprint
pp = pprint.PrettyPrinter(indent=4, width=200).pprint
from planet import Planet
from asteroid import Asteroid
class Sector:
def __init__(self, screen_width, screen_height, buffer, background=libtcod.Color(0,0,0)):
... |
import maya.OpenMayaUI as apiUI
from PySide2.QtGui import *
from PySide2.QtCore import *
from PySide2.QtWidgets import *
import shiboken2 as shiboken
def getMayaWin():
ptr = apiUI.MQtUtil.mainWindow()
if ptr is not None:
return shiboken.wrapInstance(long(ptr), QWidget)
class ProgressBarUI(QWidget):
... |
#########################################################
# md5crypt.py
#
# 0423.2000 by michal wallace http://www.sabren.com/
# based on perl's Crypt::PasswdMD5 by Luis Munoz (lem@cantv.net)
# based on /usr/src/libcrypt/crypt.c from FreeBSD 2.2.5-RELEASE
#
# MANY THANKS TO
#
# Carey Evans - http://home.clear.net.nz/p... |
import collections
import datetime
import itertools
import sqlalchemy as sa
import traceback
import tqdm
from databot.db.serializers import serrow, serkey
from databot.db.utils import strip_prefix, create_row, get_or_create, Row
from databot.db.windowedquery import windowed_query
from databot.db.models import Compress... |
import time
def _rcall_recieve(payload):
payload = eval(payload)
function = globals()[payload['function']]
callback = payload['callback']
args = payload['payload'][0]
kwargs = payload['payload'][1]
response = function(*args, **kwargs)
if callback:
if type(response) == tuple:
... |
"""Classes to aid in working with the STIX2 patterning language."""
import base64
import binascii
import datetime
import re
from .utils import parse_into_datetime
def escape_quotes_and_backslashes(s):
return s.replace(u'\\', u'\\\\').replace(u"'", u"\\'")
def quote_if_needed(x):
if isinstance(x, str):
... |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.building.DistributedPetshopInterior
from direct.distributed.DistributedObject import DistributedObject
from direct.actor.Actor import Actor
from RandomBuilding import RandomBuilding
class DistributedPetshopInterior(DistributedObject, RandomBuildi... |
import math
class Primes:
"""
Sieve of Eratosthenes is a simple algorithm for finding all prime
numbers up to any given limit with O(n log log n).
https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
"""
def __init__(self, n=2):
self.__frontier = [False, False]
sel... |
from django.conf.urls.defaults import *
from staste.charts.views import PieChart, TimeserieChart, LatestCountAndAverageChart
from staste.middleware import response_time_metrica
from .views import IndexView
from .metrics import gender_age_metrica
urlpatterns = patterns('',
url(r'^$', IndexView... |
import numpy as np
import GPy
from mcmcGP import BinnedPoisson, GPMCMC, SGPMCMC, HMC, AHMC
from itertools import product
from IPython import embed
from scipy.cluster.vq import kmeans
import pyhmc
def load_pines():
X = np.load('pines.np')
return X
def build_vb(initialZ, binMids, binSize, counts, seed):
... |
from tkinter import *
def fib(n):
a, b = 0, 1
for i in range(n):
a, b = b, a+b
return a
class App(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.entry_n = Entry(self, width=10)
self.entry_n.pack(... |
"""
Write a program to find the node at which the intersection of two singly linked lists begins.
For example, the following two linked lists:
A: a1 → a2
↘
c1 → c2 → c3
↗
B: b1 → b2 → b3
begin to intersect at node c1.
Notes:
I... |
from django.conf import settings
class EmailOtoConfig(object):
def __init__(self):
"""Read from settings.py and apply defaults (or raise exceptions.)"""
self.redis_host = settings.EMAILOTO.get('redis_host', 'localhost')
self.redis_port = settings.EMAILOTO.get('redis_port', 6379)
... |
"""
tutorial3.py
by E. Dennison
"""
from ggame import App, RectangleAsset, ImageAsset, SoundAsset
from ggame import LineStyle, Color, Sprite, Sound
myapp = App()
# define colors and line style
green = Color(0x00ff00, 1)
black = Color(0, 1)
noline = LineStyle(0, black)
# a rectangle asset and sprite to use as backgroun... |
"""The Netatmo data handler."""
from collections import deque
from datetime import timedelta
from functools import partial
from itertools import islice
import logging
from time import time
from typing import Deque, Dict, List
import pyatmo
from homeassistant.config_entries import ConfigEntry
from homeassistant.core i... |
from django.db.models.fields.related import ReverseSingleRelatedObjectDescriptor, SingleRelatedObjectDescriptor, \
ForeignRelatedObjectsDescriptor, ManyRelatedObjectsDescriptor, ReverseManyRelatedObjectsDescriptor
def _construct_graph(parent_type, child_type, via, is_collection, property_name):
return {
... |
# coding: utf-8
#!/usr/bin/env python
# encoding: utf-8
"""
appStore.py
Created by peter on 2010-03-29.
Copyright (c) 2010 __maweis.com__. All rights reserved.
"""
import re
import urllib
import os
import json
import time
class SinaRead():
def get_book_title(self,html):
title = re.findall(r'<h1>(.*?)</h1... |
# -*- coding: utf-8 -*-
"""PyCTD loads all CTD content in the database. Content is available via functions."""
import configparser
import gzip
import io
import logging
import os
import re
import sys
import time
from configparser import RawConfigParser
import numpy as np
import pandas as pd
from requests.compat impor... |
# _ GGLlistRule1.py ______________________________________________________
# Simple Graph Grammar rule for inserting an element in the list
# _______________________________________________________________________
from GGrule import *
from ASG_LinkedListMM import *
from Element import *
from B... |
#!/usr/bin/env python
import urllib
import json
import os
import sys
from flask import Flask
from flask import request
from flask import make_response
# Flask app should start in global layout
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
req = request.get_json(silent=True, forc... |
"""Tests for the Device Registry."""
import time
from unittest.mock import patch
import pytest
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
from homeassistant.core import CoreState, callback
from homeassistant.helpers import device_registry, entity_registry
from tests.common import MockConfigEntry, fl... |
# 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... |
# coding: utf-8
""" Port of NAFF to Python """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import time
# Third-party
from astropy import log as logger
import numpy as np
from numpy.fft import fftfreq
# try:
# import pyfftw
# HAS_PYFFTW = ... |
# 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 ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import shutil
import time
import pexpect
from . import watch, log
class RemoteLogger:
PROMPT = "[#$%>]"
TIMEOUT_EXPECT = 20
TIMEOUT_LOGGING = 30
TIMEOUT_MOVE = 30
def __init__(self, params):
"""
constructor
... |
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
__author__ = 'aarongary'
class SearchResultModel():
def __init__(self):
self.clusterNodeName = ''
self.searchTab = ''
self.geneScoreRangeMax = 100
self.geneSuperList = []
self.items = []
self.geneScoreRangeStep = 0.1
self.geneScoreRangeMin = 5
self.se... |
# Copyright 2015 IBM Corp. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) Copyright 2013 to 2017 University of Manchester
#
# HydraPlatform 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... |
# F3AT - Flumotion Asynchronous Autonomous Agent Toolkit
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
# 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... |
# pyNFC_Util.py
"""
definition module for some pyNFC utility classes
"""
import numpy as np
class NFC_Halo_Data_Organizer(object):
"""
collect and organize how halo data will be organized prior to communication
"""
def __init__(self,ngb_rank):
"""
constructor
"""
s... |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HSS3_then2_IsolatedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HSS3_then2_IsolatedLHS.
"""
# Flag this instanc... |
'''
Created on 2016
@author: Graham Reid
Builds a 2-gram vectorizer using scikit learn count vectorizer. Only really
interesting thing here is that I didn't concatenate all of the fields together.
This helps to preserve context.
'''
import random
import pickle
import numpy as np
from sklearn.feature_extraction.text ... |
# -*- coding: utf-8 -*-
"""\
This file contains functions to stress-test natsort, looking
for cases that raise an unknown exception.
"""
from random import randint, sample, choice
from string import printable
from copy import copy
from pytest import fail
from natsort import natsorted
from natsort.compat.py23 import py2... |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Tests the EventAdmin shell commands
:author: Thomas Calmant
"""
# Standard library
import threading
try:
import unittest2 as unittest
except ImportError:
import unittest
# Pelix
from pelix.ipopo.constants import use_ipopo
import pelix.framework
import... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""will allow you to get a console and enter commands within your flask environment.
Maybe not as nice as debugging with pdb, but always useful (when you will initialize your database).
Credits : https://github.com/mitsuhiko/flask/wiki/Large-app-how-to
"""
__license__ = """... |
###############################
## Global KNN Implementation ##
###############################
### Import Python Libraries ###
import pandas as pd
from pandas import DataFrame
from numpy import array, matrix
### Import R Libraries ###
import rpy2.robjects as R
from rpy2.robjects.packages import importr
from rpy2.rob... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.