src
stringlengths
721
1.04M
import json import os def load_config (config_file): ''' Load configuration file as json ''' with open(config_file) as f: config_data = json.load(f) return config_data def get_dbinfo (config): ''' Get database information from config object ''' db_confi...
#!/usr/bin/python # import nwb import test_utils as ut from nwb import nwb_file from nwb import nwb_utils as utils # TESTS storage of reference image def test_refimage_series(): if __file__.startswith("./"): fname = "s" + __file__[3:-3] + ".nwb" else: fname = "s" + __file__[1:-3] + ".nwb" ...
#!/usr/bin/env python # coding=utf-8 import sys # We must use setuptools, not distutils, because we need to use the # namespace_packages option for the "google" package. try: from setuptools import setup, Extension, find_packages except ImportError: try: from ez_setup import use_setuptools us...
 class temple(object): def __init__(self, name, locateRegion, mastergod, religiousBelief, organizationType, location, phone1, phone2): self.name = name self.locateRegion = locateRegion self.mastergod = mastergod self.religiousBelief = religiousBelief self.organizationType = ...
# Importing all library that are used! from random import randint from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait import time def main(): # Yeah, I know it consumes a lot of RAM. # But still i don't know why i always use th...
from .ddt_container import ddt_container from .ddt_tile import ddt_tile from .ddt_tile_html import ddt_tile_html class ddt_container_biPlotAndValidation(ddt_container): def make_biPlotAndValidation(self, data1,data2, data1_keys,data1_nestkeys,data1_keymap, data2_keys,data2_nestkeys,data2_ke...
# -*- coding: utf-8 -*- # pylint: disable-msg=W0612,E1101,W0141 from warnings import catch_warnings, simplefilter import datetime import itertools import pytest import pytz from numpy.random import randn import numpy as np from pandas.core.index import Index, MultiIndex from pandas import (Panel, DataFrame, Series, n...
""" If an application needs to wait for various events and polling is not possible or desirable, one solution is to use a blocking threads for each events. However, multi-threading comes with its pitfalls and problems. This event loop is a framework that allows an application to wait for vario...
from django.conf import settings from django.test import TestCase from django.utils import timezone from slimta.envelope import Envelope from slimta.relay import PermanentRelayError from slimta.queue import QueueError from faker import Factory as FakerFactory from munch.core.models import Category # from munch.core.u...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # 05_mc-roboto documentation build configuration file, created by # sphinx-quickstart on Mon Aug 7 20:04:09 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this...
from django.conf.urls.defaults import patterns, url from threadedcomments.models import FreeThreadedComment, ThreadedComment from threadedcomments import views from voting.views import vote_on_object free = {'model' : FreeThreadedComment} urlpatterns = patterns('', ### Comments ### url(r'^comment/(...
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys sys.path.append("..") # # Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com) # # Pychart 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 Foundati...
#!/usr/bin/python from __future__ import print_function from alchemyapi import AlchemyAPI import argparse import file_utils import json import sys import os from collections import namedtuple alchemyapi = AlchemyAPI() ## ARGPARSE USAGE ## <https://docs.python.org/2/howto/argparse.html> parser = argparse.Ar...
# Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2012, 2013 by the Micromagnum authors. # # This file is part of MicroMagnum. # # MicroMagnum 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) a...
# 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/. """Deprecated by socorro/external/postgresql/service_base.py""" import contextlib import logging import psycopg2 impo...
""" Created on 01/10/2018 @author: aurelio """ from flask import render_template, request, session, redirect, url_for from scisynergy_flask import app from .models import Researcher from flask.helpers import make_response def insert_answer(userid, idx, form): pass @app.route('/questionario', methods=['GET', ...
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved. # # This file is part of kiwi. # # kiwi 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 la...
from __future__ import unicode_literals import datetime from decimal import Decimal import json from django.contrib.auth.models import User, Permission from django.core.urlresolvers import reverse from django.test import TestCase from django.utils.translation import ugettext as _ from backbone.tests.models import Pr...
#!/usr/bin/python """ androidcrypt.py allows access to Android's encrypted partitions from a recovery image. Copyright (C) 2012 Michael Zugelder 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 Sof...
# -*- coding: utf-8 -*- # Copyright 2011-2018 by Luc Saffre. # License: BSD, see LICENSE for more details. """ Basic extension Sphinx setup used to build the Lino documentation. .. rst:role:: blogref Inserts a reference to the blog entry of the specified date. Instead of writing ``:doc:`/blog/2011/0406``...
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import pickle from universal import tools class PickleMixin(object): def save(self, filename): """ Save object as a pickle """ with open(filename, 'wb') as f: pickle.dump(self, f, -1) @classmethod def load...
# -*- 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 o...
import sys, os file, = sys.argv[1:] oldsignaturemap = {} newsignaturemap = {} for line in open(file): line = line.rstrip('\n') try: oldsignature, newsignature, count, example = line.split('\t') except ValueError: print >>sys.stderr, "Questionable line: %r" % (line,) continue c...
import csv, logging from .models import Student, Project from django.contrib.auth.models import User logger = logging.getLogger(__name__) def parse_input_csv(csv_file_wrapper, project_file_wrapper): ''' Takes in raw text and outputs json for group information. Expected format of project_file: Name / ...
#!/usr/bin/env python # Copyright 2017-present Open Networking 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.org/licenses/LICENSE-2.0 # # Unless required b...
from tests.unit.dataactcore.factories.staging import ObjectClassProgramActivityFactory from tests.unit.dataactvalidator.utils import number_of_errors, query_columns _FILE = 'b7_object_class_program_activity_2' def test_column_headers(database): expected_subset = {'row_number', 'gross_outlays_delivered_or_cpe', ...
# Copyright (c) 2015, MapR Technologies # # 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...
import math, cv2 def distance(point1, point2): """ Euclidean distance. """ point1 = point1[0] point2 = point2[0] return math.sqrt(math.pow(point1[0] - point2[0], 2) + math.pow(point1[1] - point2[1], 2)) class Gesture: """ Represent the current state of the hand. """ def __in...
import numpy as np from PIL import Image import scipy.ndimage import matplotlib.pyplot as plt def gabor( theta=0, gamma=1, sigma=2, lam=5.6, k=10 ): # Mutch and Lowe, 2006 theta -= np.pi/2 x,y = np.meshgrid(np.arange(-k,k),np.arange(-k,k)) X = x*np.cos(theta) - y*np.sin(theta) ...
# -*- coding: utf-8 -*- """ Patient Line - Used by Marketing Only Data model. No functions. Created: 16 May 2018 Last up: 29 mar 2021 """ from openerp import models, fields, api from openerp.addons.openhealth.models.patient import pat_vars #from openerp.addons.openhealth.models.libs import eval_vars...
#!python # coding=utf-8 from pyaxiom.netcdf import CFDataset from pyaxiom import logger class IndexedRaggedTimeseries(CFDataset): @classmethod def is_mine(cls, dsg): try: rvars = dsg.get_variables_by_attributes(cf_role='timeseries_id') assert len(rvars) == 1 asser...
# coding: utf-8 """ OAuth2 provider setup. It is based on the code from the example: https://github.com/lepture/example-oauth2-server More details are available here: * http://flask-oauthlib.readthedocs.org/en/latest/oauth2.html * http://lepture.com/en/2013/create-oauth-server """ from flask import Blueprint, reques...
from parcellearning.conv.cgatconv import CGATConv import numpy as np import dgl from dgl import data from dgl.data import DGLDataset import dgl.function as fn from dgl.nn.pytorch import edge_softmax import torch import torch.nn as nn import torch.nn.functional as F class CGAT(nn.Module): """ Instantiate...
# 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, ...
import numpy as np import caffe import os def extract_caffe_model(model, weights, output_path): """extract caffe model's parameters to numpy array, and write them to files Args: model: path of '.prototxt' weights: path of '.caffemodel' output_path: output path of numpy params Returns: None """...
# # Copyright (c) 2004 Conectiva, Inc. # # Written by Gustavo Niemeyer <niemeyer@conectiva.com> # # This file is part of Smart Package Manager. # # Smart Package Manager 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...
import socket from os import kill, getpid from Queue import Full from multiprocessing import Process from struct import Struct, unpack from msgpack import unpackb from cPickle import loads import logging import settings logger = logging.getLogger("HorizonLog") class Listen(Process): """ The listener is resp...
__author__ = 'giacomov' # !/usr/bin/env python # add |^| to the top line to run the script without needing 'python' to run it at cmd # importing modules1 import numpy as np # cant use 'show' inside the farm import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt from matplotlib import gridspec imp...
class Solution: def fullJustify(self, words: [str], maxWidth: int) -> [str]: result = [] start_index, current_length = 0, 0 for i in range(len(words)): if current_length + len(words[i]) > maxWidth: space = maxWidth - current_length + (i - start_index) ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ from cms.models.pluginmodel import CMSPlugin from .conf import settings @python_2_unicode_compatible cla...
# *- coding: utf-8 -*- # mailbox.py # Copyright (C) 2013 LEAP # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This...
import bz2 import os import time from urllib.request import urlopen, Request, urlretrieve def request_(req_url, sleep_time=1): print("Requesting: %s" % req_url) request = Request(req_url) request.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This software may be used and distributed according to the terms of the # GNU General Public License version 2. from eden.integration.lib import hgrepo from .lib.hg_extension_test_base import EdenHgTestCase, hg_test @hg_test # pyre-ignore...
""" You can modify and use one of the functions below to test the gateway service with your account. """ import asyncio import logbook import logbook.more from threema.gateway import ( Connection, GatewayError, util, ) from threema.gateway.simple import TextMessage async def send_via_id(connection): ...
# Copyright 2008-2015 Nokia Solutions and Networks # # 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...
from django.conf import settings from appconf import AppConf from django.utils.translation import ugettext_lazy as _ gettext = lambda s: s class AdsConf(AppConf): class Meta: prefix = 'ads' GOOGLE_ADSENSE_CLIENT = None # 'ca-pub-xxxxxxxxxxxxxxxx' ZONES = { 'header': { 'na...
#!/usr/bin/python #run as array job #if files are bzipped -> copy to local disk and unzip there import os,sys db_dir = sys.argv[1] zipped = sys.argv[2] #are files bzipped? if zipped == 'True': zipped = True else: zipped = False files = os.listdir(db_dir) file = '#$ -S /bin/tcsh\n#$ -cwd\n#$ -V\n' path = os.g...
from __future__ import unicode_literals import uuid from django.core.validators import RegexValidator from django.db import models from stagecraft.apps.organisation.models import Node from stagecraft.apps.users.models import User from django.db.models.query import QuerySet def list_to_tuple_pairs(elements): retu...
# -*- coding: utf-8 -*- import string from infoparser import MInfo class MEGenerator(): """Classe que gera linhas de comando para o MEncoder.""" def __init__(self): self._cut_cmd = string.Template("") self.info = MInfo() self._supported_ops = ['sub','wmv2avi','avixvid'] de...
# python # This file is generated by a program (mib2py). Any edits will be lost. from pycopia.aid import Enum import pycopia.SMI.Basetypes Range = pycopia.SMI.Basetypes.Range Ranges = pycopia.SMI.Basetypes.Ranges from pycopia.SMI.Objects import ColumnObject, MacroObject, NotificationObject, RowObject, ScalarObject, N...
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2019, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. from collections import OrderedDict import pytest from babel.numb...
# Test case for the os.poll() function import os import random import select from _testcapi import USHRT_MAX, INT_MAX, UINT_MAX try: import threading except ImportError: threading = None import time import unittest from test.support import TESTFN, run_unittest, reap_threads try: select.poll except Attribu...
# -*- coding: utf-8 -*- # Copyright (c) 2013-2016, Sebastian Linke # Released under the Simplified BSD license # (see LICENSE file for details). import sys # Fail as early as possible, since some imports may cause errors on old versions if sys.version_info < (2, 7): sys.exit('ERROR: Python interpreter\'s version...
""" Generate report module of OnePiece Platform Usage: a) dic : 1. instantiation 2. call method: read_dic b) json : 1. instantiation 2. call method: read_json API: Input: gen_rpt_path gen_rpt_path: generate report path Ouput: 1) stdout: show the report o...
import superdesk from flask import current_app as app from superdesk.utils import ListCursor from superdesk.geonames import geonames_request, format_geoname_item class PlacesAutocompleteResource(superdesk.Resource): resource_methods = ["GET"] item_methods = [] schema = { "scheme": {"type": "stri...
from __future__ import absolute_import from django.contrib.contenttypes.models import ContentType from django.template import Template, Context from django_comments.forms import CommentForm from django_comments.models import Comment from testapp.models import Article, Author from . import CommentTestCase class Com...
import unittest from decimal import Decimal from datetime import datetime, time from random import randint from pony import orm from pony.orm.core import * from pony.orm.tests import setup_database, teardown_database from pony.orm.tests.testutils import raises_exception db = Database() class Person(db.Entity): i...
from __future__ import unicode_literals from django.db import models from django.conf import settings from django.db.models.signals import post_save from django.dispatch import receiver from rest_framework.authtoken.models import Token def image_path(instance, filename): # file will be uploaded to MEDIA_ROOT/us...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'main_window.ui' # # Created: Tue Aug 5 12:46:39 2014 # by: PyQt4 UI code generator 4.10.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui from floorplanFrameBeh import FloorplanFrame from heate...
# -*- coding: utf-8 -*- u""" Copyright 2016 Telefónica Investigación y Desarrollo, S.A.U. This file is part of Toolium. 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/lic...
"""Copyright 2014 Cyrus Dasadia Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distr...
# Legal boring crap follows. In simple english, you can use this # code in your own project, be your project commercial or free. # Just be sure to include the license and stuff. The "copyright" # here is just for technical reasons. # # Copyright 2011, Philip Peterson. # # This file is part of Pumpkinpy. # # Pumpkinpy ...
#!/usr/bin/env python import linuxcnc import hal import math import time import sys import subprocess import os import signal import glob import re def wait_for_linuxcnc_startup(status, timeout=10.0): """Poll the Status buffer waiting for it to look initialized, rather than just allocated (all-zero). Retu...
import utils as uts import numpy as np from scipy.misc import logsumexp from config import * from thirdparty import log_mvnpdf, log_mvnpdf_diag from scipy.stats import multivariate_normal EPS = np.finfo(float).eps class BatchGauss(object): def __init__(self, param): self.n = param[CLUSTERS] self.th...
import z3 from examples import AclContentCacheScaleTest, NAclContentCacheScaleTest import time import random import sys import argparse def ResetZ3 (): z3._main_ctx = None z3.main_ctx() z3.set_param('smt.random_seed', 42) if __name__ == "__main__": parser = argparse.ArgumentParser(description = 'Non-...
from builtins import range from shyft import api import numpy as np import unittest class TimeAxis(unittest.TestCase): """Verify and illustrate TimeAxis defined as n periods non-overlapping ascending """ def setUp(self): self.c = api.Calendar() self.d = api.deltahours(1) ...
import os import sys import locale try: import configparser except ImportError: import ConfigParser as configparser import logging from extensions import * from babelfish import Language import languagecode class ReadSettings: def __init__(self, directory, filename, logger=None): # Setup loggin...
r"""Codefight challenge (stringsRearrangement), 2017-01-17, by DStauffman.""" #%% Imports import doctest import unittest #%% Functions - is_str_one_off def is_str_one_off(str1, str2): r""" Determines if strings are only one character different from one another. Parameters ---------- str1 : str ...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'data/liveusb-creator.ui' # # Created: Tue Jan 15 12:09:54 2013 # by: PyQt4 UI code generator 4.9.6 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 e...
""" These functions are used to plot the points on google map by years or road types. """ from util import plotSampledPointMap from config import CONFIG def readDatePoints(filename): f = open(filename, 'r') yearPoints = {} for line in f.readlines(): point, info = line.strip("\n").split("==") ...
# -*- coding: mbcs -*- #auto generated by GUI operation. #the template of the original example:ExpAbq00.py #link:http://www.020fea.com/a/5/152/11521.html #explanation: #structure:simple supported beam #load:ConcentratedForce in the midSpan #post:none #comment by lindinan in 20170829 # from part import * from mat...
from django.contrib import admin from edc_base.modeladmin.admin import LimitedAdminInlineMixin from getresults.admin import admin_site from .models import ExportHistory, ImportHistory, CsvFormat, CsvField, CsvDictionary from getresults_csv.forms import CsvDictionaryForm class CsvFieldAdmin(admin.ModelAdmin): li...
from toontown.toonbase.ToontownGlobals import * from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * from toontown.catalog import CatalogItem from toontown.toonbase import ToontownGlobals from direct.distributed import DistributedObject from toontown.toonbase import TTLocalizer impor...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # post_fstab.py # # Copyright © 2013-2018 Antergos # # This file is part of Cnchi. # # Cnchi 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 ...
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011 Piston Cloud Computing, Inc. # Copyright 2012-2013 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # ...
#!/usr/bin/env python # Copyright (c) 2015-2016, Juniper Networks, Inc. # All rights reserved. # # Copyright (C) 2012 Martin Blech and individual contributors. # # See the LICENSE file for further information. """Internal module that provides a common parsing handler.""" from __future__ import absolute_import from . i...
""" The Fibonacci numbers, which we are all familiar with, start like this: 0,1,1,2,3,5,8,13,21,34,... Where each new number in the sequence is the sum of the previous two. It turns out that by summing different Fibonacci numbers with each other, you can create every single positive integer. In fact, a much stronger...
#!/usr/bin/python # -*- coding: UTF-8 -*- from django.db import connection import pytz from django.utils import timezone from django.utils.deprecation import MiddlewareMixin class SqlPrintMiddleware(object): def __init__(self, get_response): self.get_response = get_response def __call__(self, request): res...
from .common import EWSAccountService from ..properties import UserConfiguration from ..util import create_element, set_xml_value ID = 'Id' DICTIONARY = 'Dictionary' XML_DATA = 'XmlData' BINARY_DATA = 'BinaryData' ALL = 'All' PROPERTIES_CHOICES = {ID, DICTIONARY, XML_DATA, BINARY_DATA, ALL} class GetUserConfiguratio...
# -*- coding: utf-8 -*- # Copyright(C) 2015 Baptiste Delpey # # This file is part of a weboob module. # # This weboob module 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...
import json import urlparse kwargs_issues_filters = { 'duplicates': { 'state': 'closed', 'label': 'duplicate' }, 'rejected': { 'state': 'closed', 'label': 'rejected' }, 'done': { 'state': 'closed', 'label': '-rejected,duplicate' }, 'ready': { 'state': 'open', 'label': 'ready' }, 'new': { 'state': '...
#!/usr/bin/env python2 # Description # ----------- # Patch binary to remove anti-debug import sys from lief import ELF import distorm3 def remove_anti_debug(binary): patch = [0x83, 0xf8, 0xff, 0x90, 0x90] # cmp eax, 0xFFFFFFFF ep = binary.header.entrypoint text_section = binary.section_...
""" The schema module helps convert the Curb API REST resources into Python-friendly objects. """ import logging from marshmallow import Schema from marshmallow import fields from marshmallow import validate from marshmallow import pre_dump from marshmallow import pre_load from marshmallow import post_load from curb_e...
#!/usr/bin/env python2 import os import re import natsort import string import netCDF4 as nc import numpy as np import pandas as pd import cPickle as pickle import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from matplotlib.cm import get_cmap from matplotlib import style from scipy import stats fro...
""" This module provides procedures to interact in a programmatic way with the application "Viscosity" from http://www.sparklabs.com/viscosity/ using the OS X applescripting interface. """ import logging import time import applescript from .observer import Subject EVT_VPN_STOPPED = 100 EVT_VPN_STARTED = 101 def c...
''' Manager of controls to insure only one is active: receiving events, being drawn, and it's controlee focused. ''' ''' Copyright 2010, 2011 Lloyd Konneker This file is part of Pensool. Pensool is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as...
#!%PYTHON_BANGPATH% # pypad_glasscoder.py # # Send articulated PAD updates to an instance of glasscoder(1). # # (C) Copyright 2019 Fred Gleason <fredg@paravelsystems.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as #...
# 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 ...
""" Doc string goes here. @author: mje mads [] cnru.dk """ import socket import mne from mne.minimum_norm import make_inverse_operator import os # import subprocess import glob cmd = "/usr/local/common/meeg-cfin/configurations/bin/submit_to_isis" # SETUP PATHS AND PREPARE RAW DATA hostname = socket.gethostname() ...
# -*- coding: utf-8 -*- import os import tempfile import types import json from mock import patch from nose.tools import eq_ from helper import TestCase import appvalidator.constants from appvalidator.errorbundle import ErrorBundle from appvalidator.specs.webapps import WebappSpec import appvalidator.webapp class T...
# import the unit test module import unittest from vending_machine import give_change from vending_machine import give_change_decimal # define a class (inherits from unittest) class TestVendingMachine(unittest.TestCase): # define our method (must because with test_ otherwise the test will not run) def test_re...
# Copyright (C) 2008-2010 Adam Olsen # # 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, or (at your option) # any later version. # # This program is distributed in the hope that...
SERVER_PORT = 31412 PSIZE = 20 WIDTH = 30 HEIGHT = 30 PERIOD = 100 def p2add(u, v): return (u[0] + v[0], u[1] + v[1]) DIRS = [(0, 1), (1, 0), (-1, 0), (0, -1)] NB_APPLES = 3 class Packet: def __init__(self, data = b''): self.start_index = 0 self.data = data def add_position(self, p): ...
""" Tests the difference between importing something globally versus locally """ def bench_local_versus_global_import(): """ Write two python files that loop over a test function that uses some external module. One version imports the dependency globally at startup, the other does a lazy import o...
import dataProcessing as dp import plotFuncs as pf import numpy as np from matplotlib.ticker import MultipleLocator, FormatStrFormatter from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist as AA from matplotlib.path import Path from mpl_toolkits.mplot3d import Axes3D import matplotlib as mp...
import os CURRENT_DIR = os.path.dirname(__file__) ###Default Settings DATA_DIR = 'data' COUNTS_FILE = 'word-totals.txt' WHITE_LIST = 'whitelist.csv' DEFAULT_LIMIT = 50000 DEFAULT_DEPTH = 5 DEFAULT_SYNSETS = 3 ##### DB Dependent variables MYSQL_URL = 'mysql://user:password@host/database?charset=utf8' from sqlalchemy ...
# -*- coding: utf-8 -*- # pylint: disable=too-few-public-methods """ Recursive globbing with ant-style syntax. """ # # The MIT License (MIT) # # Original source (2014-02-17) from https://github.com/zacherates/fileset.py # Copyright (c) 2012 Aaron Maenpaa # # Modifications at https://github.com/jhermann/rituals # Copyri...
__author__ = 'ejs' import errno import glob import logging import inspect import os import sys import platform def mkdirP(path): try: os.makedirs(path) except OSError as exc: # Python >2.5 if exc.errno == errno.EEXIST and os.path.isdir(path): pass else: raise ...