src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
"""
markupsafe
~~~~~~~~~~
Implements a Markup string.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import re
import string
from collections import Mapping
from markupsafe._compat import text_type, string_types, int_types, \
u... |
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2017 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... |
import logging
from flask import Flask, render_template
from flask_ask import Ask, statement, question, session
from chatterbot import ChatBot
app = Flask(__name__)
ask = Ask(app, "/")
logging.getLogger("flask_ask").setLevel(logging.DEBUG)
# Create a new instance of a ChatBot
chatbot = ChatBot(
"Improv",
read... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, 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 Licens... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2006 - 2010 Loic Dachary <loic@dachary.org>
# Copyright (C) 2006 Mekensleep
#
# Mekensleep
# 26 rue des rosiers
# 75004 Paris
# licensing@mekensleep.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of th... |
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
class BuktiPotongPPhF113313In(models.Model):
_name = "l10n_id.bukti_potong_pph_f113313_in"
_inherit = "l10n_id.bukti_potong_pph"
_table = ... |
# -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
from inferbeddings.models import base as models
from inferbeddings.models import similarities
from inferbeddings.knowledgebase import Fact, KnowledgeBaseParser
from inferbeddings.parse import parse_clause
from inferbeddings.models.training import cons... |
import pathlib
import pkg_resources
from mopidy import config, ext, httpclient
__version__ = pkg_resources.get_distribution("Mopidy-Podcast").version
CHARTS = ["podcasts", "audioPodcasts", "videoPodcasts"]
COUNTRIES = [
"AD",
"AE",
"AF",
"AG",
"AI",
"AL",
"AM",
"AO",
"AQ",
"... |
import collections
import logging
import six
from python_jsonschema_objects import util
from python_jsonschema_objects.validators import registry, ValidationError
from python_jsonschema_objects.util import lazy_format as fmt
logger = logging.getLogger(__name__)
class ArrayWrapper(collections.abc.MutableSequence):
... |
#-*- coding: utf-8 -*-
class AddrTable(object):
TABLE_SIZE = 10000
def __init__(self, dic=False):
self.__addr = list()
self.__dic = dic
for i in xrange(AddrTable.TABLE_SIZE):
if self.__dic:
self.__addr.append(dict())
else:
self._... |
#!/usr/bin/env python
# Script to compute the PRC using LCG
#
import os
import sys
import numpy as np
import getopt
import subprocess as sub
import lcg
import time
from lcg.entities import (H5Recorder, LIFNeuron,
RealNeuron, Waveform,
Constant, ConstantFromFile,
... |
from numpy import *
from pylab import *
import matplotlib.tri
from math import atan2
vertices = loadtxt("vertices.txt")
indices = loadtxt("triangles.txt")
uImplicit = loadtxt("u_implicit.txt")
energyImplicit = loadtxt("energy_implicit.txt")
uExplicitNoCfl = loadtxt("u_explicit_no_cfl.txt")
energyExplicitNoCfl = loa... |
# ------------------------------------------------------------------------
#
# This file is part of Territory.
#
# Territory 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 ... |
import copy
import numpy
import logging
from six.moves import xrange
import theano
from theano import tensor, scalar, gof
from theano.compile import optdb
from theano.compile.ops import shape_i
from theano.gof import (local_optimizer, EquilibriumDB,
SequenceDB, Optimizer, toolbox)
from theano.g... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
vowels_to_be_replaced= {}
def replace_null(from_chr_num, to_chr_num):
for x in range(from_chr_num, to_chr_num):
vowels_to_be_replaced[chr(x)]= ""
#replace_null(0x0900, 0x0904)
#replace_null(0x093A, 0x0950)
#replace_null(0x0951, 0x0958)
#replace_nu... |
#!/usr/bin/python3
#
# Copyright (C) 2006, 2007, 2008 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
#... |
# -*- coding: utf-8 -*-
"""Pythonization of the :term:`tmux(1)` server.
libtmux.server
~~~~~~~~~~~~~~
"""
from __future__ import absolute_import, unicode_literals, with_statement
import logging
import os
from . import exc, formats
from .common import (
EnvironmentMixin,
TmuxRelationalObject,
has_gte_ver... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... |
# -*- coding: utf-8 -*-
__author__ = 'duc_tin'
import ConfigParser
import re
import sys
def ctext(text, color):
""" Add color to printed text
:type text: str
:type color: str
"""
fcolor = {'p': '\033[95m', # purple
'b': '\033[94m', # blue
'g': '\033[92m', # green
... |
from django.db import models
from api.models import Hackathon
from api.models.judging_criteria import JudgingCriteria
from api.models.judging_expo import JudgingExpo
from django.contrib import admin
from hackfsu_com.admin import hackfsu_admin
class HackQuerySet(models.QuerySet):
from api.models.judge_info import ... |
# 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 (t... |
import numpy as np
from tensorboardX import SummaryWriter
from seq2seq_summarization.globals import *
from classifier.train_classifier import get_predictions, calculate_accuracy, create_single_article_category_list
from research.train import split_category_and_article, category_from_string, evaluate
def test_accurac... |
import json
from urllib import urlencode
from social_auth.backends import BaseOAuth2, OAuthBackend
from social_auth.utils import dsa_urlopen
class AppsfuelBackend(OAuthBackend):
name = 'appsfuel'
def get_user_id(self, details, response):
return response['user_id']
def get_user_details(self, resp... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Carlos Jenkins <carlos@jenkins.co.cr>
#
# 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from string import split as L
from django.db import models
from django.utils.http import urlencode
from django.forms.models import model_to_dict
from django.contrib.auth.models import User
class PayPalNVP(models.Model):
"""Record of a NVP interaction with PayPal."""
... |
# Zulip's OpenAPI-based API documentation system is documented at
# https://zulip.readthedocs.io/en/latest/documentation/api.html
#
# This file defines the Python code examples that appears in Zulip's
# REST API documentation, and also contains a system for running the
# example code as part of the `tools/test-api` t... |
"""
https://leetcode.com/problems/prime-number-of-set-bits-in-binary-representation/
https://leetcode.com/submissions/detail/136523875/
"""
class Solution:
def countPrimeSetBits(self, L, R):
"""
:type L: int
:type R: int
:rtype: int
"""
def isPrime(n):
... |
from __future__ import absolute_import, print_function
import tarfile
import json
import yaml
import os
import errno
import requests
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import ParseError
from decanter import config
def InstallFromFile(**kwargs):
if kwargs.get('path') is None:
... |
__author__ = 'quentin'
import cv2
try:
CV_VERSION = int(cv2.__version__.split(".")[0])
except:
CV_VERSION = 2
try:
from cv2.cv import CV_CHAIN_APPROX_SIMPLE as CHAIN_APPROX_SIMPLE
from cv2.cv import CV_AA as LINE_AA
except ImportError:
from cv2 import CHAIN_APPROX_SIMPLE
from cv2 import LINE_... |
#!/usr/bin/env python
# This file is part of nexdatas - Tango Server for NeXus data writer
#
# Copyright (C) 2012-2018 DESY, Jan Kotanski <jkotan@mail.desy.de>
#
# nexdatas is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... |
"""Functional interface to graph methods and assorted utilities.
"""
# Copyright (C) 2004-2015 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
#
import networkx as nx
from networkx.utils import not_implemente... |
"""
Support for generation, use, and storage of public/private key pairs.
The :func:`pk_encrypt`, :func:`pk_decrypt`, :func:`pk_sign`, and
:func:`pk_verify` functions provide a thin interface over
:class:`Crypto.PublicKey.RSA` methods for easier use and to work around some
issues found with some keys read from ssh ``id... |
########################################################################################
## This file is a part of YAP package of scripts. https://github.com/shpakoo/YAP
## Distributed under the MIT license: http://www.opensource.org/licenses/mit-license.php
## Copyright (c) 2011-2013 Sebastian Szpakowski
#############... |
# -*- coding: utf-8 -*-
# @Author: Manuel Rodriguez <valle>
# @Date: 10-May-2017
# @Email: valle.mrv@gmail.com
# @Last modified by: valle
# @Last modified time: 17-Mar-2018
# @License: Apache license vesion 2.0
from kivy.uix.anchorlayout import AnchorLayout
from kivy.properties import ObjectProperty, StringProp... |
import traceback
import threading
from contextlib import contextmanager
import smach
__all__ = ['Container']
class Container(smach.state.State):
"""Smach container interface.
This provides an interface for hooking into smach containers. This includes
methods to get and set state, as well as provide sta... |
"""
This module defines Scripts, out-of-character entities that can store
data both on themselves and on other objects while also having the
ability to run timers.
"""
from twisted.internet.defer import Deferred, maybeDeferred
from twisted.internet.task import LoopingCall
from django.core.exceptions import ObjectDoes... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
import os
PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Admin Qualitio', 'admin@qualitio.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_PATH, 'data.sqlit... |
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import re
import logging
keywords = {
'de': {
'now': ['jetzt', 'sofort', 'nun'],
'noon': ['mittag'],
'midnight': ['mitternacht'],
'today': ["heute"],
'tomorrow': ["morgen"],
'at': ['um', 'am'],
... |
# Copyright (c) 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
from muntjac.api import VerticalLayout, Panel, Label, Button
from muntjac.ui.button import IClickListener
class PanelBasicExample(VerticalLayout, IClickListener):
def __init__(self):
super(PanelBasicExample, self).__init__()
self.setSpacing(True)
# Panel 1 - with caption
self._... |
# coding=utf-8
"""
Testing endpoint features.
"""
import unittest
import pycolo as coap
from pycolo.endpoint import Endpoint, Rule
class BasicFunctionalityTestCase(unittest.TestCase):
"""
Basic routing and endpoint testing
"""
def setUp(self):
"""
Set up a simple Endpoint. All the se... |
data = (
((0.200000, 0.700000), (0.900000, 0.700000)),
((0.000000, -1.000000), (0.000000, 0.900000)),
((0.100000, 0.700000), (0.800000, 0.700000)),
((0.000000, -0.900000), (0.000000, 1.000000)),
((0.200000, 0.600000), (0.900000, 0.600000)),
((0.100000, 0.600000), (0.800000, 0.600000)),
((0.200000, 0.500000), (0.900000,... |
#!/usr/bin/env python3
# This sample script demonstrates how to
# 1. get a list of low level categories
# 2. get a single low level category by its id
import importlib
import json
import os
import sys
sys.path.append(os.path.realpath('../modules'))
client_module = importlib.import_module('RestApiClient')
SampleUtilit... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# encfs.py
#
# Copyright 2013 Antergos
#
# 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 opti... |
# (c) 2017, Florian Engel <florian.engel@turbocache3000.de>
#
# This file is part of Slingring
#
# Slingring 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 optio... |
import time
import pytz
import datetime
UTC_TIMEZONE = pytz.timezone('UTC')
def format_pubdate(date):
# Mon, 02 Nov 2009 08:39:06 +0000
return date.astimezone(UTC_TIMEZONE).strftime(u'%a, %d %b %Y %H:%M:%S %z')
def format_isodate(date):
# 2009-11-02 09:39:06
return date.strftime(u'%Y-%m-%d %H:%M:%S'... |
# coding: utf-8
import os.path
import sys
import unittest
from pgmagick import api
from pgmagick import Image, Geometry, Blob
from utils import MACOSX_FONT
class TestCookbook(unittest.TestCase):
def setUp(self):
self.tmp_filename_jpg = "_cookbook_test.jpg"
self.tmp_filename_png = "_cookbook_test... |
"""
#########################################################
#Google Map Display Tool for E-Mission Trip/Section Data#
#########################################################
Author: En (Ryan) Lei
A library of functions that allows the user to plot GPS coordinates data via Google Maps API(pygmap).
Plots are stored ... |
"""Pattern-matching utilities"""
import dataclasses
import re
from typing import Dict, List, Optional, Union
class Operator:
"""Used as a wildcards and operators when matching message arguments
(see assertMessageMatch and match_list)"""
def __init__(self) -> None:
pass
class AnyStr(Operator):
... |
# coding: utf-8
from six.moves.urllib.parse import quote, unquote
from grab.error import GrabTooManyRedirectsError
from tests.util import BaseGrabTestCase, build_grab
def build_location_callback(url, counter):
meta = {
'counter': counter,
'url': url,
}
def callback():
if meta['co... |
# coding: utf-8
# This file is part of Supysonic.
#
# Supysonic is a Python implementation of the Subsonic server API.
# Copyright (C) 2013 Alban 'spl0k' Féron
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the F... |
# Copyright 2009-2011 Mark Fiers
# The New Zealand Institute for Plant & Food Research
#
# This file is part of Moa - http://github.com/mfiers/Moa
#
# Licensed under the GPL license (see 'COPYING')
#
"""
**sgeActor** - Run jobs through SGE
-----------------------------------------------------------
"""
import os
impor... |
"""
Django settings for url_condenser project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import... |
"""
Tests for fine uploader integration
"""
# Django
from django.test import RequestFactory, TestCase
from django.urls import reverse
# Standard Library
import json
# Third Party
from nose.tools import assert_false, eq_
# MuckRock
from muckrock.core.factories import UserFactory
from muckrock.fine_uploader import vi... |
"""
KeepNote
Insert date extension
"""
#
# KeepNote
# Copyright (c) 2008-2009 Matt Rasmussen
# Author: Matt Rasmussen <rasmus@mit.edu>
#
# 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 Foundat... |
import os
import transaction
from zope.sqlalchemy import ZopeTransactionExtension
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, UnicodeText, Boolean, DateTime
from datetime impo... |
import hashlib
from rest_framework.generics import ListCreateAPIView, UpdateAPIView, ListAPIView, RetrieveAPIView, CreateAPIView
from django.core.cache import caches
from rest_framework.response import Response
from substitutes.models import Session, SessionEvent, Sub
from accounts.models import CustomUser
from teams.... |
"""Module containing python functions, which generate first order Redfield kernel.
For docstrings see documentation of module neumann1."""
import numpy as np
import itertools
from ...wrappers.mytypes import doublenp
from ...wrappers.mytypes import complexnp
from ..aprclass import Approach
from .neumann1 import Ap... |
# Made by Mr. - Version 0.3 by DrLecter
import sys
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
GOLEM_HEARTSTONE = 1346
BROKEN_HEARTSTONE = 1365
ADENA = 57
class Quest (JQuest) :
... |
import sys
from _pytest.terminal import TerminalReporter
import pytest
__version__ = '0.2'
__releasedate__ = '20150826'
class WholeNodeIDTerminalReporter(TerminalReporter):
def _getfailureheadline(self, rep):
if hasattr(rep, 'location'):
fspath, lineno, domain = rep.location
# U... |
# -*- coding: utf-8 -*-
import logging
from importlib import import_module
from sqlalchemy import orm, create_engine
from sqlalchemy.orm.query import Query
def multidb_binds(databases, package=None, engine_params=None):
'''Creates dictionary to be passed as `binds` parameter to
`sqlalchemy.orm.sessionmaker()... |
# -*- coding: utf-8 -*-
from docpool.users import DocpoolMessageFactory as _
from docpool.users.interfaces import IDocPoolUsersLayer
from plone.app.users.browser.account import AccountPanelSchemaAdapter
from plone.app.users.browser.personalpreferences import PersonalPreferencesPanel
from plone.autoform import directive... |
#!/usr/bin/env python
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="samil",
version="2.1.0",
author="Maarten Visscher",
author_email="mail@maartenvisscher.nl",
description="Samil Power inverter tool",
long_description=long_descrip... |
"""
This module contains code for handling dependency graphs.
"""
# vim: noet:ts=4
import logging
msg = logging.getLogger (__name__)
import os.path
import subprocess
import rubber.contents
from rubber.util import _
class MakeError (Exception):
def __init__ (self, msg, errors):
super (MakeError, self).__in... |
#!/usr/bin/env python
# List our containers. Note: this only works with docker-compose containers.
from __future__ import print_function
from collections import defaultdict
import json
#
# Manage different docker libraries
#
try:
from docker import Client
except ImportError:
from docker import APIClient as C... |
#!/usr/bin/env python
# Copyright 2016-2017 Workonline Communications (Pty) Ltd. All rights reserved.
#
# The contents of this file are 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://... |
# /usr/bin/env python
'''
Written by Kong Xiaolu and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
'''
import os
import numpy as np
import torch
import CBIG_pMFM_basic_functions_main as fc
import warnings
def CBIG_mfm_test_desikan_main(gpu_index=0):
'''
This function is ... |
# -*- coding: utf-8 -*-
import json
from django.db.models import Q
from rest_framework import status
from rest_framework import mixins
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.decorators import list_route
from app.podcast import filters
from app.podcast.mod... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013, John McNamara, jmcnamara@cpan.org
#
import unittest
import os
from ...workbook import Workbook
from ..helperfunctions import _compare_xlsx_files
class TestCompareXLSXFiles(unittest.TestC... |
'''
Default entity collection implementation
'''
import sys
import re
class BaseCollection(list):
def __init__(self, entities=None):
list.__init__(self)
if entities is not None:
self.extend(entities)
def extend(self, entities):
for e in entities:
self.append(e)... |
from ReportGenerator.Top_ReportGenerator import Top_ReportGenerator
from ReportGenerator.Geom import Geom
import logging
log = logging.getLogger(__name__)
class Charges(Top_ReportGenerator):
def __init__(self,we,parsed):
self.Q = list()
super().__init__(we,parsed)
def prepare_for_report(self... |
# 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... |
# -*- coding: utf-8 -*-
#
# slides documentation build configuration file, created by
# sphinx-quickstart on Wed Jul 1 21:05:39 2015.
#
# 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.
#
# Al... |
"""
UN Flag
-------
A demonstration of the power of Matplotlib combined with cartopy's Azimuthal
Equidistant projection to reproduce the UN flag.
"""
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
from matplotlib.patches import PathPatch
import matplotlib.path
import mat... |
# TODO: don't use round
from __future__ import division
from sympy.mpmath import *
# XXX: these shouldn't be visible(?)
LU_decomp = mp.LU_decomp
L_solve = mp.L_solve
U_solve = mp.U_solve
householder = mp.householder
improve_solution = mp.improve_solution
A1 = matrix([[3, 1, 6],
[2, 1, 3],
... |
import io
import random
import string
import textwrap
import pytest
import numpy as np
import pandas as pd
import validate_docstrings
validate_one = validate_docstrings.validate_one
class GoodDocStrings:
"""
Collection of good doc strings.
This class contains a lot of docstrings that should pass the va... |
import sys
sys.path.append('..')
from chowdren.shaders import SHADERS
from mmfparser.gperf import get_hash_function
from chowdren.common import get_method_name, get_base_path
from chowdren.codewriter import CodeWriter
import os
def write_shader_param():
header = CodeWriter(os.path.join(get_base_path(), 'shaderpara... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from glob import glob
from vlpp.utils import add_suffix, nfmap2dict, warn, run_shell, gzipd, run_matlab, TPL_PATH
from vlpp.registration import applyWarpImageMultiTransform, estimatePet2Anat
def main():
transitional = "${transitional}"
mode = "${config... |
import logging
import urllib.parse
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.shortcuts import redirect
from .apps import app_settings, env_settings
from .parser import Parser
logger = logging.getLogger('aplus.shibboleth')
class ShibbolethAuthB... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2006 ACYSOS S.L. (http://acysos.com)
# Pedro Tarrafeta <pedro@acysos.com>
# Copyright (c) 2008 Pablo Rocandio. All Rights Res... |
# -*- 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):
# Adding unique constraint on 'SectionLayout', fields ['slug']
db.create_unique('storybase_story_sectionlayo... |
"""Http related parsers and protocol."""
import collections
import functools
import http.server
import itertools
import re
import string
import sys
import zlib
from wsgiref.handlers import format_date_time
from aiopy.required import aiohttp
from aiopy.required.aiohttp import hdrs, errors
from .multidict import CIMul... |
# -*- coding: utf-8 -*-
import logging
import pdb
from collections import OrderedDict
from StringIO import StringIO
from lxml import etree
logger = logging.getLogger(__name__)
class PresetParser():
types = {
'node': 'point',
'way': 'line',
'area': 'polygon',
'closedway': 'polygo... |
# In the 20×20 grid below, four numbers along a diagonal line have been marked in red.
#
# 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
# 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
# 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
# 52 70 95 23 04 60 11 42 69 24 68 56 01 32 5... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.md').read()
setup(
name='irccrypt',
... |
#!/usr/bin/env python
#
# SPI example (using the STM32F407 discovery board)
#
import sys
import time
import ctypes
from silta import stm32f407
def bytes_to_int(byte_list):
num = 0
for byte in range(len(byte_list)):
num += byte_list[byte] << ((len(byte_list) - 1 - byte) * 8)
return num
class MA... |
#!/usr/bin/python
# -*- coding: utf8 -*-
from bs4 import BeautifulSoup as Soup
import urls
import re
import proxy
import functions
def subject_list ( start, end, school_id ):
increase = 1
subjects = []
cards = []
for code in range(0, end-start+1):
cards.append(start + (code*increase))
for code in cards:
u... |
from __future__ import absolute_import
import os
path = os.path
from random import randrange
from myhdl import *
from myhdl.conversion import verify, analyze
from myhdl import ConversionError
from myhdl.conversion._misc import _error
def ForLoopError1(a, out):
@instance
def logic():
while 1:
... |
import numpy
def Area(a, b, c):
v = numpy.cross(b-a,c-a)
return numpy.sqrt(numpy.dot(v,v))*0.5
class OctaMapSamp:
def __init__(self):
self.size = 0
self.dir = None
self.dirrot = None
self.weight = None
def nsamp(self):
return len(self.dir)
def DuplicateT... |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
def fileformatting():
import re
errorlog = open("error_log.txt","w+", encoding = "UTF8")
for x in range(1,1015):
try:
#please change this number
f = open(str(x)+".txt", "r+", encoding ... |
#!/usr/bin/python
# (c) 2018 Jim Hawkins. MIT licensed, see https://opensource.org/licenses/MIT
# Part of Blender Driver, see https://github.com/sjjhsjjh/blender-driver
"""Python module for the Blender Driver diagnostic.
This module contains analytical utilities that are used in some diagnostic and
demonstration Blend... |
import os
import sys
from setuptools import setup, find_packages
py_version = sys.version_info[:2]
if py_version < (3, 3):
raise Exception("websockets requires Python >= 3.3.")
here = os.path.abspath(os.path.dirname(__file__))
NAME = 'creds'
with open(os.path.join(here, 'README.rst')) as readme:
README = re... |
# -*- coding: UTF-8 -*-
import sys
import emoji
import mysql.connector
from extracao.rsoservices.config import config
from extracao.rsoservices.emoji_dict import emoticon_dict
from extracao.rsoservices.preprocessing_dict import EMOJI_CARACTER
add_message_table0 = ("INSERT INTO extracao_processamento_twee... |
"""
Support for Z-Wave climate devices.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/climate.zwave/
"""
# Because we do not compile openzwave on CI
# pylint: disable=import-error
import logging
from homeassistant.components.climate import DOMAIN
from h... |
# Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... |
# BurnMan - a lower mantle toolkit
# Copyright (C) 2012, 2013, Heister, T., Unterborn, C., Rose, I. and Cottaar, S.
# Released under GPL v2 or later.
"""
SLB_2011_ZSB_2013
^^^^^^^^^^^^^^^^^
Minerals from Stixrude & Lithgow-Bertelloni 2011, Zhang, Stixrude & Brodholt 2013, and references therein.
"""
import burnman.... |
#!/usr/bin/env python
import glfw
import OpenGL.GL as gl
import OpenGL.GLU as glu
window_width = 640
window_height = 480
def main():
# Initialize the library
if not glfw.init():
return
# Create a windowed mode window and its OpenGL context
window = glfw.create_window(window_width, window_heig... |
#!/usr/bin/env python
# -*- coding: ascii -*-
import urwid
class SelText(urwid.Text):
"""A selectable text widget. See urwid.Text."""
def selectable(self):
return True
def keypress(self, size, key):
return key # don't handle any keys
class JKListbox(urwid.ListBox):
"""Listbox that also scrolls its... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# Note: Remember to use orm['appname.ModelName'] rather than "from appname.mo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.