content stringlengths 4 20k |
|---|
#Contains objects for using external display applications
import logging, urllib
from galaxy.util import parse_xml, string_as_bool
from galaxy.util.odict import odict
from galaxy.util.template import fill_template
from galaxy.web import url_for
from parameters import DisplayApplicationParameter, DEFAULT_DATASET_NAME
fr... |
# Subject models to explicit solvent simulation.
#
# John D. Chodera <<EMAIL>> - 17 Feb 2013
#
# PREREQUISITES
#
# * OpenMM
# http://simtk.org/home/openmm
#
# TODO
# * use ff99sb-ildn-star
# * trim all systems to have the same number of waters?
# PARAMETERS
import sys
from ast import literal_eval
# Process only thes... |
from fabric.api import settings, sudo
from cuisine import package_clean, package_ensure, file_exists
import fabuloso.utils as utils
CINDER_CONF = '/etc/cinder/cinder.conf'
CINDER_API_PASTE_CONF = '/etc/cinder/api-paste.ini'
def stop():
with settings(warn_only=True):
sudo("nohup service cinder-api stop")... |
import os
import logging
from pegasus.models import TargetPlatform, Architecture, ProductType
from pegasus.targets.macosx_common import (process_params_for_driver,
link_product_dependency, get_full_product_name, get_full_product_path,
get_full_symbols_path, get_product_install_name, check_source_compiles,
check... |
from datetime import datetime
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import transaction
import olympia.core.logger
from olympia import amo
from olympia.addons.models import Addon
from olympia.amo.decorators import use_primary_db
from olympia.files.utils im... |
from nansat_tools import *
class Nansatshape():
''' Nansatshape class reads and writes ESRI-shape files
The core of Nansatshape is a OGR. the main functions of the class are
1. Create empty object in memory and add data (fields and geometory).
2. Open shape file and read the data.... |
"""
This module performs data fetching from the Infodengue database.
for remote database access, we recommend establishing an SSH tunnel:
ssh -f user@remote-server -L 5432:localhost:5432 -N
"""
import pandas as pd
import random
from sqlalchemy import create_engine
from decouple import config
import pickle
db_engine ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
wid_calibra
a serial port packet monitor that plots live data using PyQwt
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
revision 0.1 201... |
"""
Class for outlier detection.
This class provides a framework for outlier detection. It consists in
several methods that can be added to a covariance estimator in order to
assess the outlying-ness of the observations of a data set.
Such a "outlier detector" object is proposed constructed from a robust
covariance es... |
import argparse
from pythonwarrior.config import Config
from pythonwarrior.game import Game
class Runner(object):
def __init__(self, arguments, stdin, stdout):
self.arguments = arguments
self.stdin = stdin
self.stdout = stdout
self.game = Game()
def run(self):
Config.... |
# -*- coding: utf-8 -*-
import unittest2 as unittest
import logging
from zope.component import getUtility, getMultiAdapter
from plone.registry.interfaces import IRegistry
from plone.portlets.interfaces import IPortletType
from plone.portlets.interfaces import IPortletManager
from plone.portlets.interfaces import IPort... |
from PySide import QtCore
from pyface.qt.QtGui import QWidget, QImage, QPixmap
from pyface.qt import QtGui
from traits.has_traits import HasTraits
from traits.trait_types import Str
from traitsui.item import UItem
from traitsui.basic_editor_factory import BasicEditorFactory
from traitsui.qt4.editor import Editor
from t... |
# -*- coding: utf-8 -*-
import itertools
from sqlparse import sql
from sqlparse import tokens as T
try:
next
except NameError: # Python < 2.6
next = lambda i: i.__next__()
def _group_left_right(tlist, ttype, value, cls,
check_right=lambda t: True,
check_left=lam... |
#!/bin/env python
# -*- coding: utf-8 -*-
MSG_DILIMITER = '\x9E' #0x80+0x1E(RS)
MSG_ESC = '\x9B' #0x80+0x1B(ESC)
ESCAPE_BYTES = (MSG_DILIMITER, MSG_ESC)
def unpack(data) :
packs = []
group = data.split(MSG_DILIMITER)[1:]
for pkg in group:
s = pkg.split(MSG_ESC)
packs.append(''.join([s[... |
"""
Tests for user handling.
"""
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.core import mail
from weblate.accounts.models import Profile
from weblate.trans.tests.test_views import ViewTestCase
from weblate.trans.tests import O... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Version CLI helpers."""
from pathlib import Path
from datetime import datetime
import requests
from .. import __version__
RELEASE_EXPIRY_DAYS = 14
DATE_FMT = "%Y%m%d"
def check_latest():
"""Deter... |
from pytest_bdd import given, when, then
from model.group import Group
import random
@given('a group list')
def group_list(db):
return db.get_group_list()
@given('a group with <name>, <header> and <footer>')
def new_group(name, header, footer):
return Group(name=name, header=header, footer=footer)
@when('I ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import matplotlib.pyplot as plt
import numpy as np
import theano
import theano.tensor as T
from imtoolbox import autocrop
def corrupt(x, corruption_type, corruption_level, theano_rng):
if corruption_type == 'zeromask':
return x * the... |
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
#-------------------------------------------------------------------------
#
# GNOME modules
#
#-------------------------------------------------------------------------
from gi.repository import Gtk
from gi.repository import GObjec... |
# coding: utf-8
# # Accessing ERDDAP from Python
#
# ERDDAP rich responses and RESTful API is makes it **THE** most convenient way to serve data.
#
# One can build URLs manually or programmatically like:
#
# <small>`https://erddap-uncabled.oceanobservatories.org/uncabled/erddap/tabledap/CP05MOAS-GL336-02-FL... |
from openerp.osv import fields, osv
import pdb
class res_partner(osv.osv):
_name = 'res.partner'
_inherit = "res.partner"
def _fnct_recency(self, cr, uid, ids, field_name, args, context=None):
import pdb;pdb.set_trace()
for partner in self.browse(cr,uid,ids,context=context):
sql_string = "select date... |
from __future__ import print_function
import sys
import numpy as np
from keras.preprocessing.image import ImageDataGenerator
import logging
logging.basicConfig(format = u'[%(asctime)s] %(message)s', level = logging.INFO)
from model import get_model
from utils import crps, real_to_cdf, preprocess, rotation_augmentati... |
# -*- coding: utf-8 -*-
import signal
import sys
import threading
import traceback
from time import sleep
import time
import cherrypy
from eliza import run_eliza
import re
from restapi.base import Root
from restapi.resources.messages import SendMessageResource
from restapi.restsettings import CHERRYPY_CONFIG
import set... |
import eventlet
import re
import socket
import socketio
from django.apps.config import AppConfig
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from djangio import listener
naiveip_re = re.compile(r"""^(?:
(?P<addr>
(?P<ipv4>\d{1,3}(?:\.\d{1,3}){3}) | # I... |
"""
sphinx_hdl_diagrams
~~~~~~~~~~~~~~~~~~~~~~~
"""
import os
import re
import codecs
import posixpath
import subprocess
import sys
from os import path
from docutils import statemachine, nodes, io, utils
from docutils.parsers.rst import Directive, directives
from docutils.statemachine import ViewList
import sphinx... |
from hypothesis import given, settings
import pytest
from tests import uid_strategy
from vdirsyncer.repair import IrreparableItem, repair_item, repair_storage
from vdirsyncer.storage.memory import MemoryStorage
from vdirsyncer.utils import href_safe
from vdirsyncer.vobject import Item
@given(uid=uid_strategy)
@set... |
#!/usr/bin/python
import tempfile
import gcode
import sys
def float_fmt(f):
if isinstance(f, float): return "% 5.1g" % f
return "%5s" % f
class Canon:
def __getattr__(self, attr):
"""Assume that any unknown attribute is a canon call; just print
its args and return None"""
def inne... |
import time
import re
from shinken.misc.sorter import hst_srv_sort, last_state_change_earlier
# Will be populated by the UI with it's own value
app = None
def get_page():
app.bottle.redirect("/all?search=%s" % app.PROBLEMS_SEARCH_STRING)
def get_all():
user = app.bottle.request.environ['USER']
# Upda... |
from __future__ import absolute_import
from __future__ import unicode_literals
import dnf.exceptions
import dnf.repo
import dnf.sack
import tests.support
from tests.support import mock
class SackTest(tests.support.DnfBaseTestCase):
REPOS = []
def test_rpmdb_version(self):
version = self.sack._rpmd... |
"""Temperature, learning rate and step size scheduler selection functions."""
import ast
from flax.training import lr_schedule
import jax
from jax import lax
import jax.numpy as jnp
import ml_collections
def get_make_lr_fn(config):
"""Construct the learning rate schedule based on config.
Args:
config: Confi... |
import sys
import portage
from portage import os
from portage import digraph
from portage._sets.base import InternalPackageSet
from portage.dep import Atom
from _emerge.BlockerCache import BlockerCache
from _emerge.Package import Package
from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
... |
{
'name': "Product Ship Balance",
'version': '1.0',
'category': 'product',
'description': """Adds shipping balance""",
'author': 'Comunitea Servicios Tecnologicos',
'website': 'www.comunitea.com',
"depends" : ["base", "product", "mrp_repair", "sale", "account",
"stock_reserv... |
import json
import unittest
import mock
from django.http import HttpResponse
from base import assert_auth_READ
from pulp.server.webservices.views.root_actions import LoginView
class TestLoginView(unittest.TestCase):
"""
Tests for login view.
"""
@mock.patch('pulp.server.webservices.views.decorators... |
"""
EasyBuild support for building and installing WIEN2k, implemented as an easyblock
@author: Stijn De Weirdt (Ghent University)
@author: Dries Verdegem (Ghent University)
@author: Kenneth Hoste (Ghent University)
@author: Pieter De Baets (Ghent University)
@author: Jens Timmerman (Ghent University)
"""
import filein... |
from __future__ import unicode_literals
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.forms.formsets import formset_factory
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _
from shuup.admin.modules.products.forms import... |
from unittest import TestCase
import mock
from nose.tools import raises
from minio import Minio
from minio.api import _DEFAULT_USER_AGENT
from .minio_mocks import MockConnection, MockResponse
class StatObject(TestCase):
@raises(TypeError)
def test_object_is_string(self):
client = Minio('localhost:9... |
# -*- coding: utf-8 -*-
"""
Test cases for rendering exporters
"""
from io import BytesIO
from hashlib import sha256
from unittest import SkipTest
import numpy as np
from holoviews.plotting.mpl.renderer import MPLRenderer
from holoviews import HoloMap, Image, ItemTable
from holoviews.element.comparison import Comparis... |
from Helper import *
import sys, getopt
from typing import *
def main(): #main function that takes in command line arguments and passes them to core algorithm
try:
opts,args = getopt.getopt(sys.argv[1:], 'hp')
for opt in opts:
if(opt[0] == '-p'):
if len(args) != 2:
raise getopt.GetoptError('')
pri... |
from PIL import Image
from io import BytesIO
from random import shuffle
SPACING = 10
VCELLS = 10
MARGIN = 20
hcells = 0
def start(image_byte_array):
original_image = convert_bytes_to_image(image_byte_array)
working_image = create_working_image(original_image)
destination_image = create_destination_imag... |
from elections.models import Candidate
from popular_proposal.models import Commitment
class CommitmentsExporter(object):
def __init__(self, area, position=None):
super(CommitmentsExporter, self).__init__()
self.candidates = []
candidates = Candidate.objects.filter(elections__area=area)
... |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
from azure... |
from flask import Blueprint
from flask import render_template
from flask import request
from flask import abort
from flask import flash
from flask import redirect
from flask import url_for
from flask import current_app
from flask import Response
from flask.ext.login import login_required, current_user
from flaskext.wtf... |
#!/usr/bin/env
# coding=utf-8 pep-0263 ftw!
"""
At the moment, this only tests some codewiki.viewseditor
"""
from django.core.urlresolvers import reverse
from django.test import TestCase
import codewiki
from codewiki.models import Scraper, Code
import datetime
import json
test_new_scraper_params = {
'title'... |
# -*- coding: utf-8 -*-
import os
import sys
import time
import logging
import tweepy
import ConfigParser
from flask import Flask, session, request, abort, json
config = ConfigParser.ConfigParser()
config.read('app.ini')
UPLOAD_FOLDER = os.path.join(os.path.abspath(os.path.dirname(__file__)),
... |
from pyap.playlist.encoder import Encoder
class PLSEncoder(Encoder):
def encode(playlist):
pass |
"""Tests for legendre module.
"""
from __future__ import division, absolute_import, print_function
from functools import reduce
import numpy as np
import numpy.polynomial.legendre as leg
from numpy.polynomial.polynomial import polyval
from numpy.testing import (
assert_almost_equal, assert_raises, assert_equal, ... |
"""
MIMS Configuration File
"""
## Copyright 2017 Marshall E. Giguere
##
## 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... |
"""HTTP endpoints for interacting with vouchers."""
from __future__ import absolute_import
import logging
import django_filters
import pytz
from dateutil.parser import parse
from dateutil.utils import default_tzinfo
from django.shortcuts import get_object_or_404
from django.utils.timezone import now
from opaque_keys.... |
import pytest
from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
def delete_cookie(session, name):
return session.transport.send("DELETE", "/session/%s/cookie/%s" % (session.session_id, name))
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
@pytest.mark.param... |
import sys
sys.path.append( '../pymod' )
import gdaltest
from osgeo import osr
###############################################################################
# Test with WGS 84 datum
def osr_ozi_1():
srs = osr.SpatialReference()
srs.ImportFromOzi(["OziExplorer Map Data File Version 2.2",
... |
import os
import shutil
from jinja2 import Environment, FileSystemLoader
from . import Command, CommandException
from arm.util import get_playbook_root
from arm.conf import settings
class init(Command):
help = "initialize directory structure & files"
def __init__(self, parser):
group = parser.add... |
from scipy.sparse import csr_matrix
from scipy.sparse import spdiags
from scipy.stats import multivariate_normal
import graphlab
import numpy as np
import sys
import time
from copy import deepcopy
from sklearn.metrics import pairwise_distances
from sklearn.preprocessing import normalize
def sframe_to_scipy(x, column_n... |
import curses
import time
import api_example
###########################################################################################################
def getEventsFromZENOSS():
z = api_example.ZenossAPIExample()
# Get events from Zenoss
rawEvents = z.get_events()['events']
events = []
#Iterate th... |
from __future__ import print_function
import io
import os
import optparse
import re
import shutil
import sys
import textwrap
import logging
from mapproxy.compat import iteritems
from mapproxy.version import version
from mapproxy.script.scales import scales_command
from mapproxy.script.wms_capabilities import wms_capa... |
# To be included in pyth.py
class PythParseError(Exception):
def __init__(self, active_char, rest_code):
self.active_char = active_char
self.rest_code = rest_code
def __str__(self):
return "%s is not implemented, %d from the end." % \
(self.active_char, len(self.rest_code)... |
# -*- coding: utf-8 -*-
#
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from rest_framework_bulk import BulkListSerializer, BulkSerializerMixin
from common.utils import signer, validate_ssh_public_key
from .models import User, UserGroup
class UserSerializer(BulkSeria... |
if __name__ == '__main__':
import os
import sys
sys.path.insert (0, os.path.join (sys.path[0], os.pardir))
import unittest
from notify.base import AbstractValueObject
from notify.condition import Condition
from notify.variable import AbstractVariable, Variable
from test.__common import NotifyTe... |
from pkg_resources import resource_filename
import pytest
import numpy.testing as nptest
import pandas.util.testing as pdtest
import numpy
import pandas
from shapely import wkt
from shapely import geometry
import geopandas
from gisutils import vector
from .helpers import raises
@pytest.fixture
def basic_xy():
... |
"""
ZFSpy: Python bindings for ZFS
Copyright (C) 2008 Chen Zheng <<EMAIL>>
This file is licensed under the terms of the GNU General Public License
version 2. This program is licensed "as is" without any warranty of any
kind, whether express or implied.
"""
class OODict(dict):
"""
OODict
OO style dict... |
# -*- coding: utf-8 -*-
"""
The `Node` Class
----------------
The basic building block for the linked list implementation is the
**node**. Each node object must hold at least two pieces of information.
First, the node must contain the list item itself. We will call this the
**data field** of the node. In addition, eac... |
"""Class Rotations
Rotations store n-dimensional arrays of 2D/3D rotations,
represented as complex numbers or quaternions. They can be converted
to and from Rotation<TV> and Array<Rotation<TV> > in O(1) time.
"""
from __future__ import (division,absolute_import)
import numpy
from numpy import *
from . import *
real... |
#coding=utf8
from __future__ import print_function
import os
from uliweb.core.template import *
import time
path = os.path.dirname(__file__)
dirs = [os.path.join(path, 'templates')]
def test():
"""
>>> d = {'myvalue':'XXX'}
>>> print (template("<html>{{= myvalue }}</html>", d))
<html>XXX</html>
""... |
"""Page models."""
from django.db import models
from happening import db
from django_pgjson.fields import JsonField
from pages import utils
from happening.plugins import plugin_enabled
class Page(db.Model):
"""A static page."""
url = models.CharField(unique=True, max_length=255)
title = models.CharField... |
"""
EasyBuild support for installing the Intel Performance Primitives (IPP) library, implemented as an easyblock
"""
from easybuild.easyblocks.generic.intelbase import IntelBase
class EB_ipp(IntelBase):
def sanity_check_step(self):
"""Custom sanity check paths for IPP."""
custom_paths = {
... |
#!/usr/bin/env python
import os
import re
from setuptools import find_packages, setup
with open(os.path.join(os.path.dirname(__file__), "README.rst")) as f:
long_description = f.read()
def get_version(package):
"""
Return package version as listed in `__version__` in `__init__.py`.
"""
path = os... |
"""
Classes and functions for writing SafeBrowsing Records, which are IndicatorRecords with a record type of "SB."
"""
from django.conf import settings
from pivoteer.writer.core import CsvWriter
class SafeBrowsingCsvWriter(CsvWriter):
"""
A CsvWriter implementation for SafeBrowsing Records
"""
def __... |
"""Metadata request handler."""
import hashlib
import hmac
import os
from oslo_log import log as logging
from oslo_utils import secretutils as secutils
import six
import webob.dec
import webob.exc
from nova.api.metadata import base
from nova import cache_utils
import nova.conf
from nova import context as nova_context... |
import imp
import os
import py_compile
import shutil
import tempfile
import unittest
from test import test_support as support
class PyCompileTests(unittest.TestCase):
def setUp(self):
self.directory = tempfile.mkdtemp()
self.source_path = os.path.join(self.directory, '_test.py')
self.pyc_... |
import os
from unittest import TestCase
from tempfile import NamedTemporaryFile
from redislite.db import DB
from redislite.storage.file import Storage
from . import randomword
class TestStorageFile(TestCase):
def setUp(self):
with NamedTemporaryFile(delete=False) as fp:
self.filename = fp.na... |
import mock
from nova import exception
from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit.api.openstack.compute import test_networks
def _fixtures_passthrough(method_name):
# This compensates for how fixtures 3.x handles the signatures of
# MonkeyPatched functions vs fixt... |
from tkinter import *
pseudo = "unasigned"
def channelselect(debug=0):
global pseudo
def getname():
global pseudo
pseudo = name.get()
# print(pseudo)
window.destroy()
# get name function
window = Tk()
# window title
window.wm_title("Twitch database - pseudo"... |
#!/usr/bin/env python3
#######################
# ACE3 Setup Script #
#######################
import os
import sys
import shutil
import platform
import subprocess
import winreg
######## GLOBALS #########
MAINDIR = "x"
PROJECTDIR = "carma2"
##########################
def main():
FULLDIR = "{}\\{}".format(MAINDI... |
import os
import abc
import six
__all__ = ["FileWriter", "TextFileWriter"]
@six.add_metaclass(abc.ABCMeta)
class FileWriter(object):
@abc.abstractmethod
def write(self, data, file_path, replace=False):
"""
Write data to file_path.
"""
pass
class TextFileWriter(FileWriter):
... |
"""
Classes to represent the definitions of aggregate functions.
"""
from django.core.exceptions import FieldError
from django.db.models.expressions import Func, Value
from django.db.models.fields import FloatField, IntegerField
__all__ = [
'Aggregate', 'Avg', 'Count', 'Max', 'Min', 'StdDev', 'Sum', 'Variance',
]
... |
from openerp import models, fields, api, _
import sys
class MrpWorkcenter(models.Model):
_inherit = 'mrp.workcenter'
capacity_per_cycle = fields.Float(
string='Capacity per Cycle Max.', help='Capacity per cycle maximum.')
capacity_per_cycle_min = fields.Float(
string='Capacity per Cycle M... |
from pyramid import testing
from pytest import fixture
class TestTitleSheet:
@fixture
def meta(self):
from adhocracy_core.sheets.title import title_meta
return title_meta
def test_create(self, meta, context):
from adhocracy_core.sheets.title import ITitle
from adhocracy_c... |
import logging
import new
from django import shortcuts
from django.forms.util import flatatt
from django.contrib import messages
from django.core import urlresolvers
from django.utils.translation import string_concat, ugettext as _
from horizon import exceptions
LOG = logging.getLogger(__name__)
class BaseAction(... |
"""
SLB_2005
^^^^^^^^
Minerals from Stixrude & Lithgow-Bertelloni 2005 and references therein
"""
from __future__ import absolute_import
from .. import mineral_helpers as helpers
from ..mineral import Mineral
class stishovite (Mineral):
def __init__(self):
self.params = {
'equation_of_state... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
import sys
import os
import getopt
import struct
import binascii
import locale
import codecs
iswindows = sys.platform.startswith('win')
# Because Windows (and Mac OS X) allows full unicode filenames and paths
# any paths... |
from telemetry.story import story_set as story_set_module
from gpu_tests import gpu_test_base
class GpuRasterizationBlueBoxPage(gpu_test_base.PageBase):
def __init__(self, story_set, expectations):
super(GpuRasterizationBlueBoxPage, self).__init__(
url='file://../../data/gpu/pixel_background.html',
... |
from django.views.generic import TemplateView
from antxetamedia.structure.models import Node
from antxetamedia.recordings.models import News, Program, INTERVIEW
from antxetamedia.multimedia.models import get_orphaned_media
from antxetamedia.agenda.models import Happening
from antxetamedia.misc.models import Widget, Fe... |
"""
homeassistant.components.switch.transmission
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enable or disable Transmission BitTorrent client Turtle Mode.
Configuration:
To use the Transmission switch you will need to add something like the
following to your config/configuration.yaml
switch:
platform: transmiss... |
from itertools import count
PAGE_PARAM = 'page_param'
PAGE_SIZE_PARAM = 'page_size_param'
PAGE_SIZE = 'page_size'
PAGINATION_TYPE = 'pagination_type'
RESULTS_KEY = 'results_key'
NEXT_KEY = 'next_key'
START = 'start'
class PaginationType(object):
ITEM = 'item'
PAGE = 'page'
class PaginatedResults(object):
... |
from qtpy import QtCore
from mantidqt.utils.qt import load_ui
DEFAULT_STACKTRACE_TEXT = "Stacktrace unavailable"
moreDetailsUIBase, moreDetailsUI = load_ui(__file__, 'moredetails.ui')
class MoreDetailsDialog(moreDetailsUIBase, moreDetailsUI):
def __init__(self, parent=None):
super(self.__class__, self)... |
import logging
import re
from odoo import tools, models, fields, api, _
from odoo.exceptions import ValidationError
_logger = logging.getLogger(__name__)
UPC_EAN_CONVERSIONS = [
('none','Never'),
('ean2upc','EAN-13 to UPC-A'),
('upc2ean','UPC-A to EAN-13'),
('always','Always'),
]
class BarcodeNomen... |
# -*- coding: utf-8 -*-
"""Algorithms for directed acyclic graphs (DAGs)."""
# Copyright (C) 2006-2016 by
# Aric Hagberg <<EMAIL>>
# Dan Schult <<EMAIL>>
# Pieter Swart <<EMAIL>>
# All rights reserved.
# BSD license.
from fractions import gcd
import heapq
import networkx as nx
from networkx.utils imp... |
"""
Obtencion de Master Bias y Master Flats
"""
from astropy.io import fits
import scipy as sp
import matplotlib.pyplot as plt
path = "../data/dat."
"""
Esto ya lo sabemos
bias_counter = flats_counter = 0
k = 1
skipped_nums=[]
while 1:
file = "%03d.fits" % k
file_path = path + file
try:
img = fit... |
from api import db
from api.models.tasks import Task
from api.models.users import User
from api.models.groups import Group
from flask_restful import Resource, fields, marshal, reqparse
from flask import url_for, make_response
import json
from datetime import datetime
task_fields = {
'title' : fields.String,
'b... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple flask-based API to access FreeLing functionalities.
"""
__author__ = "Víctor Peinado"
__email__ = "<EMAIL>"
__date__ = "28/06/2013"
import freeling
from flask import Flask, Response, request
from flask.ext.restful import Api, Resource
import json
# #########... |
! /Library/Frameworks/Python.framework/Versions/3.4/bin/python
"""
Assignment Six
by Landon Soriano
"""
import requests
import re
DEBUG = False
STEAM_GAMES_URL = "http://store.steampowered.com/search/?specials=1"
STEAM_GAME_PAT = '<span class="title">.*?-(\d*)%.*?</span>'
STEAM_GAME_DISCAMT = '<span>-(\d*)%</span>'... |
#!/usr/bin/env python3
"""
Segment cards in a given board image and save to a given directory.
type ./segment_cards.py -h for more information
"""
import getopt
import os
import sys
import cv2
from scipy import misc
from segmentboard.segmentboard import extract_cards
from utils.format import bgr2rgb
def usage(com... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# This simple example on how to do animations using graph-tool. Here we do a
# simple simulation of an S->I->R->S epidemic model, where each vertex can be in
# one of the following states: Susceptible (S), infected (I), recovered (R). A
# vertex in the S state becomes inf... |
# ~*~ coding: utf-8 ~*~
from celery import shared_task
from django.utils.translation import ugettext as _
from django.core.cache import cache
from common.utils import get_logger
from ops.celery.decorator import register_as_period_task
from ..models import AdminUser
from .utils import clean_hosts
from .asset_connecti... |
import ipaddress
import logging
import time
class Ptr:
STATUS_UNKNOWN = 0
STATUS_OK = 1
STATUS_NOT_UPDATED = 2
STATUS_NOT_CREATED = 3
STATUS_NOT_AUTHORITATIVE = 4
STATUS_IGNORED = 5
STATUS_FOR_DELETION = 6
def __init__(self, ip_address, ptr, hostname, if_name, status=STATUS_UNKNOWN, c... |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from django.utils.module_loading import import_string
class Command(BaseCommand):
args = '<model model ...>'
help = 'Reorder the model by pk'
def handle(self, *args, **options):
for modelname in args:
... |
import json,codecs,os,glob,time, pickle, collections, requests
import concurrent.futures
import urllib.parse
from urllib.request import urlopen
#Get shrinked urls
shrinkedUrls = [x.strip().decode() for x in urlopen('https://www.dropbox.com/s/y1elvhioeg5tr9f/allShrinks.txt?raw=1').readlines()]
shrinkedUrls.sort()
ses... |
import sys,os,time
from termios import *
from test_DQ import *
if len(sys.argv) < 2:
print "Bad arguments"
sys.exit(2)
cn = DQ(sys.argv[1])
print 'Result of open ' + hex(cn.open())
for i in range(1, 12):
print 'Result of set_channel ' + hex(cn.set_channel(i))
time.sleep(1)
m = 0
res = 5
while res != 0 or m > 6... |
"""SCons.Tool.dlltool
Tool-specific initialization for dlltool.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 The SCons Foundation
#
# Permission ... |
"""
Application-class that implements pyFoamAPoMaFoX.py (A Poor Man's FoamX)
"""
from optparse import OptionGroup
from os import path
import os
import shutil
from PyFoamApplication import PyFoamApplication
from CaseBuilderBackend import CaseBuilderFile,CaseBuilderDescriptionList
from CommonCaseBuilder import CommonCas... |
"""Commands that handle every public message."""
# In general, we want to catch all exceptions, so ignore lint errors for e.g.
# catching Exception
# pylint: disable=broad-except
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.