src stringlengths 721 1.04M |
|---|
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import os
import pandas as pd
import matplotlib.pyplot as plt
def symbol_to_path(symbol, base_dir="data"):
"""Return CSV file path given ticker symbol."""
return os.path.join(base_dir, "{}.csv".format(str(symbol)))
def get_data(symbols, dates):
"""Read stock data (adjusted close) for given symbols from ... |
"""Generic socket server classes.
This module tries to capture the various aspects of defining a server:
For socket-based servers:
- address family:
- AF_INET{,6}: IP (Internet Protocol) sockets (default)
- AF_UNIX: Unix domain sockets
- others, e.g. AF_DECNET are conceivable (see <socket.h>
... |
# Copyright (c) 2010-2012 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
#!/usr/bin/python
# by tianming 2013-06-26
import Logger
import socket, select
class Event_handle_obj:
def __init__(self, socket_obj, epoll_obj):
self._socket_obj = socket_obj
self._epoll_obj = epoll_obj
def __del__(self):
self._socket_obj.close()
def on_readable(self, fd):
raise "this is an abstrac... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import telebot
from telebot import types
from telebot import util
import re
import time
from time import sleep
import sys
import json
import os
import logging
import subprocess
import requests
import requests as req
import random
from random import randint
imp... |
#!/usr/bin/env python3
# -*- coding: iso-8859-15 -*-
import numpy as np
import matplotlib.pyplot as plt
from .velocity import *
from .sigma import *
from .grid import *
from .libzhang import _find_rad, _find_phi
from .plotlib import *
class inerMod:
def __init__(self,nr=33,nphi=256,ntheta=128,m=0,l=None,N=0,n=1,... |
# -*- coding: utf-8 -*-
# Copyright Tom SF Haines, Aaron Snoswell
#
# 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 appl... |
import datetime
import os.path
kDirName, filename = os.path.split(os.path.abspath(__file__))
kFixtureFile = os.path.join(kDirName, 'types.db')
kTestFile = os.path.join(kDirName, 'test.db')
kTestDirectory = os.path.join(kDirName, 'tempdir', 'child')
kConfigFile = os.path.join(kDirName, 'testing.ini')
kConfigFile2 = os.... |
'''
Created on 30 Jan 2014
@author: peterb
'''
import base64
import logging
class BasicAuthMixin(object):
"""
BasicAuthMixin
"""
def _request_auth(self, realm):
if self._headers_written: raise Exception('headers have already been written')
self.set_status(401)
... |
#
# Copyright (C) 2009, 2010 UNINETT AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License version 2 as published by the Free
# Software Foundation.
#
# This program is distributed in th... |
#!/usr/bin/python
#
import os
import cgi
import cgitb
import sys
import meowaux as mew
import urllib
import Cookie
import json
cgitb.enable();
#print "Content-Type: text/html"
#print
cookie = Cookie.SimpleCookie()
cookie_hash = mew.getCookieHash( os.environ )
g_debug = False
def log_line( l ):
logf = open("/tmp/... |
# -*- coding: utf-8 -*-
# Copyright 2004-2014 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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... |
from .adaptive import *
from .base import build, Optimizer
from .dataset import Dataset
from .first_order import *
__version__ = '0.2.2'
def minimize(loss, train, valid=None, params=None, inputs=None, algo='rmsprop',
updates=(), monitors=(), monitor_gradients=False, batch_size=32,
train_bat... |
#
# (C) Copyright 2015 Enthought, Inc., Austin, TX
# All right reserved.
#
# This file is open source software distributed according to the terms in
# LICENSE.txt
#
""" Tests for Commands that work with Components """
from __future__ import (division, absolute_import, print_function,
unicode_li... |
#
# Race Capture App
#
# Copyright (C) 2014-2017 Autosport Labs
#
# This file is part of the Race Capture App
#
# This 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 ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
import libfeedly
import libfeedly.utils as utils
def test_user_id():
assert utils.user_id('00000000-0000-0000-0000-000000000000') \
== 'user/00000000-0000-0000-0000-000000000000'
def test_feed_id():
assert utils.feed_id('... |
# Copyright (C) 2020 by the XiDian Open Source Community.
#
# This file is part of xidian-scripts.
#
# xidian-scripts 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 3 of the License, or ... |
from django.utils.translation import ugettext_lazy as _
# Reviewer Tools
REVIEWER_VIEWING_INTERVAL = 8 # How often we ping for "who's watching?"
REVIEWER_REVIEW_LOCK_LIMIT = 3 # How many pages can a reviewer "watch"
# Types of Canned Responses for reviewer tools.
CANNED_RESPONSE_ADDON = 1
CANNED_RESPONSE_THEME = 2... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('eighth', '0027_eighthbloc... |
# Copyright 2018,2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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
#... |
"""
Tests for adapters.py
"""
import json
from django.contrib.auth.models import User
from django.test import TestCase
from main.adapters import adapt_model_to_frontend
from main.models import Chromosome
from main.models import Project
from main.models import ReferenceGenome
from main.models import Variant
from main... |
"""last spring temp"""
import datetime
from pandas.io.sql import read_sql
import pandas as pd
import matplotlib.dates as mdates
from pyiem.plot import figure_axes
from pyiem.util import get_autoplot_context, get_dbconn
from pyiem.exceptions import NoDataFound
def get_description():
""" Return a dict describing h... |
import logging
import warnings
from django import template
from django.conf import settings
from django.contrib.staticfiles.templatetags.staticfiles import static
logger = logging.getLogger(__name__)
register = template.Library()
# cache available sizes at module level
def get_available_sizes():
all_sizes = set... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
This module defines how cells are stored as tunacell's objects
"""
from __future__ import print_function
import numpy as np
import warnings
import treelib as tlib
from tunacell.base.observable import Observable, FunctionalObservable
from tunacell.base.datatools impo... |
'''
You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hint that indicates how many digits in said guess match your secret number exactly in both digit and position (called "bulls... |
# -*- coding: cp1252 -*-
from PyQt4 import QtCore, QtGui
import os
import os.path
models = None
class AbstractFormView:
"""gère le cycle de vie de sauvegarde d'un formulaire"""
def __init__(self):
self.saved = True
self.saveAction.clicked.connect(self.doSave)
def closeEvent(sel... |
from PyCIP.DataTypesModule.BaseDataParsers import BaseData, BaseStructure, VirtualBaseStructure
class BOOL(BaseData):
_byte_size = 1
_signed = 0
class SINT(BaseData):
_byte_size = 1
_signed = 1
class INT(BaseData):
_byte_size = 2
_signed = 1
class DINT(BaseData):
_byte_size = 4
_sign... |
# File : udl.py
# Author : Jose Amores <biomol at gmail dot com>
import sys
import os
import sys
import pkgutil
import importlib
import logging
from core.model.model import model
from generators import genbase
class udl(genbase.genBase):
""" Uc4fun Data Layer"""
TPL_ENABLE = True
# allowed confi... |
import os
from django.test import SimpleTestCase
from corehq.apps.settings.utils import get_temp_file
class GetTempFileTests(SimpleTestCase):
def test_file_closed(self):
"""
Check that an error is not raised if the file is closed by the caller
"""
try:
with get_temp_fi... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Reads source-modifier pairs and outputs a graphviz .dot file.
#
# Usage:
#
# Author: rja
#
# Changes:
# 2018-08-17 (rja)
# - initial version
import fileinput
import math
import random
from collections import Counter
def filter_graph(sources, modifiers, edges):
fi... |
# Copyright 2014 Mitch Garnaat
#
# 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... |
# Generated by Django 3.0.5 on 2020-04-07 10:39
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("spectator_events", "0041_event_ticket"),
]
operations = [
migrations.AlterField(
model_name="venue... |
# coding=utf-8
from __future__ import print_function
import time
import logging
import traceback
class BaseSource(object):
def __init__(self, config, checks, res_q):
self.log = logging.getLogger('tantale.client')
self.config = config
self.checks = checks
self.res_q = res_q
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2018-05-07 23:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('harvest', '0001_initial'),
]
operations = [
migrations.AddField(
m... |
# -*- coding: utf-8 -*-
"""Support for wildcard pattern matching in object inspection.
Authors
-------
- Jörgen Stenarson <jorgen.stenarson@bostream.nu>
- Thomas Kluyver
"""
#*****************************************************************************
# Copyright (C) 2005 Jörgen Stenarson <jorgen.stenarson@bos... |
from __future__ import absolute_import
# Copyright (c) 2010-2018 openpyxl
"""
Enclosing chart object. The various chart types are actually child objects.
Will probably need to call this indirectly
"""
from openpyxl.compat import unicode
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descrip... |
# encoding: utf-8
from flask import jsonify, request
from flask_login import login_required, current_user
from project.app import db
from project.models import Dog
from utils.rest import RestView
class DogAPI(RestView):
schema = 'Dog'
def get(self, id):
page = request.args.get('page') or 1
if... |
from __future__ import division
from keras.optimizers import RMSprop
from keras.callbacks import EarlyStopping, ModelCheckpoint, LearningRateScheduler
from keras.layers import Input
from keras.models import Model
import os, cv2, sys
import numpy as np
from config import *
from utilities import preprocess_images... |
#!/usr/bin/env python3
#Quiero utf8: áéíóú
from PIL import ImageFilter, ImageStat, Image, ImageDraw
from multiprocessing import Pool, cpu_count
# conda install --channel https://conda.anaconda.org/menpo opencv3
from cv2 import imread as cv2_imread, resize as cv2_resize, INTER_AREA as cv2_INTER_AREA # http://tanb... |
# Lint as: python3
# Copyright 2020 Google. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from PyJedoxWebApi.PyJedoxWeb import PyJedoxWeb
P = PyJedoxWeb()
print("SID: " + P.getSid())
database = "control_musterstadt"
cubename = "fcmain"
res = P.CreateDatabase(DBName=database)
print(res)
P.loadDBList()
DB = P.getDB(DBName=database)
... |
"""
Django settings for jp project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Buil... |
# Generated by Django 2.2.3 on 2019-08-05 12:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("accounts", "0011_auto_20190721_1810")]
operations = [
migrations.AlterField(
model_name="subscription",
name="notification",
... |
import os
import gtk
import gobject
import fnmatch
from threading import Thread, Event
from gui.input_dialog import OverwriteFileDialog, OverwriteDirectoryDialog, OperationError, QuestionOperationError
from gui.operation_dialog import CopyDialog, MoveDialog, DeleteDialog, RenameDialog
from gui.error_list import ErrorL... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SinglePartsToMultiparts.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************... |
from __future__ import absolute_import
import six
from rest_framework.response import Response
from sentry.api.bases.integration import IntegrationEndpoint
from sentry.integrations.exceptions import ApiError
from sentry.models import Integration
class GitlabIssueSearchEndpoint(IntegrationEndpoint):
def get(self... |
#!/usr/bin/env python
# https://pymotw.com/3/os.path/
import os
import os.path
import time
import argparse
APPNAME='lister'
__version__ = '0.0.1'
def config_args():
"""
Configure command line arguments
"""
parser = argparse.ArgumentParser(description=APPNAME,
epilog=("Version {}".format(__... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv, cStringIO
class CsvExporter:
"""Iterate through the list of transactions for an account and
exort to a CSV file."""
@staticmethod
def Generate(model, delimiter=",", quotechar="'"):
"""Generate the CSV string."""
result = cS... |
#!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from pottymouth import __version__
import os
import os.path
import shutil
setup(name='PottyMouth',
py_modules=['pottymouth'],
version=__version__,
data_files=[('share/doc/python-pott... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2015, Joseph Callen <jcallen () csc.com>
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
... |
"""The module estimates 2D convolution layers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import six
from paleo.layers import base
class Deconv2D(base.BaseLayer):
"""Deconv2D"""
def __init__(self,
name,
... |
import pandas as pd
import numpy as np
from operator import and_
from six import iteritems
from functools import reduce
import warnings
def transformGroupToReal(dataframe):
""" Takes a dataframe and transforms the groups in it to a real representation.
Args:
dataframe:
Returns:
A copy of... |
from __future__ import unicode_literals
import logging
logger = logging.getLogger(__name__)
from mopidy import backend
from mopidy.models import Playlist
from mopidy.models import Track
import os
import fnmatch
import glob
def find_files(path):
matches = glob.glob(os.path.join(path,'*.mp3'))
return matches
... |
"""Manages invocation of ProvScala `provmanagement` script.
"""
# Copyright (c) 2015 University of Southampton
#
# 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,
# includi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
from __future__ import with_statement
import log... |
#!/usr/bin/python
'''
This code will automatically generate most of the ctypes from ANTLR3 C runtime
headers.
'''
import os
import sys
import ext_path
from pyclibrary import *
from glob import glob
ANTLR3C_INCLUDE = os.path.join(
os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
'libantlr3c-3.4',... |
# -*- coding: utf-8 -*-
"""
"""
import numpy as np
def get_euclid_norm(matrix):
"""
this function accepts one vector
the calling function should compute this vector as the difference of two vectors
the standard Euclidean distance formula sqrt(x1^2+x2^2+....+xn^2) is applied
"""
sum = 0
f... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import numpy as np
from test_helpers import TestHelpers
helpers=TestHelpers()
helpers.add_relative_path()
from lib.api import Similarity_API
from lib.clusters import get_linkage_matrix
from time import time
# from scipy.cluster.hierarchy import linkage,... |
# -*- coding: utf-8 -*-
from fissure_Coude import fissure_Coude
class fissure_Coude_4(fissure_Coude):
"""
probleme de fissure du Coude : ASCOU09A
adaptation maillage
"""
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres g... |
#!/usr/bin/python3
from pathlib import Path
import hashlib
import sys
def enumerate_files(path):
if not path.is_dir():
return []
else:
return [x for x in path.iterdir() if x.is_file()]
def create_hash(file_path, hash=hashlib.sha256):
bytes = file_path.read_bytes()
hashed = hash(bytes).hexdigest()
return h... |
#!/usr/bin/env python3
"""
Generate MUX.
MUXes come in two types,
1) Configurable via logic signals,
2) Statically configured by PnR (called "routing") muxes.
"""
import argparse
import itertools
import lxml.etree as ET
import os
import sys
from lib import mux as mux_lib
from lib.argparse_extra import ActionStoreB... |
"""
from fast_jsonrpc import JSONRPCResolver
def foo(msg)
return 'foobar ' + str(msg)
router = {'foo': foo}
resolver = JSONRPCResolver(router)
json_request = {"jsonrpc": "2.0", "method": "foo", "params": ["toto"], "id": 1}
json_response = resolver.handle(json_request)
print json_response
-> {"jsonrpc": "2.0", "... |
#!/usr/bin/env python
########################################################################
# RecopilaInformationSNMP.py of data base, get device in a network by nmap command and
# get information of device whit snmp tool and cisco OID, updateing the
# information in data base
#
# This program is free software; y... |
# range.py
#/***************************************************************************
# * Copyright (C) 2015 Daniel Mueller (deso@posteo.net) *
# * *
# * This program is free software: you can redistribute it and/or modify... |
import logging
import os
import re
import sh
from sys import stdout, stderr
from math import log10
from collections import defaultdict
from colorama import Style as Colo_Style, Fore as Colo_Fore
import six
# This codecs change fixes a bug with log output, but crashes under python3
if not six.PY3:
import codecs
... |
from segment import Segment
from scipy.signal import resample
class TimeStretchSegment(Segment):
"""Like a :py:class:`radiotool.composer.Segment`, but stretches
time to fit a specified duration.
"""
def __init__(self, track, comp_location, start, orig_duration, new_duration):
"""Create a time-... |
'''
Created on 19 Aug 2017
@author: Mathias Bucher
'''
import unittest
from Tkinter import *
from view.VSearch import VSearch
from ctr.Log import Log
from mock import MagicMock
from model.ModelEntry import ModelEntry
class TestVSearch(unittest.TestCase):
def setUp(self):
self.log = Log("testlog.txt")
... |
# Copyright (C) 2014 Orange
# This software is distributed under the terms and conditions of the 'BSD
# 3-Clause' license which can be found in the 'LICENSE.txt' file in this package
# distribution or at 'http://opensource.org/licenses/BSD-3-Clause'.
#!/usr/bin/env python
"""Setup script for tinypyki."""
from distu... |
# PROBLEM: We have a list of addresses with varying lengths tied up in an HTML page, but it's
# not in a table. Luckily they follow a pretty predictable format; we need to parse them into
# different columns and stick them in a delimited file.
#
# HOW WE'RE GOING TO DEAL WITH IT:
# - Use line breaks to split one big ... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import bytes
from future import standard_library
standard_library.install_aliases()
from sys import version_info
from string import Template
from .exception... |
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from functools import wraps
from sql import Table
from trytond.model import Workflow, fields
from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transactio... |
import marshal
import builtins
import random
from tornado.ioloop import IOLoop
from . import events
def deny():
"""
A function to be called from within a can_* event handler if the receiver
denies the proposed action.
"""
raise events.ActionDenied()
def stop():
"""
A function that can be... |
from django import template
from django.db.models import Sum
from transifex.languages.models import Language
from transifex.resources.models import RLStats, Resource
from transifex.txcommon.utils import StatBarsPositions
register = template.Library()
@register.inclusion_tag('resources/stats_bar_simple.html')
def prog... |
#! /usr/bin/python2.7
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import errorvalues as ev # github.com/stefantkeller/errorvalues
from VECSELsetup.eval.varycolor import varycolor
from VECSELsetup.eval.gen_functions import load, extract, plotinstructions_write, plotinstructions_read, lu... |
#!/usr/bin/python2.7
#
# This script is part of khmer, http://github.com/ged-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2014. It is licensed under
# the three-clause BSD license; see doc/LICENSE.txt.
# Contact: khmer-project@idyll.org
#
# pylint: disable=invalid-name,missing-docstring
"""
Take a... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path
import numpy as np
import scipy.io
import scipy.ndimage as sn
import h5py
from util import log
# __PATH__ = os.path.abspath(os.path.dirname(__file__))
__PATH__ = './datasets/svhn'
rs = np.rand... |
import pytest
from django.test import override_settings
from django.urls import NoReverseMatch
from quickstartup.qs_pages.models import Page
from quickstartup.qs_pages.urlresolver import page_reverse
from ..base import TEMPLATES, check_contains, check_in_html, check_template_used
pytestmark = pytest.mark.django_db
... |
from numba import jit
import numpy as np
import math
import collections
from timeit import default_timer as timer
@jit(nopython=True)
def normalize(data, min_val=0, max_val=1):
no_vectors, dim = data.shape
D = np.empty((no_vectors,dim), dtype=np.float64)
inf = 1.7976931348623157e+308
min_arr = np.empty(dim, dtype... |
import optparse
import os
optparser = optparse.OptionParser()
optparser.add_option("-l", "--language", dest="language", default="French", help="Language to package")
optparser.add_option("-b", "--bucket", dest="bucket", default="brendan.callahan.thesis", help="S3 bucket name")
optparser.add_option("-p", "--prefix", de... |
#-------------------------------------------------------------------------------
# elftools tests
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import unittest
from elftools.elf.elffile import ELFFile
class Te... |
from orphics.mpi import MPI
import orphics.pipelines as utils
import argparse
from enlib import enmap
# Parse command line
parser = argparse.ArgumentParser(description='Run south rotation test.')
parser.add_argument("-x", "--patch-width", type=float, default=40., help="Patch width in degrees.")
parser.add_argument("-... |
#!/usr/bin/env python3
# coding: utf-8
from rtmbot.core import Plugin
from chatterbot import ChatBot
from plugins.console import Command
# Sessions
SESS = {}
# Init ChatBots
BOTS = ['HAL 9000', 'Wall-E', 'Agent Smith']
TRAINER='chatterbot.trainers.ChatterBotCorpusTrainer'
BOT_DICT = {B: ChatBot(B, trainer=TRAINER... |
'''
Go through a given fasta file (later - mod for sets of fastas),
and output a new fasta file, with sequences containg unknown, or non standard AA
removed; too short sequences removed.
Later, can be used to filter sequences whose ID is a classname; (keeping those
with a minimum amount of examples, e.g. 30+ samples ... |
#!/usr/bin/python3.3
import sys
import os
rootDir = sys.path[0]
sys.path.append(os.path.normpath(os.path.join(rootDir, "..", "packages")))
sys.path.append(os.path.join(rootDir, "build"))
import pynja
import repo
build_cpp = True
build_java = True
def generate_ninja_build(projectMan):
# define cpp_variants and... |
#!/usr/bin/python
import tbbtest
class Test(tbbtest.TBBTest):
def test_screen_coords(self):
# https://gitweb.torproject.org/torbrowser.git/blob/HEAD:/src/current-patches/firefox/0021-Do-not-expose-physical-screen-info.-via-window-and-w.patch
driver = self.driver
js = driver.execute_script
... |
# -*- coding: utf-8 -*-
from . import DatabaseConnectionResolver
from .. import OratorTestCase
from orator.orm.scopes import Scope
from orator import Model
class ModelGlobalScopesTestCase(OratorTestCase):
@classmethod
def setUpClass(cls):
Model.set_connection_resolver(DatabaseConnectionResolver())
... |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... |
#!/usr/bin/python
#
# Bertrone Matteo - Polytechnic of Turin
# November 2015
#
# eBPF application that parses HTTP packets
# and extracts (and prints on screen) the URL
# contained in the GET/POST request.
#
# eBPF program http_filter is used as SOCKET_FILTER attached to eth0 interface.
# Only packets of type ip and tc... |
"""
===========================
RevAssets
===========================
Makes possible for python web apps to work with hashed static assets
generated by other tools like Gulp or Webpack.
It does so by reading the manifest generated by the revision tool.
"""
import json
import io
__version__ = '1.0.3'
class AssetN... |
#!/usr/bin/python
# coding: utf-8
#
# Copyright © 2012-2014 Ejwa Software. All rights reserved.
#
# This file is part of gitinspector.
#
# gitinspector 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 ve... |
from djtempl import render_files
import argparse
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--template",
metavar='file',
default='Dockerfile.tmpl',
type=argparse.FileType(mode='r'), # 2.7 argparse... |
# Copyright (c) 2016-2017 Rocky Bernstein
"""
More complex expression parsing
"""
# from __future__ import print_function
import sys
from spark_parser.ast import AST
from py2_scan import Python2Scanner, ENDMARKER
from spark_parser import GenericASTBuilder
DEFAULT_DEBUG = {'rules': False, 'transition': False, 'red... |
import pytest
from configmanager import Config, NotFound, Section, Item
from configmanager.utils import not_set
def sub_dict(dct, keys):
"""
Helper for tests that creates a dictionary from the given dictionary
with just the listed keys included.
"""
return {k: dct[k] for k in keys if k in dct}
... |
#!/usr/bin/env python
def stockDataSort(stockData,userInput):
stockDataAfterSort = {}
if userInput == None:
print "input wrong items"
exit(1)
else:
for i in stockData:
stockDataAfterSort[i[userInput]] = i
print "-----------------------------------"
for dataItem i... |
import pdb
import sys
import os
import time
import socket
from heat.openstack.common import log as logging
from heat.engine.resources.cloudmanager.exception import *
from heat.engine.resources.cloudmanager.environmentinfo import *
import vcloud_proxy_install as proxy_installer
import vcloud_cloudinfo as data_handler... |
# Copyright (C) 2011 OpenStack Foundation
#
# 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... |
# -*- coding: utf-8 -*-
#
# This file is part of NINJA-IDE (http://ninja-ide.org).
#
# NINJA-IDE 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
# any later version.
#
# NIN... |
"""
Boolean algebra module for SymPy
"""
from __future__ import print_function, division
from collections import defaultdict
from itertools import product, islice
from sympy.core.basic import Basic
from sympy.core.cache import cacheit
from sympy.core.numbers import Number
from sympy.core.decorators import deprecated
... |
#!/usr/bin/python
# coding=latin-1
import serial
import argparse
# command line arguments
commandline = argparse.ArgumentParser(description='simulate serial communication with AlphaInnotec heating controller')
commandline.add_argument('--serial_port', '-p', default='/dev/ttyUSB0', help='the serial port to communicate ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.