src
stringlengths
721
1.04M
import tensorflow as tf def training_mse_loss(output, labels): with tf.variable_scope('loss') as scope: loss = tf.reduce_mean(tf.square(tf.sub(output, labels)), name='mse_loss') return loss def training_sigmoid_cross_entropy(output, labels): with tf.variable_scope('loss') as scope: loss ...
# -*- coding: utf-8 -*- # Copyright (c) 2020, Frappe Technologies and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document class LogSettings(Document): def clear_logs(self): self.clear_er...
from enum import Enum import jouvence.document class ElementType(Enum): ACTION = jouvence.document.TYPE_ACTION CENTERED_ACTION = jouvence.document.TYPE_CENTEREDACTION CHARACTER = jouvence.document.TYPE_CHARACTER DIALOG = jouvence.document.TYPE_DIALOG PARENTHETICAL = jouvence.document.TYPE_PARENT...
# -*- coding: utf-8 -*- import sys import json import six from funcy import select_keys, cached_property, once, once_per, monkey, wraps from funcy.py2 import mapcat, map from .cross import pickle, md5 import django from django.utils.encoding import smart_str from django.core.exceptions import ImproperlyConfigured from...
from __future__ import print_function, division from sympy.logic.boolalg import And from sympy.core.add import Add from sympy.core.basic import Basic from sympy.core.compatibility import as_int, with_metaclass, range, PY3 from sympy.core.expr import Expr from sympy.core.function import Lambda, _coeff_isneg from sympy....
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe.utils import cstr, cint from frappe import throw, _ from frappe.model.document import Document class RootNotEditable(frappe.V...
spec = { 'name' : "The devil's work...", 'external network name' : "exnet3", 'keypair' : "openstack_rsa", 'controller' : "r720", 'dns' : "10.30.65.200", 'credentials' : { 'user' : "nic", 'password' : "nic", 'project' : "nic" }, 'Networks' : [ { 'name' : "merlynctl" , "start": "172.1...
import os import re from MenuList import MenuList from Components.Harddisk import harddiskmanager from Tools.Directories import SCOPE_ACTIVE_SKIN, resolveFilename, fileExists, pathExists from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, \ eServiceReference, eServiceCenter, gFont, getDesktop from Tools.Loa...
import re import datetime as dt import pytz from pupa.scrape import Scraper, Event from openstates.utils import LXMLMixin url = "http://assembly.state.ny.us/leg/?sh=hear" class NYEventScraper(Scraper, LXMLMixin): _tz = pytz.timezone('US/Eastern') def lower_parse_page(self, url): page = self.lxmliz...
from GaudiConf import IOHelper from Configurables import DaVinci, DecayTreeTuple from DecayTreeTuple.Configuration import * # Stream and stripping line we want to use stream = 'Dimuon' line = 'FullDSTDiMuonPsi2MuMuDetachedLine' rootInTES = '/Event/{0}'.format(stream) tesLoc = '/Event/{0}/Phys/{1}/Particles'.format(str...
# -*- coding: utf-8 -*- from geode_geocoding.base import Base from geode_geocoding import IGeocode from geode_geocoding import IGeocodeReverse from geode_geocoding.keys import google_key, google_client, google_client_secret class Google(Base, IGeocode, IGeocodeReverse): def coder(self, location, **kwargs): ...
# Copyright 2017-2018 Simon Guest # # This file is part of filebutler. # # Filebutler 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. #...
import pandas as pd import numpy as np from operator import itemgetter from itertools import groupby from keras.preprocessing import sequence from keras.models import Sequential from keras.models import model_from_json from keras import backend as K from keras.optimizers import RMSprop import keras.callbacks from kera...
""" Contains the core building blocks of the framework. """ import math from copy import deepcopy import pandas as pd import numpy as np import cython as cy class Node(object): """ The Node is the main building block in bt's tree structure design. Both StrategyBase and SecurityBase inherit Node. It cont...
#!/usr/bin/env python """ # extracts functions code from xtm source code, returns a structure consisting of a list of metadata dictionaries (one per function) USAGE python parse.py > data.json """ import os, sys from pygments import highlight from pygments.lexers import get_lexer_by_name from pygments.formatte...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'Filing.total_exp_indirect_comm' db.alter_column('lobbyingph_filing', 'total_exp_indirect_...
# # Copyright 2016 Import.io # # 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, ...
""" You can clone this file and its companion two_pop_m_run.py to easily get started on a new two pop markov model. It also is a handy tool to have around for testing new features added to the base system. The agents don't move. They have 50% chance of changing color from red to blue, or from blue to red. """ import i...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Check for cheating. Output file in format: distance file1 file2 usage: pygrade cheat --test <file> [--students <file>] [--output <file>] [--workdir <file>] Options -h, --help -o, --output <file> Output file [default: cheats.tsv] -s, --stud...
#!/usr/bin/env python # # Copyright (C) 2017 - Massachusetts Institute of Technology (MIT) # # 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...
""" Utility to create a simple webserver that will answer oauth .well-known required requests. This is so we can test the HTTP requesting part of issuers. """ import threading import json try: from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer except ImportError: from http.server import BaseHTTPReq...
# -*- coding: utf-8 -*- # Copyright (C) 2014, David Poulter # # 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 p...
# Copyright (c) 2004 Ian Bicking. 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 # notice, this list of conditions and the fo...
# Copyright (c) 2014 Marco Schindler # # 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. import subprocess import logging...
# Copyright 2015 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. from __future__ import absolute_import import symbol from py_utils.refactor.annotated_symbol import base_symbol __all__ = [ 'Class', ] class Class(b...
#!/usr/bin/env python # -*- encoding: utf-8 -*- # vim: ai ts=4 sts=4 et sw=4 nu import os import sys import platform import json import logging IS_FROZEN = hasattr(sys, 'frozen') WORKING_DIR = os.path.dirname(os.path.abspath(sys.executable if IS_FROZEN else ...
""" Test cases for VCF output in tskit. """ from __future__ import print_function from __future__ import division import collections import math import os import tempfile import unittest import msprime import vcf import tskit # Pysam is not available on windows, so we don't make it mandatory here. _pysam_imported = ...
# -*- coding: utf-8 -*- """Conservation filters.""" from django.contrib.gis.db import models as geo_models from django.contrib.gis.db.models import Extent, Union, Collect # noqa from django.db.models import Q import django_filters from conservation import models as cons_models from conservation import widgets as con...
import unittest import arrow from unittest.mock import patch, MagicMock from github_api import prs, API def create_mock_pr(number, title, pushed_at, created_at): return { "number": number, "title": title, "statuses_url": "statuses_url/{}".format(number), "head": { "rep...
# coding: utf-8 # Copyright (c) 2015-2016 Free Security Team # # 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, mo...
# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2001-2007 Donald N. Allingham, Martin Hawlisch # Copyright (C) 2009 Douglas S. Blank # Copyright (C) 2012 Benny Malengier # Copyright (C) 2013 Vassilii Khachaturov # # This program is free software; you can redistribute it and/or modify # it under the...
from matplotlib.colors import LinearSegmentedColormap from numpy import nan, inf cm_data = [[0.0000208612, 0.0000200049, 0.0000198463], [0.000378464, 0.000334228, 0.000406941], [0.00109526, 0.000946811, 0.00122278], [0.00213279, 0.00181849, 0.00245175], [0.00347066, 0.002929, 0.00409539], [0.0050945, 0.00426533, 0.0061...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010-2011 OpenStack LLC. # 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...
# 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...
import components def ContentCacheTest (): """Learning firewall test""" ctx = components.Context (['a', 'b', 'c', 'd', 'cc'],\ ['ip_a', 'ip_b', 'ip_c', 'ip_d', 'ip_cc']) net = components.Network (ctx) a = components.EndHost(ctx.a, net, ctx) b = components.EndHost(ctx.b...
#coding=utf-8 '''/* * Copyright 2015 lixiaobo * * VersionUpgrade project licenses this file to you 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 ...
import io try: from urlparse import urlparse except ImportError: from urllib.parse import urlparse try: from StringIO import StringIO except ImportError: from io import StringIO from vladiate.exceptions import MissingExtraException class VladInput(object): """ A generic input class """ def ...
# ----------------------------------------------------------------------------- # Copyright (C) Daniel Standage, 2015. It is licensed under the ISC license, # see LICENSE.txt. Contact: daniel.standage@gmail.com # ----------------------------------------------------------------------------- """ Generators for parsing s...
# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-07-05 14:50 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('seqr', '0058_matchmakercontactnotes'), ] operations = [ migrations.AlterFi...
"""Microsoft Visual C++ Compiler""" from compilertools.compilers import CompilerBase as _CompilerBase __all__ = ["Compiler"] class Compiler(_CompilerBase): """Microsoft Visual C++""" @_CompilerBase._memoized_property def option(self): """Compatibles Options Returns ------- ...
""" Class that contains client access to the transformation DB handler. """ __RCSID__ = "$Id$" import types from DIRAC import S_OK, S_ERROR, gLogger from DIRAC.Core.Base.Client import Client from DIRAC.Core.Utilities.List ...
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. import abc import json import six from babel.numbers import forma...
# Copyright 2015 Cloudbase Solutions Srl # # 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 ...
# # 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 us...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import time import mock # type: ignore import pytest # type: ignore import nixnet from nixnet import _frames from nixnet import constants from nixnet import errors from nixnet import types def raise_code...
# Simply uses the assessors estimate to predict price, so we can see how much better the machine learning models are. # requires data from Assemble_Data.py # Copyright (C) 2017 Kevin Maher # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public Lice...
"""Test moving window functions.""" import numpy as np import pytest from numpy.testing import assert_array_almost_equal, assert_equal, assert_raises import bottleneck as bn from .util import array_order, arrays @pytest.mark.parametrize("func", bn.get_functions("move"), ids=lambda x: x.__name__) def test_move(func)...
import csv, json, os, requests, sys from wtforms import Form, FieldList, FloatField, FormField, TextField, IntegerField, SelectField, validators, RadioField from jinja2 import Environment, FileSystemLoader import copy from base.models import Experiment from flask import render_template from base.settings import Confi...
def set_config(): import ConfigParser config = ConfigParser.ConfigParser() config.read('development.ini') global REST_URL global OUTPATH global DEFAULT_OPENOFFICE_PORT global PIDFILE_PATH global LOGFILE_PATH global SUPPORTED_FILES #---------------------# # Configuration...
from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase.ToontownBattleGlobals import * import InventoryBase from toontown.toonbase import TTLocalizer from toontown.quest import BlinkingArrows from direct.interval.IntervalGlobal import * from direct.directnotify import DirectNotifyGlo...
""" WSGI config for bearded_adventure project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPL...
import asyncio import threading from typing import (Optional, Iterable, AsyncGenerator, TypeVar, Type, NamedTuple, Callable) import pykube import structlog from aiochannel import Channel from k8s_snapshots.context import Context _logger = structlog.get_logger(__name__) Resource = TypeVar( 'R...
# Copyright 2008,2009 Marcus Huewe <suse-tux@gmx.de> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 2 # as published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, # but WITHOUT...
import os import sys from setuptools import setup, find_packages if sys.version_info[:2] < (2, 6): raise RuntimeError('Requires Python 2.6 or better') here = os.path.abspath(os.path.dirname(__file__)) try: README = open(os.path.join(here, 'README.rst')).read() CHANGES = open(os.path.join(here, 'CHANGES.r...
"""Export CSV.""" import time import codecs import subprocess from ..localization import _ from .. import util from ... import rumcore if util.platform() == "windows": from os import startfile RESULT_ROW = '%(file)s,%(matches)s,%(extensions)s,%(size)s,%(path)s,%(encoding)s,%(modified)s,%(created)s\n' RESULT_CONTE...
from Tkinter import * from idlelib import SearchEngine from idlelib.SearchDialogBase import SearchDialogBase import re def replace(text): root = text._root() engine = SearchEngine.get(root) if not hasattr(engine, "_replacedialog"): engine._replacedialog = ReplaceDialog(root, engine) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import tkinter import tkinter.messagebox from Bl import Play from Lib import Tools class GUI : def __init__ (self, master) : self.master = master self.Tools = Tools.Tools() self.listRst = '' self.resRst = '' self.getDetail = '' def showList (self, searchKey)...
#!/usr/bin/env python3 # Copyright (c) 2015 The Bitcoin Core developers # Copyright (c) 2015-2016 The Bitcoin Unlimited developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test PrioritiseTransaction code # from test_fr...
# -*- coding: utf-8 -*- import logging import random import re logger = logging.getLogger(__name__) reflections = { "am": "are", "was": "were", "i": "you", "i'd": "you would", "i've": "you have", "i'll": "you will", "my": "your", "are": "am", "you've": "I have", "you'll": "I w...
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt # Search from __future__ import unicode_literals import frappe, json from frappe.utils import cstr, unique, cint from frappe.permissions import has_permission from frappe import _ from six import string_types import re ...
# -*- coding: utf-8 -*- """ Catch-up TV & More Copyright (C) 2018 SylvainCecchetto This file is part of Catch-up TV & More. Catch-up TV & More 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 Foundat...
import sys, os from PyQt5.QtWidgets import QApplication, QWidget,QFileDialog, QPushButton, QLabel, QPlainTextEdit from PyQt5.QtGui import QPixmap import cv2 # # -- import src packages -- # from src.VideoController import VideoController from src.CharacterController import CharacterController from src.EmblemController ...
from SDWLE.agents.trade.util import Util from functools import reduce class PossiblePlay: def __init__(self, cards, available_mana): if len(cards) == 0: raise Exception("PossiblePlay cards is empty") self.cards = cards self.available_mana = available_mana def card_mana(se...
################################################################################ ## ## ## This file is a part of TADEK. ## ## ...
from pyws.errors import BadFunction, FunctionNotFound,\ FunctionAlreadyRegistered from pyws.functions import Function class FunctionManager(object): def get_one(self, context, name): """ Returns a function by its name if it is accessible in the context. If it is not accessible or does...
""" Integration tests for the jsonlogging package. """ import json import logging import unittest import StringIO from mock import MagicMock import jsonlogging class TestJsonLogging(unittest.TestCase): def test_logged_messages_are_formatted_as_json(self): """ Test a full run through the stack f...
#Process: #1. Get a list of original sdf files #2. Use chopRDKit02.py generates fragments and list of files with total atom number, carbon atom number, nitrogen and oxygen atom number #3. Form lists of by atom numbers #4. Run rmRedLinker03.py or rmRedRigid01.py on different lists generated by step 3. Remove redundancy ...
import distutils.core import distutils.errors import json import os import os.path import platform import re import shutil import sys import tarfile import tempfile import warnings import zipfile try: import urllib2 except ImportError: from urllib import request as urllib2 from setuptools import setup fzf_v...
from datetime import datetime from urllib.request import urlopen from subprocess import check_output ###################### # DOWNLOAD FUNCTIONS # ###################### #url -> html def get_html(url): html = '' try: html = check_output(['wget', '-qO-', url]).decode() except Exception as e: print(e) r...
# Script Name : password_cracker.py # Author : Craig Richards # Created : 20 May 2013 # Last Modified : # Version : 1.0 # Modifications : # Description : Old school password cracker using python import crypt # Import the module def testPass(cryptPass): # Start the function """ function to compare given pa...
from django.conf import settings from django.conf.urls import patterns, include, url # There is a course creators admin table. from ratelimitbackend import admin admin.autodiscover() # Pattern to match a course key or a library key COURSELIKE_KEY_PATTERN = r'(?P<course_key_string>({}|{}))'.format( r'[^/]+/[^/]+/[...
############################################################################### # This file is part of openWNS (open Wireless Network Simulator) # _____________________________________________________________________________ # # Copyright (C) 2004-2009 # Chair of Communication Networks (ComNets) # Kopernikusstr. 5, D-5...
# encoding: utf-8 """ Contains the tests for creating an coupon associated with enterprise customer and catalog. """ from __future__ import absolute_import, unicode_literals from uuid import uuid4 from django.core.management import call_command from django.utils.timezone import now from mock import Mock, patch from ...
# -*- coding: utf-8 -*- """ g_octave.config ~~~~~~~~~~~~~~~ This module implements a Python object to handle the configuration of g-octave. :copyright: (c) 2009-2010 by Rafael Goncalves Martins :license: GPL-2, see LICENSE for more details. """ from __future__ import absolute_import import o...
# Copyright 2011 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...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # king_phisher/version.py # # 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 lis...
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import os from pants.base.build_environment import get_buildroot, pants_version from pants.build_graph.aliased_target import AliasTargetFactory from pants.build_graph.build_file_aliases i...
# -*- coding: utf-8 -*- # # phpMyAdmin documentation build configuration file, created by # sphinx-quickstart on Wed Sep 26 14:04:48 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. # # ...
""" Copyright (c) 2011, Mihail Szabolcs All rights reserved. See LICENSE for more information. """ import random import math from pyglet.gl import * class Particle(object): def __init__(self): self.p = [0,0,0] self.a = 1 self.dx = (random.random() - 0.5) self.dy = (random.random() - 0.5) def update(s...
#!/usr/bin/env python # -*- coding=utf-8 -*- ########################################################################### # Copyright (C) 2013-2016 by Caspar. All rights reserved. # File Name: chm_gendata.py # Author: Shankai Yan # E-mail: sk.yan@my.cityu.edu.hk # Created Time: 2016-03-01 22:15:59 ######################...
import pyspark import operator import sys #311 call 2010 to present csv #0 Unique Key,Created Date,Closed Date,Agency,Agency Name, #5 Complaint Type,Descriptor,Location Type,Incident Zip,Incident Address, #10 Street Name,Cross Street 1,Cross Street 2,Intersection Street 1, #14 Intersection Street 2,Address Type,Cit...
# :copyright: (c) 2008 by Armin Ronacher and PEP 273 authors. # :license: modified BSD license. # # 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 copyrigh...
#----------------------------------------------------------------------- # XALT: A tool that tracks users jobs and environments on a cluster. # Copyright (C) 2013-2015 University of Texas at Austin # Copyright (C) 2013-2015 University of Tennessee # # This library is free software; you can redistribute it and/or modif...
#!/usr/bin/env python """Tests for flow utils classes.""" from absl import app from grr_response_core.lib import rdfvalue from grr_response_core.lib.rdfvalues import client as rdf_client from grr_response_server import flow_utils from grr.test_lib import flow_test_lib from grr.test_lib import test_lib class TestInt...
#! /usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### ## ## ## Copyright 2010-2012, Neil Wallace <neil@openmolar.com> ## ## ...
def indexToLocation(x): return ( (8-(x%8)) , (int(x/8)+1) ) class Location: def __init__(self, x=1, y=1, z=1): self.x = x self.y = y self.z = z def parseStr(self, inStr): inStr = inStr[1:-1] inStr = inStr.split(',') self.x = int(inStr[0]) self.y = in...
import factory from assert_helpers import assert_difference, assert_no_difference from ekklesia_portal.datamodel import Document from webtest_helpers import assert_deform, fill_form def test_create_document(client, db_query, document_factory, proposition_type_factory, logged_in_department_admin): department = lo...
# -*- python -*- # # wireshark_gen.py (part of idl2wrs) # # Author : Frank Singleton (frank.singleton@ericsson.com) # # Copyright (C) 2001 Frank Singleton, Ericsson Inc. # # This file is a backend to "omniidl", used to generate "Wireshark" # dissectors from CORBA IDL descriptions. The output language generated # ...
# -*- encoding: utf-8 -*- import re import operator from datetime import datetime try: from functools import reduce except ImportError: pass import django from django.db import models from django.db.models import Model, Manager, Q from django.db.models.fields import FieldDoesNotExist from django.core.exceptio...
"""create mandate events table Revision ID: 585774625ec2 Revises: 2cbbef3d8e8f Create Date: 2015-07-06 00:58:44.470013 """ # revision identifiers, used by Alembic. revision = '585774625ec2' down_revision = '2cbbef3d8e8f' from alembic import op import sqlalchemy as sa def upgrade(): op.create_table( 'm...
# 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 u...
from south.db import db from django.db import models from ftrain.ohlih.models import * class Migration: def forwards(self, orm): # Adding model 'Energy' db.create_table('ohlih_energy', ( ('kcal_is_est', orm['ohlih.energy:kcal_is_est']), ('kcal', orm['ohlih.ene...
# -*- coding: utf-8 -*- # # common/templatetags/compact.py # # Copyright (C) 2011-19 Tomáš Pecina <tomas@pecina.cz> # # This file is part of legal.pecina.cz, a web-based toolbox for lawyers. # # This application is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public Licen...
# Copyright (c) 2013 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 ...
from collections import defaultdict, OrderedDict, deque import copy import sys import numpy as np import scipy.stats from scipy.linalg import LinAlgError import scipy.sparse import sklearn # TODO use balanced accuracy! import sklearn.metrics import sklearn.cross_validation from sklearn.utils import check_array from sk...
from datetime import datetime, timedelta from discord.ext import commands from .utils import utils import traceback import asyncio import discord import pytz loop_list = {} class Remind(commands.Cog): #This is to remind user about task they set. def __init__(self,bot): self.bot = bot self.redis = ...
#!/usr/bin/env python from tornado.httputil import url_concat import unittest class TestUrlConcat(unittest.TestCase): def test_url_concat_no_query_params(self): url = url_concat( "https://localhost/path", {'y':'y', 'z':'z'}, ) self.assertEqual(url,...
#! python # Python Serial Port Extension for Win32, Linux, BSD, Jython and .NET/Mono # serial driver for .NET/Mono (IronPython), .NET >= 2 # see __init__.py # # (C) 2008 Chris Liechti <cliechti@gmx.net> # this is distributed under a free software license, see license.txt import clr import System import Syste...
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright 2013 Matthieu Huin <mhu@enovance.com> # # This file is part of duplicity. # # Duplicity 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; ei...
#!/usr/bin/env python """Script to convert templates from Mako to Jinja2.""" import io import glob import sys import os import re import json import shutil import tempfile import colorama import jinja2 dumb_replacements = [ ["{% if any(post.is_mathjax for post in posts) %}", '{% if posts|selectattr("is_mathjax")...