src
stringlengths
721
1.04M
#! /usr/bin/env python3 import pyowm import datetime owm = pyowm.OWM('2642ecf7132b8918b8f073910006483c', language='ru') now = pyowm.timeutils.now().date() tomorrow = pyowm.timeutils.tomorrow().date() def to_human_time(unix): return datetime.datetime.fromtimestamp(unix) def weather_date(weather): return t...
import os import json import datetime import logging import math import isodate import urllib from collections import defaultdict from operator import itemgetter from django import http from django.contrib.auth.models import Permission from django.shortcuts import render, redirect from django.conf import settings from...
# encoding: 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 index on 'HardwareDevice', fields ['device_type', 'id'] db.create_index('dashboard_app_hardwaredevice', ...
# -*- coding: utf-8 -*- ## ## ## This file is part of Indico. ## Copyright (C) 2002 - 2014 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; eith...
# -*- coding: utf-8 -*- import pdb import sys import traceback from collections import deque from enum import IntEnum from typing import Deque, Dict, List, NamedTuple, Optional, Tuple, Union class ParameterMode(IntEnum): POSITIONAL = 0 IMMEDIATE = 1 RELATIVE = 2 class ParameterType(IntEnum): READ =...
""" sentry.templatetags.sentry_helpers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :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 import functools import os.path from collections import namedtuple from datetime...
#!/usr/bin/python # # Copyright (C) 2010, 2011, 2012, 2013 Google 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 2 of the License, or # (at your option) any later version...
#!/usr/bin/env python """ Uses the python unittest module to test this app with `python -m unittest pug.nlp`. """ # from django.test import TestCase from unittest import TestCase, main import doctest from pug.nlp import util, http, penn_treebank_tokenizer, detector_morse class NLPDocTest(TestCase): def test_mod...
# linux-utils: Linux system administration tools for Python. # # Author: Peter Odding <peter@peterodding.com> # Last Change: February 9, 2020 # URL: https://linux-utils.readthedocs.io """Generic parsing of Linux configuration files like ``/etc/fstab`` and ``/etc/crypttab``.""" # Standard library modules. import re #...
# -*- coding: utf-8 -*- # OpenFisca -- A versatile microsimulation software # By: OpenFisca Team <contact@openfisca.fr> # # Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team # https://github.com/openfisca # # This file is part of OpenFisca. # # OpenFisca is free software; you can redistribute it and/or modify...
import logging import pickle import random from google.appengine.ext import db from google.appengine.ext import deferred from google.appengine.api import memcache from google.appengine.datastore import entity_pb from google.appengine.ext.webapp import RequestHandler from .models import _GAEBingoExperiment, _GAEBingoA...
from enigma import eEPGCache from Components.Converter.Converter import Converter from Components.Element import cached from Components.Converter.genre import getGenreStringSub class EventName(Converter, object): NAME = 0 SHORT_DESCRIPTION = 1 EXTENDED_DESCRIPTION = 2 FULL_DESCRIPTION = 3 ID = 4 NAME_NOW = 5 ...
# -*- coding: utf-8 -*- # Copyright (c) 2009 Technische Universitaet Muenchen, Informatik Lehrstuhl IX. # Author: Federico Ruiz-Ugalde <ruizf at in.tum.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 ...
import os import shutil import subprocess import infra class Builder(object): def __init__(self, config, builddir, logtofile): self.config = '\n'.join([line.lstrip() for line in config.splitlines()]) + '\n' self.builddir = builddir self.logfile = infra.ope...
# # Copyright SAS Institute # # 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...
import warnings from sympy import Basic, Symbol, Integer from sympy.core import sympify from sympy.core.basic import S from sympy.polys import Poly, roots, cancel from sympy.simplify import simplify from sympy.utilities import any # from sympy.printing import StrPrinter /cyclic/ import random class NonSquareMatrixE...
import numpy as np import matplotlib.pyplot as plt from matplotlib import rc rc('font',**{'family':'serif','serif':['Palatino'],'size':14}) rc('text', usetex=True) def read_results(): ms, ns, times_eigen, times_fastor = [], [], [], [] with open("benchmark_results.txt", "r") as f: lines = f.readlines()...
""" Implementation of the 'special-phrases' command. """ import logging from pathlib import Path from nominatim.errors import UsageError from nominatim.db.connection import connect from nominatim.tools.special_phrases.sp_importer import SPImporter from nominatim.tools.special_phrases.sp_wiki_loader import SPWikiLoa...
# Copyright 2021 The HuggingFace Team. 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 applicabl...
""" Implementation of bigram part-of speech (POS) tagger based on first-order hidden Markov models from scratch. """ from __future__ import division from __future__ import unicode_literals import numpy as np import pandas as pd import codecs POS_UNIVERSAL = ('VERB', 'NOUN', 'PRON', 'ADJ', 'ADV', 'ADP', ...
# (C) British Crown Copyright 2010 - 2016, Met Office # # This file is part of Iris. # # Iris 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 l...
# -*- coding: utf-8 -*- # Copyright (c) 2012-2015 CoNWeT Lab., Universidad Politécnica de Madrid # This file is part of Wirecloud. # Wirecloud 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 v...
# This file is part of the musicbrainzngs library # Copyright (C) Alastair Porter, Wieland Hoffmann, and others # This file is distributed under a BSD-2-Clause type license. # See the COPYING file for more information. __all__ = [ 'set_caa_hostname', 'get_image_list', 'get_release_group_image_list', 'get_relea...
from django import forms from util import constants import haystack.forms class ListFormField(forms.MultipleChoiceField): """ A form field for a list of values that are unchecked. The Django MultipleChoiceField does *almost* what we want, except it validates that each choice is in a suppl...
""" WMO WIS monitoring tool for OpenWIS. All datetime values must conform to ISO 8601. date - YYYY-MM-DD datetime - YYYY-MM-DDThh:mm:ssZ """ import os import sys import time from datetime import datetime from ConfigParser import ConfigParser, NoSectionError, NoOptionError import urllib2 import json import log...
# 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 # Copyright 2017 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, division, print_function, unicode_literals import logging from collections import defaultdict from pants.base.specs import Descenda...
# Generated by Django 2.0.8 on 2018-11-29 10:12 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('occurrence', '0005_auto_20181025_1720'), ] operations = [ migrations.AlterField( model_name='areaencounter', name='s...
# -*- coding: utf-8 -*- """ crypto.cipher.rijndael Rijndael encryption algorithm This byte oriented implementation is intended to closely match FIPS specification for readability. It is not implemented for performance. Copyright © (c) 2002 by Paul A. Lambert Read LICENSE.txt for license info...
# -*- coding: utf-8 -*- #*************************************************************************** #* * #* Copyright (c) 2015 Pierre Vacher <prrvchr@gmail.com> * #* ...
from __future__ import unicode_literals from django.contrib.auth.models import ( AbstractBaseUser, BaseUserManager, PermissionsMixin) from django.db import models from django.forms.models import model_to_dict from django.utils import timezone from django.utils.encoding import python_2_unicode_compatible from djang...
#!/usr/bin/python # A handy python script to use SSH host keys and known_host files to # encrypt/decrypt or sign/verify files. The basic idea is to have a HTTP # server without SSL, but you still can use it (internally) as package-distribution # or update server if you just ever connected to it via SSH and ensured # t...
# -*- coding: utf-8 -*- from setuptools import setup setup( name="autoupgrade-ng", version="0.3.0", author="Walter Purcaro", author_email="vuolter@gmail.com", description="Automatic upgrade of PyPI packages", long_description=open('README.rst').read(), keywords=['autoupgrade', 'pip-upgrade...
from PyQt5.QtCore import QObject, pyqtSlot from PyQt5.QtCore import QSignalMapper from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QAction from core.plugins.PluginLoader import PluginLoader class PluginMenu(QObject): currRoot = None def constructMenu(self, root): self.currRoot = roo...
# Copyright 2017 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...
# -*- coding: utf-8 -*- # # Copyright (C) 2008-2012 Ricky Zhou, Red Hat, Inc. # This file is part of python-fedora # # python-fedora 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 2.1...
""" Copyright (c) 2015 Andreea Georgescu Created on Wed Mar 4 00:47:37 2015 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 the License, or (at your option) any later version. ...
#! /usr/bin/env python from numpy import * import sys #p1 = [30.625621, -96.336753] #p2 = [30.624388, -96.335755] #p3 = [30.626050, -96.333368] #p4 = [30.627195, -96.334945] xres = 300 yres = 500 lat = [] lon = [] for line in sys.stdin: line.strip() (latS, lonS, dummy) = line.split(',') lat.appe...
# -*- coding: utf-8 -*- import numpy as np from pyorderedfuzzy.ofnumbers.ofnumber import OFNumber, fmax __author__ = "amarszalek" def sample_mu(ofseries, ord_method='expected'): n = len(ofseries) suma = ofseries[0] if ofseries[0].order(method=ord_method) >= 0 else OFNumber(ofseries[0].branch_g, ...
from setuptools import setup with open("requirements.txt") as f: install_requires = f.read().splitlines() with open("test-requirements.txt") as f: tests_require = f.read().splitlines() tests_require.pop(0) # remove '-r requirements.txt' line setup( name="mcstatus", version="6.4.0", author="N...
# -*- coding: utf-8 -*- # # Arb documentation build configuration file, created by # sphinx-quickstart on Thu Oct 11 09:33:44 2012. # # 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. # # All con...
# Copyright 2017 Cargill Incorporated # # 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 ...
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # Copyright 2014-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # # qutebrowser 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 S...
# -*- coding: utf-8 -*- from flask import Blueprint, jsonify, request blueprint = Blueprint('index', __name__, url_prefix='/api/v1/') @blueprint.route("ping") def health_check(): return jsonify({'ping': 'pong'}) @blueprint.route("solve", methods=['POST']) def solve(): solve_request = request.get_json() ...
from pylab import * import astronomy as ast # to format the labels better from matplotlib.ticker import FormatStrFormatter fmt = FormatStrFormatter('%1.2g') # or whatever X1 = load('ec2117ans_1_c.dat') x1 = X1[:,0] y1 = 10**(X1[:,2]/(-2.5)) y1 /= average(y1) T0 = 2453964.3307097 P = 0.1545255 figure(figsize=(6,4)...
from msl.qt import utils, QtCore, QtWidgets, Qt, QtGui def test_screen_geometry(): # just check that these don't raise an exception assert isinstance(utils.screen_geometry(), QtCore.QRect) assert isinstance(utils.screen_geometry(QtWidgets.QLabel()), QtCore.QRect) assert isinstance(utils.screen_geometr...
# -*- coding: utf-8 -*- """Functions returning an IMAP account state Usage: imap-cli-list [options] [<directory>] Options: -c, --config-file=<FILE> Configuration file (`~/.config/imap-cli` by default) -f, --format=<FMT> Output format -l, --limit=<limit> ...
""" Scraper for querying NeuroMorpho.Org from Python. For more on NeuroMorpho.Org, see: Ascoli GA, Donohue DE, Halavi M. (2007) NeuroMorpho.Org: a central resource for neuronal morphologies.J Neurosci., 27(35):9247-51 Run this file as a stand-alone script for a demo. The demo queries NeuroMorpho.Org in gener...
import asyncio, discord from discord.ext.commands import guild_only from .. import db, log from ..core import command class VoiceText(metaclass=command.Cog): async def on_voice_state_update(self, member, before, after): if before.channel is after.channel: return # Only care about changing channels with self.bot.s...
#Copyright ReportLab Europe Ltd. 2000-2012 #see license.txt for license details __version__ = '$Id: ch1_intro.py 3960 2012-09-27 15:22:33Z guillaume $' from tools.docco.rl_doc_utils import * from reportlab.platypus.tableofcontents import TableOfContents from datetime import datetime import reportlab title("ReportLab P...
#!/usr/bin/env python import os DEBUG = False TIME_ZONE = "Europe/Stockholm" DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3"}} SECRET_KEY = "not needed" USE_TZ = True LANGUAGE_CODE = "en" INSTALLED_APPS = [ "django.contrib.contenttypes", "django.contrib.auth", "django.contrib.sites"...
from django.urls import path from . import views urlpatterns = [ path('logout', views.student_logout, name="Logout"), path(r's/login', views.student_login_page, name="StudentLogin"), path('s/check_login', views.student_check_login, name="StudentCheckLogin"), path(r's/club/news/<int:page>', views.stude...
# pylint:disable-msg=E0611,I1101 """ Filters for date parsing and date validators. """ ## This file is available from https://github.com/adbar/htmldate ## under GNU GPL v3 license # standard import datetime import logging import time from collections import Counter from functools import lru_cache from .settings imp...
# -*- coding: utf-8 -*- # 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 "Lic...
from sqlalchemy.orm import Session from app import db, current_user, ENTITY_MAPPING, ACTIVITY_TYPE from app.models.files import Files from app.routes import tags_mapping from app.models.comments import Comments from app.models.metadata import MetadataMapping, Metadata from app.models.cfg_category_range_mapping import ...
import asyncio import logging logger = logging.getLogger(__name__) class IrcProtocol(asyncio.Protocol): def __init__(self, factory): self.factory = factory self.encoding = factory.encoding self.transport = None self.closed = True def connection_made(self, transport): ...
import os import subprocess from glob import glob from pathlib import Path def readFile(filepath): try: with open(filepath) as f: lines = f.readlines() except: return [] return lines def readFiles(filepaths): names = map(lambda p: Path(p).stem, filepaths) ...
import json import networkx as nx from networkx.readwrite import json_graph import httplib2 baseUrl = 'http://192.168.231.246:8080/controller/nb/v2' containerName = 'default' h = httplib2.Http(".cache") h.add_credentials('admin', 'admin') def find_edge(edges, headNode, tailNode): for edge in odlEdges: if edge[...
""" Copyright 2011-13 Attila Zseder Email: zseder@gmail.com This file is part of hunmisc project url: https://github.com/zseder/hunmisc hunmisc 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 versi...
import math # Enter your code here. Read input from STDIN. Print output to STDOUT def distance_between(point1, point2): EARTH_RADIUS = 6371 point1_lat_in_radians = math.radians( point1['latitude'] ) point2_lat_in_radians = math.radians( point2['latitude'] ) point1_long_in_radians = math.radians( poin...
#!/usr/bin/env python # -*- coding:utf-8 -*- ## # Python function for reading linux utmp/wtmp file # http://www.likexian.com/ # # Copyright 2014, Kexian Li # Released under the Apache License, Version 2.0 # ## import struct XTMP_STRUCT = 'hi32s4s32s256shhiii4i20x' XTMP_STRUCT_SIZE = struct.calcsize(XTMP_STRUCT) de...
#!/usr/bin/python # ============================================================================== # author :Ghislain Vieilledent # email :ghislain.vieilledent@cirad.fr, ghislainv@gmail.com # web :https://ghislainv.github.io # python_version :2.7 # license :GPLv3 # =============...
import logging as log import sqlite3 class Database(): "Class to manage interactions with database" def __init__(self): self.connection = sqlite3.connect('book.db') self.connection.row_factory = sqlite3.Row try: self.sanity_checks() except Exception: sel...
import unittest from taric_challange.core.books_manager import BooksManager from taric_challange.core.models.book import Book from mock import Mock import mock data = {"author_data" : [ { "name": "Richards, Rowland", "id": "richards_rowland" }], "awards_text": "", ...
"""Methods for reading and writing spk files""" import sys try: from Cryptodome.Cipher import AES from Cryptodome.PublicKey import RSA from Cryptodome.Util.number import bytes_to_long, long_to_bytes except ImportError: from Crypto.Cipher import AES from Crypto.PublicKey import RSA from Crypto.Util.number import...
#!/usr/bin/env python2.6 # Zeckviz IRC bot # Copyright (C) 2011 Bruno Rahle # # 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 la...
#! /usr/bin/env python3 import sys import pygame import random PADDLE_WIDTH = 10 PADDLE_HEIGHT = 60 WIDTH = 800 HEIGHT = 600 FPS = 60 FONT_SIZE = 40 # define some colors RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) WHITE = (255, 255, 255) BLACK = (0, 0, 0) class Paddle(pygame.sprite.Sprite): def _...
# stdlib from datetime import datetime from datetime import timedelta from json import dumps from json import loads from json.decoder import JSONDecodeError import logging from secrets import token_hex # grid relative from ..codes import RESPONSE_MSG from ..database import Group from ..database import Role from ..data...
# Copyright 2012 Cloudbase Solutions Srl # 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 r...
# 1. read from kafka, kafka broker, kafka topic # 2. write back to kafka, kafka broker, new kafka topic import sys import atexit import logging import json import time from kafka import KafkaProducer from kafka.errors import KafkaError, KafkaTimeoutError from pyspark import SparkContext # how to talk to spark from py...
#!/usr/bin/env python3 """rocFFT kernel generator. Currently this acts as a shim between CMake and the C++ kernel generator. It accept two sub-commands: 1. list - lists files that will be generated 2. generate - pass arguments down to the old generator Note that 'small' kernels don't decompose their lengths. """ i...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com> # Copyright (C) 2009 Damien Churchill <damoxc@gmail.com> # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of t...
from django.shortcuts import render from django.http import HttpResponse from django.db.models import Q from django.utils import timezone from datetime import * from pyzcash.rpc.ZDaemon import * from faucet.models import * def index(request): #Going to show the page no matter what, so pull these variables out. h...
from collections import Counter from numpy import nan from rtm import SMARTS import rtms import pdb CONFIG_FILE = open('config.yaml') DATA_FILE = open('time-series.csv') print "Importing configuration...", site_info, csv_map, run_config = rtms.importer.config(CONFIG_FILE) print "done." print "Importing data...", ti...
from django.shortcuts import render from django.contrib.auth.models import User, Group from django.contrib.auth import login from django.contrib.auth import logout from django.contrib.auth import authenticate from django.http import HttpResponseRedirect from rest_framework import viewsets from rest_framework.authentic...
# coding=utf-8 import argparse import traceback from py4j.java_gateway import java_import, JavaGateway, GatewayClient from mistpy.decorators import __complex_type from mistpy.executable_entry import load_entry def to_scala_arg_type(type_hint, gateway): if type_hint is None: return gateway.jvm.PythonUti...
# Copyright 2017 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...
import logging from django import shortcuts from django.contrib import messages from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ from horizon import api from horizon import tables LOG = logging.getLogger(__name__) class CreateUserLink(tables.LinkAction): name = "...
# Copyright (C) 2014, 2015 University of Vienna # All rights reserved. # BSD license. # Author: Ali Baharev <ali.baharev@gmail.com> from __future__ import print_function import networkx as nx from networkx.algorithms.bipartite import is_bipartite_node_set, projected_graph from plot import dummy as plot __all__ = [ 'Du...
#!/usr/bin/env python """ Design FIR filter coefficients using Parks-McClellan or windowing algorithm and plot filter transfer function. Michael Hirsch, Ph.D. example for PiRadar CW prototype, writing filter coefficients for use by filters.f90: ./FilterDesign.py 9950 10050 100e3 -L 4096 -m firwin -o cwfir.asc Refs: h...
from __future__ import absolute_import, division, print_function import requests from lxml import etree from symantecssl.request_models import RequestEnvelope as ReqEnv class FailedRequest(Exception): def __init__(self, response): super(FailedRequest, self).__init__() self.response = response ...
#!/usr/bin/python # coding=UTF8 import argparse import os import sys import utils import flickruploader def main(): def scan(fup): print "Scanning folder", options.folder, "..." pc, npc, pcs, npcs = fup.scan_directory(options.folder) print pc, "total pictures found. (" + utils.sizeof_fmt...
# Copyright (C) 2005-2010 Canonical Ltd # # 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 the License, or # (at your option) any later version. # # This program is distribute...
import os import sys import timeit import pylab from PIL import Image import numpy import theano import theano.tensor as T from theano.tensor.signal import downsample from theano.tensor.nnet import conv from logistic_sgd import LogisticRegression, load_data from cnn_tools import HiddenLayer, _dropout_from_layer, Dro...
# Copyright (c) 2013 OpenStack Foundation. # # 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...
import numpy as np from bayesnet.tensor.tensor import Tensor from bayesnet.function import Function from bayesnet.image.util import img2patch, patch2img class MaxPooling2d(Function): def __init__(self, pool_size, stride, pad): """ construct 2 dimensional max-pooling function Parameters ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('conversation', '0008_conversation_notified'), ] operations = [ migrations.AlterField( ...
# -*- coding: utf-8 -*- # Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com) # # Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com> # # 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...
from collections import Counter from datetime import datetime from django.contrib.auth.models import User from django.core.management.base import BaseCommand, CommandError from django.template.loader import render_to_string from django.utils import timezone from bulk_update.helper import bulk_update from pontoon.adm...
# Lint as: python3 """Functions for manipulating nested structures of arrays.""" from typing import Any, Union import jax import jax.numpy as jnp def slice_along_axis( inputs: Any, axis: int, idx: Union[slice, int] ): """Returns slice of `inputs` defined by `idx` along axis `axis`. Args: inputs:...
''' A base event class. Subclasses should implement abstract methods "trigger" and "action". ''' class Event(object): def __init__(self,trigger=None,action=None): self.trigger = trigger self.action = action self.initiated = False self.completed = False # currently s...
# vim:fileencoding=utf-8:noet from __future__ import unicode_literals, absolute_import __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' __docformat__ = 'restructuredtext en' import sys import os import errno class INotifyError(Exception): pass _inotify = None def load_inotify(): ''' Initialize th...
"""The main CLI for regolith""" from __future__ import print_function import os import json from argparse import ArgumentParser from regolith.runcontrol import RunControl, NotSpecified from regolith.validators import DEFAULT_VALIDATORS from regolith.database import connect from regolith import commands DEFAULT_RC = R...
#!/usr/bin/env python # # CLUES - Cluster Energy Saving System # Copyright (C) 2015 - GRyCAP - Universitat Politecnica de Valencia # # 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 versi...
# -*- coding: utf-8 -*- # __init__.py # Copyright (C) 2013 LEAP # # 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. # # Th...
#!/usr/bin/env python from __future__ import absolute_import, division, print_function from setuptools import setup from os.path import abspath, dirname, join PROJECT_ROOT = abspath(dirname(__file__)) with open(join(PROJECT_ROOT, 'README.rst')) as f: readme = f.read() with open(join(PROJECT_ROOT, 'travis_solo.p...
from fabric import task from django.utils.termcolors import colorize # 1. Local: ssh-add ~/.ssh/aws.pem # 2. Local: Edit hosts, repo_name, pythonpath (if necessary) # 3. Remote: Copy .env to to {code_dir}/.env: hosts = [{ 'host': 'ec2-3-89-247-193.compute-1.amazonaws.com', 'user': 'ubuntu', }] repo_name = ...
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers import pybindgen.settings import warnings class ErrorHandler(pybindgen.settings.ErrorHandler): def handle_error(self, wrapper, exception, traceback_): warnings.warn("exception %r in wrapper %s" % (exception, wrapper)) ...
""" 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 use this ...
# Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 Anler Hernández <hello@anler.me> # This program is free software: you can redistribute it and/or modify # it under ...