src
stringlengths
721
1.04M
from euclid import * from math import * __all__ = ['solve'] def solve(vertices, target): if len(vertices) == 2: return solve_one_edge(vertices, target) elif len(vertices) == 3: return solve_two_edges(vertices, target) else: return vertices def solve_one_edge(vertices, target): ...
# https://www.hackerrank.com/challenges/restaurant import sys import math """ def gcd(a, b): if b>a: t = a a = b b = t while b!=0: t = b b = a % b a = t return a """ """ t = int(raw_input()) while t>0: l, b = [int(x) for x in raw_input().split()] print l * b / gcd(l, b)**2 t -= 1 """ """ t = int(raw...
# -*- coding: utf-8 -*- # Pyhaa - Templating system for Python 3 # Copyright (c) 2011 Tomasz Kowalczyk # Contact e-mail: code@fluxid.pl # # This library 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, ...
# coding: utf-8 import argparse import logging import tempfile import signal import time from string import Template from android import android_devices from utils import get_free_port from appium import AppiumNode logging.basicConfig(level=logging.DEBUG) log = logging.getLogger("autoregister") class StopAutoregi...
# -*- coding: utf-8 -*- # # Copyright (c) 2016-2017 Ircam # Copyright (c) 2016-2017 Guillaume Pellerin # Copyright (c) 2016-2017 Emilie Zawadzki # This file is part of mezzanine-organization. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public L...
"""Unit tests for review request page entries.""" from __future__ import unicode_literals from datetime import timedelta from django.contrib.auth.models import AnonymousUser from django.test.client import RequestFactory from django.utils import six from djblets.testing.decorators import add_fixtures from reviewboar...
""" in quad_verts v in quad_faces s in seed s d=1 n=2 in random_factor s d=0.1 n=2 in iterations s d=1 n=2 out verts v out edges s out faces s """ from sverchok.utils.modules.geom_utils import interp_v3_v3v3 as lerp from sverchok.utils.sv_mesh_utils import mesh_join from sverchok.utils.sv_bmesh_utils import remove_dou...
""" Testing src/syncAPI """ import unittest import src.syncAPI class SyncAPITest(unittest.TestCase): """Test the SyncAPI class methods""" def setUp(self): """Set up the test""" self.syncAPI = src.syncAPI.SyncAPI() def test_syncAPI_has_a_shared_state(self): """Test the share...
''' Convert Named-Entity tagged file (Open NLP format) to Stanford NLP format (token-based) @Author yohanes.gultom@gmail Tagged file example (2 sentences): "Internal DPD Sulsel mudah-mudahan dalam waktu dekat ada keputusan. Sudah ada keputusan kita serahkan ke DPP dan Rabu ini kita akan rapat harian soal itu," kata <...
# ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- from __future__ import absolute_import import re import os import xml.etree.ElementTree as ET import json import copy from svtplay_dl.utils.urllib import urlparse, parse_qs, quote_plus from svtplay_dl.service import Service, OpenG...
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import os import re import sys import jinja2 from . import Command from openerp.modules.module import (get_module_root, MANIFEST, load_information_from_description_file as load_manifest) class Scaffold(Command): """ Generates an Odoo module skeleton...
#! /usr/bin/env python from timeside.server.tests.timeside_test_server import TimeSideTestServer from rest_framework import status from django.conf import settings import os class TestProvider(TimeSideTestServer): """ test item creation with providers """ def setUp(self): TimeSideTestServer.setUp(s...
from bson import ObjectId from dahi.statement import Statement class InvalidDocument(Exception): pass class Document(object): def __init__(self, docID=None, botSay=None, humanSay=None, onMatch=None): super(Document, self).__init__() self.botSay = botSay self.humanSay = humanSay ...
# # Copyright 2018 Microsoft Corporation # # 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 ...
from CRABClient.UserUtilities import config, getUsernameFromSiteDB config = config() config.section_('General') config.General.requestName = 'MCWZTo3LNU_v2' config.General.workArea = 'crab_projects' config.General.transferOutputs = True config.General.transferLogs = False config.section_('JobType') config.JobType.pl...
import test.helpers as helpers import nose.tools as nt import mallet.hmm as hmm # import some fixtures import test.fixtures.hmm_fixtures as fixtures class TestHMM(object): def subject(self, states = None): if not states: states = fixtures.states_with_transitions() return hmm.HMM(stat...
#!/usr/bin/env python from runtest import TestBase import subprocess as sp TDIR='xxx' class TestCase(TestBase): def __init__(self): TestBase.__init__(self, 'signal', """ uftrace file header: magic = 4674726163652100 uftrace file header: version = 4 uftrace file header: header size = 40 uf...
#!/usr/bin/python -u # Dedicated Control handler script for OpenLieroX # (http://openlierox.sourceforge.net) # Needed for sleeping/pausing execution import time # Needed for directory access import os import sys import traceback def getRawResponse(): global EmptySignalsCount ret = sys.stdin.readline().strip() if...
import contextlib import multiprocessing import time import ctypes class Ticket(): ''' A ticket from a TicketSemaphore ''' def __init__(self, ticketer, size): self.size = size self.ticketer = ticketer def release(self, *args, **kwargs): ''' Releases this ticket from the owning tic...
from __future__ import absolute_import import pkg_resources from django import utils from xblockutils.resources import ResourceLoader from .config import student_assets, studio_assets loader = ResourceLoader(__name__) class XBlockWithTranslationServiceMixin(object): """ Mixin providing access to i18n servi...
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved. # # This file is part of kiwi. # # kiwi 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 la...
# # Copyright (c) 2008-2015 Citrix Systems, 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 l...
# Copyright 2016 Chr. Hansen A/S and The Novo Nordisk Foundation Center for Biosustainability, DTU. # 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....
############################################################################ # # Copyright (C) 2016 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. # # Commercial License Usage # Licensees holding valid commercial Qt licenses may use this file in # accordance with the co...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.Create...
#!/usr/bin/env python3 # # Copyright (c) 2019, The OpenThread Authors. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright # ...
import mock import requests from novaclient import client from novaclient import exceptions from novaclient.tests import utils fake_response = utils.TestResponse({ "status_code": 200, "text": '{"hi": "there"}', }) mock_request = mock.Mock(return_value=(fake_response)) refused_response = utils.TestResponse({...
''' models for the puzzle concept ''' import json from typing import List from .redis import redis_client def puzzle_urn(name) -> str: ''' redis universal resource name ''' return f'puzzle:{name}' class Puzzle: def __init__(self, name, description, words): self.name = name self.descript...
## # Copyright (c) 2012-2015 Apple 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 l...
#!/usr/bin/python # this source is part of my Hackster.io project: https://www.hackster.io/mariocannistra/radio-astronomy-with-rtl-sdr-raspberrypi-and-amazon-aws-iot-45b617 # this program will determine the overall range of signal strengths received during the whole session. # this program can be run standalone bu...
""" OVERALL CREDIT TO: t0mm0, Eldorado, VOINAGE, BSTRDMKR, tknorris, smokdpi, TheHighway resolveurl XBMC Addon Copyright (C) 2011 t0mm0 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 Sof...
# # 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 # "License"); you may not...
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com> # Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org> # # 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; eith...
""" Utility functions for generating Debian control files from RPM spec files. """ from planex.tree import Tree from planex import mappkgname import textwrap STANDARDS_VERSION = "3.9.3" def control_from_spec(spec): """ Create the contents of the debian/control file from spec. """ res = Tree() s...
import os import logging import shutil import datetime from django.conf import settings from django.db.models import Manager as DefaultManager from django.db import models from django.utils.translation import ugettext_lazy as _ from django.template.defaultfilters import slugify from easy_thumbnails.alias import alias...
#!/usr/bin/env python #-*- coding:utf-8 -*- ######################################################## # Name: Subtitles Client # Site: http://RealGame.co.il __author__ = 'RealGame (Tomer Zait)' __license__ = 'GPL v3' __version__ = '1.0' __email__ = 'realgam3@gmail.com' ###################################################...
import cv2 import numpy import pywt from injector import Module, multiprovider, singleton from rep0st.analyze import Analyzer, Analyzers, InputImage TYPE_NAME = "WHASH" @singleton class WaveletHashAnalyzer(Analyzer): hash_size: int = None image_scale: int = None mode: str = None remove_max_haar_ll: bool = N...
# -*- coding: ascii -*- """ #============================================================================== #title :file_handler.py #description :This file is now very simple for testing purposes, it should implement its functions a lot stricter once this is migrated to...
import sqlite3 import urllib from urllib.request import urlopen from bs4 import BeautifulSoup, NavigableString import nltk nltk.download('punkt') from nltk import sent_tokenize def parseRes2(soup, title, url, cur, author, date, collectiontitle): chapter = '-' sen = "" num = 1 [e.extract() for e in s...
# coding: utf-8 # 😇 import datetime from django.contrib.postgres.fields import JSONField as JSONBField from django.conf import settings from django.db import models from django.utils.module_loading import import_string from markdownx.models import MarkdownxField from markdownx.settings import MARKDOWNX_MARKDOWNIFY_FU...
# -*- coding: utf-8 -*- ''' Created on Nov 8, 2013 @author: tedlaz ''' import sqlite3 import os import num_txt_etc as nm import model zdb = None debuging = False def dprint(val): if debuging: print(val) def executeScript(script,db): ''' Generic sql script execution ...
# -*- coding: utf-8 -*- """ Clase C{AndOperatorNode} del árbol de sintáxis abstracta. """ from pytiger2c.ast.binarylogicaloperatornode import BinaryLogicalOperatorNode from pytiger2c.types.integertype import IntegerType class AndOperatorNode(BinaryLogicalOperatorNode): """ Clase C{AndOperatorNode} del árbol...
""" duniter public and private keys @author: inso """ import libnacl.public from pylibscrypt import scrypt from .base58 import Base58Encoder from .signing_key import _ensure_bytes SEED_LENGTH = 32 # Length of the key crypto_sign_BYTES = 64 SCRYPT_PARAMS = {'N': 4096, 'r': 16, 'p':...
from django.core.urlresolvers import resolve,Resolver404 from django.conf import settings from comicmodels.models import ComicSite,get_projectname class ProjectMiddleware: """ Everything you do on comicframework is related to a project. This middleware makes this possible without having to duplicate 'pro...
# Copyright 2016 The TensorFlow Authors. 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 applica...
#!/usr/bin/python # encoding: utf-8 """ SGE.py Fragment generation submission module for the Sun Grid Engine. Created by Shane O'Connor 2013 Use this as a basis for your cluster system module. The following functionality should be provided: - A FragmentsJob class for array runs which creates a script object membe...
# Copyright 2014 TellApart, 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 writi...
#--------------------------------------------------------------------------- # Copyright 2013-2019 The Open Source Electronic Health Record Alliance # # 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 Licen...
from django.contrib.gis.db.backends.base.adapter import WKTAdapter from django.contrib.gis.db.backends.base.operations import ( BaseSpatialOperations, ) from django.contrib.gis.db.backends.utils import SpatialOperator from django.contrib.gis.db.models import aggregates from django.contrib.gis.geos.geometry import G...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division ############################################################################ # # Copyright (C) 2008-2015 # Christian Kohlöffel # Vinzenz Schulz # # This file is part of DXF2GCODE. # # DXF2GCODE is free software: ...
# -*- coding: utf-8 -*- """ 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/. date: Mon Jan 19 14:52:04 2015 @author: daniel """ import pygame from block import Block from con...
import os MODULE_ROOT = os.path.dirname(os.path.realpath(__file__)) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:' } } USE_TZ = True, CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.dummy.DummyCache', } } TEMPLATE_DIRS = (...
import random class Person: def __init__(self,name,age,location): self.name = name self.age = age self.locaiton = location def is_sick(self): return random.randint(1,10)%2==0 class AttendenceMixin: def swip_in(self): pass def swip_out(self): pass ...
from unittest.mock import MagicMock import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk from gajim.common import app from gajim.common import configpaths configpaths.init() from gajim import gui gui.init('gtk') from gajim.common.helpers import AdditionalDataDict from gajim.conversation_textvi...
############################################################ # # Copyright (c) 2005, Southpaw Technology # All Rights Reserved # # PROPRIETARY INFORMATION. This software is proprietary to # Southpaw Technology, and is not to be reproduced, transmitted, # or disclosed in any way without writt...
# encoding: utf-8 # module PyKDE4.kio # from /usr/lib/python2.7/dist-packages/PyKDE4/kio.so # by generator 1.135 # no doc # imports import PyKDE4.kdeui as __PyKDE4_kdeui import PyQt4.QtCore as __PyQt4_QtCore import PyQt4.QtGui as __PyQt4_QtGui class KUriFilter(): # skipped bases: <type 'sip.wrapper'> # no doc ...
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> rks = [ "lib.exp.summ.storage", "lib.exp.summ"] reload_mods(rks) from lib.exp.summ import Mary mm = Mary() import warnings warnings.filterwarnings('ignore') # <codecell> #dc = mm.df_classify_perf(key="coverages_9") #saf = mm.df_rec_ans() if False...
"This module provides a simple Python wrapper for the SWIG-generated Mesh class" # Copyright (C) 2012-2014 Anders Logg # # This file is part of DOLFIN. # # DOLFIN 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 Fo...
import numpy as np import cv2 from matplotlib import pyplot as plt img = cv2.imread('digits.png') gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) cv2.imshow('pre-gray', img) cv2.waitKey() cv2.imshow('gray', gray) cv2.waitKey() # Now we split the image to 5000 cells, each 20x20 size cells = [np.hsplit(row,100) for row ...
# -*- coding: utf-8 -*- """ Created on Mon Nov 16 00:27:31 2015 @author: deep """ ##################################### USERNAME = '' PASSWORD = '' ##################################### import json from scraper import scraper import os import time def diff(A,B): if len(A.keys()) > len(B.keys()): A...
############################################################################## # # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core ...
#!/usr/bin/env python # sudo apt install libpq-dev # pip install psycopg2 import argparse import sys import csv import psycopg2 from psycopg2 import OperationalError def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('--db_host', required=True) parser.add_argument('--db_port', required=T...
# Copyright 2013, Big Switch Networks, 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 applic...
from __future__ import unicode_literals import datetime import os import json import re from django.contrib.auth.models import User from django.contrib.contenttypes.fields import GenericRelation from django.contrib.postgres.fields import ArrayField from django.core.exceptions import ValidationError from django.core.ur...
# Copyright (c) 2011 X.commerce, a business unit of eBay 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 req...
import django_filters from dal import autocomplete from django import forms from django.utils.translation import ugettext_lazy as _ from teryt_tree.dal_ext.filters import VoivodeshipFilter, CountyFilter, CommunityFilter from .models import Case from feder.main.mixins import DisabledWhenFilterSetMixin from feder.teryt....
#!/usr/bin/python # # Copyright (C) Citrix Systems Inc. # # This program 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; version 2.1 only. # # This program is distributed in the hope that it will be u...
# encoding=utf-8 # Copyright © 2017 Dylan Baker # 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 dist...
# -*- coding: utf8 -*- ''' Этот модуль заточен под отображение состояния центрального процессора. Ввиду его отдельности -- его можно втыкать куда угодно. ) ''' from Tkinter import Frame from pak_pc.pak_gui.pak_widgets.mod_frm_reg import ClsFrmReg from pak_pc.pak_gui.pak_widgets.mod_frm_reg_pc import ClsFrmRegPC from ...
#!/usr/bin/env python import unittest2 import logging import time from magi.messaging.magimessage import MAGIMessage from magi.messaging.transportMulticast import MulticastTransport from magi.testbed import testbed from magi.messaging.api import Messenger class TransportTest(unittest2.TestCase): """ Testing of b...
# -*- coding: UTF-8 -*- """ $Id$ $URL$ Copyright (c) 2010 foption 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 to use, copy, modif...
#!/usr/bin/env python # -*- coding: iso-8859-1 -*- ############################################################################### # # Yet another invariant/pre-/postcondition design-by-contract support module. # # Written by Dmitry Dvoinikov <dmitry@targeted.org> # Distributed under MIT license. # # The latest version...
# -*- encoding: utf-8 -*- from robottelo.constants import FILTER from robottelo.ui.base import Base, UINoSuchElementError, UIError from robottelo.ui.locators import common_locators, locators, tab_locators from robottelo.ui.navigator import Navigator class Container(Base): """Provides the CRUD functionality for Do...
import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') import django django.setup() from papers.models import Article from papers.models import Tag from papers.models import Affiliation from papers.models import Author from datetime import date ##links for f1000 and biorxiv ##f=open(r'C:\Use...
""" PySAR Polarimetric SAR decomposition Contents -------- decomp_fd(hhhh,vvvv,hvhv,hhvv,numthrd=None) : Freeman-Durden 3-component decomposition """ from __future__ import print_function, division import sys,os import numpy as np ###===============================================================================...
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """A utility class to generate JSON results from given test results and upload them to the specified results server. """ from __future__ import with_st...
import experiment_loader import ALA3 import numpy as np from fitensemble import lvbp from fitensemble.utils import validate_pandas_columns num_threads = 2 num_samples = 20000 # Generate 20,000 MCMC samples thin = 25 # Subsample (i.e. thin) the MCMC traces by 25X to ensure independent samples burn = 5000 # Discard t...
#***************************************************************************** # Copyright 2004-2008 Steve Menard # # 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....
# Copyright 2019 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. """This file is a recipe demonstrating reading triggers of the current build.""" import json from google.protobuf import json_format from PB.go...
#Apache2 Python server from __future__ import print_function from django.shortcuts import render import time from django.http import HttpResponse import smtplib import MySQLdb import sys import os import xmpp def mytest(request): if request.GET: value = request.GET form=value['form'] for...
""" bbss - BBS Student Management Default graphical user interface for bbss. Main window was generated by calling: pyuic5 bbss_tabbed_gui.ui > main.py Created on Mon Feb 23 15:08:56 2014 @author: Christian Wichmann """ import os import sys import logging from PyQt5 import QtGui from PyQt5 import QtCore from...
# #!/usr/bin/env python-sirius # """BSMP class tests.""" # import unittest # from unittest.mock import Mock # # from siriuspy.util import check_public_interface_namespace # # # class _TestBSMP(TestCase): # """Test BSMP class.""" # # api = ( # 'ID_device', # 'variables', # 'functions', # ...
from django.db.models import fields, ForeignKey, ManyToOneRel, OneToOneRel, Q from .obj_types import clss from functools import reduce def build_query_obj(cls, search): """Return Q object to filter dm+d objects based on search. Parameters: cls: class of dm+d object to search search: a tree desc...
#!/usr/bin/python # # Copyright 2002-2019 Barcelona Supercomputing Center (www.bsc.es) # # 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 ...
from typing import Dict import jsonpickle from qtpy.QtCore import QObject, Signal from openburn.core.propellant import OpenBurnPropellant class PropellantDatabase(QObject): database_ready = Signal() propellant_added = Signal(str) propellant_edited = Signal(str) propellant_removed = Signal(str) ...
from base64 import b64decode from io import BytesIO from zeus.config import db from zeus.constants import Status from zeus.db.mixins import RepositoryBoundMixin, StandardAttributes from zeus.db.types import Enum, File, FileData, GUID from zeus.utils import timezone class Artifact(RepositoryBoundMixin, StandardAttrib...
# Copyright 2017 The TensorFlow Agents 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 law or ag...
from django.conf import settings from django.shortcuts import render from django.utils.translation import ugettext_lazy as _ from django.views.generic.base import TemplateView # headers = get_headers(request, ['HTTP_APP_SCHEME', 'HTTP_USER_AGENT', 'HTTP_HOST']) # print(headers) def get_headers(request, keys=[]): ...
# coding: utf-8 # # Copyright 2018 The Oppia Authors. 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 requi...
# 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...
# This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import sys import tempfile import os import shutil from typing import Optional import unittest from unittest.mock import MagicMock class TestFileIO(unittest.TestCase): _tmpdir: Optional[...
import argparse #import glob #import os import shutil from pathlib import Path DEFAULT_HERBARIUM_PREFIX = 'BRIT' DEFAULT_FOLDER_INCREMENT = 1000 DEFAULT_NUMBER_PAD = 7 files_analyzed = 0 files_sorted = 0 verbose = False # set up argument parser ap = argparse.ArgumentParser() ap.add_argument("-d", "--directory", requi...
from theano import tensor from theano.tensor.signal.downsample import DownsampleFactorMax def max_pool_3d(input, ds, ignore_border=False): """ Takes as input a N-D tensor, where N >= 3. It downscales the input by the specified factor, by keeping only the maximum value of non-overlapping patches of si...
from django import forms class TasksForm(forms.Form): url = forms.URLField(label='Source file URL', max_length=200, required=True) reference_id = forms.CharField(label='Reference Id', max_length=100, required=False) overwrite_file = forms.ChoiceFi...
#!/usr/bin/env python """ sage_server.py -- unencrypted forking TCP server. Note: I wrote functionality so this can run as root, create accounts on the fly, and serve sage as those accounts. Doing this is horrendous from a security point of view, and I'm definitely not doing this. None of that functionality is actua...
#################################################################################################### # neuropythy/graphics/__init__.py # Simple tools for making matplotlib/pyplot graphics with neuropythy. # By Noah C. Benson ''' The neuropythy.graphics package contains definitions of the various tools for making plots...
## ## This file is part of the libsigrokdecode project. ## ## Copyright (C) 2012-2013 Uwe Hermann <uwe@hermann-uwe.de> ## ## 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 2 of t...
''' module for cookie ''' import time GMT_FORMAT = '%a, %d %b %Y %H:%M:%S GMT' class Cookie(object): ''' cookie object ''' def __init__(self, request): self.__request = request # data read from request self.__requestdata = dict() # data to flush to response self.__re...
from __future__ import print_function from time import sleep from datetime import datetime UNITS = ('Minutes', 'Hours', 'Days', 'Months') PHOTO = ('false', 'true') class DefaultVideoPage: _base_url = '/compulink/player/recording_video?resource_id={res_id}&units={units}&count_units={count_units}&photo={photo}' ...
#!/usr/bin/env python ################################################################################ # # This file is part of Gato (Graph Algorithm Toolbox) # # file: ObjectHMM.py # author: Janne Grunau # # Copyright (C) 1998-2002, Alexander Schliep # # Contact:...