content stringlengths 4 20k |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import sys
import time
import requests
from bs4 import BeautifulSoup as bs
from sasila.system_normal.downloader.web_driver_pool import get_web_driver_pool
from sasila.system_normal.utils.cookie import formart_selenium_cookies
from sasila.system_normal.utils impo... |
def count(text, pattern):
'''
returns the number of times a pattern is in text
'''
counter = 0
pattern_length = len(pattern)
for i in range((len(text) - pattern_length) + 1):
if text[i:i + pattern_length] == pattern:
counter += 1
return counter
def frequent_words(text, k):
'''
returns the most frequentl... |
from keystoneauth1 import access
from keystoneauth1.identity import access as access_plugin
from keystoneauth1 import loading
from keystoneauth1 import session as keystone_session
from keystoneclient.v3 import client as kc_v3
from oslo_config import cfg
from oslo_log import log as logging
from karbor import exception
... |
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.optimizers import SGD, Adadelta, Adagrad
from ke... |
"""Utility functions for working with lead sheets."""
import copy
import itertools
# internal imports
from magenta.music import chords_lib
from magenta.music import constants
from magenta.music import events_lib
from magenta.music import melodies_lib
from magenta.music import sequences_lib
from magenta.pipelines impo... |
from __future__ import unicode_literals
import boto3
import botocore.exceptions
import sure # noqa
import datetime
import uuid
from botocore.exceptions import ClientError
from nose.tools import assert_raises
from moto import mock_ssm
@mock_ssm
def test_delete_parameter():
client = boto3.client('ssm', region_... |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a polcoind or Pol... |
import json
from troveclient import base
from troveclient import common
class Configuration(base.Resource):
"""Configuration is a resource used to hold configuration information."""
def __repr__(self):
return "<Configuration: %s>" % self.name
class Configurations(base.ManagerWithFind):
"""Manage... |
"""
.. _tut-sensor-locations:
Working with sensor locations
=============================
This tutorial describes how to read and plot sensor locations, and how
the physical location of sensors is handled in MNE-Python.
.. contents:: Page contents
:local:
:depth: 2
As usual we'll start by importing the module... |
'''Magically loaded by behave defining helper methods and other things'''
from __future__ import print_function
# define the necessary logging features to write messages to a file
import logging
import os
import re
import sys
from datetime import datetime
import env_setup
if os.getenv("WORKSPACE") is not None:
... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn import neighbors, datasets
k = 15 # Number of neighbors
h = .02 # step size in the mesh
# Create color maps
cmap_light = ListedColormap(['#FFAAAA', '#AAFFAA', '#AAAAFF'])
cmap_bold = ListedColormap(['#FF00... |
from __future__ import print_function, division, absolute_import
import numpy as np
import matplotlib.pyplot as pp
from pyhmc.tests.test_autocorr2 import generate_AR1
from pyhmc import integrated_autocorr1, integrated_autocorr2
from pyhmc import integrated_autocorr3, integrated_autocorr4
from pyhmc import integrated_au... |
"""Functional Utilities."""
from __future__ import absolute_import, unicode_literals
import random
import sys
import threading
import inspect
from collections import OrderedDict
try:
from collections.abc import Iterable, Mapping
except ImportError:
from collections import Iterable, Mapping
from itertools im... |
from ..rings.CommutativeRing import CommutativeRing, CommutativeRingElement
class Field(CommutativeRing):
def __init__(s, element_class):
CommutativeRing.__init__(s, element_class)
def _inv(s, a):
raise NotImplementedError()
def _mod(s, a, b):
raise NotImplementedError()
def _div(s, a, b):
... |
from msrest.serialization import Model
class BMSBackupEnginesQueryObject(Model):
"""Query parameters to fetch list of backup engines.
:param backup_management_type: Backup management type for the backup
engine. Possible values include: 'Invalid', 'AzureIaasVM', 'MAB', 'DPM',
'AzureBackupServer', 'A... |
from __future__ import unicode_literals
import frappe
import unittest
from frappe.utils import getdate
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
from erpnext.stock.doctype.... |
"""
Scheduler base class that all Schedulers should inherit from
"""
from oslo_config import cfg
from oslo_utils import importutils
from oslo_utils import timeutils
from manila import db
from manila.i18n import _
from manila.share import rpcapi as share_rpcapi
from manila import utils
scheduler_driver_opts = [
c... |
#!/usr/bin/env python
from copy import deepcopy
import datetime
import json
import logging
import msgpack
import sys
import time
import elliptics
logger = logging.getLogger('mm.convert')
CONFIG_PATH = '/etc/elliptics/mastermind.conf'
try:
with open(CONFIG_PATH, 'r') as config_file:
config = json.loa... |
"""Possible vm states for instances.
Compute instance vm states represent the state of an instance as it pertains to
a user or administrator.
vm_state describes a VM's current stable (not transition) state. That is, if
there is no ongoing compute API calls (running tasks), vm_state should reflect
what the customer ex... |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
f... |
from multi_armed_bandit import MultiArmedBandit
import numpy as np
import random
def return_rmse(predictions, targets):
"""Return the Root Mean Square error between two arrays
@param predictions an array of prediction values
@param targets an array of target values
@return the RMSE
"""
return ... |
"""Tests of tensorstore.IndexDomain"""
import pickle
import re
import pytest
import tensorstore as ts
import numpy as np
def test_init_rank():
x = ts.IndexDomain(rank=2)
assert x.rank == 2
assert x.ndim == 2
assert x.inclusive_min == (-ts.inf,) * 2
assert x.inclusive_max == (+ts.inf,) * 2
assert x.exclu... |
import json
from great_expectations.core.metric import ValidationMetricIdentifier
from great_expectations.core.util import ensure_json_serializable
from great_expectations.data_context.store.database_store_backend import (
DatabaseStoreBackend,
)
from great_expectations.data_context.store.store import Store
from g... |
# -*- coding: utf-8 -*-
import random
import unittest
class TestSettingsFunctions(unittest.TestCase):
def setUp(self):
from maboplat.utils.settings import Settings
config_file = "mabo.ini"
self.settings = Settings(config_file)
def test_item(self):
self.asse... |
from oslo_policy import policy
from nova.policies import base
BASE_POLICY_NAME = 'os_compute_api:os-networks-associate'
networks_associate_policies = [
policy.DocumentedRuleDefault(
BASE_POLICY_NAME,
base.RULE_ADMIN_API,
"""Associate or disassociate a network from a host or project.
Th... |
import os
import numpy as np
import pickle
from scipy.stats.distributions import norm
from matplotlib import pyplot as plt
#from pysb.examples.robertson import model
from pysb.integrate import Solver
#import plotly.plotly as py
#import plotly.graph_objs as go
method_list = ['Nelder-Mead', 'Powell','CG', 'BFGS', 'L-BFG... |
import os
from glob import glob
from io import StringIO
from django.core.management import call_command
from django.test import SimpleTestCase, TestCase
from django.test.utils import override_settings
from weblate.trans.tests.utils import TempDirMixin
class CommandTests(SimpleTestCase, TempDirMixin):
def setUp(... |
import time
class CallbackModule(object):
"""
A plugin for timing tasks
"""
def __init__(self):
self.stats = {}
self.current = None
def playbook_on_task_start(self, name, is_conditional):
"""
Logs the start of each task
"""
if self.current is not No... |
from django.db.models import Prefetch
from django.utils import timezone
from base.models import entity_calendar, entity_version
from base.models.entity import Entity
from base.models.entity_version import EntityVersion
from base.models.enums import academic_calendar_type
from base.models.enums.entity_container_year_li... |
import uuid
import mock
from keystone import auth
from keystone.auth.plugins import base
from keystone import exception
from keystone.tests import unit
from keystone.tests.unit.ksfixtures import auth_plugins
# for testing purposes only
METHOD_NAME = 'simple_challenge_response'
METHOD_OPTS = {
METHOD_NAME:
... |
import commands
def run(c):
return commands.getstatusoutput(c)[0]
share_path = '/usr/share/'
etc_path = '/etc/'
bin_path = '/usr/bin/'
def build(dir, name, ver, desc, deps, provs):
run('mkdir ' + dir + 'DEBIAN')
if name == 'ajenti':
run('echo "#!/bin/sh\nupdate-rc.d ajenti start 2 3 4 5 . stop 0... |
"""JSON schemas compiler for Zenodo."""
from __future__ import absolute_import, print_function
from . import config
from .cli import jsonschemas
class ZenodoJSONSchemas(object):
"""Zenodo records extension."""
def __init__(self, app=None):
"""Extension initialization."""
if app:
... |
# -*- coding: utf-8 -*-
"""
Summarization by mT5 model
"""
from transformers import T5Tokenizer, MT5ForConditionalGeneration
from typing import List
class mT5Summarizer:
def __init__(
self,
model_size: str = "small",
num_beams: int = 4,
no_repeat_ngram_size: int = 2... |
"""
Eine Platzbegrenzung.
"""
from django.db import models
from django.core.validators import MinValueValidator
from bp_cupid.models import (
Praxis,
Verwaltungszeitraum,
)
class Platzbegrenzung(models.Model):
"""
Eine Platzbegrenzung gibt an, wieviele Plätze eine Praxis in einem
Verwaltungszeitr... |
"""Provides an interface for working with multiple event files."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import threading
import six
import tensorflow as tf
from tensorboard.backend.event_processing import directory_watcher
from tensor... |
"""
`congure_test`-related shell interactions
Defines `congure_test`-related shell command interactions
"""
from riotctrl.shell import ShellInteraction
class CongureTest(ShellInteraction):
@ShellInteraction.check_term
def setup(self, ident=0, timeout=-1, async_=False):
return self.cmd('cong_setup {i... |
from xapiquery import XapiQuery
historic_archaeological_site = XapiQuery(historic= u"archaeological_site")
historic_battlefield = XapiQuery(historic= u"battlefield")
historic_boundary_stone = XapiQuery(historic= u"boundary_stone")
historic_castle = XapiQuery(historic= u"castle")
historic_city_gate = XapiQuery(historic=... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This code is in the public domain
from __future__ import print_function
import datetime
from .compat import mock
real_datetime_class = datetime.datetime
def mock_datetime_now(target, datetime_module):
"""Override ``datetime.datetime.now()`` with a custom target... |
"""Downloads items from the Chromium continuous archive."""
import os
import platform
import urllib
import util
CHROME_46_REVISION = '344997'
CHROME_47_REVISION = '352825'
CHROME_48_REVISION = '359663'
_SITE = 'http://commondatastorage.googleapis.com'
class Site(object):
CONTINUOUS = _SITE + '/chromium-browser-... |
import xml.etree.ElementTree as ET
import pickle
import os
from os import listdir, getcwd
from os.path import join
import glob
#classes = ["person","car","motorcycle","bus","train","truck","traffic light","stop sign","cat","dog","horse","parking meter","sheep","cow","bear","giraffe","cat2","zebra","cell phone"]
classes... |
## \example core/ms_connectivity_restraint.py
# This example shows how to use the MSConnectivityRestraint to ensure that all the particles that are part of complexes end up in a connected conformation following the optimization. It allows multiple copies of particles and takes an experimental tree as an input.
#
# -- ... |
from oslo_log import log
from poppy.common import errors
from poppy.manager import base
LOG = log.getLogger(__name__)
class AnalyticsController(base.AnalyticsController):
def get_metrics_by_domain(self, project_id, domain_name, **extras):
storage_controller = self.storage_controller
try:
... |
from nova.api.openstack.compute.legacy_v2 import limits
from nova.api.openstack.compute.views import limits as limits_views
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import quota
# NOTE(alex_xu): This is just for keeping backward compatible with v2 endpoint
# in api-paste... |
"""Config flow for UpCloud."""
import logging
import requests.exceptions
import upcloud_api
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME
from homeassistant.core import callback
from .const import DEFAULT_SCAN_INTER... |
import sys
import maya.cmds as cmds
import maya.OpenMayaUI as mui
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin
try:
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from PySide2 import __version__
from shiboken2 import wrapInstance
from ... |
"""
Nodes for interoperating with Fedora Commons.
"""
import os
import ocrolib
from nodetree import node, exceptions
from cStringIO import StringIO
from . import base, util as utilnodes
from .. import stages, utils
from eulfedora.server import Repository
from eulfedora.models import DigitalObject, FileDatastream
fro... |
from collections import namedtuple
import numpy as np
from dataccess.default_config import *
# if True, use MPI when extracting data from psana-python. Otherwise use
# the older (circa LD67 run) psana API with serial data access.
smd = True
# If true, disable plotting (batch job compatibility). The default specified... |
from io import BytesIO
from mock import Mock
from manifest import manifest as wptmanifest
from manifest.item import TestharnessTest, RefTest
from manifest.utils import to_os_path
from .. import manifestexpected, wpttest
dir_ini_0 = b"""\
prefs: [a:b]
"""
dir_ini_1 = b"""\
prefs: [@Reset, b:c]
max-asserts: 2
min-asse... |
# trackball.py using the ps/2 protocol interrupt version is1.py
# This module demos the capture of trackball moveme t
# at the time of release, it stil freezes and the pyboard RED LED comes on
# occaisionally for unknow reasons, sorry.
#
# usage:
"""
>>> import trackball
>>> trackball.run()
dX: 1 dY: 1
dX... |
# -*- coding: utf-8 -*-
"""Tests for the UserSource class (/profiles/USERNAME)."""
from __future__ import unicode_literals
from datetime import datetime
import pytest
from kuma.users.models import UserBan
from . import mock_requester, mock_storage
from ..sources import UserSource
@pytest.fixture
def complex_user(... |
from __future__ import print_function
import sys
class TextProgress:
def __init__(self):
self.nstep = 0
self.text = None
self.oldprogress = 0
self.progress = 0
self.calls = 0
def initialize(self, nstep, text=None):
self.nstep = float(nstep)
self.tex... |
import mock
import requests
from rest_framework.test import APIRequestFactory
from rest_framework.test import APITestCase
from rest_framework.test import force_authenticate
import django.http
from django.test import override_settings
import authdata.models
import authdata.views
import authdata.datasources.dreamschoo... |
from eventlet import patcher
from os_win.utils.io import ioutils
from os_win import utilsfactory
from oslo_config import cfg
from oslo_log import log as logging
from nova.console import serial as serial_console
from nova.console import type as ctype
from nova import exception
from nova.i18n import _, _LI
from nova.vir... |
import yaml, os
from dictasobject import DictAsObject
config_file = os.path.dirname(os.path.realpath(__file__))+'/../config.yml'
loaded_files = []
config_dict = {}
def from_file(file_name, defaults={}):
global loaded_files, config_dict
config_dict = defaults
with open(file_name, 'r') as f:
config_dict =... |
"""
EasyBuild support for foss compiler toolchain (includes GCC, OpenMPI, BLIS, LAPACK, ScaLAPACK and FFTW).
:author: Kenneth Hoste (Ghent University)
:author: Bart Oldeman (McGill University, Calcul Quebec, Compute Canada)
"""
from easybuild.toolchains.fft.fftw import Fftw
from easybuild.toolchains.gompi import Gomp... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.script import *
from test_framework.mininode import *
from test_framework.blocktools import *
SEQUENCE_LOCKTIME_DISABLE_FLAG = (1<<31)
SEQUENCE_LOCKTIME_TYPE_FLAG = (1<<22) # this means use time (0 mean... |
from django.contrib import admin
from parliament.core.models import *
class PoliticianInfoInline(admin.TabularInline):
model = PoliticianInfo
class PoliticianOptions (admin.ModelAdmin):
inlines = [PoliticianInfoInline]
search_fields = ('name',)
class RidingOptions (admin.ModelAdmin):
list_displa... |
#! /usr/bin/env python
from openturns import *
TESTPREAMBLE()
RandomGenerator().SetSeed(0)
try :
distribution = Logistic(2.0, 2.5)
size = 10000
sample = distribution.getSample(size)
factory = LogisticFactory()
estimatedDistribution = factory.build(sample)
print "distribution=", repr(distribut... |
"""
An implementation of a key manager that reads its key from the project's
configuration options.
This key manager implementation provides limited security, assuming that the
key remains secret. Using the volume encryption feature as an example,
encryption provides protection against a lost or stolen disk, assuming ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import fcntl
import json
import os
import prometheus_client
import subprocess
import sys
import syslog
class CephRgwCollector(object):
def __init__(self, name, disable_bucket_metrics, disable_user_metrics):
self.name = name
self.disable_buc... |
from django.core import mail
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
import socket
from mock import Mock, patch
from smtplib import SMTPConnectError
from tests.utils import DjohnoBaseViewTests
class DjohnoMailViewTests(DjohnoBaseViewTests):
def test_djohno_emai... |
"""
=====================================
Time-frequency beamforming using DICS
=====================================
Compute DICS source power in a grid of time-frequency windows and display
results.
The original reference is:
Dalal et al. Five-dimensional neuroimaging: Localization of the time-frequency
dynamics of... |
"""This program converts a grammar.g file into a PLY grammar.
The grammar.g file is pretty simple but not designed for LALR(1) and
similar parsers. This program tweaks the grammar slightly and
flattens the results to a more usable form. It might prove useful for
other parsers. (Yes, it did.)
Use it like this:
ge... |
__doc__="""CIM_TemperatureSensor
CIM_TemperatureSensor is an abstraction of a temperature sensor or probe.
$Id: CIM_TemperatureSensor.py,v 1.3 2013/02/28 21:47:59 egor Exp $"""
__version__ = "$Revision: 1.3 $"[11:-2]
from Products.ZenModel.TemperatureSensor import TemperatureSensor
from Products.ZenModel.HWComponen... |
from test_framework.mininode import *
from test_framework.test_framework import MateriaTestFramework
from test_framework.util import *
import re
import time
from test_framework.blocktools import create_block, create_coinbase
'''
Test version bits' warning system.
Generate chains with block versions that appear to be ... |
#!/usr/bin/env python
##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatib... |
from openerp import models, fields
class SaleOrder(models.Model):
_inherit = 'sale.order'
origin = fields.Char(copy=False) |
"""
homeassistant.components.switch.modbus
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Modbus switches.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.modbus/
"""
import logging
import homeassistant.components.modbus as modbus
from homeas... |
import datetime
import logging
import re
import google.appengine.ext.ndb as ndb
import models
XREF_RE = re.compile(r'k8s-gubernator.appspot.com/build(/[^])\s]+/\d+)')
APPROVERS_RE = re.compile(r'<!-- META={"?approvers"?:\[([^]]*)\]} -->')
def classify_issue(repo, number):
"""
Classify an issue in a repo b... |
# -*- coding: utf-8 -*-
"""
flaskbb.app
~~~~~~~~~~~~~~~~~~~~
manages the app creation and configuration process
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
import os
import logging
import datetime
import time
from functools import partial
from sqlalc... |
#!/usr/bin/env python
"""
For combining data from multiple files based on a common timestep. All other data will be ignored or, if in logging
mode, printed to a log file.
"""
from __future__ import print_function
from collections import defaultdict
import argparse
import os
import six
import sys
from md_utils.md_comm... |
__all__ = ['Select']
from core import Drawable
from events import SelectionChanged, Clicked
class Select(Drawable):
"""
Select is a widget which looks like a button when
unfocused, and shows a horizontal list of choices
when focused. The list will take up as much room as
is available to be drawn o... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Copyright (C) 2013-2019 ITB - CNR
This file is part of isoSegmenter.
isoSegmenter is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either versi... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import json
import os
from pants.util.contextutil import temporary_dir
from pants_test.pants_run_integration_test import PantsRunIntegrationTest
class TestJvmDepend... |
from __future__ import absolute_import, print_function
from requests.exceptions import RequestException
from sentry import http
from sentry.utils import json
from urllib import urlencode
from .constants import API_DOMAIN
class GitHubApiError(Exception):
def __init__(self, message='', status=None):
super... |
"""Copy Minigo training sets from table to GCS..
"""
import bisect
import math
import multiprocessing
import os
import tensorflow as tf
from absl import flags
from absl import app
from tqdm import tqdm
import bigtable_input
import utils
flags.DEFINE_bool('dry_run', False,
'If true, generate and pr... |
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.contrib.auth.models import User
import datetime, random, re, os, csv, time
from django.template import Context, Template, loader
from django.shortcuts import render_to_response, get_object_or_4... |
"""This module represents Kannada language.
For more information, see U{http://en.wikipedia.org/wiki/Kannada_language}
"""
from translate.lang import common
class kn(common.Common):
"""This class represents Kannada."""
ignoretests = ["startcaps", "simplecaps"] |
import os
import sys
from pyanaconda import constants
from pyanaconda import iutil
from pyanaconda.flags import flags
from pyanaconda.i18n import _
from pyanaconda.progress import progressQ
import gi
gi.require_version("GLib", "2.0")
gi.require_version("Gio", "2.0")
from gi.repository import GLib
from gi.repository ... |
import json
import mock
from solum.api.controllers.v1 import assembly
from solum.api.controllers.v1.datamodel import assembly as assemblymodel
from solum.common import exception
from solum import objects
from solum.tests import base
from solum.tests import fakes
@mock.patch('pecan.request', new_callable=fakes.FakeP... |
from ..Foundation import NSObject
class NSHTTPURLResponseInternalSyntheticProvider(NSObject.NSObjectSyntheticProvider):
"""
Class representing NSHTTPURLResponseInternal.
"""
def __init__(self, value_obj, internal_dict):
super(NSHTTPURLResponseInternalSyntheticProvider, self).__init__(value_obj... |
"""Error handling and exceptions used in the local Cloud Endpoints server."""
# pylint: disable=g-bad-name
from __future__ import absolute_import
import json
import logging
from . import generated_error_info
__all__ = ['BackendError',
'BasicTypeParameterError',
'EnumRejectionError',
... |
"""
Example echo application.
"""
from zope.interface import implements
from twisted.plugin import IPlugin
from twisted.python import log
from fmspy.application import Application
class EchoApplication(Application):
"""
Example application: echo.
Echo application sends back what it receives.
"""
... |
# -*- coding: utf-8 -*-
from base import PollingModule
from mpd import MPDClient, ConnectionError
import random
class MpdModule(PollingModule):
def __init__(self, cfg):
PollingModule.__init__(self, 'mpd')
self.config(cfg)
self.interval = self.interval_dead
self.status = {}
s... |
from fuel_agent.drivers import ks_spaces_validator
from fuel_agent import errors
from fuel_agent import objects
from fuel_agent.openstack.common import log as logging
from fuel_agent.utils import hardware_utils as hu
LOG = logging.getLogger(__name__)
def match_device(hu_disk, ks_disk):
"""Tries to figure out if ... |
"""This module supports acessing FORMA data."""
from gfw.forestchange.common import CartoDbExecutor
from gfw.forestchange.common import Sql
class FormaSql(Sql):
WORLD = """
SELECT COUNT(f.*) AS value
{additional_select}
FROM forma_api f
WHERE f.date >= '{begin}'::date
... |
from django.test import Client, TestCase
from mock import patch
from hc.api.models import Check, Ping
class PingTestCase(TestCase):
def setUp(self):
super(PingTestCase, self).setUp()
self.check = Check.objects.create()
def execute(f, *args, **kwargs):
return f(*args, **kwarg... |
from __future__ import unicode_literals
"""
Django settings for Andromeda project.
Generated by 'django-admin startproject' using Django 1.9.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.... |
from core.terminal import Terminal, module_trigger
from core.modules_handler import ModHandler
from core.module import ModuleException
from core.helper import Helper
import sys
#print '''
#Weevely 0.6 - Generate and manage stealth PHP backdoors
# Emilio Pinna 2011-2012
#'''
print ''' ... |
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpR... |
#!/usr/bin/env python3
import sys
import os
from subprocess import Popen, PIPE
from PyQt5 import QtCore, QtWidgets, uic
from interface import SimpleInterface
from settings import DEBUG, LOCAL_DIR
class MainWindow(QtWidgets.QMainWindow):
EXT_SOURCE = ".sol"
EXT_SCODE = ".ohana"
EXE_COMPILER = "./solc"
... |
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.views import generic
from django.utils import timezone
from .models import Choice, Question
class IndexView(generic.ListView):
template_name = 'polls/index.h... |
from Components.VariableText import VariableText
from Renderer import Renderer
from enigma import eLabel, eEPGCache, eServiceReference
from time import time, localtime, strftime
from skin import parseColor
from Tools.Hex2strColor import Hex2strColor
class NextEpgInfo(Renderer, VariableText):
def __init__(self):
Re... |
from openerp import _, api, fields, models
from openerp.exceptions import UserError
from collections import OrderedDict
class AccountPartialReconcile(models.Model):
_inherit = 'account.partial.reconcile'
def create_exchange_rate_entry(self, aml_to_fix, amount_diff, diff_in_currency, currency, move_date):
... |
# -*- coding: utf-8 -*-
from ast import literal_eval
import subprocess
from os import path
from pprint import pformat
import shutil
from errbot import BotPlugin, botcmd
from errbot.version import VERSION
from errbot.repos import KNOWN_PUBLIC_REPOS
from errbot.rendering import md_escape
from errbot.utils import which
f... |
from __future__ import absolute_import, division, print_function
import os
from qtpy import QtGui, compat
from glue.viewers.common.qt.tool import Tool, CheckableTool
from glue.config import viewer_tool
from ..extern.vispy import app, io
RECORD_START_ICON = os.path.join(os.path.dirname(__file__), 'glue_record_start... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
__all__ = ["Catalog"]
import os
import requests
import pandas as pd
try:
from StringIO import StringIO
except ImportError:
from io import BytesIO as StringIO
class Catalog(object):
url = ("http://exoplanetarchive.ipac.caltech.edu/... |
import os
import sys
from fnmatch import fnmatchcase
from distutils.util import convert_path
from setuptools import setup, find_packages
def read(*path):
return open(os.path.join(os.path.abspath(os.path.dirname(__file__)),
*path)).read()
# Provided as an attribute, so you can ap... |
'''
XBMC LCDproc addon
Copyright (C) 2012-2018 Team Kodi
Support for extra symbols on Futaba/Targa USB mdm166a VFD displays
Copyright (C) 2012-2018 Daniel 'herrnst' Scheller
Original C implementation (C) 2010 Christian Leuschen
This program is free software; you can redistribute it and/or modi... |
#pylint: disable=W0703,R0915,R0912,R0904,E0102,E1101,E0202,R0914,W0105
'''
Copyright 2014 eBay Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.