text
stringlengths
12
6.59M
# -*- Mode: Python; coding: iso-8859-1 -*- # vi:si:et:sw=4:sts=4:ts=4 ## ## Stoqdrivers ## Copyright (C) 2005 Async Open Source <http://www.async.com.br> ## 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 publishe...
"""// diagnosis.cpp #include <wiringPi.h> #include <stdio.h> #include "PCA9685.h" #include "Ultrasonic.h" #include <signal.h>""" import Adafruit_PCA9685 as pca import wiringpi as wp import signal import sys LOW = 0 HIGH = 1 OUTPUT = wp.OUTPUT INPUT = wp.INPUT CAR_DIR_FW = 0 CAR_DIR_BK = 1 CAR_DIR_LF = 2 C...
# standard modules import itertools as it import os import types import utils # third-party modules import MDAnalysis.analysis.distances as mdaad import pandas as pd # custom modules import DatabaseProvider import Parser class Analyser(object): def __init__(self): self._db = DatabaseProvider.DB() self.parser =...
#!/usr/bin/env python import os, sys, re, urllib2, cookielib, string from urllib import urlencode from urllib2 import urlopen from copy import copy import BeautifulSoup import htmlentitydefs import socket socket.setdefaulttimeout(15) class ParseException(Exception): pass ## # Removes HTML or XML character refere...
''' Application =========== The :class:`App` class is the base for creating Kivy applications. Think of it as your main entry point into the Kivy run loop. In most cases, you subclass this class and make your own app. You create an instance of your specific app class and then, when you are ready to start the applicat...
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2016 Georg Seifert. 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...
""" Support to interface with Sonos players (via SoCo). For more details about this platform, please refer to the documentation at https://home-assistant.io/components/media_player.sonos/ """ import datetime import logging from os import path import socket import urllib import voluptuous as vol from homeassistant.com...
import exc import httplib2 import json import logging import urllib from eventlet.semaphore import Semaphore LOG = None class WebResource(object): def __init__(self, auth=None, logger=None): global LOG self.h = httplib2.Http() self.auth = auth self.sem = Semaphore() if l...
import hashlib import random import signal import sys import time import traceback from datetime import date from celery.task.sets import subtask from django.core.files.base import ContentFile from django.core.management.base import BaseCommand, CommandError from django.utils.encoding import force_bytes from juriscrap...
from unittest import TestCase from unittest.mock import mock_open, patch import edi valid_edi_log = """ [REG1TEST;1] TName=Cupa Nasaud TDate=20130803;20130804 PCall=YO5PJB PWWLo=KN16SS PExch= PAdr1= PAdr2= PSect=SOMB PBand=144 MHz PClub= RName=Sorin RCall= Radr1= Radr2= RPoCo= RCity= RCoun=Romania RPhon= RHBBS= MOpe1...
from __future__ import print_function, division, absolute_import import sys # unittest only added in 3.4 self.subTest() if sys.version_info[0] < 3 or sys.version_info[1] < 4: import unittest2 as unittest else: import unittest # unittest.mock is not available in 2.7 (though unittest2 might contain it?) try: ...
## www.pubnub.com - PubNub Real-time push service in the cloud. # coding=utf8 ## PubNub Real-time Push APIs and Notifications Framework ## Copyright (c) 2010 Stephen Blum ## http://www.pubnub.com/ ## ----------------------------------- ## PubNub 3.1 Real-time Push Cloud API ## ----------------------------------- im...
#!/usr/bin/python ######################################################################## # # Caution: there are two separate, independent build systems: # 'makepanda', and 'ppremake'. Use one or the other, do not attempt # to use both. This file is part of the 'makepanda' system. # # To build panda using this scrip...
# @Context context # @Dataset dataset # @ImageJ ij # @LogService log # @DatasetIOService io import os from ij import IJ from ij.plugin.frame import RoiManager import fiji.plugin.kymographbuilder.KymographFactory as KFactory from java.io import File rm = RoiManager.getInstance() counter = 0 parent_folder = File(data...
from __future__ import print_function import datetime import gzip import hashlib import os import shutil import sys import bs4 import requests from flask import (Flask, abort, jsonify, redirect, render_template, request, url_for) from peewee import * # noqa from werkzeug.contrib.atom import AtomFe...
#!/usr/bin/python # Reddit pics downloader import threading from requests import get from json import loads from os.path import exists from os import mkdir import re import sys global open_files, OPEN_FILE_LIMIT OPEN_FILE_LIMIT = 256 open_files = 0 class UsageError(Exception): pass class InvalidURLError(Base...
#!/usr/bin/env python import os from glob import glob from cStringIO import StringIO from tempfile import mkstemp from numpy.testing import set_package_path, restore_path, ScipyTestCase, ScipyTest from numpy.testing import assert_equal, assert_array_almost_equal from numpy import arange, array, eye, pi, cos, exp, sin,...
"""Tracks the latency of a host by sending ICMP echo requests (ping).""" import asyncio from datetime import timedelta from functools import partial import logging import re import sys from typing import Any, Dict from icmplib import SocketPermissionError, ping as icmp_ping import voluptuous as vol from homeassistant...
import time from pprint import pformat import uuid import urllib from test_utils import print_error # ----- Constants ----- # DEFAULT_TIMEOUT = 60 DEFAULT_INTERVAL = 20 ENTRY_TYPE_ERROR = 4 INC_CREATION_ERR = 'Failed to create incident. Possible reasons are:\nMismatch between playbookID in conf.json and ' \ ...
""" The alignment pipeline. We start with the .fastq files and the reference for a particular genome and carry out the gauntlet of steps to perform alignments and clean them up. """ import os import subprocess from subprocess import CalledProcessError import sys from main.celery_util import CELERY_ERROR_KEY from mai...
from ConfigParser import ConfigParser from helper import errortypes from helper import kort_db_api from helper import osm_fix import pprint import argparse import logging import os import logging.config import yaml parser = argparse.ArgumentParser() parser.add_argument( "-d", "--dry", help="do not actually...
from apsis.utilities import adapter_utils import numpy as np from sklearn.cross_validation import train_test_split class SimpleScikitLearnAdapter(object): """ Simple Scikit Learn adaptor to be executed in a single core manner. """ estimator = None param_defs = None n_iter = None scoring = ...
#!/usr/bin/python ######################################################################## # # Caution: there are two separate, independent build systems: # 'makepanda', and 'ppremake'. Use one or the other, do not attempt # to use both. This file is part of the 'makepanda' system. # # To build panda using this scrip...
#!/usr/bin/env python import re import sys import urllib import urllib2 from bs4 import BeautifulSoup def valid_andrew_id(andrewid): # regex written by Jacob Zimmerman return type(andrewid) is str and re.match(r'^[a-zA-Z][a-zA-Z0-9]{1,7}$', andrewid) is not None class Directory: base_url = 'http://direc...
# Copyright (c) 2016 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. import math import copy import io import xml.etree.ElementTree as ET import uuid from UM.Logger import Logger import UM.Dictionary import UM.Settings ## Handles serializing and deserializing material containers from an...
from __future__ import nested_scopes # ******NOTICE*************** # optimize.py module by Travis E. Oliphant # # You may copy and use this module as you see fit with no # guarantee implied provided you keep this notice in all copies. # *****END NOTICE************ # A collection of optimization algorithms. Version 0....
""" Support for Synology NAS Sensors. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.synologydsm/ """ import logging from datetime import timedelta from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.helpers...
import operator import sys import types import py import six def test_add_doc(): def f(): """Icky doc""" pass six._add_doc(f, """New doc""") assert f.__doc__ == "New doc" def test_import_module(): from logging import handlers m = six._import_module("logging.handlers") asser...
"""Plots many dataset examples (storm objects).""" import os.path import argparse import numpy import matplotlib matplotlib.use('agg') import matplotlib.pyplot as pyplot from gewittergefahr.gg_io import storm_tracking_io as tracking_io from gewittergefahr.gg_utils import radar_utils from gewittergefahr.gg_utils import...
# coding: iso-8859-15 # Copyright (c) 2013 John Maguire <john@leftforliving.com> # # 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 #...
#!/usr/bin/env python """ Minibook: the Facebook(TM) status updater (C) 2009 Gergely Imreh <imrehg@gmail.com> """ VERSION = '0.1.0' APPNAME = 'minibook' import pygtk pygtk.require('2.0') import gtk import gobject try: from facebook import Facebook except: print "Pyfacebook is not available, cannot run." e...
import inspect from annotypes import Array, Anno, Union, Sequence, Mapping, Any, to_array, \ Optional, TYPE_CHECKING, WithCallTypes, NO_DEFAULT import numpy as np from enum import Enum from malcolm.compat import OrderedDict, str_ from .alarm import Alarm from .notifier import DummyNotifier, Notifier from .seriali...
import xml.etree.ElementTree as ET import codecs def indent(elem, level=0): i = "\n" + level*" " if len(elem): if not elem.text or not elem.text.strip(): elem.text = i + " " if not elem.tail or not elem.tail.strip(): elem.tail = i for elem in elem: ...
import unittest import pickle import pickletools from test.test_support import TestFailed, have_unicode, TESTFN # Tests that try a number of pickle protocols should have a # for proto in protocols: # kind of outer loop. Bump the 3 to 4 if/when protocol 3 is invented. protocols = range(3) # Return True if opcod...
"""Support for Sure PetCare Flaps/Pets sensors.""" from __future__ import annotations from typing import cast from surepy.entities import SurepyEntity from surepy.entities.devices import Felaqua as SurepyFelaqua from surepy.enums import EntityType from homeassistant.components.sensor import SensorEntity from homeass...
#!/usr/bin/python """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 l...
''' Created on Jan 26, 2013 @package: livedesk @copyright: 2012 Sourcefabric o.p.s. @license: http://www.gnu.org/licenses/gpl-3.0.txt @author: Gabriel Nistor Contains the default data for the live desk plugin. ''' from ..acl.security import rightId from ..administration.actions import rightRequestsInspection from .....
import argparse from random import * import math from geo2d.geometry import * import itertools from tkinter import * import time from intervalset import AngularIntervalSet,odd import sys,traceback from collections import namedtuple def random_color(): return "#%02x%02x%02x" % (randrange(0,255),randrange(0,255),ran...
from __future__ import print_function import unittest from test import test_support as support import os import sys class NoAll(RuntimeError): pass class FailedImport(RuntimeError): pass class AllTest(unittest.TestCase): def check_all(self, modname): names = {} with support.check_warn...
# Test discovery content types as inferred from resource contents. import os from django.test import TransactionTestCase from django.contrib.auth.models import Group from hs_core import hydroshare from hs_core.testing import MockIRODSTestCaseMixin, TestCaseCommonUtilities from hs_core.search_indexes import get_conten...
"""Plots many dataset examples (storm objects).""" import os.path import argparse import numpy import matplotlib matplotlib.use('agg') import matplotlib.pyplot as pyplot from gewittergefahr.gg_io import storm_tracking_io as tracking_io from gewittergefahr.gg_utils import radar_utils from gewittergefahr.gg_utils import...
doctests = """ Test simple loop with conditional >>> sum(i*i for i in range(100) if i&1 == 1) 166650 Test simple nesting >>> list((i,j) for i in range(3) for j in range(4) ) [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)] Test nesting with the inner ...
from flask.ext.classy import route from utils.views import ModelView from plutonium.users.models import User class UsersView(ModelView): model = User __exclude__ = ['password'] @route('/filter/') def filter(self): return "yeye"
# -*- coding: utf-8 -*- ############################################################################## # # This file is part of html_widget_embedded_picture, an Odoo module. # # Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>) # # html_widget_embedded_picture is free software: # you can redistribute...
"""Plots storm outlines (along with IDs) at each time step.""" import argparse import numpy import matplotlib matplotlib.use('agg') import matplotlib.colors import matplotlib.pyplot as pyplot from gewittergefahr.gg_utils import radar_utils from gewittergefahr.gg_utils import radar_sparse_to_full as radar_s2f from gewi...
import os import base64 import gettext def test_api_1(localedir, mofile): print 'test api 1' # Test basic interface os.environ['LANGUAGE'] = 'xx' print 'installing gettext' gettext.install('gettext', localedir) # test some translations print _('albatross') print _(u'mullusk') p...
from lab.server import Server class CimcServer(Server): _handle = None _dump_xml = True _logout_on_each_command = False LOM_ENABLED, LOM_DISABLED = 'Enabled', 'Disabled' POWER_UP, POWER_DOWN, POWER_CYCLE = 'up', 'down', 'cycle-immediate' RAID_0, RAID_1, RAID_10 = '0', '1', '10' def logger...
import asyncore import email.utils import socket import threading import smtpd import smtplib import StringIO import sys import time import select from unittest import TestCase from test import test_support HOST = test_support.HOST def server(evt, buf, serv): serv.listen(5) evt.set() try: conn, a...
from lab.with_log import WithLogMixIn from lab.with_config import WithConfig class Tims(WithLogMixIn, WithConfig): FOLDERS = {'HIGH AVAILABILITY': 'Tcbr1841f', 'NEGATIVE': 'Tcbr1979f', 'VTS PERF AND SCALE': 'Tcbr1840f'} TOKENS = {'kshileev': '0000003933000000000D450000000000', 'nfedotov': '26520...
"""Supporting definitions for the Python regression test.""" class Error(Exception): """Base class for regression test exceptions.""" class TestFailed(Error): """Test failed.""" class TestSkipped(Error): """Test skipped. This can be raised to indicate that a test was deliberatly skipped, but no...
""" Test script for the Unicode implementation. Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. """ from test_support import verbose import sys def test(method, input, output, *args): if verbose: print '%s.%s%s =? %s... ' % (repr(input), method, arg...
#!/usr/bin/env python # -*- coding: utf8 -*- import _init_path import codecs import os.path import re import sys import subprocess from functools import partial from collections import defaultdict try: from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * except ImportError: ...
#!/usr/bin/env python # -*- coding: utf8 -*- import _init_path import os.path import re import sys import subprocess from functools import partial from collections import defaultdict from PyQt4.QtGui import * from PyQt4.QtCore import * import resources from lib import struct, newAction, newIcon, addActions, fmtShor...
# 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 required by applicable law or agreed ...
# -*- coding: utf-8 -*- ## ## ## This file is part of Indico. ## Copyright (C) 2002 - 2013 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; eith...
# -*- coding: UTF-8 -*- import re import unicodedata def strip_accents(text): if text: return str(unicodedata.normalize('NFKD', text).encode('ASCII', 'ignore'),'utf-8') return '' def trim(text): if text: return re.sub(r'\s+',' ',text.strip()) return '' def remove_punctuation(text, replace=''): return re....
# -*- coding: utf-8 -*- import time import dougrain import random from flask.ext.script import Command, Option from app.question_module.exceptions.request_exceptions import WrongStatusCodeException, InvalidQuestionFormatException import requests from simplejson import JSONDecodeError class CollectQuestion(Command): ...
# -*- coding: utf-8 -*- ## ## ## This file is part of Indico. ## Copyright (C) 2002 - 2014 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; eith...
# -*- coding: utf-8 -*- ## ## ## This file is part of Indico ## Copyright (C) 2002 - 2013 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...
#! /usr/bin/env/python """This module contains the LensInWriter class that is used to write the various .in files used to interface with LENS """ import re # from mann import helper class LensInWriterHelper(object): def __init__(self): pass def clean_agent_state_in_file(self, agent_id_str, agent_st...
''' API for the laws app ''' import logging from tastypie.constants import ALL import tastypie.fields as fields from apis.resources.base import BaseResource from mks.models import Member, Party from mks.api import MemberResource from video.utils import get_videos_queryset from video.api import VideoResource from link...
import itertools class List: def __init__(self, iterable): self._iterable = iter(iterable) self._list = list() @property def _exhausted(self): try: self._consume_next() return False except IndexError: return True def _consume_next(se...
''' Created on Jun 3, 2012 @author: dstrauss implementation of contrast source ADMM optimization ''' import numpy as np import scipy.sparse as sparse import scipy.sparse.linalg as lin from mpi4py import MPI import sparseTools as spTools import scipy.io as spio from optimize import optimizer from superSolve import wr...
import os from uuid import uuid4 from datetime import datetime from nose.plugins.attrib import attr from ..helpers import UniqueCourseTest from ...fixtures.course import CourseFixture, XBlockFixtureDesc from ...pages.lms.auto_auth import AutoAuthPage from ...pages.lms.course_nav import CourseNavPage from ...pages.lms.c...
#!/bin/env python import numpy as np import scipy.signal as ss import astropy.io.fits as fits import matplotlib.pyplot as plt inpt = str(raw_input("Nome do Arquivo: ")) lc = fits.open(inpt) # Convert to big-endian array is necessary to the lombscargle function time = np.array(lc[1].data["TIME"], dtype='float64') rat...
import glob import re import pickle import numpy as np import pandas as pd import logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger('__ldaUtils__') #Creates labeled dictionary of corpora for referencing #Sample running: #INFO:__ldaUtils__:Processing .../labeled_image_maps/003770.labels.txt #I...
# # Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U # # This file is part of IoT orchestrator # # IoT orchestrator is free software: you can redistribute it and/or # modify it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # L...
import ply.lex as lex import ply.yacc as yacc import re from lxml.cssselect import CSSSelector from lxml.html import fromstring ############################### # Lex # ############################### """ Ply compiles a master regex from the tokens specified. When specified with strings, they...
## Empty files deserve poetry. # She dwelt among the untrodden ways # Beside the springs of Dove, # A Maid whom there were none to praise # And very few to love: # # A violet by a mossy stone # Half hidden from the eye! # Fair as a star, when only one # Is shining in the sky. # # She lived unknown, and few could k...
#!/usr/bin/env python3 import pycuda.driver import pycuda.autoinit import pycuda.compiler import getopt import sys def usage(prog): print("Usage: %s [OPTION]..." % prog) print() print(" --help ", "display this help and exit") print(" --version ", "output version information and exit") ...
#!/usr/bin/python3 # -*- coding: utf-8 """Letscode is just a language-aware tool to quickly perform a bunch of usual actions on a piece of code. Letscode provides some kind of convenient abstraction over the different languages you are working with and the related tools (compiler, interpreter, etc). You might not want...
from flask import Flask, request, send_file, Response, render_template, make_response import datetime import hashlib import os import json import uuid import magic import sqlite3 import random import string BASE_PATH="/var/www/curldu.mp/files/" BASE_URL="http://curldu.mp/" SHORTLEN=10 application = Flask(__name__) ap...
from openerp import models, fields, api, _ class res_currency(models.Model): _inherit = 'res.currency' @api.one @api.onchange('rate') # if these fields are changed, call method def check_change_rate(self): import pdb;pdb.set_trace(); self.update_prices() @api.model def update...
class res_currency(models.Model): _inherit = 'res.currency' @api.model def update_prices(self): # Moneda en USD currency_obj = self.pool.get('res.currency') currency_usd = currency_obj.search(['name','=','USD']) products = self.env['product.product'].search([]) fo...
#!/usr/bin/env python # -*-coding: utf-8 -*- """A simple Python file.""" print 'Hello World!'
#! /usr/bin/env python3 import sys import re import threading import pickle import ssl import time import irc.client from telegram import Telegram from config import config help_txt = { 'all' : 'current avaliable commands are: .nick, .help, .join, .list', 'help' : '.help [command] => show help message (for...
#!/usr/bin/env python3 # -*- coding: ascii -*- import sys, os, re, time import operator, collections import fnmatch import threading import sqlite3 import basebot REPLY_TIMEOUT = 3600 GC_INTERVAL = 3600 HELP_TEXT = ''' To add a message to other users' mailbox, use !tell @user1 [@user2 ...] [*group1 ...] message...
import json import logging from optparse import Values from typing import TYPE_CHECKING, Iterator, List, Optional, Sequence, Tuple, cast from pip._vendor.packaging.utils import canonicalize_name from pip._internal.cli import cmdoptions from pip._internal.cli.req_command import IndexGroupCommand from pip._internal.cli...
from threading import RLock from collections.abc import MutableMapping from typeguard import check_argument_types from typing import Any, Callable from .loader import traverse, load sentinel = object() class lazy: """Lazily record the result of evaluating a function and cache the result. This is a non-data des...
#!/usr/bin/python import sys import ansi # Get the size of the current terminal # (http://stackoverflow.com/questions/566746/how-to-get-console-window-width-in-python) def get_terminal_size(): import fcntl, termios, struct h, w, hp, wp = struct.unpack('HHHH', fcntl.ioctl(sys.stdin, termios.TIOCGWINSZ, ...
#!/usr/bin/env python2 # # Copyright 2012-2013 Janis Jansons (janis.jansons@janhouse.lv) # import argparse args=None from SocksiPy import socks import socket # Magic! def getaddrinfo(*args): return [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))] socket.getaddrinfo = getaddrinfo socket.setdefau...
""" Starting point for minimal Flask API. """ # Import package dependencies. from flask import Flask from flask_restful import Resource, Api # Cra=eate a new Flask App. app = Flask(__name__) # Wrap the App in an API. api = Api(app, prefix="/api/v1") # Define dummy data for testing API. users = [ {"email":"th...
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import functools import unittest from unittest.util import safe_repr import operator from polymer_states import Poly...
VERSION = (1, 7, 0, 'final', 0) __version__ = '1.7.0'
# Create your views here. # -*- coding: utf-8 -*- import logging import random import json import sys from django.conf import settings from django.core.urlresolvers import reverse from django.http import HttpResponse from django.views.generic.base import View, TemplateView, RedirectView from django.views.generic.edit...
import itertools import os import numpy as np import pandas as pd def prepare_data(data_dir, hh_sample_file, hh_marginals_file, per_sample_file, per_marginals_file): os.chdir(data_dir) hh_sample = pd.read_csv(hh_sample_file, header=0) hh_sample = hh_sample.astype('int') hh_var_list =...
import sys from poretools.Fast5File import * import matplotlib.pyplot as plt import rpy2.robjects as robjects import rpy2.robjects.lib.ggplot2 as ggplot2 from rpy2.robjects.packages import importr from collections import defaultdict # from kmer import kmercount_in_table ## attempt 1: brute force def singleTablePlot_gg...
"""Portal view functions (i.e. not part of the API or auth)""" from datetime import datetime from pprint import pformat from time import strftime, time import sys from urllib.parse import urlencode from celery.exceptions import TimeoutError from celery.result import AsyncResult from flask import ( Blueprint, ...
"""Portal view functions (i.e. not part of the API or auth)""" from flask import current_app, Blueprint, jsonify, render_template, flash from flask import abort, make_response, redirect, request, session, url_for from flask_login import login_user from flask_user import roles_required from flask_swagger import swagger ...
import numpy as np import random import cvxpy as cvx import pandas as pd from scipy.stats import norm def EstimateWeights(X_c, X_t): """ Function that estimates synthetic control weights for each treated unit. For each treated unit, we find w that minimizes: || w' X_c - X_t ||_2, subject to the weights being...
''' Test package information in various install settings The routines here install the package in various settings and print out the corresponding version info from the installation. The typical use for this module is as a makefile target, as in:: # Print out info for possible install methods check-version-i...
import unittest import sys sys.path.append('roomfinder_web/roomfinder_web') import web_server class FlaskTestCase(unittest.TestCase): def setUp(self): web_server.app.config['TESTING'] = True self.app = demoapp.app.test_client() def test_correct_http_response(self): resp = self.app.ge...
#!/bin/env python # -*- encoding: utf-8 -*- ################################################################################ ## TexPack - Free and open-source TexturePacker alternative ## Copyright (c) 2015 criptych ## ## Released under the MIT License. See LICENSE file for terms. ## ## Disclaimer: This tool was not ...
"""Utilities""" from pkg_resources import resource_filename import warnings from tg.request_local import request from functools import partial, update_wrapper class DottedFileLocatorError(Exception):pass def get_partial_dict(prefix, dictionary): """Given a dictionary and a prefix, return a Bunch, with just item...
#!/usr/bin/env python # vim:ts=4:sw=4:ft=python:fileencoding=utf-8 """TimeLog Simple command line interface to track what tasks are worked on throughout the day. """ # $Id$ __version__ = "$Rev$" import sys import os import traceback import ConfigParser import sqlite3 import ansioutput def gb(): """Global var...
import socket from SimpleCV import Camera, Image import cv2 import numpy import sys import os import time import imgproc import json from valueconfig import ValueConfig from object import Obj from threading import Thread import threading import subprocess ROBORIO_IP = '10.8.62.2' ROBORIO_LISTEN_PORT = 8622 CONFIG_LI...
# ====================================================================== # matscipy - Python materials science tools # https://github.com/libAtoms/matscipy # # Copyright (2014) James Kermode, King's College London # Lars Pastewka, Karlsruhe Institute of Technology # # This program is free software: you...
#!/usr/bin/env python3 # -*- coding: ascii -*- """ A simple curses-based TUI library for Python cwidgets implements an array of classes that can be composed into an interactive text user interface. The UI can be interacted with using standard key bindings (Tab, Space, Return, ...), and adapts to different screen reso...
import os import shutil import subprocess import socket import SocketServer import StringIO import time import threading from Queue import Queue import numpy as np from matscipy.elasticity import full_3x3_to_Voigt_6_stress from matscipy.logger import quiet, screen from ase.atoms import Atoms from ase.io.extxyz impor...
from typing import Any, List import numpy as np from astropy import units as u from astropy.coordinates import CartesianRepresentation from astropy.time import Time, TimeDelta from czml3.core import Packet, Preamble from czml3.enums import InterpolationAlgorithms, ReferenceFrames from czml3.properties import ( Bil...