text stringlengths 12 6.59M |
|---|
import psycopg2
import config
PROJECTS_KEY_ORDER = ['project_id', 'name', 'slug', 'description', 'photo_url', 'past_project_url']
GET_PROJECTS_QUERY = 'SELECT project_id, name, slug, description, photo_url, past_project_url FROM projects WHERE past_project = %s ORDER BY display_order;'
GET_PROJECT_PHOTOS_QUERY = 'SELE... |
"""
Return 0 if the string is "balanced"
Return 1 if the string is "open"
Return -1 if the string is "broken"
For the purposes of this assignment, open and closed parens must match.
As an example, consider this string:
')))((('
Although there are an equal number of open and closed parens,
they are not properly paired.... |
# -*- coding: utf-8 -*-
#
# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
import os
import tempfile
import datetime
import mimetypes
import urllib
import functools
import logging
logger = logging.getLogger('fnp.... |
from __future__ import print_function, division
#from pprint import pprint as print
import bali
fp = bali.FileParser()
'''
Try to prove hypothesis that Lanang strokes are on the beat and Wadon strokes
are off the beat
Starting with hypothesis that only high strokes (e and o) are being analyzed
'''
'''
What perce... |
from collections import defaultdict
from django.conf import settings
from django.dispatch import receiver
from django.db.models.signals import pre_save
from threading import currentThread
from django.contrib.sessions.models import Session
import json
import yaml
import proso.util
import os
import copy
DEFAULT_DEFAULT... |
## $Id$
##
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006 CERN.
##
## CDS Invenio 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 (a... |
## $Id$
##
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS Invenio 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
## Li... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014-2017 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __opener... |
#
#
# Copyright (C) 2006, 2007 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distri... |
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 CERN.
##
## Invenio 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, ... |
#!/usr/bin/env python
"""
This module provides functionalities for training an svr model
"""
from util.data_parser import DataParser
from util.keyword_extractor import KeywordExtractor
from lib.peer_extractor import PeerExtractor
import numpy as np
from sklearn.svm import SVC as SKSVR
from util.top_similar import TopSi... |
#!/usr/bin/env python
# life.py -- A curses-based version of Conway's Game of Life.
# Contributed by AMK
#
# An empty board will be displayed, and the following commands are available:
# E : Erase the board
# R : Fill the board randomly
# S : Step for a single generation
# C : Update continuously until a key is str... |
"""
A collection of lazy, repeatably consumable list- & tuple-like objects which
wrap any iterator.
"""
from collections import Sequence, MutableSequence
from sys import version_info
if version_info < (3, 0): # pragma: no cover
range = xrange # pylint: disable=redefined-builtin,invalid-name
__version__ = '1.... |
import re
import os
import codecs
import threading
import shutil
import queue
import uuid
import zipfile
import requests
import sys
from bs4 import BeautifulSoup
downloadQueue = queue.Queue()
debug = 1
hasQT = False
singleThread = False
try:
from PyQt4 import QtCore
hasQT = True
except... |
import logging
import os
import shutil
import sys
from subprocess import PIPE, Popen
from dcb.dcbenvironment import DCBEnvironment
from typing import List
from jinja2 import BaseLoader, Template
# inspired by http://blog.endpoint.com/2015/01/getting-realtime-output-using-python.html
# https://stackoverflow.com/questi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
DICOM2FEM - organ segmentation and FE model generator
Example:
$ dicom2fem -d sample_data
"""
# import unittest
from optparse import OptionParser
from scipy.io import loadmat, savemat
from scipy import ndimage
import numpy as np
import sys
import os
from PyQt4.QtCor... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#SVN:rev202 + PythonTidy + rewrite 'toString' methods using Python __str__ + test cases
from helpers import colored_print #to colorize the sentence output
class Sentence:
"""
A sentence is formed from:
sn : a nominal structure typed into a Nominal_group
sv : ... |
# -*- coding: utf-8 -*-
#
# Rackspace Developer Documentation documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 6 14:14:55 2014.
#
# 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
#... |
import logging
import base64
import hmac
import hashlib
from urllib import parse
from django.contrib.auth.decorators import login_required
from django.http import (HttpResponseBadRequest, HttpResponseRedirect,
HttpResponse, HttpResponseForbidden)
from django.conf import settings
from django.sh... |
from elasticsearch import Elasticsearch
import elasticsearch.helpers
import json
import gzip
import boto
import boto3
import tempfile
import dparselog
from datetime import datetime
import sqlite3
import os.path
import argparse
import sys
from copy import deepcopy
import time
import urllib3
from pprint import pprint
de... |
"""Bulk operations for indexd"""
import json
import flask
from indexd.errors import UserError
from indexd.index.drivers.alchemy import IndexRecord, IndexRecordUrl
from sqlalchemy.orm import joinedload
blueprint = flask.Blueprint('bulk', __name__)
blueprint.config = dict()
blueprint.index_driver = None
@blueprin... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import re
import csv
import logging
import itertools
import requests
from io import BytesIO, StringIO
from zipfile import ZipFile
from collections import namedtuple
from indra.util import read_unicode_csv
f... |
from indra.databases import mesh_client
def test_mesh_id_lookup_from_web():
mesh_id = 'D003094'
mesh_name = mesh_client.get_mesh_name_from_web(mesh_id)
assert mesh_name == 'Collagen', mesh_name
def test_invalid_id():
mesh_name = mesh_client.get_mesh_name_from_web('34jkgfh')
assert mesh_name is N... |
# -*- coding: utf-8 -*-
from abc import abstractmethod
import numpy as np
import tensorflow as tf
import inferbeddings.activations as activations
from inferbeddings.nli import tfutil
from inferbeddings.nli import BaseRTEModel
import logging
logger = logging.getLogger(__name__)
class BaseDecomposableAttentionMod... |
__author__ = 'Daniel Dittenhafer'
__version__ = '0.1'
__date__ = '2015-03-23'
import pandas as pd
import gviz_data_table as gv
import numpy
from datetime import datetime
def ToGvizDataTable(dataframe):
table = gv.Table()
dt = dataframe.dtypes
# Loop to add the columns from the dataframe to the gviz data... |
import datetime
import importlib
import os
import sys
import click
import jinja2
import markdown
import strictyaml
from docutils.core import publish_parts
from utilkit import datetimeutil, fileutil
def include_type_exists(key):
"""
Check whether the include type (plugin) is valid/exists.
Needs a file of ... |
import re
class BettingRound:
def __init__(self, lines):
self.cards = []
self.actions = []
_round_name_re = re.compile(r"^([A-Z ]+) \*\*\*.*$")
_street_cards_re = re.compile(r".*\[(.*)\].*")
# hits only last [Kh] construct because 1st * is greedy.
_hole_cards_re = re... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
############################################################################
#
# passgen.py
#
############################################################################
#
# Author: Videonauth <videonauth@googlemail.com>
# Date: 30.06.2016
# Purpose:
# Generate a rand... |
#!/usr/bin/env python3.5
# -*- coding: UTF-8 -*-
############################################################################
#
# passgen.py
#
############################################################################
#
# Author: Videonauth <videonauth@googlemail.com>
# Date: 30.06.2016
# Purpose:
# Generate a ra... |
#!/usr/bin/env python3.5
# -*- coding: UTF-8 -*-
############################################################################
#
# passgen.py
#
############################################################################
#
# Author: Videonauth <videonauth@googlemail.com>
# Date: 30.06.2016
# Purpose:
# Generate a ra... |
#!/usr/bin/env python
#
# -*- mode:python; sh-basic-offset:4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim:set tabstop=4 softtabstop=4 expandtab shiftwidth=4 fileencoding=utf-8:
#
import bottle
from bottle.ext import sqlalchemy as sqlaplugin
import ConfigParser
import hashlib
import logging
import os
import pygments
f... |
#!/usr/bin/env python
#########################################################################################
#
# Install patch.
#
# Note for the developer:
# =======================
# Patch are created manually as follows:
# - get the previous patch version from sourceforge (if it exists)
# - rename it (or if not ex... |
#!/usr/bin/python3
import cgi
import cgitb
import datetime
import json
import math
import os
import requests
import sys
from copy import copy
from datetime import datetime, timedelta, time
from random import randint
from bmdjson import completed_quarter, get_sha512_32_hash, decode, get_dash_price, get_dash_chain_tota... |
import math
import numpy as np
import scipy.linalg
import pyscf.gto.mole
pi=math.pi
class Cell(pyscf.gto.mole.Mole):
def __init__(self, mol, h):
pyscf.Mole.__init__(self, mol)
# h in HM (Eq. (3.1))
self.h=h
def get_gv(gs):
'''
integer cube of indices, -gs...gs along each d... |
"""
PEINARD: chill out and let me do your balance and accounting.
This is just a small algorithm.
Copyright (C) 2010-2011
Created by Feth AREZKI <feth AT tuttu.info>
Contributions by Alexis Metaireau <alexis AT notmyidea org>
This program is free software: you can redistribute it and/or modify
it under the terms o... |
#!/usr/bin/python
#
# Copyright (c) 2011 rPath, Inc.
#
# All rights reserved.
#
from django.db.models import Q
from django.db.models.query import EmptyQuerySet
from django.db import connection, transaction
from mint.django_rest import timeutils
from mint.django_rest.rbuilder import modellib
from mint.django_rest.rbui... |
#!/usr/bin/env python
#By @arbitrary_code
#https://github.com/bharshbarger/AutOSINT
#Special thanks to:
#@Beamr
#@tatanus
#unum alces!
try:
#builtins
import argparse, time, os, sys
#AutOSINT module imports
from modules.whois import Whois
from modules.dnsquery import Dnsquery
from modules.hibp import Haveibee... |
# Copyright 2016 Nexenta Systems, 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 req... |
import sys
import os
import settings
import difflib
"""
This script compares the generated CSV coverage files with the ones in the codebase.
"""
def check_file_exists(file):
if not os.path.exists(file):
print("Expected file '" + file + "' doesn't exist.", file=sys.stderr)
sys.exit(1)
def ignore... |
import json
import requests
import time
misperrors = {'error': 'Error'}
mispattributes = {'input': ['btc'], 'output': ['text']}
moduleinfo = {'version': '0.1', 'author': 'Sascha Rommelfangen',
'description': 'BTC expansion service to \
get quick information from MISP attribu... |
import sys
import os
import shutil
TEMP_DIR = "temp"
CODECS = ["utf8", "cp1252", "win1251"]
class Utf8LineConverter(object):
def __init__(self, input_path):
self.input_file = file(input_path)
self.output_file = None
def split_lines(self):
os.makedirs(TEMP_DIR)
for num, line ... |
import json
import sys
try:
import dns.resolver
resolver = dns.resolver.Resolver()
resolver.timeout = 0.2
resolver.lifetime = 0.2
except ImportError:
print("dnspython3 is missing, use 'pip install dnspython3' to install it.")
sys.exit(0)
misperrors = {'error': 'Error'}
mispattributes = {'input... |
# -*- coding: utf-8 -*-
import abc
import functools
import os
class DownloadFailed(Exception):
pass
class IDownloadStrategy(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def execute(self, url):
"""
Parameters
----------
url : str
Returns
... |
import json
import base64
from pymisp import MISPEvent
from collections import defaultdict, Counter
misperrors = {'error': 'Error'}
moduleinfo = {'version': '1', 'author': 'Christian Studer',
'description': 'Export to GoAML',
'module-type': ['export'],
'require_standard_format... |
"""HTML 5 conformance checker
Warning: this module is experimental, incomplete, and subject to removal at any time.
Usage:
>>> from html5lib.html5parser import HTMLParser
>>> from html5lib.filters.validator import HTMLConformanceChecker
>>> p = HTMLParser(tokenizer=HTMLConformanceChecker)
>>> p.parse('<!doctype html>... |
"""Module containing classes for datagrid MVC implementation."""
import os
from datetime import datetime
from gi.repository import (
GLib,
GObject,
GdkPixbuf,
Gtk,
Pango,
)
from . import popupcal
from .uifile import UIFile
GRID_LABEL_MAX_LENGTH = 100
_MEDIA_FILES = os.path.join(
os.path.dirn... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from bluebird import *
import sys
import re
import os
import platform
from math import inf
from time import sleep
from threading import Thread
from elftools.elf.elffile import *
from collections import defaultdict
from mmap import PROT_EXEC, PROT_READ, PROT_WRITE, \
... |
# -*- coding: utf-8 -*-
#
# LIKO-12 documentation build configuration file, created by
# sphinx-quickstart on Thu May 25 07:48:25 2017.
#
# 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 file.
#
# A... |
import math
import torch
from torch.autograd import Function
from torch.nn.modules.utils import _pair
from .. import masked_conv2d_cuda
class MaskedConv2dFunction(Function):
@staticmethod
def forward(ctx, features, mask, weight, bias, padding=0, stride=1):
assert mask.dim() == 3 and mask.size(0) == 1... |
#
# Quru Image Server
#
# Document: imaging_pillow.py
# Date started: 22 May 2018
# By: Matt Fozard
# Purpose: Provides an interface to the Pillow image processing library
# Requires: The Python Pillow library (http://python-pillow.org)
# Copyright: Quru Ltd (www.quru.com)
# Licence:
#
#... |
"""Module containing classes for datagrid MVC implementation."""
import os
from datetime import datetime
from gi.repository import (
GLib,
GObject,
GdkPixbuf,
Gtk,
Pango,
)
from pygtkcompat.generictreemodel import GenericTreeModel
from . import popupcal
from .uifile import UIFile
GRID_LABEL_MAX_... |
#!/usr/bin/env
import requests
import json
from threading import Thread
from queue import Queue
import marsem.protocol.config as cfg
import paramiko
# Global state variables
SERVER_RUNNING = False
# This queue is filled with move commands
queue = Queue(maxsize=1)
ssh = paramiko.client.SSHClient()
# Warning
ssh.set_... |
import os
from abc import ABCMeta
from abc import abstractproperty
from abc import abstractmethod
from cached_property import cached_property
from .pixels import VipsPixels
from .pixels import NumpyPixels
from .readers import DatasetReader
from .errors import MetadataError
from .metadata import IllumstatsImageMetadata
... |
##
# See the file COPYRIGHT for copyright information.
#
# 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... |
import pprint as pp
from dateutil import parser
import StringIO
import csv,json,math
import numpy as np
from collections import defaultdict
from tastypie.serializers import Serializer
from tastypie.resources import ModelResource, ALL
from tastypie.authorization import Authorization
from tastypie.authentication import... |
# -*- coding: utf-8 -*-
__version__ = '0.6'
|
from __future__ import unicode_literals
import datetime
import iso8601
import pytz
from calendar import timegm
from decimal import Decimal, localcontext
from uuid import UUID
from logging import getLogger
from pytz import BaseTzInfo
from .utils import escape, parse_array, comma_join, string_or_func, get_subclass_names
... |
# Copyright 2014-2015 Boxkite Inc.
# This file is part of the DataCats package and is released under
# the terms of the GNU Affero General Public License version 3.0.
# See LICENSE.txt or http://www.fsf.org/licensing/licenses/agpl-3.0.html
import sys
from os import listdir
from os.path import isdir, exists
from datac... |
# coding=utf-8
"""
A collection of small helper functions for generating small pieces of datatable output in custom
methods on a view.
Because of uncontrolled external use of ``preload_record_data()`` by the view, each of these utility
functions allows for generic ``*args`` to pass through to the function, even though... |
"""
This module contains the Connection class that manages the connection to the database,
and the `conn` function that provides access to a persistent connection in datajoint.
"""
import warnings
from contextlib import contextmanager
import pymysql as client
import logging
from getpass import getpass
from pymysql imp... |
import re
from django.db.models import Model, Manager
from django.core.exceptions import ObjectDoesNotExist
from django.forms.util import flatatt
from django.template.loader import render_to_string
try:
from django.utils.encoding import python_2_unicode_compatible
except ImportError:
from .compat import python... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import six
import six.moves.urllib as urllib
import tabulator
from .resource_file import (
InlineResourceFile,
LocalResourceFile,
RemoteResourceFi... |
import math
from decimal import Decimal
from typing import List, Optional
from mbstrdecoder import MultiByteStrDecoder
from typepy import Integer, Nan, StrictLevel, Typecode, TypeConversionError
from ._align import Align
from ._align_getter import align_getter
from ._base import DataPeropertyBase
from ._common import... |
# This file is part of LiSE, a framework for life simulation games.
# Copyright (c) 2013 Zachary Spector, zacharyspector@gmail.com
"""Widget to represent :class:`Place`s. :class:`Pawn` moves around on
top of these.
"""
from functools import partial
from kivy.properties import (
AliasProperty,
ListProperty,
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
# import queue
from multiprocessing import Process, Lock, get_context, Manager
from multiprocessing.queues import Queue
from queue import Empty
# import threading
import random
from PIL imp... |
from __future__ import print_function
from autobahn.twisted.websocket import WebSocketClientProtocol, WebSocketClientFactory
from twisted.internet.protocol import ReconnectingClientFactory
from twisted.internet.task import LoopingCall
class LiveStream(WebSocketClientProtocol): # pragma: no cover
""" Internal cla... |
# implicits.py copyright (c) 2003 Charl P. Botha <cpbotha@ieee.org>
# $Id: implicits.py,v 1.11 2004/02/25 20:50:32 cpbotha Exp $
import genUtils
from modules.Viewers.slice3dVWRmodules.shared import s3dcGridMixin
import vtk
import wx
# -------------------------------------------------------------------------
class im... |
# Based on the works of https://github.com/AlessandroZ/LaZagne/blob/master/Windows/lazagne/softwares/sysadmin/cyberduck.py
import win32crypt
import os, base64
import xml.etree.cElementTree as ET
class Cyberduck():
def __init__(self):
pass
# find the user.config file containing passwords
def get_p... |
import unittest
import pycellbase.cbrestclients as cbfts
from pycellbase.cbconfig import ConfigClient
from requests import Session
class GeneClientTest(unittest.TestCase):
"""Tests the GeneClient class"""
def setUp(self):
"""Initializes the gene client"""
self._gc = cbfts.GeneClient(Session()... |
# Copyright 2015 Cedric RICARD
#
# This file is part of CloudMailing.
#
# CloudMailing is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... |
import tensor
import lists
import sympy
'''
<!> Always use sympy.expand(exp) before using makeTermList(exp) <!>
If you ignore this recomendation, stuf might not work as expcted.
Delta is the Kronicer delta.
ContractDeltas contracts all idndices of all Deltas, that are sympy.Symbol or sympy.Dummy
>>> T=tensor.Tenso... |
from django.core.validators import RegexValidator
from django.db import models
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from imagekit.models import ProcessedImageField
from imagekit.processors import Transpose
from time import mktime
from datetime import datetime, timedelta
im... |
#!env python
# simple Twitter client using requests_oauthlib.
import requests_oauthlib
import ConfigParser
class DummyTwitter(object):
def __init__(self):
pass
def tweet(self, message):
print('[DUMMY TWEET] "{}" (len:{})'.format(message, len(message)))
return True
class Twitter(object... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import logging
import pymongo
from django.core.cache import cache
from contextlib import contextmanager
from . import BaseDriver
from . import DatabaseInfraStatus
from . import DatabaseStatus
from . import AuthenticationError
from . import... |
import multiprocessing
from dbt.adapters.postgres import PostgresAdapter
from dbt.logger import GLOBAL_LOGGER as logger # noqa
from dbt.compat import basestring
drop_lock = multiprocessing.Lock()
class RedshiftAdapter(PostgresAdapter):
@classmethod
def type(cls):
return 'redshift'
@classmeth... |
# (c) Nelen & Schuurmans. MIT licensed, see LICENSE.rst.
#from __future__ import unicode_literals
import pydap.responses.html
from pydap.util.template import GenshiRenderer, StringLoader
DEFAULT_TEMPLATE = pydap.responses.html.DEFAULT_TEMPLATE \
.replace("© Roberto De Almeida", "") \
.replace("<em><a hr... |
"""
Django settings for Epitome project.
Generated by 'django-admin startproject' using Django 1.8.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build path... |
# coding: utf-8
from sqlalchemy import BigInteger, Boolean, Column, Float, Integer, Numeric, \
String, Table, Text, text
from geoalchemy2.types import Geometry
from sqlalchemy.dialects.postgresql.base import ARRAY
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.met... |
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
class DiaryDetailAPIView(APIView):
def get(self, request, *args, **kwargs):
year = kwargs.get("year")
month = kwargs.get("month")
day = kwargs.get("day")
dateti... |
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django_dynamic_fixture import G, N
from entity.models import Entity, EntityRelationship
from mock import patch
from entity_subscription.models import Medium, Source, Subscription, Unsubscribe
class SubscriptionManagerMed... |
from eucadeploy.plugins.validator.validatorplugin import ValidatorPlugin
from schema import Schema, And, Or, Use, Optional
class Structure(ValidatorPlugin):
def validate(self):
self.envdata = self.environment
self.schema = Schema(
{
'description': And(str, error="Invalid... |
"""TinyFlow Example code.
Automatic variable creation and shape inductions.
The network structure is directly specified via forward node numbers
The variables are automatically created, and their shape infered by tf.infer_variable_shapes
"""
import tinyflow as tf
from tinyflow.datasets import get_mnist
# Create the m... |
"""
==========================
FastICA on 2D point clouds
==========================
This example illustrates visually in the feature space a comparison by
results using two different component analysis techniques.
:ref:`ICA` vs :ref:`PCA`.
Representing ICA in the feature space gives the view of 'geometric ICA':
ICA... |
#!/usr/bin/env python
# encoding: utf-8
r"""Runs idealized jump and sloped 1d shelf tests"""
import sys
from clawpack.riemann import layered_shallow_water_1D
import clawpack.clawutil.runclaw as runclaw
from clawpack.pyclaw.plot import plot
import multilayer as ml
def jump_shelf(num_cells,eigen_method,**kar... |
#!/usr/bin/env python3
import math
import copy
from collections import defaultdict
import sys
import re
def extract(s):
return [int(x) for x in re.findall(r'-?\d+', s)]
def rotate(g):
xs = []
for i in range(len(g)):
s = ''.join(x[i] for x in g)
xs.append(s)
return tuple(reversed(xs))... |
# CTK: Cherokee Toolkit
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2009-2010 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Software Foundation.... |
'''
Channels is where we store information for mapping virtual (qubit) channel to real channels.
Created on Jan 19, 2012
Original Author: Colm Ryan
Copyright 2013 Raytheon BBN Technologies
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License... |
import asyncio
import discord
import os
import re
import psutil
import platform
import time
import sys
import fnmatch
import subprocess
import speedtest
import json
import struct
from PIL import Image
from discord.ext import commands
from Cogs import Settings
from Cogs import DisplayName... |
import asyncio, discord, os, re, psutil, platform, time, sys, fnmatch, subprocess, speedtest, json, struct, shutil, tempfile
from PIL import Image
from discord.ext import commands
from Cogs import Utils, Settings, DisplayName, ReadableTime, GetImage, ProgressBar, UserTime, Message, DL
try:
from urll... |
import tushare as ts
import os
import pandas as pd
class DataBase:
def update_share_list(self):
self._log("updata share list form internet")
data = ts.get_stock_basics()
data.to_csv("share_list.csv")
def has_share_list_local(self);
return os.path.exists("share_list.csv")
d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""EMSL Api.
Usage:
EMSL_api.py list_basis [--atom=atom_name...]
[--db_path=db_path]
EMSL_api.py list_atoms --basis=basis_name
[--db_path=db_path]
EMSL_api.py get_basis_data --basis=basis_name
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os, sys, getopt
if sys.version_info[0] < 3:
raise Exception("Python 2.x is not supported. Please upgrade to 3.x")
import got
def main(argv):
if len(argv) == 0:
print('You must pass some parameters. Use \"-h\" to help.')
return
if len... |
import json
import Config
import User
from Util import Util
from BoardManager import BoardManager
from UserManager import UserManager
from BCache import BCache
from errors import *
TYPE_BOARD = 1
TYPE_DIR = 2
DEFAULT_LIST_FAVBOARD_COUNT = 20
class FavBoard(object):
def __init__(self, index = -1, name = '', fath... |
# Strangers wrote
import os
import sys
import numpy as np
import matplotlib.nxutils as nxutils
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.patches import FancyArrow
from subprocess import PIPE, Popen
from matplotlib.ticker import NullFormatter, MaxNLocator, MultipleLocator
import pyfits
i... |
import discord
from discord.ext import commands
import time
import datetime
import pytz
class GameTime():
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
async def time(self, ctx):
"""Displays current game time."""
await self.bot.say(embed=get_gametime(... |
####################
# wrap up loop-call
####################
from scipy.linalg import toeplitz
from scipy.ndimage import convolve
from scipy.stats import poisson
from scipy.sparse import coo_matrix
import numpy as np
import pandas as pd
from sklearn.cluster import Birch
###########################
# Calculate co... |
#!/usr/bin/env python3
# vim:fileencoding=utf-8:ts=8:et:sw=4:sts=4:tw=79
"""
lrrfeed.py
Periodically update LRR RSS feeds and store latest entries.
Copyright (c) 2015 Twisted Pear <pear at twistedpear dot at>
See the file LICENSE for copying permission.
"""
import aiohttp
import asyncio
import datetime
import feedp... |
import json
from collections import OrderedDict
from functools import wraps
from .cache import cache, recache
from .command import Command
from .settings import FormatterSettings
def formatter(name, command='', args=''):
def decorator(cls):
@wraps(cls)
def make_formatter(*args, **kwargs):
... |
# ======================================================================
# matscipy - Python materials science tools
# https://github.com/libAtoms/matscipy
#
# Copyright (2014) James Kermode, King's College London
# Lars Pastewka, Karlsruhe Institute of Technology
#
# This program is free software: you... |
# -*- coding: utf-8 -*-
"""
Django settings for fbstats project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_lit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.