code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import my_config as config
from FundAsset import Fund
from calReturn import fetchQuantCode, fetchCodePerf
stickers = None
def getBuySticker(stickers, index, trade_df, quant_df, quant_json, short_quant_json):
candidates = [... | martinggww/lucasenlights | ETF/src/calBackTest.py | Python | cc0-1.0 | 12,064 |
from robofab.world import CurrentFont
f = CurrentFont()
# this is the high level RoboFab object
print f
# this is the low level FontLab object, not a part of RoboFab
print f.naked()
| schriftgestalt/robofab | Docs/Examples/howtos/lowLevel_00.py | Python | bsd-3-clause | 182 |
import os
import urllib2
import numpy as np
DTYPE_TRAIN = [('u-g', np.float32),
('g-r', np.float32),
('r-i', np.float32),
('i-z', np.float32),
('redshift', np.float32)]
DTYPE_TEST = [('u-g', np.float32),
('g-r', np.float32),
('r... | astroML/sklearn_tutorial | doc/data/sdss_colors/fetch_data.py | Python | bsd-3-clause | 1,455 |
#!/usr/bin/env python3
from raptiformica.cli import inject
if __name__ == '__main__':
inject()
else:
raise RuntimeError("This script is an entry point and can not be imported")
| vdloo/raptiformica | bin/raptiformica_inject.py | Python | mit | 186 |
from collections import Counter
f1 = open('../features/question_char_freq.txt', 'w')
queswords = []
maxwordid = 1
with open('../train_data/question_info.txt', 'r') as f2:
for line in f2:
sp = line.split()
try:
words = map(int, sp[3].split('/'))
maxwordid = max(maxwordid, max(words))
except:
words = [... | jashwanth9/Expert-recommendation-system | code/generateTermFreq.py | Python | apache-2.0 | 506 |
# Copyright (C) 2011-2015 2ndQuadrant Italia (Devise.IT S.r.L.)
#
# This file is part of Barman.
#
# Barman is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option... | terrorobe/barman | tests/test_utils.py | Python | gpl-3.0 | 14,132 |
from .infant_dashboard import infant_dashboard
from .maternal_dashboard import MaternalDashboard
| botswana-harvard/edc-bhp074 | bhp074/apps/eit_dashboard/views/__init__.py | Python | gpl-2.0 | 97 |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | googleads/googleads-python-lib | examples/ad_manager/v202202/creative_set_service/get_creative_sets_for_master_creative.py | Python | apache-2.0 | 2,081 |
from HOFsGenericas import *
isCopy = lambda line: 'COPY' in words(line)[1]
isInclude = lambda line: ('INCLUDE' in words(line)[1] and 'SQLCA' not in words(line)[1])
isLink = lambda line: 'LINK' in words(line)[1]
isXctl = lambda line: 'XCTL' in words(line)[1]
isCall = lambda line: 'CALL' in words(line)[1]
isPic = lambd... | flavio-casacurta/File-Fixed | HOFs.py | Python | mit | 561 |
# NOTE: You don't need to edit this code.
import time
import tensorflow as tf
import numpy as np
from scipy.misc import imread
from caffe_classes import class_names
from alexnet import AlexNet
# placeholders
x = tf.placeholder(tf.float32, (None, 227, 227, 3))
# By keeping `feature_extract` set to `False`
# we indica... | phuongxuanpham/SelfDrivingCar | CarND-Alexnet-Feature-Extraction-Lab/imagenet_inference.py | Python | gpl-3.0 | 1,098 |
#
# actions.py: routines that actually run the svn client.
#
# Subversion is a tool for revision control.
# See http://subversion.tigris.org for more information.
#
# ====================================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more con... | centic9/subversion-ppa | subversion/tests/cmdline/svntest/actions.py | Python | apache-2.0 | 86,069 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A module for the Debugger base class."""
import cr
class Debugger(cr.Action, cr.Plugin.Type):
"""Base class for implementing debuggers.
Implementa... | Gateworks/platform-external-chromium_org | tools/cr/cr/actions/debugger.py | Python | bsd-3-clause | 1,515 |
__version_info__ = {
'major': 1,
'minor': 0,
'micro': 5,
'releaselevel': 'beta',
'serial': 1
}
def get_version(short=False):
assert __version_info__['releaselevel'] in ('alpha', 'beta', 'final')
vers = ["%(major)i.%(minor)i" % __version_info__, ]
if __version_info__['micro']:
ve... | jessethegame/django-undjango | undjango/__init__.py | Python | bsd-2-clause | 579 |
"""Test shopping list component."""
from homeassistant.components.websocket_api.const import TYPE_RESULT
from homeassistant.const import HTTP_NOT_FOUND
from homeassistant.helpers import intent
async def test_add_item(hass, sl_setup):
"""Test adding an item intent."""
response = await intent.async_handle(
... | tchellomello/home-assistant | tests/components/shopping_list/test_init.py | Python | apache-2.0 | 10,183 |
import time
from typing import Any, Callable, Dict, Tuple
from unittest import mock
import ujson
from django.http import HttpRequest, HttpResponse
from zerver.lib.actions import do_change_subscription_property, do_mute_topic
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import POSTReq... | shubhamdhama/zulip | zerver/tests/test_event_queue.py | Python | apache-2.0 | 35,615 |
#
# Tests the diversity scoring function
# Author: David
# Date: 2018-01-06
#
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "treconomics_project.settings")
import unittest
from treconomics.experiment_functions import get_performance_diversity
TOPIC_NUM = '367'
class TestScoring(unittest.TestCase):
... | leifos/treconomics | treconomics_project/test_diversity_scoring.py | Python | mit | 4,423 |
import os
filename_exe = 'harv_hadcm3_biomas.exe'
#filename_comp = 'harv_allcfts_2035_2065_amazon.f'
#filename_comp = 'harv_allcfts_91_00_brazil_biomas_v2.f'
#filename_comp = 'harv_allcfts_91_00_brazil_biomas_v3.f'
filename_comp = 'harv_allcfts_2035_2065_amazon_biomas.f'
os.system('gfortran %s -o %s'%(filename_comp,... | jpdarela/no-rain | jp_np-for/compilef.py | Python | gpl-3.0 | 334 |
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import tensorflow as tf
from keras.models import Model
from keras.layers import Dense, Input, Dropout
from keras.callbacks import ModelCheckpoint
from utils.resBlock import res_block
... | uqyge/combustionML | FPV_ANN/FPV_resnet_fullycoupled.py | Python | mit | 4,896 |
# 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... | cg31/tensorflow | tensorflow/contrib/distributions/python/ops/operator_pd_diag.py | Python | apache-2.0 | 9,420 |
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2015 Ensky Lin <enskylin@gmail.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU A... | ensky/taiga-contrib-ldap-auth | taiga_contrib_ldap_auth/connector.py | Python | agpl-3.0 | 3,872 |
#!/usr/bin/env python
from argparse import ArgumentParser
from collections import defaultdict
import sys
import os
from sonLib.bioio import cigarRead, cigarWrite, getTempFile, system
def getSequenceRanges(fa):
"""Get dict of (untrimmed header) -> [(start, non-inclusive end)] mappings
from a trimmed fasta."""
... | benedictpaten/cactus | src/cactus/blast/upconvertCoordinates.py | Python | mit | 4,797 |
# Test script to try to catch serial data from an arduino.
import serial
# for now have to hardwire what device the thing is
# also have set 9600 as the baud rate on the arduino side
arduino = serial.Serial('/dev/ttyUSB0',9600,timeout=.1)
while True:
line = arduino.readline()[:-2] # chopping the newlin... | DAMason/Sketches | USBSerial/Catcher.py | Python | gpl-2.0 | 359 |
'''
LinConnect: Mirror Android notifications on Linux Desktop
Copyright (C) 2013 Will Hauck
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
... | hauckwill/linconnect-server | LinConnectServer/main/linconnect_server.py | Python | gpl-3.0 | 7,427 |
import os
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from mmkitstorage.models import Storage
from mmkitstorage import exceptions as storage_exceptions
from mmkitcommon.utils import fs as fs_utils
class Co... | einsfr/mmkit2 | mmkitstorage/management/commands/mmkitcreatestorage.py | Python | mit | 7,420 |
# -*- coding: utf-8 -*-
# Copyright 2015-2022 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""Extractors for *booru sites"""
from .common import BaseExtractor, Me... | mikf/gallery-dl | gallery_dl/extractor/booru.py | Python | gpl-2.0 | 2,388 |
server = True
import scipy.io as io
import matplotlib
if server:
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import alfileformat as al
import theano
import tools
import numpy
import theano.tensor as T
from theano.tensor.nnet import conv
from collections import defaultdict, Orde... | stencilman/deep_nets_iclr04 | lib/stitchparts.py | Python | gpl-2.0 | 11,123 |
from sac.util import Util
import collections
import contextlib
import wave
import webrtcvad
from sac.model.audacity_label import AudacityLabel
class Vad(object):
def _read_wave(self, path):
"""Reads a .wav file.
Takes the path, and returns (PCM audio data, sample rate).
"""
with c... | nicktgr15/sac | sac/methods/vad.py | Python | mit | 6,246 |
from types import SimpleNamespace
import asynctest
from asynctest import CoroutineMock, Mock, call
from stig.client.aiotransmission.api_freespace import FreeSpaceAPI
class TestFreeSpaceAPI(asynctest.ClockedTestCase):
async def setUp(self):
self.rpc = SimpleNamespace(free_space=CoroutineMock())
s... | rndusr/stig | tests/client_test/aiotransmission_test/api_freespace_test.py | Python | gpl-3.0 | 1,115 |
"""Support for Blockchain.com sensors."""
from datetime import timedelta
import logging
from pyblockchain import get_balance, validate_address
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME
import homeassistant.helpers.c... | tchellomello/home-assistant | homeassistant/components/blockchain/sensor.py | Python | apache-2.0 | 2,276 |
from __future__ import division
import sys
from pygame import Rect, Surface, draw, image
from pygame.locals import K_RETURN, K_KP_ENTER, K_ESCAPE, K_TAB, \
KEYDOWN, SRCALPHA
from pygame.mouse import set_cursor
from pygame.cursors import arrow as arrow_cursor
from pygame.transform import rotozoom
from vectors import... | mcedit/mcedit | albow/widget.py | Python | isc | 24,276 |
from django.http import HttpResponse
from django.shortcuts import render
def index(request):
return HttpResponse('Page content')
def custom(request):
return render(request, 'custom.html', {})
| geelweb/geelweb-django-contactform | tests/views.py | Python | mit | 202 |
# 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 ... | Azure/azure-sdk-for-python | sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sensitivity_labels_operations.py | Python | mit | 28,939 |
# Copyright (c) 2020 PaddlePaddle 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 appli... | luotao1/Paddle | python/paddle/tests/test_datasets.py | Python | apache-2.0 | 8,337 |
"""Support for BT Smart Hub (Sometimes referred to as BT Home Hub 6)."""
from collections import namedtuple
import logging
from btsmarthub_devicelist import BTSmartHub
import voluptuous as vol
from homeassistant.components.device_tracker import (
DOMAIN,
PLATFORM_SCHEMA as PARENT_PLATFORM_SCHEMA,
DeviceSc... | aronsky/home-assistant | homeassistant/components/bt_smarthub/device_tracker.py | Python | apache-2.0 | 3,162 |
# -*- coding: utf-8 -*-
"""
From http://www.wellho.net/mouth/3002_a-list-of-special-method-and-attribute-names-in-python.html
and also http://www.rafekettler.com/magicmethods.html
__new__ True constructor - usually wraps __init__
__init__ Object constructor
__call__
__getattr__ Handling object attributes [example] an... | thebjorn/pymagic | magicmethods.py | Python | lgpl-2.1 | 4,227 |
import os
path = os.path.dirname(os.path.split(os.path.abspath(__file__))[0])
import glob
import numpy as np
from nPDyn.dataParsers.mantidNexus import processNexus
def test_import_QENS():
dataPath = path + "/sample_data/vana_QENS_280K.nxs"
result = processNexus(dataPath)
assert result.sh... | kpounot/nPDyn | nPDyn/tests/dataParsers/test_mantidNexus.py | Python | gpl-3.0 | 511 |
import unittest
class UnitTestTemplate(unittest.TestCase):
@classmethod
def setUpClass(cls):
"""runs before tests
an exception here results in tests and tearDownClass not running"""
#raise TypeError
print "in setUpClass"
@classmethod
def tearDownClass(cls):
... | bpuderer/python_test | unittest_demo/test_template.py | Python | mit | 790 |
import logging
class LogManager(object):
""" Manages multiple loggers from different modules
"""
def __init__(self):
self.log_level = logging.WARNING
self.console_handler = logging.StreamHandler()
self.console_handler.setLevel(self.log_level)
self.formatter = logging.For... | adamreeve/npTDMS | nptdms/log.py | Python | lgpl-3.0 | 1,037 |
# Imports the hooks dynamically while keeping the package API clean,
# abstracting the underlying modules
from airflow.utils.helpers import import_module_attrs as _import_module_attrs
_hooks = {
'ftp_hook': ['FTPHook'],
'ftps_hook': ['FTPSHook'],
'gcloud/gcs_hook': ['GCSHook'],
'vertica_hook': ['Vertic... | modsy/incubator-airflow | airflow/contrib/hooks/__init__.py | Python | apache-2.0 | 598 |
# -*- coding: utf8 -*-
u"""
This module lints the current sagessh project and displays the report.
It checks the `sagessh` and `tools` packages and the `setup.py` module.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_lit... | demurgos/py-pathmatch | tools/lint.py | Python | mit | 628 |
def write_pdf(ticket):
with open("boleto.pdf", "wb") as file:
file.write(ticket.content)
| hudsonbrendon/python-boleto-cloud | boletocloud/utils.py | Python | mit | 101 |
MODULES = ['main', 'config', 'recovery']
DEPS = [
(['any'],
[
('plugin', 'webserver_common'),
('app', 'lighttpd', 'lighttpd')
])
]
NAME = 'lighttpd'
PLATFORMS = ['any']
DESCRIPTION = 'lighttpd webserver control plugin'
VERSION = '0.1'
AUTHOR = 'Ajenti team'
HOMEPAGE = 'http://ajenti.org... | DmZ/ajenti | plugins/lighttpd/__init__.py | Python | lgpl-3.0 | 322 |
def extractPbeartransWordpressCom(item):
'''
Parser for 'pbeartrans.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loi... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractPbeartransWordpressCom.py | Python | bsd-3-clause | 560 |
# Natural Language Toolkit: Test that all imports are proper
#
# Copyright (C) 2001 University of Pennsylvania
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
#
# $Id: imports.py,v 1.1.1.2 2004/09/29 21:58:11 adastra Exp $
"""
A test suite ... | ronaldahmed/SLAM-for-ugv | neural-navigation-with-lstm/MARCO/nltk/test/imports.py | Python | mit | 4,479 |
#!/usr/bin/env python
import re
import os
import sys
import random
import subprocess
import traceback
import argparse
import pysam
import bamsurgeon.replacereads as rr
import bamsurgeon.asmregion as ar
import bamsurgeon.mutableseq as ms
import bamsurgeon.aligners as aligners
from bamsurgeon.common import *
from uuid ... | MischaLundberg/bamsurgeon | bin/addsv.py | Python | mit | 32,630 |
# mysql/zxjdbc.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: mysql+zxjdbc
:name: zxjdbc for Jython
:dbapi: zxjdbc
:... | odubno/microblog | venv/lib/python2.7/site-packages/sqlalchemy/dialects/mysql/zxjdbc.py | Python | bsd-3-clause | 3,803 |
from contextlib import closing
from tempfile import NamedTemporaryFile
from sqlalchemy.engine import create_engine
from sqlalchemy.orm.session import sessionmaker
from alchemyjson.tests.mapping import Managers, BASE, Employees
class DBConnection(object):
def __init__(self, engine, filename):
self.filename... | chiesax/alchemyjson | alchemyjson/tests/initializer.py | Python | agpl-3.0 | 1,374 |
import time
import functools
def timeit(repeat=3):
def time_method(func):
@functools.wraps(func)
def wrapper_func(*args, **kwargs):
# 'application' code
timer_list = []
_i = 0
while True:
_t0 = time.time()
retval = fun... | mssalvador/WorkflowCleaning | shared/WorkflowTimer.py | Python | apache-2.0 | 645 |
# Copyright (c) 2016-2021, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | ledatelescope/bifrost | python/bifrost/guppi_raw.py | Python | bsd-3-clause | 4,150 |
# -*- coding: utf-8 -*-
"""
eg.Tasklet
~~~~~~~~~~
A wrapper around stackless.tasklet
:copyright: 2009 by EventGhost team, see AUTHORS.txt for more details.
:license: GNU GPL v2, see LICENSE.txt for more details.
"""
import stackless
class Tasklet(stackless.tasklet):
countTa... | garbear/EventGhost | eg/Classes/Tasklet.py | Python | gpl-2.0 | 681 |
# Copyright (c) 2003-2008 Ralph Meijer
# See LICENSE for details.
"""
Tests for L{wokkel.generic}.
"""
from twisted.trial import unittest
from twisted.words.xish import domish
from wokkel import generic
from wokkel.test.helpers import XmlStreamStub
NS_VERSION = 'jabber:iq:version'
class VersionHandlerTest(unittest... | dustin/wokkel | wokkel/test/test_generic.py | Python | mit | 2,743 |
#!/usr/bin/env python
# Copyright (c) 2012, 2013 Paul Tagliamonte <paultag@debian.org>
#
# 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
# th... | kirbyfan64/hy | setup.py | Python | mit | 3,580 |
from nose.tools import assert_equal, assert_raises
import mock
import xmlrpc
from src.writers import FileWriter, LavaWriter
from src.writers import UnavailableError
class TestFileWriter(object):
OUTPUT_DIR = 'foo'
CONTENT = 'test'
NAME = 'test-job-name'
def test_fail_open(self):
cfg = {
... | free-electrons/custom_tests_tool | tests/test_writers.py | Python | gpl-2.0 | 4,332 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#- Author : (DEK) Devendra Kavthekar
# program066:
# The Fibonacci Sequence is computed based on the following formula:
# f(n)=0 if n=0
# f(n)=1 if n=1
# f(n)=f(n-1)+f(n-2) if n>1
# Please write a program to compute the value of f(n)
# with a given n input by con... | dek-odoo/python-samples | python exercises/dek_program066.py | Python | apache-2.0 | 1,032 |
from plumbum.commands.base import shquote, shquote_list, BaseCommand, ERROUT, ConcreteCommand
from plumbum.commands.modifiers import ExecutionModifier, Future, FG, BG
from plumbum.commands.processes import run_proc
from plumbum.commands.processes import ProcessExecutionError, ProcessTimedOut, CommandNotFound
| siemens/plumbum | plumbum/commands/__init__.py | Python | mit | 310 |
import os
import os.path
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md'), 'r') as readme:
README = readme.read()
with open(os.path.join(os.path.dirname(__file__), 'requirements.txt'), 'r') as requirements:
REQUIREMENTS = requirements.readlines()
os.chdir(
os.path.normpa... | SgtHotshot/forge-cortex | setup.py | Python | mit | 893 |
import os
result = open('prueba.txt', 'w')
dirs = os.listdir(".")
for i in dirs:
if os.path.isdir(i):
#print i
result.write(i + ":\n")
result.write(" path: "+ i + "\n")
result.write(" run: True\n\n") | fqez/JdeRobot | test/packages/aaa.py | Python | gpl-3.0 | 222 |
#!/usr/bin/python
import sys
import getopt
import nibabel as nib
import numpy
import scipy
# params is the dictionary holding all needed parameters for the script
# think about adding an -m option for introducing a mask
params = {
'nii_filename': "",
'start_slice': 0,
'end_slice': None,
'alternate_sli... | medihack/nii2img | nii2img.py | Python | bsd-3-clause | 4,023 |
import re
def is_valid_hostname(hostname):
"""
Validate is a hostname
Thanks to https://stackoverflow.com/a/2532344/1489738
"""
if len(hostname) > 255:
return False
if hostname[-1] == ".":
hostname = hostname[:-1] # strip exactly one dot from the right, if present
allowed ... | Flaburgan/diaspora-hub | thefederation/utils.py | Python | agpl-3.0 | 654 |
# -*- coding: latin-1 -*-
"""
Hydrogen Models
---------------
Hydrogen in HII regions is typically assumed to follow Case B recombination
theory.
The values for the Case B recombination coefficients are given by `Hummer &
Storey (1987)
<http://adsabs.harvard.edu/cgi-bin/nph-bib_query?bibcode=1987MNRAS.224..801H&db_ke... | bsipocz/pyspeckit | pyspeckit/spectrum/models/hydrogen.py | Python | mit | 10,701 |
from vsg.token import next_statement as token
from vsg.vhdlFile import utils
from vsg.vhdlFile.classify import condition
def detect(iToken, lObjects):
'''
next_statement ::=
[ label : ] next [ loop_label ] [ when condition ] ;
'''
if utils.are_next_consecutive_tokens([None, ':', 'next'], iT... | jeremiah-c-leary/vhdl-style-guide | vsg/vhdlFile/classify/next_statement.py | Python | gpl-3.0 | 1,245 |
#!/usr/bin/env python3
import os
import sys
try:
import bazelfixes
bazelfixes.fix_pywin32_in_bazel()
bazelfixes.fix_extraneous_path_in_bazel()
except ImportError:
pass
import aqt
if not os.environ.get("ANKI_IMPORT_ONLY"):
aqt.run()
| simgunz/anki | qt/runanki.py | Python | agpl-3.0 | 256 |
# Copyright (c) 2017 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... | gnumdk/eolie | eolie/helper_dbus.py | Python | gpl-3.0 | 3,499 |
"""Markdown Exporter class"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#---------------... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/IPython/nbconvert/exporters/markdown.py | Python | mit | 1,356 |
# Copyright (c) 2015-2017 Cisco Systems, Inc.
#
# 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... | kireledan/molecule | test/unit/lint/test_yamllint.py | Python | mit | 4,973 |
# Copyright 2015 PerfKitBenchmarker 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 appli... | xiaolihope/PerfKitBenchmarker-1.7.0 | perfkitbenchmarker/archive.py | Python | apache-2.0 | 2,247 |
'''
Driver method to run the complex_monte_carlo module
'''
import sys
import string
import os
import shutil
import time
import sassie.util.sasconfig as sasconfig
import sassie.interface.input_filter as input_filter
import sassie.simulate.complex_monte_carlo.complex_monte_carlo as complex_monte_carlo
#import complex_... | madscatt/zazzie | src_2.7/sassie/simulate/complex_monte_carlo/gui_mimic_complex_monte_carlo1.py | Python | gpl-3.0 | 8,820 |
# -*- coding: utf-8 -*-
from random import randint
import time
import OpenSSL
from base64 import b64encode,b64decode
def getRand(len=10):
#生成len长度的随机字符串
s=""
for _ in range(len):
s=s+str(randint(0,9))
return s
def getOrderId():
'''
生成订单号
:return: 返回随机订单号(str)
'''
timestamp... | zjyfdu/flask_huxiaofei | app/alipay/alipaylib/util.py | Python | mit | 1,889 |
# Copyright 2012, Nachi Ueno, NTT MCL, 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 applic... | coreycb/horizon | openstack_dashboard/dashboards/project/routers/ports/tables.py | Python | apache-2.0 | 4,671 |
# -*- coding: utf-8 -*-
# File: base.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
from abc import ABCMeta, abstractmethod
import signal
import re
from six.moves import range
import tqdm
import tensorflow as tf
from .config import TrainConfig
from ..utils import logger, get_tqdm_kwargs
from ..utils.timer import timed_o... | yinglanma/AI-project | tensorpack/train/base.py | Python | apache-2.0 | 6,236 |
from django.db import models
class Group(models.Model):
"""Group Model"""
class Meta(object):
verbose_name = 'Група'
verbose_name_plural = 'Групи'
title = models.CharField(
max_length=256,
blank=False,
verbose_name='Назва')
leader = models.OneToOneField(
... | samitnuk/studentsdb | students/models/groups.py | Python | mit | 802 |
#!/usr/bin/env python
# this script runs all examples and checks that they all
# run without throwing and exception
import os
import sys
from glob import glob
import subprocess as subp
# Modify the following to suit your environment
NUM_EPOCHS = 2
BACKEND = "gpu"
SUBSET_PCT = 5
ADDITIONAL_ARGS = ""
BASE_DATA_DIR = '~... | DougFirErickson/neon | tests/run_examples.py | Python | apache-2.0 | 2,415 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/showfont/package.py | Python | lgpl-2.1 | 1,797 |
from flask import Blueprint
from flask import Flask, abort
from flask import jsonify
from flask import render_template
from flask import request,send_from_directory
import requests
import config as conf
import helpers
sid_api = Blueprint('sid_api', __name__)
| nachoaguadoc/aimlx-demos | controller/sid_controller.py | Python | mit | 261 |
'''
Versions:
April 18, 2016 - Original version
June 16, 2016 - Processing the whole NIPS 1-17 dataset
July 05, 2016 - Customizing for the Yelp dataset
References:
http://miguelmalvarez.com/2015/03/20/classifying-reuters-21578-collection-with-python-representing-the-data/
http://www.nltk.or... | clintpgeorge/gaur | build_clda_corpus_yelp.py | Python | gpl-3.0 | 7,054 |
import subprocess
import os
import ccmlib.repository
from ccmlib.common import is_win, get_version_from_build
class DTestConfig:
def __init__(self):
self.use_vnodes = True
self.use_off_heap_memtables = False
self.num_tokens = -1
self.data_dir_count = -1
self.force_execution... | blerer/cassandra-dtest | dtest_config.py | Python | apache-2.0 | 3,864 |
#! /usr/bin/env python
import os
def _kwargs(kwargs, key, value):
if key not in kwargs.keys():
kwargs[key] = value
def _parseFilename(path):
name, ext = os.path.splitext(path)
ext = ext[1:].lower()
return name, ext
class Directory(object):
def __init__(self, directory_path, **kwargs... | bluemellophone/detecttools | detecttools/directory/__init__.py | Python | apache-2.0 | 5,056 |
"""Find spark home, and initialize by adding pyspark to sys.path.
If SPARK_HOME is defined, it will be used to put pyspark on sys.path.
Otherwise, common locations for spark (currently only Homebrew's default) will be searched.
"""
from glob import glob
import os
import sys
import subprocess
from IPython import get_i... | freeman-lab/findspark | findspark.py | Python | bsd-3-clause | 4,290 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Licen... | jameschch/Lean | Algorithm.Python/BasicTemplateForexAlgorithm.py | Python | apache-2.0 | 2,252 |
__version__ = '2.2.0'
| thespacedoctor/sherlock | sherlock/__version__.py | Python | mit | 22 |
from functools import wraps
from allura import model as M
from ming.orm.ormsession import ThreadLocalORMSession
from pylons import c
def with_user_project(username):
def _with_user_project(func):
@wraps(func)
def wrapped(*args, **kw):
user = M.User.by_username(username)
c... | leotrubach/sourceforge-allura | Allura/allura/tests/decorators.py | Python | apache-2.0 | 2,342 |
"""
This page is in the table of contents.
Mill is a script to mill the outlines.
==Operation==
The default 'Activate Mill' checkbox is on. When it is on, the functions described below will work, when it is off, the functions will not be called.
==Settings==
===Add Loops===
====Add Inner Loops====
Default is on.
Wh... | natetrue/ReplicatorG | skein_engines/skeinforge-40/skeinforge_application/skeinforge_plugins/craft_plugins/mill.py | Python | gpl-2.0 | 16,875 |
#!/usr/bin/env python2
# 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 "Lice... | qiansl127/HiBench | bin/functions/hibench_prop_env_mapping.py | Python | apache-2.0 | 6,772 |
from openstack_dashboard import api
from django.utils.text import normalize_newlines
import logging
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from novaclient.v1_1 import client as nova_client
LOG = logging.getLogger(__name__)
def create():
with open('/tmp/a','r')... | ChinaMassClouds/copenstack-server | openstack/src/horizon-2014.2/openstack_dashboard/dashboards/project/instances/workflows/test.py | Python | gpl-2.0 | 4,522 |
from django import template
from django.contrib.auth.models import AnonymousUser
from django.test import RequestFactory
from django.test.utils import override_settings
import mock
from test_app import views
from waffle.middleware import WaffleMiddleware
from waffle.tests.base import TestCase
def get():
request =... | mwaaas/django-waffle-session | waffle/tests/test_templates.py | Python | bsd-3-clause | 2,158 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | duftler/spinnaker | testing/citest/spinnaker_testing/spinnaker_test_scenario.py | Python | apache-2.0 | 12,971 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Liblarch - a library to handle directed acyclic graphs
# Copyright (c) 2011-2012 - Lionel Dricot & Izidor Matušov
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the... | getting-things-gnome/liblarch | liblarch_gtk/treemodel.py | Python | lgpl-3.0 | 7,690 |
"""mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | brady-vitrano/full-stack-django-kit | users/urls.py | Python | mit | 759 |
import sys
import json
import logging
from redash.utils import JSONEncoder
from redash.query_runner import *
logger = logging.getLogger(__name__)
types_map = {
5: TYPE_BOOLEAN,
6: TYPE_INTEGER,
7: TYPE_FLOAT,
8: TYPE_STRING,
9: TYPE_STRING,
10: TYPE_DATE,
11: TYPE_DATETIME,
12: TYPE_D... | moritz9/redash | redash/query_runner/vertica.py | Python | bsd-2-clause | 4,314 |
# Import view controllers
from controllers.static_pages import *
from controllers.auth import *
from controllers.dashboard import *
| cydrobolt/lys-server | lys_web/views.py | Python | apache-2.0 | 133 |
# -*- coding: utf-8 -*-
"""
Implement instructions of the Bitcoin VM.
The MIT License (MIT)
Copyright (c) 2013 by Richard Kiss
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 restrictio... | zsulocal/pycoin | pycoin/tx/script/microcode.py | Python | mit | 13,144 |
from django import http
from django.test import TestCase
from django.test.client import RequestFactory
from django.core.urlresolvers import reverse
from . import models
from . import views
class MemberTests(TestCase):
def setUp(self):
self.factory = RequestFactory()
self.member = models.Member.ob... | chrisfranklin/dinnertime | launchpad/tests.py | Python | gpl-3.0 | 1,749 |
"""
Tools for publishing batches.
"""
import itertools
import logging
import time
import uuid
from contextlib import contextmanager
from pgshovel.interfaces.streams_pb2 import (
BatchOperation,
BeginOperation,
CommitOperation,
Header,
Message,
MutationOperation,
RollbackOperation,
)
from pg... | disqus/pgshovel | src/main/python/pgshovel/streams/publisher.py | Python | apache-2.0 | 3,149 |
#!/usr/bin/env python3
###############################################################################
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public L... | Ecogenomics/GTDBNCBI | scripts_dev/type_genome_selection/generate_date_table.py | Python | gpl-3.0 | 10,985 |
##An OO python client for the frame_protocol_firmware.ino firmware.
##Supports four operations:
## setColor-- Sets all LEDS to a single color.
## setColors-- Pass an array of color values to set all LEDs individually.
## setBrightness-- Set the strip's brightness. (Blinkytape supports 0 through 93)
## reset... | Nentuaby/blinkytape-advanced-protocol | frame_protocol_client/BlinkyTape_3.py | Python | mit | 4,123 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_with_angular_je.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| eliezerfot123/django-with-angular | django_with_angular_je/manage.py | Python | gpl-2.0 | 265 |
from ert.enkf.enums import EnkfInitModeEnum
from ert_gui.models.connectors.run import ActiveRealizationsModel, TargetCaseModel, AnalysisModuleModel, BaseRunModel
from ert_gui.models.mixins import ErtRunError
class EnsembleSmoother(BaseRunModel):
def __init__(self):
super(EnsembleSmoother, self).__init__(... | iLoop2/ResInsight | ThirdParty/Ert/devel/python/python/ert_gui/models/connectors/run/ensemble_smoother.py | Python | gpl-3.0 | 2,604 |
from django.db import migrations, models
LEVELS_DATA = (
(1, (6107, 10442, 10531)),
(2, (2253, 12468, 12469)),
(3, (10603, 8167, 10447)),
(4, (8280, 15117)),
(5, (3412, 14)),
(6, (2256,)),
)
LEVELS_HELPS = {
1: """
<p>
L’exercice consiste à transcrire un ensemble de sources
... | dezede/dezede | examens/migrations/0002_auto_20160210_0540.py | Python | bsd-3-clause | 3,148 |
# Copyright (c) 2021 PaddlePaddle 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 app... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/npu/test_save_load_npu.py | Python | apache-2.0 | 2,813 |
#!/usr/bin/env python3
import os
import subprocess
import sys
def main():
projectroot = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
componentspath = os.path.join(projectroot, "addons")
buildpath = componentspath
for component in os.listdir(componentspath):
if os.path.isdir(os... | Soil/Soil | tools/build.py | Python | gpl-3.0 | 1,118 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.