src
stringlengths
721
1.04M
# -*- coding: utf-8 -*- """971. Flip Binary Tree To Match Preorder Traversal https://leetcode.com/problems/flip-binary-tree-to-match-preorder-traversal/ Given a binary tree with N nodes, each node has a different value from {1, ..., N}. A node in this binary tree can be flipped by swapping the left child and the right...
#!/usr/bin/env python import argparse import numpy as np from PIL import Image ''' This program 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 optio...
import difflib import itertools import yaml import os import gzip import pybedtools # The functools.partial trick to get descriptions to be valid is from: # # http://code.google.com/p/python-nose/issues/detail?id=244#c1 from functools import partial this_dir = os.path.dirname(__file__) config_fn = os.path.join(this_...
# -*- coding:utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import zipfile import io import re import logging import email import dateutil import pytz import base64 try: from xmlrpc import client as xmlrpclib except ImportError: import xmlrpclib from lxml import etree fr...
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Module containing the build stages.""" import functools import glob import os import shutil from chromite.cbuildbot import commands from chromite...
# # Copyright (c) 2014, Scott J Maddox # # This file is part of VisFitter. # # VisFitter 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...
from flask import current_app from changes.backends.base import UnrecoverableException from changes.config import db from changes.constants import Status, Result from changes.jobs.sync_job import sync_job from changes.models import Job, JobPlan from changes.queue.task import tracked_task def abort_create(task): ...
# -*- coding: utf-8 -*- from channels import Group from channels.test import ChannelTestCase, WSClient, apply_routes #TODO: use apply_routes here, these tests are wrong. from msn import consumer class MSNConsumerTest(ChannelTestCase): def test_ws_connect(self): client = WSClient() default = ...
import json import multiprocessing import os import sys import traceback import uuid from base64 import b64decode import psutil import swf.actors import swf.exceptions from simpleflow import format, logger, settings from simpleflow.dispatch import dynamic_dispatcher from simpleflow.download import download_binaries f...
''' @author: rtermondt ''' from django.shortcuts import render_to_response from django.template import RequestContext from manager.models import Interest, Interests from django.contrib.auth.decorators import login_required @login_required() def interest_manager(request): system_message = None if request.POST...
from django import forms from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Field, ButtonHolder, Submit from crispy_forms.bootstrap import InlineCheckboxes obj_types_choices = [ ("vtm", "VTMs"), ("vmp", "VMPs"), ("amp", "AMPs"), ("vmpp", "VMPPs"), ("ampp", "AMPPs")...
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2014-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...
""" Integration tests for stem.descriptor.reader. """ import getpass import os import signal import sys import tarfile import time import unittest import stem.descriptor.reader import test.runner from stem.util import system BASIC_LISTING = """ /tmp 123 /bin/grep 4567 /file with spaces/and \\ stuff 890 """ my_dir ...
# vim:ts=4:sw=4:sts=4:et # -*- coding: utf-8 -*- """Interface to the Nexus online graph repository. The classes in this file facilitate access to the Nexus online graph repository at U{http://nexus.igraph.org}. The main entry point of this package is the C{Nexus} variable, which is an instance of L{NexusConnection}. ...
import unittest import transaction import os import csv from pyramid import testing from thesis.models import DBSession from sqlalchemy import create_engine from thesis.models import ( Base, MappablePoint, Layer ) class TestMappableItem(unittest.TestCase): def setUp(self): self.config = t...
#!/usr/bin/env python import distutils.core import distutils.util try: from distutils.command.build_py import build_py_2to3 \ as build_py except ImportError: from distutils.command.build_py import build_py platform = distutils.util.get_platform() if not platform.startswith('linux'): raise Excep...
#!/usr/bin/env python import pygame import sys sprite_size = [85/2, 112/2] pygame.init() SCREEN_SIZE = (640, 480) screen = pygame.display.set_mode(SCREEN_SIZE) pygame.display.set_caption('Get Off My Head') #pygame.mouse.set_visible(0) image = pygame.image.load('sf_sprites.png') image = pygame.transform.scale(image...
from __future__ import unicode_literals, division, absolute_import from builtins import * # pylint: disable=unused-import, redefined-builtin from flexget import options, plugin from flexget.event import event from flexget.logger import console from flexget.manager import Session try: from flexget.plugins.api_t41...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Aug 11 16:36:30 2017 @author: lracuna """ from vision.conics import Circle, Ellipse from pose_sim import * from vision.camera import * from vision.plane import Plane from vision.screen import Screen from ippe import homo2d import numpy as np import ma...
from rabbyt._sprites import cBaseSprite, cSprite from rabbyt._rabbyt import pick_texture_target from rabbyt.anims import anim_slot, swizzle, Animable from rabbyt.primitives import Quad class BaseSprite(cBaseSprite, Animable): """ ``BaseSprite(...)`` This class provides some basic functionality fo...
# Copyright 2019 Akretion - Renato Lima <renato.lima@akretion.com.br> # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo.tests import SavepointCase class TestIbptService(SavepointCase): @classmethod def setUpClass(cls): super().setUpClass() cls.company = cls._create_c...
#!/usr/bin/env python # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import logging import datetime from django.utils import timezone from datetime import datetime from rest_framework import viewsets from rest_framework.permissions import IsAuthenticatedOrReadOnly from rest_framework import mixins from ..models import Sc...
# -*- coding: utf-8 -*- ### # (C) Copyright (2012-2016) Hewlett Packard Enterprise Development LP # # 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 limi...
import os #temp directory import tempfile import shutil import contextlib #jar downloader import urllib2 import json #cedar code from blocks import BlockColours from spiral import Spiral from world import World from wrapper import Wrapper from lib.png import Writer @contextlib.contextmanager def tempdir(*a, **k): ...
# -*- coding: utf-8 -*- # # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # import json import mock from StringIO import StringIO from django.core.urlresolvers import reverse from django.test import TestCase from django.test.client import Client from rest_framew...
import unittest import array import spike.kosinski TERMINATOR = [0x02, 0x00, 0x00, 0x00, 0x00] # These testcases game from http://www.segaretro.org/Kosinski_compression, # and they are WRONG. Most of them assume lazy loading of new descriptors, # and the actual Sega implementation uses greedy loading. (took my quite...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
#!/usr/bin/env python3 # encoding: utf8 # setup.py """MIPT Student Classifier """ from setuptools import setup, find_packages DOCLINES = (__doc__ or '').split('\n') CLASSIFIERS = """\ Development Status :: 4 - Beta Environment :: Console Intended Audience :: Developers Intended Audience :: End Users/Desktop In...
# -*- coding: iso-8859-15 -*- from sarpaminfohub.infohub.tests.sarpam_test_case import SarpamTestCase from sarpaminfohub.infohub.test_backend import TestBackend from sarpaminfohub.infohub.drug_searcher import DrugSearcher class DrugSearcherTest(SarpamTestCase): def setUp(self): test_backend = TestBackend()...
#!/usr/bin/env python # # 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 writing, softwa...
import re import math import logging import definitions # basic error def CorrectorError(Exception): pass class Corrector(object): def __init__(self): self._expr = "" self._funcPos = [] self.constantR = '(' + '|'.join( \ [ re.escape(const) for const in sorted(defi...
# # Quru Image Server # # Document: errors.py # Date started: 31 Mar 2011 # By: Matt Fozard # Purpose: Internal errors and exceptions # Requires: # Copyright: Quru Ltd (www.quru.com) # Licence: # # This program is free software: you can redistribute it and/or modify # it under the terms o...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2017 Moritz Luca Schmid, Communications Engineering Lab (CEL) / Karlsruhe Institute of Technology (KIT). # # This 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 Softwa...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase, RequestFactory from django.core.exceptions import PermissionDenied try: from django.core.urlresolvers import reverse except ImportError: from django.urls import reverse from django.contrib.admin.sites import Admin...
# graphicsUtils.py # ---------------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkel...
from store import connect from github import Github, NamedUser from settings import COURSE_REPO, COURSE_REPO_NAME class GitHubEventsInfo(object): username = None commits_made = None pull_requests_made = None forks_created = None issues_created = None issues_resolved = None repositories_crea...
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. from __future__ import absolute_import, division, print_function import binascii import pytest from cryptography.exceptions im...
# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j M Y' #...
import math class point: def __init__(self,x,y): self.x=x self.y=y points=[] num=int(raw_input()); for i in range(num): inp=raw_input().split(); x=long(inp[0]) y=long(inp[1]) points.append(point(x,y)) ave_x=0.0 ave_y=0.0 for i in range(num): ave_x += points[i].x; ave_y += point...
from readthedocs_build.config import (ConfigError, BuildConfig, InvalidConfig, load as load_config) from readthedocs.projects.exceptions import ProjectImportError class ConfigWrapper(object): """ A config object that wraps the Project & YAML based configs. Gives p...
# -*- coding: utf-8 -*- from forms import * from errors import * from wootpaste import mail, config from wootpaste.database import db_session from wootpaste.models import * from wootpaste.utils.helpers import * from wootpaste.utils import * if config['paste.spam_ml']: import wootpaste.utils.spam_ml as spam_ml f...
#!/usr/bin/env python # This is a script to run the hollymonitor in a little # standalone webserver, rather than being integrated # into a larger application. from __future__ import print_function from BaseHTTPServer import BaseHTTPRequestHandler from subprocess import Popen, PIPE, STDOUT import mimetypes import os i...
# Copyright 2018 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 by applicable law or a...
from __future__ import division import numpy as np import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import seaborn as sns #sns.set(style='ticks', palette='Set2') current_palette = sns.color_palette() from joblib import Parallel, delayed from scipy.special import wofz from scipy.interpolate im...
# -*- coding: utf-8 -*- #from pykt import * from pykt import KyotoTycoon as kt1 from kyototycoon import DB as kt2 from pykt_emu import KyotoTycoon as kt3 import timeit from cPickle import dumps, loads key = "A" * 12 val = "B" * 1024 def bench_set(Impl): db = Impl() db.open() ret = db.set(key, val) assert ret ==...
# coding: utf-8 # Copyright (c) 2001-2018, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public transport: # a non ending quest to...
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function from django.db import migrations def forwards_func(apps, schema_editor): LanguageBranches = apps.get_model('lexicon', 'LanguageBranches') SndComp = apps.get_model('lexicon', 'SndComp') print('Creating SndComp from LanguageBran...
#!/usr/bin/env python # Copyright (C) 2011 Smarkets Limited <support@smarkets.com> # # This module is released under the MIT License: # http://www.opensource.org/licenses/mit-license.php import glob import io import os import shutil import subprocess import sys from distutils.command import build, clean from distutils....
#!/usr/bin/env python # cardinal_pythonlib/headers_mw.py """ =============================================================================== Original code copyright (C) 2009-2021 Rudolf Cardinal (rudolf@pobox.com). This file is part of cardinal_pythonlib. Licensed under the Apache License, Version 2.0 (...
#以下来自廖雪峰的Python学习之Python模块 #在计算机程序的开发过程中,随着程序代码越写越多,在一个文件里代码就会越来越长,越来越不容易维护。 #为了编写可维护的代码,我们把很多函数分组,分别放到不同的文件里,这样,每个文件包含的代码就相对较少,很多编程语言都采用这种组织代码的方式。 #在Python中,一个.py文件就称之为一个模块(Module)。 #为了避免模块名冲突,Python又引入了按目录来组织模块的方法,称为包(Package) #请注意,每一个包目录下面都会有一个__init__.py的文件,这个文件是必须存在的,否则,Python就把这个目录当成普通目录,而不是一个包。 #__init__.py可以是空...
"""The application's model objects""" import sqlalchemy as sa from meta import Base from pylons.controllers.util import abort from beaker.cache import CacheManager from role import Role from person_role_map import person_role_map from meta import Session import datetime import random class Ceiling(Base): """S...
# Copyright (C) 2016 Red Hat, Inc # # This program 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 version. # # This program is distributed in ...
#!/usr/bin/env python from __future__ import unicode_literals, print_function from pprint import pformat try: from collections import OrderedDict from argparse import ArgumentParser except ImportError: # Python 2.6 stuff from tests.OrderedDict import OrderedDict from tests.argparse import ArgumentP...
# # GridCoordinates.py # # @author Alain Rinder # @date 2017.06.02 # @version 0.1 # class GridCoordinates: """ Coordinates on square grid """ def __init__(self, col, row): self.col = col self.row = row def left(self): """ Return ...
from flask import render_template as template from flask_classful import FlaskView from flask_login import current_user from models import Protein from models import Mutation from database import get_or_create class MutationView(FlaskView): def show(self, refseq, position, alt): protein = Protein.query....
#!/usr/bin/env python #---------------------------------------------------------------------- # Copyright (c) 2012-2015 Raytheon BBN Technologies # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and/or hardware specification (the "Work") to # deal in the Work without ...
import unittest from book_store import calculate_total # Tests adapted from `problem-specifications//canonical-data.json` @ v1.4.0 class BookStoreTest(unittest.TestCase): def test_only_a_single_book(self): self.assertEqual(calculate_total([1]), 800) def test_two_of_the_same_book(self): self...
""" widgets for django-markitup Time-stamp: <2010-01-06 12:31:06 carljm widgets.py> """ from django import forms from django.utils.safestring import mark_safe from django.contrib.admin.widgets import AdminTextareaWidget from markitup import settings from markitup.util import absolute_url, absolute_jquery_url import ...
#!/usr/bin/env python # -*- coding:utf-8 -*- """Graph isomorphimsm/automorphism formulas """ from cnfformula.cnf import CNF from cnfformula.cmdline import SimpleGraphHelper from cnfformula.cmdline import register_cnfgen_subcommand from cnfformula.families import register_cnf_generator from cnfformula.graphs import ...
from collections import OrderedDict def main(j, args, params, tags, tasklet): try: role = args.getTag('aysrole') name = args.getTag('aysname') ayspath = args.getTag('ayspath') or '' repo = j.atyourservice.repoGet(ayspath) service = repo.serviceGet(role, name, die=False) ...
# # Configures RDF_IO mappings to make gazetteer source links available as Linked Data resources # from uriredirect.models import * from gazetteer.models import GazSource,GazSourceConfig,LocationTypeField,CodeFieldConfig,NameFieldConfig from rdf_io.models import ObjectMapping, ObjectType from gazetteer.settings import ...
# pylint: disable=C0103, C0111 """ -------------------------------------------------------------------------------- VHDL Language Module. Defines class structures and methods for identifying and manipulating text structures, and extracting and replicating lexical elements. ---------------------------------...
"""SQL for storing and working on tasks.""" SQL_TEMPLATE = """ CREATE TABLE IF NOT EXISTS pgtq_{0}_scheduled ( key INTEGER PRIMARY KEY, not_before TIMESTAMP WITHOUT TIME ZONE NOT NULL, task JSON NOT NULL, attempts INTEGER NOT NULL, max_retries INTEGER ); CREATE INDEX IF NOT EXISTS ix_pgtq_{0}_scheduled_no...
# Copyright 2012 Mixpanel, 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 writin...
""" Created on Apr 24, 2013 @author: agross """ import numpy as np import pandas as pd import matplotlib.pylab as plt import Stats.Scipy as Stats from Figures.FigureHelpers import latex_float, init_ax from Figures.FigureHelpers import prettify_ax from Helpers.Pandas import match_series, true_index colors = plt.rcPa...
# -*- coding: utf-8 -*- # Copyright 2011 Takeshi KOMIYA # # 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 applica...
#!/usr/bin/env python """ The Open GSM Daemon - Python Implementation (C) 2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de> (C) 2008 Openmoko, Inc. GPLv2 or later Package: ogsmd.gsm Module: gprs This module provides a database with GPRS settings for GPRS network providers. """ providerdb = {} #================...
#! /usr/bin/env python3 import db.accounting from .common import IdSchema, CashBoxField from marshmallow import Schema, fields from odie import sqla from login import get_user, login_required from api_utils import deserialize, api_route, ClientError from db.documents import Deposit, Document class ErroneousSaleLoa...
from Tokenizer import Tokenizer class Parser: def __init__(self, input_content, file=True, debug=False): self.tokenizer = Tokenizer(input_content, file) self.tokenizer.tokenize() self.token = None self.is_debug = debug self.pos = 0 self.info = [] self.debug ...
# Copyright 2016 Casey Jaymes # This file is part of Expatriate. # # Expatriate is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version....
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
import sublime, sublime_plugin import re from collections import namedtuple import os.path """ KeyMapQueryCommand allows you to quickly query if a key-binding is bound. A combo-box will appear displayings a list of bound key-bindings. Type a key-combination into the inptu box to narrow the results ( i.e. ctrl+...
''' Extracts from objdump -d output the hexcode for each op+operands ''' import sys import re exe_info_line = 2 # objdump -d second line has ej: "program.exe: file format pei-i386" section_start_line = 5 # contains: \'Dissasembly of section .text: ''' function_dissasembly_line = 7 # First line containing the header...
# -*- coding: utf-8 -*- """This file contains a helper library to read binary files.""" import binascii import logging import os from plaso.lib import py2to3 def ByteArrayCopyToString(byte_array, codepage=u'utf-8'): """Copies a UTF-8 encoded byte array into a Unicode string. Args: byte_array: A byte array ...
# =============================================================================== # Copyright 2017 ross # # 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/LICE...
import base64 import itertools import json import logging import os import re import time from .buckets import get_bucket_client from .params import get_param_client from .secrets import get_secret_client logger = logging.getLogger("zentral.conf.config") class Proxy: pass class EnvProxy(Proxy): def __init...
from behave import * from unittest.mock import patch, mock_open, MagicMock from src import arg_parser as myArgParser, server_utils as myServerUtils, errors as myErrors import io import requests import requests_mock def setup_debug_on_error(userdata): global BEHAVE_DEBUG_ON_ERROR BEHAVE_DEBUG_ON_ERROR = userdata.getb...
from wikitextparser import parse # noinspection PyProtectedMember from wikitextparser._table import Cell, Table def test_value(): c = Cell('\n| a ') assert ' a ' == c.value assert repr(c) == 'Cell(\'\\n| a \')' assert c.attrs == {} # Use _cached_attrs assert c.attrs == {} # Inline _header...
"""Entity class that represents Z-Wave node.""" import logging from homeassistant.core import callback from homeassistant.const import ATTR_BATTERY_LEVEL, ATTR_WAKEUP, ATTR_ENTITY_ID from homeassistant.helpers.entity import Entity from homeassistant.util import slugify from .const import ( ATTR_NODE_ID, COMMAND_C...
# -*- 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-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
__author__ = 'danny' import csv import logging import tablib from datetime import datetime from django.db.models import Model from django.db.models.fields.files import FieldFile from unicodedata import normalize from django.core.exceptions import PermissionDenied from django.http import HttpResponse from django.templat...
from scipy.stats import invgauss import matplotlib.pyplot as plt fig, ax = plt.subplots(1, 1) # Calculate a few first moments: mu = 0.145 mean, var, skew, kurt = invgauss.stats(mu, moments='mvsk') # Display the probability density function (``pdf``): x = np.linspace(invgauss.ppf(0.01, mu), invgauss....
#! /Users/rkrsn/miniconda/bin/python from __future__ import print_function, division from os import environ, getcwd import sys # Update PYTHONPATH cwd = getcwd() # Current Directory axe = cwd + '/axe/' # AXE pystat = cwd + '/pystats/' # PySTAT where = cwd + '/_imports/' # Where sys.path.extend([axe, pystat, cwd, w...
#!/usr/bin/env python3 # Copyright 2013-2014 The Meson development team # 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...
# Copyright 2015-2020 Rumma & Ko Ltd # License: GNU Affero General Public License v3 (see file COPYING for details) from django.utils import translation from lino.core.gfks import gfk2lookup from lino.core.roles import SiteStaff from django.utils.text import format_lazy from lino.api import dd, rt, _ if False: ...
""" title : piresources.py description : includes a) functions to manipulate a dictionary that representes the consumption of a Raspberry Pi resources b) functions for creating a json file from the dictionary and reading it f...
#!/usr/bin/env python """Simple CLI beep tool""" from __future__ import unicode_literals from __future__ import print_function import re import os import sys import time import datetime import argparse VERSION = '2.1.0' N_BEEPS = 4 WAIT_BEEPS = 0.15 def relative_time(arg): """Validate user provided relative t...
# -*- coding: utf-8 -*- from ..index.folder_node import FolderNode from ..index.hints import DeletedHint, DestMoveHint, SourceMoveHint from ..index.hint_builder import HintBuilder from .added_local_files_task import AddedLocalFilesTask from .added_remote_files_task import AddedRemoteFilesTask from .folder_task import ...
# coding=utf-8 # Copyright 2018 The Tensor2Tensor 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 applicable...
def calculate(counts,result): n1 = 0.0 n2 = 0.0 a = 0.0 c = 0.0 for f1,f2,d in counts: f1f2 = max(f1+f2-1,0) nf1f2 = max(-f1+f2,0) n1 += f1f2 n2 += nf1f2 if d[0]: a+= max(f1f2 - d[1],0) c+= max(nf1f2 - d[1],0) else: ...
# -*- coding: utf-8 -*- # This file is part of wger Workout Manager. # # wger Workout Manager 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 ...
# -*-coding:Utf-8 -* # Copyright (c) 2010 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # l...
# coding=utf-8 # Copyright 2020 The jax_verify 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 applicable la...
from __future__ import absolute_import, print_function from ..base import ModelDeletionTask, ModelRelation class OrganizationDeletionTask(ModelDeletionTask): def get_child_relations(self, instance): from sentry.models import ( OrganizationMember, Commit, CommitAuthor, ...
from __future__ import with_statement import logging class NullHandler(logging.Handler): def emit(self, record): pass log = logging.getLogger('coap') log.setLevel(logging.ERROR) log.addHandler(NullHandler()) import threading import random import traceback import coapTokenizer as t import ...
from lxml import etree from lxml.etree import strip_elements import requests from requests.exceptions import ConnectionError, Timeout from lxml.html import fromstring from wanish.cleaner import html_cleaner, ArticleExtractor, clean_entities, describe from wanish.encoding import get_encodings from wanish.images import ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from .resort import Resort from django.db import models from django.contrib.postgres.fields import ArrayField from dynamic_scraper.models import Scraper, SchedulerRuntime from scrapy_djangoitem import DjangoItem import datetime # Past and...
# -*- coding: utf-8 -*- # # Pychievements documentation build configuration file, created by # sphinx-quickstart on Mon Sep 1 01:28:58 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file....