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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2018:
# Matthieu Estrada, ttamalfor@gmail.com
#
# This file is part of (AlignakApp).
#
# (AlignakApp) 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 Sof... | Alignak-monitoring-contrib/alignak-app | alignak_app/qobjects/common/frames.py | Python | agpl-3.0 | 1,441 |
import sys
import serial
from time import sleep
def test_feel(arg_1, arg_2, arg_3, arg_4):
serial_port = str(arg_1)
baud_rate = int(arg_2)
time_out = int(arg_3)
parameter = int(arg_4)
device = serial.Serial(serial_port, baud_rate, timeout=time_out)
for i in range(0, 10000):
device.wr... | DeRaafMedia/ProjectIRCInteractivity | skills/test_feel_function.py | Python | artistic-2.0 | 816 |
#!/usr/bin/env python
# coding=utf-8
import hashlib
import requests
import time
from .binance_exceptions import BinanceAPIException
from .binance_validation import validate_order
from urllib import urlencode
class Client(object):
"""
https://www.binance.com/cn/fee/schedule 手续费
"""
API_URL = 'https... | doubleDragon/QuantBot | quant/api/binance.py | Python | mit | 12,224 |
from math import sqrt
import gtk
from gettext import gettext as _
from ase.gui.widgets import pack, Help
class Constraints(gtk.Window):
def __init__(self, gui):
gtk.Window.__init__(self)
self.set_title(_('Constraints'))
vbox = gtk.VBox()
b = pack(vbox, [gtk.Button(_('Constrain'))... | grhawk/ASE | tools/ase/gui/constraints.py | Python | gpl-2.0 | 1,497 |
"""
Tests for Serializer Fields
"""
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
import pytest
from rest_framework.serializers import ValidationError
from courses.factories import EdxAuthorFactory, CourseFactory
from courses.models import EdxAuthor
from courses.serializers i... | mitodl/ccxcon | courses/fields_test.py | Python | agpl-3.0 | 3,535 |
from pyrser import dsl
from pyrser import parsing
from pyrser import meta
from pyrser import error
from collections import ChainMap
class MetaGrammar(parsing.MetaBasicParser):
"""Metaclass for all grammars."""
def __new__(metacls, name, bases, namespace):
# for multi heritance we have a simple inherit... | payet-s/pyrser | pyrser/grammar.py | Python | gpl-3.0 | 7,534 |
import uuid
from random import randint
from django.shortcuts import render
from django.http import HttpResponseRedirect
from .models import Url
def index(request):
if request.session.has_key("has_url"):
url = request.session.get("has_url")
del request.session['has_url']
return render(req... | luisalves05/shortener-url | src/apps/miudo/views.py | Python | mit | 1,890 |
#!/usr/bin/env python
"""Tests for the memory handler functions."""
import StringIO
# pylint: disable=unused-import,g-bad-import-order
from grr.client import client_plugins
# pylint: enable=unused-import,g-bad-import-order
from grr.client.vfs_handlers import memory
from grr.lib import flags
from grr.lib import rdf... | spnow/grr | client/vfs_handlers/memory_test.py | Python | apache-2.0 | 6,127 |
'''
Use this script from terminal / console with
./python sisostudy.py --file_storage=my_runs
Will create an output with all the necessary information
'''
# Import the pacakges
# Numpy for numerical methods
import numpy as np
# Python Control for SISO creation etc.
import control as cn
# Pandas for Data Storage
im... | AlCap23/Thesis | Python/Experiments/SISO/sisostudy_TSUM.py | Python | gpl-3.0 | 5,574 |
import sys
sys.path.insert(1, "../../../")
import h2o, tests
def binop_pipe():
iris = h2o.import_file(path=tests.locate("smalldata/iris/iris_wheader.csv"))
rows, cols = iris.dim
iris.show()
# frame/scaler
res = 5 | iris
rows, cols = res.dim
assert rows == rows and cols == cols, ... | kyoren/https-github.com-h2oai-h2o-3 | h2o-py/tests/testdir_munging/binop/pyunit_binop2_pipe.py | Python | apache-2.0 | 1,834 |
from flask import Blueprint
from my_app.hello.models import MESSAGES
hello = Blueprint('hello', __name__)
@hello.route('/')
@hello.route('/hello')
def hello_world():
return MESSAGES['default']
@hello.route('/show/<key>')
def get_message(key):
return MESSAGES.get(key) or "%s not found!" % key
@hello.route... | nikitabrazhnik/flask2 | Module 2/Chapter01/my_app/hello/views.py | Python | mit | 450 |
# encoding: utf-8
#
#
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import unicode_literals
from co... | klahnakoski/MoDataSubmission | pyLibrary/queries/__init__.py | Python | mpl-2.0 | 3,044 |
import random
import torch
from torch.autograd import Variable
from train_util import variable_from_sentence
class ModelPredictor(object):
def __init__(self, encoder, decoder, input_lang, output_lang, max_length):
self.encoder = encoder
self.decoder = decoder
self.input_lang = input_lan... | Taekyoon/Pytorch_Seq2Seq_Tutorial | predict.py | Python | mit | 2,310 |
from __future__ import division, print_function
import numpy as np
from itertools import product
import warnings
from scipy.sparse import csr_matrix
from sklearn import datasets
from sklearn import svm
from sklearn.datasets import make_multilabel_classification
from sklearn.random_projection import sparse_random_mat... | zorroblue/scikit-learn | sklearn/metrics/tests/test_ranking.py | Python | bsd-3-clause | 44,265 |
"""Token system
The capture gui application will format tokens in the filename.
The tokens can be registered using `register_token`
"""
from . import lib
_registered_tokens = dict()
def format_tokens(string, options):
"""
Replace the tokens with the correlated strings
:param string: the filename of th... | Colorbleed/maya-capture-gui | capture_gui/tokens.py | Python | mit | 1,977 |
#
# Lecture 3
# Autoencoders - fully connected model
#
#import os
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cmx
from libs.utils import montage
from libs import gif
import datetime
# dja
#np.set_printoptions(threshold=np.inf... | dariox2/CADL | session-3/l3b-autoencoder-fullyconnected.py | Python | apache-2.0 | 5,832 |
from flask import render_template_string, render_template, request
from urllib.parse import unquote
from collections import defaultdict
from .utils import drop_start, cache_filename
from .language import get_language_label
from .wikidata_api import QueryError, QueryTimeout, get_entity, get_entities
from . import user_a... | EdwardBetts/osm-wikidata | matcher/wikidata.py | Python | gpl-3.0 | 54,264 |
# -*- Mode: Python; test-case-name: flumotion.test.test_feedcomponent010 -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU G... | ylatuya/Flumotion | flumotion/component/base/baseadminnode.py | Python | gpl-2.0 | 11,796 |
#!/usr/bin/env python
# Copyright (C) 2005 Bram Cohen, Copyright (C) 2005, 2006 Canonical Ltd
#
# 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 opt... | khertan/KhtNotes | khtnotes/merge3/_patiencediff_py.py | Python | gpl-3.0 | 9,146 |
# coding: utf-8
"""Form mixins for approvable models."""
from approval.models import ApprovedModel
class ApprovableFormMixin:
"""ModelForm mixin for monitored models."""
def __init__(self, *args, **kwargs):
"""
Form initializer for ApprovedModel.
The form is initialized with the inst... | artscoop/django-approval | approval/forms/approvable.py | Python | mit | 567 |
# -*- test-case-name: twisted.test.test_paths -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Object-oriented filesystem path representation.
"""
from __future__ import division, absolute_import
import os
import sys
import errno
import base64
from hashlib import sha1
from os.path im... | Architektor/PySnip | venv/lib/python2.7/site-packages/twisted/python/filepath.py | Python | gpl-3.0 | 58,621 |
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from matplotlib.lines import Line2D
from seispy.rfcorrect import SACStation
from seispy.rf import CfgParser
import argparse
import numpy as np
from os.path import join, realpath, basename, exists
import sys
def init_figure():
h = plt.figure(... | xumi1993/seispy | seispy/plotRT.py | Python | gpl-3.0 | 7,501 |
from __future__ import unicode_literals
from django.apps import AppConfig
class ClientesConfig(AppConfig):
name = 'Clientes'
| carnadaxxx/lotizados | src/Clientes/apps.py | Python | apache-2.0 | 132 |
# This file is part of RinohType, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
from psg.document.dsc import dsc_document
from psg.drawi... | beni55/rinohtype | rinoh/backend/psg.py | Python | agpl-3.0 | 4,834 |
# 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 appli... | luotao1/Paddle | python/paddle/vision/models/shufflenetv2.py | Python | apache-2.0 | 17,363 |
from __future__ import print_function
# Copyright 2017 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 ap... | google/myelin-acorn-electron-hardware | upurs_usb_port/upload_to_upurs.py | Python | apache-2.0 | 3,335 |
import numpy as np
from scipy.integrate import odeint
from bokeh.plotting import *
def streamlines(x, y, u, v, density=1):
'''Returns streamlines of a vector flow.
* x and y are 1d arrays defining an *evenly spaced* grid.
* u and v are 2d arrays (shape [y,x]) giving velocities.
* density controls th... | sahat/bokeh | examples/plotting/cloud/vector.py | Python | bsd-3-clause | 6,505 |
// Language: Python
// Author: heckerman100
print("Hello World)
| mojtabatmj/Hacktoberfest2017 | hello-scripts/Hello_world-heckerman100.py | Python | mit | 65 |
"""The test for the threshold sensor platform."""
from homeassistant.const import ATTR_UNIT_OF_MEASUREMENT, STATE_UNKNOWN, TEMP_CELSIUS
from homeassistant.setup import async_setup_component
async def test_sensor_upper(hass):
"""Test if source is above threshold."""
config = {
"binary_sensor": {
... | kennedyshead/home-assistant | tests/components/threshold/test_binary_sensor.py | Python | apache-2.0 | 11,914 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import mock
from decimal import Decimal
from os import path, unlink
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.... | pysv/djep | pyconde/attendees/tests.py | Python | bsd-3-clause | 43,383 |
#!/usr/bin/env python2
# Copyright (c) 2015 The VCoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test PrioritiseTransaction code
#
from test_framework.test_framework import VCoinTestFramework
from test_fr... | vcoin-project/v | qa/rpc-tests/prioritise_transaction.py | Python | mit | 5,037 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# Mzero - XBMC Plugin
# http://blog.tvalacarta.info/plugin-xbmc/Mzero/
# ------------------------------------------------------------
import os
import re
import sys
import urlparse
from core import config
from core import jsontools... | Mzero2010/MaxZone | plugin.video.Mzero/channels/animeflv.py | Python | gpl-3.0 | 19,445 |
from setuptools import setup, find_packages
import sys
import os
import glob
import configparser
import re
conf = []
templates = []
long_description = '''EasyEngine is the commandline tool to manage your
Websites based on WordPress and Nginx with easy to use
commands'''
f... | Jurisdesk/freedoms | setup.py | Python | mit | 3,124 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2012 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## 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 Foundati... | tiagocardosos/stoq | stoq/gui/test/test_till.py | Python | gpl-2.0 | 8,078 |
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, api
class ProductProduct(models.Model):
_i... | ingadhoc/stock | stock_ean128/models/product_product.py | Python | agpl-3.0 | 1,232 |
# Copyright 2017 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... | gunan/tensorflow | tensorflow/python/ops/signal/fft_ops.py | Python | apache-2.0 | 18,047 |
from unittest import TestCase
from mediawords.languages.zh import ChineseLanguage
# noinspection SpellCheckingInspection
class TestChineseLanguage(TestCase):
def setUp(self):
self.__tokenizer = ChineseLanguage()
def test_language_code(self):
assert self.__tokenizer.language_code() == "zh"
... | berkmancenter/mediacloud | apps/common/tests/python/mediawords/languages/test_zh.py | Python | agpl-3.0 | 13,029 |
# Copyright 2014 Objectif Libre
# Copyright 2015 DotHill Systems
#
# 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
#
# U... | bswartz/cinder | cinder/volume/drivers/san/hp/hpmsa_iscsi.py | Python | apache-2.0 | 1,438 |
from ..utils import *
# Injured Blademaster
class CS2_181:
play = Hit(SELF, 4)
# Young Priestess
class EX1_004:
events = OWN_TURN_END.on(Buff(RANDOM_OTHER_FRIENDLY_MINION, "EX1_004e"))
# Alarm-o-Bot
class EX1_006:
events = OWN_TURN_BEGIN.on(Swap(SELF, RANDOM(CONTROLLER_HAND + MINION)))
# Angry Chicken
class ... | liujimj/fireplace | fireplace/cards/classic/neutral_rare.py | Python | agpl-3.0 | 2,580 |
import pygame
import numpy as np
import time
class Robot(object):
def __init__(self, x, y, angle, width, height, filename):
self.x = x
self.y = y
self.angle = angle
self._v = 0.0
self._r = 0.0
self.set_image(filename)
self._width = width
self._heig... | Bjarne-AAU/MonteCarloLocalization | Robot.py | Python | gpl-3.0 | 2,250 |
# This file is part of Libreosteo.
#
# Libreosteo 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.
#
# Libreosteo is distributed in the... | littlejo/Libreosteo | libreosteoweb/api/events/__init__.py | Python | gpl-3.0 | 667 |
#!/usr/bin/python
from os import walk
import re, time, datetime, ConfigParser, sys, os, subprocess, gzip
def print_usage(script):
print 'Usage:', script, '--config <config file>', '--dir <target backup directory>', '--pf <mysql password file>'
sys.exit(1)
def check_location(file, desc):
expandfile = ... | eugenebobkov/sitebackup | bin/mysqlbkp2.py | Python | gpl-3.0 | 6,653 |
# Project imports
import os
import sys
import hashlib
import random
import re
import shutil
import string
import tempfile
import time
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))))
sys.path.insert(0, os.path.abspath(os.path.dirname(o... | jmathai/elodie | elodie/tests/media/base_test.py | Python | apache-2.0 | 3,875 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9c1 on 2015-11-19 13:23
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
import django.utils.crypto
import functools
class Migration(migrations.Migration):
dependencies = [
('reminders_messages', '0004_auto_2... | takeyourmeds/takeyourmeds-web | takeyourmeds/reminders/reminders_messages/migrations/0005_auto_20151119_1323.py | Python | mit | 949 |
#!/usr/bin/env python3
from jsonschema import validate
import json
import sys
schema = json.load(open(sys.argv[1]))
manifest = json.load(open(sys.argv[2]))
validate(instance=manifest, schema=schema)
| HIPERFIT/futhark | tests_lib/c/validatemanifest.py | Python | isc | 202 |
from django.contrib.admin.sites import site
from django.contrib.auth import login as auth_login, logout as auth_logout
from django.core.serializers.json import simplejson as json
from django.forms import ModelForm
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.middleware.csrf import get... | tarequeh/django-remote-admin | src/adminapi/apps/adminapi/views.py | Python | mit | 10,166 |
# Copyright 2017 The Bazel 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 applicable la... | dropbox/bazel | src/test/py/bazel/cc_import_test.py | Python | apache-2.0 | 8,839 |
#!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_dosta_abcdjm_sio
@file mi/dataset/parser/test/test_dosta_abcdjm_sio.py
@author Emily Hahn
@brief An dosta series a,b,c,d,j,m through sio specific dataset agent parser
"""
__author__ = 'Emily Hahn'
__license__ = 'Apache 2.0'
import os
from nose.plugins.at... | oceanobservatories/mi-dataset | mi/dataset/parser/test/test_dosta_abcdjm_sio.py | Python | bsd-2-clause | 5,899 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2018 OSGeo
#
# 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 ... | tomkralidis/geonode | geonode/br/management/commands/backup.py | Python | gpl-3.0 | 24,680 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Blurring
A QGIS plugin
Blurring data
-------------------
begin : 2014-03-11
copyright : (C) 2014 by TER Géom... | Gustry/Blurring | CoreBlurring/LayerIndex.py | Python | gpl-3.0 | 2,440 |
"""MNE sample dataset
"""
from .sample import data_path, has_sample_data, requires_sample_data
| jaeilepp/eggie | mne/datasets/sample/__init__.py | Python | bsd-2-clause | 96 |
import glob
import unittest
test_files = glob.glob('test_*.py')
modules = [ s[:-3] for s in test_files ]
suites = [unittest.defaultTestLoader.loadTestsFromName(s) for s in modules]
testSuite = unittest.TestSuite(suites)
text_runner = unittest.TextTestRunner().run(testSuite)
| doctormo/gtkme | tests/test_all.py | Python | gpl-3.0 | 276 |
#!/usr/bin/env python
from molmod import *
# 0) Load the molecule.
mol = Molecule.from_file("ibuprofen.sdf")
# 1) Print the largest element in the distance matrix.
print("Largest interatomic distance [A]:")
print(mol.distance_matrix.max()/angstrom)
# Some comments:
# - One can just write code that assumes the attri... | molmod/molmod | molmod/examples/001_molecules/d_size.py | Python | gpl-3.0 | 521 |
# coding: utf-8
#
# CLUES Python utils - Utils and General classes that spin off from CLUES
# Copyright (C) 2015 - GRyCAP - Universitat Politecnica de Valencia
#
# 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 Soft... | grycap/cpyutils | config.py | Python | gpl-3.0 | 9,000 |
import ast
from wtforms.fields import Field
def slider_widget(field, ul_class='', **kwargs):
"""widget for rendering a SliderField"""
# THE BELOW IS JUST AN EXAMPLE, NOTHING TO DO WITH SLIDER
kwargs.setdefault('type', 'checkbox')
field_id = kwargs.pop('id', field.id)
html = [u'<ul %s>' % html_par... | dgrtwo/gleam | src/gleam/fields.py | Python | mit | 1,097 |
from django.conf import settings
from menus.exceptions import NamespaceAllreadyRegistered
from django.contrib.sites.models import Site
from django.core.cache import cache
from django.utils.translation import get_language
import copy
def lex_cache_key(key):
"""
Returns the language and site ID a cache key is re... | dibaunaumh/tikal-corp-website | menus/menu_pool.py | Python | bsd-3-clause | 5,979 |
#!/usr/bin/env python3
import argparse
from config import Configure
from config.api import IntranetAPI
from profiling import Context, Profile
verbose = True
if __name__ == "__main__":
conf = Configure()
parser = argparse.ArgumentParser()
parser.add_argument('-o', '--output', type=str)
parser.add_arg... | IniterWorker/epitech-stats-notes | application.py | Python | mit | 1,390 |
# -*- coding: utf-8 -*-
#
# SecureDrop whistleblower submission system
# Copyright (C) 2017 Loic Dachary <loic@dachary.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either versio... | ehartsuyker/securedrop | securedrop/tests/test_i18n.py | Python | agpl-3.0 | 11,053 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | blueburningcoder/nupic | src/nupic/research/monitor_mixin/monitor_mixin_base.py | Python | agpl-3.0 | 7,350 |
import serial
import time, os
import traceback
gpsPort = None
currentSentence = ""
debug = False
def begin():
global gpsPort
#Open serial port
gpsPort = serial.Serial("/dev/ttyS1",9600,timeout=3)
def getSentence(code, timeout):
global gpsPort, debug, currentSentence
startTime = time.time()
... | daveshah1/nova | rover/gps.py | Python | gpl-2.0 | 1,475 |
import unittest
from pyramid import testing
from pytest import fixture
from pytest import mark
class ConfigViewTest(unittest.TestCase):
def call_fut(self, request):
from adhocracy_frontend import config_view
return config_view(request)
def test_with_empty_settings(self):
request = t... | fhartwig/adhocracy3.mercator | src/adhocracy_frontend/adhocracy_frontend/test_init_.py | Python | agpl-3.0 | 4,475 |
# 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... | DailyActie/Surrogate-Model | 01-codes/tensorflow-master/tensorflow/python/ops/common_shapes.py | Python | mit | 15,311 |
# coding: utf-8
from django.db import models
from django_th.models.services import Services
from django_th.models import TriggerService
class Joplin(Services):
"""
joplin model to be adapted for the new service
"""
folder = models.TextField()
trigger = models.ForeignKey(TriggerService, on_del... | foxmask/django-th | th_joplin/models.py | Python | bsd-3-clause | 539 |
# Exe 3
import random
v1 = []
v2 = []
vI = []
c = 0
while c <= 9:
num = random.randint(1,100)
v1.append(num)
vI.append(num)
num = random.randint(1,100)
v2.append(num)
vI.append(num)
c += 1
print("A lista 1 tem os elementos",v1)
print("A lista 2 tem os elementos",v2)
print("E a lista que carrega todos os ele... | M3nin0/supreme-broccoli | _Massanori_Lists/lista_4/exe_3.py | Python | apache-2.0 | 335 |
"""MessageHub producer.
/*
* 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
* ... | dubeejw/openwhisk-package-kafka | action/messageHubProduce.py | Python | apache-2.0 | 8,014 |
#!/usr/bin/env python
#
# 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
# "... | yush1ga/pulsar | docker/scripts/apply-config-from-env.py | Python | apache-2.0 | 1,964 |
from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.PipRequirement import PipRequirement
@linter(executable='vint', output_format='regex',
output_regex=r'.+:(?P<line>\d+):(?P<column>\d+): (?P<message>.+)')
class VintBear:
"""
Check vimscript code for possible ... | IPMITMO/statan | coala-bears/bears/vimscript/VintBear.py | Python | mit | 747 |
import sys
if sys.version_info < (3, 7):
from ._symbolsrc import SymbolsrcValidator
from ._symbol import SymbolValidator
from ._sizesrc import SizesrcValidator
from ._sizeref import SizerefValidator
from ._sizemode import SizemodeValidator
from ._sizemin import SizeminValidator
from ._size ... | plotly/python-api | packages/python/plotly/plotly/validators/splom/marker/__init__.py | Python | mit | 2,113 |
# -*- coding: utf-8 -*-
# Copyright 2010-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:
#
# * Redistributions of source code must retain the above copyright
# notice, this... | kishikawakatsumi/Mozc-for-iOS | src/build_tools/ensure_gyp_module_path.py | Python | apache-2.0 | 2,712 |
#!/usr/bin/python
##########
#
# Shape2Pose scripts library: file management, job scheduling (if running parallel), scikit-learn interfaces
#
##########
import os, string, decimal, glob, re, subprocess, shlex, sys, datetime, time, getpass
###### Job Scheduling ######
maxJobs=500;
usrName = getpass.getuser();
d... | mhsung/structure-completion | python/fas.py | Python | mit | 8,178 |
import os
import requests
import seaborn as sns
import shelve
from operator import itemgetter
import matplotlib.image as mpimg
import praw
from praw.helpers import submissions_between
user = os.environ['REDDIT_USERNAME']
user_agent = 'Calculating % of downvoted submissions 0.1 by /u/{}'
r = praw.Reddit(user_agent)
sub... | eleweek/dataisbeautiful | downvoted_submissions.py | Python | mit | 5,968 |
#
# Copyright 2016 Dohop hf.
#
# 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, ... | dohop/supervisor-logstash-notifier | setup.py | Python | apache-2.0 | 1,635 |
#!/usr/bin/env python
# coding=utf-8
from hooky import List
class MyList(List):
def _before_add(self, key, item):
print('before add, key: {}, item: {}'.format(key, repr(item)))
def _after_add(self, key, item):
print(' after add, key: {}, item: {}'.format(key, repr(item)))
def _before_de... | meng89/hooky | docs/demo2_list.py | Python | mit | 623 |
# encoding: utf-8
import re
import os
import logging
import json
from django.conf import settings
from django import forms
from django.template import Context
from django.forms.widgets import FILE_INPUT_CONTRADICTION, CheckboxInput, FileInput
from django.utils.encoding import force_unicode
from django.template.loader... | dalou/django-extended | django_extended/forms/media.py | Python | bsd-3-clause | 5,738 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import arrow
from marshmallow_jsonapi import fields
from woodbox.jsonapi_schema import JSONAPISchema
class DocumentSchema(JSONAPISchema):
document_type = fields.String()
title = fields.String()
body = fields... | patrickfournier/woodbox_example | app/api_v1/document.py | Python | apache-2.0 | 483 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013-15, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditi... | jaredweiss/nupic | nupic/regions/RecordSensor.py | Python | gpl-3.0 | 18,730 |
import torch
import torch.nn as nn
import os
import numpy as np
import torchvision
from torch.utils.data import DataLoader
import torchvision.transforms as transforms
import ray
from ray import tune
from ray.tune.schedulers import create_scheduler
from ray.tune.integration.horovod import (DistributedTrainableCreator,... | pcmoritz/ray-1 | release/horovod_tests/workloads/horovod_test.py | Python | apache-2.0 | 4,752 |
# Copyright 2016 Stanislav Krotov <https://it-projects.info/team/ufaks>
# Copyright 2016 manawi <https://github.com/manawi>
# Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License MIT (https://opensource.org/licenses/MIT).
from odoo import api, fields, models
class PosConfig(mod... | it-projects-llc/pos-addons | pos_product_available_negative/models.py | Python | mit | 1,555 |
# Copyright 2011 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.apache.org/licenses/LICENSE-2.0
#
# Unless req... | citrix-openstack-build/neutron-fwaas | neutron_fwaas/openstack/common/lockutils.py | Python | apache-2.0 | 10,316 |
import os
import sys
import csv
import gzip
import pickle
import numpy as np
from ..density import ProbDensityHistogram
class ProbAbsoluteReflectance(object):
""" Implements the absolute reflectance term p(R_x). """
def __init__(self, params):
self.params = params
self._load()
def cost... | tinghuiz/learn-reflectance | bell2014/energy/prob_abs_r.py | Python | mit | 4,912 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; ... | rubenspgcavalcante/pygameoflife | controllers/cpuspinner_controller.py | Python | gpl-3.0 | 1,197 |
"""vlan_pool PK to bigint
Revision ID: e06576b2ea9e
Revises: 9089fa811a2b
Create Date: 2017-07-21 16:34:50.005560
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e06576b2ea9e'
down_revision = None
branch_labels = ('hil.ext.network_allocators.vlan_pool',)
# p... | SahilTikale/haas | hil/ext/network_allocators/migrations/vlan_pool/e06576b2ea9e_vlan_pool_pk_to_bigint.py | Python | apache-2.0 | 631 |
from ppillar import PublicPillar
from contextlib import contextmanager
import os
import shutil
import stat
import tempfile
import unittest
import yaml
try:
from unittest import skipIf
except ImportError:
# Python 2.6
from unittest2 import skipIf
@contextmanager
def ignored(*exceptions):
try:
... | thusoy/public-pillar | test_ppillar.py | Python | mit | 4,849 |
from __future__ import division
import numpy as np
import scipy.sparse as sp
from scipy.constants import epsilon_0
from ...utils.code_utils import deprecate_class
from ...fields import TimeFields
from ...utils import mkvc, sdiag, Zero
from ..utils import omega
class FieldsTDEM(TimeFields):
"""
Fancy Field S... | simpeg/simpeg | SimPEG/electromagnetics/time_domain/fields.py | Python | mit | 24,177 |
"""Commands: "@[botname] XXXXX"."""
import logging
import random
from abc import ABC
from twisted.internet import reactor
from bot.commands.abstract.command import Command
from bot.utilities.permission import Permission
class Speech(Command, ABC):
"""Natural language."""
perm = Permission.User
reloadab... | NMisko/monkalot | bot/commands/abstract/speech.py | Python | mit | 2,100 |
# -*- coding: utf-8 -*-
"""hipnotify"""
from .hipnotify import Room
__author__ = 'Akira Chiku'
__email__ = 'akira.chiku@gmail.com'
__version__ = '1.0.9'
__all__ = [
'Room'
]
| achiku/hipnotify | hipnotify/__init__.py | Python | isc | 181 |
'''
'funcassociateinfo.py' sets up the command line arguments for the
'genecentric-fainfo' program.
'''
import sys
import bpm
import argparse
parser = argparse.ArgumentParser(
description='Query Funcassociate for information to use with \'go-enrich\'',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)... | BurntSushi/genecentric | bpm/cmdargs/funcassociateinfo.py | Python | gpl-2.0 | 1,332 |
from ConfigParser import ConfigParser
config = ConfigParser()
config.read('spacephone.conf')
| SpacePhone/spacephone.org-python | spacephone/config.py | Python | gpl-2.0 | 94 |
from django.db.transaction import non_atomic_requests
from django.utils.translation import (
ugettext as _, ugettext_lazy as _lazy, pgettext_lazy)
import jingo
import jinja2
from olympia import amo
from olympia.amo.helpers import urlparams
from olympia.amo.urlresolvers import reverse
from olympia.amo.utils import... | Prashant-Surya/addons-server | src/olympia/addons/buttons.py | Python | bsd-3-clause | 9,043 |
# Copyright 2018 The Oppia 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 applicable ... | oppia/oppia | core/domain/skill_services_test.py | Python | apache-2.0 | 69,501 |
# This deliberately raises an exception, because we do not expect it to be
# loaded in the unit test - yaml_packages/versioned/2.0 will take precedence.
raise Exception("This package.py should never be loaded")
# Copyright 2013-2016 Allan Johns.
#
# This library is free software: you can redistribute it and/or
# modi... | cwmartin/rez | src/rez/tests/data/packages/py_packages/versioned/2.0/package.py | Python | lgpl-3.0 | 905 |
test_records = [
[{
"doctype": "Item Group",
"item_group_name": "_Test Item Group",
"parent_item_group": "All Item Groups",
"is_group": "No"
}],
[{
"doctype": "Item Group",
"item_group_name": "_Test Item Group Desktops",
"parent_item_group": "All Item Groups",
"is_group": "No"
}],
] | gangadhar-kadam/mtn-erpnext | setup/doctype/item_group/test_item_group.py | Python | agpl-3.0 | 303 |
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import ImproperlyConfigured
import commonware.log
from rest_framework.permissions import BasePermission, SAFE_METHODS
from access import acl
log = commonware.log.getLogger('mkt.collections')
class CuratorAuthorization(BasePermission):... | jinankjain/zamboni | mkt/collections/authorization.py | Python | bsd-3-clause | 3,647 |
import pandas as pd
from pandas.io import gbq
def test_sepsis3_one_row_per_stay_id(dataset, project_id):
"""Verifies one stay_id per row of sepsis-3"""
query = f"""
SELECT
COUNT(*) AS n
FROM
(
SELECT stay_id FROM {dataset}.sepsis3 GROUP BY 1 HAVING COUNT(*) > 1
) s
"""
... | MIT-LCP/mimic-code | mimic-iv/tests/test_sepsis.py | Python | mit | 481 |
# TO DO
# Crashes sometimes?
# In Autoplay, input can't tell if what's entered is a number and could crash
# Add Saving
# Add Play Again?
# Import random
from random import *
from york_graphics import *
from math import *
import time
from logic_module import *
# ------------------------------------ Main ------------... | Georgeleeh/2048-Clone | Main.py | Python | mit | 2,109 |
import sqlalchemy as sql
def upgrade(migrate_engine):
meta = sql.MetaData()
meta.bind = migrate_engine
token = sql.Table('token', meta, autoload=True)
idx = sql.Index('ix_token_expires', token.c.expires)
idx.create(migrate_engine)
def downgrade(migrate_engine):
meta = sql.MetaData()
meta... | kwss/keystone | keystone/common/sql/migrate_repo/versions/024_add_index_to_expires.py | Python | apache-2.0 | 481 |
from django.conf.urls import url
from backstage.email.views import EmailCreateView, EmailUpdateView, EmailAddRecipient, EmailDeleteRecipient, \
EmailPreview, EmailSend, EmailRecipientErrorReport
from backstage.email.views import EmailList
from .account.views import AccountList, AccountPrivilegeSwitch, AccountPasswor... | ultmaster/eoj3 | backstage/urls.py | Python | mit | 5,245 |
#!/usr/bin/env python2.7
# encoding: utf-8
"""Fastavro decoding benchmark."""
from io import BytesIO
from itertools import repeat
from time import time
from fastavro import dump, load, acquaint_schema, reader as avro_reader
import sys
LOOPS = 2
with open(sys.argv[1]) as reader:
records = avro_reader(reader)
SC... | mtth/avsc | etc/benchmarks/avro-serialization-implementations/scripts/decode/python-fastavro.py | Python | mit | 614 |
"""
Copyright (c) 2012-2020 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | phillxnet/rockstor-core | src/rockstor/storageadmin/models/scrub.py | Python | gpl-3.0 | 2,153 |
'''
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
'''
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# ... | wufangjie/leetcode | 104. Maximum Depth of Binary Tree.py | Python | gpl-3.0 | 590 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.