content stringlengths 4 20k |
|---|
from __future__ import absolute_import, division, print_function
from toolz import memoize, merge
from functools import wraps
from .csv import CSV
import datashape
import sqlalchemy as sa
from datashape import discover, dshape
from datashape import coretypes as ct
from collections import namedtuple
from contextlib im... |
"""A collection of kernels and kernel generators
These are mainly for use in kernel PLS. All of the kernels have the form
K(x, y) where x and y are either floats or numpy.ndarray of float.
"""
import math
from . import *
def std_gaussian(x, y):
"""A Gaussian kernel with width 1.
The Gaussian kernel with s... |
#!/usr/bin/env python
"""Script that will grab doxygen strings from a
.cpp file and stuff them in the corresponding
.sip file under a %Docstring tag"""
import os
import sys
from optparse import OptionParser
#----------------------------------------------------------
def findInSubdirectory(filename, subdirectory=''):
... |
import threading
_local = threading.local()
_local.session_id = None
def get_current_session_id() -> str:
"""
Get current session id for current
request.
This function should be used only whithin
request context. Out of request context
it always return None
"""
global _local
if ... |
from gi.repository import Gtk, GLib, Gio, WebKit2
from time import time
from gettext import gettext as _
from eolie.define import El
class DownloadRow(Gtk.ListBoxRow):
"""
A Download row row
"""
def __init__(self, download, finished):
"""
Init row
@param download ... |
#-*- coding: utf-8 -*-
from django.db import models, transaction
from django.core.exceptions import ValidationError
from base.models import ScoutChief, EventHappening
class ScoutChiefSubscription(models.Model):
scout_chief = models.ForeignKey(ScoutChief)
event_happening = models.ForeignKey(EventHappening)
... |
from testutils import mock
from rmake_test import rmakehelp
from rmake.build import imagetrove
class ImageTroveTest(rmakehelp.RmakeHelper):
def testImageTrove(self):
trv = imagetrove.ImageTrove(1, *self.makeTroveTuple('group-foo'))
assert(trv.isSpecial())
trv.setProductName('foo')
... |
#!/usr/bin/env python -u
"""
Interpolate the values along the seam, saving them out to a image file.
Author: Zachary Ferguson
"""
from __future__ import print_function
import os
import sys
import argparse
import includes
from find_seam import find_seam, seam_to_UV
from seam_intervals import compute_edge_intervals
i... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class ListMergeVars(Choreography):
def __init__(self, temboo_session):
"""
Create a... |
# -*- coding: ascii -*-
r"""
:Copyright:
Copyright 2015
Andr\xe9 Malo or his licensors, as applicable
:License:
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... |
{
# 'repo_type' : 'mercurial',
# 'url' : 'https://hg.libsdl.org/SDL',
# 'folder_name' : 'sdl2_hg',
'repo_type' : 'archive',
'download_locations' : [
{ 'url' : 'https://www.libsdl.org/release/SDL2-2.0.12.tar.gz', 'hashes' : [ { 'type' : 'sha256', 'sum' : '349268f695c02efbc9b9148a70b85e58cefbbf704abd3e91be654db7f1... |
"""
.. module: security_monkey.watchers.github.team
:platform: Unix
:synopsis: Watcher for GitHub Organization Teams.
.. version:: $$VERSION$$
.. moduleauthor:: Mike Grima <<EMAIL>>
"""
from security_monkey import app
from security_monkey.common.github.util import get_github_creds, iter_org, strip_url_fields... |
"""!
BlenderFDS, extension of Blender types.
"""
import bpy
from bpy.types import Material, Scene, Object, Collection
import time, sys, logging
from . import lang, io, fds
from .lang import bf_namelists_by_cls, bf_namelists_by_fds_label
from .types import FDSCase
from .utils import BFException, BFNotImported
log = ... |
from django.db import models
from django import forms
from django.contrib import admin
from oi.settings import CITY_LIST
class Petitioner(models.Model):
firstname = models.CharField("Ad", max_length=30)
lastname = models.CharField("Soyad", max_length=30)
city = models.CharField("Şehir", blank=True, choice... |
from unittest import TestCase
from mock import mock
from Networking.Authentication import AuthenticationHandler
from Networking.Errors import AuthenticationError
from tests.test_utils.NetworkUtils import ConnectionMock
class BannedAddressesMock:
def __init__(self, addresses_to_add=None):
self.cache = []... |
"""Support for Locative."""
import logging
from typing import Dict
import voluptuous as vol
from aiohttp import web
import homeassistant.helpers.config_validation as cv
from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER
from homeassistant.const import (
HTTP_UNPROCESSABLE_ENTITY,
ATT... |
"""'type-providers describe' command."""
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.deployment_manager import dm_beta_base
from googlecloudsdk.command_lib.deployment_manager import type_providers
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Describe(base.DescribeCommand):
"""Des... |
'''
numword for EU
'''
from .numword_base import NumWordBase
class NumWordEU(NumWordBase):
'''
NumWord EU
'''
def _set_high_numwords(self, high):
'''
Set high num words
'''
max_val = 3 + 6 * len(high)
for word, i in zip(high, list(range(max_val, 3, -6))):
... |
import unittest2
import webtest
import json
import webapp2
from datetime import datetime
from google.appengine.ext import ndb
from google.appengine.ext import testbed
from consts.district_type import DistrictType
from consts.event_type import EventType
from controllers.api.api_event_controller import ApiEventContro... |
import importlib
import unittest
try:
import unittest.mock as mock
except ImportError:
import mock
from oslo_config import cfg
import six
CONF = cfg.CONF
class SerialPortHandlerTests(unittest.TestCase):
def setUp(self):
self._serial = mock.MagicMock()
self._stream = mock.MagicMock()
... |
import math
import function_binary_conv2d
from chainer import initializers
from chainer import link
import numpy
class Convolution2D(link.Link):
"""Two-dimensional convolutional layer.
This link wraps the :func:`~chainer.functions.convolution_2d` function and
holds the filter weight and bias vector as... |
import unittest
from airflow import DAG
from airflow.contrib.operators.discord_webhook_operator import DiscordWebhookOperator
from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2018, 1, 1)
class TestDiscordWebhookOperator(unittest.TestCase):
_config = {
'http_conn_id': 'discord-webhook-... |
#!/usr/bin/env python
from distutils.core import setup
#for cmd in ('egg_info', 'develop'):
# import sys
# if cmd in sys.argv:
# from setuptools import setup
#
version='0.1.5'
setup(
name='fabtest',
version=version,
author='Mikhail Korobov',
author_email='<EMAIL>',
packages=['fabtest... |
#!data-env/bin/python3
import pygsheets
import sys
import csv
valid = {"yes": True, "y": True, "ye": True,
"no": False, "n": False}
def read_csv(ifile):
with open(ifile) as file:
reader = csv.reader(file, delimiter=',', quotechar='|')
rows = []
for row in reader:
ro... |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'orgchartapp.views.homepage'),
url(r'^employees/', 'orgchartapp.views.byEmployee'),
url(r'^orgchart/(?P<manager_id>\d... |
# # # # #
# wrap downscaler for running on slurm
# # # # #
def run_model( fn, base_dir, variable, model, scenario, units, metric ):
import os, subprocess
head = '#!/bin/sh\n' + \
'#SBATCH --ntasks=32\n' + \
'#SBATCH --nodes=1\n' + \
'#SBATCH --ntasks-per-node=32\n' + \
'#SBATCH --account=snap\n' + \
... |
import ConfigParser
import argparse
import json
import os.path
import requests
import time
class Poller():
def __init__(self, config):
self.config = config
self.username = self.config.get("Auth", "username")
self.password = self.config.get("Auth", "password")
self.git_user = self.... |
#!/usr/bin/python
import os
import sys, getopt
import csv
import random
from pydub import AudioSegment
import time, datetime
import pandas as pd
import numpy as np
import subprocess
from time import gmtime, strftime
here = os.path.abspath(os.path.dirname(__file__))
sys.path.append(here)
def media_duration(media_pat... |
# coding: utf-8
from __future__ import unicode_literals
import json
from boxsdk.config import API
from boxsdk.object.web_link import WebLink
def test_get(mock_box_session, test_web_link):
# pylint:disable=redefined-outer-name, protected-access
web_link_id = test_web_link.object_id
expected_url = '{0}/{1... |
import csv
import urllib2
import ListParamSub
import sys
class Subscription:
def __init__(self, csv_path,top):
self.raw_csv_list = list(csv.reader(open(csv_path, 'r')))
self.csv_list = ListParamSub.parseList(self.raw_csv_list)
self.csv_headers = self.csv_list[0]
self.csv... |
import numpy
import numpy.random
numpy_rng = numpy.random.RandomState(1)
import pylab
import theano
import sklearn_theano
import sklearn_theano.feature_extraction
import sklearn_theano.utils
from scipy import ndimage
network = "googlenet" #"overfeat" or "googlenet"
contentimagefile = "./contentimage.png"
styleimag... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
RAlgorithmProvider.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
********************... |
"""
Dependency resolution functionality, a.k.a. robot.
: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)
:author: Toon Willems (Ghent University)
:author... |
import re
import urllib
import urllib2
from ClosedSwarm import read_poa_from_file
def wx_get_poa(root_window=None):
"""
Pop up a graphical file selector
"""
import wx
import sys
print >>sys.stderr, "Using GUI poa browser"
fd = wx.FileDialog(root_window, "Select Proof of Access", wildcard="... |
"""
Generally speaking, compass provides a command line util that is used
a) as a management script (like django-admin.py) doing for example
setup work, adding plugins to a project etc), and
b) can compile the sass source files into CSS.
While generally project-based, starting with 0.10, compass supposedly
sup... |
################################################################################
### Copyright © 2012-2013 BlackDragonHunt
###
### This file is part of the Super Duper Script Editor.
###
### The Super Duper Script Editor is free software: you can redistribute it
### and/or modify it under the terms of the GNU Genera... |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <<EMAIL>>'
__docformat__ = 'restructuredtext en'
import struct
from collecti... |
from paramiko.common import linefeed_byte_value, crlf, cr_byte, linefeed_byte, \
cr_byte_value
from paramiko.py3compat import BytesIO, PY2, u, b, bytes_types
from paramiko.util import ClosingContextManager
class BufferedFile (ClosingContextManager):
"""
Reusable base class to implement Python-style file ... |
# -*- coding: utf-8 -*-
# --------------------------------------------------------
# Conector jplayer By Alfa development Group
# --------------------------------------------------------
import urllib
from core import httptools
from core import jsontools
from core import scrapertools
from platformcode import logger
... |
#!/bin/python
import array
import re
import sys
from DflatPredicateHandler import *
class ProgramMaker:
def startsIn(self, k):
for l in self._preds:
if k.startswith(l):
return True
return False
def __init__(self):
self._makeHeuristicProgram = True
self._reorgTDNumberspace = True
self._startReorg ... |
"""The volumes snapshots api."""
from oslo_log import log as logging
from oslo_utils import strutils
import webob
from webob import exc
from cinder.api import common
from cinder.api.openstack import wsgi
from cinder import exception
from cinder.i18n import _, _LI
from cinder import utils
from cinder import volume
L... |
import time
from sensorvalues import units
from sensorvalues.tempvalue import TempValue
class Interface(object):
def __init__(self):
pass
class Sensor(object):
"""
A sensor object with the following attributes:
id: unique id
name: sensor's name
label: a descriptive label... |
"""Autorecovery UI"""
import weakref
import os.path
from datetime import datetime
from gettext import gettext as _
import shutil
import logging
logger = logging.getLogger(__name__)
from gi.repository import Gtk
from gi.repository import GLib
import lib.document
import lib.helpers
import lib.errors
class Presenter ... |
"""
Provides generic filtering backends that can be used to filter the results
returned by list views.
"""
from __future__ import unicode_literals
import operator
from functools import reduce
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from dja... |
"""
Author: PH01L
Email: <EMAIL>
Website: https://www.osrsbox.com
Copyright (c) 2019, PH01L
###############################################################################
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 F... |
"""Some common functionality for beets' test cases."""
from __future__ import division, absolute_import, print_function
import time
import sys
import os
import tempfile
import shutil
import six
import unittest
from contextlib import contextmanager
# Mangle the search path to include the beets sources.
sys.path.inser... |
import datetime as dt
import numpy as np
import sys
import get_data
import allocation_sharpe_optimizer
import simulate_portfolio_allocation as smlt
import all_permutes as permutes
#Allow to disable printing allocation_sharpe_optimizer
class NullDevice():
def write(self, s):
pass
def backtes... |
#!/usr/bin/env python3
"""XSLSTokenizer is the lexical analyzer of xslclearer."""
from .tokenizer_exception import (
UnexpectedCharacter,
InvalidSelector,
UnableToConvertCSSSelector
)
import re
from .css_to_xpath import PatchedTranslator
class Tokenizer:
"""Tokenizer for .xsls files"""
def __init... |
__all__ = ['contHSRA']
import numpy as np
def contHSRA(wavelength, units='frequency'):
"""
Return the continuum spectrum of the HSRA model, obtained as a 3rd degree polynomial fit. This gives
a maximum error of 0.125%
Args:
wavelength (float): wavelength in Angstrom
units (str, op... |
import os
import random
import sys
import time
try:
from hashlib import md5 as _md5
except ImportError:
import md5
_md5 = md5.new
from django.conf import settings
from django.template.loader import render_to_string
from django.contrib.sites.models import Site
from django.db import models
from django.utils... |
# -*- coding: utf-8 -*-
from google.appengine.ext import ndb
import hashlib
import datetime
import random
class ArticleTag(ndb.Model):
''' A module that represent tags of articles, dont forget tags in your blogs! They are like keywords '''
tags = ndb.StringProperty(repeated=True) # tags name
add_date = nd... |
from flask import request, g, abort
from flask_restplus import Resource, fields
from pyinfraboxutils.ibflask import auth_required, OK
from pyinfraboxutils.ibrestplus import api
from api.namespaces import project as ns
collaborator_model = api.model('Collaborator', {
'name': fields.String(required=True),
'id'... |
from celery import Celery
import cv2
import numpy as np
import json
c = Celery(main='romanesco', backend='amqp', broker='amqp://guest:guest@localhost:5672//')
class NumPyArangeEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.ndarray):
return obj.tolist() # or map(int, ... |
from __future__ import absolute_import
import math
SNAP = 0.001
class Vector2(object):
def __init__(self, x=0.0, y=0.0):
self.x = x
self.y = y
class Vector3(object):
def __init__(self, x=0, y=0, z=0):
self.x = x
self.y = y
self.z = z
def clone(self):
... |
import frappe
from json import loads
from frappe.desk.doctype.workspace.workspace import get_link_type, get_report_type
def execute():
frappe.reload_doc('desk', 'doctype', 'workspace')
pages = frappe.db.sql("Select `name` from `tabDesk Page`")
# pages = frappe.get_all("Workspace", filters={"is_standard": 0}, pluck... |
from blivet.devices import DiskDevice, PartitionDevice, MDRaidArrayDevice
from blivet.devices import BTRFSVolumeDevice, BTRFSSubVolumeDevice
from blivet.devicelibs.raid import RAID1
from blivet.formats import get_format
from blivet.size import Size
from pyanaconda.modules.storage.bootloader.grub2 import GRUB2
import ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django_markdown.models
class Migration(migrations.Migration):
dependencies = [
('core', '0044_auto_20151026_1133'),
]
operations = [
migrations.AddField(
model_nam... |
from typing import List
from senf import fsnative, path2fsn
from ._audio import AudioFile
extensions: List[str] = []
class RemoteFile(AudioFile):
is_file = False
fill_metadata = True
format = "Remote File"
def __init__(self, uri):
assert not isinstance(uri, bytes)
self["~uri"] = ... |
'''Compatibility functions for python 2 and 3.
@author Bernhard Leiner (bleiner AT gmail com)
@author Alexander Belchenko (alexander belchenko AT gmail com)
'''
__docformat__ = "javadoc"
import sys, array
if sys.version_info[0] >= 3:
# Python 3
Python = 3
def asbytes(s):
if isinstance... |
import sys
import argparse
import json
import base64
import zlib
import time
import subprocess
#
# Construct a basic firmware description
#
def mkdesc():
proto = {}
proto['magic'] = "PX4FWv1"
proto['board_id'] = 0
proto['board_revision'] = 0
proto['version'] = ""
proto['summary'] = ""
proto['description'] = ""... |
"""
Theming aware template loaders.
"""
from django.core.exceptions import SuspiciousFileOperation
from django.template.loaders.filesystem import Loader as FilesystemLoader
from django.utils._os import safe_join
from edxmako.makoloader import MakoLoader
from openedx.core.djangoapps.theming.helpers import get_all_theme... |
# Logging level 2 = Verbose, 1 = Default, or 0 = None
log_level = 2
# Logging to irc, same levels as above
irc_log_level = 2
# Regex name filter, anyone that does not match this will be removed.
# currently all keys normally on a keyboard. cubeworld really isnt picky.
name_filter = "^[a-zA-Z0-9_!@#$%\^&*()\[\]|:;'.,/... |
"""Hypervisor action implementations"""
import re
from novaclient import exceptions as nova_exceptions
from osc_lib.command import command
from osc_lib import utils
from openstackclient.i18n import _
class ListHypervisor(command.Lister):
_description = _("List hypervisors")
def get_parser(self, prog_name)... |
import os
import sys
def GetChromiumSrcDir():
return os.path.abspath(os.path.join(
os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, os.pardir))
def GetGpuTestDir():
return os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
def AddDirToPathIfNeeded(*path_parts):
path = os.pa... |
from msrest.serialization import Model
class SecurityGroupNetworkInterface(Model):
"""Network interface and all its associated security rules.
:param id: ID of the network interface.
:type id: str
:param security_rule_associations:
:type security_rule_associations:
~azure.mgmt.network.v2017_... |
import time
from datetime import datetime
import requests
import json
channels = {
'600':'bbc2hd',
'505':'bbc1hd',
'10005':'itvhd',
'1540':'channel4hd',
'1547':'channel5',
'1520':'film4'
}
listings_dict = {}
def get_tv_listings():
listings_dict.clear()... |
import numpy as np
import sys,os
parent_path=os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(parent_path)
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from mlpy import writemda64,writemda32,readmda,DiskReadMda
from common import TimeseriesChunkReader
# we no longer use cppi... |
from datetime import datetime
from werkzeug import cached_property
from flask import Markup
from flaskext.sqlalchemy import BaseQuery
from flaskext.principal import Permission, UserNeed, Denial
from newsmeme import signals
from newsmeme.extensions import db
from newsmeme.permissions import auth, moderator
from newsm... |
import importlib
import yaml
import sys
import os
import io
import instructor
import translator
env = {}
me = {}
def setup_environnement():
global env
global me
# get spider own path
own_path = os.path.dirname(os.path.abspath(__file__))
# verify it
if not os.path.isdir(own_path):
raise Exception('Error w... |
import subprocess, sys, os, glob, re
import yaml
from dirs_lib import *
LOG_PATH_RE = re.compile(r" *Refer to '([^']+)' for details")
def run_cmd(program, args, accept_no_output=False, env=None, verbose=False):
cmd = [program] + args
#print ' '.join("'%s'" % e if ' ' in e else e for e in cmd)
process = s... |
# -*- coding: utf-8 -*-
"""
(c) 2012-2021 Martin Wendt; see https://github.com/mar10/pyftpsync
Licensed under the MIT license: https://www.opensource.org/licenses/mit-license.php
"""
import json
import time
from ftpsync import __version__
from ftpsync.util import (
get_option,
make_native_dict_keys,
prett... |
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
try:
from django.contrib.auth import get_user_model
except ImportError: # Django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
... |
""" Models for displaying maps in Bokeh plots.
"""
from __future__ import absolute_import
from ..properties import HasProps, abstract
from ..properties import Enum, Float, Instance, Int, JSON, Override
from ..enums import MapType
from ..validation.warnings import MISSING_RENDERERS, NO_GLYPH_RENDERERS
from ..validatio... |
#!/usr/bin/python
# coding=utf-8
from __future__ import print_function
import os, sys
from unidecode import unidecode
import flask
import requests, socket
app = flask.Flask(__name__)
app.debug = True
# Flask settings
host='localhost'
port=4242
# Solr settings
solr = {'host': 'localhost', 'port':8080,
'c... |
"""
Copyright (C) 2014-2015, Zoomer Analytics LLC.
All rights reserved.
License: BSD 3-clause (see LICENSE.txt for details)
"""
import sqlite3
import os
from xlwings import Workbook, Range
def playlist():
"""
Get the playlist content based on the ID from the Dropdown
"""
# Make a connection to the ca... |
# -*- coding: utf-8 -*-
"""
This is part of WebScout software
Docs EN: http://hack4sec.pro/wiki/index.php/WebScout_en
Docs RU: http://hack4sec.pro/wiki/index.php/WebScout
License: MIT
Copyright (c) Anton Kuzmin <http://anton-kuzmin.ru> (ru) <http://anton-kuzmin.pro> (en)
Class for logging WS output
"""
import codecs
... |
__source__ = 'https://leetcode.com/problems/n-ary-tree-postorder-traversal/'
# Time: O(N)
# Space: O(N)
#
# Description: Leetcode # 590. N-ary Tree Postorder Traversal
#
# Given an n-ary tree, return the postorder traversal of its nodes' values.
#
# For example, given a 3-ary tree:
#
# Return its postorder traversal ... |
from django import forms
from django.core.validators import validate_email
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from .utils import get_user_model
class PasswordRecoveryForm(forms.Form):
username_or_email = forms.CharField()
error_messages = {
'not_fo... |
"""
This plugin matches incoming identifiers to Publisher configurations from the database.
It's a bit special - instead of storing what license statements match to what licenses
in the code, it fetches these (called Publisher configurations) from the database.
"""
import requests
from openarticlegauge import plugin
f... |
"""Support for Google - Calendar Event Devices."""
import logging
import os
import yaml
import voluptuous as vol
from voluptuous.error import Error as VoluptuousError
import homeassistant.helpers.config_validation as cv
from homeassistant.setup import setup_component
from homeassistant.helpers import discovery
from h... |
# -*- coding: UTF-8 -*-
from payment.models import Novedad, Pensionado
from decimal import *
class PayingRules():
def __init__(self):
pass
def calculate(self, pensionado_id, tipo_aporte):
monto = None
# SALUD
if tipo_aporte == '01':
tarifa = self.calcularSaludConN... |
from .gpxfile import get_hr_measurements
from .utils import interpolate
from operator import itemgetter
def __calculate_moving_sums(points, window):
""" Calculates hr moving sums of the window len """
time, hrs = zip(*points)
moving_sum = sum(hrs[0:window])
sums = [(time[0], moving_sum)]
for i, t ... |
import collections
class Cache(collections.MutableMapping):
"""Mutable mapping to serve as a simple cache or cache base class."""
def __init__(self, maxsize, missing=None, getsizeof=None):
self.__data = dict()
self.__currsize = 0
self.__maxsize = maxsize
if missing:
... |
from Tools.CList import CList
# down up
# Render Converter Converter Source
# a bidirectional connection
def cached(f):
name = f.__name__
def wrapper(self):
cache = self.cache
if cache is None:
return f(self)
if name not in cache:
cache[name] = (True, f(self))
return cache[nam... |
#! /usr/bin/python
#this is a script to extract given named nodes from a dot file, with
#the associated edges. An edge is kept iff for edge x -> y
# x and y are both nodes specified to be kept.
#known issues: if a line contains '->' and is not an edge line
#problems will occur. If node labels do not begin with
#Nod... |
#Do we wish to see debug messages on our agenthandler
DEBUG_TOGGLE = True
#What our service bundle will be called
SERVICE_BUNDLE = "dynamicagents"
#Services that we wish to register locally
NEW_AGENT_SERVICE = "agent"
TERMINATE_AGENT_SERVICE = "terminate_agent"
#The websocket host that our RVI websocket server is li... |
"""
pgoapi - Pokemon Go API
Copyright (c) 2016 tjado <https://github.com/tejado>
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... |
import os.path
import pyodbc
from Orange.widgets.widget import OWWidget
import pandas as pd
import pandas.io.sql as psql
from orangecontrib.spark.utils.data_utils import pandas_to_orange, format_sql
import Orange
# from Orange.widgets import widget, gui, settings
# from Orange.widgets.utils import itemmodels, colorp... |
from __future__ import absolute_import, division, print_function
import abc
import ipaddress
from email.utils import parseaddr
import six
from cryptography import utils
from cryptography.x509.name import Name
from cryptography.x509.oid import ObjectIdentifier
_GENERAL_NAMES = {
0: "otherName",
1: "rfc822Na... |
# -*- coding: utf-8 -*-
import urllib
import urllib2
import json
import random
# turbogears imports
from tg import expose, redirect, validate, flash, session, request
from tg.decorators import *
# third party imports
from repoze.what import predicates, authorize
from repoze.what.predicates import not_anonymous, in_gr... |
"""
Functions that largely mirror the workflow functions specified
in `workflow.api`, but specifically for handling team submissions.
"""
import logging
from django.db import DatabaseError
from django.db.models import Count
from openassessment.workflow.errors import (
AssessmentWorkflowError,
AssessmentWorkfl... |
# -*- coding: utf-8 -*-
"""The default Windows Registry plugin."""
from plaso.parsers import winreg_parser
from plaso.parsers.winreg_plugins import interface
class DefaultPlugin(interface.WindowsRegistryPlugin):
"""Default plugin that extracts minimum information from every Registry key.
The default plugin will... |
import datetime
import unittest
from apel.parsers import LSFParser
class ParserLSFTest(unittest.TestCase):
'''
Test case for LSF parser
'''
def setUp(self):
self.parser = LSFParser('testSite', 'testHost', True)
def test_parse(self):
fields = ('JobName', 'LocalUserID', 'LocalUse... |
from oslo_log import log as logging
import webob
from cinder.api import extensions
from cinder.api.openstack import wsgi
from cinder.i18n import _, _LI
from cinder import objects
from cinder.objects import fields
LOG = logging.getLogger(__name__)
def authorize(context, action_name):
action = 'snapshot_actions:%... |
# This file is called by Example7_Galactic_Center_Batch.batch
# The scan performs a run over the inner galaxy
# NB: this example makes use of the Fermi Data, which needs to already be installed. See Example 1 for details.
import numpy as np
from NPTFit import nptfit # module for performing scan
from NPTFit import cr... |
# Website: www.vThinkBeyondVM.com
# Product: vCenter server/EVC (Enhanced Compatibility Mode)
# Description: Script to get enbale/disable EVC on cluster
# Reference: http://vthinkbeyondvm.com/tutorial-how-to-manage-enhanced-vmotion-compatibility-evc-using-vsphere-python-sdk-pyvmomi
# How to setup pyVmomi environment?: ... |
import tvm
from tvm import te
import numpy as np
from tvm import relay
from tvm.contrib import graph_runtime
from tvm.relay.testing import run_infer_type
def dequantize_test_driver(in_dtype, quant_args, in_data, verify_output_data, axis):
shape = in_data.shape
input_data = relay.var("input_data", shape=shape,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
from setuptools import find_packages, setup
def get_version(*file_paths):
"""Retrieves the version from magic_cards/__init__.py"""
filename = os.path.join(os.path.dirname(__file__), *file_paths)
version_file = open(filename).rea... |
from pyramid.config import Configurator
from pyramid.httpexceptions import HTTPNotFound
# from sqlalchemy import engine_from_config
# import sqlite3
from whoosh.fields import Schema, TEXT, NGRAM, NGRAMWORDS, ID, STORED, KEYWORD
from whoosh import index
from whoosh.qparser import QueryParser
from whoosh.query import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.