content
string
"Functions that help with dynamically creating decorators for views." # For backwards compatibility in Django 2.0. from contextlib import ContextDecorator # noqa from functools import WRAPPER_ASSIGNMENTS, partial, update_wrapper, wraps class classonlymethod(classmethod): def __get__(self, instance, cls=None): ...
# -*- coding: utf-8 -*- from docx import Document from docx.shared import Cm from docx.enum.text import WD_PARAGRAPH_ALIGNMENT, WD_ALIGN_PARAGRAPH from datetime import datetime import apps.council.models as council_models def generate_attendance_list(meeting): document = Document() # Setting margins se...
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import sys ifile = sys.argv[1] ofile = sys.argv[2] paragraph_flag = False with open(ifile, 'r') as inf: with open(ofile, 'w') as outf: for line in inf.readlines(): if line.strip().startswith("<doc ") or line.strip() == "</doc>" or line....
from utils import create_newfig, create_moving_polygon, create_still_polygon, run_or_export func_code = 'au' func_name = 'test_one_moving_one_stationary_along_path_intr_at_start' def setup_fig01(): fig, ax, renderer = create_newfig('{}01'.format(func_code), xlim=(-4, 15), ylim=(-2, 10)) create_moving_polygon(...
#!/usr/bin/env python # Thunder Chen<<EMAIL>> 2007.9.1 # # import xml.etree.ElementTree as ET from object_dict import object_dict def __parse_node(node): tmp = object_dict() # save attrs and text, hope there will not be a child with same name if node.text: # Uncomment the below line to get value...
from os.path import expanduser from examples.python.conceptual_blending.networks.base_network import \ BaseNetwork from opencog.scheme_wrapper import scheme_eval __author__ = 'DongMin Kim' # noinspection PyTypeChecker class ConceptNetNetwork(BaseNetwork): def __init__(self, a): super(self.__class__, ...
#!/usr/bin/env python ''' read a run log output of current seeding-study program and retrieve the most important feature data like task completion time and the answer correctness. after processing, the output will dump to the stdout Copyright Chapstudio 2010-2011 Haipeng Cai @June 1st, 2011 ''' import os import sys ...
"""Controllers for the learner dashboard.""" from core.controllers import base from core.domain import acl_decorators from core.domain import exp_services from core.domain import feedback_services from core.domain import learner_progress_services from core.domain import subscription_services from core.domain import su...
import unittest from integrationtest_support import IntegrationTestSupport class Test(IntegrationTestSupport): def test(self): self.write_build_file(""" from pybuilder.core import use_plugin, init use_plugin("python.core") use_plugin("python.distutils") name = "integration-test" default_task = "publish...
""" The UI widgets of the language selection dialog. """ from PyQt4 import QtGui from openlp.core.lib import translate from openlp.core.lib.ui import create_button_box class Ui_FirstTimeLanguageDialog(object): """ The UI widgets of the language selection dialog. """ def setupUi(self, language_dialog)...
""" Functional API endpoints separate from static views """ # stdlib import json import asyncio as aio from functools import wraps from pathlib import Path from typing import Dict # library from quart import Response, request from quart_openapi.cors import crossdomain from voluptuous import Invalid, MultipleInvalid ...
#!/usr/bin/env python3 from datetime import datetime, timedelta from io import StringIO import os import matplotlib import yaml from dicttoxml import dicttoxml from flask import Flask, jsonify, request, Response, abort, render_template from flask_caching import Cache import meteo from meteo import data as md matplot...
"""Tests for ast_util module.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import ast import collections import textwrap from absl.testing import absltest as test import gast from pyctr.core import anno from pyctr.core import ast_util from pyctr.core...
from trac.versioncontrol.api import RepositoryManager from bhsearch.search_resources.base import BaseIndexer from bhsearch.search_resources.changeset_search import ChangesetIndexer class ChangesetSearchModel(BaseIndexer): def get_entries_for_index(self): repository_manager = RepositoryManager(self.env) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ (c) 2014 Brant Faircloth || http://faircloth-lab.org/ All rights reserved. This code is distributed under a 3-clause BSD license. Please see LICENSE.txt for more information. Created on 23 June 2014 17:38 PDT (-0700) """ from __future__ import absolute_import import...
import scrapy import logging import pprint from pprint import pformat class CSpider(scrapy.Spider): name = 'CarsCrawler' start_urls = ['https://suchen.mobile.de/fahrzeuge/search.html?damageUnrepaired=NO_DAMAGE_UNREPAIRED&isSearchRequest=true&maxMileage=100&maxPowerAsArray=PS&minPowerAsArray=35&min...
import floto.api import pytest import botocore.client import botocore.exceptions from unittest.mock import PropertyMock, Mock import json class Client_Mock(object): def register_workflow_type(self, **args): pass class TestSwf(object): @classmethod def teardown_class(cls): print('tearing d...
#!/usr/bin/env python from sys import argv, exit from os import path from glob import glob from numpy import * try: working_folder = path.abspath(argv[1]) except(IndexError): print("Usage: %s working_folder" % argv[0]) exit(1) hbarC = 0.19733 bulk_flag = False # convert hyper-surface from VISH2+1 format...
""" create pool tables Revision ID: 6a2f424ec9d2 Created at: 2020-05-03 14:47:59.136410 """ import sqlalchemy as sa from alembic import op revision = "6a2f424ec9d2" down_revision = "1e280b5d5df1" branch_labels = None depends_on = None def upgrade(): op.create_table( "pool_category", sa.Column("...
""" Image file manipulation functions related to profile images. """ import binascii from collections import namedtuple from contextlib import closing from io import BytesIO import piexif import six from django.conf import settings from django.core.files.base import ContentFile from django.utils.translation import u...
from django import template from django.template.base import FilterExpression from django.template.loader import get_template from django.conf import settings from ..exceptions import SiteMessageConfigurationError register = template.Library() @register.tag def sitemessage_prefs_table(parser, token): tokens = ...
# -*- coding: utf-8 -*- # Scrapy settings for naver_crawler project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # http://doc.scrapy.org/en/latest/topics/settings.html # http://scrapy.readthedocs.org/en/...
"""Tests for keypair API.""" from oslo.config import cfg from nova.compute import api as compute_api from nova import context from nova import db from nova import exception from nova.openstack.common.gettextutils import _ from nova import quota from nova.tests.compute import test_compute CONF = cfg.CONF QUOTAS = qu...
class baselinkedlist: """ Linked-List interface. is_empty() add_as_first(element) add_as_last(element) get_first() get_last() get_first_record() get_last_record() pop_first() pop_last() delete_record(record) """ def is_empty(self)...
import math listaTrian=[] listaCuadr=[] listaPenta=[] listaHexa=[] listaHepta=[] listaOcto=[] listaNoSalidos=[] encontrado=0 n1=0 n2=0 n3=0 n4=0 n5=0 n6=0 x=0 temp=0 for x in range(1,200): a1=x*(x+1)/2 a2=x*x a3=x*(3*x-1)/2 a4=x*(2*x-1) a5=x*(5*x-3)/2 a6=x*(3*x-2) if a1<10000 and a1>1010: ...
"""ml2 binding:vif_details Revision ID: 50d5ba354c23 Revises: 27cc183af192 Create Date: 2014-02-11 23:21:59.577972 """ # revision identifiers, used by Alembic. revision = '50d5ba354c23' down_revision = '27cc183af192' # Change to ['*'] if this migration applies to all plugins migration_for_plugins = [ 'neutron....
# encoding: utf-8 import mimetypes import os import re import requests from tempfile import NamedTemporaryFile from twitter import TwitterError TLDS = [ "ac", "ad", "ae", "af", "ag", "ai", "al", "am", "an", "ao", "aq", "ar", "as", "at", "au", "aw", "ax", "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "...
# -*- coding: utf-8 -*- """QGIS Unit tests for QgsPalLabeling: base suite setup From build dir, run: ctest -R PyQgsPalLabelingBase -V See <qgis-src-dir>/tests/testdata/labeling/README.rst for description. .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU Gen...
import threading class Peripheral(object): supported_firmwares = [] commands = [] def __init__(self, serial, firmware): self.pause_reading = False self.serial = serial self.firmware = firmware if self.firmware not in self.supported_firmwares: print(self.suppor...
# stdlib import re # 3p import mock # project from tests.checks.common import AgentCheckTest, Fixtures DEFAULT_DEVICE_NAME = '/dev/sda1' class MockPart(object): def __init__(self, device=DEFAULT_DEVICE_NAME, fstype='ext4', mountpoint='/'): self.device = device self.fstype = fs...
# -*- coding: utf-8 -*- """Module handling schedules""" import attr from navmazing import NavigateToSibling, NavigateToAttribute from widgetastic.exceptions import NoSuchElementException from widgetastic.widget import Text, Checkbox, TextInput from widgetastic_manageiq import Calendar, AlertEmail, Table, PaginationPa...
__file__ = 'BlanksCleanUp_v2' __date__ = '3/10/14' __author__ = 'ABREZNIC' import arcpy routeList = [] blanks = "C:\\TxDOT\\_Subfile Validations\\EOY\\2014\\blanks.dbf" cursor = arcpy.SearchCursor(blanks) for row in cursor: route = str(row.RTE_ID) if route not in routeList: routeList.append(route) ...
from O365.contact import Contact import logging import json import requests logging.basicConfig(filename='o365.log',level=logging.DEBUG) log = logging.getLogger(__name__) class Group( object ): ''' A wrapper class that handles all the contacts associated with a single Office365 account. Methods: constructor -...
import netaddr from oslo_versionedobjects import fields as obj_fields from neutron.db import api as db_api from neutron.db import models_v2 as models from neutron.objects import base from neutron.objects import common_types @base.NeutronObjectRegistry.register class SubnetPool(base.NeutronDbObject): # Version 1....
""" Decorator for views that tries getting the page from the cache and populates the cache if the page isn't in the cache yet. The cache is keyed by the URL and some data from the headers. Additionally there is the key prefix that is used to distinguish different cache areas in a multi-site setup. You could use ...
import os import mock import unittest from ciscospark import core GNAHCKIRE_KEY = os.environ['GNAHCKIRE_KEY'] MY_TOKEN = 'Bearer ' + GNAHCKIRE_KEY PERSON_ID = 'Y2lzY29zcGFyazovL3VzL1BFT1BMRS85ZTAxNzczMS03NTE4LTRlN2UtOTNlMy0wNGVkMjJlN2YxNGU' # <EMAIL> RESULT_ERROR_MSG = 'returned result is not in expected format' cl...
import pytest from anchore_engine.analyzers.syft import filter_artifacts class TestFilterArtifacts: @pytest.mark.parametrize( "relationships", [ [ { "parent": "parent-id", "child": "child-id", "type": "NOT-own...
#!/usr/bin/env python # encoding: utf-8 """ SyntaxHighlight.py Created by Rui Carmo on 2007-01-11. Published under the MIT license. """ import re, yaki.Engine, yaki.Store from yaki.Utils import * from BeautifulSoup import * class TracWikiPlugin(yaki.Plugins.WikiPlugin): def __init__(self, registry, webapp): re...
import untwisted.event from util import NotInstalled def install(bot, no_numeric=False, max_level=0): old_drive = bot.drive def drive(event, *args, **kwds): if event == untwisted.event.TICK: return if event == untwisted.event.READ: return if event == untwisted.event.WRITE: return ...
from __future__ import print_function, absolute_import, division, unicode_literals import numpy as np def _comment_replacer(match): start, mid, end = match.group(1, 2, 3) if mid is None: # single line comment return '' elif start is not None or end is not None: # multi line comment...
import wx import os import re import time import calendar import base64 import calendar import urllib2 import urlparse import threading import feedparser from htmlentitydefs import name2codepoint from settings import settings def set_icon(window): bundle = wx.IconBundle() bundle.AddIcon(wx.Icon...
""" A web developer needs to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements: The area of the rectangular web page you designed must equal to the given target area...
"""Fichier contenant la classe Ancre, détaillée plus bas.""" from random import randint from bases.objet.attribut import Attribut from primaires.interpreteur.editeur.entier import Entier from primaires.perso.exceptions.stat import DepassementStat from secondaires.navigation.constantes import * from .base import BaseE...
from zen import * import unittest import os import os.path as path import tempfile class EdgeListWriteTestCase(unittest.TestCase): """ Tests to write: - test_write_undirected1_labels_noweights - test_write_directed1_labels_noweights - test_write_undirected1_labels_weights - test_write_directed1_labels_weight...
#!/usr/bin/python3 import sys import os from head import Head from lib import (human_size_to_byte, correct_offset, Locator, TailWorkerSLIH, TailWorkerSBIH, TailWorkerSB, TailWorkerULIH, TailWorkerUBIH, TailWorkerTLIH, TailWorkerTBIH, TailWorkerTL, TailWorkerTB) import thinap class T...
############################################################################### # # # ctx_common.py # # Component of Contexo Core - (c) Scalado AB 2006 # ...
import re def to_valid_filename(filename: str) -> str: """Given any string, return a valid filename. For this purpose, filenames are expected to be all lower-cased, and we err on the side of being more restrictive with allowed characters, including not allowing space. Args: filename (str...
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( determine_ext, clean_html, get_element_by_attribute, ExtractorError, ) class TVPIE(InfoExtractor): IE_NAME = 'tvp' IE_DESC = 'Telewizja Polska' _VALID_URL = r'https?:...
# Conquer def conquer_merge(array, left, right, mid): #temp = [None] * len(array) i = left j = mid + 1 k = left while i <= mid and j <= right: if array[i] <= array[j]: temp[k] = array[i] i += 1 else: temp[k] = array[j] j += 1 ...
#!/usr/bin/env python """ Utility functions for manipulating poses in ROS. Used mostly for extending coordinate transformations beyond the scope of transformations.py. Written by Alex Zhu (alexzhu(at)seas.upenn.edu) """ import numpy as np import roslib from std_msgs.msg import ( Header, ) from geometry_msgs.msg i...
""" Copyright information for Expluit0. """ from __future__ import division, absolute_import #from expluit0 import __version__ as version, version as longversion #longversion = str(longversion) copyright="""\ Copyright (c) 2012-2013 Posquit0. See LICENSE for details.""" disclaimer=''' Expluit0, the Framework of Yo...
import os import unittest import logging import cmath import math import testfixtures from pyvivado import project, signal from pyvivado import config as pyvivado_config from rfgnocchi.blocks import controller from rfgnocchi import config logger = logging.getLogger(__name__) def make_blank_d(): ...
import logging from virtaal.views import recent from virtaal.views.welcomescreenview import WelcomeScreenView from basecontroller import BaseController class WelcomeScreenController(BaseController): """ Contains logic for the welcome screen. """ MAX_RECENT = 5 """The maximum number of recent it...
import sys import json import gzip from bisect import bisect import random from datagen.entitygenerator import EntityGenerator, SimpleElement from datagen.cdf import CDF class USEmail(SimpleElement): def __init__(self, domains = "domains.txt", **kwargs): SimpleElement.__init__(self...
#!/usr/bin/env python from nose.tools import * import networkx as nx from random import random, choice class TestUnweightedPath: def setUp(self): from networkx import convert_node_labels_to_integers as cnlti self.grid=cnlti(nx.grid_2d_graph(4,4),first_label=1,ordering="sorted") self.cycle=...
""" Helpers for working with 2-d matrices """ import numpy as np import scipy.io def permute_matrix(m, is_flat=False, shape=None): """ Randomly permute the entries of the matrix. The matrix is first flattened. Parameters ---------- m: np.array The matrix (tensor, etc.) is_flat: bool...
DBUS_INTERFACE_VERSION = 1 DBUS_INTERFACE_REVISION = 15 DBUS_INTERFACE = "org.fedoraproject.FirewallD%d" % DBUS_INTERFACE_VERSION DBUS_INTERFACE_ZONE = DBUS_INTERFACE+".zone" DBUS_INTERFACE_POLICY = DBUS_INTERFACE+".policy" DBUS_INTERFACE_DIRECT = DBUS_INTERFACE+".direct" DBUS_INTERFACE_POLICIES = DBUS_INTERFACE+".pol...
from collections import Counter from scipy import spatial from sys import exit LETTER_FREQ = { " " : 0.1831685753, "e" : 0.1026665037, "t" : 0.0751699827, "a" : 0.0653216702, "o" : 0.0615957725, "n" : 0.0571201113, "i" : 0.0566844326, "s" : 0.0531700534, "r" : 0.0498790855, "h"...
import datetime import numpy as np import sys from matplotlib.dates import * from copy import deepcopy import matplotlib.pyplot as mpl def convertDates(dates): numDates = len(dates) dates2 = np.zeros([numDates], 'float') for i in range(0, numDates): year = int(dates[i] / 10000) month = int(dates...
import unittest import os import comm from xml.etree import ElementTree import json class TestCrosswalkApptoolsFunctions(unittest.TestCase): def test_versionCode_normal(self): comm.setUp() comm.create(self) os.chdir('org.xwalk.test') with open(comm.ConstPath + "/../tools/org.xwalk...
import hashlib import os from pyCI.util.db import DB def page(route): title = route[2] db = DB('/etc/pyci.db') body = '' slug = db.project_slug_by_name(route[2]) host = os.environ.get('HTTP_REFERER', 'http://{0}/'.format(os.environ.get('HTTP_HOST', ''))) badge_info = ''' <div class="section...
import logging from netaddr import * def merge(dbag, data): # A duplicate ip address wil clobber the old value # This seems desirable .... if "add" in data and data['add'] is False and "ipv4_address" in data: if data['ipv4_address'] in dbag: del(dbag[data['ipv4_address']]) else: ...
import numpy as np try: from scipy.linalg import solve_triangular scipy_exists = True except Exception: scipy_exists = False EPS = np.finfo(float).eps def abs_sign(x, y): """ Returns the value :math:`|x|\\mathsf{sign}(y)`; used in GMRES, for example. Parameters ---------- x : float ...
import os import sys sys.path.insert(0, os.path.abspath('..')) import unittest from weatheralerts.cap import CapParser # some sample cap xml rc = """<?xml version = '1.0' encoding = 'UTF-8' standalone = 'yes'?> <feed xmlns = 'http://www.w3.org/2005/Atom' xmlns:cap = 'urn:oasis:names:tc:emergency:cap:1.1' xmlns:ha...
dashboard = """ <!DOCTYPE html> <html lang="en"> <head> <title id='Description'>trakr Dashboard </title> <link rel="stylesheet" href="http://cdn.trakr.mobi/jqwidgets/styles/jqx.base.css" type="text/css" /> <link rel="stylesheet" href="http://cdn.trakr.mobi/jqwidgets/styles/jqx.ui-darkness.css" type="tex...
# -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User, Group from django.contrib import admin from django.core.exceptions import ValidationError from datetime import date, timedelta import datetime class Unidade(models.Model): sigla = models.CharField(max_length=20, uniqu...
from openpyxl.shared.xmltools import Element, SubElement, get_document_content from openpyxl.shared.ooxml import ( SHEET_MAIN_NS, DRAWING_NS, SHEET_DRAWING_NS, CHART_NS, REL_NS, CHART_DRAWING_NS, PKG_REL_NS ) class DrawingWriter(object): """ one main drawing file per sheet...
import pygame class Ship(): def __init__(self, ai_settings, screen): '''Initialize the player and set its starting position.''' self.screen = screen self.ai_settings = ai_settings # Load the image and get its rect. self.image = pygame.image.load('images/rocket.png') ...
""" FGDC metadata parser """ from owslib.etree import etree from owslib import util class Metadata(object): """ Process metadata """ def __init__(self, md): self.idinfo = Idinfo(md) self.eainfo = Eainfo(md) self.metainfo = Metainfo(md) class Idinfo(object): """ Process idinfo """ ...
from django.http import Http404 from django.core.exceptions import ObjectDoesNotExist from django.template.defaultfilters import slugify from django.db import models from django.contrib.auth.models import Permission, Group from django.contrib.contenttypes.models import ContentType from Forum.settings import User from F...
# To allow __main__ in subdirectory import sys sys.path.append(sys.path[0] + '/../..') import json import itertools as it import numpy as np import scipy import problems import problems.boundary from abcoef import calc_a_coef import sys M = 7 n_done = 0 def go(problem_name, boundary_name): global n_done ...
from __future__ import absolute_import from datetime import timedelta from django.db import models from django.utils import timezone from sentry.utils import metrics from sentry.utils.cache import cache from sentry.db.models import BoundedPositiveIntegerField, FlexibleForeignKey, Model, sane_repr class ReleaseProje...
from nose.tools import istest, assert_equal from mammoth import documents from mammoth.docx.xmlparser import element as xml_element, text as xml_text from mammoth.docx.document_xml import read_document_xml_element from mammoth.docx import body_xml @istest class ReadXmlElementTests(object): @istest def can_re...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys try: from setuptools import setup except ImportError: from distutils.core import setup readme = open('README.rst').read() history = open('HISTORY.rst').read().replace('.. :changelog:', '') requirements = [ # TODO: put package requireme...
"""PLEASE - The Python Low-energy Electron Analysis SuitE. Author: Maxwell Grady Affiliation: University of New Hampshire Department of Physics Pohl group Version 1.0.0 Date: October, 2017 config_test_data.py This file provides a script that will automatically adjust the data path setting in the four YAML configurat...
""" Given a function on floating number f(x) and two floating numbers ‘a’ and ‘b’ such that f(a) * f(b) < 0 and f(x) is continuous in [a, b]. Here f(x) represents algebraic or transcendental equation. Find root of function in interval [a, b] (Or find a value of x such that f(x) is 0) https://en.wikipedia.org/wiki/Bise...
import shelve import logging import utils from tinydb import TinyDB from tinydb.storages import JSONStorage from tinydb.middlewares import CachingMiddleware from numpy import argsort, zeros, array from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer f...
from easing_functions.easing import ( LinearInOut, QuadEaseInOut, QuadEaseIn, QuadEaseOut, CubicEaseInOut, CubicEaseIn, CubicEaseOut, QuarticEaseInOut, QuarticEaseIn, QuarticEaseOut, QuinticEaseInOut, QuinticEaseIn, QuinticEaseOut, SineEaseInOut, SineEaseIn, ...
""" This component provides HA sensor for Netgear Arlo IP cameras. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.arlo/ """ import logging import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.component...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Weblio API(as if) consumer """ import requests from requests import RequestException from bs4 import BeautifulSoup class Weblio: def __init__(self): #self.definition_url = 'http://www.weblio.jp/content/%s' # Cannot find some rare words ...
#!/usr/bin/env python ## if you wish to work with tensorflow v1 then ask it to emulate version 2 behavior #import tensorflow.compat.v2 as tf #tf.enable_v2_behavior() #print(tf.__version__) from __future__ import absolute_import, division, print_function, unicode_literals import os import csv import joblib import tim...
__doc__="""HPEVADiskFCPort HPEVADiskFCPort is an abstraction of a HPEVA_DiskFCPort $Id: HPEVADiskFCPort.py,v 1.2 2010/06/30 17:08:21 egor Exp $""" __version__ = "$Revision: 1.2 $"[11:-2] from Globals import DTMLFile, InitializeClass from HPEVAHostFCPort import * class HPEVADiskFCPort(HPEVAHostFCPort): """DiskF...
import argparse import sys import os import numpy as np from PIL import Image import cStringIO import zlib import ocppaths import ocpcarest import zindex import anydbm import pdb # # ingest the PNG files into the database # """This file is super-customized for Mitya's FlyEM data.""" # Stuff we make take from a c...
import argparse import logging from neutronclient.common import utils from neutronclient.neutron import v2_0 as neutronV20 def _format_fixed_ips(port): try: return '\n'.join([utils.dumps(ip) for ip in port['fixed_ips']]) except Exception: return '' class ListPort(neutronV20.ListCommand): ...
#!/usr/bin/env python """ This script generates the ES template file (packetbeat.template.json) from the _meta/fields.yml file. Example usage: python generate_template.py filebeat/ filebeat """ import yaml import json import argparse import os def fields_to_es_template(args, input, output, index, version): ...
import sys, os, re import numpy, math import HTSeq ##################################################################################################################################################################### if len(sys.argv)!= 9: print ("The parameter number is wrong!!! (#1)") raise SystemExit (1) ...
""" Commands make it possible for layers to communicate with the "outer world", e.g. to perform IO or to ask the master. A command is issued by a proxy layer and is then passed upwards to the proxy server, and from there possibly to the master and addons. The counterpart to commands are events. """ from typing import ...
from odoo import fields, models, tools class ReportProjectActivityUser(models.Model): _name = "report.project.activity.user" _description = "Activities by user and project" _order = 'name desc, project_id' _auto = False name = fields.Char(string='Actividad', readonly=True) user_id = fields.Ma...
"""empty message Revision ID: 3f837c9f110d Revises: 3680c3777428 Create Date: 2015-08-12 10:21:51.494497 """ # revision identifiers, used by Alembic. revision = '3f837c9f110d' down_revision = '3680c3777428' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - ...
import random symbols = ["Cherry","Bell","Lemon","Orange","Star","Skull"] player_credit = 100 cost_of_turn = 20 def random_symbols(symbols): """ Generates a random symbol from a given list """ return symbols[random.randint(0,len(symbols)-1)] while player_credit > 0: #Ch...
from __future__ import print_function, absolute_import, division import logging import monocyte.handler.acm import monocyte.handler.cloudformation import monocyte.handler.dynamodb import monocyte.handler.ec2 import monocyte.handler.rds2 import monocyte.handler.s3 import monocyte.handler.iam from pils import get_item_f...
"""Runs both the Python and Java tests.""" import sys import time from pylib import apk_info from pylib import test_options_parser from pylib import run_java_tests from pylib import run_python_tests from pylib import run_tests_helper from pylib.test_result import TestResults def SummarizeResults(java_results, pytho...
# This cog is a modified version of Radio Haru by Mr Boo Grande import discord from discord.ext import commands from cogs.utils import checks from __main__ import send_cmd_help import asyncio from icyparser import IcyParser class RadioElectro: """Radio Electro :)""" def __init__(self, bot): self.bot...
# -*- coding: utf-8 -*- from __future__ import unicode_literals, division, absolute_import, print_function from builtins import * # pylint: disable=unused-import, redefined-builtin import logging import functools from flexget import plugin from flexget.event import event from flexget.manager import Session try: ...
""" This module contains a backport for collections.namedtuple obtained from http://code.activestate.com/recipes/500261-named-tuples/ """ from operator import itemgetter as _itemgetter from keyword import iskeyword as _iskeyword import sys as _sys #pylint: disable=I0011,R0914,W0141,W0122,W0612,C0103,W0212,R0912 def ...
class PriorityQueue(object): """A priority queue implementation using a min-heap based on Skiena's Algorithm Design Manual. Attributes: array: An array of tuples to store data. The position of a tuple implicitly satisfies the role of pointers. Array index starts at 1 to simplify...
# -*- coding: utf-8 -*- from pytgbot import Bot from pytgbot.api_types.receivable.media import PhotoSize from pytgbot.api_types.receivable.updates import Message from pytgbot.api_types.sendable.reply_markup import InlineKeyboardButton, InlineKeyboardMarkup from pytgbot.exceptions import TgApiException import logging _...
# -*- coding: utf-8 -*- from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from model.contact import ContactBaseData import re class ContactHelper: def __init__(self, app): self.app = app # additional methods -adding contact d...
from dataclasses import dataclass from string import Template from builder import Builder from config import Config, Target from utils.shell import shell # language=bash download_command = Template( """ curl -L -s -o ag.tar.gz https://github.com/ggreer/the_silver_searcher/archive/${version}.tar.gz """ ) # langua...
# -*- coding: utf-8 -*- import os import sys from karmaworld.apps.notes import sanitizer from south.utils import datetime_utils as datetime from south.db import db from south.v2 import DataMigration from django.db import models from django.core.files.storage import default_storage import requests def display_counts(c...