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 numpy as np
import matplotlib.pyplot as plt
import matplotlib
import sens_calc as sens
import sys, os
from astropy.io import fits
import aplpy
from astropy.wcs import WCS
plt.ion()
telescope = sys.argv[1]
rootdir = '.'
bands = np.array([250, 350, 500]) # microns
t_map = np.array([10., 5., 3., 1]) # hours
t_dust... | sbg2133/miscellaneous_projects | galaxies/plot_gals_time.py | Python | gpl-3.0 | 4,294 |
# Copyright (C) 2013-2014 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... | huddler/pgbarman | tests/test_output.py | Python | gpl-3.0 | 36,282 |
# coding: utf-8
from flask import Blueprint
from flask import request, render_template, render_template_string, Flask
from flask import jsonify
import json
import random
from ..decorators.crossdomain import crossdomain
__all__ = ['bp']
bp = Blueprint('demo_handler', __name__)
########################... | tim-tang/arctic-bear | arctic/handlers/demo_handler.py | Python | mit | 15,878 |
"""apoio URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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-based... | piratas/apoio-piratas | apoio/apoio/urls.py | Python | gpl-3.0 | 995 |
"""
pyNEAT
Copyright (C) 2007-2008 Brian Greer
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in ... | liquidkarma/pyneat | pyNEAT/Fitness.py | Python | gpl-2.0 | 1,737 |
from tests import utils
import tempfile
import pytest
from cutevariant.gui import export as exp
from cutevariant.gui.plugins.variant_view import widgets
from cutevariant.core import sql, importer
from cutevariant.core.reader import VcfReader
import os
from PySide2.QtWidgets import *
from PySide2.QtCore import *
from ... | labsquare/CuteVariant | tests/gui/test_export.py | Python | gpl-3.0 | 1,187 |
from abc import ABC, abstractmethod
import io
import gzip
import math
from collections import Counter
# use to format value with URL caracter : #See Issue
from urllib.parse import unquote
import cutevariant.commons as cm
from cutevariant import LOGGER
class AbstractReader(ABC):
"""Base class for all Readers re... | labsquare/CuteVariant | cutevariant/core/reader/abstractreader.py | Python | gpl-3.0 | 21,709 |
'''tzinfo timezone information for America/Miquelon.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Miquelon(DstTzInfo):
'''America/Miquelon timezone definition. See datetime.tzinfo for details'''
zone = 'America/Miquelo... | newvem/pytz | pytz/zoneinfo/America/Miquelon.py | Python | mit | 4,711 |
from cppstyle import check_naming, check_order, check_indent, check_comments
def check(file, node, config):
issues = []
if file == node.file:
issues += check_naming.check(node, config)
issues += check_indent.check(node, config)
issues += check_order.check(node, config)
issues +... | gfelbing/cppstyle | cppstyle/check.py | Python | gpl-3.0 | 446 |
"""Axis class and associated."""
# --- import --------------------------------------------------------------------------------------
import re
import numexpr
import operator
import functools
import numpy as np
from .. import exceptions as wt_exceptions
from .. import kit as wt_kit
from .. import units as wt_units... | wright-group/WrightTools | WrightTools/data/_axis.py | Python | mit | 6,659 |
# Copyright 2017, Google LLC 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... | jonparrott/gcloud-python | dlp/noxfile.py | Python | apache-2.0 | 3,018 |
# encoding: utf-8
# This library 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.
#
# This library is distributed in the hope... | poppogbr/genropy | gnrpy/gnr/devel/commands.py | Python | lgpl-2.1 | 10,715 |
name = 'STEM'
identifier = 'edu.cornell.birds.stem'
version = '0.0.2'
def package_dependencies():
return ['edu.utah.sci.vistrails.rpy']
| VisTrails/vistrails-contrib-legacy | stem/__init__.py | Python | bsd-3-clause | 141 |
"""
https://codelab.interviewbit.com/problems/listcycle/
"""
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param A ... | JuanCTorres/interview-prep-solutions | codelab/listcycle.py | Python | mit | 1,048 |
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy
from django.core import urlresolvers
from gasistafelice.rest.views.blocks.base import BlockSSDataTables, ResourceBlockAction, CREATE_PDF, SENDME_PDF
from gasistafelice.consts import EDIT, CONFIRM
from gasistafelice.lib.shortcuts import render_... | matteo88/gasistafelice | gasistafelice/rest/views/blocks/basket.py | Python | agpl-3.0 | 8,830 |
from pyhdf.HDF import *
from pyhdf.VS import *
f = HDF('inventory.hdf', # Open file 'inventory.hdf'
HC.WRITE|HC.CREATE) # creating it if it does not exist
vs = f.vstart() # init vdata interface
vd = vs.attach('INVENTORY', 1) # attach vdata 'INVENTORY' in write mode
# Update the... | fhs/python-hdf4 | examples/inventory/inventory_1-2.py | Python | mit | 1,007 |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from django.template import RequestContext
from ..classes import HnsccDashboard
@login_required
def hnscc_dashboard(request, **kwargs):
dashboard = HnsccDashboard(
dashboard_type=kwargs.get('dashboar... | botswana-harvard/bhp065_project | bhp065/apps/hnscc_dashboard/views/hnscc_dashboard.py | Python | gpl-2.0 | 806 |
# 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/customproviders/azure-mgmt-customproviders/azure/mgmt/customproviders/models/_customproviders_enums.py | Python | mit | 1,961 |
#!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... | GoobyCoin/GoobyCoin | contrib/pyminer/pyminer.py | Python | mit | 6,435 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apach... | eltonkevani/tempest_el_env | tempest/services/compute/xml/flavors_client.py | Python | apache-2.0 | 8,407 |
# -*- coding: UTF-8 -*-
import haystack
from django.core.management.base import BaseCommand, CommandError
from conference import models
from collections import defaultdict
from optparse import make_option
class Command(BaseCommand):
"""
"""
option_list = BaseCommand.option_list + (
make_option('-... | pythonitalia/pycon_site | p3/management/commands/ticket_list.py | Python | bsd-2-clause | 5,861 |
import pytest
from plenum.common.config_helper import PNodeConfigHelper
from plenum.common.startable import Mode
from plenum.server.replica_validator_enums import INCORRECT_PP_SEQ_NO, OLD_VIEW, ALREADY_ORDERED, STASH_WATERMARKS, \
STASH_CATCH_UP, STASH_VIEW_3PC
from plenum.test.helper import checkDiscardMsg, gener... | evernym/plenum | plenum/test/replica/test_3pc_messages_validation.py | Python | apache-2.0 | 4,314 |
"""Development settings and globals."""
from os.path import join, normpath
from base import *
########## LOCAL DATABASE CONFIGURATION, OVERIDES BASE
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': joi... | josven/phx | phx/settings/local.py | Python | mit | 1,642 |
"""A formatter which formats phone numbers as they are entered.
An AsYouTypeFormatter can be created by invoking
AsYouTypeFormatter(region_code). After that digits can be added by invoking
input_digit() on the formatter instance, and the partially formatted phone
number will be returned each time a digit is added. cle... | WillisXChen/django-oscar | oscar/lib/python2.7/site-packages/phonenumbers/asyoutypeformatter.py | Python | bsd-3-clause | 31,690 |
from SoundManager import *
import time
import sys
sm = SoundManager()
sm.daemon = True
sm.start()
sm.play_sound(sys.argv[1])
sm.play_sound(sys.argv[2])
while True:
time.sleep(1)
| mendrew/questroom-lovecraft | sound_test/sm_test_callback.py | Python | gpl-2.0 | 185 |
# -*- coding: utf-8 -*-
import urllib, urllib2
from datetime import datetime
SPEEDURL = 'http://speed.pypy.org/'
def save(project, revision, results, options, executable, int_options, host, testing=False):
testparams = []
#Parse data
data = {}
current_date = datetime.today()
for b in resu... | camillobruni/pinocchioCodespeed | tools/pypy/savecpython.py | Python | gpl-3.0 | 2,103 |
import numpy as np
from pySDC.implementations.collocation_classes.gauss_radau_right import CollGaussRadau_Right
from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI
from pySDC.implementations.problem_classes.Van_der_Pol_implicit import vanderpol
from pySDC.implementations.sweeper_cl... | Parallel-in-Time/pySDC | pySDC/projects/RDC/vanderpol_reference.py | Python | bsd-2-clause | 2,054 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softwa... | timeyyy/PyUpdater | pyupdater/vendor/PyInstaller/loader/rthooks/pyi_rth_pkgres.py | Python | bsd-2-clause | 916 |
import scrapy
from scrapy.crawler import CrawlerProcess
import json
import mysql.connector
import logging
import datetime
from w3lib.html import remove_tags
from urllib.parse import urlparse
class Spider(scrapy.Spider):
name = 'Spider'
def __init__(self, p_cnx, p_sources, p_keywords):
self.cnx = p_... | Xaess/crawler | main.py | Python | mit | 5,944 |
"""
Module servant uniquement à lancer le jeu
"""
from jeu import jouer
if __name__ == "__main__":
jouer()
| UnderXirox/Python-3_Des-fichiers-complementaires | Guide/20_Module_2/lanceur.py | Python | gpl-3.0 | 115 |
from scipy.optimize import curve_fit
from numpy import *
import matplotlib.pyplot as plt
# Create a function
# ==> First encounter with *whitespace* in Python <==
def gaussian(x, a, b, c):
val = a * exp(-(x - b)**2 / c**2)
return val
# Generate fake data.
# Note: functions in random package, array arithmetic ... | azariven/BioSig_SEAS | bin/dev/random_code.py | Python | gpl-3.0 | 1,048 |
#!/usr/bin/env python
from distutils.core import setup
import sys, shutil
def do(cmd):
if len(sys.argv)<2: sys.argv.append(cmd)
else: sys.argv[1]=cmd
setup(
name='SAM',
version='1.0',
description='Cyberoam Account Manager',
author='Viranch Mehta / Mohit Kothari',
author_email='viranch.mehta@gmail.com / m... | viranch/sam | setup.py | Python | bsd-2-clause | 495 |
#!/usr/bin/python
import yaml
config = yaml.safe_load(open("config.yml"))
twilio_account_sid = config["twilio"]["account_sid"]
twilio_auth_token = config["twilio"]["auth_token"]
twilio_from_number = config["twilio"]["from_number"]
from twilio.rest import TwilioRestClient
twilio_client = TwilioRestClient(twilio_accou... | alexshepard/aledison | text.py | Python | mit | 877 |
# ext/preprocessors.py
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""preprocessing functions, used with the 'preprocessor'
argument on Template, TemplateLookup"""
... | scheib/chromium | third_party/mako/mako/ext/preprocessors.py | Python | bsd-3-clause | 576 |
import math
import random
def gcd(_a, _b):
"""Returns the Greatest Common Divisor from two integers"""
while _b:
_t, _a = _a, _b
_b = _t % _b
return _a
if __name__ == "__main__":
assert gcd(60, 96) == 12
assert gcd(20, 8) == 4
for _i in range(20):
_a, _b = random.rand... | Moggi/python-playground | HRank/gcd.py | Python | gpl-2.0 | 405 |
# -*- coding: utf-8 -*-
__all__ = ["cc"]
| MarieVdS/ComboCode | __init__.py | Python | gpl-3.0 | 42 |
'''Testing numerical differentiation
Still some problems, with API (args tuple versus *args)
finite difference Hessian has some problems that I didn't look at yet
Should Hessian also work per observation, if fun returns 2d
'''
import numpy as np
from numpy.testing import assert_almost_equal, assert_allclose
import ... | yarikoptic/pystatsmodels | statsmodels/tools/tests/test_numdiff.py | Python | bsd-3-clause | 14,062 |
#!/usr/bin/env python
"""
deps:
*) pip install --upgrade pip wheel setuptools twine
publish:
1) #> python setup.py sdist bdist_wheel
2) #> twine upload dist/* #<specific specific wheel if needed>; --repository <testpypi> or --repository-url <testpypi-url>
"""
import os
from setuptools import setup, find_packages
d... | holiman/evmlab | setup.py | Python | gpl-3.0 | 1,872 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-30 15:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contributions', '0062_auto_20170330_1530'),
]
operations = [
migrations.Cre... | phani00/tovp | tovp/contributions/migrations/0063_source.py | Python | mit | 606 |
"""
Measure management functions.
"""
import binascii
import errno
import glob
import os
import shutil
import xdrlib
from datetime import datetime
from pas import conf
from pas import tshark
from pas import shell
from pas import xml
from pas.conf import settings
from pas.conf import map_interfaces
from pas.conf impo... | GaretJax/pop-analysis-suite | pas/measure.py | Python | mit | 15,485 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from pymongo import MongoClient, DESCENDING
from secret import server
from json import loads
def fast():
db = MongoClient(server.MONGODB_DEV_URI)["mirrors"]
find_law = {
"hits": { "$gt": 0 },
"pages": { "$gt": 0 },
"bandwidt... | ccreimondo/visual-ip | fetch_location.py | Python | mit | 2,063 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack, LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this s3 except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/li... | rcbops/glance-buildpackage | glance/tests/unit/test_s3_store.py | Python | apache-2.0 | 11,404 |
import re
from lxml import etree
from pyramid.settings import asbool
from .exception import ConfigurationError
def clean_oai_settings(settings):
"""Parse and validate OAI app settings in a dictionary.
Check that the settings required by the OAI app are in the settings
dictionary and have vali... | Tietoarkisto/kuha | kuha/config.py | Python | bsd-3-clause | 6,033 |
#!/usr/bin/env python
import uvloop
import asyncio
import time
from pprint import pprint
from owllook.fetcher.parse import novels_search
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
def novel_task(url):
loop = asyncio.get_event_loop()
task = asyncio.ensure_future(novels_search(url))
loop.run_u... | zhiyue/owllook | tests/parse_test.py | Python | apache-2.0 | 530 |
# -*- coding: utf-8 -*-
"""
Foundation Images
=================
This plugin is mostly for the foundation theme I'm building
which allows one to easily insert centered images with captions
into posts. It's extremely basic and niche for now, but I might
make it more fully-featured later.
"""
from pelican import signals... | FuzzyWuzzie/foundation_images | foundation_images.py | Python | mit | 914 |
import array
import numpy as np
import tensorflow as tf
from collections import defaultdict
def load_vocab(filename):
vocab = None
with open(filename) as f:
vocab = f.read().splitlines()
dct = defaultdict(int)
for idx, word in enumerate(vocab):
dct[word] = idx
return [vocab, dct]
def load_glove_vect... | baeriivan/OpensubtitleBot | models/helpers.py | Python | mit | 1,428 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module contains the ChannelMerger class.
"""
from harpia.GUI.fieldtypes import *
from harpia.model.plugin import Plugin
class ChannelMerger(Plugin):
# -------------------------------------------------------------------------
def __init__(self):
Pl... | llgoncalves/harpia | harpia/extensions/javascript/webaudio/channelmerger.py | Python | gpl-2.0 | 1,789 |
# coding:utf-8
from flask import Flask
def create_app():
app = Flask(__name__)
app.config.from_object("application.config.DevelopmentConfig")
return app
app = create_app()
from application import views
| shiraco/gourmetgrapher | application/__init__.py | Python | apache-2.0 | 219 |
"""Support for Tahoma scenes."""
import logging
from homeassistant.components.scene import Scene
from . import DOMAIN as TAHOMA_DOMAIN
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Tahoma scenes."""
controller = hass.data[TAHOMA_DOM... | MartinHjelmare/home-assistant | homeassistant/components/tahoma/scene.py | Python | apache-2.0 | 1,181 |
from django.contrib import admin
# Register your models here.
from app.models import Crags
admin.site.register(Crags)
| agronauts/rockandrice | rocknrice/app/admin.py | Python | gpl-3.0 | 120 |
# Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/SourceXCloud | lib/sxc/proclib.py | Python | apache-2.0 | 3,746 |
# occiput
# Stefano Pedemonte
# Aalto University, School of Science, Helsinki
# Oct 2013, Helsinki
# Harvard University, Martinos Center for Biomedical Imaging
# Boston, MA, USA
from occiput.Visualization.Visualization import ProgressBar
from occiput.DataSources.FileSources.LookupTable import load_freesurfer_lut_... | kastman/occiput | occiput/DataSources/FileSources/Web.py | Python | apache-2.0 | 3,397 |
import scipy.misc
import random
xs = []
ys = []
#points to the end of the last batch
train_batch_pointer = 0
val_batch_pointer = 0
#read data.txt
with open("/usr/local/google/home/limeng/Downloads/nvida/data.txt") as f:
for line in f:
xs.append("/usr/local/google/home/limeng/Downloads/nvida/driving_datas... | mengli/MachineLearning | self_driving/steering/driving_data.py | Python | apache-2.0 | 1,856 |
import threading
from yandextank.core.tankcore import TankCore
from yandextank.plugins.Telegraf import Plugin as TelegrafPlugin
class TestTelegrafPlugin(object):
def test_plugin_configuration(self):
""" testing telegraf plugin configuration """
cfg = {
'core': {},
'telegra... | f2nd/yandex-tank | yandextank/plugins/Telegraf/tests/test_plugin.py | Python | lgpl-2.1 | 1,320 |
# Copyright (c) Mathias Kaerlev 2011-2012.
# This file is part of pyspades.
# pyspades 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... | iamgreaser/pysnip | feature_server/commands.py | Python | gpl-3.0 | 34,282 |
# Locate and load the lldb python module
import os
import sys
def import_lldb():
""" Find and import the lldb modules. This function tries to find the lldb module by:
1. Simply by doing "import lldb" in case the system python installation is aware of lldb. If that fails,
2. Executes the lldb exe... | apple/swift-lldb | utils/vim-lldb/python-vim-lldb/import_lldb.py | Python | apache-2.0 | 2,603 |
#
#
# Copyright (C) 2014 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and ... | yiannist/ganeti | lib/cmdlib/cluster/verify.py | Python | bsd-2-clause | 91,184 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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,
... | timj/scons | test/AR/AR.py | Python | mit | 2,795 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 30, transform = "RelativeDifference", sigma = 0.0, exog_count = 0, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_MovingMedian/cycle_30/ar_/test_artificial_128_RelativeDifference_MovingMedian_30__0.py | Python | bsd-3-clause | 276 |
import datetime
from django.utils.html import linebreaks
from django.contrib.sites.models import Site
def camelcase(name):
return ''.join(x.capitalize() or ' ' for x in name.split(' '))
def camelcase_lower(name):
pname = camelcase(name)
return pname[0].lower() + pname[1:]
def split_thousands(n, sep=',... | thierrymarianne/valuenetwork | valuenetwork/valueaccounting/utils.py | Python | agpl-3.0 | 24,484 |
import webapp2
from webapp2 import Route
from webapp2_extras import routes
import handlers_base
import registry.handlers
import widgets.handlers
import demos.mememator.handlers
import demos.shortener.handlers
import demos.instapaper.handlers
import demos.cloudfilepicker.handlers
import demos.imgur.handlers
import demo... | PaulKinlan/WebIntents | server/server.py | Python | apache-2.0 | 4,274 |
#! /usr/bin/python
# Copyright (C) 2012-2015, Alphan Ulusoy (alphan@bu.edu)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later ve... | wasserfeder/lomap | lomap/algorithms/multi_agent_optimal_run.py | Python | gpl-2.0 | 2,403 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RDt(RPackage):
"""Data objects in R can be rendered as HTML tables using the JavaScript
... | rspavel/spack | var/spack/repos/builtin/packages/r-dt/package.py | Python | lgpl-2.1 | 1,816 |
#
# Copyright (c) 2015 Autodesk 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 l... | svoorhees/ochopod | sdk/setup.py | Python | apache-2.0 | 1,557 |
# *****************************************************************************
# Copyright (c) 2020, Intel Corporation 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 sou... | IntelLabs/hpat | examples/series/series_lt.py | Python | bsd-2-clause | 1,748 |
# vim: set et sw=4 sts=4 fileencoding=utf-8:
#
# Python camera library for the Rasperry-Pi camera module
# Copyright (c) 2013-2015 Dave Jones <dave@waveform.org.uk>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# ... | ListFranz/picamera | picamera/encoders.py | Python | bsd-3-clause | 63,187 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | GoogleCloudPlatform/keras-idiomatic-programmer | zoo/srcnn/srcnn-post_c.py | Python | apache-2.0 | 3,721 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import models
from openerp import api, SUPERUSER_ID
def _setup_inalterability(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
# enable ping for this module
env['publisher_warranty.contract'].updat... | Elico-Corp/odoo_OCB | addons/l10n_fr_certification/__init__.py | Python | agpl-3.0 | 1,524 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import ast
from pan... | megaserg/pants | src/python/pants/backend/python/tasks/checkstyle/class_factoring.py | Python | apache-2.0 | 1,351 |
import research.utils
import argparse
import sys
parser = argparse.ArgumentParser(description='Flip the most significant bit in every byte of the file.')
parser.add_argument('input', nargs='?', type=argparse.FileType('br'), default=sys.stdin)
parser.add_argument('--output', '-o', nargs='?', type=argparse.FileType('bw'... | west-tandon/ReSearch | bin/flip.py | Python | mit | 438 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | qrohlf/cf-client | lib/cfclient/utils/mux/__init__.py | Python | gpl-2.0 | 7,589 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# parallel https://code.google.com/p/pysam/issues/detail?id=105
# import pp
import argparse
import multiprocessing as mp
import os
import pysam
from datetime import datetime
from pynnotator import settings
from subprocess import call
class Dbnsfp(object):
def __init__... | raonyguimaraes/pynnotator | pynnotator/helpers/dbnsfp.py | Python | bsd-3-clause | 6,048 |
from particles.dataTypes import Integer, Double, DoubleTensor
from collisions.function import GradGraph
from particles import ops
import numpy as np
import unittest
def divtest():
x = Integer("Int1")
y = Integer("Int2")
z = x / y
graph = GradGraph(z)
output = graph.getOutput({x: 6,
... | amartya18x/easyGrad | easyGrad/test.py | Python | apache-2.0 | 5,129 |
import django
import pytest
from django.db import models
from psqlextra.fields import HStoreField
from .fake_model import get_fake_model
@pytest.fixture
def model():
"""Test models, where the first model has a foreign key relationship to the
second."""
return get_fake_model({"title": HStoreField()})
... | SectorLabs/django-postgres-extra | tests/test_query_values.py | Python | mit | 2,282 |
from django.contrib import admin
from django.contrib.sites.models import RequestSite
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
from registration.models import RegistrationProfile
class RegistrationAdmin(admin.ModelAdmin):
actions = ['activate_users', 're... | xlk521/cloudguantou | registration/admin.py | Python | bsd-3-clause | 1,632 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#file:convert.py
import sqlite3
import re
import logging
import json
from database import Database
logger = logging.getLogger(__name__)
FORMAT = "[%(filename)s:%(lineno)s - %(funcName)20s() ] %(message)s"
logging.basicConfig(file="sqlconvert.log", format=FORMAT, level=logg... | cortext/antonio | sql2json.py | Python | mit | 5,710 |
from __future__ import print_function
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.xgboost import H2OXGBoostEstimator
#----------------------------------------------------------------------
# Purpose: Smoke-test basic XGBoost operation under Hadoop.
#------------... | spennihana/h2o-3 | h2o-py/tests/testdir_hdfs/pyunit_INTERNAL_XGBoostEstimation.py | Python | apache-2.0 | 2,346 |
from .pyfirmata import *
from .boards import BOARDS
__version__ = '1.0.3' # Use bumpversion!
# shortcut classes
class Arduino(Board):
"""
A board that will set itself up as a normal Arduino.
"""
def __init__(self, *args, **kwargs):
args = list(args)
args.append(BOARDS['arduino'])
... | jochasinga/pyFirmata | pyfirmata/__init__.py | Python | mit | 1,176 |
import pytest
import pandas as pd
from lcdblib.pandas import utils
@pytest.fixture(scope='session')
def sample_table():
metadata = {
'sample': ['one', 'two'],
'tissue': ['ovary', 'testis']
}
return pd.DataFrame(metadata)
def test_cartesian_df(sample_table):
df2 = pd.DataFrame({'num... | lcdb/lcdblib | tests/test_pandas_utils.py | Python | mit | 1,376 |
from Constants import *
from LoewnerRunFactory import LoewnerRunFactory
from prompt_toolkit import PromptSession
from os import popen
from numpy import arange, linspace
from InterfaceMode import *
class CommandLineInterface:
def __init__(self):
# Create a dictionary of input-function pairs
self.b... | ucapdak/loewner | main/PythonTools/Interface.py | Python | mit | 7,161 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | airbnb/superset | superset/connectors/druid/models.py | Python | apache-2.0 | 64,948 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa 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... | CulturePlex/pybossa | test/test_api/test_api_common.py | Python | agpl-3.0 | 7,558 |
# Copyright (C) 2010-2014 GRNET S.A.
#
# 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.
#
# This program is distributed i... | Erethon/synnefo | snf-cyclades-app/synnefo/logic/management/commands/server-modify.py | Python | gpl-3.0 | 4,868 |
content_types = {
'css': 'text/css',
'gif': 'image/gif',
'html': 'text/html',
'jpg': 'image/jpeg',
'js': 'application/javascript',
'json': 'application/json',
'png': 'image/png',
'txt': 'text/plain',
}
def get_static_file(path, static_files):
"""Return the local filename and conten... | miguelgrinberg/python-engineio | src/engineio/static_files.py | Python | mit | 2,064 |
# GromacsWrapper: test_amber03star.py
# Copyright (c) 2009 Oliver Beckstein <orbeckst@gmail.com>
# Released under the GNU Public License 3 (or higher, your choice)
# See the file COPYING for details.
from __future__ import division, absolute_import, print_function
import pytest
from gromacs.exceptions import Gromacs... | Becksteinlab/GromacsWrapper | tests/fileformats/top/test_amber03star.py | Python | gpl-3.0 | 666 |
import yaml
def get_page_data(path, get, post, variables):
resume_data = yaml.load(open("static/resume.yml", "r"))
for job in resume_data['work']:
job['tasks_html'] = "<ul><li>%s</li></ul>" % "</li><li>".join(job['tasks'])
return resume_data
| ClintonMorrison/personal-website | app/pages/controllers/resume.py | Python | apache-2.0 | 254 |
# -*- coding: utf-8 -*-
# Minio Python Library for Amazon S3 Compatible Cloud Storage, (C) 2015 Minio, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licen... | harshavardhana/minio-py | minio/helpers.py | Python | apache-2.0 | 15,117 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_infra_statsd_oper.py | Python | apache-2.0 | 145,349 |
#!/usr/bin/env python
# @author: Yannick Dayer <yannick.dayer@idiap.ch>
# @date: Wed 16 Jun 2021 17:21:47 UTC+02
import csv
import logging
from pathlib import Path
import click
from tqdm import tqdm
import bob.io.audio
import bob.io.base
from bob.bio.base.database import CSVDataset
from bob.bio.base.database impo... | bioidiap/bob.bio.spear | bob/bio/spear/database/voxforge.py | Python | gpl-3.0 | 6,256 |
"""Utility file for generating synthetic phrases from input phrases"""
# Copyright 2022 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/LIC... | GoogleCloudPlatform/dfcx-scrapi | src/dfcx_scrapi/core_ml/utterance_generator.py | Python | apache-2.0 | 4,665 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class NetkitFtp(AutotoolsPackage):
"""netkit-ftp is the original file transfer client program fo... | LLNL/spack | var/spack/repos/builtin/packages/netkit-ftp/package.py | Python | lgpl-2.1 | 622 |
"""
Tests for Course Blocks forms
"""
import ddt
from django.http import Http404, QueryDict
from urllib import urlencode
from rest_framework.exceptions import PermissionDenied
from opaque_keys.edx.locator import CourseLocator
from openedx.core.djangoapps.util.test_forms import FormTestMixin
from student.models import ... | franosincic/edx-platform | lms/djangoapps/course_api/blocks/tests/test_forms.py | Python | agpl-3.0 | 8,417 |
__author__ = 'student'
a = 1
while a <= 100:
if a % 3 == 0:
if a % 5 != 0:
print('Fizz')
else:
print('FizzBuzz')
elif a % 5 == 0:
print('Buzz')
else:
print(a)
a += 1 | YellowNettle/Labs-16 | 3_2.py | Python | gpl-3.0 | 237 |
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license noti... | sbbic/core | wizards/com/sun/star/wizards/web/data/CGImage.py | Python | gpl-3.0 | 894 |
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
import tempfile
import pytest
import bugzilla
import tests
import tests.mockbackend
import tests.utils
#################################
# 'bugzilla login' mock testing #
#################################
def... | wgwoods/python-bugzilla | tests/test_cli_login.py | Python | gpl-2.0 | 3,667 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Analysis Preservation Framework.
# Copyright (C) 2016 CERN.
#
# CERN Analysis Preservation Framework 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... | cernanalysispreservation/analysis-preservation.cern.ch | cap/modules/schemas/views.py | Python | gpl-2.0 | 4,908 |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
from workflows.models.workflow import Workflow
class UserProfile(models.Model):
user = models.OneToOneFiel... | xflows/clowdflows-backend | workflows/models/user_profile.py | Python | mit | 1,084 |
from __future__ import print_function
import sys
#
"""
Utility methods for CRUD of alarms
"""
def get_state(mon_client, alarm_id):
result = get(mon_client, alarm_id)
return result['state']
def get(mon_client, alarm_id):
result = mon_client.alarms.get(**{'alarm_id': alarm_id})
return result
def... | srsakhamuri/monasca-ansible-scripts | tests/alarm.py | Python | apache-2.0 | 1,773 |
from sklearn.preprocessing import LabelEncoder
from splearn.preprocessing import SparkLabelEncoder
from splearn.utils.testing import SplearnTestCase, assert_array_equal
class TestSparkLabelEncoder(SplearnTestCase):
def test_same_fit_transform(self):
Y, Y_rdd = self.make_dense_randint_rdd(low=0, high=10, ... | lensacom/sparkit-learn | splearn/preprocessing/tests/test_label.py | Python | apache-2.0 | 1,105 |
import sys
import unittest
from pytos.common.base_types import Service_Type, Single_Service_Type, \
Any_Service_Type, Range_Service_Type, Group_Service_Type, Service_Set
__author__ = 'saar.katz'
service_port = {'http': 80, 'https': 443, 'ftp': 21, 'gopher': 70, 'smtp': 25,
'imap': 143, 'imaps': 9... | Tufin/pytos | tests/common_test/test_service_types_unittest.py | Python | apache-2.0 | 9,119 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.