code
stringlengths
1
199k
import mock from buildbot.changes import base from buildbot.test.util import changesource from buildbot.test.util import compat from twisted.internet import defer from twisted.internet import reactor from twisted.internet import task from twisted.trial import unittest class TestChangeSource(changesource.ChangeSourceMix...
import unittest """684. Redundant Connection https://leetcode.com/problems/redundant-connection/description/ In this problem, a tree is an **undirected** graph that is connected and has no cycles. The given input is a graph that started as a tree with N nodes (with distinct values 1, 2, ..., N), with one additional edg...
import json from flask import Blueprint, jsonify, request, g from flask_autodoc import Autodoc item_api = Blueprint('itemApi', __name__) auto = Autodoc() def get_item_as_object(item): return { "_id": str(item.mongo_id), "name": item.name, "description": item.description, "imageURL": ...
from tracks.core import MultiTracksReader, dump_track, MultiTracksWriter import numpy __all__ = [ "pca_levels", "CovarianceMatrix", "CovarianceBlocks", "cov_overlap", "cov_overlap_multi", "pca_common_usage", "pca_common_script", ] def pca_levels(mtr, num_levels, weights=None, correlation=False, reference=No...
from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('shop', '0008_auto_20150417_0958'), ] operations = [ migrations.AlterField( model_name='positioninorder', name='qty', ...
""" plainbox.impl.commands.test_run =============================== Test definitions for plainbox.impl.run module """ import os import shutil import tempfile from collections import OrderedDict from inspect import cleandoc from mock import patch from unittest import TestCase from plainbox.impl.box import main from plai...
""" """ from ulakbus.models.auth import Unit from ulakbus.models.personel import Personel from ulakbus.models.ogrenci import Okutman from .general import ints, gender, marital_status, blood_type, driver_license_class, id_card_serial, birth_date from .general import fake from random import random, randint __author__ = '...
import wx from .helpers import AutoListCtrl class ItemProperties(wx.Panel): def __init__(self, parent, stuff, item, context=None): wx.Panel.__init__(self, parent) mainSizer = wx.BoxSizer(wx.VERTICAL) self.paramList = AutoListCtrl(self, wx.ID_ANY, style=w...
import os import sys import numpy as np from PIL import Image from m64py.core.defs import Buttons import ag.logging as log class Processing(): """The image processing. This will be used by both the Process and Playback Modules for conversion of images for Tensorflow. """ def __init__(self, folders="...
""" find the sum of two binary numbers represented by a string, and print out the result in a string format. https://leetcode.com/problems/add-binary/ date: 10/09/21 """ def add(str1,str2): bin_arr1 = list(str1) bin_arr2 = list(str2) min_len = min(len(bin_arr1), len(bin_arr2)) max_len = max(len(bin_arr1...
"""Run dfoil test dataset""" import sys import subprocess args = ("../fasta2dfoil.py", sys.argv[1], "-o", sys.argv[1] + ".counts", "--names P1,P2,P3,P4,PO") print("Running ", " ".join(args)) proc = subprocess.Popen(' '.join(args), stdout=sys.stdout, stderr=sys.stderr, shell=True)...
from karaage.conf.defaults import * # NOQA from karaage.tests.defaults import * # NOQA PLUGINS = [ 'kgapplications.plugin', ] import sys from karaage.conf.process import post_process post_process(sys.modules[__name__])
import curses class Item: """ Base class for all ingame objects, including creatures and scenery """ def __init__(self): self.blocking = False self.carryable = False self.glyph = "@" self.colour = curses.COLOR_GREEN def isBlocking(self): """ Does this item prevent movement on a map? """ return self.bl...
import cairo import copy import gtk import pangocairo import webbrowser from collections import namedtuple from itertools import chain import action from appearance import CellPropertiesDialog import constants from gui_common import launch_dialog from grid import Grid, decompose_word import preferences from preferences...
import coefficient_example_1 import random ARRAY1 = [random.random() for _ in range(0, 10000)] ARRAY2 = [random.random() for _ in range(0, 10000)] def slow_test(): coefficient_example_1.slow_processing(ARRAY1, ARRAY2) return True def fast_test(): coefficient_example_1.faster_processing(ARRAY1, ARRAY2) r...
import threading class AbstractWriter(object): def __init__(self, file): self.external_stop = False self._condition = threading.Condition() self.file = file def open(self): """ Opens the currently set port""" raise NotImplementedError() def is_open(self): """ ...
from __future__ import division import numpy as np import pylab as pl from pybrain.structure.modules import LSTMLayer import pybrain.tools.shortcuts as pybrain_tools import pybrain.datasets import pybrain.supervised.trainers.rprop as pybrain_rprop import multiprocessing import timeit from mpi4py import MPI import sys p...
import unittest from ua.core.utils import htmlutils class Test_HtmlUtils(unittest.TestCase): def test_strip_tags_none(self): result = htmlutils.strip_tags(None) self.assertIsNone(result) def test_strip_tags_match(self): result = htmlutils.strip_tags('text <tag>tag content</tag> more text...
import struct import subprocess import re import binascii from shutil import copyfile ORIG_EXE = "QCRACK.EXE" TARGET_EXE = "QCRACK01.EXE" copyfile(ORIG_EXE, TARGET_EXE) def get_24_bytes(addr, game, challenge, breakpoint): with open(TARGET_EXE, "r+b") as f: addr = struct.pack("L", addr) f.seek(breakp...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module: ec2_group_facts short_description: Gather facts about ec2 security groups in AWS. description: - Gather facts about ec2 security groups in AWS. v...
from conan.packager import ConanMultiPackager if __name__ == "__main__": builder = ConanMultiPackager(username="pix4d", channel="testing", upload="https://api.bintray.com/conan/pix4d/conan") builder.add_common_builds(shared_option_name="Expat:shared") builder.run()
''' This example demonstrates supervised backpropagation training in a simple network. ''' import os, sys sys.path.append(os.path.abspath(os.path.join(os.getcwd(), '../..', ))) import logging import numpy as np import random import theano logging.root.setLevel(logging.DEBUG) theano.config.compute_test_value = 'warn' fr...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os from ansible import constants as C from ansible.errors import AnsibleParserError, AnsibleUndefinedVariable, AnsibleFileNotFound from ansible.module_utils.six import string_types try: from __main__ import display except...
import numpy def matrixToNumpyArray(m): rn= m.noRows cn= m.noCols retval= numpy.empty([rn,cn]) for i in range(0,rn): for j in range(0,cn): retval[i][j]= m(i,j) return retval def vectorToNumpyArray(v): rn= v.size() retval= numpy.empty([rn,1]) for i in range(0,rn): retval[i][0]= v[i] retur...
import os import json import re import sys from io import open as uopen from collections import OrderedDict if len(sys.argv) == 1 or not sys.argv[1]: raise SystemExit('Build dir missing.') proj_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], '..') build_dir = os.path.abspath(sys.argv[1]) chromium_ma...
from tkinter import * from tkinter.filedialog import * import tkinter.messagebox import os, time, sys, random, math, string, socket, _thread, webbrowser, Pmw from WsprMod import g from WsprMod import palettes from math import log10 import numpy.core.multiarray import array from PIL import Image, ImageTk, ImageDraw from...
from django.contrib.auth.models import User from django.contrib.auth.decorators import login_required from django.contrib.auth.forms import PasswordChangeForm from django.shortcuts import render_to_response from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.template.context import RequestCo...
import datetime import gpxpy import gpxpy.gpx import sqlite3 import sys import time def main(dbsource, filename): real_filename = filename + '.gpx' gpx = gpxpy.gpx.GPX() # Create first track in our GPX: gpx_track = gpxpy.gpx.GPXTrack() gpx.tracks.append(gpx_track) # Create first segment in our GPX track: gpx_seg...
"""Setup forDjango Imager app.""" import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) REQUIRES = [ 'django', 'psycopg2', 'django-registration', 'sorl-thumbnail', ] TEST = [ 'tox', 'coverage', 'pytest-cov', 'factory-boy', ] DEV = [ '...
import os from datetime import date import json from django.core.cache import cache from django.db.utils import DatabaseError from django.http.response import Http404 from django.test import override_settings from django.test.client import RequestFactory from bedrock.base.urlresolvers import reverse from mock import AN...
from positive_alert_test_case import PositiveAlertTestCase from negative_alert_test_case import NegativeAlertTestCase from alert_test_suite import AlertTestSuite class TestAlertProxyDropExecutable(AlertTestSuite): alert_filename = "proxy_drop_executable" # This event is the default positive event that will caus...
import collections from django.conf import settings from elasticsearch_dsl import F, Q, query from rest_framework.filters import BaseFilterBackend from kuma.wiki.search import WikiDocumentType from .models import Filter, FilterGroup def get_filters(getter_func): filters = collections.OrderedDict() for slug in F...
import datetime import django_filters from dateutil import parser from django.core.exceptions import ObjectDoesNotExist from django.db import models as django_models from rest_framework import viewsets from rest_framework.decorators import action from rest_framework.exceptions import ParseError from rest_framework.resp...
from __future__ import absolute_import, print_function, unicode_literals import datetime import jsone import pipes import yaml import os import slugid import taskcluster from git import Repo from lib.tasks import schedule_task ROOT = os.path.join(os.path.dirname(__file__), '../..') def calculate_branch_and_head_rev(roo...
"""This script use the nearest marker to the transcript as control, increasing permutation rounds according to the p-value""" import string import sys import MySQLdb import getpass import time def translateAlias(str): if str == "B6": return "C57BL/6J" elif str == "D2": return "DBA/2J" else: return str dataStar...
""" Structured Tagging based on XBlockAsides """ import json from xblock.core import XBlockAside, XBlock from web_fragments.fragment import Fragment from xblock.fields import Scope, Dict from xmodule.x_module import AUTHOR_VIEW from xmodule.capa_module import CapaModule from edxmako.shortcuts import render_to_string fr...
from __future__ import absolute_import, print_function, unicode_literals, division from jormungandr import InstanceManager from pytest import fixture from pytest_mock import mocker from jormungandr import app from jormungandr.instance_manager import choose_best_instance class FakeInstance: def __init__(self, name, ...
import unittest try: from unittest import mock except ImportError: import mock from pyramid import testing as pyramid_testing from .. import testing from ... import config from .views_test_data import COLLECTION_METADATA class OaiViewsTestCase(unittest.TestCase): fixture = testing.data_fixture @classmet...
from django.contrib import admin from sorl.thumbnail import get_thumbnail from sorl.thumbnail.admin import AdminImageMixin from . import models @admin.register(models.Slide) class SlideAdmin(admin.ModelAdmin): list_display = ('id', 'content_object', 'content_type', 'sort_order', 'is_active') list_filter = ('is_...
import StringIO import datetime import urllib from django.utils import simplejson import re import collections import logging from django.template.loader import render_to_string from django.template import RequestContext from django.core import serializers from django.http import \ HttpResponse, HttpResponseRed...
"""View for viewing all coding jobs (for a user)""" from django.shortcuts import render from api.rest.datatable import Datatable from navigator.utils.auth import check from amcat.models.user import User CODINGJOB_MENU=None from api.rest.resources import CodingJobResource @check(User, args='coder_id', args_map={'coder_i...
""" This module contains helper functions used in HTML application templates. An ``helper`` object linked to the application is created by this module to be used in all the application. """ import re import time import traceback from logging import getLogger, INFO from alignak_webui import get_app_config lo...
import subprocess import sys import os if len(sys.argv) < 2: print "Usage: %s SCRIPTNAME [args]" % sys.argv[0] sys.exit(1) else: script = sys.argv[1] args = sys.argv[2:] project = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)) wd = os.path.join(project, 'localconfig') if not os...
import synthicity.urbansim.interaction as interaction import pandas as pd, numpy as np, copy from synthicity.utils import misc from drcog.models import transition def simulate(dset,year,depvar = 'building_id',alternatives=None,simulation_table = 'households', output_names=None,agents_groupby = ['income_3_...
""" Patient Sale Created: 25 Sep 2019 Last mod: 25 Sep 2019 """ from openerp import models, fields, api from openerp.addons.openhealth.models.order import ord_vars class patient_sale(models.Model): """ Patient Sale Class """ _name = 'openhealth.patient.sale' _description = 'Openhealth Patient Sale' _inhe...
""" This module holds the standard implementation of the :class:`PrinterInterface` and it helpers. """ from __future__ import absolute_import __author__ = "Gina Häußge <osd@foosel.net>" __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' __copyright__ = "Copyright (C) 2014 The OctoPr...
from erukar.system.engine import EnvironmentProfile, ErukarObject from .Location import Location import operator, re class Sector(ErukarObject): def __init__(self, region, economic_seed_fn=None): self.coordinates = "" self.environment_profile = EnvironmentProfile() self.region = region ...
import pytest from collections import OrderedDict from zone_normalize import split_comments, zone_normalize, zone_dict_to_str REFERENCE_COM_ZONE = [OrderedDict([('origin', 'com.'), ('ttl', '900'), ('class', 'in'), (...
from django.conf.urls.defaults import * from django.contrib import admin from django.conf import settings admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), (r'^api/', include('api.urls', 'api')), (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': s...
from django.shortcuts import render from django.utils.translation import ugettext_lazy as _ from django.db.models import Sum from books.models import BookType, OrderedBook from common.bookchooserwizard import BookChooserWizard from orders.models import Order from utils.books import get_available_books, get_available_am...
import time import logging from PyQt4.QtGui import QWidget, QListWidgetItem, QImage, QIcon, QPixmap, \ QFrame, QMessageBox, QTabWidget, QVBoxLayout, \ QFormLayout, QLabel, QPushButton from PyQt4.QtCore import SIGNAL, Qt from weboob.tools.application.qt import QtDo, HTMLDe...
{ 'name': 'Product Replacement Cost', 'version': '0.3.1', 'depends': ['base', 'product', 'purchase', 'stock', 'purchase_expense_distribution'], 'author': '[OpenDrive Ltda]', 'website': '[http://www.opendrive.cl]', 'description': """ This module add the replacement cost to the product and the cost price in the sel...
from __future__ import absolute_import, print_function, division import unittest from pony.orm.sqlsymbols import * from pony.orm.sqlbuilding import SQLBuilder from pony.orm.dbapiprovider import DBAPIProvider from pony.orm.tests.testutils import TestPool class TestFormatStyles(unittest.TestCase): def setUp(self): ...
from __future__ import absolute_import from celery import task from django.conf import settings from helfertool.utils import cache_lock from .receive import MailHandler @task(bind=True) def receive_mails(self): if settings.RECEIVE_EMAIL_HOST: with cache_lock("receive_mails", self.app.oid) as acquired: ...
from odoo import api, fields, models class StockMove(models.Model): _inherit = 'stock.move' @api.multi def _get_lot_vals(self, old_lot, index): self.ensure_one() lot_number = "%s-%d" % ( old_lot.name, index) return { 'name': lot_number, 'product_id...
import six from shuup.xtheme.layout import Layout, LayoutCell from shuup.xtheme.plugins.text import TextPlugin from shuup.xtheme.rendering import get_view_config, render_placeholder from shuup.xtheme.testing import override_current_theme_class from shuup_tests.utils import printable_gibberish from shuup_tests.xtheme.ut...
import mysite.profile.controllers import mysite.project.controllers def get_user_ip(request): if request.META['REMOTE_ADDR'] == '127.0.0.1': return "98.140.110.121" else: return request.META['REMOTE_ADDR'] class HandleWannaHelpQueue(object): def process_request(self, request): if not...
from . import account_fiscalyear_close
"backend for http://www.lesinrocks.com" from weboob.capabilities.messages import ICapMessages from weboob.tools.capabilities.messages.GenericBackend import GenericNewspaperBackend from .browser import NewspaperInrocksBrowser from .tools import rssid class NewspaperInrocksBackend(GenericNewspaperBackend, ICapMessages): ...
import couchdb couch = couchdb.Server() def get_db(name): if name in couch: return couch[name] else: print("Automatically created database", name) return couch.create(name)
from flask.ext.wtf import Form from wtforms.fields.html5 import (IntegerField, DateField) from wtforms import SelectField, FloatField from ..models import Offer, CURRENCIES CURRENCIES = [(c, c) for c in CURRENCIES] class OfferForm(Form): currency_from = SelectField('From currency',...
import colander from zope.interface import implementer from substanced.content import content from substanced.schema import NameSchemaNode from substanced.util import renamer from dace.objectofcollaboration.entity import Entity from pontus.widget import RichTextWidget from pontus.core import VisualisableElement, Visual...
__author__ = "Felix Brezo, Yaiza Rubio <contacto@i3visio.com>" __version__ = "2.0" from osrframework.utils.platforms import Platform class Ebay(Platform): """A <Platform> object for Ebay""" def __init__(self): self.platformName = "Ebay" self.tags = ["e-commerce"] #######################...
""" Errors used by the Discussion API. """ from __future__ import absolute_import from django.core.exceptions import ObjectDoesNotExist class DiscussionDisabledError(ObjectDoesNotExist): """ Discussion is disabled. """ pass class ThreadNotFoundError(ObjectDoesNotExist): """ Thread was not found. """ pas...
from django.conf import settings from django.conf.urls.defaults import patterns, include, handler404 from django.views.generic.simple import direct_to_template, redirect_to from django.contrib import admin admin.autodiscover() urlpatterns = patterns('channelguide.guide.views', (r'^$', 'frontpage.index'), (r'^ad...
import setuptools with open('VERSION.txt', 'r') as f: version = f.read().strip() setuptools.setup( name="odoo14-addons-oca-donation", description="Meta package for oca-donation Odoo addons", version=version, install_requires=[ 'odoo14-addon-donation', 'odoo14-addon-donation_base', ...
from django.conf import settings from django.conf.urls import patterns, url from ecommerce.credit.views import Checkout urlpatterns = patterns( '', url(r'^checkout/{course}/$'.format(course=settings.COURSE_ID_PATTERN), Checkout.as_view(), name='checkout'), )
from odoo import api, models class HRHolidays(models.Model): _inherit = "hr.holidays" @api.multi def _get_duration(self): self.ensure_one() return self.number_of_hours_temp @api.multi def _set_duration(self, duration): self.ensure_one() self.number_of_hours_temp = dur...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('compatibility_test', '0001_initial'), ] operations = [ migrations.CreateModel( name='Topic', fields=[ ('id', mode...
__doc__="""This code implements the motp one time password algorithm described in motp.sourceforge.net. The code is tested in tests/test_lib_tokens_motp """ from .mOTP import mTimeOtp from privacyidea.lib.apps import create_motp_url from privacyidea.lib.tokenclass import TokenClass from privacyidea.lib.log import log_w...
from flask import flash, request, url_for from flask import Markup from flask_admin.contrib.sqla import ModelView from wtforms import validators from labonneboite.common.models import OfficeAdminAdd, OfficeAdminRemove from labonneboite.web.admin.forms import nospace_filter, phone_validator, strip_filter, siret_validato...
{ 'name': 'Guatemala - Accounting', 'version': '3.0', 'category': 'Localization/Account Charts', 'description': """ This is the base module to manage the accounting chart for Guatemala. ===================================================================== Agrega una nomenclatura contable para Guatemala....
from __future__ import unicode_literals from django.db import migrations, models import datetime from django.utils.timezone import utc import apps.txtrender.fields class Migration(migrations.Migration): dependencies = [ ('forum', '0002_forumthreadpost_content_text'), ] operations = [ migrati...
from openerp.addons.account_report_webkit.report.general_ledger import ( GeneralLedgerWebkit ) from openerp.addons.account_report_webkit.report.webkit_parser_header_fix import ( HeaderFooterTextWebKitParser ) class GeneralLedgerCsv(GeneralLedgerWebkit): def __init__(self, cursor, uid, context): supe...
""" Config is the class to read, load and manipulate the user configuration. It read a main cfg (nagios.cfg) and get all informations from it. It create objects, make link between them, clean them, and cut them into independent parts. The main user of this is Arbiter, but schedulers use it too (but far less)""" imp...
from __future__ import absolute_import, unicode_literals import time from future import standard_library from pyload.core.datatype.check import OnlineCheck from pyload.core.manager.base import BaseManager from pyload.core.thread import InfoThread from pyload.utils.layer.safethreading import RLock from pyload.utils.stru...
from openerp import models, fields, api class clv_seedling(models.Model): _inherit = 'clv_seedling' _defaults = { 'active_history': True, }
import datetime from lxml import etree import Primitives import Match import Tactics class player_position_type: Goalkeeper = 0 Defender = 1 Midfielder = 2 Forward = 3 def num_to_pos(num): if num == 0: return player_position_type.Goalkeeper elif num == 1: return player_position_t...
from osv import fields,osv from lxml import etree from tools import graph from tools.safe_eval import safe_eval as eval import tools from tools.view_validation import valid_view import os import logging _logger = logging.getLogger(__name__) class view_custom(osv.osv): _name = 'ir.ui.view.custom' _order = 'creat...
import logging import psycopg2 from odoo.addons.component.core import Component from odoo.addons.connector.exception import RetryableJobError _logger = logging.getLogger(__name__) class RecordLocker(Component): """Component allowing to lock record(s) for the current transaction Example of usage:: self.c...
""" WSGI config for notifications project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATI...
""" BioDrop uLite """ from bika.lims import bikaMessageFactory as _ from bika.lims.utils import t from . import BioDropCSVParser, BioDropImporter import json import traceback title = "BioDrop uLite" def Import(context, request): """ Read biodrop analysis results """ infile = request.form['filename'] fil...
from yandextank.core.consoleworker import ConsoleTank from TankTests import TankTestCase, FakeOptions from yandextank.core import ConfigManager import tempfile import unittest class ConfigManagerTestCase(TankTestCase): def setUp(self): tank = ConsoleTank(FakeOptions(), None) tank.init_logging() ...
from __future__ import absolute_import, print_function, unicode_literals from . import gpgme from . import util del absolute_import, print_function, unicode_literals NO_ERROR = None EOF = None util.process_constants('GPG_ERR_', globals()) del util class GpgError(Exception): """A GPG Error This is the base of al...
import pytest from unittest.mock import MagicMock from yandextank.plugins.ShellExec import Plugin def test_plugin_execute(): plugin = Plugin(MagicMock(), {}, 'shellexec') assert plugin.execute('echo foo') == 0 def test_plugin_execute_raises(): plugin = Plugin(MagicMock(), {}, 'shellexec') with pytest.ra...
""" myhdl's distribution and installation script. """ from __future__ import print_function import ast import fnmatch import re import os import sys from collections import defaultdict if sys.version_info < (2, 6) or (3, 0) <= sys.version_info < (3, 4): raise RuntimeError("Python version 2.6, 2.7 or >= 3.4 required...
import os import sys import subprocess if __name__ == "__main__": for fn_src, fn_dst in [ ("acpi-phat.builder.xml", "acpi-phat.bin"), ("bcm57xx.builder.xml", "bcm57xx.bin"), ("ccgx.builder.xml", "ccgx.cyacd"), ("ccgx-dmc.builder.xml", "ccgx-dmc.bin"), ("cfu-offer.builder.xml"...
from spack import * class PyPsycopg2(PythonPackage): """Python interface to PostgreSQL databases""" homepage = "http://initd.org/psycopg/" url = "http://initd.org/psycopg/tarballs/PSYCOPG-2-7/psycopg2-2.7.5.tar.gz" version('2.7.5', sha256='eccf962d41ca46e6326b97c8fe0a6687b58dfc1a5f6540ed071ff1474cea749e...
import sys from sets import Set from threading import RLock from traceback import print_exc from Tribler.Core.simpledefs import * DEBUG = False class RateManager: def __init__(self): self.lock = RLock() self.statusmap = {} self.currenttotal = {} self.dset = Set() self.clear_d...
r"""Command-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) """ import argparse import json import sys def...
from abc import abstractmethod import string import traceback from types import GeneratorType from contracts import describe_type, describe_value, contract from contracts.utils import indent from procgraph import Generator from procgraph import ModelExecutionError __all__ = ['IteratorGenerator'] class IteratorGenerator...
from __future__ import division # support for python2 from threading import Thread, Condition import concurrent.futures import logging try: from urllib.parse import urlparse except ImportError: # support for python2 from urlparse import urlparse from opcua import ua from opcua.client.ua_client import UaClient...
""" This script uses a matrix to store STAGES number of short samples always renewed by recording a source sound with MatrixRecLoop. A metronomic random playback choose a sample to play between the first and RND_LEVEL. """ from pyo import * s = Server(duplex=0).boot() SIZE = 8192 STAGES = 32 RND_LEVEL = 4 # 1 -> STAGE...
import argparse from argparse import RawDescriptionHelpFormatter import logging import sys import re import mclib def getOptions(): """ Function to pull in arguments """ description = """ This script takes a VCF 4.2 file pulls out snps/indels and depth into a csv """ parser = argparse.ArgumentParser(descrip...
from flask import Flask, request, jsonify, Response, send_from_directory from flask_restful import Resource, Api import petl, json, logging, io, sys, os, csv type_supported = {'csv':petl.io.csv.fromcsv, 'tsv':petl.io.csv.fromtsv, 'txt':petl.io.text.fromtext, 'xml':petl.io.xml.fromxml, 'json':petl.io.json.fromjso...
"""netfilter stats for TSDB. This collector exposes metrics from /proc/sys/net/ipv4/netfilter/*. Note that the plugin also collects the setting values from this directory, as it makes it possible to monitor for incorrect settings, and also gives access to the value of these for non-root users.""" import sys im...
r"""This module implements IO and manipulation function for discrete trajectories Discrete trajectories are generally ndarrays of type integer We store them either as single column ascii files or as ndarrays of shape (n,) in binary .npy format. .. moduleauthor:: B. Trendelkamp-Schroer <benjamin DOT trendelkamp-schroer ...
import sys from optparse import OptionParser from xml.dom import minidom import codecs from androguard.core import androconf from androguard.core.bytecodes import apk option_0 = { 'name' : ('-i', '--input'), 'help' : 'filename input (APK or android\'s binary xml)', 'nargs' : 1 } option_1 = { 'name' : ('-o', '--output')...
import sys try: from r_core import RCore except: from r2.r_core import RCore core = RCore() path="/tmp/fatmach0-3true" core.bin.load (path, 0, 0, 0, 0, 0) print ("Supported archs: %d"%core.bin.narch) if core.bin.narch>1: for i in range (0,core.bin.narch): core.bin.select_idx (i) info = core.bin.get_info () if ...
from dataclasses import dataclass from enum import Enum from typing import List from dcs.drawing.drawing import Drawing, LineStyle from dcs.mapping import Point class LineMode(Enum): Segment = "segment" Segments = "segments" Free = "free" @dataclass class LineDrawing(Drawing): closed: bool line_thic...