src stringlengths 721 1.04M |
|---|
import argparse
import json
import logging
import time
from collections import defaultdict
from pynet import Node, NodeHooks, Encryptor, PeerDefinition
from pynet.util import run_node
SHUTDOWN = False
class KVPDB(object):
"""A per-owner dictionary.
Each owner has their own dictionary, this class exposes metho... |
from __future__ import division, absolute_import
__author__ = 'Tatiana Likhomanenko'
import sys
import struct
from scipy.special import expit
import numpy
from rep_ef.estimators._matrixnetapplier import MatrixnetClassifier
def unpack_formula(formula_stream, print_=True):
features = list() # feature names
... |
# Copyright (c) 2012, 2013 Rich Porter - see LICENSE for further details
import message
import random
import test
import verilog
################################################################################
message.control.ERROR.threshold = 100
# use verilog callback on each clock
class cbClk(verilog.callback) :... |
# Copyright 2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Long-poll event adapter tests."""
__metaclass__ = type
from lazr.lifecycle.event import (
ObjectCreatedEvent,
ObjectDeletedEvent,
ObjectModifiedEvent,
)
from s... |
import os
import importlib.machinery
def _download_file_from_remote_location(fpath: str, url: str) -> None:
pass
def _is_remote_location_available() -> bool:
return False
try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_stat... |
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
class ReviewDecision(models.Model):
name = models.CharField(_("Name"), max_length=255)
description = models.TextField(_("Description"), blank=True, null=True)... |
"""Setup."""
import io
from os import path
from setuptools import setup
here = path.abspath(path.dirname(__file__))
# io.open for py27
with io.open(path.join(here, "README.rst"), encoding="utf-8") as f:
long_description = f.read()
# import __version__ attributes
about = {}
with open(path.join(here, "fbm", "__... |
# -*- coding: utf-8 -*-
#
# StarMaker ndb Admin documentation build configuration file, created by
# sphinx-quickstart on Tue Feb 10 18:17:07 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated... |
import os
import re
from .data_source import DataSource, DataCollection
from .ecoinvent_lcia import EcoinventLciaConfig, EI_LCIA_SPREADSHEETS
FILE_PREFIX = ('current_Version_', 'ecoinvent ')
FILE_EXT = ('7z', 'zip')
ECOINVENT_SYS_MODELS = ('apos', 'conseq', 'cutoff')
MODELMAP = {
'apos': ('apos',),
'conseq': ... |
#Copyright (c) 2011,12 Walter Bender
# 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.
#
# You should have received a cop... |
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import api, models, fields
class PickingType(models.Model):
_inherit = 'stock.picking.type'
display_completion_info = fields.Boolean(
help='Inform operator of a completed operation at processing ... |
import random
from django.utils.encoding import smart_unicode
import jinja2
from jingo import register, env
from tower import ugettext as _
import amo
@register.function
def emaillink(email, title=None, klass=None):
if not email:
return ""
fallback = email[::-1] # reverse
# inject junk somewh... |
# Copyright 2015 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 a... |
# -*- coding: utf-8 -*-
#
# 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
#... |
# -*- coding: utf-8 -*-
import os
import MySQLdb
import pandas as pd
import traceback
import logging
from mysql_query import ROOT_PATH
from tools.json_tools import JsonConf
class TDJobTimeUsedQuery():
def __init__(self, conf_path=os.path.join(ROOT_PATH, 'conf/conf.json')):
# init param
self.conf_... |
def cells():
'''
# 4/ Problem solutions
'''
'''
'''
# helper code needed for running in colab
if 'google.colab' in str(get_ipython()):
print('Downloading plot_helpers.py to util/ (only neded for colab')
!mkdir util; wget https://raw.githubusercontent.com/minireference/noBSL... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import pickle
import logging
from indra.sources import bel, biopax
import indra.tools.assemble_corpus as ac
from indra.preassembler import Preassembler
from indra.preassembler.hierarchy_manager import hiera... |
class DLNode(object):
def __init__(self):
self.key = None
self.value = None
self.prev = None
self.next = None
class LRUCache(object):
def __init__(self, capacity):
"""
:type capacity: int
"""
self.head = DLNode()
self.tail = DLNode()
... |
import warnings
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
class BackendTest(TestCase):
backend = 'django.contrib.auth.backends.ModelBackend'
def s... |
#/usr/local/bin/python
# sendmail.py
#
# a simple interface for injecting mail to the local mail delivery
# agent
#
import os,string,re
#import log
DISABLED=0
VALID_CHARS = string.ascii_letters + string.digits + "@.+-_,:"
VALID_CHARS_RE = "([^-@\+\._,:A-Za-z0-9])"
def shell_escape(s):
global VALID_CHARS, VALID... |
###############################################################################
# lazyflow: data flow based lazy parallel computation framework
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/o... |
import base64
import csv
import sys
FIELDS = ("summary", "detail")
def extract_doc(stream):
targets = dict()
target = None
for line in stream:
# only comment lines
if not line.startswith("#"):
continue
# strip off the comment, trailing whitespace, and a single lead... |
"""
WSGI config for piper 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_APPLICATION`` se... |
import re
from urlparse import urlparse, urlunsplit
from django import forms
from django.contrib import admin
from .models import Mirror, MirrorProtocol, MirrorUrl, MirrorRsync
class MirrorUrlForm(forms.ModelForm):
class Meta:
model = MirrorUrl
def clean_url(self):
# is this a valid-looking U... |
from subprocess import call
from os import path
import hitchpostgres
import hitchselenium
import hitchpython
import hitchserve
import hitchredis
import hitchtest
import hitchsmtp
# Get directory above this file
PROJECT_DIRECTORY = path.abspath(path.join(path.dirname(__file__), '..'))
class ExecutionEngine(hitchtest... |
from collections import deque
import inspect
import json
from giotto import get_config
from giotto.exceptions import (GiottoException, InvalidInput, ProgramNotFound,
MockNotFound, ControlMiddlewareInterrupt, NotAuthorized, InvalidInvocation)
from giotto.primitives import GiottoPrimitive, RAW_INVOCATION_ARGS
from ... |
# Copyright (c) 2011-2012 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
#
# U... |
import sys
import requests
import requests_cache
import string
import unicodedata
import json
import shutil
import os
import re
import pprint
import pathvalidate
import ptab.cgi
#
# PTAB API
#
baseURL = 'https://developer.uspto.gov/ptab-api'
docsURL = 'https://developer.uspto.gov/ptab-api/documents'
trialsURL = 'htt... |
#!/usr/bin/python
import sys, os, operator, numpy, MySQLdb, json
import matplotlib.pyplot as plt
from db import entity
from db import session
from collections import defaultdict
'''
@author: anant bhardwaj
@date: Feb 12, 2013
script for preparing data in lenskit format
'''
entities = entity.Entity().entities
sessi... |
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from ...models import ContentBlock
class AbstractSingleProductBlock(ContentBlock):
name = _("Single Product")
code = 'single-product'
group = _("Catalogue")
template_name = "fancypages/blocks/... |
from django import views
from django.shortcuts import render, get_object_or_404
from django.views.generic import TemplateView
from django.views.generic.edit import CreateView
from .models import *
from .forms import *
import requests
import http
from django.urls import reverse_lazy
from django.views.decorators.csrf imp... |
#
# 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 python3
# -*- coding: utf-8 -*-
"""Tests for the syslog parser."""
from __future__ import unicode_literals
import unittest
from plaso.parsers import syslog
from tests.parsers import test_lib
class SyslogParserTest(test_lib.ParserTestCase):
"""Tests for the syslog parser."""
def testParseRsyslo... |
import pytest
import copy
from blitzdb import Document
import six
@pytest.fixture(scope="function")
def mockup_backend():
class Backend(object):
def __init__(self):
self.attributes = {'foo': 'bar', 'baz': 123}
def get(self, DocumentClass, pk):
return DocumentClass(copy... |
import sys
import getopt
import traceback
import urllib2
from urlparse import urljoin, urlparse, ParseResult
from BeautifulSoup import BeautifulSoup
def connect(conn, url):
assert conn is not None, 'Input connection must be valid'
assert url, 'Input old URL cannot be empty'
response = None
try:
... |
# -*- coding: utf-8 -*-
"""
Utilites for copying huge HDF5 files.
Created on Thu Jun 20 14:02:59 2013
"""
#from ../modules/hdf5_creator import create_empty_hdf5
from tables import openFile
import numpy as np
import time
def copy_hdf5_newindex(data, new):
"""Copying a part of data, updating indexes.
Cop... |
# Copyright 2015 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... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
## Does "land_surface_air__latent_heat_flux" make sense? (2/5/13)
# Copyright (c) 2001-2014, Scott D. Peckham
#
# Sep 2014. Fixed sign error in update_bulk_richardson_number().
# Ability to compute separate P_snow and P_rain.
# Aug 2014. New CSDMS Standard Names and clean up.
# Nov 2013. Con... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
import mimetypes
from pathlib import Path
import iso8601
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django_cleanup import cleanup
from rdmo.core.constants import (VALUE_TYPE_BOOLEAN, VALUE_TYPE_CHOICES,
VALU... |
#!/usr/bin/env python3
from mpi4py import MPI
from baselines.common import set_global_seeds
from baselines import bench
import os.path as osp
from baselines import logger
from baselines.common.atari_wrappers import make_atari, wrap_deepmind
from baselines.common.cmd_util import atari_arg_parser
def train(env_id, num_... |
#
# Copyright 2014 Thomas Rabaix <thomas.rabaix@gmail.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... |
#!/usr/bin/env python3
# coding: utf-8
from analyze import get_msgs
from collections import defaultdict
import itertools
import random
import re
class TgMarkov(object):
START='\x01'
STOP='\x02'
def __init__(self, msgs):
self.table = {}
self.user_table = defaultdict(list)
prev = ... |
# -*- coding: utf-8 -*-
#
# Copyright 2007 Zuza Software Foundation
#
# This file is part of translate.
#
# translate is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at y... |
def get_cmmds(filename):
values = []
next = []
final = []
file = open(filename, 'r')
for line in file:
values.append(line.split(' '))
for i in range(len(values)):
for j in range(4):
temporary = values[i][j]
if temporary.endswith('\n'):
nex... |
import os
import traceback
from couchpotato.api import addApiView
from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotato.environment import Env
log = CPLog... |
import bpy
from io_scene_cs.utilities import rnaType, rnaOperator, B2CS, BoolProperty
from io_scene_cs.utilities import HasSetProperty, RemoveSetPropertySet
from io_scene_cs.utilities import RemovePanels, RestorePanels
class csFactoryPanel():
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_contex... |
# -*- coding: utf-8 -*-
import base64
import os
import random
import time
from auto_tagify import AutoTagify
from boto.s3.key import Key
from PIL import Image
from pymongo import DESCENDING
from pymongo.objectid import ObjectId
import settings
CONTENT_TYPE = 'image/jpeg'
ATAG = AutoTagify()
ATAG.link = "/tag"
RECENT... |
# force floating point division. Can still use integer with //
from __future__ import division
# This file is used for importing the common utilities classes.
import numpy as np
import matplotlib.pyplot as plt
# need to add the utilities class. Want 'home' to be platform independent
from os.path import expanduser
home ... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2013 XXX, Inc.
# 2013 红铭曼,王芳
#
# Author: 红铭曼,王芳 <hongmingman@sina.com>
# Maintainer: 红铭曼,王芳 <hongmingman@sina.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... |
import warnings
import torch.cuda
__all__ = ['all_reduce', 'reduce', 'broadcast', 'all_gather', 'reduce_scatter']
SUM = 0 # ncclRedOp_t
def is_available(tensors):
devices = set()
for tensor in tensors:
if tensor.is_sparse:
return False
if not tensor.is_contiguous():
... |
# -*- coding: utf-8 -*-
from pysignfe.xml_sped import *
class InfSubstituicaoNfse(XMLNFe):
def __init__(self):
super(InfSubstituicaoNfse, self).__init__()
self.Id = TagCaracter(nome=u'InfSubstituicaoNfse', propriedade=u'Id', raiz=u'/')
self.NfseSubstituidora = TagInteiro(nome=u'NfseSubstit... |
import socket
import select
import codes
import funs
import os
import subprocess
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('server_ip', type=str, help='address of the server (e.g. 198.123.1.3)')
parser.add_argument('--server_port', type=int, default=12345, required=False, help='port server... |
# Copyright (c) 2016 Riverbank Computing Limited <info@riverbankcomputing.com>
#
# This file is part of PyQt5.
#
# This file may be used under the terms of the GNU General Public License
# version 3.0 as published by the Free Software Foundation and appearing in
# the file LICENSE included in the packaging of this fi... |
# Minio Python Library for Amazon S3 Compatible Cloud Storage, (C) 2015 Minio, 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
#
# Unle... |
# Copyright (c) 2013-2021, Freja Nordsiek
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions ... |
#!/usr/bin/python3 -W all
"""
getTweetText.py: extract tweet text from json file
usage: getTweetText.py < file
20170418 erikt(at)xs4all.nl
"""
import csv
import json
import re
import sys
# command name for error messages
COMMAND = sys.argv[0]
patternNewline = re.compile("\n")
# open csv output
with sys.s... |
import socket
import time
import sys
import random
import math
import threading
msg_header = 'AADD'
msg_stamp = '\x00\x00\x00\x00'
msg_id_gw = '2016A008'
msg_id_dev = '00000000'
msg_devtype = '\x01\x00'
msg_auth_key = '88888888'
msg_auth_datatype = '\x1c\x00'
msg_auth = msg_header+msg_stamp+msg_id_gw+msg_id_dev+ms... |
## @file
# This file is used to create/update/query/erase table for Queries
#
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. ... |
# Lint as: python3
# Copyright 2019 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 a... |
class LangStructBase(object):
def __init__(self, parse_tree):
self._parse_tree = parse_tree
class Tag(LangStructBase):
_DEFAULT_TAG_NAME = 'div'
def compile(self, block, env):
tag_name = self._DEFAULT_TAG_NAME
class_names = []
_id = None
_filter = None
att... |
import scipy.linalg as la
from interfaces import *
from utilities import *
import numpy as np
def test_coarse_operator():
"""
Build and test the :class:`CoarseLO`.
"""
nt,npix,nb= 400,20,1
blocksize=nt/nb
d,pairs,phi,t,diag=system_setup(nt,npix,nb)
c=bash_colors()
runcase={'I':1,'QU':2,... |
import plone.testing
import zeit.cms.repository.interfaces
import zeit.cms.section.interfaces
import zeit.cms.testcontenttype.interfaces
import zeit.cms.testing
import zope.component
import zope.interface
ZCML_LAYER = zeit.cms.testing.ZCMLLayer(
'ftesting.zcml', product_config=zeit.cms.testing.cms_product_config)... |
#!/usr/bin/python
##################################################
######## Please Don't Remove Author Name #########
############### Thanks ###########################
##################################################
#
#
__author__='''
Suraj Singh
surajsinghbisht054@gmail.com
https://bitforestinfo.bl... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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... |
from datetime import datetime
from functools import partial
from io import StringIO
import numpy as np
import pytest
import pytz
from pandas._libs import lib
from pandas.errors import UnsupportedFunctionCall
import pandas as pd
from pandas import DataFrame, Series, Timedelta, Timestamp, isna, notna
import pandas._te... |
# Copyright 2013-present Barefoot Networks, 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 ... |
# -*- 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... |
import warnings
from functools import wraps
from couchbase_core import operation_mode
def deprecate_module_attribute(mod, deprecated=tuple()):
return warn_on_attribute_access(mod, deprecated, "deprecated")
class Level(object):
desc = None # type: str
msg_params = "msg_params"
def __new__(cls, f... |
# Version 8 of the database updates FieldChanges as well as adds tables
# for Regression Tracking features.
import sqlalchemy
from sqlalchemy import String, Integer, Column, ForeignKey
# Import the original schema from upgrade_0_to_1 since upgrade_1_to_2 does not
# change the actual schema, but rather adds functional... |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from models import ModelFactory
from common import import_simplejson
from error import TweepError
class Parser(object):
def parse(self, method, payload):
"""
Parse the response payload and return the result.
Retur... |
#Example showing how to run 'fiber' (gridNode+girdConnection) in Yade-MPI
from yade import utils
from yade.gridpfacet import *
from yade import mpy as mp
# create a Fiber class with attributes of the nodes it consists, the node which corresponds to the centre of mass, and a tuple 'segs' which consists the node pair ... |
#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under the
# terms of the GNU General Public License as published by ... |
import random, math
import pygame
import basic_shape
import coin
class Enemy(basic_shape.Shape):
def explode(self, bullet):
coins = []
for i in range(self.numcoins):
angle = random.randint(0, 360)
coins.append(
coin.Coin(self.position, self.GUI.coin_img, ang... |
#! /usr/bin/env python
#
# DNmap Server - Edited by Justin Warner (@sixdub). Originally written by Sebastian Garcia
# Orginal Copyright and license (included below) applies.
#
# This is the server code to be used in conjunction with Minions, a collaborative distributed
# scanning solution.
#
#
# DNmap Version Modi... |
import sys
sys.path.append('..')
import os
import json
from time import time
import numpy as np
from sklearn.externals import joblib
import scipy
from scipy import io
# from matplotlib import pyplot as plt
# from sklearn.externals import joblib
import theano
import theano.tensor as T
from lib import activations
fro... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from System.Collections.Generic import List
from System.Drawing.Color import FromArgb
from Rhino.Geometry import Point3d
from Rhino.Geometry import Line
from compas_rhino.conduits import BaseConduit
from compa... |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... |
import pandas as pd
from .pyomoio import get_entity, list_entities
def create_result_cache(prob):
entity_types = ['set', 'par', 'var', 'exp']
if hasattr(prob, 'dual'):
entity_types.append('con')
entities = []
for entity_type in entity_types:
entities.extend(list_entities(prob, entity_... |
##
# Copyright 2013 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (http://w... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from random import sample
from scipy import isscalar
from dataset import DataSet
from pybraingpu.utilities import fListToString
class SupervisedDataSet(DataSet):
"""SupervisedDataSets have two fields, one for input and one for the target.
"""
def __... |
from webtest import TestApp
import wsgi_basic_auth
def wsgi_app(environ, start_response):
body = b'this is private! go away!'
headers = [
('Content-Type', 'text/html; charset=utf8'),
('Content-Length', str(len(body)))
]
start_response('200 OK', headers)
return [body]
def test_no... |
"""Editions API tests."""
from rest_framework import status
from tests.utils import SimpleAPITestCase, logged_in
from projects.factory import EditionFactory, EditionFormFactory
class EditionEndpointsTest(SimpleAPITestCase):
"""Test access to the editions endpoints."""
factory = EditionFactory
read_exp... |
#!/usr/bin/python
"""
Benjamin Carr
Homework #2 - MPCS 55001
Answers:
(1) Program below.
(2) My program is correct for all cases where both the numbers and the distances from the median
are unique. I spent a lot of time (30+ hrs) trying to figure out other ways of doing this other than using a
dictio... |
import sqlite3 as lite
import sys
#statusuuid
# active = 37806757-4391-4c40-8cae-6bbfd71e893e
# pending = 0eaec4f3-c524-40ab-b295-2db5cb7a0770
# finished = f82db8cc-a969-4495-bffd-bb0ce0ba877a
# running = 6c25b6d2-75cc-42c3-9c8c-ccf7b54ba585
#sounduuid
# on = 510b9503-7899-4d69-83c0-690342daf271
# off = 05797a63-51f5... |
from pyswagger import SwaggerApp, utils, primitives, errs
from ..utils import get_test_data_folder
from ...scanner import CycleDetector
from ...scan import Scanner
import unittest
import os
import six
class CircularRefTestCase(unittest.TestCase):
""" test for circular reference guard """
def test_path_item_... |
import epydoc
import epydoc.apidoc
import epydoc.cli
import epydoc.docbuilder
import epydoc.docintrospecter
import epydoc.docwriter.html
import epydoc.markup.epytext
import inspect
import PyQt4.QtCore
import sys
import types
DOC_PAGES = [
("Hello world!", "doc-hello-world"),
]
OUTPUT_DIR = "output"
# SIP does som... |
# -*- coding: utf-8 -*-
import test_helper
import json
import re
import unittest
from gid_online_service import GidOnlineService
service = GidOnlineService()
#service.set_proxy("89.108.77.131:80", "http")
document = service.fetch_document(service.URL)
all_movies = service.get_movies(document)['items']
class GidO... |
from .NotifierClass import Notifier
import twitter
from datetime import datetime, timedelta
import time
import threading
class TFFPNotifier(Notifier):
def __init__(self,cfgParser,insec):
self.header = insec
try:
self.screenname = cfgParser.get(insec,"username").strip()
except:
self.screenname = ''
sel... |
import scrapenhl_globals
import os.path
def get_url(season, game):
"""
Returns the NHL API url to scrape.
Parameters
-----------
season : int
The season of the game. 2007-08 would be 2007.
game : int
The game id. This can range from 20001 to 21230 for regular season, and 30111 ... |
"""
Custom logging handlers we use.
LogBuffer
Handler used solely for temporarily storing messages so that they can be
retrieved later.
Copyright 2012 Red Hat, Inc.
Licensed under the GNU General Public License, version 2 as
published by the Free Software Foundation; see COPYING for details.
"""
__author__ = """
oli... |
from copy import deepcopy
from globals import *
import zones as zns
import life as lfe
import render_los
import bad_numbers
import zones
import alife
import numpy
import tiles
import maps
import logging
import time
import sys
def astar(life, start, end, zones, chunk_mode=False, terraform=None, avoid_tiles=[], avoi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import caronte
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
version = caronte.__version__
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
print("You probably want to ... |
# -*- coding: utf-8 -*-
#
# This file is part of PyGaze - the open-source toolbox for eye tracking
#
# PyGaze is a Python module for easily creating gaze contingent experiments
# or other software (as well as non-gaze contingent experiments/software)
# Copyright (C) 2012-2013 Edwin S. Dalmaijer
#
# ... |
# -*- coding: utf-8 -*-
"""Writer for Debian packaging (dpkg) files."""
from __future__ import unicode_literals
import io
import os
from l2tdevtools.dependency_writers import interface
class DPKGCompatWriter(interface.DependencyFileWriter):
"""Dpkg compat file writer."""
PATH = os.path.join('config', 'dpkg', ... |
"""Logistic Regression with Grid Search (scikit-learn)"""
import os, sys
import itertools
import joblib
import pandas as pd
import numpy as np
from sklearn import model_selection
from sklearn import linear_model
from sklearn import metrics
sys.path.append(os.path.join("..", "modeldb"))
from modeldbclient import Mo... |
import sys
import numpy as np
import mne
from mne.minimum_norm import read_inverse_operator, apply_inverse_epochs
from my_settings import (mne_folder, epochs_folder, source_folder)
subject = sys.argv[1]
method = "dSPM"
snr = 1.
lambda2 = 1. / snr**2
labels = mne.read_labels_from_annot(
subject=subject, parc="PA... |
# 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... |
#---------------------------------
# PIPELINE RUN
#---------------------------------
# The configuration settings to run the pipeline. These options are overwritten
# if a new setting is specified as an argument when running the pipeline.
# These settings include:
# - logDir: The directory where the batch queue scripts... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.