text stringlengths 17 737k |
|---|
from pony.py23compat import iteritems
import json
from datetime import date, datetime
from decimal import Decimal
from collections import defaultdict
from pony.orm.core import Entity, TransactionError
from pony.utils import cut_traceback, throw
class Bag(object):
def __init__(bag, database):
bag.database... |
# -*- coding: utf-8 -*-
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# Thomas Cokelaer <thomas.cokelaer@pasteur.fr>
# Dimitri Desvillechabrol <dimitri.desvillechabrol@pasteur.fr>,
# <d.desvillechabrol@gmail.com>
#
# Distributed un... |
#SPDX-License-Identifier: MIT
"""
Augur library script for generating a config file
"""
import os
import click
import json
ENVVAR_PREFIX = "AUGUR_"
default_config = {
"Database": {
"name": "augur",
"host": "localhost",
"key": "key",
"password": "augur",
... |
import os
import sys # noqa: F401
from datetime import date, datetime, timedelta # noqa: F401
import asyncio
import discord
from discord.ext import commands
from cogs.utils.dataIO import dataIO
from .utils import checks
class AutoRooms:
"""
auto spawn rooms
"""
__author__ = "mikeshardmind"
__ver... |
#!/usr/bin/env python
""" SGA-ICE
SGA Iteratively Correcting Errors
"""
__author__ = ["Juliana Roscito, Katrin Sameith, Michael Hiller"]
import os
import stat
import sys
import argparse
def __parse_arguments():
"""Read arguments from the command line.
Returns an argument object containing all input paramete... |
import logging
import dbus
import telepathy
import tp
import util.go_utils as gobject_utils
import util.misc as misc_utils
_moduleLogger = logging.getLogger(__name__)
class CallChannel(
tp.ChannelTypeStreamedMedia,
tp.ChannelInterfaceGroup,
tp.ChannelInterfaceCallState,
tp.ChannelInterfaceHold,
):
def ... |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2017 SML
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... |
"""
The dataset class used in this package.
Datasets consists of data used for training, represented by a list of
(feature, label) tuples.
May be exported in different formats for application on other libraries.
"""
import random
import numpy as np
class Dataset(object):
def __init__(self, X=[], y=[]):
... |
# -*- coding: utf-8 -*-
# (c) 2013-2016 Andreas Motl, Elmyra UG
import logging
from StringIO import StringIO
from zipfile import ZipFile, ZIP_DEFLATED
from pyramid.httpexceptions import HTTPError
from elmyra.ip.access.uspto.image import get_images_view_url
from elmyra.ip.util.numbers.common import decode_patent_number
... |
import numpy as np
from candidate_selection.models.lazy_indexer import LazyIndexer
class HypergraphBatchPreprocessor:
entity_indexer = None
relation_indexer = None
in_batch_indices = None
in_batch_labels = None
graph_counter = None
def __init__(self):
self.entity_indexer = LazyInde... |
import datetime
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core import mail
from django.core.urlresolvers import reverse
from django.test import TestCase
from registration.forms import RegistrationForm
from registration.models ... |
import datetime
import pytz
from juliabox.cloud import Compute
from juliabox.jbox_tasks import JBoxAsyncJob
from juliabox.jbox_util import JBoxCfg
from juliabox.jbox_container import BaseContainer
from juliabox.vol import VolMgr, JBoxVol
import docker.utils
from docker.utils import Ulimit
import time
class SessConta... |
##########################################################################
#
# Copyright (c) 2009, 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:
#
# * Redistribu... |
import webapp2
import json
import logging
import musicdb.model
from apptools.data_handler import DataHandler
from google.appengine.api import users
from musicdb.music_data_handler import VenueHandler
from musicdb.music_data_handler import ArtistHandler
from musicdb import tools
logger = logging.getLogger("resource")
... |
# This is a very quick and dirty code for David so he can work on its
# sikuli agent and report as nsca the results.
#
# This need to be clean a lot, it's still a server and should be a
# client class :) I can do it after my "new baby holidays" are
# finished ;)
#
# J. Gabes
import time
import select
import socket
imp... |
#!/usr/bin/env python
# Copyright 2009 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... |
from pprint import pprint
from pyquery import PyQuery as pq
import json
import datetime
import collections
import sys
# Where to write to.
OUTFILE = "resto/1.0/menu/{}/{}.json"
# Languages
TYPES = ['nl', 'en', 'nl-sintjansvest']
# The url containing the list of weekmenu's.
WEEKMENU_URL = {
"nl": "http://www.uge... |
from __future__ import absolute_import
from __future__ import unicode_literals
import errno
import fcntl
import os
import time
from subprocess import PIPE
from subprocess import Popen
import service_configuration_lib
from behave import given
from behave import then
from kazoo.exceptions import NodeExistsError
from p... |
class Register(object):
def __init__(self, name, bitwidth):
self.name = name
self.value = 0
self.past = [0] # maybe for rewind?
self.symbVal = [z3.BitVec(self.name, bitwidth)] # maybe for
# symbolic
... |
try:
from json_field.fields import JSONField
except ImportError:
pass # fails when imported by setup.py, no worries
__version__ = '0.4.1'
|
# pylint:disable=no-member
from ...protos import cfg_pb2
from ...serializable import Serializable
class MemoryDataSort:
Unspecified = None
Unknown = "unknown"
Integer = "integer"
PointerArray = "pointer-array"
String = "string"
UnicodeString = "unicode"
SegmentBoundary = "segment-boundary"... |
#!/usr/bin/env python
# Thanks a lot to nemo_ on irc.gnome.org for help on this and Kuleshov Alexander for undostack!
import pygtk, gtk, os, re, sys, gobject, imp, pango, enchant, undostack
pygtk.require('2.0')
if not os.path.exists(os.path.join(os.path.expanduser('~'), '.smartte', 'Default.conf')):
os.makedirs(os... |
import json
import sys
try:
from collections import MutableMapping
except ImportError:
from collections.abc import MutableMapping
PY3 = sys.version_info[0] >= 3
if PY3:
from urllib import parse as urlparse
from urllib.parse import unquote
from urllib.request import urlopen
unicode = str
else:... |
__version__ = "3.1.0"
|
"""
===================================================================
Multi-output Decision Tree Regression
===================================================================
An example to illustrate multi-output regression with decision tree.
The :ref:`decision trees <tree>`
is used to predict simultaneously the ... |
from common import modelzoo
import mxnet as mx
import os
import logging
import math
import argparse
def train_imagenet(args):
# arguments to change
num_epoch = args.num_epoch
batch_size = args.batch_size
lr = args.lr
lr_steps = [int(i) for i in args.lr_steps.split(',')]
lr_factor = args.lr_fac... |
from typing import Set, Dict, Union, Callable, Tuple
from hwt.code import Concat
from hwt.hdl.types.bits import Bits
from hwt.hdl.types.bitsVal import BitsVal
from hwt.hdl.types.sliceVal import HSliceVal
from hwt.hdl.value import HValue
from hwt.serializer.utils import RtlSignal_sort_key
from hwt.synthesizer.rtlLevel.... |
import re
import os.path
import fnmatch
from subprocess import Popen, PIPE
from vial import vfunc, vim
from vial.utils import buffer_with_file, focus_window, \
get_ws_len, mark, get_key_code, echo, get_projects
from vial.widgets import SearchDialog, ListFormatter, ListView
def escape():
if len(vim.windows) ... |
#!/usr/bin/env python
import sys
import os
def GetKV(key, vals):
lk = len(key)
for v in vals:
if (len(v) >= len(key) and v[0:lk] == key):
return v[lk:]
else:
return None
def GetStrand(value):
if (value & 16 != 0):
return 1
else:
return 0
def IsPrimary... |
import os
import pdb
import json
import sqlite3 as sqlite
import threading
import cherrypy
import mpv
import collections
from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool, WebSocket
from youtube_dl import YoutubeDL
# load lua libs for mpv to play youtube urls directly w/o
# translation with youtub... |
###########################################################
#
# Copyright (c) 2005-2008, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import docutils.core,docutils.nodes,sys,re
import pygments_code_block_directive
import sys
import os
import pprint
from types import StringType
from docutils import __version__, __version_details__, SettingsSpec
from docutils import frontend, io, utils, readers, writers
fr... |
#!/usr/bin/python
# Copyright (c) 2010 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.
"""
This tool launches several shards of a gtest-based binary
in parallel on a local machine.
Example usage:
parallel_launcher.py pat... |
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
'''Code to help make typed objects out of parsed YAML'''
from typing import Callable, Dict, List, Optional, Sequence, TypeVar
import yaml
try:
from yaml import CSafeL... |
# model.py
# Compiles an OBJ model file into a C++ file that can be linked
# with Apocalypse.
import sys, os
inFileName = sys.argv[1]
outFileName = sys.argv[2]
modelName = sys.argv[3]
vertices = []
texCoords = []
normals = []
# Basically, each vertex is a 3-tuple of 0-based indices into
# the vertices, texCoords an... |
from PySide import QtCore, QtGui, QtDeclarative
from fixture import Fixture
class FixtureWidget(QtDeclarative.QDeclarativeItem):
def __init__(self, parent = None):
super(FixtureWidget, self).__init__(parent)
self.setFlag(QtGui.QGraphicsItem.ItemHasNoContents, False)
self.setAccep... |
"""
Copyright 2017-2018 Fizyr (https://fizyr.com)
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... |
"""
Push basic system info (hostname, IP address, etc.) to Twitter
"""
import sys
import socket
import llnet as net
tw = net.Twitter('twitter_app1')
time_ntp = net.get_time_ntp()
hostname = socket.gethostname()
msg = "[%s] %s: active at %s" % (time_ntp, hostname, net.get_ip_address('wlan0'))
tw.update_status(msg)... |
from datetime import date
from hashlib import sha256
from urlparse import urlparse
import base64
import pickle
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.db.models.query_utils import Q
from django.http... |
from __future__ import division
import sys
import os
import shutil
import inspect
import configparser
from twiggy import log
log = log.name('meco')
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
from ..misc import setup_log
from .. import empirical as emp
from .. impo... |
#!/usr/bin/env python
# encoding: utf-8
# connection.py
#
# Created by Maan Bsat on 2013-09-02.
# Copyright (c) 2013 Maan Bsat. All rights reserved.
from Queue import Queue
from random import randint
from datetime import datetime
import ib.opt
from ib.opt import message
from ib.ext.Contract import Contract
from untw... |
# Name: HDF5FermiSource
from pathlib import Path
import inviwopy as ivw
import h5py
import numpy as np
class HDF5FermiSource(ivw.Processor):
'''
Process used for reading HDF5 data pertaining to fermi surface data
Outport
-------
volumeOutport: ivw.data.VolumeOutport
Final processed data... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import base64
import concurrent.futures
import errno
import logging
import os
import shutil
import tempfile
import traceback
from collections import OrderedDict
from typing import (
IO,
Any,
Callable,
Dict,
Iterable,
List,
... |
#!/usr/bin/env ccp4-python
'''
30.01.2016
@author: hlfsimko
'''
import logging
import os
import sys
from ample.ensembler.constants import SIDE_CHAIN_TREATMENTS
from ample.util import version
# Python 3.x --> ConfigParser renamed to configparser
try:
import configparser as ConfigParser
except ImportError:
i... |
#!/usr/bin/env python
import logging, sys, json
import time
import stomp
#import pprint
import config
import yaml
NETWORK_RAIL_AUTH = (config.NR_USER, config.NR_PASSWORD)
feed = config.NR_TMVT_FEED_ID
locations = yaml.load(open("Location_Info.dat","rb"))
#pretty = pprint.PrettyPrinter(indent=4)
# Sourced from http... |
#!/usr/bin/env python
"""
This module builds HTML documentation for models by introspecting the model
unit tests.
"""
from django.core import meta, template
import runtests
import inspect, os, re, sys
MODEL_DOC_TEMPLATE = """
<div class="document" id="model-{{ model_name }}">
<h1 class="title">{{ title }}</h1>
{{ bl... |
# -*- coding: UTF-8 -*-
# Copyright 2012-2017 Luc Saffre
# License: BSD (see file COPYING for details)
"""Defines the classes used for generating workflows:
:class:`State` and :class:`Workflow`, :class:`ChangeStateAction`.
"""
from builtins import str
import six
import logging
logger = logging.getLogger(__name__)
fr... |
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2018, Arm Limited and contributors.
#
# 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
#
# ... |
#ipc_lista1.8
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que pergunte quanto você ganha por hora e o número de horas trabalhadas no mês.
#Calcule e mostre o total do seu salário no referido mês.
QntHora = input("Entre com o valor de seu rendimento por hora: ")
hT = input("E... |
import logging
import os
import time
from WMCore.Credential.Proxy import Proxy as WMProxy
from lobster.util import Configurable, PartiallyMutable
logger = logging.getLogger('lobster.cmssw.proxy')
class Proxy(Configurable):
"""
Wrapper around CMS credentials.
Parameters
----------
renew : ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2007 Google Inc.
# Licensed to PSF under a Contributor Agreement.
#
# 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.... |
'''
A salt interface to psutil, a system and process library.
See http://code.google.com/p/psutil.
:depends: - psutil Python module
'''
# Import python libs
import sys
import time
# Import third party libs
try:
import psutil
HAS_PSUTIL = True
except ImportError:
HAS_PSUTIL = False
def __virtual__():
... |
import unittest
from hashlib import sha256
from pypeerassets.kutil import Kutil
class KutilTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
print('''Starting Kutil class tests.
This class handles all things cryptography.''')
def test_network_parameter_load(self):
... |
import csv
import datetime
from dateutil.parser import parse
from value_maps import ethnicity, war_participated
from api.models import Client
from api.models import Services
def sync_client():
with open('sample_data/client.csv') as csvfile:
reader = csv.DictReader(csvfile)
bulk_create = []
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
def literalize_string(content, is_unicode=False):
r'''Literalize a string content.
Examples:
>>> print literalize_string('str')
'str'
>>> print literalize_string('\'str\'')
"'str'"
>>> print literalize_string('\"\'str\'\"')
'"\'... |
class GetUserInfoOnException(object):
def process_exception(self, request, exception):
if request.user.is_authenticated():
request.META['CURRENT_USER'] = '%s: %s' % \
(request.user.pk, request.user.username)
|
from __future__ import (absolute_import, unicode_literals, division,
print_function)
from matplotlib import pyplot as plt
from matplotlib import gridspec
import numpy as np
from .fit import linear_fit, linear_fun, align
def mask(xs, mask_xs, invert=False):
'''Create mask from ranges. Mask... |
import time
import base64
import unittest
import storjcore
from btctxstore import BtcTxStore
class TestAuth(unittest.TestCase):
def setUp(self):
self.btctxstore = BtcTxStore()
self.sender_wif = self.btctxstore.create_key()
self.sender = self.btctxstore.get_address(self.sender_wif)
... |
from vcfkit import calc
from subprocess import Popen, PIPE
import hashlib
from test import Capturing, terminal
def test_sample_hom_gt():
with Capturing() as out:
calc.main(["calc", "sample_hom_gt", "data/test.vcf.gz"])
assert out[0] == 'sample\tfreq_of_gt\tn_gt_at_freq'
assert out[10] == 'QG536\t10... |
import sys
import os
import os.path
import re
import readline
import shlex
try:
import swiftclient as cloud
except ImportError:
print
"OpenStack Swift python API package are needed, download at:"
"swiftclient https://github.com/openstack/python-swiftclient.git"
sys.exit(1)
import swiftclient as cloud... |
####################################
# Driftwood 2D Game Dev. Suite #
# inputmanager.py #
# Copyright 2014 PariahSoft LLC #
# Copyright 2017 Michael D. Reiley #
# & Paul Merrill #
####################################
# **********
# Permission is hereby granted, free of charge,... |
# -*- coding: utf-8 -*-
# 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.
# ---------------------------------------------... |
# -*- coding: utf-8 -*-
import os
import unittest
from kisell import core
_license_file_path = os.path.join(
os.path.dirname(os.path.dirname(__file__)), 'LICENSE'
)
_license_file_content = None
with open(_license_file_path, 'r') as f:
_license_file_content = f.read()
class BaseTester(unittest.TestCase):
... |
import unittest
from httmock import all_requests, HTTMock, response
from flask import Flask
from flask.ext.goat import Goat
try:
from urlparse import urlparse
except:
from urllib.parse import urlparse
class TestGoat(unittest.TestCase):
def setUp(self):
self.app = Flask(__name__)
self.app... |
from __future__ import unicode_literals
import unittest
import mock
from mopidy_alarmclock import http
class HttpTest(unittest.TestCase):
def test_SetAlarmRequestHandler(self):
config = mock.Mock()
core = mock.Mock()
alarm_manager = mock.Mock()
msg_store = mock.Mock()
... |
#!/usr/bin/env python
from utils import *
def test_cheat_destroy_deck():
game = prepare_game()
game.player1.discard_hand()
game.player2.discard_hand()
game.player1.give(DESTROY_DECK).play(target=game.player2.hero)
assert not game.player2.deck
game.end_turn()
assert not game.player2.hand
assert game.player2.h... |
from __future__ import division
import sys
import math
import pytest
from gmpy_cffi import mpfr, mpq, mpz
from math import sqrt
invalids = [(), [], set(), dict(), lambda x: x**2]
class TestInit(object):
ints = [0, -1, 1, 3, -25]
def test_init_empty(self):
assert mpfr() == mpfr('0.0')
def tes... |
#
# Copyright 2012 Quantopian, 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 wr... |
import re
import pytest
from lektor.context import _ctx_stack
from lektor.context import Context
from lektor.utils import cleanup_path
from lektor.utils import cleanup_url_path
def test_cleanup_path():
assert cleanup_path("/") == "/"
assert cleanup_path("/foo") == "/foo"
assert cleanup_path("/foo/") == ... |
__doc_all__ = []
import unittest
import sys
import exceptions
import datetime
import time
import random
import threading
import wsgiref.validate
import httplib
import os
import tempfile
import socket
from cStringIO import StringIO
from cogen.common import *
from cogen.core import reactors
from cogen... |
import argparse
import json
import logging
import subprocess
import yaml
import re
import collections
import os
import requests
import urllib
import teuthology
from . import misc
from . import provision
from .config import config
from .lockstatus import get_status
log = logging.getLogger(__name__)
# Don't need to see... |
"""Top level driver functionality for processing a sequencing lane.
"""
import copy
import os
import re
from bcbio import utils, broad
from bcbio.log import logger
from bcbio.bam import callable
from bcbio.bam.trim import brun_trim_fastq, trim_read_through
from bcbio.pipeline.fastq import get_fastq_files, needs_fastq_... |
# oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
# Copyright (c) 2016, Gluu
#
# Author: Arvind Tomar
#
from org.xdi.service.cdi.util import CdiUtil
from org.gluu.jsf2.message import FacesMessages
from javax.faces.application import FacesMessage
from org.xdi.util... |
import re
from portality.lib import dataobj, swagger
from portality import models, regex
from portality.util import normalise_issn
from copy import deepcopy
from portality.regex import DOI,DOI_COMPILED
BASE_ARTICLE_STRUCT = {
"fields": {
"id": {"coerce": "unicode"}, # Note that we'll leave ... |
import matplotlib.pyplot as plt
workloads_to_be_plotted = [
"cmtDatasetSimple",
"cmtDatasetComplex",
"milanTelecomSimple",
"milanTelecomComplex",
"campaignExpendituresSimple",
"campaignExpendituresComplex",
"fedDisbursementsSimple",
"fedDisbursementsComplex"
]
timing_types = [
'Loading',
'Summariz... |
import os
import PIL
import sys
import glob
import imageio
import logging
import argparse
import numpy as np
from tqdm import tqdm
from datetime import datetime
from cartoongan import build_model
STYLES = ["shinkai", "hayao", "hosoda", "paprika"]
VALID_EXTENSIONS = ['jpg', 'png', 'gif']
# TODO: add self-trained carto... |
#!/usr/bin/env python
#
# thapbi_santi_otus.py
#
# Script to identify OTUs from metabarcoding reads.
#
# This is an almost direct translation of a pipeline written by Santiago
# Garcia, to generate OTU clusters from metabarcoding ITS reads in
# Phytophthora.
#
# (c) The James Hutton Institute 2016
# Author: Leighton Pr... |
"""
Forms and validation code for user registration.
"""
from django import newforms as forms
from django.core.validators import alnum_re
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from registration.models import RegistrationProfile
# I put this on all requ... |
import logging
log = logging.getLogger(__name__)
from django.contrib import admin
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from easy_select2 import select2_modelform
from .models import (
Convention,
Singer,
Chorus,
Quartet,
District,
Contest,... |
"""
Unit tests for django-registration.
"""
import datetime
from django.conf import settings
from django.contrib.auth.models import User
from django.core import mail
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
from django.test import TestCase
from registratio... |
import numpy as np
import json
import csv
import argparse
from pathlib import Path
from collections import defaultdict
from datetime import date
from getpass import getuser
from topopy.MorseSmaleComplex import MorseSmaleComplex as MSC, TopologicalObject
class Merge(object):
def __init__(self, level, is_max, src,... |
"""Thumber Library
Author Hannu Valtonen"""
import Image
import struct
import StringIO
try:
import json
except:
import simplejson as json
INDEX_VERSION = 1
class Thumber(object):
"""Thumber librarys main class, use this if you want to use everything"""
def __init__(self, thumbnail_sizes = None, reserv... |
"""Views for the ``django-tinylinks`` application."""
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import permission_required
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.db.models import Count, Sum
from django.http import Http404
from django... |
# Author: F. Alex Wolf (http://falexwolf.de)
# T. Callies
"""Rank genes according to differential expression [Wolf17]_.
"""
import numpy as np
import pandas as pd
from math import sqrt, floor
from scipy.sparse import issparse
from scipy.stats import rankdata
from scipy.stats import norm
from .. import utils
fr... |
#!/usr/bin/env python
# Copyright 2010 Leonid Movshovich <event.riga@gmail.com>
# This file is part of Webridge.
# Webridge 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 Lic... |
#!/usr/bin/env python
import os
import sys
import optparse
directory = os.path.dirname(__file__)
sys.path.append(
os.path.realpath(os.path.join(directory, '..', 'third_party', 'v8', 'tools'))
)
import js2c
js2c.GET_SCRIPT_SOURCE_CASE = """\
if (index == %(i)i) return std::string(sources + %(offset)i, %(sour... |
import os.path
import click
import readline
import getpass
import sys
from mastodon import Mastodon
# TODO: need to modify this to support multiple shards, since we have to register per shard
# For now it only supports the default mastodon.social shard
APP_PATH = os.path.expanduser('~/.config/tootstream/client.txt')
A... |
#!/usr/bin/env python
#
# Test cases for tournament.py
from tournament import *
def test_delete_all_event(test_num):
delete_all_events()
c = count_events()
if type(c) is not long:
raise TypeError(
"count_events() should return long value.")
if c != 0:
raise ValueError("Aft... |
from toydist.misc import \
Extension
from toydist.cabal_parser.cabal_parser import \
parse
class PackageDescription:
def __init__(self, name, version=None, summary=None, url=None,
author=None, author_email=None, maintainer=None,
maintainer_email=None, license=None, descript... |
#!/usr/bin/env python3
# Trace Generator for ECE5984 Cache Project
# Generates a trace file
import random
import pprint
import sys
import math
# Script Wide Values
rw_options = ['read', 'write']
#addr_options = range(0,0xffffffff+1) # must be range otherwise will fill mem
crit_options = ['hi', 'low']
#prior_options... |
#!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# 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/.
# ***** END LICENSE BLOCK *****
import sys, os, re, multiprocess... |
import os
from zipfile import ZipFile
#Place all .zip files from Udacity in the directory you specify below:
inputDirectory = "transcripts/"
#The formatted .txt files from each of the lessons will be saved in the directory you specify below:
outputDirectory = "parsedTranscripts/"
def parseTranscript(inputLines, outp... |
__version__ = '3.3.1'
if __name__ == '__main__':
print(__version__)
|
"""
Backfill information into the IEM summary table, so the website tools are
happier
"""
from __future__ import print_function
from pyiem.util import get_dbconn
from pyiem.datatypes import speed, distance, temperature
ISUAG = get_dbconn('isuag', user='mesonet')
IEM = get_dbconn('iem', user='mesonet')
def two():... |
#!/usr/bin/env python
#
# This program returns the gray matter segmentation given anatomical, spinal cord segmentation and t2star images
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2013 Polytechnique Montreal <www.neuro.polymtl.ca>
# Authors: Sara Dupont
#... |
from httplib2 import Http
from urllib import urlencode
from datetime import datetime
import exceptions
import json
import oauth2 as oauth
import os
import random
import time
import urlparse
class ResourceUnavailable(Exception):
"""Exception representing a failed request to a resource"""
def __init__(self, msg, http... |
# Copyright (c) 2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSHelperFn, AWSObject, AWSProperty
from .validators import boolean, network_port, positive_integer
class DBInstance(AWSObject):
resource_type = "AWS::RDS::DBInstance"
props = {
... |
import tkinter as Tk
import tkinter.ttk as ttk
import tkinter.simpledialog as simpledialog
import tkinter.filedialog as filedialog
import tkinter.messagebox as messagebox
import importlib
import tts
#if win
USE_REGISTRY = importlib.find_loader('winreg')
if USE_REGISTRY:
import winreg
else:
import xdgappdirs
impo... |
# -*- coding: utf-8 -*-
"""
Twingoで利用する認証バックエンドを提供します。
@author: Jun-ya HASEBA
"""
from django.conf import settings
from django.contrib.auth.models import User
import tweepy
from twingo.models import Profile
class TwitterBackend:
"""
TwitterのOAuthを利用した認証バックエンドです。
ModelBackendの代替として使用してください。
"""
... |
import configparser
import click
import signal
import sys
import time
from .common import TwitterConnection
class TweetReader:
def __init__(self, twitter, wall, query, lang=None):
self.twitter = twitter
self.wall = wall
self.params = {'q': query, 'since_id': 0}
self.tf = {}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.