src
stringlengths
721
1.04M
import math import numpy from os import path def get_ndcg(test_path, pred_path): test_rank = [] pred_rank = [] # all the return value ndcg10 = 0 ndcg5 = 0 ndcgall = 0 if path.isfile(pred_path) == False: return [0, 0, 0, 0] with open(test_path) as fp: for line in f...
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Author: <<name>> # Date : <<date>> #import os #import sys #sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))) import time import datetime # App Config # XXX: https://stackoverflow.com/questions/3536620/how-to-change-a-module-variable-f...
import unittest from semantic_version import Version from maintain.release.version_file import VersionFileReleaser from ..utils import temp_directory, touch class BumpVersionTestCase(unittest.TestCase): # Detection def test_detects_version_file(self): with temp_directory(): touch('VERSI...
#!/usr/bin/python # # Copyright (c) 2011 Rime Project. # # 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, m...
""" Measuring a shape of an object ============================== Simple class to measure weighted quadrupole moments, size, and ellipticity of an object. Can be used for example to verify weak lensing mission requirements. :requires: NumPy (tested with 1.9.1) :author: Sami-Matias Niemi :contact: s.niemi@icloud.com ...
# -*- coding: utf-8 -*- """ *************************************************************************** lasnoise.py --------------------- Date : September 2013 Copyright : (C) 2013 by Martin Isenburg Email : martin near rapidlasso point com ****************...
""" Handle Q smearing """ ##################################################################### #This software was developed by the University of Tennessee as part of the #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) #project funded by the US National Science Foundation. #See the license tex...
# Copyright 2020 The HuggingFace Team. 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 applicabl...
#!/usr/bin/python # -*- coding: utf-8 -*- import unittest import json import urllib2 import sys import host import time BUFFER_SIZE = 500 address = 'http://'+host.concordia_host if len(host.concordia_port) > 0: address += ':'+host.concordia_port def file_len(fname): with open(fname) as f: for i, l ...
#!/usr/bin/python3 from bs4 import BeautifulSoup import ClassName import Fields import Method import Constructor class Comment(): """ comment stores a comment for later printing """ def __init__(self, indent): """ Make a new instance of the comment class attributes: ...
from datetime import datetime from time import sleep from rq.job import Job from models.trial import Trial from redis import Redis __author__ = 'daniel' import threading class RqResultsProcessor(threading.Thread): session = None stopped = False def stop(self): self.stopped = True def run(se...
import lzma import pickle import curses import random import enchant from index import index from doubleentries import doubleentries with lzma.open('webster.txt.xz', 'rt') as infile: webster = infile.read() wordlist = enchant.request_pwl_dict('wordlist.txt') # initialize terminal screen screen = curses.initscr() c...
# -*- coding: utf-8 -*- from django.conf.urls import patterns, url from django.views.generic import TemplateView from django.contrib.auth.decorators import login_required from .views import upload_file, login_view, logout_view, UserUploads from .views import AsvDetailView, AsvDeleteView # from .views import AsvMaDetai...
import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__),"humanrl")) if __name__ == "__main__": import argparse import numpy as np from humanrl import pong_catastrophe from humanrl.classifier_tf import * parser = argparse.ArgumentParser() parser.add_argument('--logdi...
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ Author: Norin (copied it) 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...
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2017-03-01 16:23 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('profiles', '0001_initial'), ] operations = [ migrations.RemoveField( ...
from charms.reactive import when, when_not from charms.reactive import set_state, remove_state from charmhelpers.core import hookenv from charms.flume import Flume from charms.hadoop import get_dist_config from charms.reactive.helpers import data_changed @when_not('hadoop.related') def report_blocked(): hookenv.s...
# -*- coding: utf-8 -*- """ A simple merge sort implementation: http://en.wikipedia.org/wiki/Merge_sort """ def merge(left, right): """Merges ordered lists 'left' and 'right'. It does this by comparing the first elements and taking the smaller one and moving on to the next one in the list, continuing...
# -*- coding: utf-8 -*- from __future__ import division from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals import os import json import pytest from mock import Mock from tabulator import Stream from tabulator.parsers.datapackage import DataPackageParser...
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + from __future__ import (absolute_import, div...
# Licensed under The MIT License. # For full copyright and license information, please see the LICENSE.txt. import os import sys import codecs warning = "<!-- Generated automatically by make_l10n.py. Think twice before edit. -->" if (4 != len(sys.argv)): print("Usage:") print("./make_l10n.py <source directory...
# generated by 'xml2py' # flags '-c -d -v -k defst -lrregadmin -m rregadmin.util.glib_wrapper -m rregadmin.util.icu_wrapper -m rregadmin.util.path_wrapper -m rregadmin.util.icu_wrapper -m rregadmin.util.path_info_wrapper -m rregadmin.util.ustring_wrapper -m rregadmin.util.offset_wrapper -m rregadmin.util.value_wrapper ...
import gspread import os import string def new_token(): gc = gspread.login(os.environ.get('GOOGLE_USER'), os.environ.get('GOOGLE_PASS')) return gc def write_cell(worksheetKey, row, col, value): gc = new_token() worksheet = gc.open_by_key(worksheetKey).get_worksheet(0) row ...
# -*- coding:utf-8 -*- from sqlalchemy import create_engine import pymysql import pandas as pd import numpy as np from pandas.io import sql from pandas.lib import to_datetime from pandas.lib import Timestamp import datetime,time,os import tushare as ts import easytrader,easyhistory import time,os from ...
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe.utils import cstr, has_gravatar, cint from frappe import _ from frappe.model.document import Document from frappe.core.doctype...
# View more python learning tutorial on my Youtube and Youku channel!!! # My tutorial website: https://morvanzhou.github.io/tutorials/ from __future__ import division, print_function, absolute_import import tensorflow as tf import numpy as np import matplotlib.pyplot as plt # Import MNIST data from tensorflow.examp...
# -*- coding: utf-8 -*- # <Lettuce - Behaviour Driven Development for python> # Copyright (C) <2010-2012> Gabriel Falcão <gabriel@nacaolivre.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 Foundatio...
"""Tests for parsing the WorldBirds page containing the checklist.""" from datetime import datetime from unittest import TestCase from checklists_scrapers.spiders import DOWNLOAD_FORMAT, DOWNLOAD_LANGUAGE from checklists_scrapers.spiders.worldbirds_spider import ChecklistParser from checklists_scrapers.tests.utils imp...
import torrent import bencode import sys import socket import os import struct import math import hashlib import random import locks import threading from protocol import protocol_header, header_reserved, message_types, PeerBase class LoggingFile(object): def __init__(self, file, path): self.file = file ...
#!/usr/bin/env python # # This script takes a database (SQLite) obtained from the PIQMIe service and populates # additional tables/views to facilitate differential protein expression analyses based # on standardized SILAC ratios. # # Note: # z_score_{raw|norm}_ratio - column with canonical Z-score transformed raw/no...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('memoryoracle', '0002_auto_20150402_2000'), ] operations = [ migrations.AlterField( model_name='commit', ...
# 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 ...
#!/usr/bin/env python # This file is part of beets. # Copyright 2013, Adrian Sampson. # # 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 th...
#!/usr/bin/python """ MAGUM python module (Beta 1.1.0) MAGUM stands for (Magnetometer, Accelerometer and Gyroscope Udoo Management) it includes some modules such as smbus, time, os, sys, subprocess etc.. to manage the udoo-neo motion sensors over the I2C serial communicaton protocol. Because the I2C device interfa...
from .base import * # NOQA import dj_database_url from os import environ from urllib.parse import urlparse from django.conf import global_settings # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False # SECURITY WARNING: keep the secret key used in production secret! # https://docs.djangopr...
#!/usr/bin/python # Spits out a Javascript embeddable list o' recent RSS stuff. # Ryan Tucker, August 21 2009, <rtucker@gmail.com> checkevery = 30*60 # check every ~30 minutes displaymax = 5 import cgi import feedparser import logging import logging.handlers import operator import robotparser import sqlite3 impo...
# coding: utf-8 from fabric.api import * import os #Paso inicial para poner a punto nuestra maquina. def Instala(): #Aseguramos la limpieza de la maquina. run ('sudo rm -rf DietasBot') #Descargamos nuestra aplicacion desde GitHub. run('git clone https://github.com/maribhez/DietasBot.git') #Entra...
import os import json from sdklib.util.urlvalidator import urlsplit class SwaggerReader(object): def __init__(self, folder): files = os.listdir(folder) self.apis = [] for file_elem in files: print '%s/%s' % (folder, file_elem) f = open('%s/%s' % (folder, file_el...
import logging import abc, time import numpy as np import scipy.sparse as spp from contextlib import contextmanager import indigo.operators as op from indigo.util import profile log = logging.getLogger(__name__) class Backend(object): """ Provides the routines and data structures necessary to implement a...
"""Weight Boosting. This module contains weight boosting estimators for both classification and regression. The module structure is the following: - The `BaseWeightBoosting` base class implements a common ``fit`` method for all the estimators in the module. Regression and classification only differ from each oth...
# -*- coding: utf-8 -*- import hashlib import json import time import urllib import requests from requests import RequestException, ConnectionError, Timeout from tornado import gen from tornado.httpclient import AsyncHTTPClient from .api import ApiSpec from .exceptions import ElongException, ElongAPIError, \ Ret...
#! /usr/bin/env python #coding=utf-8 #-------------------------------------------------------------------- # for micom regriding, 2014 0815 by M. Shen # modify, creating netcdf file, 2015 0227 by M. Shen # load module # import time start_time = time.time() import sys import os import numpy as np impo...
# This file is part of Pebble. # Copyright (c) 2013-2021, Matteo Cafasso # Pebble is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License # as published by the Free Software Foundation, # either version 3 of the License, or (at your option) any later versio...
#import pymysql.cursors import mysql.connector from model.group import Group from model.contact import Contact class Dbfixture: def __init__(self, host, name, user, password): self.host = host self.name = name self.user = user self.password = password #self.connection = py...
# -*- coding: utf-8 -*- from __future__ import absolute_import import mock import zlib from sentry.cache.redis import RedisClusterCache, RbCache from sentry.testutils import TestCase from sentry.utils.imports import import_string class FakeClient(object): def get(self, key): if key == "c:1:foo:a": ...
from printer import pretty, GREEN, YELLOW, CYAN class Schedule(object): def __init__(self): self.schedule = [] self.startTimes = [] self.finishTimes = [] self.report = {} self.fitness = None self.startTime = (2,0,0) def maxTime(self): if len(self.schedule) > 0: maxTime = self.schedule[0][2] for ...
# -*- coding: utf-8 -*- # * Authors: # * TJEBBES Gaston <g.t@majerti.fr> # * Arezki Feth <f.a@majerti.fr>; # * Miotte Julien <j.m@majerti.fr>; import colander import pytest import datetime from autonomie.forms.tasks.invoice import ( get_add_edit_invoice_schema, get_add_edit_cancelinvoice_schem...
""" Non-RPC unit tests for Power Reg exam system. :author: Chris Church <cchurch@americanri.com> :copyright: Copyright 2010 American Research Institute, Inc. Even our exams have to take tests. """ __docformat__ = "restructuredtext en" # Python import codecs from decimal import Decimal import random # Django from dj...
"""Tests for scout requests""" import tempfile import zlib from urllib.error import HTTPError import pytest import requests import responses from scout.utils import scout_requests def test_get_request_json_error(): """Test the function that sends a GET request that returns an error""" # GIVEN A URL that re...
# -*- coding: utf-8 -*- from os import path from gluon import * from gluon.storage import Storage from s3 import * # ============================================================================= class index(): """ Custom Home Page """ def __call__(self): auth = current.auth if auth.is_logge...
#!/usr/bin/python # Copyright 2015 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 required by applicable law or a...
from django.contrib.auth.models import User from requests import Response from rest_framework import generics from rest_framework import permissions, renderers, parsers from rest_framework.authtoken.models import Token from rest_framework.decorators import api_view from rest_framework.response import Response from rest...
import os import sys import time from owanimo.app.error import ERROR as e from owanimo.script import allegory_special from owanimo.util import define from owanimo.util.log import LOG as L class Allegory(allegory_special.Allegory): def __init__(self, runner, profile, player): allegory_special.Allegory.__in...
#!/usr/bin/env python ''' Make predictions for the test data 6. Use logistic regression ''' import argparse, multiprocessing from common import * from sklearn.linear_model import LogisticRegression from sklearn.preprocessing import OneHotEncoder, StandardScaler def prepare_features(data, enc=None, scaler=None): ...
# -*- coding: 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 model 'PictureItem' db.create_table('contentitem_contentplugins_pictureitem', ( ('conte...
import json import uuid from datetime import datetime from flask import render_template, url_for, request from flask_login import current_user import portality.formcontext.forms from portality.crosswalks.journal_form import JournalFormXWalk from portality.crosswalks.article_form import ArticleFormXWalk from portality...
#!/usr/bin/env python # Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com> # # This file is part of paramiko. # # Paramiko is free software; you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 2....
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-06-10 19:56 from __future__ import unicode_literals import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0007_alter_validators_...
# Generated by Django 2.1.4 on 2018-12-05 10:46 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Iris', fields=[ ('id', models.AutoField(aut...
#!/usr/bin/python # # Author : Pierre-Jean Coudert # # 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; version 2 of the License. # # This program is distributed in the hope that it will...
# -*- 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 License as published by #...
""" Collaborate with RestApiClient to make remote anonymous and authenticated calls. Uses user_io to request user's login and password and obtain a token for calling authenticated methods if receives AuthenticationException from RestApiClient. Flow: Directly invoke a REST method in RestApiClient, example: get_co...
import os import colorama try: import setproctitle except ImportError: setproctitle = None class RayError(Exception): """Super class of all ray exception types.""" pass class RayTaskError(RayError): """Indicates that a task threw an exception during execution. If a task throws an exceptio...
""" """ import os import vcr jiravcr = vcr.VCR( record_mode = 'once', match_on = ['uri', 'method'], ) class BridgeTests: def test_get_issue(self): with jiravcr.use_cassette(os.path.join(self.vcr_directory, "issue.yaml")): self.assertIsNotNone(self.bridge.get_issue("TP-9")) def te...
from __future__ import print_function import os from os.path import join as pjoin, normpath, exists as pexists, dirname import subprocess from shutil import rmtree, move as shmove import re from zipfile import ZipFile from lib import get_svn_version, get_scipy_version BUILD_MSI = False SRC_ROOT = normpath(pjoin(os.ge...
#!/usr/bin/python # Copyright (c) 2012 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from __future__ import print_function from driver_env import env from driver_log import Log import driver_tools import filetype ...
# Twisted Imports from twisted.internet import reactor, defer from twisted.internet.error import TimeoutError, AlreadyCalled, AlreadyCancelled from twisted.protocols.basic import LineOnlyReceiver from twisted.python import log, failure # System Imports import exceptions from collections import deque import logging # ...
# -*- coding: latin-1 -*- """ Copyright (c) 2008 Pycircuit Development Team All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: a. Redistributions of source code must retain the above copyright notice, ...
# coding: utf-8 from content_plugin import ContentPlugin from z_whoosh import Whoosh from gluon import current, URL from gluon.storage import Storage from gluon.cache import Cache import perms class Application(object): def __init__(self): super(Application, self).__init__() # copy current conte...
import tensorflow as tf class TextCNN(object): """ A CNN for text classification. Uses an embedding layer, followed by a convolutional, kmax-pooling, convolutional, maxpooling and softmax layer. """ def __init__( self, sequence_length, num_classes, vocab_size, embedding_si...
import subprocess, os from lib.util import convert_scad def render(filename, scad_cfg, mirror): """ renders scad module defined by scad_cfg into stl 'filename' """ assert filename[-1] == 'b' scad = "../scad/tmp.scad" with open(scad, "w") as fd: fd.write("include <model.scad>;\n $fn=32;") ...
""" This module is the main driver for calls to plugins from the CLI interface. It also has all of the scaffolding and wrapper functions required to generically invoke and run any of the supported plugin methods in the plugin interface for any plugin using just the plugin name, plugin group and call args. """ impor...
# pylint:disable=abstract-method import logging from typing import Optional, List, Set, Tuple from sortedcontainers import SortedSet from . import PageBase from angr.storage.memory_object import SimMemoryObject from .cooperation import MemoryObjectMixin l = logging.getLogger(name=__name__) class ListPage(MemoryOb...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011-2012 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....
import uuid from unittest import mock from unittest.mock import call import pytest from boto.exception import SQSError from flask import current_app, json from app.dao import templates_dao from app.dao.service_sms_sender_dao import dao_update_service_sms_sender from app.models import ( EMAIL_TYPE, INTERNATION...
# Allow access to command-line arguments import sys import os import subprocess import markdown import codecs import pickle # Import the core and GUI elements of Qt from PySide.QtCore import * from PySide.QtGui import * #Useful script! from send2trash import send2trash # Extra module for markdown from markdownEditor ...
from mudwyrm_users.admin.achaea import ScriptState from mudwyrm_users.admin.achaea.action import Action, Outcome, EventOutcome from mudwyrm_users.admin.achaea.trigger import Trigger, Alias, OnEvent, TriggerPack from mudwyrm_users.admin.achaea.common import not_, traverse_scripts, AttrDict, partition_action from mudwyrm...
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2015 Anler Hernández <hello@anler.me> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
# # 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 us...
import simplejson # declare direct exports here loads = simplejson.loads JSONDecodeError = simplejson.JSONDecodeError def _simplejson_datetime_serializer(obj): """ Designed to be passed as simplejson.dumps default serializer. Serializes dates and datetimes to ISO strings. """ if hasattr(obj, 'isoform...
# -*- coding: utf-8 -*- # Copyright (C) 2015 ZetaOps Inc. # # This file is licensed under the GNU General Public License v3 # (GPLv3). See LICENSE.txt for details. # from zengine.forms import JsonForm from ulakbus.models import OgrenciProgram, Ogrenci, Role, User, AbstractRole from zengine.forms import fields from z...
# Copyright 2012 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/LICENSE-2.0 # # Unless requ...
import numpy as np import math from pylab import * from palettable.wesanderson import Zissou_5 as wsZ import matplotlib.ticker as mtick from scipy.interpolate import interp1d from scipy.interpolate import griddata from scipy.signal import savgol_filter def smooth(xx, yy): yy = savgol_filter(yy, 7, 2) np.cl...
import paho.mqtt.client as mqtt import json from .models import Switch, Device, PWM # The callback for when the client receives a CONNACK response from the server. def on_connect(client, userdata, flags, rc): print("Connected with result code "+str(rc)) #subscribe to status and discovery topics client.subsc...
#!/usr/bin/env python # -*- coding:utf-8 -*- __author__ = 'yinzishao' """ 手机版没有cookie,更方便 但是pc版的首页是所有分类混在一起的 手机版则是新闻在各个分类,所以爬取的时候需要爬各个分类。 """ import re import scrapy from bs4 import BeautifulSoup import logging from thepaper.items import NewsItem import json logger = logging.getLogger("WshangSpider") from thepaper.set...
from django.urls import path from . import views app_name = 'store' urlpatterns = [ path('', views.index_view, name='index'), path('order_by/category_score', views.index_order_by_category_score, name='index_order_by_category_score'), path('detail/<int:pk>/', views.ItemDataDetailView.as_view(), name='deta...
#Retrieving from PV1, PV2, PV4 #Working on retrieving from PV3 #Solar Capstone #Johnson, Raphael & Adrian from bs4 import BeautifulSoup from datetime import datetime import urllib.request import threading #Loop import time from ctypes import c_short from ctypes import c_byte from ctypes import c_ubyte from time import ...
#!/usr/bin/env python # # Copyright 2015 DyD Dinámica y Desarrollo SAS # # 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 ap...
###################################################################### # HCSR04_GUI.py # # This program read HCSR04 sensor data and print on a label in GUI ###################################################################### from Tkinter import * import RPi.GPIO as GPIO import time trigPin = 18 echoPin = 23 ...
from django.db import models from waldur_core.core.managers import GenericKeyMixin def get_permission_subquery(permissions, user): subquery = models.Q() for entity in ('customer', 'project'): path = getattr(permissions, '%s_path' % entity, None) if not path: continue if p...
import unittest from docker_ascii_map.raster import Raster, Boundary, RasterCell class RasterTests(unittest.TestCase): def test_empty_raster(self): raster = Raster() self.assertEqual('', str(raster)) self.assertEqual((0, 0), raster.size()) self.assertEqual(RasterCell(), raster.get...
import NodeDefender import flask_migrate import sqlalchemy import os from flask_sqlalchemy import SQLAlchemy import alembic import shutil import pip default_config = {'engine' : '', 'username' : '', 'password' : '', 'host' : '', 'port' : '', ...
import logging import re from django.apps import apps from django.conf import settings from django.db.models import signals from taggit.models import Tag from grouprise.features.tags import RE_TAG_REF from grouprise.features.tags.utils import get_slug logger = logging.getLogger(__name__) _DEFAULT_CONF = { 'tag...
import re, os, sys from Queue import Queue # ----------------------------------------------------------------------------- class term_colors: """ Usage: print term_colors.WARNING + "This is a msg" + term_colors.ENDC """ HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m...
from numbers import Number import theano from theano import tensor as TT import numpy as np from . import origin class Input(object): """Inputs are objects that provide real-valued input to ensembles. Any callable can be used an input function. """ def __init__(self, name, values, zero_after_time=...
# Copyright (c) 2009, Rotem Yaari <vmalloc@gmail.com> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this li...
from sqlalchemy import * from migrate import * from migrate.changeset import schema pre_meta = MetaData() post_meta = MetaData() athlete = Table('athlete', post_meta, Column('id', Integer, primary_key=True, nullable=False), Column('name_first', String(length=64)), Column('name_last', String(length=64)), ...
# -*- Mode: python; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*- # # Copyright (C) 2012 - fossfreedom # Copyright (C) 2012 - Agustin Carrasco # # 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 Fou...
# -*- coding: UTF-8 -*- from payment.views import * from django.views.decorators.csrf import csrf_exempt class EmpresaEmpleadoraListAPIViewImpl(EmpresaEmpleadoraListAPIView): def __init__(self): EmpresaEmpleadoraListAPIView.__init__(self) class EmpresaEmpleadoraCreateAPIViewImpl(EmpresaEmpleadoraCreateA...
""" Generate data files and TOC file for the visualization. Depends on vtn_sieve and pysieve (vtn_sieve is a private repository that cannot be shared) See file specification at file_spec.md """ from pysieve import substbased from seqdistance.matrices import binarySubst, addGapScores, binGapScores from vtn_sieve impo...