src stringlengths 721 1.04M |
|---|
from metal.contrib.modules.sparse_linear_module import SparseLinearModule
from metal.end_model import EndModel
from metal.utils import recursive_merge_dicts
class SparseLogisticRegression(EndModel):
"""A _sparse_ logistic regression classifier for a single-task problem
Args:
input_dim: The maximum le... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" QiSrc Project """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import... |
from collections import namedtuple
from time import sleep
import click
import requests
from bs4 import BeautifulSoup
@click.command()
@click.option('--key', '-k',
type=click.STRING,
help='Goodreads dev API key',
)
def main(key):
url = "https://en.wikipedia.org/wiki/List_of... |
#!/usr/bin/env python2.7
import argparse
from collections import defaultdict
from fast5tools.samclass import *
from fast5tools.samops import *
parser = argparse.ArgumentParser(description="""
DESCRIPTION
Given a SAM file (with F5:Z: info attached) that is sorted by read name:
- get the alignment or set o... |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 22 14:45:42 2015
@author: Wasit
"""
#sequential
import time
import numpy as np
from six.moves import zip
from bokeh.plotting import *
def part(n=20, m=3):
base = n//m;
extra = n-m*(n//m)
x=np.ones(m,dtype=np.int32)*base
x[0:extra]=base+1
y = [0]
c... |
# -*- coding: utf-8 -*-
# This code is part of Amoco
# Copyright (C) 2018 Axel Tillequin (bdcht3@gmail.com)
# published under GPLv2 license
# import expressions:
from amoco.cas.expressions import *
# registers :
# -----------
# main reg set:
R = [reg("r%d" % r, 32) for r in range(32)]
with is_reg_flags:
PSW = ... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
import os
import tempfile
import mmap
import re
from xml.etree import ElementTree
from java_exec import run_java
NS = {'xmlns': "http://www.interlis.ch/INTERLIS2.3"}
class IliModel:
"""Metadata and link to model"""
def __init__(self, name, version="", uri="http://interlis.sourcepole.ch/"):
self.na... |
"""
koan = kickstart over a network
a tool for network provisioning of virtualization (xen,kvm/qemu,vmware)
and network re-provisioning of existing Linux systems.
used with 'cobbler'. see manpage for usage.
Copyright 2006-2008 Red Hat, Inc and Others.
Michael DeHaan <michael.dehaan AT gmail>
This program is free s... |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... |
###############################################################################
#
# codingDensityPlots.py - Create a GC histogram and a delta-CD plot.
#
###############################################################################
# #
#... |
import numpy as np
import time
import matplotlib.pyplot as plt
import random
# get gekko package with:
# pip install gekko
from gekko import GEKKO
import pandas as pd
# import data
data = pd.read_csv('data.txt')
tm = data['Time (sec)'].values
Q1s = data[' Heater 1'].values
Q2s = data[' Heater 2'].values... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/... |
# Copyright 2018 Google. 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 agree... |
#!/usr/bin/env python3
# coding: utf-8
# Copyright (C) 2017 Thomas De Keulenaer
#
# 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 lat... |
### Open Provenance February 2016 - https://myveryown.org
### Bitcoin Blockchain Information using python-bitcoinlib
### CTxIn & COutPoint Objects and Properties
### Donate to Open Provenance: 1opDUZQ9nsL1LJALBdV1dvqSMtcvNj9EC
## Import the modules required and setup a connection to bitcoin
import bitcoin
## Create a... |
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
#
# Copyright (c) 2014 Tom Kralidis
#
# 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 ... |
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
#
#
# googletasksapi.py
#
# Copyright (C) 2011 Lorenzo Carbonell
# lorenzo.carbonell.cerezo@gmail.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 Foundat... |
from functools import wraps
from pprint import pprint
class Debug:
enabled = True
allow_now = True
def __init__(self):
class on:
def __init__(self, parent):
self.parent = parent
def __call__(self):
self.parent.enabled = True
def... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import urllib2
import socket
import requests
import urlparse
import itertools
import datetime
import locale
import pprint
import logging
import decimal
import hashlib
import cStringIO
import time
import messytables
from slugify import slugify... |
import tensorflow as tf
"""tf.eye(num_rows, num_columns=None, batch_shape=None, dtype=tf.float32, name=None)
功能:返回单位阵。
输入:num_rows:矩阵的行数;num_columns:矩阵的列数,默认与行数相等
batch_shape:若提供值,则返回batch_shape的单位阵。"""
z1 = tf.eye(2, batch_shape=[2]) # 一个三维矩阵其中包含有两个2行2列的矩阵
z2 = tf.eye(2, batch_shape=[3]) # 一个三维矩阵其中包含有三... |
#!/usr/bin/env python
#
# Copyright 2017 Robot Garden, 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 applicab... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# kate: space-indent on; indent-width 4; mixedindent off; indent-mode python;
crashdump_use_jinja2 = False
def _(msg):
return msg
def tag_a(name, title=None, href=None, alt=None):
from xml.etree.ElementTree import Element, tostring
a = Element('a')
a.text = n... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Lucas Huber, Copyright CoĐoo Project
#
# 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... |
'''
Created on 2014-7-21
@author: xiajie
'''
import numpy as np
'''
Useful for simple classifiers
'''
def simulate_data():
kai = 9.34
X = np.zeros((200,10))
Y = np.zeros(200)
for i in range(200):
x = []
for j in range(10):
xj = np.random.standard_normal(1)[0]
x... |
from mitmproxy.addons import readfile
from mitmproxy.test import taddons
from mitmproxy.test import tflow
from mitmproxy import io
from mitmproxy import exceptions
from unittest import mock
import pytest
def write_data(path, corrupt=False):
with open(path, "wb") as tf:
w = io.FlowWriter(tf)
for i... |
# -*- coding: utf-8 -*-
import datetime
DATE_DICT = {'1':('01-01', '01-31'),
'2-1':('02-01', '02-28'),
'2-2':('02-01', '02-29'),
'3':('03-01', '03-31'),
'4':('04-01', '04-30'),
'5':('05-01', '05-31'),
'6':('06-01', '06-30'),
'7... |
from ... import options as opts
from ... import types
from ...charts.chart import Chart
from ...globals import ChartType
class Funnel(Chart):
"""
<<< Funnel >>>
Funnel diagram is suitable for one-way analysis of single process
with standardized business process, long cycle and multiple lin... |
# pylint: disable=no-self-use,invalid-name
from deep_qa.data.datasets.dataset import Dataset, TextDataset
from deep_qa.data.instances.text_classification.text_classification_instance import TextClassificationInstance
from tests.common.test_case import DeepQaTestCase
class TestDataset:
def test_merge(self):
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import datetime
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
m... |
from functools import partial
from threading import Thread
import requests
from sportorg.models.memory import race
from sportorg.modules.live import orgeo
class LiveClient:
@staticmethod
def is_enabled():
obj = race()
live_enabled = obj.get_setting('live_enabled', False)
urls = obj.g... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
import time
driver = webdriver.PhantomJS()
url = "https://lzone.daiwa.co.jp/lzone/common/authorize"
username='shinichi... |
#!/usr/bin/env python2.7
""" A simple continuous receiver class. """
# Copyright 2015 Mayer Analytics Ltd.
#
# This file is part of pySX127x.
#
# pySX127x 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,... |
# Copyright 2010, 2011 Red Hat Inc.
#
# This file is part of StratoSource.
#
# StratoSource 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 opti... |
# The ansible_runner file contains all of the functions used to call ansible
# playbooks. The runner can call playbooks via the Ansible API or the CLI,
# and supports the three most recent versions of Ansible (just as the Ansible
# team itself does)
from __future__ import absolute_import
import os
import sys
import j... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""Corpus in SVMlight format."""
from __future__ import with_statement
import logging
from gensim import utils
from gensim.corpora ... |
# -*- coding: utf8 -*-
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
import pytz
import datetime
from pyramid.httpexceptions import HTTPFound
from persistent.list import PersistentList
from dace.objectofcollaborat... |
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2004-2007, 2009-2011, 2016 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notic... |
##########################################################################
#
# Copyright (c) 2011, 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 numpy as np
import pandas as pd
import nltk
from nltk.stem.snowball import SnowballStemmer
from sklearn.feature_extraction.text import TfidfVectorizer
from bs4 import BeautifulSoup
import re
import os
import codecs
from sklearn import feature_extraction
from sklearn.cluster import KMeans
from pprint import pprin... |
import pandas as pd
from sqlalchemy import create_engine, MetaData, Table, select
# Parameters
TableName = "data"
DB = {
'drivername': 'mssql+pyodbc',
'servername': 'DAVID-THINK',
#'port': '5432',
#'username': 'lynn',
#'password': '',
'database': 'BizIntel',
'driver': 'SQL Server Native Cl... |
# ===========================================================================
# eXe
# Copyright 2004-2006, University of Auckland
#
# 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... |
# -*- coding: utf-8 -*-
"""
This is the default template for our main set of AWS servers.
Common traits:
* Use memcached, and cache-backed sessions
* Use a MySQL 5.1 database
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disabl... |
from scipy.interpolate import RegularGridInterpolator, RectBivariateSpline, interp1d
from scipy.ndimage.filters import gaussian_filter, minimum_filter
import numpy as np
class source:
"""
An object which wraps equation of state tables and functions.
"""
def __init__(self, inNames, outNames, contains, smoothMask,... |
import re
from .html import hlp
from .text import remove_diacritics
VOWELS = 'AEIOUYaeiouy'
def abbreviate(text, min_len=1, tags=True, enabled=True):
"""
Abrège les mots avec une limite de longueur (par défaut 1).
>>> print(abbreviate('amélie'))
<span title="Amélie">a.</span>
>>> print(abbrevi... |
"""
Copyright (c) 2014 High-Performance Computing and GIS (HPCGIS) Laboratory. All rights reserved.
Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Authors and contributors: Eric Shook (eshook@kent.edu); Zhengliang Feng (odayfans@gmail.com, zfeng2@kent.edu)
"""
from set... |
# rootpy license excluded in this source file
# Copyright (C) 2010 Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# bo... |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... |
# -*- encoding: utf-8 -*-
#
# :authors: Arturo Filastò
# :licence: see LICENSE
from ooni.templates import httpt
class ExampleHTTP(httpt.HTTPTest):
name = "Example HTTP Test"
author = "Arturo Filastò"
version = 0.1
inputs = ['http://google.com/', 'http://wikileaks.org/',
'http://torprojec... |
# -*- coding: utf-8 -*-
from PyQt5 import QtWidgets
from gui.gl_widget import GLWidget
from gui.pdf_widget import PDFWidget
from gui.histogram_widget import HistogramWidget
class GLStack(QtWidgets.QStackedWidget):
def __init__(self, parent, main_window):
QtWidgets.QStackedWidget.__init__(self, parent)
... |
import mock
import HBASR
import unittest
import xmlrpclib
import xs_errors
import os
import SR
import xml.dom.minidom
import util
def mock_init(self):
pass
def imp_fake_probe():
dom = xml.dom.minidom.Document()
hbalist = dom.createElement("HBAInfoList")
dom.appendChild(hbalist)
for host in ["ho... |
import os
import sys
from fileinfo import FileInfo
import logging
import datetime
import mods
import xml.etree.ElementTree as ET
# logging data
dateTimeInfo = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
logger1 = logging.getLogger('1')
logger1.addHandler(logging.FileHandler("logs/single_file_asset_to_mods_" + d... |
from datetime import date
from footparse import eloratings
from testutils import data_path
def test_homepage_date():
path = data_path('eloratings_home.html')
page = eloratings.HomePage.from_file(path)
assert page.date == date(2016, 9, 18)
def test_homepage_ratings():
truth = {
'rank': 234,
... |
# -*- coding: utf-8 -*-
"""
Supply
@author: Michael Howden (michael@sahanafoundation.org)
@date-created: 2010-08-16
Generic Supply functionality such as catalogs and items that will be used across multiple modules
"""
module = "supply"
if deployment_settings.has_module("logs"):
#================... |
import dsz
import ops.data
import ops.parseargs
dsz.control.echo.Off()
dsz.ui.Background()
parser = ops.parseargs.ArgumentParser()
parser.add_argument('command_id', type=int, help='Command ID to monitor.')
args = parser.parse_args()
pr = ops.data.getDszObject(args.command_id)
lasterror = None
while True:
dsz.scrip... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
DOCUMENTATION = '''
---
module: slony_path
author: Alexandr Kurilin
version_added: "1.9"
short_description: Create / delete a slony path
requirements: [psycopg2, slonik]
description:
- Manage a Slony-I path
'''
EXAMPLES = '''
# Foo
- slony_path: name=TODO
'''
try:
im... |
# -*- coding: utf-8 -*-
#
# scrapydd documentation build configuration file, created by
# sphinx-quickstart on Fri Oct 07 20:40:31 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated f... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
'''
(*)~----------------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2013 Moritz Kassner & William Patera
Distributed under the terms of the CC BY-NC-SA License.
License details are in the file license.txt, distributed as part of this softwar... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.php
~~~~~~~~~~~~~~~~~~~
Lexers for PHP and related languages.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygroups, default, us... |
# 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 version.
#
# This library is distributed in the hope that it will be us... |
import sys
import os
from lib.data_loader import utils_mask3d
sys.path.append(os.path.dirname(os.getcwd()))
from lib.utils import output_utils
from lib.data_loader import mri_atlas
from lib.data_loader import pet_atlas
from lib.data_loader import PET_stack_NORAD
from lib.data_loader import MRI_stack_NORAD
from lib.uti... |
from scipy import io
import numpy as np
from counting_grid import CountingGrid
'''
This is an example of using the CountingGrid
class on lung cancer gene expression data.
'''
def filter_by_variance(X,nr_of_features_to_keep):
'''
Function for thresholding data by variance,
keeping only 'nr_of_features_to_... |
# Lint as: python2, python3
# Copyright 2019 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
#
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware 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 cop... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Ensures the given config value is set.
# https://github.com/mikolak-net/ansible-raspi-config/blob/master/library/pi_boot_config.py
from ansible.module_utils.basic import *
# START - common module code - yay for copy-paste
BOOT_CONFIG_PATH = "/boot/config.txt"
RASPI_CONFIG_... |
# Copyright (c) 2014 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
import pandas as pd
from eod_historical_data import (get_api_key,
get_eod_data,
get_dividends,
get_exchange_symbols,
get_exchanges, get_currencies, get_indexes)
import datetime
import requ... |
# <copyright>
# (c) Copyright 2017 Hewlett Packard Enterprise Development LP
#
# 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 ve... |
# Copyright (c) 2012-2013 - The IBus Cangjie authors
#
# This file is part of ibus-cangjie, the IBus Cangjie input method engine.
#
# ibus-cangjie 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... |
## Create a network trace from the saturator output
import glob
import os
import sys
INPUT_PATH = 'raw_traces'
OUTPUT_PATH = 'cleaned_traces'
def extract_trace(filePath, targetFilePath):
with open(filePath) as f:
with open(targetFilePath, 'w+') as wf:
firstLine = True
for line in ... |
# -*- coding: utf-8 -*-
# (c) 2018, Ivan Mikheykin <ivan.mikheykin@flant.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
cal... |
#! /usr/bin/env python
from pbhla.filenames import get_file_type
__author__ = 'bbowman@pacificbiosciences.com'
import logging
from tempfile import NamedTemporaryFile
from pbcore.io.FastaIO import FastaRecord, FastaWriter
from pbcore.io.FastqIO import FastqRecord, FastqWriter
from pbhla.io.AmpAnalysisIO import Amplic... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from typing import TYPE_CHECKING
from .local_provider import LocalCryptographyProvider
from .._internal import EllipticCurveKey
from ... import KeyOperation, KeyType
i... |
import numpy as np
from old.project import FILE_NAMES
from old.project import ROOT_PATH
from old.project import exists
from old.project import makedirs
def percetage_executer():
for file_name in FILE_NAMES:
generate_intervals(file_name, 5)
print file_name
break
def generate_intervals(fi... |
import logging
from typing import Any, Dict
from freqtrade.exceptions import OperationalException
from freqtrade.exchange import (available_exchanges, get_exchange_bad_reason, is_exchange_bad,
is_exchange_known_ccxt, is_exchange_officially_supported)
from freqtrade.state import RunMode
... |
#
# Response handlers for P2P Server
#
import asyncio
import logging
from functools import partial
from hashlib import sha1, sha384
from uuid import uuid4
from os import path
from lib.Database import getFriendRequests, getSigningKeys, setUidMask, storeAuthority, setFriendAuth, getMessageKeys, \
setAddress, getFil... |
"""Utilities for manipulating BED files.
"""
import os
import shutil
import sys
import subprocess
import toolz as tz
from bcbio import utils
from bcbio.bam import ref
from bcbio.distributed.transaction import file_transaction
from bcbio.pipeline import config_utils
from bcbio.pipeline import datadict as dd
from bcbio... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# dblib/postgres.py (spaces, not tabs)
# PostgreSQL database driver for Taxídí.
# Zac Sturgeon <admin@jkltech.net>
# 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 Softwa... |
from django.utils import timezone
from .models import ConInfo, Registration, BlockRegistration, TimeBlock, get_choice, Game
def friendly_username(user):
name = user.first_name + " " + user.last_name
name = name.strip()
if "" == name:
name = user.username
return name
def get_con_value(parame... |
#
# BitBake (No)TTY UI Implementation
#
# Handling output to TTYs or files (no TTY)
#
# Copyright (C) 2006-2007 Richard Purdie
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# Thi... |
#!/usr/bin/env python
import argparse
from random import randint
parser = argparse.ArgumentParser(description='Gem5 Fault Instance Generator')
parser.add_argument('-b', '--btb-access-count', type=str, dest='bacFile',
help='File containing BTB access references')
parser.set_defaults(bacFile="m5ou... |
"""Packaging information."""
from subprocess import call
from sys import exit
from setuptools import Command, setup
from brute import (
__doc__ as description,
__version__ as version,
)
class TestCommand(Command):
description = 'run all tests'
user_options = []
def initialize_options(self):
... |
from __future__ import print_function
import glob
import hw_sungyong_list
import os
# os.chdir("homework_01")
list_a = [10, 30, 40, -20, 15]
list_b = [-90, 20, 50, 2, 4]
list_c = ['hello', 34, 0, 12]
num_p = 3
num_q = 7
sy_a = hw_sungyong_list.square_of_list(list_a, num_p)
sy_b = hw_sungyong_list.square_of_list(li... |
"""Networking overhead (200 trials on 200 nodes)
In this run, we will start 100 trials and run them on 100 different nodes.
This test will thus measure the overhead that comes with network communication
and specifically log synchronization.
Cluster: cluster_100x2.yaml
Test owner: krfricke
Acceptance criteria: Shoul... |
###
# Copyright (c) 2005, Ali Afshar
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions, a... |
"""
============================================================
Comparing random forests and the multi-output meta estimator
============================================================
An example to compare multi-output regression with random forest and
the :ref:`multioutput.MultiOutputRegressor <multiclass>` meta-e... |
# coding=utf-8
from django.contrib.auth.models import User, Group
from django.test.testcases import TestCase
from grading.models import *
from grading.autograding import get_autograders
class StudentTest(TestCase):
def test_user_creation_creates_student(self):
u = User.objects.create(username = "test1", ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Thing to automate getting custom reports from IPEDS.
Usage:
./csv_downloader.py test
./csv_downloader.py --uid=<uid_path> --mvl=<mvl_path>
Options:
--uid=FILE Path to .uid file
--mvl=PATH Path to .mvl file or directory containing .mvl files
You also need ... |
'''
Created on Aug 23, 2015
@author: robertbitel
'''
from bs4 import BeautifulSoup
try:
import urllib2 # @UnresolvedImport @UnusedImport
except:
import urllib.request as urllib2 # @Reimport
class EspnKickerStatHeader(object):
def __init__(self, soup):
'''for now we are just going to hard code it... |
import rpy2.robjects as R
def binomialTailTest(count, nTrials, pEvent, oneSided=True):
alt = 'greater' if oneSided else 'two.sided'
func = R.r['binom.test']
result = func(x=count, n=nTrials, p=pEvent, alternative=alt)
return result[2][0]
count = 530
nTrials = 1000
pEvent = 0.5
result = binomialTa... |
from setuptools import setup, find_packages
setup(
name='Djinja',
version=".".join(map(str, __import__("djinja").__version__)),
description='A package that makes possible the integration of Jinja2 in Django, in a clean way.',
long_description=open('README.rst').read(),
author='Syrus Akbary Nieto',
... |
#! /usr/bin/env python
"""Regression test.
This will find all modules whose name is "test_*" in the test
directory, and run them. Various command line options provide
additional facilities.
Command line options:
-v: verbose -- run tests in verbose mode with output to stdout
-q: quiet -- don't print anythin... |
from toee import *
def OnBeginSpellCast( spell ):
print "Read Magic OnBeginSpellCast"
print "spell.target_list=", spell.target_list
print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
#game.particles( "sp-divination-conjure", spell.caster )
def OnSpellEffect( spell ):
print "Read Magic OnS... |
import socket
class ChooyanHttpClient:
def request(host, port=80):
response = ChooyanResponse()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
request_str = 'GET / HTTP/1.1\nHost: %s\r\n\r\n' % (host)
s.send(request_str.encode('utf-8'))
... |
#requires: apiclient, --upgrade google-api-python-client, oauth2client
import praw
import httplib2
import os
import sys
import datetime
from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
... |
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
import importlib.util
import os
import __main__
from configparser import ConfigParser
from core import environment
from core import inputEvent
from core.settings import settings
from core import debug
class... |
"""A pre-trained implimentation of VGG16 with weights trained on ImageNet."""
##########################################################################
# Special thanks to
# http://www.cs.toronto.edu/~frossard/post/vgg16/
# for converting the caffe VGG16 pre-trained weights to TensorFlow
# this file is essentially ju... |
#!/usr/bin/env python
#from distribute_setup import use_setuptools
#use_setuptools()
from setuptools import setup
import sys
PY3 = sys.version_info >= (3,)
VERSION = "0.4.1"
COMMANDS = ['fscat',
'fscp',
'fsinfo',
'fsls',
'fsmv',
'fscp',
'fsrm',... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.