text stringlengths 12 6.59M |
|---|
import os.path
import pytest
from cfgrib import xarray_store
SAMPLE_DATA_FOLDER = os.path.join(os.path.dirname(__file__), 'sample-data')
TEST_DATA = os.path.join(SAMPLE_DATA_FOLDER, 'era5-levels-members.grib')
@pytest.mark.parametrize('cache', [True, False])
def test_all(cache):
da = xarray_store.open_dataset... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2010-2017 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 .utils.fixtures import user_validator
from .utils.validator_functions import TestValidators
def test_field_validator_functions(user_validator):
"""
This test makes sure that the defined functions are present.
"""
email_field = user_validator.fields['email']
assert TestValidators.is_email in ... |
# 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... |
# -*- coding: utf-8 -*-
"""
.. module:: tests.test_hooks.test_django
:synopsis: Tests for bundled django hooks
"""
from facio.hooks.django.secret import GenerateDjangoSecretKey, run
from facio.state import state
from mock import patch
from six.moves import builtins
from .. import BaseTestCase
class TestDjangoS... |
#!/usr/bin/env python
#
# regex_path_reorganizer.py
# Copyright (C) 2016 Larroque Stephen
#
# Licensed under the MIT License (MIT)
#
# 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 re... |
# 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 License, or
# (at your option) any later version.
#
# OpenQuake is distri... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# 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/LICENS... |
'''
Python bindings for working with Vagrant and Vagrantfiles. Do useful things
with the `vagrant` CLI without the boilerplate (and errors) of calling
`vagrant` and parsing the results.
The API attempts to conform closely to the API of the `vagrant` command line,
including method names and parameter names.
Quick and... |
# 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 License, or
# (at your option) any later version.
#
# OpenQuake is distri... |
# coding: utf-8
"""
This test file tests the lib.tokens.radiustoken
This depends on lib.tokenclass
"""
from .base import MyTestCase
from privacyidea.lib.tokens.radiustoken import RadiusTokenClass
from privacyidea.lib.challenge import get_challenges
from privacyidea.models import Token
from privacyidea.lib.error import... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Copyright 2014, Cercle Informatique ASBL. All rights reserved.
#
# 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 ... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2010-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... |
import pytest
import json
from kdr import syncthing_factory as factory
from kdr.utils import config_rollbacker as rb
from mock import adapters as mock
Cache = {}
c_app_rb = rb.AppRollbacker(mock.client)
s_app_rb = rb.AppRollbacker(mock.server)
c_st_rb = rb.SyncthingRollbacker(mock.client)
s_st_rb = rb.SyncthingRollba... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-,
# @file: optimize.py
# @purpose: read a ROOT file containing ntuples and attempt to find optimal cuts
# @author: Giordon Stark <gstark@cern.ch>
# @date: June 2015
#
# __future__ imports must occur at beginning of file
# redirect python output using the newer print ... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2010-2016 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
import tests
import unittest
from mock import MagicMock, patch, call
from twitter_harvester import TwitterHarvester
from twarc import Twarc
import threading
import shutil
import tempfile
import time
from datetime import datetime, date
import copy
import os
from kombu import Connec... |
#!/usr/bin/env python
# @file: optimize.py
# @purpose: read a ROOT file containing ntuples and attempt to find optimal cuts
# @author: Giordon Stark <gstark@cern.ch>
# @date: June 2015
#
# __future__ imports must occur at beginning of file
# redirect python output using the newer print function with file descr... |
#based on T1932 protocol
import usb.core
import time
import ant, trainer
import sys
import binascii
import struct
import platform, glob
import os
import threading
import Tkinter
import pickle
from Tkinter import *
from tkMessageBox import *
from datetime import datetime
import argparse
if os.name ... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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.
#
# OpenQuak... |
#!/usr/bin/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 applicable... |
#! /usr/bin/env python
# Copyright (C) 2011 OpenStack, LLC.
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a c... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2013-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 2013 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 applicable law or agreed to in wr... |
from ._module import _module
import re
import logging
import urllib.request
from hurry.filesize import size as filesize
import html.parser
import threading
class WorkerThread(threading.Thread):
def __init__(self, module, source, target, url):
super().__init__()
self.module = module
... |
#! /usr/bin/env python
from __future__ import print_function
import os
import time
from github import Github
gh = Github(os.environ['DMWMBOT_TOKEN'])
codeRepo = os.environ.get('CODE_REPO', 'WMCore')
teamName = os.environ.get('WMCORE_REPO', 'dmwm')
repoName = '%s/%s' % (teamName, codeRepo)
issueID = None
if 'ghprb... |
from __future__ import absolute_import, division, print_function
import utool
import utool as ut
import ibeis
from plottool import interact_helpers as ih
from plottool import draw_func2 as df2
from ibeis.viz.interact import interact_matches # NOQA
# from ibeis.gui import guiback
from functools import partial
import gu... |
import os
from pkg_resources import resource_filename
import arcpy
import numpy
import nose.tools as nt
import numpy.testing as nptest
import tidegates.testing as tgtest
import mock
import tidegates
from tidegates import utils
class Test_EasyMapDoc(object):
def setup(self):
self.mxd = resource_filename... |
import os
from clang.cindex import Config
if 'CLANG_LIBRARY_PATH' in os.environ:
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
from clang.cindex import *
from .util import get_tu
import unittest
# FIXME: We need support for invalid translation units to test better.
class TestDiagnostics(unittest.T... |
from modules import Module
import re
import logging
from hurry.filesize import size as filesize
import html.parser
import threading
import requests
class WorkerThread(threading.Thread):
def __init__(self, module, source, target, url):
super().__init__()
self.module = module
self.source = so... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2013-2017 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... |
""" Functions for moksha-ctl """
import decorator
import subprocess
import os
import sys
import shutil
# Local imports
import config
import colors as c
import utils
ctl_config = config.load_config()
pid_files = ['paster.pid', 'orbited.pid', 'moksha-hub.pid']
PRETTY_PREFIX = "[" + c.magenta("moksha-ctl") + "] "
@d... |
#!/usr/bin/env python
import argparse
import sys
def merge(vcf, cadd, header_only, print_header):
for cadd_line in cadd:
if cadd_line.startswith('#'):
continue
cadd_fields = cadd_line.rstrip().split('\t')
for vcf_line in vcf:
if vcf_line.startswith('##'):
... |
import json
import argparse
# import numpy as np
def load_grades_file(filename):
with open(filename) as f:
return json.loads(f.read())
def sum_credits(grades, key):
completed = grades[key]
credit_sum = 0
for _, grade in completed.iteritems():
credit_sum += grade["credit"]
return ... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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.
#
# OpenQuak... |
# -*- coding: utf-8 -*-
'''
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase
from t... |
from __future__ import print_function, absolute_import, division
from future.builtins import *
from future import standard_library
standard_library.install_aliases()
# Copyright 2017 Autodesk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with ... |
import os
import re
import sys
from rbtools.clients import SCMClient, RepositoryInfo
from rbtools.clients.svn import SVNClient, SVNRepositoryInfo
from rbtools.utils.checks import check_install
from rbtools.utils.process import die, execute
class GitClient(SCMClient):
"""
A wrapper around git that fetches rep... |
import logging
from itertools import combinations
from collections import defaultdict
import numpy as np
import scipy.spatial as spatial
from opensfm import bow
from opensfm.context import parallel_map
logger = logging.getLogger(__name__)
def has_gps_info(exif):
return (exif and
'gps' in exif and
... |
"""
You have a RecentCounter class which counts the number of recent requests within a certain time frame.
Implement the RecentCounter class:
RecentCounter() Initializes the counter with zero recent requests.
int ping(int t) Adds a new request at time t, where t represents some time in milliseconds, and returns the n... |
from celery.task import PeriodicTask, Task
class Provider(object):
def __call__(self):
return self
@classmethod
def register_tasks(cls, *args, **kwargs):
"""Constructor, looks for decorated tasks and registers them with Celery,
this is done in a non-standard way as Celery tasks c... |
'''
Definition of the models used in the timetracker app
'''
import datetime
from django.db import models
class Tbluser(models.Model):
"""
Models the user table and provides the admin interface with the
niceties it needs.
"""
USER_TYPE = (
('ADMIN', 'Administrator'),
('RUSER', '... |
"""mist.io views"""
import os
import tempfile
import logging
from time import time
from datetime import datetime
import requests
import json
from hashlib import sha256
from pyramid.response import Response
from pyramid.view import view_config
from libcloud.compute.base import Node, NodeSize, NodeImage, NodeLocati... |
import os
import json
import bleach as python_bleach
from core import fragments, markdown as core_markdown
from core.views import app_config
from django import template
from django.conf import settings
from django.contrib.sites import models as sites_models
from django.template import defaultfilters
from django.utils... |
from django.http import HttpResponseForbidden
from django.http import HttpResponseNotFound
from django.contrib.auth.models import User
from django.contrib.auth.models import Group
from django.core import serializers
from django.db.utils import IntegrityError
from django.db import transaction
from django.utils import si... |
#!/usr/bin/env cctbx.python
#
# Copyright (C) (2016) STFC Rutherford Appleton Laboratory, UK.
#
# Author: David Waterman.
#
# This code is distributed under the BSD license, a copy of which is
# included in the root directory of this package.
#
"""Calculate the periodogram of real evenly-spaced data"""
from __futu... |
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import authenticate
from django.contrib.auth import login, logout
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse, reverse_lazy
from django.http import HttpResponseRedirect
from django.... |
import logging
import os
import re
import sys
from rbtools.clients import SCMClient, RepositoryInfo
from rbtools.clients.errors import (InvalidRevisionSpecError,
TooManyRevisionsError)
from rbtools.clients.perforce import PerforceClient
from rbtools.clients.svn import SVNClient, SVN... |
PACKAGE = 'herbpy'
import logging
import numbers
import numpy
import openravepy
import prpy
import prpy.rave
import prpy.util
import yaml
import subprocess
from .barretthand import BarrettHand
from .herbbase import HerbBase
from .herbpantilt import HERBPantilt
from .wam import WAM
from prpy import Cloned
from prpy.acti... |
import logging
import os
from openspending.core import db
from openspending.model import Dataset
from openspending.command.util import create_submanager
from openspending.command.util import CommandException
import migrate.versioning.api as migrate_api
from migrate.exceptions import DatabaseNotControlledError
log = ... |
'''
lock
~~~~
A generic lock.
'''
import etcd
import pylibmc
import redis
import time
import uuid
class LockException(Exception):
'''
Generic exception for Locks.
'''
pass
class LockTimeoutException(Exception):
'''
Raised whenever timeout occurs while trying to acquire lock.
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
#
# 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/licen... |
import os
import re
import sys
from rbtools.clients import SCMClient, RepositoryInfo
from rbtools.clients.svn import SVNClient, SVNRepositoryInfo
from rbtools.utils.checks import check_install
from rbtools.utils.process import die, execute
class GitClient(SCMClient):
"""
A wrapper around git that fetches rep... |
import numpy
from prpy.tsr.tsrlibrary import TSRFactory
from prpy.tsr.tsr import *
@TSRFactory('herb', 'plastic_glass', 'grasp')
def glass_grasp(robot, glass, manip=None, **kw_args):
'''
@param robot The robot performing the grasp
@param glass The glass to grasp
@param manip The manipulator to perform ... |
# Copyright (C) 2020 Mandiant, Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at: [package root]/LICENSE.txt
# Unless required by applicable law or agreed to in writing... |
import colander
import logging
import urllib
from flask import Blueprint, render_template, request, redirect, url_for
from flask.ext.login import current_user
from flask import current_app
from openspending.core import db
from openspending.model import Dataview
from openspending.auth import require
blueprint = Bluepr... |
from .core import Service, NoService, NoData, SkipThisService
import arrow
class Bitstamp(Service):
supported_cryptos = ['btc']
def get_price(self, crypto, fiat):
if fiat.lower() != 'usd':
raise SkipThisService('Bitstamp only does USD->BTC')
url = "https://www.bitstamp.net/api/tic... |
import math
from functools import reduce
from django.core.paginator import Paginator, Page, InvalidPage
# From https://djangosnippets.org/snippets/773/
# Lets us do better pagination, so we don't need to show *every* page.
__all__ = (
"InvalidPage",
"ExPaginator",
"DiggPaginator",
"QuerySetDiggPaginat... |
import colander
import logging
import urllib
from flask import Blueprint, render_template, request, redirect, url_for
from flask.ext.login import current_user
from flask import current_app
from openspending.core import db
from openspending.model import Dataview
from openspending.auth import require
blueprint = Bluepr... |
import random
def first_letters(text):
"""(string) -> string
>>> first_letters('this is a test')
This Is A Test
"""
return text.title()
def even_odd(text):
"""(string) -> string
>>> even_odd('this is a test')
ThIs iS A TeSt
"""
new = ''
for i in range(len(text)):
... |
# Lint as: python3
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
# coding=utf-8
import os
import sys
import subprocess
import filecmp
import shutil
import itertools
import errno
from urllib.parse import urlparse
class WarningContext(object):
""" Represents the context of a warning. """
def __init__(self, name: str, row_index: int=-1, card_index: int=-1):
self.na... |
from flask import jsonify, request
from carson import app
from carson.github.parser import Parser
@app.route('/api')
def placeholder():
return jsonify({"Hello": "World"})
# Pull Requests are considered Issues in this part of the API
@app.route('/messages/github/issue_comment', methods=['POST'])
def handle_github... |
# -*- coding: utf-8 -*-
"""
Module for authenticated access to CARTO's APIs
.. module:: carto.auth
:platform: Unix, Windows
:synopsis: Module for authenticated access to CARTO's APIs
.. moduleauthor:: Daniel Carrion <daniel@carto.com>
.. moduleauthor:: Alberto Romeu <alrocar@carto.com>
.. moduleauthor:: Juan Ig... |
"""
Scraper for Maryland Court of Appeals
CourtID: md
Court Short Name: MD
Author: Andrei Chelaru
Date created: 06/27/2014
Court Support: webmaster@mdcourts.gov, mdlaw.library@mdcourts.gov
"""
from datetime import date
from juriscraper.OpinionSite import OpinionSite
from juriscraper.lib.string_utils import convert_da... |
"""
A maintenance workflow that you can deploy into Airflow to periodically kill off tasks that are running in the background that don't correspond to a running task in the DB.
This is useful because when you kill off a DAG Run or Task through the Airflow Web Server, the task still runs in the background on one of the... |
#! /usr/bin/python3
"""Create and parse 'send'-type messages."""
import struct
from . import (util, config, exceptions, bitcoin, util)
FORMAT = '>QQ'
LENGTH = 8 + 8
ID = 0
def validate (db, source, destination, asset, quantity, block_index):
problems = []
if asset == config.BTC: problems.append('cannot s... |
''' Degradation Module
This module contains functions to calculate the degradation rate of
photovoltaic systems.
'''
from __future__ import division
import pandas as pd
import numpy as np
import statsmodels.api as sm
def degradation_ols(normalized_energy):
'''
Description
-----------
OLS routine
... |
#!/usr/bin/env python3
# Copyright (c) 2002-2018, California Institute of Technology.
# All rights reserved. Based on Government Sponsored Research under contracts NAS7-1407 and/or NAS7-03001.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the followin... |
import blinker
from pyelasticsearch import ElasticHttpNotFoundError
from flask import request
from . import app
from . import api
from . import search
from . import items
from . import rest
from .auth import auth_required
def save_item(data):
search.index(app.config.get('ELASTIC_INDEX'), 'items', data, id=data.g... |
# Copyright (C) 2009 - TODAY Renato Lima - Akretion
# Copyright (C) 2019 - TODAY Raphaël Valyi - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
# pylint: disable=api-one-deprecated
from odoo import _, api, fields, models
from odoo.exceptions import UserError
# These fields that have the sam... |
import json
import base64
from django import forms
from django.contrib import admin
from django.db import models
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from django.contrib.admin.templatetags.admin_static import static
from djangae.utils import memoized
class TrueOrN... |
# coding: utf-8
#
# This file is part of Supysonic.
# Supysonic is a Python implementation of the Subsonic server API.
#
# Copyright (C) 2013-2018 Alban 'spl0k' Féron
#
# Distributed under terms of the GNU AGPLv3 license.
import os, os.path
import mimetypes
import mutagen
import time
from datetime import datetime
fro... |
# -*- coding: utf-8 -*-
# Copyright (C) 2016 KMEE (http://www.kmee.com.br)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import api, fields, models
MES_DO_ANO = [
(1, u'Janeiro'),
(2, u'Fevereiro'),
(3, u'Marco'),
(4, u'Abril'),
(5, u'Maio'),
(6, u'Junho'),
... |
# Copyright 2020 KMEE
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class WizardDocumentStatus(models.TransientModel):
_name = 'l10n_br_fiscal.document.status.wizard'
_inherit = 'l10n_br_fiscal.base.wizard.mixin'
rps_number = fields.Char(
st... |
from django.contrib.auth.models import User
from django.db import models
from subprocess import call
class BaseModel():
def save(self):
try:
call(['varnishadm', 'ban', 'req.url ~ /'])
except(OSError):
print("Could not clear varnish cache")
return models.Model.save(s... |
# This is a slightly modified version of the doctest.py that shipped with Python 2.4
# It incorporates changes that have been submitted the the Python ticket tracker
# as ticket #1521051. These changes allow for a DoctestRunner and Doctest base
# class to be specified when constructing a DoctestSuite.
# Module doctest... |
#!/bin/env python
"""
This module convert from one currency to another, result will be saved in cache file
for later use. if result get from cache is older than 30 minutes request API again to
get the new value
API info:
What it does: convert one currency to others
Site: https://free.currencyconverterapi.com
Call ... |
import collections
import os
import zipfile
import shutil
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import BaseCommand
from contentcuration.constants import content_kinds
from contentcuration import models as ccmodels
from kolibri.content import... |
# This is a slightly modified version of the doctest.py that shipped with Python 2.4
# It incorporates changes that have been submitted the the Python ticket tracker
# as ticket #1521051. These changes allow for a DoctestRunner and Doctest base
# class to be specified when constructing a DoctestSuite.
# Module doctest... |
import unicodecsv
import glob
import json
import os
import sys
class Build(object):
ERROR = 'ERROR'
def __init__(self, input_, output):
self.input = os.path.abspath(input_)
self.output = os.path.abspath(output)
def run(self):
"""Reads data from disk and generates CSV files."""
... |
# *****************************************************************************
# Copyright (c) 2014 IBM Corporation and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution,... |
import contextlib
import blinker
import blinker._saferef
import pprint
import copy
import functools
import os
import typing
import textwrap
import ruamel.yaml
from mitmproxy import exceptions
from mitmproxy.utils import typecheck
"""
The base implementation for Options.
"""
unset = object()
class _Option:
... |
#!/usr/bin/env python
"""Process that loads the system policy"""
__author__ = 'Stephen P. Henrie'
"""
Process that loads the system policy
"""
from pyon.core.governance import get_system_actor, get_system_actor_header
from pyon.public import CFG, log, ImmediateProcess, iex, Container, IonObject, RT, OT
from interfa... |
"""
:mod:`django-bcrypt` --- bcrypt support for Django
==================================================
`Django <http://www.djangoproject.com/>`_ ships with support for the following
password hash algorithms:
* SHA1 (default)
* MD5 (deprecated)
* crypt
These are general purpose functions, designed to calculate ... |
from morpheusapi.morpheus import Morpheus
import json
from urlparse import urljoin
import posixpath
import requests
import six
class Billing(Morpheus):
def __init__(
self, baseurl,
username, password,
id=None):
"""
Billing object is a Morpheus object. Inherits ... |
#!/usr/bin/env python
"""Process that loads the system policy"""
__author__ = 'Stephen P. Henrie'
"""
Process that loads the system policy
"""
from pyon.public import CFG, log, ImmediateProcess, iex, Container, IonObject, RT, OT
from interface.services.coi.iidentity_management_service import IdentityManagementService... |
import warnings
from django.conf import settings
from django.core.exceptions import FieldError
from django.db import models
from django.db.models.constants import LOOKUP_SEP
from django.db.models.expressions import Expression
from django.db.models.fields import FieldDoesNotExist
from django.db.models.fields.related im... |
# Copyright 2011 Gilt Groupe, INC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
"""Provides interface for preprocessing image-related data."""
import os
import random
from io import BytesIO
import cv2
import numpy as np
import requests
from PIL import Image
class ImagePreprocessor:
"""A preprocessor that handles visual data encoded in various image formats."""
# All the supported ima... |
#!/usr/bin/env python
__author__ = 'Stephen P. Henrie'
__license__ = 'Apache 2.0'
from interface.services.coi.ipolicy_management_service import BasePolicyManagementService
from pyon.core.exception import NotFound, BadRequest, Inconsistent
from pyon.public import PRED, RT, Container, CFG, OT, IonObject
from pyon.uti... |
import logging
log = logging.getLogger(__name__)
# Events, for Task
import event
# Subprocess, for NagiosTask
import subprocess
import shlex
# Multiprocessing, for PythonTask
import multiprocessing
# Requests, for JSONWebTask
import requests
import time
class Task():
def __init__(self, name, ttl):
log.info("Cr... |
import sys
import copy
import logging
import json
from django.utils import six
from django.conf import settings
from django.core import serializers
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned,\
FieldError
from django.db import models
from django.db.models import signals
from djan... |
import collections
from packaging.version import Version
import inspect
import logging
from numbers import Number
import numpy as np
import time
import warnings
from mlflow.tracking.client import MlflowClient
from mlflow.utils.file_utils import TempDir
from mlflow.utils.mlflow_tags import MLFLOW_PARENT_RUN_ID
from mlf... |
# -*- coding: utf-8 -*-
##Pyslvs - Open Source Planar Linkage Mechanism Simulation and Mechanical Synthesis System.
##Copyright (C) 2016-2018 Yuan Chang
##E-mail: pyslvs@gmail.com
##
##This program is free software; you can redistribute it and/or modify
##it under the terms of the GNU Affero General Public License as ... |
""" Main module for the ConfigObj version of the parameter task editor
$Id$
"""
from __future__ import division # confidence high
import configobj, glob, os, tkMessageBox
import cfgpars, editpar, filedlg, vtor_checks
from cfgpars import APP_NAME
# tool help
tealHelpString = """\
The TEAL (Task Editor And Launcher) G... |
"""Django Feed Aggregator."""
VERSION = (0, 2, 95)
__version__ = ".".join(map(str, VERSION))
__author__ = "Ask Solem"
__contact__ = "askh@opera.com"
__homepage__ = "http://github.com/ask/django-feeds/"
__docformat__ = "restructuredtext"
|
# Authors: Tal Linzen <linzen@nyu.edu>
# Teon Brooks <teon.brooks@gmail.com>
# Denis A. Engemann <denis.engemann@gmail.com>
# Jona Sassenhagen <jona.sassenhagen@gmail.com>
# Marijn van Vliet <w.m.vanvliet@gmail.com>
# License: BSD (3-clause)
from collections import namedtuple
from i... |
# All fields except for BlobField written by Jonas Haag <jonas@lophus.org>
from django.db import models
from django.core.exceptions import ValidationError
__all__ = ('GenericField', 'ListField', 'DictField', 'SetField', 'BlobField')
class RawField(models.Field):
""" Generic field to store anything your database ... |
import logging
from lxml import etree as ET
from couchdbkit import ResourceNotFound
from django.core.management import BaseCommand
from corehq.apps.app_manager.dbaccessors import get_app_ids_in_domain
from corehq.apps.app_manager.models import Application, PreloadAction
from corehq.apps.app_manager.util import save_x... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.