text
stringlengths
475
200k
# # organize_photos.py: (C) 2011-2014 Sameer Sundresh. No warranty. # # exif_cache.py is a helper for organize_photos.py # # It maintains a cache file exif_cache.json in the source directory that # keeps track of which files have already been copied out of that source # directory, including where they were copied and t...
# -*- coding: utf-8 -*- """\ This is a python port of "Goose" orignialy licensed to Gravity.com under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Python port was written by Xavier Grangier for Recrutae Gravity.co...
''' Utilities to allow inserting docstring fragments for common parameters into function and method docstrings''' import sys def docformat(docstring, docdict=None): ''' Fill a function docstring from variables in dictionary Adapt the indent of the inserted docs Parameters ---------- docstring : ...
# -*- coding:utf8 -*- # File : grad_modifier.py # Author : Jiayuan Mao # Email : [EMAIL] # Date : 1/28/17 # # This file is part of TensorArtist. import tensorflow as tf from ..tfutils import clean_name from ...core.logger import get_logger from ...core.utils.match import NameMatcher logger = get_logger(__file_...
from __future__ import unicode_literals import boto import boto3 import pytest import sure # noqa from boto.exception import EC2ResponseError from moto import mock_ec2, mock_ec2_deprecated @mock_ec2_deprecated def test_create_vpn_connections(): conn = boto.connect_vpc("the_key", "the_secret") vpn_connection...
# 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...
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # # Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under ...
# -*- coding: utf-8 -*- from django.contrib.auth.models import User, Permission, Group from django_any import any_model def any_user(password=None, permissions=[], groups=[], **kwargs): """ Shortcut for creating Users Permissions could be a list of permission names If not specified, creates active, n...
# -*- coding: utf-8 -*- """ jinja2.ext ~~~~~~~~~~ Jinja extensions allow to add custom tags similar to the way django custom tags work. By default two example extensions exist: an i18n and a cache extension. :copyright: (c) 2010 by the Jinja Team. :license: BSD. """ from jinja2 import nod...
import itertools class corners(object): def __init__(self, i, j): # i, j are position of corner self.i = i self.j = j def __str__(self): return "[" + str(self.i) + ", " + str(self.j) + "]" # return corner on the same line def same_line(index, list): for c in list: ...
# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved. # Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved. # # 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. Redistrib...
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Utility functions to perform Xcode-style build steps. These functions are executed via gyp-mac-tool when using the Makefile generator. ""...
# -*- coding: utf-8 -*- # # Copyright (C) 2004-2013 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.edgewall.org/wiki/TracLicense. # # This software consi...
import numpy as np from scipy.optimize import curve_fit def expfit(x, y): """ expfit calculates an exponential power law fit based upon levenburg-marquardt minimization. Fits are of the form. y = ax**b Parameters: ----------- x: array_like independent variable y: array_like ...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
#!/usr/bin/env python3 """ License statement applies to this file (glgen.py) only. """ """ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limi...
# 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/env python # # Copyright 2008 the V8 project 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: # # * Redistributions of source code must retain the above copyright # noti...
# coding=utf-8 """ InaSAFE Disaster risk assessment tool by AusAid **GUI InaSAFE Wizard Dialog.** Contact : [EMAIL] .. note:: 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...
import logging from gevent.pywsgi import WSGIServer, WSGIHandler logger = logging.getLogger(__name__) class LymphWSGIHandler(WSGIHandler): def format_request(self): # XXX(Mouad): Copied shamessly from gevent.pywsgi.WSGIHandler's format_request # and removed only the datetime from the output, s...
#!/usr/bin/env python2 # vim:fileencoding=utf-8 from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' import os, unittest, shutil from calibre import CurrentDir from calibre.pte...
""" This module holds simple classes to convert geospatial values from the database. """ from decimal import Decimal from django.contrib.gis.db.models.fields import GeoSelectFormatMixin from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.measure import Area, Distance class BaseField: ...
# -*- coding: utf-8 -*- """ sockjs.tornado.transports.rawwebsocket ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Raw websocket transport implementation """ import logging import socket from sockjs.tornado import websocket, session from sockjs.tornado.transports import base LOG = logging.getLogger("tornado.gener...
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function, division import logging log = logging.getLogger("forecast") has_pywapi = False try: import pywapi has_pywapi = True except: log.error('Error loading library pywapi. Library not found.') def fahrenheit_to_celcius(f): re...
# -*- coding: iso-8859-1 -*- # Copyright (C) 2011-2014 Bastian Kleineidam # # 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 versi...
from __future__ import absolute_import, division, print_function import inspect import sys import traceback from inspect import CO_VARARGS, CO_VARKEYWORDS import attr import re from weakref import ref from _pytest.compat import _PY2, _PY3, PY35, safe_str from six import text_type import py builtin_repr = repr if _PY...
'''Manager for predicates. Created on Jun 15, 2013 @author: Cam Moore ''' import sys import inspect from apps.managers.challenge_mgr.models import RoundSetting, GameInfo from apps.widgets.smartgrid_library.models import LibraryEvent, LibraryAction from apps.widgets.smartgrid_design.models import DesignerLevel, Design...
#!/usr/bin/env python """ AM_ifSensorsNotOK_notRelease Assertion monitor For use in Human-Robot Interaction simulator. Created by David Western, July 2015. Implements assertion: if human is ready and NOT sensorsOk and contact_robot_hand_and_object ==1 then assert after T, contact_robot_hand_and_object == 1 (robot d...
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logistic Regression 3-class Classifier ========================================================= Show below is a logistic-regression classifiers decision boundaries on the `iris <http://en.wikipedia.org/wiki/Iris_f...
#!/usr/local/bin/python # -*- coding: utf-8 -*- ''' Created on Oct 20, 2015 クロールの流れ 1.FeaturedGamesで最近のゲームを取得 2.ParticipantsのSummonerNamesを取得 3.SummonerNamesを使ってSummonerIdを取得 4.SummonerIdを使ってSummonerGamesを取得 5.SummonerGamesからMatchStatsを取得 6.保存 @author: ochi ''' import urllib2 import urllib import json import lolapi...
#-*- coding:utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2011 OpenERP SA (<http://openerp.com>). All Rights Reserved # # This program is free software: you can redistribute it and/or modify # it under th...
""" Commonly useful validators. """ from __future__ import absolute_import, division, print_function from ._make import attr, attributes @attributes(repr=False, slots=True) class _InstanceOfValidator(object): type = attr() def __call__(self, inst, attr, value): """ We use a callable class t...
"""Support for the Pico TTS speech service.""" import logging import os import shutil import subprocess import tempfile import voluptuous as vol from homeassistant.components.tts import CONF_LANG, PLATFORM_SCHEMA, Provider _LOGGER = logging.getLogger(__name__) SUPPORT_LANGUAGES = ["en-US", "en-GB", "de-DE", "es-ES"...
import requests import redis from requests.exceptions import Timeout, ConnectionError, HTTPError import json import time from tornado.options import options import config from ate_logger import AteLogger class NotifyMonitor(object): def __init__(self, logger=None): if logger: self.__logger = ...
# Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ SCons generator. This contains class definitions and supporting functions for generating pieces of SCons files for the different types of GYP targets. """ im...
# Copyright (c) 2011 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. """Python representation for Chromium Omnibox. Obtain one of these from PyUITestSuite::GetOmniboxInfo() call. Example: class MyTest(pyauto.PyUITest): ...
# Copyright (c) 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 ...
import asyncio from atoolbox import patch from atoolbox.db.helpers import run_sql_section from textwrap import dedent, indent from time import time from tqdm import tqdm @patch async def run_logic_sql(conn, settings, **kwargs): """ run the "logic" section of models.sql """ await run_sql_section('logic...
# Copyright 2014 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. import collections import copy import traceback from telemetry import value as value_module from telemetry.results import page_run from telemetry.results im...
from datetime import date from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import setup class RegroupTagTests(SimpleTestCase): @setup({'regroup01': '' '{% regroup data by bar as grouped %}' '{% for group in gro...
from Child import Child from Node import Node # noqa: I201 PATTERN_NODES = [ # type-annotation -> ':' type Node('TypeAnnotation', kind='Syntax', children=[ Child('Colon', kind='ColonToken'), Child('Type', kind='Type'), ]), # enum-case-pattern -> type-identifie...
# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood # Copyright (c) 2009 The Hewlett-Packard Development Company # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source co...
# Copyright (c) 2001-2004 Twisted Matrix Laboratories. # See LICENSE for details. """An input/output window for the glade reactor inspector. """ import time import gtk import gobject import gtk.glade from twisted.python.util import sibpath from twisted.python import reflect from twisted.manhole.ui import gtk2manhol...
# Copyright (c) 2012-2013 Rackspace Hosting # 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 # # Unles...
r""" ===================================================================== The Johnson-Lindenstrauss bound for embedding with random projections ===================================================================== The `Johnson-Lindenstrauss lemma`_ states that any high dimensional dataset can be randomly projected i...
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Unit tests for the ninja.py file. """ import gyp.generator.ninja as ninja import unittest import StringIO import sys import TestCommon ...
'''This example demonstrates embedding a standalone Bokeh document into a simple Flask application, with a basic HTML web form. To view the example, run: python simple.py in this directory, and navigate to: http://localhost:5000 ''' from __future__ import print_function import flask from bokeh.embed impo...
#!/usr/bin/env python # # Copyright 2009, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Business Applications # Copyright (C) 2004-2014 OpenERP S.A. (<http://openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms ...
#!/usr/bin/python # MIT License # # Copyright 2014 Gluu, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software # and associated documentation files (the Software), to deal in the Software without restriction, # including without limitation the rights to use, copy, modif...
import os import time from datetime import date import osgtest.library.core as core import osgtest.library.files as files import osgtest.library.osgunittest as osgunittest import osgtest.library.service as service class TestStartPBS(osgunittest.OSGTestCase): pbs_config = """ create queue batch queue_type=executi...
#!/usr/bin/python # -*- coding: utf-8 -*- # thumbor imaging service # https://github.com/globocom/thumbor/wiki # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2011 globo.com [EMAIL] import logging import inspect from json import loads, dumps from datetime import da...
#!/usr/bin/env python import sys import types from traceback import format_exc def rec_gen(func, callback=None, err_callback=None): ''' callback accept arguments with output of func err_callback is called after Exception occured, accept Exception instance as it's arguments ''' def trans_func(*args...
from contextlib import contextmanager import os from os.path import dirname, abspath, join as pjoin import shutil from subprocess import check_call import sys from tempfile import mkdtemp from . import compat _in_proc_script = pjoin(dirname(abspath(__file__)), '_in_process.py') @contextmanager def tempdir(): td...
from __future__ import unicode_literals import re # A list of regular expressions for headers in the source code that we can # display in collapsed regions of diffs and diff fragments in reviews. HEADER_REGEXES = { '.cs': [ re.compile( r'^\s*((public|private|protected|static)\s+)+' ...
#!/usr/bin/python import sys import time import os import string sys.path.insert(0, "python") import libxml2 # # the testsuite description # DIR="xinclude-test-suite" CONF="testdescr.xml" LOG="check-xinclude-test-suite.log" log = open(LOG, "w") os.chdir(DIR) test_nr = 0 test_succeed = 0 test_failed = 0 test_error =...
# LLVM based numeric specializer in 1000 lines. from __future__ import print_function from functools import reduce import sys import ast import types import ctypes import inspect import pprint import string import numpy as np from textwrap import dedent from collections import deque, defaultdict from llvmlite import...
#!/usr/bin/python import os import sys import re from subprocess import * import time def run(cmd): print "run:", cmd os.system(cmd) def get_image_dim(fn): output = Popen(["file", fn], stdout=PIPE).communicate()[0] r = re.compile("(\d+)\s*x+\s*(\d+)") m = r.search(output) if m: return...
# Part of Odoo. See LICENSE file for full copyright and licensing details. from openerp import _, api, fields, models class Job(models.Model): _inherit = "hr.job" _name = "hr.job" _inherits = {'mail.alias': 'alias_id'} @api.model def _default_address_id(self): return self.env.user.compan...
# ACTION_CHECKBOX_NAME is unused, but should stay since its import from here # has been referenced in documentation. from django.contrib.admin.decorators import register from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME from django.contrib.admin.options import (HORIZONTAL, VERTICAL, ModelAdmin, StackedI...
import unittest from mantid.kernel import V3D from mantid.simpleapi import CreateSimulationWorkspace, CreatePeaksWorkspace import numpy as np import numpy.testing as npt class IPeakTest(unittest.TestCase): def setUp(self): # IPeak cannot currently be instatiated so this is a quick way # getting a...
""" ========================================================= Multidimensional image processing (:mod:`scipy.ndimage`) ========================================================= .. currentmodule:: scipy.ndimage This package contains various functions for multidimensional image processing. Filters ======= .. autosum...
# -*- coding: utf-8 -*- """ samsara_sdk.constants ~~~~~~~~~~~~~~~~~~~~~ Samsara SDK client constants """ # Samara specific HTTP Header PUBLISHED_TIMESTAMP_HEADER = "X-Samsara-publishedTimestamp" API_PATH = '/v1/events' DEFAULT_CONFIG = { # a samsara ingestion api endpoint "http://samsara-ingestion.lo...
#!/usr/bin/env python # Copyright 2014 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. """ Tool to update all branches to have the latest changes from their upstreams. """ import argparse import collections import logging...
#/usr/bin/python2.7 #*-coding:utf-8-*- from structure import DependencyTree from DepNN import DepNN #Main class to execute the task. class Execute(object): def __init__(self): self.depnn = DepNN() self.depnn.extendLookUp('../data/depcheck2') self.depnn.load_wordvector('../data/word-vec.bin'...
from django.conf import settings from django.http import HttpResponseRedirect from django.utils.cache import patch_cache_control LOGIN_REQUIRED_PREFIXES = getattr(settings, 'LOGIN_REQUIRED_PREFIXES', ()) NO_LOGIN_REQUIRED_PREFIXES = getattr(settings, 'NO_LOGIN_REQUIRED_PREFIXES', ()) ALLOWED_DOMAINS = getattr(setting...
# -*- coding: utf-8 -*- from flask import url_for from flask_login import login_user def test_new_project_require_name(client, login): resp = client.post(url_for('dashboard.new_project'), data={'name': ''}) assert resp.status_code == 400 assert resp.json['errors']['name'] def test_new_project_success(cli...
""" Basic functions for manipulating 2d arrays """ __all__ = ['diag','diagflat','eye','fliplr','flipud','rot90','tri','triu', 'tril','vander','histogram2d','mask_indices', 'tril_indices','tril_indices_from','triu_indices','triu_indices_from', ] from numpy.core.numeric import asanyarr...
#!/usr/bin/env python # Copyright 2013 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 Python library to read and store procfs (/proc) information on Linux. # # Each information storage class in this file stores origin...
import pickle import time import os from indra.sources.isi.api import process_preprocessed from indra.sources.isi.preprocessor import IsiPreprocessor def abstracts_runtime(): pfile = '/Users/daniel/Downloads/text_content_sample.pkl' dump = pickle.load(open(pfile, 'rb')) all_abstracts = dump['pubmed'] ...
# # Copyright (c) 2014-2015 Christopher Felton # import os import shutil import inspect from random import randint from copy import copy import myhdl from myhdl._block import _Block as Block from .extintf import Port from .extintf import Clock from .extintf import Reset class FPGA(object): """ """ vendor =...
from __future__ import unicode_literals import datetime import re from itertools import chain from django.conf import settings from django.db import models from django.db.migrations import operations from django.db.migrations.migration import Migration from django.db.migrations.operations.models import AlterModelOpti...
#!/usr/bin/python """ airSuckClient by ThreeSixes (https://github.com/ThreeSixes) This project is licensed under GPLv3. See COPYING for dtails. This file is part of the airSuck project (https://github.com/ThreeSixes/airSUck). """ ########### # Imports # ########### try: import config except: raise IOError(...
# -*-*- encoding: utf-8 -*-*- # # This is gdata.photos.media, implementing parts of the MediaRSS spec in gdata structures # # $Id: __init__.py 81 2007-10-03 14:41:42Z havard.gulldahl $ # # Copyright 2007 Håvard Gulldahl # Portions copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "Lice...
# -*- coding: utf-8 -*- # # Mock documentation build configuration file, created by # sphinx-quickstart on Mon Nov 17 18:12:00 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleable...
#!/usr/bin/env python # File: generate.py ; This file is part of Twister. # version: 2.003 # Copyright (C) 2013 , Luxoft # Authors: # Adrian Toader <[EMAIL]> # Andrei Costachi <[EMAIL]> # Andrei Toma <[EMAIL]> # Cristi Constantin <[EMAIL]> # Daniel Cioata <[EMAIL]> # Mihail Tudoran <[EMAIL]> # Li...
# # namcap rules - fhsmanpages # Copyright (C) 2008 Aaron Griffin <[EMAIL]> # # 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...
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Test for distributed trial worker side. """ import os from cStringIO import StringIO from zope.interface.verify import verifyObject from twisted.trial.reporter import TestResult from twisted.trial.unittest import TestCase from twisted.trial...
"""SocksiPy - Python SOCKS module. Version 1.00 Copyright 2006 Dan-Haim. 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 ...
# Copyright (c) 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved # # 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 ...
#!/usr/bin/env python """ Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ import ntpath import os from lib.core.common import getLimitRange from lib.core.common import isNumPosStrValue from lib.core.common import isTechniqueAvailable from lib.core....
# -*- coding: utf-8 -*- # # Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyrigh...
#!/usr/bin/env python # (c) 2013, Michael Scherer <[EMAIL]> # # This file is part of Ansible, # # Ansible 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)...
#!/usr/bin/env python # encoding: utf-8 import os from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL from efl import elementary from efl.elementary.window import StandardWindow from efl.elementary.box import Box from efl.elementary.icon import Icon from efl.elementary.segment_control import SegmentControl EXPAND_...
from copy import deepcopy import hashlib from bs4 import BeautifulSoup from rest_framework import serializers from instanotifier.notification.models import RssNotification from instanotifier.notification.utils import html def _parse_country(summary): soup = BeautifulSoup(summary, features="html5lib") countr...
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2015, 2016 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Backup.origin' db.add_column(u'client_backup', 'origin', ...
# Python's datetime strftime doesn't handle dates before 1900. # These classes override date and datetime to support the formatting of a date # through its full "proleptic Gregorian" date range. # # Based on code submitted to comp.lang.python by Andrew Dalke # # >>> datetime_safe.date(1850, 8, 2).strftime("%Y/%m/%d was...
from django.views.generic.edit import FormMixin from django.shortcuts import get_object_or_404 from widgy.models import Node class HandleFormMixin(FormMixin): """ An abstract view mixin for handling form_builder.Form submissions. """ def post(self, *args, **kwargs): """ copied from dja...
"""Tokenization help for Python programs. generate_tokens(readline) is a generator that breaks a stream of text into Python tokens. It accepts a readline-like method which is called repeatedly to get the next line of input (or "" for EOF). It generates 5-tuples with these members: the token type (see token.py) ...
# -*- coding: utf-8 -*- """The compressed stream file-like object implementation.""" import os from dfvfs.compression import manager as compression_manager from dfvfs.file_io import file_io from dfvfs.lib import errors from dfvfs.resolver import resolver class CompressedStream(file_io.FileIO): """File input/outpu...
# Copyright 2015 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...
from __future__ import absolute_import, unicode_literals import datetime import re from datetime import date from decimal import Decimal from django import forms from django.db import models from django.forms.models import (_get_foreign_key, inlineformset_factory, modelformset_factory) from django.test import Tes...
# -*- coding: utf-8 -*- from __future__ import print_function, division from sympy.core.compatibility import range from sympy.core import cacheit, Dummy, Eq, Integer, Rational, S, Wild from sympy.functions import binomial, sin, cos, Piecewise # TODO sin(a*x)*cos(b*x) -> sin((a+b)x) + sin((a-b)x) ? # creating, each ...
# Copyright (C) 2001-2006 Python Software Foundation # Author: Barry Warsaw # Contact: [EMAIL] """Various types of useful iterators and generators.""" __all__ = [ 'body_line_iterator', 'typed_subpart_iterator', 'walk', # Do not include _structure() since it's part of the debugging API. ...
#*************************************************************************** #* * #* Copyright (c) 2015 - FreeCAD Developers * #* Author (c) 2015 - Przemo Fiszt < [EMAIL]> * #* ...
# Copyright 2017 DataCentred Ltd # # 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.db import IntegrityError from django.test import TestCase from student.tests.factories import UserFactory from user_api.tests.factories import UserPreferenceFactory from user_api.models import UserPreference class UserPreferenceModelTest(TestCase): def test_duplicate_user_key(self): user = Use...
import logging import os import shutil import time import teuthology from teuthology.contextutil import safe_while log = logging.getLogger(__name__) # If we see this in any directory, we do not prune it PRESERVE_FILE = '.preserve' def main(args): """ Main function; parses args and calls prune_archive() ...
# -*- coding: utf-8 -*- """ pygments.lexers.factor ~~~~~~~~~~~~~~~~~~~~~~ Lexers for the Factor language. :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexer import RegexLexer, bygroups, default, words from ...