src stringlengths 721 1.04M |
|---|
# Author: Marcelo Huerta San Martin
# Contact: richieadler@users.sourceforge.net
# Revision: $Revision: 3189 $
# Date: $Date: 2005-04-08 05:05:45 +0200 (Fri, 08 Apr 2005) $
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read... |
import asyncio
import datetime
import os
import traceback
import markovify
from NintbotForDiscord.Enums import EventTypes
from NintbotForDiscord.Events import MessageSentEvent
from NintbotForDiscord.Plugin import BasePlugin
class DiscordMarkov(BasePlugin):
def __init__(self, manifest, bot_instance):
sup... |
# -*- coding: utf-8 -*-
import datetime
from flask import current_app
from purchasing.extensions import db
from purchasing.notifications import Notification
from purchasing.jobs.job_base import JobBase, EmailJobBase
from purchasing.opportunities.models import Opportunity, Vendor, Category
from purchasing.public.mode... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: stock_min.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _ref... |
import subprocess
import shutil
from PIL import Image
from tsparser.utils import StatisticDataCollector
PARAMS = {
'pto_gen': (),
'cpfind': ('--multirow',
'--celeste' # Ignore clouds
),
'cpclean': (),
'linefind': (),
'autooptimiser': ('-a', # Auto align
... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 21 20:34:20 2016
%reset -f
%pylab
%clear
%load_ext autoreload
%autoreload 2
@author: isaac
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import plots
reload(plots)
from plots import bmap, rcj, tl, tickout, four_plot
# %% Get some colors... |
#!/usr/bin/env python2
# -----------------------------------------------------------------------------
# @brief:
# Several Walkers
# @author:
# Tingwu (Wilson) Wang, Nov. 22nd, 2017
# -----------------------------------------------------------------------------
import numpy as np
from gym import utils
... |
from unittest import TestCase
from evaluation.top_n_evaluator import TopNEvaluator
__author__ = 'fpena'
ratings = [
{'user_id': 'U1', 'business_id': 'I1', 'stars': 5.0, 'text': 'review U1:I1'},
{'user_id': 'U1', 'business_id': 'I2', 'stars': 4.0, 'text': 'review U1:I2'},
{'user_id': 'U1', 'business_id': ... |
from __future__ import print_function
import sys
try:
from subprocess import check_output
def execute(lt):
return check_output(lt)
except Exception:
from subprocess import Popen
from subprocess import PIPE
def execute(lt):
p = Popen(lt, stdout=PIPE)
result = ""
... |
'''
Coordinates drag and drop, which crosses controls.
!!! Note that all event coords are in the device coord system.
TODO not a class, just a singleton module
'''
'''
Copyright 2010, 2011 Lloyd Konneker
This file is part of Pensool.
Pensool is free software: you can redistribute it and/or modify
it under the terms... |
import os
import filecmp
import shutil
import tempfile
import unittest as unittest0
try:
unittest0.skipUnless
unittest0.skip
except AttributeError:
import unittest2 as unittest
else:
unittest = unittest0
del unittest0
import uuid
import win32file
from winsys import fs
from winsys.tests import utils
def _test... |
# -*- coding: utf-8 -*-
"""
Setting for production env
:copyright: (c) 2013 by Openlabs Technologies & Consulting (P) Limited
:license: see LICENSE for more details.
"""
#Flake8: noqa
from common import *
STATIC_ROOT = '/opt/pursuite/www/static'
MEDIA_ROOT = '/opt/pursuite/www/media'
ALLOWED_HOSTS = ['pur... |
import re
import os
import sys
from Bio import Seq
from Bio import SeqIO
import pandas as pd
import itertools
import numpy as np
import random
import subprocess as sub
def get_least_gaps_seq(seq_dict,length,side='left'):
middle = length/2
min_gaps = length
min_key = ''
# for all sequences check number of gaps in ... |
#!/usr/bin/python2.7
import unittest
import config
from time import sleep
class RouterLlsec(config.scenarios, unittest.TestCase):
def modeSetUp(self):
config.security_layer=1
self.support.backbone.prefix=config.eth_prefix
self.support.wsn.prefix=config.wsn_prefix
self.br = self.sup... |
# -*- coding: utf-8 -*-
"""
flaskbb.auth.forms
~~~~~~~~~~~~~~~~~~
It provides the forms that are needed for the auth views.
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
from flask_wtf import Form
from wtforms import (StringField, PasswordField, Boolean... |
# Copyright 2015 Nicta
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... |
# Copyright 2020 The TensorFlow Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
from datetime import timedelta
import pytest
from django.utils.timezone import now
from pretix.base.models import Event, Organizer
@pytest.fixture
def env():
o = Organizer.objects.create(name='MRMCD e.V.', slug='mrmcd')
event = Event.objects.create(
organizer=o, name='MRMCD2015', slug='2015',
... |
#!/usr/bin/env python
import rospy
from std_msgs.msg import String
#from std_msgs.msg import UInt16
from std_msgs.msg import Int32
import time
from pyfirmata import Arduino
on_hardware = True # whether we are running this node on the actual car (so it can access the IO board)
wheelpin = 5 # to which pin on the IO shel... |
''' pydevd - a debugging daemon
This is the daemon you launch for python remote debugging.
Protocol:
each command has a format:
id\tsequence-num\ttext
id: protocol command number
sequence-num: each request has a sequence number. Sequence numbers
originating at the debugger are odd, sequence numbers ori... |
from django.conf import settings
from storages.backends.s3boto import S3BotoStorage
"""
Store your static and media files on Amazon S3 easily.
Example settings config:
AWS = {
'STATIC': {
'location': 'static', # AWS_LOCATION
'querystring_auth': False, # AWS_QUERYSTRING_AU... |
import os
import sys
from pathlib import Path
from importlib import import_module
from pkg_resources import load_entry_point, get_entry_info, iter_entry_points
from geonature.utils.utilstoml import load_and_validate_toml
from geonature.utils.config_schema import ManifestSchemaProdConf
from geonature.utils.env import G... |
"""Tests for PROPKA stream io"""
import logging
from pathlib import Path
from io import StringIO
import pytest
from propka.parameters import Parameters
from propka.molecular_container import MolecularContainer
from propka.input import read_parameter_file, read_molecule_file
from propka.lib import loadOptions
from .tes... |
"""
A testcase for MySQLConnection.
"""
import proof.driver.MySQLConnection as MySQLConnection
import proof.driver.MySQLCursor as MySQLCursor
import proof.driver.MySQLDictCursor as MySQLDictCursor
import unittest
class testMySQLConnection(unittest.TestCase):
def setUp(self):
self.__host = 'localh... |
##########################################################################
#
# Copyright (c) 2007-2013, Image Engine Design 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:
#
# * Redis... |
#%%
import xlrd
import itertools
import os
import pandas as pd
def combine_paths(directory, files):
return (os.path.join(directory, filename) for filename in files)
def get_excel_for_district(district_path):
files = os.walk(district_path)
files_per_directory = [combine_paths(walk[0],walk[2]) fo... |
"""
# Majic
# Copyright (C) 2014 CEH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This pr... |
# -*- coding: utf-8 -*-
#
# Copyright(c) 2010 poweredsites.org
#
# 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... |
# -*- coding: utf-8 -*-
from Plugins.Extensions.MediaPortal.plugin import _
from Plugins.Extensions.MediaPortal.resources.imports import *
class nhlGenreScreen(MPScreen):
def __init__(self, session):
self.plugin_path = mp_globals.pluginPath
self.skin_path = mp_globals.pluginPath + mp_globals.skinsPath
path =... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import web
import os
from socorro.webapi.classPartial import classWithPartialInit
from configman import Namespace, Req... |
import os
import sys
from unittest import TestCase
from pkg_resources import DistributionNotFound
from apsconnectcli.apsconnect import (
GITHUB_RELEASES_PAGE,
bin_version,
get_version,
get_latest_version,
main,
APSConnectUtil,
)
if sys.version_info >= (3,):
from unittest.mock import patch... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# ---------------------------------------------------------------------------
# ___ __ ___ ___ ____ ____ __
# | \ | \ | | / | | | \ Automatic
# |__/ |__/ | | | |__ |__ | | Conference
# | |\... |
import random, sys, os, re
if len(sys.argv) != 6:
print "Invalid number or arguments for %s." % sys.argv[0]
sys.exit(1)
IDFilePath = sys.argv[1]
ClassFilePath = sys.argv[2]
Prefix = sys.argv[3]
OutFilePath = sys.argv[4]
NumPermutations = sys.argv[5]
Method = sys.argv[6]
if not os.path.exists(IDFilePath):
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-07 20:07
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('flocks', '0004_auto_20170228_2038'),
]
operations ... |
#!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
import time
from geocoder.base import Base
from geocoder.keys import google_key
# todo: Paging (pagetoken) is not fully supported since we only return the first result. Need to return all results to the user so paging will make sense
# todo: Add... |
from chargify_settings import CHARGIFY, CHARGIFY_CC_TYPES
from datetime import datetime
from decimal import Decimal
from django.contrib.auth.models import User
from django.db import models
from django.utils.datetime_safe import new_datetime
from pychargify.api import ChargifyNotFound
import logging
import time
import t... |
#!/usr/bin/env python2
# -----------------------------------------------------------------------------
# @author:
# Tingwu Wang, Jun 23rd, 2017
# -----------------------------------------------------------------------------
import init_path
from util import logger
from . import mujoco_parser
import numpy as n... |
import pytest
import json
from velstor.restapi import Session
from velstor.pcapi import Workspace
from velstor.pcapi import RESTException
def test_as_json():
"""Tests whether the Workspace JSON representation is valid JSON"""
w = Workspace('session')
json.loads(w.json)
def test_get_well_known_workspace(... |
from django.contrib.auth import authenticate
from django.utils.translation import gettext_lazy as _
from rest_framework import exceptions, serializers
from .settings import api_settings
from .state import User
from .tokens import RefreshToken, SlidingToken, UntypedToken
class PasswordField(serializers.CharField):
... |
# Copyright 2015-2017 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
# a small URL shortening service
import psycopg2 # if we want to persistent strorage on heroku
from flask import Flask, request, Response, g, redirect, url_for, abort, render_template
from contextlib import closing
import os
import urlparse
import appconfig
import shortenid
APPSETTINGS_ENVVAR = 'SUMMER_APP_CONFIG'
... |
#!/usr/bin/env python
#
# Copyright 2014 The Oppia 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... |
# Copyright (c) 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.
import json
from telemetry.page import page_benchmark
# Test how long Chrome takes to load when warm.
class PerfWarm(page_benchmark.PageBenchmark):
d... |
from django.shortcuts import render
from django.http import HttpResponse
from blog.models import Post, Comment
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
def archive(request):
all_posts = Post.objects.all();
context = {}
context['posts'] = all_p... |
#!/usr/bin/env python
__author__ = "Justin Kuczynski"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Justin Kuczynski"]
__license__ = "GPL"
__version__ = "1.8.0-dev"
__maintainer__ = "Justin Kuczynski"
__email__ = "justinak@gmail.com"
"""takes as input alpha diveristy files, format:
file: one rar... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... |
#This file is now part of the main Bareos repo. Do not use this version, use the package bareos-filedaemon-python-plugin instead
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Baseclass for Bareos python plugins
# Functions taken and adapted from bareos-fd.py
# (c) Bareos GmbH & Co. KG, Maik Aussendorf
# AGPL v.3
... |
"""
Django settings for vinocave project.
Generated by 'django-admin startproject' using Django 1.11.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import o... |
from abc import ABCMeta, abstractmethod
import numpy as np
from scipy.constants import e, m_p
def gaussian_generator(eps_geo, phase_space_tuple=('x', 'xp'), alpha=0, beta=1):
sigma = np.sqrt(eps_geo)
def generate(bunch):
n_macroparticles = bunch.n_macroparticles
x = np.random.normal(scale=s... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-18 07:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('snippets', '0011_auto_20170917_2103'),
]
operations = [
migrations.AlterFie... |
"""
给定一个数字,我们按照下面规则将其翻译成字符串:
0翻译成"a",1翻译成"b",...25翻译成"z",一个数字可能有多种翻译,比如
12258有5种不同的翻译,分别是"bccfi","bwfi","bczi","mcfi"和"mzfi",
求给定一个数字它的翻译方法有多少种?
思路:
套路就是求以每个位置结尾的情况有多少种翻译方式,可以通过动态规划求解
dp[i] = dp[i-1] + tmp(tmp=dp[i-2]当num_str[index-1:index+1]可以
被翻译成合法的字符,否则tmp为0)
"""
class Num2Str:
def get_total_res(self, num):
... |
""" A neural network trainer with various options: rmsprop, nerterov, momentum etc.
This trainer is used for multiple types of neural nets: dbns and cnns and it is designed
to be adaptable to other types of networks as well.
"""
__author__ = "Mihaela Rosca"
__contact__ = "mihaela.c.rosca@gmail.com"
import numpy as np... |
# -*- coding: utf-8 -*-
"""
eww.quitterproxy
~~~~~~~~~~~~~~~~
QuitterProxy is a :py:class:`threading.local`-based proxy used to override
the normal quit behavior on demand. It is very similar to IOProxy, but
rather than proxying files, it proxies Quitter objects. We need to do this
so calling... |
import datetime
import json
from pprint import pprint
import requests
class Sensor():
"""Abstract sensor class."""
def __init__(self, uuid):
"""Initialisation."""
# find a way to get a stable name
self.uuid = uuid
def save_measure(self):
"""How to save a ne... |
# Copyright (c) Mathias Kaerlev 2012.
# This file is part of Anaconda.
# Anaconda is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# ... |
import unittest, sys
from ctypes.test import xfail
class SimpleTypesTestCase(unittest.TestCase):
def setUp(self):
import ctypes
try:
from _ctypes import set_conversion_mode
except ImportError:
pass
else:
self.prev_conv_mode = set_conversion_mode... |
# -*- coding: utf-8 -*-
#
# django-quick-reports documentation build configuration file, created by
# sphinx-quickstart on Sun Jul 12 09:08:52 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
# autogenerate... |
#!/usr/bin/python3
# Python gopytranslte
# Author : namakukingkong
# Site : namakukingkong[dot]kandangbuaya[dot]com
# Email : namakukingkong[at]gmail[dot]com
# dependency : linux,windows, python3, internet
# gopytranslte
# .....|___gopytranslte.py
# .....|___log-translate.txt
# $mkdir gopytranslte
# $cd gop... |
from __future__ import absolute_import, unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils.text import slugify
from wagtail.tests.utils import WagtailTestUtils as WagtailTestUtils
from wagtail.wagta... |
from django.shortcuts import get_object_or_404, redirect
from django.views import generic
from django.core.urlresolvers import reverse, reverse_lazy
from django.core.exceptions import ObjectDoesNotExist
from django import http
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
f... |
# # -*- coding: utf-8 -*-
import numpy as np
from . import _smmprod
def smmprod_c(A, B, Omega):
# out wird hier preallocated, kann in Schleifen dann wiederverwendet werden
out = np.zeros(Omega[0].shape[0])
_smmprod.smmprod(A, B, Omega, out)
return out
# def smmprod(A, B, Omega):
# A_rows = A[Omeg... |
# Generated by YCM Generator at 2017-02-03 10:06:47.051388
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publis... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
import unittest
from iptest import is_cli, long, run_test
class BoolTest(unittest.TestCase):
def test_type... |
# Subunit handling
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2014
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later vers... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
RasterLayerHistogram.py
---------------------
Date : January 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
*****************... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import os
import uuid
from api import api, GlobalError
from flask import request, Response
from model.image import Image as Image_model
from server import db
from util.jsonResponse import jsonSuccess, jsonError
from config import UPLOAD_PATH
from werkzeug.utils import secu... |
"""This module contains test for KeyValue helpers with canonical paths
and blockSize set to 0."""
__author__ = "Bartek Kryza"
__copyright__ = """(C) 2019 ACK CYFRONET AGH,
This software is released under the MIT license cited in 'LICENSE.txt'."""
from test_common import *
from common_test_base import *
from posix_... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# -*- coding: utf-8 -*-
# @Author: Zachary Priddy
# @Date: 2016-04-11 09:54:21
# @Last Modified by: Zachary Priddy
# @Last Modified time: 2016-10-17 22:11:21
#
#
# 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... |
# Copyright 2014
# The Cloudscaling Group, 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 or agreed ... |
#!/usr/bin/env python
from contextlib import contextmanager
import argparse
import sys
import sshtunnel
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from fermi_blind_search.configuration import get_config
from fermi_blind_search import myLoggi... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
slope.py
---------------------
Date : October 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*******************... |
#
# Copyright 2017 Russell Smiley
#
# This file is part of timetools.
#
# timetools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
MAIL_SERVER = 'smtp.126.com'
MAIL_PORT = 25
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get('MAIL_USERNAME') ... |
import bpy
from bpy.types import Menu, Panel
from bpy.props import *
import os
import sys
import subprocess
import ast
script_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(script_dir)
# Get system's python path
proc = subprocess.Popen('python3 -c "import sys; prin... |
from PIL import Image
from resources import common
import settings
class SnapshotGenerator:
def __init__(self, base_available_snapshot_image, skeleton, bid_image=None,
base_unavailable_snapshot_image=None):
# Initialize objects
self.elements_skeleton = BaseElementsSkeleton(skeleto... |
# coding: utf-8
import xlrd
import time
import random
import types
import xlsxwriter
from StringIO import StringIO
from girlfriend.util.lang import (
args2fields,
SequenceCollectionType
)
from girlfriend.data.table import AbstractTable
from girlfriend.plugin.data import AbstractDataReader
class ExcelReaderPl... |
#******************************************************************************
# Eurecom OpenAirInterface
# Copyright(c) 1999 - 2013 Eurecom
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by ... |
#
# Copyright (c) 2015 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
from rest_framework import mixins
from rest_framework import viewsets
from pdc.apps.common import viewsets as common_viewsets
from pdc.apps.auth.permissions import APIPermission
from . import filters
from . imp... |
#!/usr/bin/env python
import sys
import csv
import math
def parseSlice(s):
if "-" in s:
parts = s.split("-")
return slice(int(parts[0]) - 1, int(parts[1]))
else:
p = int(s)
return slice(p-1, p)
class SimpleDiff():
filename = None
outfile = "/dev/stdout"
labels = No... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
# =============================================================================
# DOCS
# =============================================================================
__doc__ = """Make band merges difference and union."""
__version... |
#Flask imports
from flask import Blueprint, render_template, flash, redirect, url_for, abort
from flask.ext.login import LoginManager, login_required, logout_user, login_user
#App imports
from app import app
from app.mod_auth.forms import LoginForm, UserForm, EmailForm, PasswordForm
from app.mod_auth.models import Use... |
"""Subscribes users to the EFF newsletter."""
import logging
import requests
import zope.component
from certbot import constants
from certbot import interfaces
logger = logging.getLogger(__name__)
def handle_subscription(config):
"""High level function to take care of EFF newsletter subscriptions.
The us... |
# -*- coding: utf-8 -*-
## Ranking of records using different parameters and methods.
## This file is part of Invenio.
## Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
#... |
#Copyright ReportLab Europe Ltd. 2000-2017
#see license.txt for license details
#history https://hg.reportlab.com/hg-public/reportlab/log/tip/src/reportlab/platypus/paraparser.py
__all__ = ('ParaFrag', 'ParaParser')
__version__='3.5.20'
__doc__='''The parser used to process markup within paragraphs'''
import string
imp... |
import copy
cards = [[0, 'Q'], [2, '6'], [1, 'K'],
[1, '8'], [2, '10'], [2, '4'],
[3, '4'], [0, '4'], [1, '3'],
[2, '5'], [0, 'K'], [3, 'A'],
[1, 'J'], [0, '3'], [0, '9']]
def cardTypeAsInt( card ):
if card[1].isdigit():
return int(card[1])
if card[1] == "J":
... |
import os
from time import sleep
from django.shortcuts import render
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework import status
import requests
import json
from hotels.zomat import Zomat
from hotels.fb import FB
from hotels.models import Postbacks
@api... |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 30 10:54:21 2017
@author: ishort
"""
#plotting:
import matplotlib
import matplotlib.pyplot as plt
#%matplotlib inline
import pylab
#General file for printing ad hoc quantities
#dbgHandle = open("debug.out", 'w')
#Get the data
dataPath = "SolFluxAtlas20... |
#
# Copyright 2013 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 by applicable law or agreed to in writing, ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-01-17 19:04
from __future__ import unicode_literals
import caching.base
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('people', '0002_person_photo'),
]
... |
import discord
import asyncio
import random
import steam
from steam.steamid import SteamId
from steam.steamprofile import SteamProfile
from steam.steamaccountuniverse import SteamAccountUniverse
from steam.steamaccounttype import SteamAccountType
from discord.ext import commands
from utils import checks
from mods.cog i... |
# blaplay, Copyright (C) 2012 Niklas Koep
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distribut... |
#
# Copyright (C) 2012 - Marcus Dillavou
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope ... |
#!/usr/bin/env python
# Copyright NumFOCUS
#
# 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.txt
#
# Unless required by applicable law or ... |
# coding=utf-8
"""archive.py - Archive handling (extract/create) for Comix."""
from __future__ import absolute_import
import cStringIO
import os
import re
import sys
import tarfile
import threading
import zipfile
import gtk
try:
from py7zlib import Archive7z
except ImportError:
Archive7z = None # ignore it.... |
# -*- coding: utf-8 -*-
import os
import json
import tempfile
import unittest
from .collection import TaskCollection
from subprocess import check_output, CalledProcessError
class TaskCollectionTest(unittest.TestCase):
def _create_db(self, **kwargs):
temp = tempfile.NamedTemporaryFile(prefix='onetasktest... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
from axiom import attributes, errors, item, store
from datetime import timedelta
from epsilon import extime
from twisted.trial import unittest
from maxims import creation
class SimpleItem(item.Item):
activations = attributes.integer(default=0)
def activate(self):
self.activations += 1
def _get... |
"""
REST API for connections.
Author: Henrik Thostrup Jensen <htj@nordu.net>
Copyright: NORDUnet (2015)
"""
import time
import json
from twisted.python import log
from twisted.internet import defer
from twisted.web import resource, server
from opennsa import nsa, error, state, constants as cnt, database
from openns... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.