code stringlengths 1 199k |
|---|
from functools import wraps
import numpy as np
def minmax(arr):
return np.min(arr), np.max(arr)
from extended_stencil.stencil import *
from extended_stencil.dispersion import *
from extended_stencil.optimize import *
from extended_stencil.weight import weight_functions
from ._version import get_versions
__version__... |
'''
Created on Dec 9, 2013
@author: dgraja
'''
def mod2(x) :
return x%2==0
'''
The filter method is used to filter a list (or array)
'''
even = filter(mod2, xrange(1,10))
print even |
import re
import json
import pytz
import urllib
import urllib2
import email_normalize
from django import forms
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from django.db import transaction
from django.forms import ValidationError
from django.urls import reverse
from django.utils import ti... |
from novel import serial, utils, config
BASE_URL = 'http://www.hax16.com/files/article/html/{}/{}/'
class Hax16(serial.SerialNovel):
def __init__(self, tid):
super().__init__(utils.base_to_url(BASE_URL, tid), '#BookText',
intro_sel='.intro',
chap_type=serial... |
from lxml import etree
class enhance_html(object):
def elements2data(self, element, data, path=None, recursive=True):
if self.verbose:
print("Extracting element {}".format(element.tag))
if path:
path += "/" + element.tag
else:
path = element.tag
fi... |
import re
from channels import autoplay
from channels import filtertools
from core import httptools
from core import scrapertools
from core import servertools
from core import tmdb
from core.item import Item
from platformcode import config, logger
host = 'http://www.serieslatino.tv/'
IDIOMAS = {'Latino': 'Latino', 'Sub... |
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qrtextedit import ScanQRTextEdit
import re
from decimal import Decimal
from electrum import bitcoin
import util
RE_ADDRESS = '[1-9A-HJ-NP-Za-km-z]{26,}'
RE_ALIAS = '(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>'
frozen_style = "QWidget { background-color:none; border:... |
'''
Authorized by vlon Jang
Created on May 10, 2016
Email:zhangzhiwei@ict.ac.cn
From Institute of Computing Technology
All Rights Reserved.
'''
def gen():
sql = ''
sqlTemplate = """
CREATE TABLE user_play_at{0} AS
SELECT user_id, total from tmp_user_action_distinguish_by_clock
where action_type='1' and action... |
import sys
from random import randint
if (len(sys.argv) > 1):
number = int(sys.argv[1])
else:
print "Invalid number of parking lots"
exit();
vagasFile = "vagas.txt"
file = open(vagasFile, "w");
file.write(str(randint(0,number)))
file.close(); |
import logging
from optparse import OptionParser
import sys
from elbepack.elbeproject import ElbeProject
from elbepack.elbexml import ValidationError
from elbepack.log import elbe_logging
def run_command(argv):
oparser = OptionParser(
usage="usage: %prog buildsysroot [options] <builddir>")
oparser.add_o... |
from core.models import UserToken
from dispatcher.models import Pilot
from storage.models import DataProxyServer as DPS
from django.utils.timezone import now
from tastypie.authentication import Authentication
from tastypie.authorization import Authorization
from tastypie.exceptions import Unauthorized
from django.db.mo... |
import logging, serial
from sdserror import *
class SdsSensor:
def __init__(self, port = "/dev/serial0", samplingPeriod = 15):
self.serial = serial.Serial(port = port, baudrate = 9600)
self.serial.setTimeout(1.5)
self.samplingPeriod = samplingPeriod
self.id = "unknown"
def getIdF... |
from .base import *
DEBUG = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
ALLOWED_HOSTS = ['192.168.1.100','127.0.0.1']
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',... |
import logging
from beeswarm.drones.honeypot.capabilities.pop3 import Pop3
from beeswarm.drones.honeypot.capabilities.handlerbase import HandlerBase
logger = logging.getLogger(__name__)
class Pop3S(Pop3, HandlerBase):
"""
This class will get wrapped in SSL. This is possible because we by convention wrap
al... |
BS4_SEARCH_STRING = "search_string"
BS4_SOURCE_STRING = "source_string"
BS4_SOURCE_STRING_START = "source_string_start"
BS4_SOURCE_STRING_END = "source_string_end" |
import os
import subprocess
import sys
inFile = sys.argv[1]
ogr2ogrFile = r"C:\OSGeo4W64\bin\ogr2ogr.exe"
def check_output(command,console):
if console == True:
process = subprocess.Popen(command)
else:
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STD... |
from datetime import tzinfo, timedelta
from khayyam.jalali_datetime import JalaliDatetime
STDOFFSET = timedelta(minutes=210) # Minutes
DSTOFFSET = timedelta(minutes=270) # Minutes
DSTDIFF = DSTOFFSET - STDOFFSET
ZERO = timedelta(0)
class TehTz(tzinfo):
def utcoffset(self, dt):
if self._isdst(dt):
... |
"""This is a a functional doctest test. It uses PloneTestCase and doctest
syntax. In the test itself, we use zope.testbrowser to test end-to-end
functionality, including the UI.
One important thing to note: zope.testbrowser is not JavaScript aware! For
that, you need a real browser. Look at zope.testbrowser.real and Se... |
import re
import os.path
from optparse import OptionParser
import random
import math
import psyco
psyco.full()
WCSP_PROBLEM_LINE = re.compile('^(?P<name>\S+)\s+(?P<num_vars>\d+)\s+(?P<max_domain_size>\d+)\s+(?P<total_constraints>\d+)\s+(?P<upper_bound>\d+)')
EXP_ROOT = 2.0
EXP_K = 0.001
class WCSPVariable:
def __in... |
""" This script reads and transforms pricing data to pd.DataFrame as time-series"""
import pandas as pd
from datetime import timedelta
from data_preprocessing import ExtractTimeSeries
from auxiliary_functions import print_process
def main():
df = pd.read_excel('../data/Tariffs.xlsx')
df.loc[df['Tariff'] == 'Low... |
from ert.test import TestAreaContext, ExtendedTestCase
from ert.ecl import EclDataType, EclTypeEnum
class EclDataTypeTest(ExtendedTestCase):
# All of the below should list their elements in the same order as
# EclTypeEnum!
# [char, float, double, int, bool, mess]
ELEMENT_SIZE = [9, 4, 8, 4, 4, 0]
VE... |
import setuptools
def get_readme():
with open('README.rst') as f:
return f.read()
setuptools.setup(
# the first three fields are a must according to the documentation
name="pytags",
version="0.0.11",
packages=[
'pytags',
'pytags.utils',
],
# from here all is optional
... |
import os
import sys
import gzip
from MODtree import *
filename_MODtree_list = sys.argv[1]
dirname_ens = '/work/project/pub/ens/70/'
filename_names = 'ens70.prot2name'
prot_names = get_prot2names()
tax2sp = get_tax2sp()
seq_list = dict()
for filename in os.listdir(dirname_ens):
if not filename.endswith('.pep.all.fa... |
#!/usr/bin/python
"""
Arabic numbers routins
@author: Taha Zerrouki
@contact: taha dot zerrouki at gmail dot com
@copyright: Arabtechies, Arabeyes, Taha Zerrouki
@license: GPL
@date:2017/02/14
@version: 0.3
license: LGPL <http://www.gnu.org/licenses/lgpl.txt>
link http://www.ar-php.org
category Text
author ... |
class GetBookTypeInteractor(object):
def __init__(self, persistence):
self.__persistence = persistence
def execute(self, format_code):
return self.__persistence.get_book_type(format_code) |
"""Functions for accessing video-MEG audio and video files
by Andrey Zhdanov (andrey dot zhdanov at aalto dot fi)
Copyright (C) 2014 BioMag Laboratory, Helsinki University Central Hospital
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public L... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('invitation', '0008_auto_20161124_2314'),
]
operations = [
migrations.AlterField(
model_name='guest',
name='last_seen_at',
... |
import os
import multiprocessing as mp
import subprocess
from '{% if cookiecutter.namespace %}{{ cookiecutter.namespace }}.{{ cookiecutter.project_slug }}{% else %}{{ cookiecutter.project_slug }}{% endif %}'.commands.base import BaseCommand
from '{% if cookiecutter.namespace %}{{ cookiecutter.namespace }}.{{ cookiecutt... |
r"""
===================
IPT Histereris loop
===================
Within the iterative perturbative theory (IPT) the aim is to find the
coexistance regions.
"""
from __future__ import division, absolute_import, print_function
from dmft import ipt_imag
from dmft.common import greenF, tau_wn_setup
from dmft.twosite import... |
from eos.saveddata.module import State
from eos.modifiedAttributeDict import ModifiedAttributeDict
type = "active", "projected"
def handler(fit, src, context, **kwargs):
if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or
hasattr(src, "amountAc... |
'''Forms used on the mailapp application
'''
from django import forms
from django.utils.translation import gettext_lazy as _
from django.conf import settings
import re
from utils.config import WebpymailConfig
from .multifile import MultiFileField
try:
import markdown
HAS_MARKDOWN = True
except ImportError:
... |
__author__ = "Alexander Weigl <Alexander.Weigl@uiduw.student.kit>"
__date__ = "2014-11-18"
__version__ = ""
import shelve
import os
import pickle
import atexit
import gzip
class ReRunCheck(object):
"""This class checks if the execution of operators can be omitted.
"""
def __init__(self, folder, gzip_mode = ... |
from config import *
from model import *
import pwd
from pysqlite2 import dbapi2 as sqlite # https://github.com/ghaering/pysqlite
config = load_config_file()
cache = sqlite.connect(config['cache'])
cur = cache.cursor()
for pwd_entry in pwd.getpwall():
ai = AccountInfo(pwd_entry.pw_uid, cur)
ai.refresh_from_sys... |
import re
import sys
try:
import setuptools
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
with open('hyperkitty/__init__.py') as fp:
for line in fp:
mo = re.match("""VERSION\s*=\s*['"](?P<version>[^'"]+?)['"]""", line)
... |
import math
import random
class PField(object):
def __init__(self, x, y, r, s, direction):
self.x = x
self.y = y
self.r = r
self.s = s
self.direction = direction
def calc_vector(self, tank_x, tank_y):
# find the distance
dist = (self.x - tank_x)**2 + (self.y - tank_y)**2
# find the angle
angle = 0.0... |
"""
This script compares Amber energies from GMIN binding and two different ways via OpenMM.
GMIN Input files are coords.inpcrd, coords.prmtop and min.in. From Fortran code the energy is -21.7345926639 kcal/mol
One of the OpenMM calculation uses coords.inpcrd for coordinates and coords.prmtop for ff params.
The other O... |
'''
A Tornado-inspired logging formatter, with displayed time with millisecond accuracy
FYI: pyftpdlib also has a Tornado-style logger.
'''
from __future__ import annotations
import sys
import time
import logging
class TornadoLogFormatter(logging.Formatter):
def __init__(self, color, *args, **kwargs):
super().__i... |
import os
from testtools.matchers import (
Contains,
FileExists,
Not
)
import integration_tests
class PrimeKeywordTestCase(integration_tests.TestCase):
def test_prime_filter(self):
self.run_snapcraft(['prime', 'prime-keyword'], 'simple-prime-filter')
# Verify that only the `prime1` file ... |
"""Utilities for managing GeoNode layers
"""
import logging
import re
import os
import glob
import sys
from osgeo import gdal
from django.contrib.auth import get_user_model
from django.template.defaultfilters import slugify
from django.core.files import File
from django.conf import settings
from geonode import GeoNodeE... |
SENTIMENT_COLORS = [
(49,54,149), (69,117,180), (116,173,209), (171,217,233),
(224,243,248), (255,255,191), (254,224,144), (253,174,97),
(244,109,67), (215,48,39), (165,0,38), ]
GRAY = (170,170,170)
def get_sentiment_color(sentiment, scale=4):
"""Returns a color corresponding to the sentiment value.
... |
import logging
from scap.model.xhtml import *
from scap.Model import Model
logger = logging.getLogger(__name__)
class OptGroupTag(Model):
MODEL_MAP = {
'elements': [
{'tag_name': 'option', 'list': '_elements', 'class': 'OptionTag', 'max': None},
],
'attributes': {
'di... |
''' DIRAC Transformation DB
Transformation database is used to collect and serve the necessary information
in order to automate the task of job preparation for high level transformations.
This class is typically used as a base class for more specific data processing
databases
'''
import re, time, thread... |
import urlparse,urllib2,urllib,re
import os
from core import scrapertools
from core import logger
from core import config
def get_video_url( page_url , premium = False , user="" , password="", video_password="" ):
logger.info("tvalacarta.servers.sieterm get_video_url(page_url='%s')" % page_url)
data = scraperto... |
from __future__ import print_function
import BaseHTTPServer
import threading
import SocketServer
import urlparse
import re
import argparse
import sys
import time
import os
import datetime
try:
import whois
except Exception as e:
print(str(e))
print("You need to install the Python whois module. Install PIP ... |
from urllib.request import urlopen
html = urlopen("http://beans.itcarlow.ie/prices.html")
print(html.read().decode('utf-8')) |
from django.contrib.auth.decorators import login_required
from django.http import Http404, JsonResponse
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.cache import never_cache
from django.views.decorators.http import require_GET
from repanier.em... |
"""Manage migration from INSPIRE legacy instance."""
from __future__ import absolute_import, division, print_function
import gzip
import re
import tarfile
import zlib
from collections import Counter
from contextlib import closing
from itertools import chain
import click
import requests
from celery import group, shared_... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'core'}
DOCUMENTATION = '''
module: package_facts
short_description: package information as facts
descriptio... |
import win32serviceutil
import win32event
import win32service
import servicemanager
import winerror
from win32service import SERVICE_START_PENDING, \
SERVICE_RUNNING, \
SERVICE_STOP_PENDING, \
SERVICE_STOPPED
from win32serviceutil import Service... |
import os
import numpy as np
from .Experiment_auto_read_T import Experiment_auto_read_T
from .GIF_subth_adapt_constrained import GIF_subadapt_constrained
from .Filter_Rect_LogSpaced import Filter_Rect_LogSpaced
from . import Tools
def run(animal_number, root_path, unwanted_sessions):
#%%
#######################... |
from __future__ import division
import numpy as np
s = lambda smax, b, B: 1/smax+(smax-(1/smax))*((b-1)/(B-1))
sigmoid = lambda x: 1 / (1 + np.e ** (-1 * x))
g = lambda lab, a0, Q: 1 - lab * np.sum(a0 * Q)
Q_a = lambda a, Q: np.sum(a) - (np.sum(np.sum(a * Q, axis = 0), axis = 0)/2)
def attention(Q, K, V):
num = np.... |
"""
Created on Tue Dec 6 21:50:20 2016
@author: Louis
"""
def checksum(packet):
""" This function hopefully implements the same XOR checksum as the gps. """
i = 0
check = 0
while i < len(packet):
if packet[i] != '$' and packet[i] != '*':
check = check ^ ord(packet[i])
if pac... |
import xml.etree.ElementTree as ET
import xml.dom.minidom as minidom
import os
import arcpy
import re
class XMLBuilder:
"""
Builds an XML file
"""
def __init__(self, xml_file, root_name='', tags=[]):
"""
Initializes the class by setting up the root based on the given name and tags
... |
'''EGL library interface.'''
__all__ = ['eglGetDisplay', 'eglInitialize', 'eglTerminate', 'eglQueryString',
'eglGetConfigs', 'eglChooseConfig', 'eglGetConfigAttrib',
'eglCreateWindowSurface', 'eglCreatePbufferSurface',
'eglCreatePbufferFromClientBuffer', 'eglCreatePixmapSurface',
... |
from multiprocessing import Pool
import time
import os
import sys
import argparse
from Bio.Blast.Applications import NcbiblastxCommandline
def parser_code():
parser = argparse.ArgumentParser(description='Run BLAST on a set of searchable database using a query that is specified by the user. Results will be stored by... |
"""
gdown.modules.privatevpn
~~~~~~~~~~~~~~~~~~~
This module contains handlers for privatevpn.
"""
import re
from datetime import datetime, timedelta
from ..core import Captcha
from ..module import browser, acc_info_template
from ..exceptions import ModuleError # , IpBlocked
def accInfo(username, passwd, proxy=False):... |
"""this is the main gui for ORTi3D. It creates a wx window where parameter
panel, visualisation panel and visuChoose panel are included.
it uses core for the major job of storing and retrieving the data
writer/readers are available for different models"""
import wx
from wxVisualisation import *
from guiShow import *
fr... |
from django.apps import AppConfig
class AppOpeningPageConfig(AppConfig):
name = 'app_opening_page' |
import os
import numpy as np
import orthopoly as op
def triquad(n):
"""
Compute the quadrature nodes and weights for integrating a
function f(x,y) over a triangle with vertices {(-1,-1),(-1,1),(1,-1)}
"""
alphax, betax = op.rec_jacobi(n, 0, 1)
x, wx = op.gauss(alphax, betax)
x = (1 +... |
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_criteria(object):
def setupUi(self, criteria):
criteria.setObjectName("criteria")
criteria.resize(461, 245)
self.verticalLayout = QtWidgets.QVBoxLayout(criteria)
self.verticalLayout.setContentsMargins(-1, -1, -1, 0)
self.ver... |
import re
from urllib import unquote
from urlparse import urljoin, urlparse
from module.network.HTTPRequest import BadHeader
from module.plugins.internal.SimpleHoster import create_getInfo
from module.plugins.Hoster import Hoster
class BasePlugin(Hoster):
__name__ = "BasePlugin"
__type__ = "hoster"
__... |
import os
import logging
import time
import tornado.web
import sqlite3
import tornado.httpserver
import tornado.ioloop
from tornado.options import parse_command_line
from tornado.web import url
conn = sqlite3.connect(
os.path.join(os.path.expanduser("~"), ".ds18b20/values.db"),
detect_types=sqlite3.PARSE_DECLTY... |
import hashlib
from openpyxl.descriptors import (Bool, Integer, String)
from openpyxl.descriptors.excel import Base64Binary
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.worksheet.protection import (
hash_password,
_Protected
)
class ChartsheetProtection(Serialisable, _Protected):
... |
import xbmcgui
from core import httptools
from core import scrapertools
from platformcode import config
from platformcode import platformtools
class Recaptcha(xbmcgui.WindowXMLDialog):
def Start(self, key, referer):
self.referer = referer
self.key = key
self.headers = {'Referer': self.refere... |
import util
import logging
from scenario import ScenarioMaster
def load_image(filename, anchor_x=None, anchor_y=None):
return None
util.load_image = load_image
def load_sprite(filename, anchor_x=None, anchor_y=None):
return None
util.load_sprite = load_sprite
if __name__ == "__main__":
from time import slee... |
import sys
def main(*args, **kwargs):
# right now there's only gtk available.
# When more frontends have been coded, this file will detect the OS and use
# the correct frontend
from snappy.ui.gtk.main import main
main(*args) |
'''
Dataset generator for experiments with MINSEQ operator
'''
from gen.data import gen_all_streams
from gen.directory import MINSEQ_DIR_DICT, create_directories
from gen.experiment import VAR, DEF, ATT, NSQ, RAN, SLI, MIN, ALGORITHM_LIST, \
CQL_ALG, DIRECTORY, PARAMETER, MINSEQ_ALG, MAX_VALUE, TUPLE_RATE, \
ge... |
num = int(input('enter a number'))
binary = []
while num != 0:
a = num % 2
binary.insert(0, a)
num = num / 2
print binary |
"""Reads configuration file for StapleGun."""
from ConfigParser import SafeConfigParser
import logging
import os
class Configs(object):
"""Read configuration file."""
def __init__(self):
"""Read Robottelo's config file and initialize the logger."""
# Set instance vars.
self.properties = ... |
"""Interface to CALIOP L2 HDF4 cloud products."""
import logging
import os.path
import re
from datetime import datetime
from pyhdf.SD import SD, SDC
from satpy.dataset import Dataset
from satpy.readers.file_handlers import BaseFileHandler
logger = logging.getLogger(__name__)
class HDF4BandReader(BaseFileHandler):
"... |
import this
import textwrap
text = this.s
print("\n")
"""
class TextWrapper
width: 行宽度 默认 70
initial_indent: 会被添加到第一行首的位置 默认 ""
subsequent_indent: 会被添加到除了第一行的行首 默认 ""
expend_tabs: 是否将table转换为空格 默认 true
replace_whitespace: 是否转换所有空白字符位空格 此操作位于 expend_tabs 后 默认 true
fix_sentence_endings: 是否强制保证句号后... |
import string
from types import StringType, IntType
from AOR.DoubleList import DoubleList
from AOR.BasicStatement import BasicStatement, BasicRepr
class IODoList(BasicRepr):
# Stores '(obj1, obj2, ..., objn, i=1, n)
def __init__(self,sParOpen, obj1, sComma1):
self.sParOpen = sP... |
def tokenize_file(infilename):
"""Take input file name and return list of tokens, eliminating comments"""
import re
import sys
import fileinput
import math
try:
fp = open (infilename, 'r')
except IOError:
print "Error opening file"
raise
lines = fp.readlines ()
tokens = []
for line in lines:
tmp = re.... |
"""irclib -- Internet Relay Chat (IRC) protocol client library.
This library is intended to encapsulate the IRC protocol at a quite
low level. It provides an event-driven IRC client framework. It has
a fairly thorough support for the basic IRC protocol, CTCP, DCC chat,
but DCC file transfers is not yet supported.
In ... |
"""Web service CLI and mod_wsgi functions.
wsgi_app - Return a WSGI application for a web service.
ws_cli - Parse CLI. Start/Stop ad-hoc server.
"""
import cherrypy
from glob import glob
import os
import signal
from rose.opt_parse import RoseOptionParser
from rose.reporter import Reporter
from rose.resource import Reso... |
from test_support import *
gnatprove(opt=["-P", "test.gpr", "--mode=check", "-cargs", "-gnat2012"]) |
"""
Started on thu, dec 12nd, 2017
@author: carlos.arana
"""
import pandas as pd
import numpy as np
import sys
module_path = r'D:\PCCS\01_Dmine\Scripts'
if module_path not in sys.path:
sys.path.append(module_path)
from SUN.asignar_sun import asignar_sun
from VarInt.VarInt import VarInt
from SUN_integridad.SUN_integ... |
'''
.. module:: lineroot
Defines LineSeries and Descriptors inside of it for classes that hold multiple
lines at once.
.. moduleauthor:: Daniel Rodriguez
'''
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import sys
from .utils.py3 import map, range, string_... |
from backend.controller import Controller
from backend.interface import Handler
from tests.helpers import CallTrack, drain_queue
from backend.component_library import ComponentLibrary
from backend.components import And, Nand
from tests import helpers
import queue
class ElementMock:
def __init__(self, metadata=None)... |
import sys
import threading
class IDSet(object):
def __init__(self, filename = "idset.txt"):
self.lock = threading.Lock()
self.idset = set([])
self.filename = filename
def size(self): return len(self.idset)
def loads(self, filename = None):
if not filename:
filena... |
def check(ex1, ex2):
"""
@type x: int
@type y: int
@rtype: None
"""
assert (ex1, ex2) # Error on this line |
__author__ = 'mcharbit'
from setuptools import setup, find_packages
setup(
name='XlsxGen',
version='0.1',
packages=find_packages(),
scripts=['bin/utils.py'],
package_data = {
# Include template files:
'': ['Template.xlsx', 'Template_no_visible_styles.xlsx', 'Template_visible_styles.x... |
"""
@author:
contact:
@file: 2017/8/28-ansible-module-learning-ping.py
@time: 2017/8/28
"""
from ansible.module_utils.basic import AnsibleModule
def main():
module = AnsibleModule(
argument_spec=dict(
data=dict(required=False, default=None),
),
supports_check_mode=True
)
... |
import copy
from functools import partial
from ansible.module_utils.network.ftd.common import HTTPMethod, equal_objects, FtdConfigurationError, \
FtdServerError, ResponseParams, copy_identity_properties, FtdUnexpectedResponse
from ansible.module_utils.network.ftd.fdm_swagger_client import OperationField, Validation... |
import re
import subprocess
import iet_target
class IetAdm(object):
def __init__(self):
pass
def show(self, params, tid, sid=-1):
if sid >= 0:
cmnd = 'ietadm --op=show --tid=%d --sid=%d' % (tid, sid)
else:
cmnd = 'ietadm --op=show --tid=%d' % tid
process =... |
import sys
import os.path
delimiter = '|'
general = 'General'
fontname = 'fontname'
fontsize = 'fontsize'
datadir = 'datadir'
bgimage = 'bgimage'
fullscreen='fullscreen'
year = 'Year'
start = 'start'
space = 'space'
image = 'image'
moviescreen = 'Moviescreen'
left = 'left'
top = 'top'
width = 'width'
height = 'height'
... |
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.122 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding': 'gzip,deflate,sdch',
'Accept-Language': 'en-US,en;q=... |
import ROOT
import numpy
from e3pipe.__logging__ import logger
from e3pipe.root.E3TreePlotter import E3TreePlotter
ROOT_TO_NUMPY_DICT = {'C': 'string',
'B' : 'int8',
'b' : 'uint8',
'S' : 'int16',
's' : 'uint16',
... |
import orjson
import os
from wsgiref.handlers import CGIHandler
import sys
sys.path.append("..")
import custom_functions
try:
from custom_functions import WebConfig
except ImportError:
from philologic.runtime import WebConfig
try:
from custom_functions import WSGIHandler
except ImportError:
from philolo... |
import os
from PyQt4.QtGui import QApplication
"""Material de la tubería:
0 - Nombre
1 - Tipo
2 - Rugosidad, mm
3 - Diametro nominal, mm
4 - Diametro nominal, pulgadas
5 - Espesor de la pared, mm
6 - Diametro externo, mm
7 - ... |
import os, sys, re
import pprint
import time
import pickle
def search_distinct(thelist):
_stat = {}
for elem in thelist:
if elem not in _stat:
_stat[elem] = 1
else:
_stat[elem] += 1
return _stat
def find_distinct(thelist):
_stat = []
for elem in thelist:
... |
import optparse
import sys
description = """
RHEV-nagios-table-host output is a script for querying RHEVM via API to get host status
It's goal is to output a table of host/vm status for simple monitoring via external utilities
"""
p = optparse.OptionParser("rhev-nagios-table-host.py [arguments]", description=descripti... |
"""
:date: 2016-02-03
:author: liuxy
"""
OSIP_SUCCESS = 0
OSIP_UNDEFINED_ERROR = -1
OSIP_BADPARAMETER = -2
OSIP_WRONG_STATE = -3
OSIP_NOMEM = -4
OSIP_SYNTAXERROR = -5
OSIP_NOTFOUND = -6
OSIP_API_NOT_INITIALIZED = -7
OSIP_NO_NETWORK = -10
OSIP_PORT_BUSY = -11
OSIP_UNKNOWN_HOST = -12
OSIP_DISK_FULL = -30
OSIP_NO_RIGHTS =... |
import gps
session = gps.gps("localhost", "2947")
session.stream(gps.WATCH_ENABLE | gps.WATCH_NEWSTYLE)
while True:
try:
report = session.next()
# Wait for a 'TPV' report and display the current time
# To see all report data, uncomment the line below
# print report
if report['class'] == 'T... |
DEVICE_PROBES = {
'LGE: LGLS740': {
'name': 'LG Volt (LGLS740)',
'missing_probes': [
'edu.northwestern.cbits.purple_robot_manager.probes.sensors.LightSensorProbe',
]
},
'LGE: LGL34C': {
'name': 'Optimus Fuel (LGL34C)',
'missing_probes': [
'edu.... |
"""
Module implementing the printer functionality.
"""
from __future__ import unicode_literals
from PyQt5.QtCore import QTime, QDate, Qt, QCoreApplication
from PyQt5.QtGui import QColor
from PyQt5.QtPrintSupport import QPrinter
from PyQt5.Qsci import QsciPrinter
import Preferences
class Printer(QsciPrinter):
"""
... |
from __future__ import with_statement
from contextlib import nested
from pyglet.gl import *
import math
from gletools import ShaderProgram, Sampler2D, Matrix, Texture, VBO
from ctypes import c_float
from vector import Vector
from protagonist import Protagonist
class Gold(Protagonist):
def __init__(self, texture, progr... |
__author__ = 'Urokhtor'
from Managers.BaseManager import BaseManager
from Constants import *
from time import time
class SensorManager(BaseManager):
def __init__(self, parent):
BaseManager.__init__(self, parent, CONFIG_CORE, "sensors")
def getReading(self, id):
sensor = self.getById(id)
... |
from gi.repository import Gtk
from gi.repository import Gdk
from math import pi
class CellRendererImage(Gtk.CellRenderer):
def __init__(self):
Gtk.CellRenderer.__init__(self)
self.th1 = 2. # border thickness
self.th2 = 3. # shadow thickness
self.page = None
def set_page(self, p... |
import sys
sys.path.append('/home/pi/Desktop/ADL/YeastRobot/PythonLibrary')
from RobotControl import *
def nextplatetotest():
NextOffset = int(raw_input("enter next offset"))
return NextOffset
deck="""\
DW96P SW24P SW24P SW24P SW24P
DW96P SW24P SW24P SW24P SW24P
DW96P SW24P SW24P SW24P SW24P
DW96P SW24P ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.