src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
from __future__ import with_statement
import os, sys
scintillaDirectory = os.path.join("..", "..", "scintilla", "include")
sys.path.append(scintillaDirectory)
import Face
def cell(s):
return "<td>%s</td>" % s
def faceFeatures(out):
out.write("<h2>Scintilla key commands</h2>\... |
#!/usr/bin/python
import PeakCounter
import unittest
import random
import time
class PeakCounterTest(unittest.TestCase):
def setUp(self):
self.PC = PeakCounter.PeakCounter()
def test_construct(self):
self.assertIsInstance(self.PC, PeakCounter.PeakCounter)
def test_initnumpeaks(self):
... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... |
"""
Tests for the distance module.
"""
import os
from nose.tools import *
from wiggelen.distance import distance
from wiggelen.index import INDEX_SUFFIX, clear_cache
DATA_DIR = os.path.join(os.path.dirname(__file__), 'data')
def open_(filename, mode='r'):
"""
Open a file from the test data.
"""
... |
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.dialects import postgresql
from geoalchemy2 import Geometry
from sqlalchemy import func, ForeignKey, PrimaryKeyConstraint, event, Sequence
from sqlalchemy.schema import DropTable
from sqlalchemy.ext.compiler import compiles
import flask_login
from datetime import ... |
import json
from app.authorities import CODES
from requests import get
import xmltodict
class Entity:
def __init__(self, data):
self.data = data
self.properties = self._build_properties()
self.labels = self._build_labels()
def _build_properties(self):
raise NotImplemented
... |
import os
import shutil
import json
import yaml
import zipfile
import re
from flask import (render_template, current_app)
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import (UserMixin, AnonymousUserMixin)
from werkzeug.security import (generate_password_hash, check_password_hash)
from sqlalchemy.e... |
#!/usr/bin/env python
import unittest
import io
from src.ipr import read_ipr
class TestIPR(unittest.TestCase):
def setUp(self):
self.ipr_file = io.StringIO(\
'm.98281\tc95b0824ccd627403aa63f9e474649cc\t7571\tSuperFamily\tSSF48726\t5997\t6096\t6.42E-13\tT\t04-04-2014\n\
m.98281\tc95b0824ccd627403a... |
from app import application as app
import app.protobufs.decisiontrees_pb2 as pb
from flask.ext.pymongo import PyMongo
from protobuf_to_dict import protobuf_to_dict
import fake_data
import json
import unittest
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
app.config['TEST_DBNAME'] = 'ui_test'
... |
# -*- coding: utf-8 -*-
from collections import OrderedDict
import itertools
import functools as ft
import logging
import threading
from cairo_helpers.surface import flatten_surfaces
from logging_helpers import _L
from pygtkhelpers.ui.views.shapes_canvas_view import GtkShapesCanvasView
from pygtkhelpers.utils import g... |
"""Node (User) Class for Paxos Calendar."""
import os
import sys
import time
import thread
import pickle
import socket
import logging
from Bully import bully_algorithm
from Appointment import Appointment
from Calendar import Calendar
from Proposer import Proposer
from Acceptor import Acceptor
class Node(object):
... |
#!/usr/bin/env python3
'''
ParamAP.py (parametrization of sinoatrial myocyte action potentials)
Copyright (C) 2018 Christian Rickert <christian.rickert@ucdenver.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 ... |
'''
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 this ... |
from __future__ import unicode_literals
from django.db import models
from django.contrib.postgres.fields import ArrayField
from django.contrib.postgres.fields import JSONField
class AudioSnippet(models.Model):
audio = models.FileField(upload_to='audioparts/%Y-%m-%d')
# Predictions: each item in the list is a... |
import os
# directories and so on
basedir = os.path.abspath(os.path.dirname(__file__))
DB_DIRECTORY=os.path.join(basedir,'app/database')
DB_NAME='biblio.db'
# stuff for Flask
WTF_CSRF_ENABLED = True
from sensible_config import SECRET_KEY
# formats, etc
DATETIME_STR_FORMAT = '%Y-%m-%d %H:%M:%S'
SHORT_DATETIME_STR_FO... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
# Copyright (C) 2011-today Synconics Technologies Pvt. Ltd. (<http://www.synconics.com>)
#
# Th... |
"""
Module containing NFC bounding interval annotator, version 1.0.
An NFC bounding interval annotator sets values for the `Call Start Index`
and `Call End Index` annotations for a clip containing a nocturnal flight
call (NFC). If the annotations already exist their values are overwritten,
and if they do not already e... |
# -*- coding: UTF-8 -*-
# Copyright (C) 2005-2008 Juan David Ibáñez Palomar <jdavid@itaapy.com>
# Copyright (C) 2006-2007 Nicolas Deram <nicolas@itaapy.com>
#
# 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... |
# Copyright 2014 Adobe. All rights reserved.
"""
Utilities for converting between T2 charstrings and the bez data format.
"""
import copy
import logging
import os
import re
import subprocess
import tempfile
import itertools
from fontTools.misc.psCharStrings import (T2OutlineExtractor,
... |
import re
from django.conf import settings
from django.conf.urls.defaults import patterns, url
from django.core.exceptions import ImproperlyConfigured
urlpatterns = []
def static(prefix, view='django.views.static.serve', **kwargs):
"""
Helper function to return a URL pattern for serving files in debug mode.
... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import random
import re
import string
import requests
from odoo import api, models, _
from odoo.exceptions import UserError
from ..py_etherpad import EtherpadLiteClient
_logger = logging.getLogger(__na... |
#!/usr/bin/python
# -*- coding: latin2 -*-
## this test suite is an almost verbatim copy of the jsontest.py test suite
## found in json-py available from http://sourceforge.net/projects/json-py/
## Copyright (C) 2005 Patrick D. Logan
## 2007-03-15 - Viktor Ferenczi (python@cx.hu)
## Added unit tests for encoder/deco... |
import pytest
from .. import base
from .. import factories as f
from .. utils import create_user_verify_login
pytestmark = pytest.mark.django_db
def create_user_type(slug='tutor'):
tutor_type = f.create_usertype(slug=slug, display_name=slug)
return tutor_type
def test_signup_college_poc_flow(base_url, bro... |
""" Helper script to help in compilation of the musl libc.
See for the musl library:
https://www.musl-libc.org/
"""
import os
import logging
import glob
import time
import traceback
from ppci.api import cc
from ppci.lang.c import COptions
from ppci.common import CompilerError, logformat
home = os.environ['HOME']
mu... |
# Volum kalkulator
# made by Kristian Sundal/(Kesmon/)
# Release 1.0
pi=3.14159265359
start = '\n\nVelg mellom\n"kjegle","pyramide","tpyramide","sylinder","kule","prisme" eller "tprisme"\n"avslutt" for å avslutte'
trekant = 'Vil du ha trekant versjonen? "ja/nei"'
fase=''
print(start)
fase = input('> ')
while fase ... |
import sys
import numpy
from collections import defaultdict
from itertools import chain
import argparse
def renormalize(M):
M /= numpy.linalg.norm(M, axis=1)[:, None]
return
def renormalize_vector(v):
return v / numpy.linalg.norm(v)
def outer(l1, l2):
return list(chain(*[[(x,y) for x in l1] for y in ... |
import os
import tempfile
import unittest
from django.test.simple import DjangoTestSuiteRunner, build_suite, reorder_suite
from django.test import TestCase as DjangoTestCase
from django.test._doctest import DocTestCase
from django.db.models import get_app, get_apps
from django.db import transaction, connections, DEFAU... |
import sendgrid
import json
import os
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
##################################################
# Create a domain whitelabel. #
# POST /whitelabel/domains #
data = {
"automatic_security": False,
"custom_spf": True,
"default": True,
... |
#!/usr/bin/env python
'''
@author: David Shaw, david.shaw.aw@gmail.com
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 obtain... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.http import HttpResponseRedirect, HttpResponse, HttpResponseForbidden
from django.views.decorators.csrf import csrf_exempt
import functools
import logging
from oauthlib.common import urlencode
from oauthlib.oauth2.draft25 impor... |
# -*- coding: utf-8 -*-
"""
Simple example using LSTM recurrent neural network to classify IMDB
sentiment dataset.
References:
- Long Short Term Memory, Sepp Hochreiter & Jurgen Schmidhuber, Neural
Computation 9(8): 1735-1780, 1997.
- Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng,... |
import os
import pandas as pd
import subprocess
from collections import Counter
import numpy as np
import math
import pysam
import pybedtools
from bcbio.utils import (file_exists, tmpfile, chdir, splitext_plus,
max_command_length, robust_partition_all)
from bcbio.provenance import do
from bcb... |
#!/usr/bin/env python
from __future__ import unicode_literals
import datetime
import mwparserfromhell
import pywikibot
import re
site = pywikibot.Site('en', 'wikipedia')
GA_SUBPAGES = ['Agriculture, food and drink', 'Art and architecture', 'Engineering and technology',
'Geography and places', 'History... |
# Copyright 2014 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 ... |
from enigma import eComponentScan, iDVBFrontend, eTimer
from Components.NimManager import nimmanager as nimmgr
from Tools.Transponder import getChannelNumber
class ServiceScan:
Idle = 1
Running = 2
Done = 3
Error = 4
DonePartially = 5
Errors = {
0: _("error starting scanning"),
1: _("error while scanning")... |
from __future__ import unicode_literals
import json
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
from .parser import (
MarkdownFlavoredTextNode,
ModelStuffNode,
TextPlusStuffLexer,
TextPlusStuffParser
)
class TextPlusStuff(object):
def __init__(self... |
#!/usr/bin/env python3
# encoding: UTF-8
# This file is part of Addison Arches.
#
# Addison Arches 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 Free Software Foundation, either version 3 of the License, or
# (at your option)... |
#
# inputs outputs
# single sin
# simple sim
# solution so
# a a
#
class Node:
def __init__(self, val):
self.val = val
self.children = [0] * 26
self.is_end = False
self.word_count = 1
def get_unique_prefixes(words):
root = Node(0)
root.word_count += 1
... |
"""
===========
Simple Plot
===========
Create a simple plot.
"""
import matplotlib.pyplot as plt
import numpy as np
# nodebox section
if __name__ == '__builtin__':
# were in nodebox
import os
import tempfile
W = 800
inset = 20
size(W, 600)
plt.cla()
plt.clf()
plt.close('all')
... |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... |
class Solution(object):
def add(self, x, y):
n = max(len(x), len(y))
res = []
ext_add = 0
for i in range(n):
a = x[i] if i < len(x) else 0
b = y[i] if i < len(y) else 0
v = a + b + ext_add
res.append(v % 10)
ext_add = v // ... |
#
# Andrei Korostelev <andrei at korostelev dot net>
#
# Before using this product in any way please read the license agreement.
# If you do not agree to the terms in this agreement you are not allowed
# to use this product or parts of it. You can read this license in the
# file named LICENSE.
#
"""
Ccpy state
"... |
# Copyright 2014-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Clean up old snapshot directories."""
import os
import shutil
def list_old_snapshots(storage):
"""List of snapshot directories that are no longer in use."""
cur... |
class Solution(object):
def verifypostorder(self,postorder):
# left-right-root
stck=[]
maxnum=1<<31
for i in xrange(len(postorder)-1,-1,-1):
if postorder[i]>maxnum:return False
while stck and postorder[i]<stck[-1]:
maxnum=stck.pop()
... |
class EventsTrigger(object):
""" 'Abstract' class that has a mechanism to subscribe and trigger events
"""
def __init__(self):
self.__events__ = []
self.__eventsCallbacks__ = {}
self.__eventsCount__ = 0
@property
def events(self):
return self.__events__
def ... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pprint import pprint
import requests
from django.conf import settings
from PyDictionary import PyDictionary
import wikipedia
import sendgrid
sid = settings.EXOTEL_SID
token = settings.EXOTEL_TOKEN
api = settings.SENDGRID_API_TOKEN
def send_message(sid, token, sms_f... |
'''
This submodule collects useful functionality required across the task
submodules, such as preprocessing, validation, and common computations.
'''
import os
import inspect
import six
import numpy as np
def index_labels(labels, case_sensitive=False):
"""Convert a list of string identifiers into numerical indi... |
#!/usr/bin/python
# coding=utf-8
from __future__ import print_function
import os, sys
from unidecode import unidecode
import flask
import requests, socket
import ast
app = flask.Flask(__name__)
app.debug = True
# Flask settings
host='localhost'
port=4242
# Solr settings
solr = {'host': 'localhost', 'port':8080, ... |
"""
Mail (SMTP) notification service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.smtp/
"""
import logging
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage... |
'''
This study is a Bogazici University - NETAS Nova V-Gate collaboration and funded by TEYDEB project "Realization of Anomaly Detection and Prevention with Learning System Architectures, Quality Improvement, High Rate Service Availability and Rich Services in a VoIP Firewall Product'', by the Scientific and Technolog... |
class CommandLineStatements:
"""Batch of command line statements surrounding zfs"""
"""Checks the disks in the system"""
check_disks = "ls -la /dev/disk/by-id"
"""
zpool command to check status
{0} = pool
"""
zpool_status = "sudo zpool status {0}"
"""
zpool command... |
from flask import Flask, render_template, request, redirect, url_for
from database import *
import flask_login, json, re
from bson.objectid import ObjectId
from jinja2 import evalcontextfilter, Markup, escape
from api import *
from questions import *
import random, time
app = Flask(__name__)
app.secret_key = '80e48d13... |
import unittest
import urllib
from foursquare import OAuthHandler, API, BasicAuthHandler, FoursquareError
from models import Tip, User
class TestAuthentication(unittest.TestCase):
CLIENT_ID = 'YOUR_CLIENT_ID'
CLIENT_SECRET = 'YOUR_CLIENT_SECRET'
REDIRECT_URI = 'YOUR_CALLBACK'
def _test_create_OAuthHa... |
# Copyright (C) 2010, 2011 Linaro
#
# Author: James Westby <james.westby@linaro.org>
#
# This file is part of Linaro Image Tools.
#
# Linaro Image Tools 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 v... |
#encoding: utf-8
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
from math import sqrt
def ldvec(vecf):
rsd = {}
unkv = False
with open(vecf) as frd:
for line in frd:
tmp = line.strip()
if tmp:
tmp = tmp.decode("utf-8")
ind = tmp.find(" ")
key = tmp[:ind]
value = tuple(float(tmpu) f... |
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import Selector
from lyricwiki.items import LyricWikiItem
class LyricWikiSpider(CrawlSpider):
name = "chance" #CHANGE NAME
... |
"Maximizes box volume given area and aspect ratio constraints."
from gpkit import Variable, Model
# Parameters
alpha = Variable("alpha", 2, "-", "lower limit, wall aspect ratio")
beta = Variable("beta", 10, "-", "upper limit, wall aspect ratio")
gamma = Variable("gamma", 2, "-", "lower limit, floor aspect ratio")
delt... |
# coding=utf-8
from utils.decorator.synchronizer import syncClassBase,sync,sync_
from threading import Thread
from kernel.filetype import filemap
import ex.exception_logic
import utils.datastructure.splittree
import filehandler
import config.nodeinfo
import cStringIO
overhaulOrder=[]
def addoverhaulOrder(node,lay):
... |
# Copyright 2017 SAS Project 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 requ... |
#!/usr/bin/env python3
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
# Copyright (c) 2015, Colorado State University.
#
# This file is part of ndn-atmos.
#
# ndn-atmos is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as publish... |
# ___________________________________________________________________________
# SmallInteger Primitives
ADD = 1
SUBTRACT = 2
LESSTHAN = 3
GREATERTHAN = 4
LESSOREQUAL = 5
GREATEROREQUAL = 6
EQUAL = 7
NOTEQUAL = 8
MULTIPLY = 9
DIVIDE = 10
MOD = 11
DIV = 12
QUO = 13
BIT_AND = 14
BIT_OR = 15
BIT_XOR = 16
BIT_SHIFT = 17
MAK... |
#!/usr/bin/python
'''
SPIM Auto-grader
Owen Stenson
Grades every file in the 'submissions' folder using every test in the 'samples' folder.
Writes to 'results' folder.
'''
import os, time, re
from subprocess import Popen, PIPE, STDOUT
def run(fn, sample_input='\n'):
#start process and write input
p... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 29 15:34:36 2015
@author: antlin
"""
import numpy as np
import matplotlib.pyplot as plt
import lmfit
import epicea
import electron_calibration_data
import plt_func
line_model = epicea.electron_calibration_helper.n_line_fit_model
line = 'voigt'
data_list = electron_cal... |
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
USE_CUDA = False
KERN_SIZE = 3
def set_cuda(val):
global USE_CUDA
USE_CUDA = val
def sequence_mask(sequence_length, max_len=None):
if max_len is None:
max_len = sequence_... |
# -*- coding: utf-8 -*-
import re
from flask import Blueprint, render_template, g, jsonify, request
from dataviva.apps.general.views import get_locale
from dataviva.apps.embed.models import Build, App
from dataviva.api.rais.services import Industry as CnaeService
from dataviva.api.secex.services import Product as Secex... |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2015 Jacob Mendt
Created on 04.08.15
@author: mendt
'''
import os
import uuid
from mapscript import MS_IMAGEMODE_RGB, MS_OFF, MS_PIXELS, MS_LAYER_RASTER, layerObj, mapObj, MS_ON, outputFormatObj
from georeference.utils.exceptions import MapfileBindingInitalizationException
... |
# -*- coding: utf-8 -*-
# Copyright (C) 2015-16 Red Hat, Inc.
# This file is part of the Infinity Note Compiler.
#
# The Infinity Note Compiler 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 ... |
# -*- coding: utf-8 -*-
import logging
import traceback
from flask import Blueprint, jsonify, render_template, Response
from flask import current_app
from odpw.web_rest.rest import settings
from sqlalchemy.orm.exc import NoResultFound
log = logging.getLogger(__name__)
from flask_restplus import Api
api = Api(vers... |
__author__ = 'User'
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^myfollowers/$', views.beingFollowedByView, name="my_followers"),
url(r'^circle/new/$', views.CreateCircleView.as_view(), name="new_circle"),
url(r'^circle/(?P<slug>[0-9]+)/$', views.circleDetails, name="circle_d... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" imports """
import queue
import logging
import signal
import sys
import configparser
import ControlDaemon
import MessageBroker
import WebService
from flask import Flask, request
""" global vars """
thread1 = None
thread2 = None
thread3 = None
config = None
server =... |
#! /usr/bin/env python3
"""
Sample script that monitors card connection events.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under t... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from collections import defaultdict
import json
from odoo import api, fields, models, _, SUPERUSER_ID
from odoo.exceptions import... |
"""Email utility functions"""
from six import string_types
from django.template.loader import render_to_string
from django.core.mail import EmailMultiAlternatives
from django.conf import settings
from premailer import transform
def send_game_accepted(user, game):
"""Email an user when their game submission is acc... |
# Foremast - Pipeline Tooling
#
# Copyright 2018 Gogo, 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... |
from __future__ import unicode_literals
import pytest
import sideboard.lib.sa
@pytest.fixture
def public_modules():
return [sideboard.lib, sideboard.lib.sa]
@pytest.fixture
def version_contract():
return {
'0.1': {
sideboard.lib: [
'log', 'listify', 'services', 'Configu... |
from flask import Flask, render_template, json, request, redirect, session
from flask.ext.mysql import MySQL
from werkzeug import generate_password_hash, check_password_hash
from flask_googlemaps import GoogleMaps
from flask_googlemaps import Map
import pygal
from pygal.style import BlueStyle, NeonStyle,DarkSolarizedS... |
from functools import wraps
import time
__author__ = "Aaron Koeppel"
__version__ = 1.0
def retry(ExceptionToCheck, logger, tries=4, delay=3, backoff=2):
"""Retry calling the decorated function using an exponential backoff.
http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/
origina... |
"""
API object specification and correspond methods
"""
def fill_list_article_object(article_id, title, site, updated, cover_url, is_fav):
"""
list article object:
{
article_id: article_id,
title: title,
site: site_title,
updated: YYYY-MM-DD,
... |
# -*- coding: utf-8 -*-
# PyMeeus: Python module implementing astronomical algorithms.
# Copyright (C) 2018 Dagoberto Salazar
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either v... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import, unicode_literals
from qtpy.QtCore import *
# from qtpy.QtWidgets import *
import re
import logging
from sphinx_explorer.util.commander import Commander
logger = logging.getLogger(__name__)
class PipInstallT... |
from __future__ import unicode_literals
from . import helper
from . import grading
import collections
Student = collections.namedtuple('Student', ['id'])
NamedStudent = collections.namedtuple('Student', ['student', 'aliases'])
FullStudent = collections.namedtuple('FullStudent', ['student', 'aliases', 'submissions', ... |
# -*- test-case-name: malva.tests.test_utils -*-
from twisted.internet.serialport import SerialPort
from twisted.internet.defer import DeferredList, Deferred
from twisted.internet import reactor
from txgsm import txgsm
from serial.tools import list_ports
class ModemProbe(object):
protocol = txgsm.TxGSMProtoco... |
from flask import Flask
from flask_restful import Resource, Api, reqparse
from apiviewer import __version__
import json
import importlib
from cobwebs.config import get_config
global_config = get_config()
driver_module = importlib.import_module(global_config['main']['mq_driver'])
mq_driver = driver_module.driver
app... |
lya_source_dcl = """
dcl dcl1 int;
dcl dcl2, dcl3, dcl4, dcl5 char;
dcl dcl6, dcl7 int, dcl8 bool;
dcl dcl9 int = 5;
dcl dcl10, dcl11 int = 6;
dcl dcl12 int, dcl13, dcl14 int = 10;
dcl dcl15 int (2:5);
dcl dcl16 char (0:10);
dcl dcl17 bool(10:11);
dcl dcl18 dcl17 (1:2);
dcl d... |
# Copyright (c) 2014 Dell 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 a... |
__problem_title__ = "Connectedness of a network"
__problem_url___ = "https://projecteuler.net/problem=186"
__problem_description__ = "Here are the records from a busy telephone system with one million " \
"users: The telephone number of the caller and the called number in " \
... |
# -*- coding: utf-8 -*-
#
# This file is part of Glances.
#
# Copyright (C) 2015 Nicolargo <nicolas@nicolargo.com>
#
# Glances is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Biligrab-Danmaku2ASS
#
# Author: Beining@ACICFG https://github.com/cnbeining
# Author: StarBrilliant https://github.com/m13253
#
# Biligrab is licensed under MIT licence
# Permission has been granted for the use of Danmaku2ASS in Biligrab
#
# Copyright (c) 2014
#
# Perm... |
#!/usr/bin/env python
from __future__ import print_function
NUMBER_OF_RANDOMS = 10000
CHUNK_SIZE = 1000
working_dir = "temp_tutorial7/"
import os
import sys
# add grandparent to search path for testing
grandparent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
sys.path.insert(0, grand... |
from django.contrib.auth import login, REDIRECT_FIELD_NAME
from django.http import HttpResponseRedirect, HttpResponseForbidden
from django.utils.http import urlquote
try:
from functools import wraps, WRAPPER_ASSIGNMENTS
except ImportError:
from django.utils.functional import wraps, WRAPPER_ASSIGNMENTS
try:
... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... |
from django.db import models
from fields import ListField, ColourField
# Create your models here.
class MapCity(models.Model):
#Creation date
create_date = models.DateTimeField('Date Created', auto_now_add=True)
#Name of the city
city_name = models.CharField(max_length=200)
#Local rail name
rail_na... |
#!/usr/bin/python
import sys
import re
import string
variables = {}
outs = {}
monomial = "([a-zA-z]+\d+)"
mn = re.compile(monomial)
def extractValues(strin):
xAddr1 = strin[2].strip()
xAddr2 = strin[4].strip()
if xAddr1 in variables:
x1 = variables[xAddr1]
else:
... |
import numpy as np
from os import path
from scipy.io import loadmat
from timer import timer
from classifier import LDAClassifier, QDAClassifier
""" TODO: choose either mnist or spam >>HERE<< """
which = "spam.mat"
which = "mnist.mat"
""" TODO: choose either mnist or spam >>HERE<< """
timer.start("reading", which, "... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import codecs
import sys
def operation(inf, outf):
'''
Check
'''
err = False
annotations = set([])
for line in inf:
if line.startswith(";"):
continue
items = line[:-1].split("\t")
if len(items)... |
'''
This file is part of python-libdeje.
python-libdeje is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
python-libdeje is distribute... |
# -*- coding: utf-8
# Checkcase class implementation.
"""Checkcase class implementation.
There is three kinds of ways to fail a check:
- Warning: Generate a warning message but do not count as an error.
- Error: Generate an error message and count as an error.
- Failure: Generate a failure message and stop the run... |
import sublime
from unittesting import DeferrableTestCase
Lorem = ("""Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod"""
"""tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,"""
"""quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commo... |
from __future__ import print_function, division, absolute_import
import numpy as np
from scipy.linalg import eigh, cholesky, inv, svd, solve
import tensorflow as tf
from sklearn.svm import SVC
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from odin.backend import length_norm, calc_white_mat
fr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.