src
stringlengths
721
1.04M
import pytest from mdp import * random.seed("aima-python") sequential_decision_environment_1 = GridMDP([[-0.1, -0.1, -0.1, +1], [-0.1, None, -0.1, -1], [-0.1, -0.1, -0.1, -0.1]], term...
from __future__ import unicode_literals from django.db import models from django.template.defaultfilters import slugify from bible.models import BibleBook from useraccounts.models import UserAccount class Author(models.Model): name = models.CharField(null=False, blank=False, max_length=50) name_slug = model...
# Copyright (C) 2020 OpenMotics BV # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distribu...
#!/usr/bin/env python """ rules_mapk_bind_data.py contains dictionary with BIND reactions from MAPK network. {rxncon_quick_string: 'Rules': [rule1, rule2 ...], 'Tags': [rtype ...]} """ MAPK_BIND_DATA = { # ASSOCCIATION # BIND no contingencies 'Hot1_BIND_Hot1Site': { 'Rules':[ 'Hot1(AssocHot1Site) + Hot1Sit...
""" Misc. bindings to ffmpeg and ImageMagick.""" import os import sys import subprocess as sp from moviepy.tools import subprocess_call from moviepy.config import get_setting def ffmpeg_movie_from_frames(filename, folder, fps, digits=6): """ Writes a movie out of the frames (picture files) in a folder. ...
""" WSGI config for host 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_APPLICATION`` set...
""" The build-related URI request handlers used by Tweb. """ import datetime import random import json import ast import re import collections from bson.objectid import ObjectId import tornado.web import tornado.gen import tornado.escape import motor import tweblib.handlers import twcommon.misc import twcommon.inte...
__author__ = 'tom1231' from PyQt4.QtCore import QUrl from PyQt4.QtGui import * from BAL.Interface.DeviceFrame import DeviceFrame, EX_DEV, PPMReader from lxml.etree import Element, SubElement, XML class PPMReader(DeviceFrame): def __init__(self, frame, data): DeviceFrame.__init__(self, EX_DEV, frame, data)...
import os import cairo as cairo import numpy as np from render import Animate, Image_Creator import matplotlib.cm as cm def random_rgb_color(alpha=1): return [np.random.uniform(0,1),np.random.uniform(0,1), np.random.uniform(0,1),alpha] def linear_gradient(start,finish,n=10,alpha=1): gradient=[0]*n gradi...
__author__ = 'fahadadeel' import jpype import re import datetime class AddJavascript: def __init__(self, dataDir): self.dataDir = dataDir self.Document = jpype.JClass("com.aspose.pdf.Document") self.JavascriptAction=jpype.JClass("com.aspose.pdf.JavascriptAction") def main(se...
# -*- coding: utf-8 -*- # Copyright © 2012-2017 Roberto Alsina and others. # Permission is hereby granted, free of charge, to any # person obtaining a copy of this software and associated # documentation files (the "Software"), to deal in the # Software without restriction, including without limitation # the rights t...
""" https://en.wikipedia.org/wiki/State-space_representation https://www.kalmanfilter.net/modeling.html """ import numpy as np from scipy.linalg import * def expmint(A, t, nbins=100): f = lambda x: expm(A*x) xv = np.linspace(0, t, nbins) result = np.apply_along_axis(f, 0, xv.reshape(1,-1)) return np...
import unittest import os from datetime import datetime from zope.interface.verify import verifyObject from caliopen_storage.config import Configuration import vobject if 'CALIOPEN_BASEDIR' in os.environ: conf_file = '{}/src/backend/configs/caliopen.yaml.template'. \ format(os.environ['CALIOPEN_...
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
from django.db import models class Host(models.Model): """store host information""" hostname = models.CharField(max_length=30) osver = models.CharField(max_length=30) vendor = models.CharField(max_length=30) product = models.CharField(max_length=30) cpu_model = models.CharField(max_length=30) ...
# coding: utf-8 """Form management utilities.""" from __future__ import unicode_literals import abc from collections import OrderedDict import re from django.forms import TypedChoiceField from django.forms.fields import Field from django.forms.widgets import RadioSelect from django.forms.widgets import RadioChoiceI...
""" DeepMind Control Suite Wrapper directly sourced from: https://github.com/denisyarats/dmc2gym MIT License Copyright (c) 2020 Denis Yarats Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software witho...
import datetime import json import discord import os from discord.ext import commands from discord.ext.commands.converter import * class CassandraContext(commands.Context): def is_float(self, argument): """Checks if the argument is a float.""" try: return float(string) # T...
from setuptools import setup setup( name='django-foundation-statics', version='5.4.7-2', url='https://github.com/benbacardi/django-foundation-statics', description='Zurb Foundation (http://foundation.zurb.com) static files packaged in a django app to speed up new applications and deployment.', auth...
#!/usr/bin/python import commands import sys import argparse import re import urllib, urllib2 import time from collections import namedtuple def split_text(input_text, max_length=100): """ Try to split between sentences to avoid interruptions mid-sentence. Failing that, split between words. See split...
#!/usr/bin/python import RPi.GPIO as GPIO import time import os import signal #Configuration Items fan_pin = 13 fan_freq = 100 fan_startup = 30. fan_min = 30. poll_sec = 1 #Linear interpolation from 2 points upper_temp, lower_temp, upper_speed, lower_speed temp_1 = 70. temp_2 = 30. speed_1 = 100. speed_2 = 1. smoot...
"""Tests for the higlighter classes.""" import pytest from typing import List from rich.highlighter import NullHighlighter, ReprHighlighter from rich.text import Span, Text def test_wrong_type(): highlighter = NullHighlighter() with pytest.raises(TypeError): highlighter([]) highlight_tests = [ ...
import numpy as np def spinfock(eorbitals): """ """ if type(eorbitals) is np.ndarray: dim = 2*len(eorbitals) fs = np.zeros(dim) for i in range(0,dim): fs[i] = eorbitals[i//2] fs = np.diag(fs) # put MO energies in diagonal array elif type(eorbitals) is dict: ...
import cv2 import math import numpy as np import pickle import sys import os import platform def getColor(color, testCode): print "starting Get Color" try: PATH = "Recognition/ColorClassifier/PythonColorClassifier/ColorClassifier/Python/" color_db=pickle.load(open(PATH+"color_db.p","rb")) except : print "Exce...
# Copyright (c) 2013 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
# vim: set fileencoding=utf-8 : from __future__ import absolute_import import logging class NullHandler(logging.Handler): def emit(self, record): pass def log_to_stderr(logger=None, level = logging.DEBUG): """Configures the python log system to log to stderr logger: Logger to configure. Pass no...
#!/usr/bin/env python3 import os import os.path import sys import numpy as np import matplotlib.pyplot as plt from features_common import match_angle, base_plot def outlier_frequency_plot(path, angles, threshold): f, ax = base_plot() ax.plot(100 * np.cumsum(np.abs(angles) > threshold) / angles.size) ax.s...
############################################ # This file contains a wrapper class # for DroneKit related operations # for our drone. ############################################ # Multi-Rotor Robot Design Team # Missouri University of Science Technology # Spring 2017 # Lucas Coon, Mark Raymond Jr. # pylint: di...
# Copyright 2020-2021 Tecnativa - João Marques # Copyright 2021 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, models class MailThread(models.AbstractModel): _inherit = "mail.thread" @api.returns("mail.message", lambda value: value.id) ...
import pytest from formulaic.parser.types import Term, Token class TestToken: @pytest.fixture def token_a(self): return Token('a', kind='name') @pytest.fixture def token_b(self): return Token('log(x)', kind='python', source='y ~ log(x)', source_start=4, source_end=9) @pytest.fix...
import logging import os import sys try: import curses except ImportError: curses = None def _stderr_supports_color(): color = False if curses and hasattr(sys.stderr, 'isatty') and sys.stderr.isatty(): try: curses.setupterm() if curses.tigetnum("colors") > 0: ...
# -*- coding: utf8 -*- ''' Simulate magnetization of one group of nuclear spins "0D" solving the Bloch equation within a frame of reference rotating with w_rf dM/dt = g*(M x B) + relax M: magnetization B: applied magnetic field = B_0 + B_RF + B_G g: gyromagnetic ratio relax: T1, T2 relaxation terms ''' # TODO: [ ] ...
import json import unicodedata # to detect Unicode category from zdict.dictionary import DictBase from zdict.exceptions import QueryError, NotFoundError from zdict.models import Record class MoeDict(DictBase): API = 'https://www.moedict.tw/uni/{word}' @property def provider(self): return 'moe'...
#!/usr/bin/env python from confu import atlas from troposphere import ( Template, FindInMap, GetAtt, Ref, Parameter, Join, Base64, Select, Output, ec2 as ec2 ) template = Template() template.add_description('kafka') atlas.infra_params(template) # ssh_key, Env, Silo atlas.conf_params(template) # Conf Nam...
from celery.schedules import crontab from backoffice.celery import app as celery_app from base.business.education_groups.automatic_postponement import EducationGroupAutomaticPostponement from base.business.learning_units.automatic_postponement import LearningUnitAutomaticPostponement celery_app.conf.beat_schedule.upd...
#! python3 # readCensusExcel.py - Tabulates population and number of census tracts for # each country. import openpyxl, pprint print('Opening workbook...') wb = openpyxl.load_workbook('censuspopdata.xlsx') sheet = wb.get_sheet_by_name('Population by Census Tract') countyData = {} # TODO: Fill in countyDa...
''' @package ssengine lsscoltransfer was writen by Giuseppe Marco Randazzo <gmrandazzo@gmail.com> Geneve Dec 2015 ''' #from scipy.optimize import fmin from optimizer import simplex as fmin from math import sqrt, pi, log10, log, exp, fabs, isnan, isinf, erf from optseparation import drange from time import sleep def ...
# encoding: UTF-8 ''' 登陆模块相关的GUI控制组件 ''' import sys sys.path.append('../') #sys.path.append('D:\\tr\\vnpy-master\\vn.trader\\DAO') sys.path.append('D:\\tr\\vnpy-1.7\\vnpy\\DAO') sys.path.append('D:\\tr\\vnpy-1.7\\vnpy\\common') import vnpy.DAO import vnpy.common from vnpy.DAO import * import pandas as pd import Tki...
#!/usr/bin/env python import sys import os import math import json import scipy.io.netcdf import quantized_mesh_tile.global_geodetic import quantized_mesh_tile.terrain # https://pypi.python.org/pypi/quantized-mesh-tile/ # pip install quantized-mesh-tile class Grd: def __init__(self,fname,tileSize): self....
from builtins import object from tastypie.resources import ModelResource from geodata.models import Country, Region, City from indicator.models import Indicator from tastypie import fields from tastypie.serializers import Serializer class IndicatorFiltersResource(ModelResource): name = fields.CharField(attribut...
''' The synapse distributed key-value hypergraph analysis framework. ''' import os import msgpack import tornado import logging logger = logging.getLogger(__name__) if msgpack.version < (0,4,2): raise Exception('synapse requires msgpack >= 0.4.2') if tornado.version_info < (3,2,2): raise Exception('synapse r...
import sys from bs4 import BeautifulSoup import effulgence_pb2 as eproto import google.protobuf import re import os import urlparse def get_chapters_from_stdin(): chapters = eproto.Chapters() google.protobuf.text_format.Merge(sys.stdin.read(), chapters) return chapters def load_profile_data(): ...
import mock import hashlib from django.core.cache import cache from siglock.decorators import single_task def test_single_task_no_arguments(add_mock): """ Tests cache key without any args or kwargs """ def fn(): pass # decorate & call single_task(60)(fn)() assert add_mock.call_count ==...
import tornado.httpclient import ujson import jwt import abc from urllib import parse from .. import admin as a from .. social import SocialNetworkAPI, APIError, AuthResponse, SocialPrivateKey class GoogleAPI(SocialNetworkAPI, metaclass=abc.ABCMeta): GOOGLE_OAUTH = "https://www.googleapis.com/oauth2/" NAM...
#!/usr/bin/python #-*- coding: utf-8 -*- import re, os from datatypes.Section import Section from datatypes.Slide import Slide from datatypes.Presentation import Presentation from parser_utils import get_named_entities, get_urls, get_slide_type def parse_beamer(path): """ Transform a beamer tex file into a |...
# Copyright 2019-2020 by Christopher C. Little. # This file is part of Abydos. # # Abydos 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 version 3 of the License, or # (at your option) any later versio...
'''Collection of static util methods for various Canvas operations''' import logging from http import HTTPStatus from requests.utils import quote from integrated_channels.exceptions import ClientError from integrated_channels.utils import generate_formatted_log LOGGER = logging.getLogger(__name__) class CanvasUtil...
########################################################################## # # Copyright (c) 2011-2012, John Haddon. All rights reserved. # Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted prov...
#!/usr/bin/python # coding: UTF-8 """ Implementation of command: track """ __author__ = "Hiroyuki Matsuo <h-matsuo@ist.osaka-u.ac.jp>" # ===== Configuration ========================================================== # ----- Disk I/O tracking ------------------------------------------------------ #DEVICE_NAME = "mm...
# This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2009-2019 DataONE # # Licensed under the Apache License, Version 2.0 (the "License"); # you ma...
from backdoors.backdoor import * import time class Netcat(Backdoor): prompt = Fore.RED + "(nc) " + Fore.BLUE + ">> " + Fore.RESET def __init__(self, core): cmd.Cmd.__init__(self) self.intro = GOOD + "Using netcat backdoor..." self.core = core self.options = { ...
# -*- coding: utf-8 -*- import pytest from django.contrib.sessions.backends.base import SessionBase from django.core.handlers.wsgi import WSGIRequest from django.http import HttpResponse from incuna_test_utils.testcases.integration import BaseIntegrationTestCase from tests.factories import UserFactory from tests.views...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This file is part of Karesansui. # # Copyright (C) 2012 HDE, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, incl...
import pytest import secp256k1 def test_schnorr_simple(): if not secp256k1.HAS_SCHNORR: pytest.skip('secp256k1_schnorr not enabled, skipping') return inst = secp256k1.PrivateKey() raw_sig = inst.schnorr_sign(b'hello') assert inst.pubkey.schnorr_verify(b'hello', raw_sig) key2 = se...
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico 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 version 3 of the # License, or (a...
#!/usr/bin/python # # Peteris Krumins (peter@catonmat.net) # http://www.catonmat.net -- good coders code, great reuse # # http://www.catonmat.net/blog/python-library-for-google-search/ # # Code is licensed under MIT license. # import random import socket import urllib import urllib2 import httplib BROWSERS = ( ...
""" Tray icon for udiskie. """ from gi.repository import Gio from gi.repository import Gtk from .async_ import run_bg, Future from .common import setdefault, DaemonBase, cachedmethod from .locale import _ from .mount import Action, prune_empty_node from .prompt import Dialog from .icons import IconDist import os _...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'ScenarioStand.acres' db.add_column('trees_scenariostand', 'acres', sel...
import pytest from uwg import psychrometrics def test_psychrometric_float_point(): # Input values Tdb_in = 297.5311337413935 w_in = 0.018576773131376 P = 10090 Tdb, w, phi, h, Tdp, v = psychrometrics.psychrometrics(Tdb_in, w_in, P) assert Tdb == pytest.approx(24.381133741393512, abs=1e-15) ...
# Copyright 2012 OpenStack Foundation. # All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
# -*- coding: utf-8 -*- """ Class SupplyUseTable. Version 1.1. Last change: May 18th, 2015. Check https://github.com/stefanpauliuk/pySUT for latest version. Methods for efficient handling of supply and use tables (SUTs) Created on Mon Jun 30 17:21:28 2014 @author: stefan pauliuk, NTNU Trondheim, Norway Guillaume ...
#!/usr/bin/env python # This file sends a sms of the visitor's image to the cell phone number using twilio account. # Download the twilio-python library from http://twilio.com/docs/libraries # Import the necessary modules import twilio from twilio.rest import TwilioRestClient # Sends a picture of the visitor to the...
import re # First Part def First_Part(s): Bot_Dict = {} g=0 s=s.split('\n') while 1: p=re.sub('(?<=output )\d+',lambda k:str(-int(k.group(0))-1),s[g%len(s)]) G=re.findall('-?\d+',p) if p[:3]=='bot' and G[0] in Bot_Dict.keys() and len(Bot_Dict[G[0]])>1: if sorted(Bot_Dict[G[0]]...
#==================================================== # Cycle - calendar for women # Distributed under GNU Public License # Original author: Oleg S. Gints # Maintainer: Matt Molyneaux (moggers87+git@moggers87.co.uk) # Home page: http://moggers.co.uk/cgit/cycle.git/about #==================================...
#!/usr/bin/python # -*- coding: UTF-8 -*- #import times import hebcalendar import sys import datetime import io from oleHelper import * from convertdate import hebrew, utils year = int(sys.argv[1]) location = 'Israel' holidays = hebcalendar.get_year(year, location) # Excel version sheet = create_sheet() row = 2 ...
import pytest import pickle from spacy.vocab import Vocab from spacy.strings import StringStore from ..util import make_tempdir test_strings = [([], []), (["rats", "are", "cute"], ["i", "like", "rats"])] test_strings_attrs = [(["rats", "are", "cute"], "Hello")] @pytest.mark.parametrize("text", ["rat"]) def test_se...
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
# Copyright (c) 2013 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
from HTMLParser import HTMLParser import sys, re,os from os import listdir import Levenshtein class MLStripper(HTMLParser): def __init__(self): self.reset() self.fed = [] def handle_data(self, d): self.fed.append(d) def get_data(self): return ''.join(self.fed) def strip_tag...
# -*- coding: utf-8 -*- from django.shortcuts import render, redirect, render_to_response import ast from ..forms import selecttForm from ..forms import applicationForm from ..utils import ApplicationUtil from ..utils import ApplicationHistoryUtil from ..utils import EnvironmentUtil from ..utils import StringUtil from ...
#!/usr/bin/env python # Copyright (c) 2014, Carnegie Mellon University # All rights reserved. # # Authors: Michael Koval <mkoval@cs.cmu.edu> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # Redistributions of...
#List all ENUMS from Object.Ingredient import Ingredient for i in Ingredient: print(i) from Object.PotionColor import PotionColor for r in PotionColor: print(r) from Object.PotionSign import PotionSign for r in PotionSign: print(r) #//TODO #NEED TO ADD ALCHEMICAL ENUMS HERE #Make a Potion and Fetch its values fr...
#!/usr/bin/env python2.5 # # Copyright 2011 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from utils import gauss_2d_isotropic, gauss_2d_anisotropic gauss_dict = {2: gauss_2d_isotropic, 4: gauss_2d_anisotropic} def scatter_3d(x1, x2, y, xlabel='u', ylabel='v', zlabel='flux', xlim3d=None, ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import logging import math import numpy as np from collections import defaultdict import ray from ray.rllib.evaluation.metrics import LEARNER_STATS_KEY from ray.rllib.policy.tf_policy import TFPolicy from ray....
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
from . import base_models class Single11(base_models.SingleLabelModel): patch_size = 11 weight_shapes = { 'w_c1': [4, 4, 4, 1, 64], 'w_c2': [3, 3, 3, 64, 64], 'w_c3': [3, 3, 3, 64, 128], 'w_c4': [3, 3, 3, 128, 128], 'w_fc1': [1024, 512], 'w_fc2': [512, 512], ...
# stdlib from collections import defaultdict import re import time # 3rd party import requests # project from checks import AgentCheck from config import _is_affirmative from util import headers STATS_URL = "/;csv;norefresh" EVENT_TYPE = SOURCE_TYPE_NAME = 'haproxy' class Services(object): BACKEND = 'BACKEND' ...
""" sentry.models.group ~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function import logging import math import six import time import warnings from base64 import b16decod...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from hwt.code import Add from hwt.synthesizer.param import Param from hwtHls.platform.virtual import VirtualHlsPlatform from hwtHls.hls import Hls from hwtLib.logic.pid import PidController class PidControllerHls(PidController): def _config(self): super(Pid...
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
"""Command to clone a CVS repository or module as a Git repository.""" import os.path import shutil from cvsgit.main import Command, Conduit from cvsgit.i18n import _ from cvsgit.command.verify import Verify class Clone(Command): __doc__ = _( """Clone a CVS repository or module into a Git repository. Us...
import weakref _weaks = {} # weakref.WeakValueDictionary() class ExtendedRef(weakref.ref): def __init__(self, ob, callback=None, **annotations): super(ExtendedRef, self).__init__(ob, callback) self.__counter = 0 for k, v in annotations.iteritems(): setattr(self, k, v) def...
#!/usr/bin/python # -*- coding: utf-8 -*- # This script calculates 95th percentile for request time and shows top 10 requests ID with max send time to customers # # Start example: # ./loganalytics.py /path-to-log/input.txt > /path-to-some-dir/output.txt # then you can complete analysis by running 2nd script # ./granaly...
# -*- coding: utf-8 -*- import urllib from urllib.request import urlopen import html.parser as h from bs4 import BeautifulSoup import sys import time import io import re reg =re.compile(r'\d+') list = ['0', '10', '20'] for s in list: url = ('https://site.douban.com/maosh/widget/events/1441569/?start='+s) url...
""" OEML - REST API This section will provide necessary information about the `CoinAPI OEML REST API` protocol. This API is also available in the Postman application: <a href=\"https://postman.coinapi.io/\" target=\"_blank\">https://postman.coinapi.io/</a> # noqa: E501 The version of the OpenAPI d...
# -*- coding: utf-8 -*- import os ''' Simple résolution numérique de l'équation d'un oscillateur harmonique pour illustrer l'isochronisme des oscillations quelle que soit l'amplitude de départ avec animation au cours du temps. ''' import numpy as np # Pour np.linspace import scipy as sp ...
# coding=utf-8 import random from django.core.cache import cache from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import ugettext as _ from notifications.models import EventType from social_graph import EdgeType try: from hashlib import sha1 as sha_constructor, md5 as md5_constru...
# coding=utf-8 class SpatialOrientation: '''Spatial Orientation facade. Computes the device's orientation based on the rotation matrix. .. versionadded:: 1.3.1 ''' @property def orientation(self): '''Property that returns values of the current device orientation as a (azimut...
#!/usr/bin/python # # Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
import tempfile import shutil import os from molotov import quickstart, __version__, run from molotov.tests.support import set_args, TestLoop, dedicatedloop class TestQuickStart(TestLoop): def setUp(self): super(TestQuickStart, self).setUp() self._curdir = os.getcwd() self.tempdir = tempf...
from ...combinators import Lazy from ...AST.statements.loop import WhileStatement, ForStatement, RepeatStatement def while_stmt(): """ Parsing 'while' statement. """ from ..common import keyword from ..expressions import logical from ..statements import base def process(parsed): (...
#!/usr/bin/env python import rospy from cv_bridge import CvBridge import cv, cv2 import numpy from sensor_msgs.msg import Image bridge = CvBridge() pub = rospy.Publisher("/image_out", Image) def image_callback(image): """ Applies a new filter to the image and displays the result. """ image_cv = bridge.imgms...
# coding: utf-8 from __future__ import absolute_import from google.appengine.ext import ndb import flask_restful import flask from api import helpers import auth import model import util from main import api_v1 @api_v1.resource('/repo/', endpoint='api.repo.list') class RepoListAPI(flask_restful.Resource): def g...
#coding: utf-8 #------------------------------------------------------------------- # 宝塔Linux面板 #------------------------------------------------------------------- # Copyright (c) 2015-2016 宝塔软件(http:#bt.cn) All rights reserved. #------------------------------------------------------------------- # Author: 黄文良 <287962...
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + from __future__ import (absolute_import, divi...
import web import common import base class Register(base.Page): def __init__(self): base.Page.__init__(self, "Register") def GET(self): # show login page return common.render.register() @staticmethod def send_conf_email(user_id, name, email): duration = 1800 # 30 mi...
# ***** BEGIN LICENSE BLOCK ***** # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. # ***** END LICENSE BLOCK ***** import json from mozharness.base import log from mozha...
# -*- coding: utf-8 -*- ############################################################################## # # Author: Yannick Buron # Copyright 2015, TODAY Clouder SASU # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License with Attribution # ...
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2012-2021 GEM Foundation # # OpenQuake is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the Licen...