src stringlengths 721 1.04M |
|---|
import json as js
import numpy as np
from argparse import ArgumentParser
def main(data_file, train_file, test_file, dev_file, num_noise):
data = js.load(open(data_file, "r"))
train_data = []
test_data = []
dev_data = []
np.random.seed(100)
test_indices = np.random.choice(a=range(len(data))... |
from proteus.default_n import *
from proteus import (StepControl,
TimeIntegration,
NonlinearSolvers,
LinearSolvers,
LinearAlgebraTools)
import vof_p as physics
from proteus.mprans import VOF
from proteus import Context
ct = Context.get... |
# -*- coding: utf-8 -*-
# alot documentation build configuration file
import sys, os
###############################
# readthedocs.org hack,
# needed to use autodocs on their build-servers:
# http://readthedocs.org/docs/read-the-docs/en/latest/faq.html?highlight=autodocs#where-do-i-need-to-put-my-docs-for-rtd-to-find... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... |
# -*- coding: utf-8 -*-
import re
from navmazing import NavigateToSibling, NavigateToAttribute
from widgetastic.widget import Text, Checkbox
from widgetastic_manageiq import SummaryFormItem
from widgetastic_patternfly import BootstrapSelect, Button, Input
from widgetastic_patternfly import CandidateNotFound
from cfm... |
import io
import socket
import struct
from PIL import Image
import cv2
import numpy
# Start a socket listening for connections on 0.0.0.0:8000 (0.0.0.0 means
# all interfaces)
server_socket = socket.socket()
server_socket.bind(('0.0.0.0', 8000))
server_socket.listen(0)
# Accept a single connection and make a file-lik... |
import h2o
class GroupBy:
"""
A class that represents the group by operation on an H2OFrame.
Sample usage:
>>> my_frame = ... # some existing H2OFrame
>>> grouped = my_frame.group_by(by=["C1","C2"],order_by="C1")
>>> grouped.sum(col="X1",na="all").mean(col="X5",na="all").max()
An... |
import pandas as pd
import sys
class FullAffmatCompiler(object):
"""docstring for FullAffmatCompiler"""
def __init__(self, handle):
super(FullAffmatCompiler, self).__init__()
self.handle = handle
self.summed_affmat = pd.DataFrame()
self.current_df = None
self.affmats = d... |
"""With this string:
'monty pythons flying circus'
Create a function that returns a sorted string with no duplicate characters
(keep any whitespace):
Example: ' cfghilmnoprstuy'
Create a function that returns the words in reverse order:
Example: ['circus', 'flying', 'pythons', 'monty']
Create a function that returns... |
import threading, io, struct, time
from ThreadClient import ThreadClient
from devices.Devices import *
class CameraModule(ThreadClient):
def __init__(self, name):
ThreadClient.__init__(self, name)
self.camera_capture = False
# Execute command
def execute_cmd(self, cmd):
args = cmd.split(" ")
cmd = args[0]... |
import requests
#import BeautifulSoup
from bs4 import BeautifulSoup
import HTMLParser
from HTMLParser import HTMLParser
import sys
import os
# Open the file.
r = open(sys.argv[1])
if not os.path.isdir('Detail_Class_List_files'):
os.rename('Detail Class List_files', 'Detail_Class_List_files')
# Try to parse the ... |
# -*- coding: utf-8 -*-
from collections import OrderedDict
from unittest.case import TestCase
from unittest import mock
from alamo_common.test.utils import override_settings
from alamo_worker.plugins.druid import DruidResult
from alamo_worker.plugins.evaluate import ResultEvaluator
from alamo_worker.plugins.http_che... |
# coding: utf-8
from __future__ import unicode_literals
import codecs
from .utils import default_words, default_verbs
from .Stemmer import Stemmer
from .WordTokenizer import WordTokenizer
class Lemmatizer(object):
"""
>>> lemmatizer = Lemmatizer()
>>> lemmatizer.lemmatize('کتابها')
'کتاب'
>>> lemmatizer.lemmat... |
# jtChannelBox - Modular / Customizeable Channel Box
# Copyright (C) 2016 Jared Taylor
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your ... |
"""
Django settings for moo project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import... |
"""
.. module:: dbsync.utils
:synopsis: Utility functions.
"""
import random
import inspect
from sqlalchemy.orm import (
object_mapper,
class_mapper,
ColumnProperty,
noload,
defer,
instrumentation,
state)
def generate_secret(length=128):
chars = "0123456789"\
"abcdefghijklm... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Red Hat, Inc.
#
# This program 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.... |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import division
__license__ = 'GPL v3'
__copyright__ = '2010-2012, Timothy Legge <timlegge@gmail.com>, Kovid Goyal <kovid@kovidgoyal.net> and David Forrester <davidfor@internode.on.net>'
__docformat__ = 'restructuredtext en'
'... |
import os
import sys
import numpy as np
from scipy.signal import get_window
import matplotlib.pyplot as plt
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../software/models/'))
import stft
import utilFunctions as UF
eps = np.finfo(float).eps
"""
A4-Part-3: Computing band-wise energy e... |
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import random
import string
from django.conf import settings
from django.core.exceptions ... |
import httpretty
import unittest
from os import path
import types
import sys
import requests
from yaaHN.models import item
from yaaHN import hn_client
from yaaHN.helpers import item_parser, API_BASE
from test_utils import get_content, PRESET_DIR
class TestItem(unittest.TestCase):
def setUp(self):
httpret... |
# System built-in modules
import time
from datetime import datetime
import sys
import os
from multiprocessing import Pool
# Project dependency modules
import pandas as pd
pd.set_option('mode.chained_assignment', None) # block warnings due to DataFrame value assignment
import lasagne
# Project modules
sys.path.append('... |
"""Coders for individual Variable objects."""
from typing import Any
import warnings
from functools import partial
import numpy as np
import pandas as pd
from ..core import dtypes, duck_array_ops, indexing
from ..core.pycompat import dask_array_type
from ..core.variable import Variable
class SerializationWarning(Ru... |
"""Performance test for treadmill.scheduler
"""
import timeit
# Disable W0611: Unused import
import tests.treadmill_test_deps # pylint: disable=W0611
# XXX(boysson): Test needs update to new Scheduler API
# XXX: from treadmill import scheduler
def schedule(sched):
"""Helper function to run the scheduler."""
... |
import sys
import eventlet
from eventlet import event
import logging
import msgpack
from .settings import BUF_LEN
LOG = logging.getLogger('Server')
class Server(object):
exit_event = event.Event()
def __init__(self, conf):
super(Server, self).__init__()
self._node_listen_ip = conf.get('se... |
import unittest
from collections import OrderedDict
from hamlpy.compiler import Compiler
from hamlpy.parser.attributes import read_attribute_dict
from hamlpy.parser.core import ParseException, Stream
class AttributeDictParserTest(unittest.TestCase):
@staticmethod
def _parse(text):
return read_attribu... |
#!/usr/bin/env python3
import sys
def help():
print("\nUsage:\n\t./{0} {1} {2}\n\n".format(sys.argv[0], "change_from", "change_to"))
if __name__ == "__main__":
if len(sys.argv) != 4 :
help()
else:
chgfrom = str(sys.argv[1])
chgto = str(sys.argv[2])
snapnum = str(sys.arg... |
from PySide.QtGui import QFrame, QHBoxLayout, QLabel, QPushButton
from ..menus.disasm_options_menu import DisasmOptionsMenu
class QDisasmStatusBar(QFrame):
def __init__(self, disasm_view, parent=None):
super(QDisasmStatusBar, self).__init__(parent)
self.disasm_view = disasm_view
# widg... |
# Copyright 2014 CloudFounders NV
#
# 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 writ... |
#!/usr/bin/env python
#
# vim: tabstop=4 noexpandtab shiftwidth=4 softtabstop=0
#
# Show all ports of all VM instances for
# all users and topologies.
# Like the console port and the VNC port
#
# v0.3 18-Feb-2017
# adjusted to Mitaka
# v0.2 02-Dec-2015
# adapted to Kilo release
# v0.1 24-Nov-2014
# initial release
#
# ... |
__author__ = 'valentin'
#from mezzanine.forms.models import Form
from django.forms import ModelForm, Textarea
from django import forms
from django.forms.models import inlineformset_factory,modelformset_factory,BaseModelFormSet
from ..models.organization import Organization
from ..models.person import Person,PersonLoca... |
# -*- 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... |
#
# smartthings.py
#
# David Janes
# IOTDB.org
# 2014-01-31
#
# Demonstrate how to use the SmartThings API from Python.
#
# See also:
# Example App explanation:
# http://build.smartthings.com/blog/tutorial-creating-a-custom-rest-smartapp-endpoint/
#
# Example PHP code:
# https://www.dropbox.com/s/7m... |
from datetime import datetime
from decimal import Decimal
from functools import wraps
from mock import Mock, patch
import operator
import os
import re
import sys
from typing import Any, Callable, Dict, List, Optional, TypeVar, Tuple, cast
import ujson
import json
from django.core import signing
from django.core.manage... |
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... |
#!/usr/bin/env python
# Seq_chopper!
from __future__ import print_function
from os import path
# The fasta parser.
import screed
import docopt
import sys
__author__ = "Luisa Teasdale"
CLI_ARGS = """
USAGE:
seq_chopper.py -f SEQFILE -p PARTITIONS
OPTIONS:
-f SEQFILE The multi-species alignment file in fasta f... |
import sys
def parse_file(filepath):
############################################
# Read the layout file to the board array.
# Note how the order in which the rows are
# read is reversed in the final array. This
# accomodates the requirement that positions
# arenumbered from the bottom left.
... |
# 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... |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import swapper
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('contenttypes', '0001_initial'),
]
... |
## \file redirect.py
# \brief python package for file redirection
# \author Trent Lukaczyk, Aerospace Design Laboratory (Stanford University)
# \version 0.0.0
#
# ----------------------------------------------------------------------
# Imports
# --------------------------------------------------------------------... |
"""
Contains all classes and functions to deal with lists, dicts, generators and
iterators in general.
Array modifications
*******************
If the content of an array (``set``/``list``) is requested somewhere, the
current module will be checked for appearances of ``arr.append``,
``arr.insert``, etc. If the ``arr`... |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 ... |
import unittest
import os
import pandas as pd
import sys
FILE_DIR = os.path.dirname(os.path.realpath(__file__))
if FILE_DIR + "/../" not in sys.path:
sys.path.append(FILE_DIR + "/../")
import gtmanipulator as gt
class GtClassTestCase(unittest.TestCase):
def test_summarize(self):
test_data = gt.GtMani... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# migadmin - admin control panel with daemon status monitor
# Copyright (C) 2003-2015 The MiG Project lead by Brian Vinter
#
# This file is part of MiG.
#
# MiG is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... |
# -*- coding: utf-8 -*-
u"""Clichés.
---
layout: post
source: write-good
source_url: https://github.com/btford/write-good
title: Cliches
date: 2014-06-10 12:31:19
categories: writing
---
Cliches are cliché.
"""
from proselint.tools import existence_check, memoize
@memoize
def check(text):
""... |
# -*- coding: utf-8 -*-
from flask import request
from configuration import config, ConfFields
from Cisco79xxPhoneDirectory import app
from flask.views import View
class PhoneBookProviderBase(View):
"""Phonebook provider base class."""
Routing = {}
NameFieldKey = "name"
NumberFieldKey = "number"
Pa... |
from models import AgencyCountries, Country8DPFix, CountryExclusion, NotApplicable, Rating
from consts import NA_STR
base_selector = lambda q : q.baseline_value
cur_selector = lambda q : q.latest_value
def float_or_none(x):
if NotApplicable.objects.is_not_applicable(x):
return NA_STR
try:
ret... |
#This plugin sends a "Server Rules" mail to every player that connects to the server.
#It also adds a /rules command to resend the mail if a player needs it.
import clr
clr.AddReferenceToFileAndPath(GameDir + "IR.exe")
import Game
from System import DateTime
#This function sends the "Server Rules" mail to a player
de... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from raptiformica.actions.prune import check_if_instance_is_stale
from raptiformica.shell.execute import COMMAND_TIMEOUT
from tests.testcase import TestCase
class TestCheckIfInstanceIsStale(TestCase):
def setUp(self):
self.log = self.set_up_patch('raptiformica.actions.prune.log')
self.compute_chec... |
#!/usr/bin/python
import logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
import procgame.game, sys, os
import procgame.config
import random
import procgame.sound
sys.path.insert(0,os.path.pardir)
import bingo_emulator.common.units as units
import bingo_em... |
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2004-2006 Donald N. Allingham
#
# 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 t... |
#!/usr/bin/python
import json
import signal
import subprocess
import socket
import logging
from time import sleep
from datetime import datetime
import RPi.GPIO as GPIO
from socketIO_client import SocketIO
import MFRC522
from TTLeague import Player, Match, Game
from Adafruit_CharLCD import Adafruit_CharLCD
from ev... |
"""
=============================
OOB Errors for Random Forests
=============================
The ``RandomForestClassifier`` is trained using *bootstrap aggregation*, where
each new tree is fit from a bootstrap sample of the training observations
:math:`z_i = (x_i, y_i)`. The *out-of-bag* (OOB) error is the average er... |
# -*- coding: utf-8 -*-
#
# libmemcached documentation build configuration file, created by
# sphinx-quickstart on Sun Mar 6 12:05:53 2011.
#
# 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.
#
... |
# coding=utf-8
from __future__ import absolute_import, print_function, with_statement
import json
from autobahn.twisted.websocket import (WebSocketServerFactory,
WebSocketServerProtocol)
from zope.interface import implements
import txtorcon
from torweb.api.json.circuit import ... |
""" call this with:
./bin/instance run src/org.bccvl.testestup/src/org/bccvl/testsetup/main.py ....
make sure ./bin/instance is down while doing this
"""
import sys
import logging
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SpecialUsers import system
from Testing.makerequ... |
"""
Deep Belief Network (DBN) search spaces used in [1] and [2].
The functions in this file return pyll graphs that can be used as the `space`
argument to e.g. `hyperopt.fmin`. The pyll graphs include hyperparameter
constructs (e.g. `hyperopt.hp.uniform`) so `hyperopt.fmin` can perform
hyperparameter optimization.
Se... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015 FactorLibre (http://www.factorlibre.com)
# Hugo Santos <hugo.santos@factorlibre.com>
#
# This program is free software: you... |
"""
Module for generating and validing oauth tokens for use in the API layer
"""
import copy
import datetime
import uuid
from authlib.jose import jwt
from authlib.jose import JWTClaims
from anchore_engine.configuration import localconfig
from anchore_engine.configuration.localconfig import (
OauthNotConfiguredErro... |
# -*- coding: utf-8 -*-
# Copyright 2016 The Switch-Chile Authors. All rights reserved.
# Licensed under the Apache License, Version 2, which is in the LICENSE file.
# Operations, Control and Markets laboratory at Pontificia Universidad
# Católica de Chile.
"""
Groups generation units by plant to reduce number of varia... |
import os
from global_settings import *
try:
from local_settings import *
from local_settings_secret import *
except ImportError:
import warnings
warnings.warn('Local settings have not been found (src.conf.local_settings). Trying to import Heroku config...')
try:
from local_settings_heroku... |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Basic list exercises
# Fill in the code for the functions below. main() is already set ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import unittest
import sys
import argparse
from haystack import argparse_utils
class Test(unittest.TestCase):
def test_readable(self):
"""test the readable helper."""
invalid = '/345678ui0d9t921giv9'
self.assertRaises(argpars... |
from django.conf.urls.defaults import include, patterns
from django.views.generic.simple import redirect_to
class Section(object):
def __init__(self, name, obj=None, target=None, redirectTo=None,
match=None, values=None, new=None, valuesAsSet=True, compareFunc=None,
needsAuth=False, perms=None, di... |
#!/usr/bin/env python
import gd, os, cStringIO, urllib2
os.environ["GDFONTPATH"] = "."
FONT = "Pacifico"
def simple():
im = gd.image((200, 200))
white = im.colorAllocate((255, 255, 255))
black = im.colorAllocate((0, 0, 0))
red = im.colorAllocate((255, 0, 0))
blue = im.colorAllocate((0, 0, 255))... |
"""
Support for Insteon dimmers via local hub control.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/light.insteon_local/
"""
import logging
from datetime import timedelta
from homeassistant.components.light import (
ATTR_BRIGHTNESS, SUPPORT_BRIGH... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 15 18:59:49 2016
@author: miles
"""
from __future__ import division
import time as timemodule
from gpuODE import ode, param_grid, funcs2code, run_ode
import pylab as pl
import numpy as np
import pandas as pd
#from utils import *
osc = ode("osc")
INPUTS = ["I"]
PAR... |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# 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 Licen... |
#!/usr/bin/python3.3 -O
from pyrser import grammar,meta
from pyrser.directives import ignore
from network import Host, Router
import sys
def insensitiveCase(s):
return "[" + " ".join("['" + "'|'".join(x) + "']" for x in map((lambda each: [each.lower(), each.upper()]), s)) + "]"
class MapParser(grammar.Grammar):
... |
## control script for VHS's wall display array of WS2801 36mm Square LEDs
import RPi.GPIO as GPIO, time, os, random
import datetime
from vhsled_spi import *
from vhsled_text import *
from vhsled_colour import *
from vhsled_rain import *
GPIO.setmode(GPIO.BCM)
#properties of our display
width = 42
height = 10
stri... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Preside CMS documentation build configuration file, created by
# sphinx-quickstart on Sun May 18 22:23:25 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 numpy as np
import matplotlib
matplotlib.use('TkAgg') # Can change to 'Agg' for non-interactive mode
import matplotlib.pyplot as plt
plt.rcParams['svg.fonttype'] = 'none'
from baselines.common import plot_util
X_TIMESTEPS = 'timesteps'
X_EPISODES = 'episodes'
X_WALLTIME = 'walltime_hrs'
Y_REWARD = 'reward'
Y_... |
import os
import shutil
import tempfile
import pytest
def mock_install_tree(request, version, script=None):
root = tempfile.mkdtemp()
# When done, delete the entire thing.
def cleanup():
shutil.rmtree(root)
request.addfinalizer(cleanup)
# Create expected structure.
bin = os.path.join(root, "bin")... |
#!/usr/bin/python
##
## license:BSD-3-Clause
## copyright-holders:Miodrag Milanovic
from __future__ import with_statement
import sys
## to ignore include of emu.h add it always to list
files_included = ['src/emu/emu.h']
include_dirs = ['src/emu/', 'src/devices/', 'src/mame/']
mappings = dict()
deps_files_included... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.postgres.fields
import uuid
class Migration(migrations.Migration):
dependencies = [
('data_collection', '0004_auto_20150512_2124'),
]
operations = [
migrations.... |
# -*- coding: utf-8 -*-
# Asymmetric Base Framework - A collection of utilities for django frameworks
# Copyright (C) 2013 Asymmetric Ventures 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 S... |
# Absolute import (the default in a future Python release) resolves
# the logging import as the Python standard logging module rather
# than this module of the same name.
from __future__ import absolute_import
import os
import sys
from datetime import datetime
import logging
import qiutil
NIPYPE_LOG_DIR_ENV_VAR = 'NIP... |
"""
#Cyclic 4
R.<x1,x2,x3,x4> = QQ[]
polys = [x1+x2+x3+x4,x1*x2+x2*x3+x3*x4+x4*x1,x1*x2*x3+x2*x3*x4+x3*x4*x1+x4*x1*x2]
TropicalPrevariety(polys)
#Should be equivalent (up to homogenization) to:
R.ideal(polys).groebner_fan().tropical_intersection().rays()
#Reduced cyclic 8
R.<y_1,y_2,y_3,y_4,y_5,y_6,y_7> = QQ[]... |
# coding: utf-8
from __future__ import absolute_import #todo shouldn't we have this on every module or on none?
import logging
from google.appengine.ext import ndb #pylint: disable=import-error
from google.appengine.datastore import datastore_query#.Cursor #pylint: disable=import-error
import re
import util
import con... |
import numpy as np
from pprint import pprint
dd={}
for l in open('timings.txt'):
if l.startswith('#'): continue
ll=l[:-1].split()
if len(ll)==0: continue
tag,cores,nPar,nSteps=ll[0],int(ll[1]),int(ll[2]),int(ll[3])
t1,t,colliderRel=[float(i) for i in ll[4:]]
key=(tag,cores,nPar,nSteps)
data=... |
from sklearn import linear_model
from matplotlib import pyplot
from price_parsing import *
from xkcd import xkcdify
from datetime import datetime
DEFAULT_SAMPLES = 50
DEFUALT_LOOKBACK = 200
def extendGraphByN(X, n):
"""
Extend the domain of X by n
:param X: The current domain in sklearn format
:param... |
# setup.py, config file for distutils
#
# To install this package, execute
#
# python setup.py install
#
# in this directory. To run the unit tests, execute
#
# python setup.py test
#
# To update the HTML page for this version, run
#
# python setup.py register
#
# To upload the latest version to the python repos... |
import os
from collections import OrderedDict
from flask import Flask
from wtforms import fields
from ggplot import (aes, stat_smooth, geom_point, geom_text, ggtitle, ggplot,
xlab, ylab)
import numpy as np
import pandas as pd
from gleam import Page, panels
# setup
stats = ['At-Bats (AB)', 'Runs... |
"""Contains DiscoGroup class that is above all other group classes used"""
import logging
from .base_group import BaseGroup
from .disco_autoscale import DiscoAutoscale
from .disco_elastigroup import DiscoElastigroup
logger = logging.getLogger(__name__)
class DiscoGroup(BaseGroup):
"""Implementation of DiscoGrou... |
# -*- coding: utf-8 -*-
'''
TIPS:
1. operation (buy, sell)
2. for each (buy, sell), we find the longest incr sequence
3. but the most important question why longest incr sequence is work?
'''
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype... |
import attr
import pytest
import requests
from cfme.utils import ports
from cfme.utils.net import net_check
from cfme.utils.wait import TimedOutError
from cfme.utils.conf import rdb
from fixtures.pytest_store import store
from cfme.fixtures.rdb import Rdb
@attr.s
class AppliancePoliceException(Exception):
me... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# 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 use ... |
"""
Implementation of operations on Array objects and objects supporting
the buffer protocol.
"""
from __future__ import print_function, absolute_import, division
import math
import llvmlite.llvmpy.core as lc
from llvmlite.llvmpy.core import Constant
import numpy
from numba import types, cgutils, typing
from numba.... |
# coding=utf-8
"""VecEnv implementation using python threads instead of subprocesses."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import threading
from third_party.baselines.common.vec_env import VecEnv
import numpy as np
from six.moves imp... |
#!/usr/bin/env python3
# -*- encoding: 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 Apach... |
###############################################################################
##
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary forms, with or without
## modification, ... |
from __future__ import print_function
import sys,os,argparse,csv,subprocess,urllib
from channels import Channel, Group
import logging, json
from enaBrowserTools.python import readGet, utils
from django.conf import settings
from utils import ena_utils
current_downloads = dict()
def start_aspera(data, reply_channel):
... |
import matplotlib as mpl
import astropy.wcs
from sunpy.visualization.animator.base import ArrayAnimator
__all__ = ['ImageAnimator', 'ImageAnimatorWCS']
class ImageAnimator(ArrayAnimator):
"""
Create a matplotlib backend independent data explorer for 2D images.
The following keyboard shortcuts are defi... |
"""Fragment processors."""
import glob
import logging
import os
from typing import Any, Callable, Iterable, Iterator, Mapping, Sequence, Tuple, Type
from climatecontrol.constants import REMOVED
from climatecontrol.file_loaders import (
FileLoader,
NoCompatibleLoaderFoundError,
iter_load,
load_from_file... |
"""
==============================
CSC to learn LFP spiking atoms
==============================
Here, we show how CSC can be used to learn spiking
atoms from Local Field Potential (LFP) data [1].
[1] Hitziger, Sebastian, et al.
Adaptive Waveform Learning: A Framework for Modeling Variability in
Neurophysiolo... |
import os
import time
import json
import random
import imghdr
import requests
IMAGE_URL_API = 'http://www.image-net.org/api/text/imagenet.synset.geturls?wnid='
OUTPUT_DIR = "images"
MAX_NUM_IMAGES_PER_CATEGORY = 100
def download_image(url, filename):
try:
r = requests.get(url)
except Exception:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import unicodecsv as csv
import json
from bs4 import BeautifulSoup
import cchardet as chardet
import grequests
# URL = 'http://search.sina.com.cn/?c=news&q=%s&range=all&time=custom&stime=2013-12-01&etime=2017-08-17&num=20&col=1_7&page=%d'
# URL = 'http://... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.