text
stringlengths
475
200k
# -*- coding: utf-8 -*- """ pygments.lexers.foxpro ~~~~~~~~~~~~~~~~~~~~~~ Simple lexer for Microsoft Visual FoxPro source code. :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexer import RegexLexer from pygm...
import numpy as np import turicreate as tc from polara import RecommenderModel class TuriFactorizationRecommender(RecommenderModel): def __init__(self, *args, **kwargs): self.item_side_info = kwargs.pop('item_side_info', None) self.user_side_info = kwargs.pop('user_side_info', None) super(...
# Copyright 2013 Hewlett-Packard Development Company, L.P. # # 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 requir...
import random from browser import doc def getMousePosition(e): if e is None: e=win.event if e.pageX or e.pageY: return {'x': e.pageX, 'y': e.pageY} if e.clientX or e.clientY: _posx=e.clientX + doc.body.scrollLeft + doc.documentElement.scrollLeft; _posy=e.clientY + doc.body.scr...
import cgi import json import os import traceback import urllib import urlparse from constants import content_types from pipes import Pipeline, template from ranges import RangeParser from request import Authentication from response import MultipartContent from utils import HTTPException __all__ = ["file_handler", "p...
# -*- 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...
from __future__ import unicode_literals from datetime import datetime, timedelta from unittest import skipIf, skipUnless from django.db import connection from django.db.models import CharField, TextField, Value as V from django.db.models.expressions import RawSQL from django.db.models.functions import ( Coalesce,...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # || ____ _ __ # +------+ / __ )(_) /_______________ _____ ___ # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \ # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/ # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/ # # Copyright (C) 20...
from django import VERSION as djangoVersion if djangoVersion[:2] >= (1, 8): from django.db.backends.base.introspection import BaseDatabaseIntrospection, TableInfo else: from django.db.backends import BaseDatabaseIntrospection from sqlanydb import ProgrammingError, OperationalError import re import sqlanydb cl...
# Copyright (c) 2012-2013 ARM Limited # All rights reserved. # # The license below extends only to copyright in the software and shall # not be construed as granting a license to any other intellectual # property including but not limited to intellectual property relating # to a hardware implementation of the functiona...
#encoding=utf-8 ''' @author: wufulin ''' import os import sys sys.path.append("..") from util.Tool import * #################################### #SongManager #歌曲列表管理类 #################################### class SongManager(object): ''' 播放列表管理器 ''' def __init__(self): self.__SongList ...
""" Unit tests for stub XQueue implementation. """ import mock import unittest import json import requests import time import copy from ..xqueue import StubXQueueService, StubXQueueHandler class FakeTimer(object): """ Fake timer implementation that executes immediately. """ def __init__(self, delay, ...
#!/usr/bin/env python2 # # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # from test_framework.mininode import * from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * from test_framew...
from __future__ import unicode_literals import datetime import pickle from decimal import Decimal from operator import attrgetter from django.contrib.contenttypes.models import ContentType from django.core.exceptions import FieldError from django.db import connection from django.db.models import ( F, Q, Avg, Coun...
################################################################################ # 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...
"""Tests for stream_slice.""" import string import six import unittest2 from apitools.base.py import exceptions from apitools.base.py import stream_slice class StreamSliceTest(unittest2.TestCase): def setUp(self): self.stream = six.StringIO(string.ascii_letters) self.value = self.stream.getval...
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Shy Shalom # Portions created by the Initial Developer are Copyright (C) 2005 # the Initial Developer. All Rights Reserved. #...
from __future__ import division import requests import random import time import threading import rethinkdb as r import math import numpy as np import cv2 import matplotlib from matplotlib import pyplot as plt import matplotlib.patches as patches from scipy.misc import imread import os plt.scatter([0,5],[0,5]) plt.io...
# # Module providing the `Process` class which emulates `threading.Thread` # # multiprocessing/process.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = ['Process', 'current_process', 'active_children'] # # Imports # import os import sys import signal import itert...
# 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...
# # Copyright (c) 2008--2015 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should have received a c...
from io import BytesIO from twisted.python import log as txlog, failure from twisted.trial import unittest from scrapy import log from scrapy.spider import Spider from scrapy.settings import default_settings from scrapy.utils.test import get_crawler class LogTest(unittest.TestCase): def test_get_log_level(self)...
# # (c) 2017, Red Hat, Inc. # # 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) any later version. # # Ansible is...
# # 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...
# This file is part of the Trezor project. # # Copyright (C) 2012-2018 SatoshiLabs and contributors # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 # as published by the Free Software Foundation. # # This library is distrib...
"""Queues""" __all__ = ['Queue', 'PriorityQueue', 'LifoQueue', 'QueueFull', 'QueueEmpty'] import collections import heapq from . import events from . import futures from . import locks from .tasks import coroutine class QueueEmpty(Exception): """Exception raised when Queue.get_nowait() is called on a Queue obj...
# -*- coding: utf-8 -*- """ jinja2.parser ~~~~~~~~~~~~~ Implements the template parser. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ from jinja2 import nodes from jinja2.exceptions import TemplateSyntaxError, TemplateAssertionError from jinja2.utils impo...
# Copyright 2012 Nebula, Inc. # Copyright 2014 IBM Corp. # # 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...
import os import subprocess import re import threading from functools import wraps from concurrent.futures import Future, wait import time from ..logger import Logger class ADB(object): """ Wrapper for adb commands. Import:: from magneto.utils.adb import ADB :required: Android SDK installe...
# coding: utf-8 # pylint: disable=invalid-name, protected-access, too-many-arguments, global-statement """Symbolic configuration API.""" from __future__ import absolute_import as _abs import ctypes import sys import numpy as _numpy from ..base import _LIB from ..base import c_array, c_str, mx_uint, py_str from ..base...
"""DB class containing many niceties to retrieve data from SQL""" import hashlib import os import sqlite3 from philologic.Config import Config, db_locals_defaults, db_locals_header from philologic.runtime import Query from . import HitList from . import MetadataQuery from . import QuerySyntax from .HitWrapper import...
#!/usr/bin/env python ''' @author: David Shaw, [EMAIL] Inspired by EAS Inspector for Fiddler https://easinspectorforfiddler.codeplex.com ----- The MIT License (MIT) ----- Filename: ASWBXMLCodePage.py Copyright (c) 2014, David P. Shaw Permission is hereby granted, free of charge, to any person obtaining a...
# Mercurial bookmark support code # # Copyright 2008 David Soria Parra <[EMAIL]> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from mercurial.i18n import _ from mercurial.node import hex from mercurial import encoding, error, ut...
#!/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. ''' Verifies that builds of the embedded content_shell do not included unnecessary dependencies.''' import os import re import string ...
from collections import Mapping, MutableMapping try: from threading import RLock except ImportError: # Platform-specific: No threads available class RLock: def __enter__(self): pass def __exit__(self, exc_type, exc_value, traceback): pass try: # Python 2.7+ from co...
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): depends_on = ( ("fluent_contents", "0001_initial"), ) def forwards(self, orm): # Adding model 'TwitterRecentEntriesItem' ...
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
""" Functions to execute commands via the operating system. """ # Copyright (c) 2016 University of Edinburgh. from __future__ import (nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals) from subprocess import call fro...
import os import sys import tempfile import shutil if sys.version_info[:2] == (2, 6): import unittest2 as unittest else: import unittest from avocado.core import sysinfo class SysinfoTest(unittest.TestCase): def setUp(self): self.tmpdir = tempfile.mkdtemp(prefix="sysinfo_unittest") def tes...
#!/usr/bin/env python # Copyright (c) 2011 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. """ Verifies that postbuild steps work. """ import TestGyp import sys if sys.platform == 'darwin': test = TestGyp.TestGyp(formats=['nin...
""" URLconf for registration and activation, using django-registration's one-step backend. If the default behavior of these views is acceptable to you, simply use a line like this in your root URLconf to set up the default URLs for registration:: (r'^accounts/', include('registration.backends.simple.urls')), Thi...
# vim: set fileencoding=utf-8 : from shirka.responders import Responder from sympy.parsing.sympy_parser import parse_expr import exceptions from shirka.consumers import BaseTestCase class MathResponder(Responder): def name(self): return 'math' def generate(self, request): """ usage: m...
###################################################################### # This file should be kept compatible with Python 2.3, see PEP 291. # ###################################################################### import sys from ctypes import * _array_type = type(c_int * 3) def _other_endian(typ): """Return the t...
from datetime import datetime, tzinfo import pytz from django.template import Library, Node, TemplateSyntaxError from django.utils import six, timezone register = Library() # HACK: datetime is an old-style class, create a new-style equivalent # so we can define additional attributes. class datetimeobject(datetime,...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2014 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
""" Cached, database-backed sessions. """ import logging from django.contrib.sessions.backends.db import SessionStore as DBStore from django.core.cache import cache from django.core.exceptions import SuspiciousOperation from django.utils import timezone from django.utils.encoding import force_text KEY_PREFIX = "djan...
import logging import requests import structlog import parsel from random import sample import re from django.test import Client from django.test import RequestFactory from siteapp.urls import urlpatterns from django.urls.exceptions import Resolver404 as Resolver404 from siteapp.models import * from guidedmodules.m...
import logging import shlex import shutil import subprocess import tempfile import textwrap import filecmp import shutil from contextlib import closing from unittest import TestCase, skip from urlparse import urlparse from uuid import uuid4 import urllib2, gzip import os, sys import posixpath import pytest from toil...
# 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) any later version. # # Ansible is distributed in the hope that ...
""" from: http://adventofcode.com/2017/day/5 --- Day 5: A Maze of Twisty Trampolines, All Alike --- An urgent interrupt arrives from the CPU: it's trapped in a maze of jump instructions, and it would like assistance from any programs with spare cycles to help find the exit. The message includes a list of the offsets f...
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
#!/usr/bin/python3 # updates repos.gz import gzip import os wwwroot = "/home/packages/www/repos.springrts.com" prefix = "http://repos.springrts.com/" streamer = "/home/packages/bin/Streamer" repos = { "main": "http://packages.springrts.com" } assert(os.path.isfile(streamer)) def SetupStreamer(repodir): streamerc...
""" PRC (Palm resource) parser. Author: Sebastien Ponce Creation date: 29 october 2008 """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, UInt16, UInt32, TimestampMac32, String, RawBytes) from hachoir_core.endian import BIG_ENDIAN class PRCHeader(FieldSet): static_size = 78*8...
# 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...
""" Utility functions for retrieving and generating forms for the site-specific user profile model specified in the ``AUTH_PROFILE_MODULE`` setting. """ from django import forms from django.conf import settings from django.contrib.auth.models import SiteProfileNotAvailable from django.db.models import get_model def...
"""Dealing with all general issues about command line tool set. And this is command entry point. """ import sys import inspect import optparse from robotx.core.base import BaseCommand from robotx.utils.misc import walk_modules from robotx.core.exceptions import UsageError def _iter_command_classes(module_name): ...
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
#from out2_sup import * import out2_sup as model_ rootObj = model_.rootTag( comments=[ model_.comments( content_ = [ model_.MixedContainer(1, 0, "", "1. This is a "), model_.MixedContainer(2, 2, "emp", "foolish"), model_.MixedContainer(1, 0, "", " comment. ...
# 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 ...
# # Emulation of has_key() function for platforms that don't use ncurses # import _curses # Table mapping curses keys to the terminfo capability name _capability_names = { _curses.KEY_A1: 'ka1', _curses.KEY_A3: 'ka3', _curses.KEY_B2: 'kb2', _curses.KEY_BACKSPACE: 'kbs', _curses.KEY_BEG: 'kbeg', ...
from collections import defaultdict from operator import itemgetter from math import log, sqrt import random as rn import time from numpy import * # install numpy from scipy import * # install scipy from numpy.linalg import norm import numpy.linalg as npl from scipy.sparse import * import scipy.sparse.linalg as spsl fr...
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( int_or_none, unified_strdate, ) from ..compat import compat_urlparse class DWIE(InfoExtractor): IE_NAME = 'dw' _VALID_URL = r'https?://(?:www\.)?dw\.com/(?:[^/]+/)+(?:av|e)-(?P<id>\d+)' ...
# # 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...
# 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 json import loads from urlparse import urlparse from flask import current_app as app from flask import request def thumbUrl(thumb): return "https://venturelog.imgix.net/articles/" + thumb + \ "?w=200&h=150&fit=crop&crop=entropy&auto=compress,format" def html(article): return '<div><p>' + articl...
#!/usr/bin/env python3 """ CFE Partition Tag { u32 part_id; u32 part_size; u16 flags; char part_name[33]; char part_version[21]; u32 part_crc32; } """ import argparse import os import struct PART_NAME_SIZE = 33 PART_VERSION_SIZE = 21 CRC32_INIT = 0xFFFFFFFF CRC32_TABLE = [ 0x00000000, 0x77073096, 0xEE0E612...
"""gettext tool """ # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # # 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 with...
#!/usr/bin/env python ''' update a wordpress wiki page Andrew Tridgell May 2013 See http://codex.wordpress.org/XML-RPC_WordPress_API/Posts ''' import xmlrpclib, sys from optparse import OptionParser parser = OptionParser("update_wiki.py [options] <file>") parser.add_option("--username", help="Wordpress username", de...
#!/usr/bin/env python2.6 # vim: ts=4 sw=4 expandtab """ Parses a script into nodes. """ import bisect import re import unittest import spidermonkey from spidermonkey import tok, op from util import JSVersion _tok_names = dict(zip( [getattr(tok, prop) for prop in dir(tok)], ['tok.%s' % prop for prop in dir(tok...
# -*- coding: utf-8 -*- """ werkzeug.http ~~~~~~~~~~~~~ Werkzeug comes with a bunch of utilities that help Werkzeug to deal with HTTP data. Most of the classes and functions provided by this module are used by the wrappers, but they are useful on their own, too, especially if the response and ...
import re __all__ = ('QueryInfo', 'QueryReadStoreInfo', 'JsonRestStoreInfo', 'JsonQueryRestStoreInfo',) class QueryInfoFeatures(object): sorting = True paging = False class QueryInfo(object): '''Usage (is that the right solution?): info = QueryInfo(request) info.extract() ...
# coding=utf-8 from psycopg2.extras import NamedTupleCursor, Json from tornado.web import Application, HTTPError from tornado import gen from tornado.ioloop import IOLoop from tornado.httpserver import HTTPServer from tornado.options import parse_command_line import momoko import os from bank import SelectQuestion, get...
import codecs from setuptools import setup with codecs.open('README.rst', encoding='utf-8') as f: long_description = f.read() setup( name="shadowsocks", version="2.8.2", license='http://www.apache.org/licenses/LICENSE-2.0', description="A fast tunnel proxy that help you get through firewalls", ...
#!/usr/bin/env python from struct import * from socket import * from optparse import OptionParser UDP_ADDR = "0.0.0.0" UDP_MULTICAST_ADDR = "239.255.255.100" UDP_PORT = 7724 BUFFER_SIZE = 65536 #HEADER_KEYS = ['Logger', 'Level', 'Source-File', 'Source-Function', 'Source-Line', 'TimeStamp'] HEADER_KEYS = { 'mini': ...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models try: from django.contrib.auth import get_user_model except ImportError: # django < 1.5 from django.contrib.auth.models import User else: User = get_user_model() user_orm_label...
"""(Extremely) low-level import machinery bits as used by importlib and imp.""" class __loader__(object):pass def _fix_co_filename(*args,**kw): raise NotImplementedError("%s:not implemented" % ('_imp.py:_fix_co_filename')) def acquire_lock(*args,**kw): """acquire_lock() -> None Acquires the interpreter's...
from datetime import datetime, timedelta from nose.tools import eq_ from kitsune.announcements.models import Announcement from kitsune.announcements.tests import announcement from kitsune.sumo.tests import TestCase from kitsune.users.tests import user, group, profile from kitsune.wiki.tests import locale class Anno...
"""Support for Vera sensors.""" from datetime import timedelta import logging from homeassistant.components.sensor import ENTITY_ID_FORMAT from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT from homeassistant.helpers.entity import Entity from homeassistant.util import convert from . import VERA_CONTROLLER,...
# (c) 2012, Michael DeHaan <[EMAIL]> # (c) 2013, Dylan Martin <[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 yo...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2014, Sebastien Rohaut <[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, o...
# -*- coding: utf-8 -*- ######################################################################### # # # Copyright (C) 2015 Agile Business Group # # # ...
""" Sparse matrix functions """ # # Authors: Travis Oliphant, March 2002 # Anthony Scopatz, August 2012 (Sparse Updates) # Jake Vanderplas, August 2012 (Sparse Updates) # from __future__ import division, print_function, absolute_import __all__ = ['expm', 'inv'] import math import numpy as np imp...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2014, Trond Hindenes <[EMAIL]>, and others # # 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 ...
""" Django settings for hoursservice project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, .....
import json from datetime import datetime, timedelta from flask import request, render_template, make_response, current_app from flask.ext.login import current_user from flask.ext.oauthlib.provider import OAuth2Provider from flask.ext.user import login_required, passwords from werkzeug.security import gen_salt from b...
# pylint: disable=C0111 # pylint: disable=W0621 from lettuce import world, step from lettuce.django import django_url from course_modes.models import CourseMode from nose.tools import assert_equal UPSELL_LINK_CSS = '.message-upsell a.action-upgrade[href*="edx/999/Certificates"]' def create_cert_course(): world....
#!/usr/bin/python -u # # # ################################################################################# # Start off by implementing a general purpose event loop for anyones use ################################################################################# import sys import getopt import os import libvirt impor...
# -*- test-case-name: twisted.web.test.test_cgi -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ I hold resource classes and helper classes that deal with CGI scripts. """ # System Imports import string import os import urllib # Twisted Imports from twisted.web import http from twiste...
import numpy as np import invesalius.data.coordinates as dco import invesalius.data.transformations as tr import invesalius.data.coregistration as dcr def angle_calculation(ap_axis, coil_axis): """ Calculate angle between two given axis (in degrees) :param ap_axis: anterior posterior axis represe...
#!/usr/bin/env python # OpenCenter(TM) is Copyright 2013 by Rackspace US, Inc. ############################################################################## # # OpenCenter is licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License....
__author__ = 'Chris HAmm' #GUI_KeyEvent #when we press a key on our keyboard, wx.KeyEvent is generated. This event is sent to the widget that currently has focus #three different key handlers #wx.EVT_KEY_DOWN #wx.EVT_KEY_UP #wx.EVT_CHAR #common request is to close the application when the ESC key is pressed import ...
from unittest import TestCase import numpy as np import pandas as pd from scattertext import LogOddsRatioInformativeDirichletPrior from scattertext.PriorFactory import PriorFactory from scattertext.test.test_semioticSquare import get_test_corpus class TestPriorFactory(TestCase): def test_all_categories(self): ...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2012, Stephen Fromm <[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 #...
# 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...
# -*- coding:utf-8 -*- import pytest # node-semver/test/index.js # import logging # logging.basicConfig(level=logging.DEBUG, format="%(message)s") cands = [ ['1.2.3', 'major', '2.0.0', False], ['1.2.3', 'minor', '1.3.0', False], ['1.2.3', 'patch', '1.2.4', False], ['1.2.3tag', 'major', '2.0.0', True]...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Business Applications # Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms o...
# -*- coding: utf-8 -*- """ pygments.console ~~~~~~~~~~~~~~~~ Format colored console output. :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ esc = "\x1b[" codes = {} codes[""] = "" codes["reset"] = esc + "39;49;00m" cod...
### This script calculates the cumulative above and belowground carbon gain in mangrove forest pixels from 2001-2015. ### It multiplies the annual biomass gain rate by the number of years of gain by the biomass-to-carbon conversion. import utilities import datetime import subprocess import sys sys.path.append('../') i...
""" An alphabetical list of provinces and territories for use as `choices` in a formfield., and a mapping of province misspellings/abbreviations to normalized abbreviations Source: http://www.canada.gc.ca/othergov/prov_e.html This exists in this standalone file so that it's only imported into memory when...
#Code from https://gist.github.com/craffel/2d727968c3aaebd10359 import matplotlib.pyplot as plt def draw_neural_net(ax, left, right, bottom, top, layer_sizes, bias=0, draw_edges=False): ''' Draw a neural network cartoon using matplotilb. :usage: >>> fig = plt.figure(figsize=(12, 12)) ...