src stringlengths 721 1.04M |
|---|
from datetime import datetime
import logging
from django.core.urlresolvers import reverse
from django.utils import html
from django.utils.translation import ugettext as _, ugettext_noop
import json
from corehq.apps.api.es import ReportCaseES
from corehq.apps.cloudcare.api import get_cloudcare_app, get_cloudcare_form_... |
#!/usr/bin/python
# Copyright (c) 2008,2010,2011,2012,2013 Alexander Belchenko
# 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 cop... |
# -*- coding: utf-8 -*-
"""
Local working copy runtime environment control.
---
type:
python_module
validation_level:
v00_minimum
protection:
k00_public
copyright:
"Copyright 2016 High Integrity Artificial Intelligence Systems"
license:
"Licensed under the Apache License, Version 2.0 (the Licen... |
import fechbase
class Records(fechbase.RecordsBase):
def __init__(self):
fechbase.RecordsBase.__init__(self)
self.fields = [
{'name': 'FORM TYPE', 'number': '1'},
{'name': 'FEC COMMITTEE ID NUMBER', 'number': '2'},
{'name': 'CONTRIB/LENDER', 'number': '3-'},
... |
'''
Set the alsa mixer volume level
'''
import os
import glob
import subprocess
class Volume(object):
def __init__(self, wd):
self.wd = wd
self.setVolume(create=True)
def setVolume(self, create=False):
volFile = os.path.join(self.wd, "Sounds", "Volume", "Level.txt")
if glob... |
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
# -*- encoding:utf-8 -*-
"""
日内滑点买入价格决策基础模块:暂时迁移简单实现方式,符合回测需求,如迁移实盘模块
需添加日内择时策略,通过日内分钟k线,实现日内分钟k线择时,更微观的
实现日内择时滑点功能,不考虑大资金的冲击成本及系统外的大幅滑点
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from abc import ABCMeta, abstractmethod
import functools... |
from botocore.exceptions import ClientError
class VPCPeeringRoutes(object):
def __init__(self, vpc1, vpc2,
vpc_peering_relationship,
ec2_gateways, logger):
self.vpc1 = vpc1
self.vpc2 = vpc2
self.vpc_peering_relationship = vpc_peering_relationship
s... |
from django.conf.urls import include, patterns, url
from . import views
# These views all start with user ID.
user_patterns = patterns(
'',
url(r'^summary$', views.user_summary,
name='lookup.user_summary'),
url(r'^purchases$', views.user_purchases,
name='lookup.user_purchases'),
url(r... |
import exceptions as exc
import glob
import shutil
import sys
import time
from logger import logger
from perfrunner.helpers.cbmonitor import CbAgent
from perfrunner.helpers.experiments import ExperimentHelper
from perfrunner.helpers.memcached import MemcachedHelper
from perfrunner.helpers.metrics import MetricHelper
... |
"""Test of the demo file demos/ebeam/csr_ex.py"""
import os
import sys
import copy
import time
FILE_DIR = os.path.dirname(os.path.abspath(__file__))
REF_RES_DIR = FILE_DIR + '/ref_results/'
from unit_tests.params import *
from acc_utils_conf import *
def test_lattice_transfer_map(lattice, p_array, parameter=None, ... |
"""
TransferFns: accept and modify a 2d array
"""
import numpy
import copy
import param
class TransferFn(param.Parameterized):
"""
Function object to modify a matrix in place, e.g. for normalization.
Used for transforming an array of intermediate results into a
final version, by cropping it, normali... |
u'''
Created on Oct 3, 2010
This module is Arelle's controller in command line non-interactive mode
(This module can be a pattern for custom integration of Arelle into an application.)
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
from arelle import Pyt... |
"""Tests for availability of ``pyPdf``.
Written by Jesse Bloom, 2013.
"""
import sys
import unittest
import mapmuts.weblogo
class TestPyPdfAvailable(unittest.TestCase):
"""Tests for availability of ``pyPdf``."""
def test_Import(self):
"""Is ``pyPdf`` available?
"""
sys.stderr.write(... |
# -*- encoding: utf-8 -*-
__author__ = 'kotaimen'
__date__ = '5/29/14'
"""
georest.geo.feature
~~~~~~~~~~~~~~~~~~~
Geo Feature object
"""
import copy
import six
import shapely.geometry.base
import geojson.base
from . import jsonhelper as json
from .key import Key
from .geometry import Geometry
from .s... |
from __future__ import division
import sys
import math
class Point2D(object):
def __init__(self, x, y):
self.x = x
self.y = y
def square_distance(self, other_point):
""" Calculates the square distance between this Point2D and another Point2D
:param other_point: The other Poin... |
from django.core.mail import EmailMessage
class BaseCondition(object):
def __init__(self, **kwargs):
self.params = kwargs
def __call__(self, message):
if not isinstance(message, (EmailMessage, )):
raise TypeError('%r is not a subclass of django.core.mail.EmailMessage' % message)
... |
# Задание 7. Вариант 25.
# Разработайте систему начисления очков для задачи 6, в соответствии с
# которой игрок получал бы большее количество баллов за меньшее количество
# попыток.
# Цивунчик Денис Владимирович
# 27.05.2016
import random
guessesTaken = 0
print("Привет, отгадай один из четрыех океанов Земли.")
x = r... |
from .model import Model
from ... import describe
def _init_to_one(W, ops):
W.fill(1.)
def _run_child_hooks(model, X, y=None):
for hook in model.child.on_data_hooks:
hook(model.child, X, y)
@describe.on_data(_run_child_hooks)
@describe.attributes(
G=describe.Weights("Scaling vector",
la... |
# -*- coding: utf-8 -*-
from __future__ import print_function
"""
Module for communication with subscription-manager, part of virt-who
Copyright (C) 2011 Radek Novacek <rnovacek@redhat.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as pub... |
from __future__ import print_function
import PyFBA
import copy
import sys
from os.path import basename
class Model:
"""
A model is a structured collection of reactions, compounds, and functional roles.
A model will provide methods for extracting its information and creating SBML-formatted files.
:iva... |
from nappingcat.util import import_module
from nappingcat import config
class AuthBackend(object):
def __init__(self, settings):
self.users = {}
self.settings = settings
self.require_update = False
def has_permission(self, user, permission):
full_query = (user,) + tuple(permiss... |
#!/usr/bin/python2.5
"""
This application converts the various text files stored in the source-data
directory into a pickled python object to be used by the random data
generator scripts
Copyright (C) 2007 Chris Moffitt
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU... |
import re
from markdown.blockprocessors import BlockQuoteProcessor
from markdown import Extension
import logging
logger = logging.getLogger('MARKDOWN.quote_by')
class QuoteByProcessor(BlockQuoteProcessor):
BY_RE = re.compile(r'(?P<pre>[ ]{0,3}>[ ]*)'
r'(-- ?|—— ?)'
r... |
# Copyright 2012-2017 Jonathan Vasquez <jon@xyinn.org>
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the fol... |
#!/usr/bin/env python
# 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 agre... |
from django.urls import resolve
from django.test import TestCase
class AtlasUrlTestCase(TestCase):
def test_all_concepts(self):
found = resolve('/concepts')
self.assertEqual(found.view_name, 'all_concepts')
def test_all_tasks(self):
found = resolve('/tasks')
self.assertEqual(f... |
import json
from models import Character, User, Draft, DraftTicket, Episode, DraftHistory, Rubric, Score
from sqlalchemy import or_, exc
from sqlalchemy.orm import lazyload
from datetime import timedelta, datetime
import pandas as pd
import numpy as np
def handle_event(msg_type, msg, db_session=None):
print("hand... |
'''
Copyleft Oct 10, 2015 Arya Iranmehr, PhD Student, Bafna's Lab, UC San Diego, Email: airanmehr@gmail.com
'''
import numpy as np
import pandas as pd
import os,sys;home=os.path.expanduser('~') +'/'
class Data:
@staticmethod
def read(param):
"""
data is sorted first by Chrom and then POS i... |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def convertBST(self, root):
"""
:type root: TreeNode
:rtype: TreeNode
"""
if not ... |
import sys, shutil
sys.path.insert(1, "../../../")
import h2o, tests
def cars_checkpoint(ip,port):
cars = h2o.upload_file(h2o.locate("smalldata/junit/cars_20mpg.csv"))
predictors = ["displacement","power","weight","acceleration","year"]
response_col = "economy"
# build first model
model1 = h2o.ra... |
"Tests for the leg bridging code"
from twisted.trial import unittest
import twisted.trial.util
from twisted.internet import defer
from shtoom.doug.leg import Bridge, BridgeSource, Leg
class FakeLegForBridging:
def _connectSource(self, source):
source.leg = self
self.source = source
def _sourc... |
from keras.models import Sequential, Graph, Model, model_from_json
from keras.layers import Dense, Dropout, Activation, Merge, Input, merge, Flatten
from keras.layers.recurrent import GRU
from keras.callbacks import Callback,ModelCheckpoint
from keras.layers.embeddings import Embedding
import numpy as np
import sys
imp... |
from PyQt5.QtCore import QAbstractListModel, Qt, QModelIndex
from PyQt5.QtGui import QFont
from urh import constants
from urh.plugins import Plugin
class PluginListModel(QAbstractListModel):
def __init__(self, plugins, highlighted_plugins = None, parent=None):
"""
:type plugins: list of Plugin
... |
# -*- coding: utf-8 -*-
from django.core.exceptions import ImproperlyConfigured
from django.http.response import HttpResponseRedirect
from django.template import loader
from django.utils.translation import ugettext as _
from .utils import HtmlEmailSender
from ..base import SmartView as View
class EmailTemplateRender... |
from .. import ServiceConstants
class Sigv4ServiceConstants(ServiceConstants):
"""Logical grouping of Signature Version 4 service constants
This class sets the appropriate Signature v4 specific parameters required
for signing.
"""
# Minimum required headers for signature v4 signed requests
__R... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Andrew Bogott for the Wikimedia Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache... |
"""
from dinput.h
"""
dinput_key_codes = {
"BACKSPACE": 0x0E,
"TAB": 0x0F,
"CLEAR": 0, # FIXME
"RETURN": 0x1C,
"PAUSE": 0, # FIXME
"ESCAPE": 0x01,
"SPACE": 0x39,
"EXCLAIM": 0, # FIXME
"QUOTEDBL": 0, # FIXME
"HASH": 0, # FIXME
"DOLLAR": 0, # FIXME
"AMPERSAND": 0, #... |
import os
from datetime import timedelta
import logging
from celery import Celery
from celery._state import set_default_app
from celery.task import task
from django.core.mail import EmailMessage
from django.core.urlresolvers import reverse
from cabot.cabotapp.models import Schedule, StatusCheckResultTag, StatusCheckR... |
# Copyright (c) 2008, Aldo Cortesi. All rights reserved.
#
# 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,... |
#!/usr/bin/python
#-*-coding:Utf-8 -*
# TheSecretTower
# Copyright (C) 2011 Pierre SURPLY
#
# This file is part of TheSecretTower.
#
# TheSecretTower 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 Foun... |
import vtk, qt, slicer
class AbstractEffect():
"""
One instance of this will be created per-view when the effect
is selected. It is responsible for implementing feedback and
label map changes in response to user input.
This class observes the editor parameter node to configure itself
and queries the curr... |
import heapq
import unittest
class Solution:
def trapRainWater(self, heightMap):
"""
:type heightMap: List[List[int]]
:rtype: int
"""
if not heightMap:
return 0
res = 0
height = len(heightMap)
width = len(heightMap[0])
visited = ... |
import threading
import time
import argparse
import requests
import json
import re,sys
from bs4 import BeautifulSoup
class crawler(object):
def request_page(self,url):
regex = re.compile('((https?|ftp)://|www\.)[^\s/$.?#].[^\s]*')
t_or_f = regex.match(url) is None
if t_or_f is True:
pass
else:
try:
... |
from django.db import models
import json_field
import amo.models
class CompatReport(amo.models.ModelBase):
guid = models.CharField(max_length=128)
version = models.CharField(max_length=128)
app_guid = models.CharField(max_length=128)
app_version = models.CharField(max_length=128)
app_build = mod... |
# coding=utf-8
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# 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... |
'''
Author: Richard Min (richardmin97@gmail.com)
Uses httplib2 and BeautifulSoup to prase the riot skins sales webpage, reading what it has already found from a text file and comparing that
to what is new on the page, printing that out and updating the text file
This code is licensed under MIT creative license.
'''
#!... |
# -*- coding: utf-8 -*-
"""
Clase perteneciente al módulo de procesamiento de datos e inferencias Ama.
.. module:: file_listener
:platform: Unix
:synopsis: Funciones útiles para la detección de cambios en directorios. Ej. cuando se agrega un nuevo archivo de radar.
.. moduleauthor:: Andreas P. Koenzen <akc@apk... |
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from sockjs.tornado.transports import pollingbase
class StreamingTransportBase(pollingbase.PollingTransportBase):
def initialize(self, server):
super(StreamingTransportBase, self).initialize(server)
self.amount_limit = self.server.settings['response_limit']
# HTTP 1.0 client might send k... |
# Patchwork - automated patch tracking system
# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
#
# This file is part of the Patchwork package.
#
# Patchwork 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; eith... |
import numpy as np
import tensorflow as tf
import cv2
import time
import sys
class YOLO_TF:
fromfile = None
tofile_img = 'test/output.jpg'
tofile_txt = 'test/output.txt'
imshow = True
filewrite_img = False
filewrite_txt = False
disp_console = True
weights_file = 'weights/YOLO_tiny.ckpt'
alpha = 0.1
threshold... |
# Copyright (c) Xavier Figueroa
# 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, sof... |
#!/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... |
"""user personal bookshelf
Revision ID: 27c24cd72c1
Revises: 4a8674c1b8a
Create Date: 2015-04-20 20:46:20.702185
"""
# revision identifiers, used by Alembic.
revision = '27c24cd72c1'
down_revision = '4a8674c1b8a'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alem... |
# -*- coding: utf-8 -*-
import json
import os
import time
import urlparse
from collections import OrderedDict
from datetime import datetime, timedelta
from django.conf import settings
from django.core import mail
from django.core.cache import cache
from django.core.files import temp
from django.core.files.base import... |
import numpy as np
import matplotlib.pyplot as plt
import h5py
import glob
import fitsio
from gatspy.periodic import LombScargle
from scipy.signal import lombscargle
from SIP import SIP
"""
Fit all the light curves with the basis from c1 and then sample from those
weights
1. assemble_fnames - make a list of all K2 li... |
#!/usr/bin/env python
#
# Copyright 2015 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 requir... |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, 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 requi... |
import json
import six
from .core import write_file_or_filename
from .mimebundle import spec_to_mimebundle
def save(chart, fp, vega_version, vegaembed_version,
format=None, mode=None, vegalite_version=None,
embed_options=None, json_kwds=None, webdriver='chrome'):
"""Save a chart to file in a v... |
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2017 Christian Pfarr
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, cop... |
import json
import os, sys ,re
import pysrt
DEFAULT_REGEX="^[W|I][0-9A-Za-z]{5}([^-]*)?-"
class ConvertSrt2JSON(object):
def __init__(self,srcdir='',destdir='',filter_regex=DEFAULT_REGEX):
self.srcdir = srcdir
self.destdir = destdir
self.filter_regex=filter_regex
def convertFile(self... |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import loggi... |
# This script was written by Chaitanya Chintaluri c.chinaluri@nencki.gov.pl
# This software is available under GNU GPL3 License.
# Uses pygraphviz to illustrate the inner structure of NSDF file format
# This is to use in the NSDF paper and to generate machine readable file structure
# for the convenience of the user.
... |
'''Example script to generate text from Nietzsche's writings.
At least 20 epochs are required before the generated text
starts sounding coherent.
It is recommended to run this script on GPU, as recurrent
networks are quite computationally intensive.
If you try this script on new data, make sure your corpus
has at le... |
"""Support for Blink Home Camera System."""
import asyncio
from copy import deepcopy
import logging
from blinkpy.auth import Auth
from blinkpy.blinkpy import Blink
import voluptuous as vol
from homeassistant.components import persistent_notification
from homeassistant.components.blink.const import (
DEFAULT_SCAN_... |
# Copyright 2011 Grid Dynamics
# Copyright 2011 OpenStack Foundation
# 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... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.website_slides.tests import common
from odoo.tests import tagged
from odoo.tests.common import users
from odoo.tools import mute_logger
@tagged('functional')
class TestKarmaGain(common.SlidesCase):
... |
#!/usr/bin/env python
"""
Takes as arguments:
1. the path to a JSON file (such as an IPython notebook).
2. the path to output file
If 'metadata' dict in the JSON file contains 'include_in_docs': true,
then copies the file to output file, appending the 'metadata' property
as YAML front-matter, adding the field 'categor... |
r"""
Test file for the `quat_opt` module of the "dstauffman.aerospace" library.
Notes
-----
#. Written by David C. Stauffer in February 2021.
"""
#%% Imports
import unittest
from dstauffman import HAVE_NUMPY
import dstauffman.aerospace as space
from dstauffman.numba import HAVE_NUMBA
if HAVE_NUMPY:
import nump... |
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS Invenio 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 (... |
from fabric.api import *
from urlparse import urlparse
from fabric.contrib.files import exists
import os
import re
@task
def is_installed(package):
"""Check if package is installed"""
import vars
vars = vars.Vars()
# This will work with "package.<extension> and "package"
package_name = os.path.spli... |
import unittest
import pypelyne2.src.parser.parse_outputs as parse_outputs
import pypelyne2.src.modules.output.output as output
class ParseOutputsTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.output_objects = parse_outputs.get_outputs()
def test_get_outputs(self):
""" ... |
#!/usr/local/bin/python
#patrcia.py
#Python class definitions for creating a radix-like trie.
# Copyright (C) <2012> <Benjamin C. Smith>
#
# 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 Foun... |
"""
REST JSON API for designing transformation files
Based on:
* https://mafayyaz.wordpress.com/2013/02/08/writing-simple-http-server-in-python-with-rest-and-json/
"""
import threading
from http.server import BaseHTTPRequestHandler, HTTPServer
from re import search
from socketserver import ThreadingMixIn
from sys... |
# 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
# "License"); you may not u... |
# -*- coding: utf-8 -*-
#
# Copyright 2015 AirPlug 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 applic... |
# This file is an EasyBuild recipy as per https://github.com/hpcugent/easybuild
#
# Copyright:: Copyright (c) 2012 University of Luxembourg / LCSB
# Author:: Cedric Laczny <cedric.laczny@uni.lu>, Fotis Georgatos <fotis.georgatos@uni.lu>
# License:: MIT/GPL
# File:: $File$
# Date:: $Date$
"""
Easybuild s... |
import random
import Train
import Tile
import pygame
import threading
import Mindmap
from random import *
from Train import *
from Tile import *
from pygame import *
from threading import *
from Mindmap import *
numPlayers = 2
trainStartLength = 3
tileDimX = 32
tileDimY = 22
offsetHUD = 90
tileImageWidth = 25
tileIma... |
#!/usr/bin/env python
# encoding: utf-8
#Created by Graham Cummins on 2007-08-23.
# Copyright (C) 2007 Graham I Cummins
# 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 L... |
"""Generic functions which are useful for working with HMMs.
This just collects general functions which you might like to use in
dealing with HMMs.
"""
def pretty_print_prediction(emissions, real_state, predicted_state,
emission_title = "Emissions",
real_title =... |
# (C) British Crown Copyright 2011 - 2019, Met Office
#
# This file is part of cartopy.
#
# cartopy is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option)... |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
# Copyright 2015-2018 Antoni Boucher (antoyo) <bouanto@zoho.com>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the ter... |
# Copyright 2017 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... |
"""jal_stats URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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')
Class-b... |
# Copyright (C) 2008, OLPC
#
# 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 is distributed in the hope... |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from indico.modules.events.timetable.controllers.display import (... |
import vcr
import unittest
from django.conf import settings
from django.core.management import call_command
from django.test import LiveServerTestCase, TestCase
from six import StringIO
from django.core.exceptions import ValidationError
from salesforce.models import Adopter, SalesforceSettings, MapBoxDataset, Partner... |
from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer, RESPONSE_HEADER_SIZE
from hazelcast.protocol.builtin import StringCodec
from hazelcast.protocol.builtin import L... |
#!/usr/bin/env python
# -*- encoding: UTF-8 -*-
import base
class FM4Parser(base.StationBase):
"""The Parser for the austrian sidestream radio station
FM4, which is part of ORF.
Look at it's homepage http://fm4.orf.at
Maybe besser use this songlist?
http://fm4.orf.at/trackservicepopup/main
... |
# -*- coding: utf-8 -*-
"""
code to initialize the remote side of a gateway once the io is created
"""
import inspect
import os
import execnet
from execnet import gateway_base
from execnet.gateway import Gateway
importdir = os.path.dirname(os.path.dirname(execnet.__file__))
class HostNotFound(Exception):
pass
... |
# coding: utf-8
import hmac
import hashlib
import unittest
import warnings
from test import test_support
class TestVectorsTestCase(unittest.TestCase):
def test_md5_vectors(self):
# Test the HMAC module against test vectors from the RFC.
def md5test(key, data, digest):
h... |
# Copyright (c) 2012,2013 Roger Light <roger@atchoo.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this lis... |
#!/usr/bin/env python
import immlib
from immlib import LogBpHook, BpHook
class ReturnBP(BpHook):
def __init__(self):
BpHook.__init__(self)
def run(self, regs):
imm = immlib.Debugger()
eip = regs["EIP"]
imm.log("bp, EIP is 0x%08X " % eip)
imm.addKnowledge("0x%0... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
#!/usr/bin/python
import logging
import zope
import libxml2
from imgfac.BuildDispatcher import BuildDispatcher
from imgfac.ImageFactoryException import ImageFactoryException
from imgfac.CloudDelegate import CloudDelegate
from glance import client as glance_client
def glance_upload(image_filename, creds = {'auth_url':... |
from datetime import timedelta, datetime
import wx
from wx import xrc
from devices import RTCDevice
from .base import ModuleBase, bind
class RTCModule(ModuleBase):
GridPos = (1, 0)
def __init__(self, system):
self._system = system
self._rtc = system.rtc # type: RTCDevice
self.title =... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# XBMC Tools
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urllib, urllib2
import xbmc
import xbmcgui
import xbmcplugin
im... |
import array,math
def make_array(N,init_val=0.0):
#return array.array('d',N*[init_val]) # array of floats broken in micropython
return N*[init_val]
def halfLifeFactors(nsamp):
# fact ^ nsamp = 0.5
# nsamp*ln(fact) = ln(0.5)
# ln(fact)= ln(0.5)/nsamp
# fact=exp(ln(0.5)/nsamp)
fact=math.exp(math.... |
# -*- coding: UTF-8 -*-
"""
Arabic Light Stemmer
A class which provides a configurable stemmer
and segmentor for arabic text.
Features:
=========
- Arabic word Light Stemming.
- Root Extraction.
- Word Segmentation
- Word normalization
- Default Arabic Affixes list.
- An customizable Light ste... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.