src stringlengths 721 1.04M |
|---|
# This file is part of Maker Keeper Framework.
#
# Copyright (C) 2017-2018 reverendus
#
# 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 Free Software Foundation, either version 3 of the License, or
# (at your opti... |
#!/usr/bin/env python
"""
Written by Ethan Shaw
"""
from astropy.io import fits
import sys, png, math, os
colors = ['red', 'green', 'blue']
# Build x_axis_len rows, each containing y_axis_len columns
# access with PNG_data[row][column]
def buildMatrix(x_axis_len, y_axis_len, greyscale=True):
# set up empty list (mat... |
"""
Extra functions for build-in datasets
"""
import torchvision.transforms as transforms
def build_transforms(normalize=True, center_crop=None, image_size=None,
random_crop=None, flip=None, random_resize_crop=None,
random_sized_crop=None, use_sobel=False):
"""
Args... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 20 11:13:08 2013
@author: JL Villanueva-Cañas
@email: jlvillanueva84@gmail.com
miraconvert -t hsnp A10_A04_first_assembly_out.maf assembly.html
"""
#Import all the functions and modules used. Check functions.py
import sys
from functions import *
try:
os.system('mkd... |
# -*- coding: utf-8 -*-
"""
flask.debughelpers
~~~~~~~~~~~~~~~~~~
Various helpers to make the development experience better.
:copyright: (c) 2016 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from ._compat import implements_to_string, text_type
from .app import Flask
from .bl... |
#!/usr/bin/env python
from __future__ import print_function
import json
import logging
import re
import time
import requests
from bs4 import BeautifulSoup
try:
from logging import NullHandler
except ImportError:
from sunstone_rest_client.util import NullHandler
class LoginFailedException(Exception):
pas... |
from __future__ import unicode_literals
import types
from prompt_toolkit.eventloop.defaults import get_event_loop
from prompt_toolkit.eventloop.future import Future
__all__ = [
'From',
'Return',
'ensure_future',
]
def ensure_future(future_or_coroutine):
"""
Take a coroutine (generator) or a `Futu... |
import os
from django.utils import unittest
from django.contrib.auth.models import User
from django.core.files import File
from models import *
from dockit.forms import DocumentForm
from dockit.models import TemporaryDocument, create_temporary_document_class
from dockit.schema import create_document, TextField
clas... |
import pytest
import json
import os.path
import importlib
import jsonpickle
from fixture.application import Application
from fixture.db import DbFixture
fixture = None
target = None
def load_confige(file):
global target
if target is None:
config_file = os.path.join(os.path.dirname(os.path.abspath(__... |
import io
import pytest
from pathod import pathod
from mitmproxy.net import tcp
from mitmproxy import exceptions
from mitmproxy.test import tutils
from . import tservers
class TestPathod:
def test_logging(self):
s = io.StringIO()
p = pathod.Pathod(("127.0.0.1", 0), logfp=s)
assert len(... |
import os
import unittest
from vsg.rules import function
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_014_test_input.vhd'))
lExpected_lower = []
lExpected_lower.append('')
utils.read_file(os.path.jo... |
from sys import platform
from typing import Optional, Any, List
from mlagents_envs.environment import UnityEnvironment
from mlagents_envs.base_env import BaseEnv
from mlagents_envs.registry.binary_utils import get_local_binary_path
from mlagents_envs.registry.base_registry_entry import BaseRegistryEntry
class RemoteR... |
# -*- coding:utf-8 -*-
import os
from glob import glob
import numpy as np
try:
import cPickle as pickle
except:
import pickle
# create label for resnext tests
# glob filename from nodules/, write label to groundTruths/
class GroundTruthCreator(object):
def __init__(self, dataPath, phrase = "train"):
... |
from auslib.AUS import isForbiddenUrl
from auslib.blobs.base import Blob
from auslib.errors import BadDataError
class SystemAddonsBlob(Blob):
jsonschema = "systemaddons.yml"
def __init__(self, **kwargs):
Blob.__init__(self, **kwargs)
if "schema_version" not in self:
self["schema_v... |
import numpy
import random
import matplotlib.pyplot as plot
from sklearn.tree import DecisionTreeRegressor
from sklearn import tree
a = 1
b = 2
# Build a simple data set with y = x + random
nPoints = 1000
# x values for plotting
xPlot = [(float(i) / float(nPoints) - 0.5) for i in range(nPoints + 1)]
# x needs to b... |
import gtk
class PyApp(gtk.Window):
def __init__(self):
super(PyApp, self).__init__()
self.set_title("Libreria")
self.set_size_request(600, 300)
self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(6400, 6400, 6440))
self.set_position(gtk.WIN_POS_CENTER)
mb = gtk.MenuB... |
#!/usr/bin/python
#-*-coding:utf-8-*-
#- utilidades class
#- Copyright (C) 2014 GoldraK & Interhack
# 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 ... |
#-*- coding: utf-8 -*-
"""
pyScss, a Scss compiler for Python
@author German M. Bravo (Kronuz) <german.mb@gmail.com>
@version 1.2.0 alpha
@see https://github.com/Kronuz/pyScss
@copyright (c) 2012-2013 German M. Bravo (Kronuz)
@license MIT License
http://www.opensource.org/licenses/mit-lic... |
from optparse import make_option
import logging
import sys
from django.db import connections
from ...boot import PROJECT_DIR
from ...db.backend.base import DatabaseWrapper
from django.core.management.base import BaseCommand
from django.core.management.commands.runserver import BaseRunserverCommand
from django.core.exc... |
#
# 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... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 27 15:44:34 2017
@author: p
"""
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
plt.close('all')
def GenWeight(shape):
initial = tf.truncated_normal(shape, stddev=1.)
return tf.Variable(initial)
def GenBias(shap... |
#!/usr/bin/env python
# ------------------------------------------------------------------------------
# Copyright 2002-2013, GridWay Project Leads (GridWay.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 obta... |
import game_structures
from block_expander import conv_endian
from copy import copy
##to do:
##check to see if the system correctly transforms between saving and loading
class Savesystem:
def __init__(self, filename = "savegame.wld"):
self.saves = []
self.filename = filename
# open the save file
f = open(... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import MetaData
from flask_migrate import Migrate
import version
from libforget.cachebust import cachebust
import mimetypes
import libforget.brotli
import libforget.img_proxy
from werkzeug.middleware.proxy_fix import ProxyFix
app = Flask(_... |
# Copyright 2016 Sungard Availability Services
# Copyright 2016 Red Hat
# Copyright 2012 eNovance <licensing@enovance.com>
# Copyright 2013 IBM Corp
# 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 obtai... |
from node.create_list import List
from node.numeric_literal import NumericLiteral
from node.string_literal import StringLiteral
from type.type_time import TypeTime
nodes = {int: NumericLiteral,
float: NumericLiteral,
str: StringLiteral,
list: List,
tuple: List}
def int_literal(num... |
# A hack to find "haikus" in English text. For the purposes of this program
# a "haiku" is one or more complete sentences that, together, can be broken
# into groups of 5, 7, and 5 syllables. Each canididate haiku line, and then
# the entire haiku, has to make it through a few heuristics to filter out
# constructions ... |
#!/usr/bin/python
# opposite direction because recent data is more important
suf = ".autosave"
pref1 = "run8/autosave_run8_epoch"
ch1 = [i for i in range(216, 184, -4)]
ch1.extend([ 184, 182])
for c in ch1:
print(pref1 + ("%03d" % c) + suf)
pref2 = "run7/autosave_run7_epoch"
ch2 = [181, 180, 171, 145, 138, 1... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright 2012 Joe Harris
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
... |
__author__ = 'janosbana'
'''
this script is responsible for collecting all the features data for the next 7 days from today and for each day
create a list of features that can be used by our trained models
'''
import json
import os
import requests
import calendar
from datetime import datetime, timedelta, date
from xml... |
"""
Assign Layer operator for FPN
author: Yi Jiang, Chenxia Han
"""
import mxnet as mx
import numpy as np
class AssignLayerFPNOperator(mx.operator.CustomOp):
def __init__(self, rcnn_stride, roi_canonical_scale, roi_canonical_level):
super().__init__()
self.rcnn_stride = rcnn_stride
self.r... |
#!/usr/bin/env python3
#########################################################################
# File Name: main.py
# Author: lingy
# Created Time: Fri 13 Jan 2017 11:32:15 AM CST
# Description:
#########################################################################
# -*- coding: utf-8 -*-
import... |
#
# Copyright (C) 2009, 2013, 2014 Red Hat, Inc.
# Copyright (C) 2009 Cole Robinson <crobinso@redhat.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 Foundation; either version 2 of the License, or
# ... |
# Authors: David Goodger, Ueli Schlaepfer
# Contact: goodger@users.sourceforge.net
# Revision: $Revision: 21817 $
# Date: $Date: 2005-07-21 13:39:57 -0700 (Thu, 21 Jul 2005) $
# Copyright: This module has been placed in the public domain.
"""
Transforms needed by most or all documents:
- `Decorations`: Generate a doc... |
# Copyright 2016 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 ... |
"""Ttk wrapper.
This module provides classes to allow using Tk themed widget set.
Ttk is based on a revised and enhanced version of
TIP #48 (http://tip.tcl.tk/48) specified style engine.
Its basic idea is to separate, to the extent possible, the code
implementing a widget's behavior from the code implementing its
ap... |
# Allow direct execution
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import unittest
from lib.pointsizes import Pointsizes
class SheetTestCase(unittest.TestCase):
def setUp(self):
pass
def test(self):
self.assertEquals(Pointsizes.min()... |
import pytest
from django.contrib.auth.models import AnonymousUser
from django.http.response import Http404
from django.test import RequestFactory
from {{ cookiecutter.project_slug }}.users.models import User
from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory
from {{ cookiecutter.project_slu... |
# -*- coding: utf-8 -*-
"""
This file contains different utils and fixtures.
"""
import os
from pytest import fixture
__author__ = 'sobolevn'
class Scope(dict):
"""
This class emulates `globals()`,
but does not share state across all tests.
"""
def __init__(self, *args, **kwargs):
"""... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
ytdl_refactored.py
Required python packages:
python-gdata
python-matplotlib
python-numpy
"""
import urllib2
import urllib
import os
import subprocess
import sys
import string
import re
import socket
import datetime
from datetime import datetime
import gdata.youtube
im... |
"""
sources: http://stackoverflow.com/questions/306400/how-do-i-randomly-select-an-item-from-a-list-using-python, https://inventwithpython.com/chapter9.html, http://stackoverflow.com/questions/14667578/check-if-a-number-already-exist-in-a-list-in-python, mary feyrer, Glen Passow (game tester), http://stackoverflow.com/... |
import wx
import getPlugins as gpi
import os
import math
from Bio import SeqIO
from time import strftime
import re
class Plugin():
def OnSize(self):
self.bPSize = self.bigPanel.GetSize()
for i in self.seqText:
i.Show(False)
i.SetSize((self.bPSize[0]-315,self.bPSize[1]-16))
... |
# Copyright (c) 2016 Uber Technologies, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... |
import time
try:
import functools
import logging
import multiprocessing
import os
import pycurl
import queue
import threading
import tkinter.font as tkfont
import webbrowser
from concurrent.futures import ThreadPoolExecutor
from idlelib.WidgetRedirector import WidgetRedirect... |
from HTMLComponent import HTMLComponent
from GUIComponent import GUIComponent
from enigma import eEPGCache, eListbox, eListboxPythonMultiContent, gFont, \
RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER, RT_VALIGN_CENTER
from Tools.Alternatives import CompareWithAlternatives
from Tools.LoadPixmap import LoadPixmap... |
"""
Load RSA keys for encryption/decryption/sign/verify.
"""
from ldap3 import *
import json
import base64
import log
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa, padding
from cryptography.hazmat.primitives.serializatio... |
# Copyright (c) 2014 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the impl... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from django.contrib.syndication.views import Feed as BaseFeed
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
class GeoFeedMixin:
"""
This mixin provides the necessary routines for SyndicationFeed subclasses
to produce simple GeoRSS or W3C Geo elements.
"""
def georss_coords(self... |
"""
Description:
This program implements a simple Twitter bot that tweets information about bills in Congress
that are (in)directly related to cyber issues. This bot uses a MySQL database backend to
keep track of bills, both posted and unposted (i.e., tweeted and yet to be tweeted, respectively).
For th... |
"""Contains a simple class for storing join configurations."""
##
# Copyright 2013 Chad Spratt
# 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/L... |
from .validators import Validator
from .errors import ValidationError
class ValidatorsNullCombination(object):
"""Used as a default validators combination when a field has no
validators.
"""
def __call__(self, *args, **kwargs):
"""Null combination does nothing"""
def __and__(self, other)... |
#!/usr/bin/env python
"""
Test script to see if Optima works.
To use: comment out lines in the definition of 'tests' to not run those tests.
NOTE: for best results, run in interactive mode, e.g.
python -i tests.py
Version: 2016feb03 by cliffk
"""
## Define tests to run here!!!
tests = [
'makeproject',
'paramete... |
# -*- coding: utf-8 -*-
# from: https://github.com/bitbar/testdroid-samples/blob/03fc043ba98235b9ea46a0ab8646f3b20dd1960e/appium/sample-scripts/python/device_finder.py
import os, sys, requests, json, time, httplib
from optparse import OptionParser
from urlparse import urljoin
from datetime import datetime
class Devi... |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This module helps emulate Visual Studio 2008 behavior on top of other
build systems, primarily ninja.
"""
import os
import re
import subprocess
import sys
fr... |
'''Copyright (c) 2015 Jason Bunk
Covered by LICENSE.txt, which contains the "MIT License (Expat)".
'''
import numpy as np
import activations
import costfuncs
import cython_convolution
class convlayer(object):
# inshape == (nsamples-per-batch, nchannels-in, im-dimensions...)
# filtshape == (nchannels-out, nchannels... |
from __future__ import print_function
from microsoft.gestures.endpoint.gestures_service_endpoint_factory import GesturesServiceEndpointFactory
from microsoft.gestures.fingertip_placement_relation import FingertipPlacementRelation
from microsoft.gestures.pass_through_gesture_segment import PassThroughGestureSegment
from... |
"""
WSGI config for enterprise_course_api project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_... |
# Carl is free software; you can redistribute it and/or modify it
# under the terms of the Revised BSD License; see LICENSE file for
# more details.
import numpy as np
from numpy.testing import assert_raises
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_almost_equal
from carl.d... |
STDLIB_NAMES = set((
"AL",
"BaseHTTPServer",
"Bastion",
"Binary",
"Boolean",
"CGIHTTPServer",
"ColorPicker",
"ConfigParser",
"Cookie",
"DEVICE",
"DocXMLRPCServer",
"EasyDialogs",
"FL",
"FrameWork",
"GL",
"HTMLParser",
"MacOS",
"Mapping",
"MimeW... |
import os
import p4.func
import pickle
import math
import numpy
import glob
from p4.p4exceptions import P4Error
class McmcCheckPointReader(object):
"""Read in and display mcmc_checkPoint files.
Three options--
To read in a specific checkpoint file, specify the file name by
fName=whatever
To re... |
# -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2020 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from __future__ import absolute_import, division, print_function
from re import compile
from ..scrape... |
from django.conf.urls import *
from canvas.shortcuts import direct_to_template
from canvas.url_util import re_slug, re_int, re_group_slug, re_year, re_month, re_day, maybe
urlpatterns = patterns('drawquest.apps.staff.views',
url(r'^$', direct_to_template, kwargs={'template': 'staff/portal.html'}),
url(r'^/st... |
import sys
import os
import re
import textwrap
import pytest
from doctest import OutputChecker, ELLIPSIS
from tests.lib import _create_test_package, _create_test_package_with_srcdir
distribute_re = re.compile('^distribute==[0-9.]+\n', re.MULTILINE)
def _check_output(result, expected):
checker = OutputChecker()... |
#
# Honeybee: A Plugin for Environmental Analysis (GPL) started by Mostapha Sadeghipour Roudsari
#
# This file is part of Honeybee.
#
# Copyright (c) 2013-2020, Mostapha Sadeghipour Roudsari <mostapha@ladybug.tools>
# Honeybee is free software; you can redistribute it and/or modify
# it under the terms of the GNU G... |
# Helper utils for gdata.
#
# Copyright (C) 2012 NigelB
#
# 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.
#
# This progr... |
# -*- coding: utf-8 -*-
# Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com>
# Copyright © 2017 Dylan Baker
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
from __future__ import absolute_import
from __future__ import division
from dat... |
# Copyright (c) 2011 Florian Mounier
# Copyright (c) 2012, 2014-2015 Tycho Andersen
# Copyright (c) 2013 Mattias Svala
# Copyright (c) 2013 Craig Barnes
# Copyright (c) 2014 ramnes
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 Adi Sieker
# Copyright (c) 2014 Chris Wesseling
#
# Permission is hereby granted, free o... |
# -*- coding: utf-8 -*-
"""
Pygments LaTeX formatter tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import print_function
import os
import unittest
import tempfile
from pygments.forma... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# autolatex/utils/gedit_runner.py
# Copyright (C) 2013-14 Stephane Galland <galland@arakhne.org>
#
# 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 Foundatio... |
import sqlalchemy
from raggregate.models import DBSession
from raggregate.models.vote import Vote
from raggregate.models.submission import Submission
from raggregate.models.comment import Comment
from raggregate.models.epistle import Epistle
from raggregate.models.section import Section
from raggregate.queries import... |
"""
homeassistant.util
~~~~~~~~~~~~~~~~~~
Helper methods for various modules.
"""
import collections
from itertools import chain
import threading
import queue
from datetime import datetime
import re
import enum
import socket
from functools import wraps
RE_SANITIZE_FILENAME = re.compile(r'(~|\.\.|/|\\)')
RE_SANITIZE_P... |
"""Cross Site Request Forgery middleware, borrowed from Django.
See also:
https://github.com/django/django/blob/master/django/middleware/csrf.py
https://docs.djangoproject.com/en/dev/ref/contrib/csrf/
https://github.com/zetaweb/www.gittip.com/issues/88
"""
import rfc822
import re
import time
import urlpa... |
# Note: not using cStringIO here because then we can't set the "filename"
from StringIO import StringIO
from copy import copy
from datetime import datetime, timedelta
from django.contrib.auth.models import User, AnonymousUser
from django.contrib.messages import SUCCESS
from django.core.urlresolvers import reverse
from... |
import os
import sys
def is_active():
return True
def get_name():
return "iOS"
def can_build():
import sys
import os
if sys.platform == 'darwin' or os.environ.has_key("OSXCROSS_IOS"):
return True
return False
def get_opts():
return [
('IPHONEPLATFORM', 'name of the... |
"""
Created on December 12, 2011
@author: sbobovyc
"""
"""
Copyright (C) 2011 Stanislav Bobovych
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) ... |
#!/usr/bin/env python
# Module : SysTrayIcon.py
# Synopsis : Windows System tray icon.
# Programmer : Simon Brunning - simon@brunningonline.net
# Date : 11 April 2005
# Notes : Based on (i.e. ripped off from) Mark Hammond's
# win32gui_taskbar.py and win32gui_menu.py demos from PyWin32
impo... |
#! /usr/bin/env python
import sys, doctest, string, StringIO, dis
from colors import colorString
import argparse as ap
from exam import *
def check_usage(f, name):
backup_stdout = sys.stdout
fake_stdout = StringIO.StringIO()
sys.stdout = fake_stdout
dis.dis(f)
sys.stdout = backup_stdout
match... |
from __future__ import absolute_import
from rest_framework import serializers
from sentry.api.serializers.rest_framework.list import ListField
from sentry.models import CommitFileChange
class CommitPatchSetSerializer(serializers.Serializer):
path = serializers.CharField(max_length=255)
type = serializers.Cha... |
def default_item():
return ('', (0,0))
class Matrix():
def __init__(self):
self.data = [[default_item()]]
def __str__(self):
return '\n'.join(repr(row) for row in self.data)
# return '\n'.join('\t|\t'.join(repr(x) for x in row) for row in self.data)
def __contains__(self, key... |
# -*- coding: utf-8 -*-
import sys, json, time
import config
from tornado_proxy.proxy import ProxyHandler, ProxyServer
from lib.httphelper import mark_unique, process_post_body, check_lang
import lib.detector
import hashlib
import os
py3k = sys.version_info.major > 2
if py3k:
from urllib import parse as urlparse
e... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-10 21:37
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... |
from __future__ import print_function, unicode_literals
import getpass
import sys
import threading
import spotify
if sys.argv[1:]:
track_uri = sys.argv[1]
else:
track_uri = 'spotify:track:6xZtSE6xaBxmRozKA0F6TA'
# Assuming a spotify_appkey.key in the current dir
session = spotify.Session()
# Process event... |
import pip
import xmlrpclib
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
'''
originally based off of:
https://gist.github.com/3555765
which was originally based off of:
http://code.activestate.com/recipes/577708/
'''
class Command(BaseCommand):... |
import os
import sys
import time
import pytest
from daethon import Daemon
class TDaemon(Daemon):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
with open('testing_daemon', 'w') as f:
f.write('inited')
def run(self):
time.sleep(1)
with open(... |
"""Custom authentication for DRF"""
import logging
from django.contrib.auth import get_user_model
import jwt
from rest_framework.authentication import BaseAuthentication
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
User = get_user_model()
HEADER_PREFIX = "Token "
HEADER_PREFIX_LENGTH = l... |
# 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 ... |
# -*- coding: utf-8 -*-
from inmembrane.helpers import run, parse_fasta_header
citation = {'ref': u"Petersen TN, Brunak S, von Heijne G, Nielsen H. "
u"SignalP 4.0: discriminating signal peptides from "
u"transmembrane regions. Nature methods 2011 "
u"Jan;8(10):... |
from fr0stlib.functions import randrange2
from fr0stlib import Flame, Xform
def GenRandomBatch(numrand,*a, **k):
lst = []
if len(a)==0:
raise ValueError, "number of xform config specs must be > 0"
if 'numbasic' in k and k['numbasic']>0 and len(a)>1:
print "more than one xform config ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-04 13:41
from __future__ import unicode_literals
from django.db import migrations, models
import xorgauth.utils.fields
class Migration(migrations.Migration):
dependencies = [
('accounts', '0011_make_user_ids_blank'),
]
operations =... |
import json
from django.urls.base import reverse
from seqr.models import GeneNote
from seqr.views.apis.gene_api import gene_info, genes_info, create_gene_note_handler, update_gene_note_handler, \
delete_gene_note_handler
from seqr.views.utils.test_utils import AuthenticationTestCase, GENE_DETAIL_FIELDS
GENE_ID =... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
r"""
Print a list of pages, as defined by page generator parameters.
Optionally, it also prints page content to STDOUT or save it to a file
in the current directory.
These parameters are supported to specify which pages titles to print:
-format Defines the output format.
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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 t... |
from listener.packets.abstractPacket import AbstractPacket
from struct import unpack
class UdpPacket(AbstractPacket):
UNPACK_FORMAT = '!HHHH'
UDP_HEADER_LENGTH = 8
PROTOCOL_NAME = 'UDP'
def __init__(self, binPacket: bytes, margin: int):
self.binPacket = binPacket
self.headerMa... |
#!/usr/bin/python
#
# Project Kimchi
#
# Copyright IBM, Corp. 2013
#
# This library 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 2.1 of the License, or (at your option) any later ver... |
#
# Copyright (c) SAS Institute 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 to in w... |
# ===============================================================================
# Copyright 2014 Jake Ross
#
# 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... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-15 17:12
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0040_page_draft_t... |
"""Tests for DataStream objects."""
import pytest
from iotile.core.exceptions import InternalError
from iotile.sg import DataStream, DataStreamSelector
def test_stream_type_parsing():
"""Make sure we can parse each type of stream."""
# Make sure parsing stream type works
stream = DataStream.FromString('... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-31 16:13
from __future__ import unicode_literals
from django.db import migrations
from project import helpers, settings
import json
import os
def fill_from_mock(apps, schema_editor):
helpers.mkdir_recursive(settings.MEDIA_ROOT)
helpers.copy_dir_rec... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.