text
stringlengths
17
737k
########################### # Emulate a (small) DB API over Consul KV store import consul class ConsulDB(): def __init__(self, service, host='localhost', port='8500', separator="/"): self.consul = consul.Consul(host, port).kv self.service = service self.sep = separator def ge...
#!/usr/bin/env python """ checked_dictionary v1.0: restrict-to version v1.1: restrict-if addition """ from pprint import pformat import sys class checked_dictionary(object): """ A checked dictionary structure. Emulates much of the behaviour of a dictionary, but adds the ability to have restrict th...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
from lingcod.common.test_settings_manager import SettingsTestCase as TestCase from lingcod.mpa.models import Mpa, MpaDesignation from lingcod.array.models import MpaArray from django.contrib.auth.models import * from django.test.client import Client from django.core.urlresolvers import reverse from django.contrib.gis.g...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- from __future__ import division from time import time from pyecs import * import hotswap hotswap.run() def onHotswap(): """Called when the source of this module has changed. When a function named 'onHotswap' is present in a module, this function is cal...
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import re import string class Test(object): """ Base class for tests that can be retried after deapplying a previously applied patch. """ def __...
# -*- coding: utf-8 -*- # # Subliminal - Subtitles, faster than your thoughts # Copyright (c) 2011 Antoine Bertin <diaoulael@gmail.com> # # This file is part of Subliminal. # # Subliminal is free software; you can redistribute it and/or modify it under # the terms of the Lesser GNU General Public License as published b...
# __BEGIN_LICENSE__ # Copyright (C) 2008-2010 United States Government as represented by # the Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # __END_LICENSE__ import math import numpy import sys import time from xgds_plot import settings MIN_SEGMENT_LENGTH_MS = (settings....
#! /usr/bin/env python """ SIP Creator for Offline Media Images. """ import sys import os import shutil import glob import imp import argparse import codecs import csv import hashlib import logging from operator import itemgetter from itertools import groupby from lxml import etree from . import config from .mods impo...
# coding: utf-8 from __future__ import (absolute_import, division, print_function, unicode_literals) import hashlib import os from contextlib import contextmanager from shutil import rmtree from notpip.download import is_file_url, url_to_path from notpip.index import PackageFinder from notpip....
import type_utilities def closure_trampoline(value): while type_utilities.is_nullary_closure(value): value = value() return value def make_closure_trampoline_wrapper(handler): return lambda *args: handler(*list(map(closure_trampoline, args))) def pack_trampoline(value): while type_utilities....
#! /usr/bin/env python # -*- coding: iso-8859-1 -*- # vi:ts=4:et # $Id$ import sys import pycurl try: import signal from signal import SIGPIPE, SIG_IGN signal.signal(signal.SIGPIPE, signal.SIG_IGN) except ImportError: pass assert sys.version[:3] >= "2.2", "requires Python 2.2 or better" try: urls...
#! /usr/bin/env python # Kristen K. Dang for Sage Bionetworks # Mar. 21, 2014 # Approximate compute needs: 300 MB RAM, 1 CPU import synapseclient, os, argparse, subprocess, math, shutil, sys, hashlib from synapseclient import File parser = argparse.ArgumentParser(description='Runs samtools variant calling on RNAseq ...
# -*- coding: utf-8 -*- # Copyright 2017 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...
# pylint: disable=invalid-name # # The Qubes OS Project, https://www.qubes-os.org/ # # Copyright (C) 2014-2015 Joanna Rutkowska <joanna@invisiblethingslab.com> # Copyright (C) 2014-2015 # Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> # Copyright (C) 2014-2015 Wojtek Porczyk <woju@inv...
# BuildFox ninja generator import os import re import sys import shutil re_folder_part = re.compile(r"^((?:\(\.\*\)(?:\(\?\![\w\|]+\))?\(\.\*\)|(?:[^\r\n(\[\"\\]|\\.))+)(\\\/|\/|\\).*$") # match folder part in filename regex re_non_escaped_char = re.compile(r"(?<!\\)\\(.)") # looking for not escaped \ with char re_ca...
# -*- coding: utf-8 -*- """ Title: Dumpscript management command Project: Hardytools (queryset-refactor version) Author: Will Hardy (http://willhardy.com.au) Date: June 2008 Usage: python manage.py dumpscript appname > scripts/scriptname.py $Revision: 217 $ Description: Generates a Py...
'''Global configuration state. .. This software is released under an MIT/X11 open source license. Copyright 2013-2014 Diffeo, Inc. This maintains a global configuration dictionary. :func:`get_global_config` will get the entire dictionary, or specific keys from it. ''' from __future__ import absolute_import import...
# Copyright 2014 Open Source Robotics Foundation, 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...
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2014-2019 GEM Foundation # # OpenQuake 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 Licen...
from django.shortcuts import render_to_response, get_object_or_404 from django.http import HttpResponseRedirect from django_fixmystreet.fixmystreet.models import dictToPoint, Report, ReportSubscription, ReportFile, ReportComment, ReportAttachment, OrganisationEntity, FMSUser from django_fixmystreet.fixmystreet.forms...
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2014-2019 GEM Foundation # # OpenQuake 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 Licen...
#!/usr/bin/env python # coding: utf-8 """ Compiles the necesary data to compute the word score for the aligner Usage: word_score [options] <input_file> <output_file> Options: -h --help Show this screen. """ import os import gzip import codecs import logging import tempfile import subprocess from docopt...
import pymatbridge as pymat import numpy.testing as npt import test_utils as tu class TestRunCode: # Start a Matlab session before running any tests @classmethod def setup_class(cls): cls.mlab = tu.connect_to_matlab() # Tear down the Matlab session after running all the tests @classmetho...
# coding=utf-8 """ ``fish_common`` 包含的是最常用用的一些函数和类。 """ # 2016.4.1 create fish_common.py by david.yi # 2016.4.3 edit FishCache class, and edit get_cf_cache # 2016.4.7 v1.0.6, v1.0.7 add get_long_filename_with_sub_dir() # 2016.10.4 v1.0.9 add #19001 check_sub_path_create() # 2017.1.8 v1.0.9 #19003, remove file relat...
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2010-2014, GEM Foundation. # # OpenQuake 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 Lice...
""" module that defines pytables cache """ import datetime import isodate import os import tempfile import tables from tables.exceptions import NoSuchNodeError from pyhis import usgs_core # default hdf5 file path HDF5_FILE_PATH = os.path.join(tempfile.gettempdir(), "pyhis.h5") class USGSSite(tables.IsDescription):...
#!/usr/bin/python import commands, time DEBUG = False class SmartDisk(): """ A class to access information on S.M.A.R.T. disks. Usage: (under construction) """ def __init__(self,diskid,sudo): self.sudo="" if (sudo == 1):self.sudo="sudo " self.diskid = diskid self.vars = "-" self.he...
#!/usr/bin/env python # Copyright (c) 2014 Jan Varho # # 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, me...
# -*- coding: utf-8 -*- # Copyright (c) 2010-2011, GEM Foundation. # # OpenQuake is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 # only, as published by the Free Software Foundation. # # OpenQuake is distributed in the hope that it will be ...
#!/usr/bin/python # # occi_api.py - common functions, classes, and variables for Vcycle # # Andrew McNab, University of Manchester. # Luis Villazon Esteban, CERN. # Copyright (c) 2013-5. All rights reserved. # # Redistribution and use in source and binary forms, with or # without modification, are permitted provi...
""" flaskext.babel ~~~~~~~~~~~~~~ Implements i18n/l10n support for Flask applications based on Babel. :copyright: (c) 2013 by Armin Ronacher, Daniel Neuhäuser. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import os from datetime import datetime from cont...
# The Hazard Library # Copyright (C) 2012 GEM Foundation # # 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 the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # Th...
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. from __future__ import division, unicode_literals """ OpenBabel interface module, which opens up access to the hundreds of file formats supported by OpenBabel. Requires openbabel with python bindings to be ins...
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # LICENSE # # Copyright (c) 2010-2017, GEM Foundation, G. Weatherill, M. Pagani, # D. Monelli., L. E. Rodriguez-Abreu # # The Hazard Modeller's Toolkit is free software: you can redistribute # it and/or modify it under the terms of the GNU Affero Ge...
""" mfuzf1 module. Contains the ModflowUzf1 class. Note that the user can access the ModflowUzf1 class as `flopy.modflow.ModflowUzf1`. Additional information for this MODFLOW package can be found at the `Online MODFLOW Guide <https://water.usgs.gov/nrp/gwsoftware/modflow2000/MFDOC/index.html?uzf_unsaturated_zo...
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2018-2019 GEM Foundation # # OpenQuake 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 Licen...
from __future__ import absolute_import from django.conf import settings from zerver.lib.response import json_error from django.db import connection from zerver.lib.utils import statsd from zerver.lib.queue import queue_json_publish from zerver.lib.cache import get_memcached_time, get_memcached_requests from zerver.lib...
import socket import threading import time import random import struct from Queue import Queue from math import ceil import csv csvfile = open('file.csv', 'wb') writer = csv.writer(csvfile, delimiter=' ',quotechar='|', quoting=csv.QUOTE_MINIMAL) peers = [] History = [] queue = Queue() AckHistory=[] Hlock = threading...
########################################################################## # # Copyright (c) 2018, Matti Gruener. 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 so...
# -*- coding: utf-8 -*- import datetime import calendar import hashlib __blockchain_version__ = "1.0" """Version of the blockchain. Used to versionize the blockchain.""" __block_version__ = "1.0" """Version of the block. Used to versionize the block.""" def utcts(dt): """Will return a UTC timestamp of the given ...
from __future__ import with_statement import sys from optparse import OptionParser, make_option as Option from pprint import pformat from textwrap import wrap from anyjson import deserialize from celery import __version__ from celery.app import app_or_default, current_app from celery.bin.base import Command as Cele...
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2018-2019 GEM Foundation # # OpenQuake 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 Licen...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as 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 'SQLNotificationPreference' db.create_table('edx_notificat...
# encoding: utf-8 from __future__ import unicode_literals import urlparse from collections import namedtuple import wkz_urls class _RI(object): RIComponents = namedtuple('RIComponents', ('scheme', 'auth', 'hostname', 'port', 'path', 'querystr', ...
from functools import wraps import logging import json from datetime import timedelta from django.shortcuts import render, redirect, resolve_url from django.utils.decorators import available_attrs from django.utils.six.moves.urllib.parse import urlparse from django.contrib.auth import REDIRECT_FIELD_NAME from django.c...
from __future__ import print_function, division from sympy.logic.boolalg import And from sympy.core.add import Add from sympy.core.basic import Basic from sympy.core.compatibility import as_int, with_metaclass, range, PY3 from sympy.core.expr import Expr from sympy.core.function import Lambda, _coeff_isneg from sympy....
""" Module containing the environment to run experiments. An :class:`~pypet.environment.Environment` provides an interface to run experiments based on parameter exploration. The environment contains and might even create a :class:`~pypet.trajectory.Trajectory` container which can be filled with parameters and results...
from pypi_notifier import models from pypi_notifier.extensions import db, cache def register_commands(app): @app.cli.command() def init_db(): db.create_all() @app.cli.command() def fetch_package_list(): models.Package.get_all_names() @app.cli.command() def clear_cache(): ...
import requests import urllib2 from pypnrstatus.pnr_utils import * import datetime def get_current_status(passengers): temp='' i = 1 for passenger in passengers: temp = temp+ 'Passenger %s ' % i +'<br/>' + 'Current Status: ' + passenger['status'] temp = temp +'<br/>'+ 'Seat Number:' + passen...
#!/usr/bin/env python # -*- coding: utf-8 -*- # synapse - remcycle.py # Created on 4/28/17. ''' Remcycle provides a mechanism for kicking off asynchronous HTTP(S) requests via Tornado's AsyncHTTPClient. A method for templating URL endpoints, providing default configuration values and user set configuration values, per...
""" This module contains a wrapper api over the various icon source pyqode could use: - icon from theme (linux only) - icon from qrc - icon from qtawesome qtawesome is an optional dependency, it is automatically disabled if the package has not been installed. """ from pyqode.qt import QtGui try: import...
#!/usr/bin/env python # Copyright (c) 2014, Palo Alto Networks # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" A...
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import import copy import datetime as dt import functools import inspect import os import sys import warnings import netCDF4 import numpy as np import pandas as pds import xarray as xr from pysat import _custom from pysat i...
import os import sys import subprocess from tkinter import Canvas from front.module import Module from front.dialogs import Popup from back.console import Console class ModuleSchema(Canvas): def __init__(self, frame, workspace, background): Canvas.__init__(self, frame, background=background) self....
import ctypes import time import os import AppKit from enso_osx.utils import sendMsg key_utils = ctypes.CDLL( os.path.join( __path__[0], "key_utils.so" ) ) def _getClipboardText(): pb = AppKit.NSPasteboard.generalPasteboard() if pb.availableTypeFromArray_( [AppKit.NSStringPboardType] ): return unico...
import math import os import random import sqlite3 import time import traceback import visa from lib.algorithms import rotate_vector from lib.algorithms import zigzag_XY from lib.agilent4156c import Agilent4156C from lib.suss_pa300 import SussPA300 import configure # Set True while desktop development (without ins...
from ggame import App, Sprite, ImageAsset, Frame import math class Stars(Sprite): asset = ImageAsset("starfield.jpg") width = 512 height = 512 def __init__(self, position): super().__init__(Stars.asset, position) class Sun(Sprite): asset = ImageAsset("sun.png") width = 80 he...
import re import cgi import inspect def call(val, view, template=None): if callable(val): (args, _, _, _) = inspect.getargspec(val) if len(args) is 0: val = val() elif len(args) is 1 and args[0] == 'self': val = val(view) elif len(args) is 1: val ...
# -*- coding: utf-8 -*- import threading import types import time # used to eval time.strftime expressions from datetime import datetime, timedelta import logging import openerp.pooler as pooler import openerp.sql_db as sql_db import misc from config import config import yaml_tag import yaml import re from lxml import...
from ggame import App, Sprite, ImageAsset, Frame import math from time import time class Stars(Sprite): asset = ImageAsset("images/starfield.jpg") width = 512 height = 512 def __init__(self, position): super().__init__(Stars.asset, position) class Sun(Sprite): asset = ImageAsset("im...
""" BUILD_ tokens. """ import struct from pyte.exc import ValidationError from pyte.superclasses import _PyteOp, _PyteAugmentedValidator from pyte import tokens, util import pyte class _Builder(_PyteOp): def __init__(self, *args, store: _PyteAugmentedValidator = None): super().__init__(*args) if...
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2014-2018 GEM Foundation # # OpenQuake 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 Licen...
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2014-2019 GEM Foundation # # OpenQuake 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 Licen...
# Copyright 2019 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd import collections import json import pprint import sys import pprint as pp import traceback import numpy as np import jax.nu...
#!/usr/bin/env python from __future__ import print_function import fnmatch import optparse import os import re import sys import textwrap import time import warnings try: from paste.deploy import appconfig except ImportError: appconfig = None import sqlobject from sqlobject import col from sqlobject.classreg...
#----------------------------------------------------------------------------- # ieOS.py # By Grant Miller (blented@gmail.com) # v 1.00 # Created On: 2012/02/06 # Modified On: 2014/05/20 #----------------------------------------------------------------------------- #----------------------------------------------------...
"""For each example (storm object), plots feature maps for one CNN layer.""" import random import os.path import argparse import numpy import matplotlib matplotlib.use('agg') import matplotlib.pyplot as pyplot from keras import backend as K from gewittergefahr.gg_utils import time_conversion from gewittergefahr.gg_uti...
# Copyright (c) 2010-2013, GEM Foundation. # # OpenQuake 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 License, or # (at your option) any later version. # # OpenQuake is distri...
#!/usr/bin/env python2 # Copyright 2016 The Fontbakery Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# cerbero - a multi-platform build system for Open Source software # Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; eit...
"""Test Python utilities related to query language processing.""" import itertools import json import unittest import querylang as ql data = [ {'age': 19}, {'age': 21}, {'age': 23} ] class TestQueryLanguage(unittest.TestCase): """Test suite.""" def run_expressions(self, ast_file, data, baselin...
# -*- coding: utf-8 -*- import configparser import copy import datetime import errno import glob import json import logging import os import shutil import sys import uuid import warnings import webbrowser from marshmallow import ValidationError from ruamel.yaml import YAML, YAMLError from six import string_types from...
import numpy as np import wikipedia import threading from Orange import data from orangecontrib.text.corpus import Corpus class NetworkException(IOError, wikipedia.exceptions.HTTPTimeoutError): pass class WikipediaAPI: attributes = ('pageid', 'revision_id') metas = ('title', 'content', 'summary', 'url')...
#!/usr/bin/env python3 """ Overview ======== A curses-based menuconfig implementation. The interface should feel familiar to people used to mconf ('make menuconfig'). Supports the same keys as mconf, and also supports a set of keybindings inspired by Vi: J/K : Down/Up L : Enter menu/Toggle item H ...
#!/usr/bin/env python # -*- mode: python; coding: utf-8; -*- ################################################################## # Documentation ################################################################## # Imports from __future__ import absolute_import, unicode_literals, print_function from builtins import ra...
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
from os.path import split from piggyback.utils import module_name, PY_IDENT, PY_MODULE, ls class FileFinder(object): def __init__(self, path): self.path, self.fname = split(path) @property def modules(self): return [module_name(self.fname)] class ModuleFinder(object): tree_filters =...
# Load the hourly observations hourly_weather_records = spark.read.parquet("data/2015_hourly_observations.parquet") hourly_weather_records.show() # Group observations by station (WBAN) and Date... # then gather a list of of hourly observations for that day from frozendict import frozendict records_per_station_per_day ...
#!/usr/bin/env python2.5 # # Copyright 2009 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
from requests_oauthlib import OAuth2Session from flask import request, redirect, session, url_for, render_template, flash from werkzeug.urls import iri_to_uri from config import client_id, client_secret, authorization_base_url, \ token_url, scope, redirect_uri from model import OrcidUser from model import UserRole ...
#!/usr/bin/env python2.5 # # Copyright 2011 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Matti Hamalainen <msh@nmr.mgh.harvard.edu> # # License: BSD (3-clause) from copy import deepcopy from functools import partial from gzip import GzipFile import os import os.path as op import numpy as np from scipy import sparse, linalg...
# lowdimPair <master> <inputFile_X1> <inputFile_X2> <inputFile_y1> <mode> <outputFile> <k>" # # perform dimensionality reduction on data set 1 # then examine responses from data set 2 in the recovered subspace # return low-dimensional subspace, as well as raw time # series projected into that space # each row is (x,y,...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import tensorflow as tf import numpy as np import os FLAGS = tf.app.flags.FLAGS tf.app.flags.DEFINE_string( "train_dir", "flickr_logos_27_dataset", "Directory where to write event logs and checkpoint.") tf.app.flags.DEFINE_int...
#!/usr/bin/env python import subprocess from subprocess import check_output, check_call, Popen, PIPE, STDOUT from datetime import datetime import os from os import path import argparse import tempfile import re import traceback import shutil CONTROL ="""\ Source: bohrium Section: devel Priority: optional Maintainer: ...
#!/usr/bin/env python # # Copyright 2016 Blaise Frederick # # 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...
from __future__ import print_function, division, absolute_import#, unicode_literals # not casa compatible from builtins import bytes, dict, object, range, map, input#, str # not casa compatible from future.utils import itervalues, viewitems, iteritems, listvalues, listitems from io import open import pickle import os....
# -*- coding: utf-8 -*- """ Functions for manipulating wiki-text. Unless otherwise noted, all functions take a unicode string as the argument and return a unicode string. """ # # (C) Pywikibot team, 2008-2019 # # Distributed under the terms of the MIT license. # from __future__ import absolute_import, division, unico...
#!/usr/bin/python import numpy as np import numpy.linalg as linalg from qitensor.array import HilbertArray from qitensor.space import HilbertSpace from qitensor.exceptions import MismatchedSpaceError # This is the only thing that is exported. __all__ = ['TensorSubspace'] def _unreduce_v1(basis, perp_basis, tol, hil...
# # The Qubes OS Project, http://www.qubes-os.org # # Copyright (C) 2016 Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de> # # This library 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 ...
from threading import Thread import glob import os import shutil import pecan import git import yaml import datetime from joulupukki.common.logger import get_logger, get_logger_path from joulupukki.common.carrier import Carrier from joulupukki.common.datamodel.job import Job from docker import Client import time i...
# ---------------------------------------------------------------------------- # Copyright 2016 Nervana Systems 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.o...
from tqdm import tqdm from shapely.geometry import Point from shapely.geometry.polygon import Polygon from datetime import timedelta import numpy as np from dateutil import parser import re import json from nltk.corpus import stopwords from lshash import lshash from scipy.optimize import minimize def RemoveStopWords(s...
#! /usr/bin/env python3 import asyncio import aiobotocore from datetime import datetime import io import umsgpack _records = [] _max_qlen = 0 _ev_flush = None def init(loop, opts): global _max_qlen, _ev_flush assert opts['codec'] in ('msgpack', 'text') ev = asyncio.Event(loop=loop) _ev_flush = ev ...
#!/usr/bin/env python # # Copyright (c) 2007-2008 rPath, Inc. # # This program is distributed under the terms of the Common Public License, # version 1.0. A copy of this license should have been distributed with this # source file in a file called LICENSE. If it is not present, the license # is always available at http...
import sublime import sublime_plugin class ChangeHeadingLevelCommand(sublime_plugin.TextCommand): def run(self, edit, up=True): for region in self.view.sel(): line = self.view.line(region) if up: # Increase heading level if not self.view.substr(line)...
""" Tests for dvol docker integration. Assumes that: * we have docker running and are running as root or a user in the docker group * we have dvol under test installed in /usr/local/bin (as per Makefile) * we have dvol docker plugin installed and running * we are not running in parallel with ourselves * we have access...
from edisgo.grid.network import Network, Scenario, TimeSeries, Results from edisgo.flex_opt import reinforce_grid import os import pickle import pandas as pd from ast import literal_eval import numpy as np timeseries = TimeSeries() scenario = Scenario(timeseries=timeseries) network = Network.import_from_ding0( os...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...