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 |
|---|---|---|---|---|---|
"""Treadmill rest auth module."""
from __future__ import absolute_import
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
| toenuff/treadmill | lib/python/treadmill/rest/auth/__init__.py | Python | apache-2.0 | 142 |
import sys
import csv
import re
import configparser
from collections import defaultdict
def validate(func):
def read_config(config_path):
config = configparser.ConfigParser()
config.read(config_path)
return config
def get_reqs_dict(config_path):
config = read_config(config_p... | ctsit/nacculator | nacc/uds3/filters.py | Python | bsd-2-clause | 12,501 |
# Copyright 2016 Red Hat, Inc. All Rights Reserved.
# Licensed to GPL under a Contributor Agreement.
"""Export libc functions that operate Linux namespaces."""
import os
if os.uname()[0] != "Linux":
raise ImportError("only support Linux platform")
import sys
import re
import json
from .exceptions import *
... | vfreex/procszoo | procszoo/namespaces/__init__.py | Python | gpl-3.0 | 4,413 |
# Copyright 2015 The Shaderc 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... | MasonLeeBack/PolyEngine | thirdparty/vulkan/shaderc/glslc/test/stdin_out.py | Python | mit | 1,333 |
#!/usr/bin/env python3
# Script that parses BBS kernel log for timing information
#
# For the moment this script only works on individual MS files and does collect
# the information through gds and ssh
#
#
# File: BBStiming.py
# Author: Sven Duscha (duscha@astron.nl)
# Date: 2011-03-08
# La... | kernsuite-debian/lofar | CEP/Calibration/BBSTools/scripts/BBStiming.py | Python | gpl-3.0 | 38,490 |
"""
Taxi simulator
Sample run with two cars, random seed 10. This is a valid doctest.
>>> main(num_taxis=2, seed=10)
taxi: 0 Event(time=0, proc=0, action='leave garage')
taxi: 0 Event(time=4, proc=0, action='pick up passenger')
taxi: 1 Event(time=5, proc=1, action='leave garage')
taxi: 1 ... | xu6148152/Binea_Python_Project | FluentPython/coroutine/taxi_sim0.py | Python | mit | 10,112 |
import datastore
import math
#---------------------------------------------------------------------------------------------------
# Header files
#include "MadgwickAHRS.h"
#include <math.h>
#---------------------------------------------------------------------------------------------------
# Definitions
degtorad = 0.... | Arcturus314/cansat2017 | CanSat/MadgwickAHRS.py | Python | gpl-3.0 | 9,897 |
# -*- coding: utf-8 -*-
"""
USED with package_mac.sh
Role : Parameters for generation of calcal Software on Mac with py2app
This is a setup.py script is generated by py2applet
Ref : doc/packaging.txt
py2applet --make-setup --force-system-tk --report-missing-from-imports \
Calcal.py --iconfile resources/images/logo_cal... | Thierry46/CalcAl | setup.py | Python | gpl-3.0 | 2,481 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#important: before running this demo, make certain that you import the library
#'paho.mqtt.client' into python (https://pypi.python.org/pypi/paho-mqtt)
#also make certain that ATT_IOT is in the same directory as this script.
import traceback ... | ATT-JBO/RPICameraRemote | RPICamera/RPICamera/RPICameraRemote.py | Python | mit | 7,821 |
"""
Continuous Random Variables - Prebuilt variables
Contains
========
Arcsin
Benini
Beta
BetaPrime
Cauchy
Chi
ChiNoncentral
ChiSquared
Dagum
Erlang
Exponential
FDistribution
FisherZ
Frechet
Gamma
GammaInverse
Kumaraswamy
Laplace
Logistic
LogNormal
Maxwell
Nakagami
Normal
Pareto
QuadraticU
RaisedCosine
Rayleigh
Studen... | dennisss/sympy | sympy/stats/crv_types.py | Python | bsd-3-clause | 60,690 |
"""
バブルソート
"""
def main():
n = int(raw_input().strip())
data = map(int, raw_input().split())
change = bubble_sort(n, data)
print " ".join([str(x) for x in data])
print change
def bubble_sort(n, data):
change = 0
for i in xrange(n):
for j in xrange(n - 1, i, -1):
if dat... | curryudon08/aoj | Lesson/ALDS1/ALDS1_2_A.py | Python | unlicense | 499 |
import decapsulation
import encapsulation
import packet_processing
import post_processing
| mwrlabs/veripy | contrib/rfc2473/tn_4in6/__init__.py | Python | gpl-3.0 | 91 |
"""Provides functions that are used when apps are finished."""
from __future__ import absolute_import
import errno
import glob
import importlib
import logging
import os
import shutil
import signal
import socket
import subprocess
import tarfile
import yaml
import kazoo
from .. import appevents
from .. import appmgr
... | toenuff/treadmill | lib/python/treadmill/appmgr/finish.py | Python | apache-2.0 | 16,515 |
#!/usr/bin/python
# Copyright 2016 Red Hat | Ansible
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['previe... | 2ndQuadrant/ansible | lib/ansible/modules/cloud/docker/docker_swarm.py | Python | gpl-3.0 | 25,412 |
# This file is part of Fedora Community.
# Copyright (C) 2008-2010 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) ... | Fale/fedora-packages | fedoracommunity/widgets/quicklinks.py | Python | agpl-3.0 | 2,554 |
'''
1. Faça um Programa que peça os três lados de um triângulo. O programa deverá
informar se os valores podem ser um triângulo. Indique, caso os lados formem um
triângulo, se o mesmo é: equilátero, isósceles ou escaleno.
'''
a = int(input('Informe o valor do lado A do triangulo: '))
b = int(input('Informe o valor do ... | judarlima/Python-Para-Zumbis | Lista 2/questao01.py | Python | mit | 835 |
# Copyright 2014 Mirantis, 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 ... | andrei4ka/fuel-web-redhat | fuelclient/fuelclient/cli/actions/__init__.py | Python | apache-2.0 | 2,207 |
# Author: Jason Lu
def test():
print("debug") | jinzekid/codehub | python/day4/Atm/debug/test.py | Python | gpl-3.0 | 50 |
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from ems.qt4.util import variant_to_pyobject
from ems.qt4.gui.widgets.graphical import ColorButton #@UnresolvedImport
from ems.qt4.gui.itemdelegate.iconview import IconViewDelegate #@UnresolvedImport
from ems.qt4.gui.itemview.iconnavigation import IconNavigationView... | mtils/ems | ems/qt4/gui/itemview/iconnavigation_widget.py | Python | mit | 3,171 |
# -*- coding_ utf-8 -*-
from pybrain.structure import TanhLayer
from pybrain.tools.shortcuts import buildNetwork
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import BackpropTrainer
if __name__ == '__main__':
ds = SupervisedDataSet(1, 1)
# Add data samples
ds.addSample(... | myth/trashcan | tdt4137/ex03/feedforward.py | Python | gpl-2.0 | 1,217 |
"""
Cart-pole balancing with iFDD+
"""
import sys
import os
from rlpy.Domains import InfCartPoleBalance
from rlpy.Agents import Greedy_GQ, SARSA, Q_Learning
from rlpy.Representations import *
from rlpy.Policies import eGreedy
from rlpy.Experiments import Experiment
import numpy as np
from hyperopt import hp
param_spa... | imanolarrieta/RL | examples/cartpole2d/q-ifdd.py | Python | bsd-3-clause | 2,112 |
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select, WebDriverWait
from .utils import TEST_URL, register_valid_user
class TestWorkout:
def test_user_can_add_workout_without_gpx(self, selenium):
register_valid_user(selenium)
app_menu = ... | SamR1/FitTrackee | e2e/test_workouts.py | Python | agpl-3.0 | 1,814 |
# Bob build tool
# Copyright (C) 2016 Jan Klötzke
#
# SPDX-License-Identifier: GPL-3.0-or-later
from ..errors import BuildError
from ..stringparser import IfExpression
from ..utils import joinLines, check_output
from .scm import Scm, ScmAudit, ScmTaint, ScmStatus
from shlex import quote
from textwrap import indent
im... | BobBuildTool/bob | pym/bob/scm/svn.py | Python | gpl-3.0 | 7,727 |
"""
Better Figures & Images
------------------------
This plugin:
- Adds a style="width: ???px; height: auto;" to each image in the content
- Also adds the width of the contained image to any parent div.figures.
- If RESPONSIVE_IMAGES == True, also adds style="max-width: 100%;"
- Corrects alt text: if alt == imag... | grupydf/grupybr-template | {{cookiecutter.repo_name}}/.plugins/better_figures_and_images/better_figures_and_images.py | Python | gpl-3.0 | 2,904 |
'''
tasks.py: Tasks for the Docker API
Copyright (c) 2017, Vanessa Sochat. All rights reserved.
'''
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
sys.path.append('..')
from sutils import (
add_http,
get_cache,
create_tar,
change_tar... | Trophime/singularity | libexec/python/docker/tasks.py | Python | bsd-3-clause | 8,998 |
import django.dispatch
announcement_created = django.dispatch.Signal(providing_args=["announcement", "request"])
announcement_updated = django.dispatch.Signal(providing_args=["announcement", "request"])
announcement_deleted = django.dispatch.Signal(providing_args=["announcement", "request"])
| arthur-wsw/pinax-announcements | pinax/announcements/signals.py | Python | mit | 295 |
# (c) 2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2018, Ansible Project
#
# This file is part of Ansible
#
# Ansible 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, o... | privateip/ansible | lib/ansible/plugins/cache/__init__.py | Python | gpl-3.0 | 12,205 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', ... | nikhilkalige/flask-nsq | setup.py | Python | mit | 1,351 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
##===-----------------------------------------------------------------------------*- Python -*-===##
##
## S E R I A L B O X
##
## This file is distributed under terms of BSD license.
## See LICENSE.txt for more information.
##
##===----------... | havogt/serialbox2 | examples/python/example-04-savepoints.py | Python | bsd-2-clause | 5,119 |
from cloudmesh.config.cm_config import get_mongo_db, get_mongo_dbname_from_collection, DBConnFactory
from pprint import pprint
import re
from cloudmesh.management.project import CLUSTERS as ProjectCLUSTERS, \
PROVISIONING as ProjectPROVISIONING, Project as MongoProject, Projects, \
SERVICES as ProjectSERVICES, ... | rajpushkar83/cloudmesh | cloudmesh_web/modules/management.py | Python | apache-2.0 | 29,460 |
import json
f = open('US.txt')
lines = f.readlines()
countyArray = []
for l in lines:
l = l.split('\t')
countyArray.append({'name': l[2], 'state': l[4], 'countyName': l[5], 'countyCode': l[6]})
f = open('population.txt')
countyPop = {}
lines = f.readlines()
for l in lines:
l = l.split(',')
countyPop[l[0]] = l[1]
... | Big-Boy/whitehouse-petitions | formatUS.py | Python | mit | 2,025 |
from wtforms import IntegerField, SelectMultipleField
from wtforms.validators import NumberRange
from dmutils.forms import DmForm
import flask_featureflags
class BriefSearchForm(DmForm):
page = IntegerField(default=1, validators=(NumberRange(min=1),))
status = SelectMultipleField("Status", choices=(
(... | AusDTO/dto-digitalmarketplace-buyer-frontend | app/main/forms/brief_forms.py | Python | mit | 3,546 |
"""celebi 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... | liuzheng712/Celebi | celebi/celebi/urls.py | Python | mit | 1,675 |
import difflib, re
from pymongo.objectid import ObjectId
class CollectionDoc(object):
def __init__(self, db, docs, find_links=True):
self._db = db
self._collection_names = db.collection_names()
self._docs = docs
self._find_links = find_links
@property
def text(self):
... | cswank/mongodoc | mongodoc/collection_doc.py | Python | mit | 3,438 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | samedder/azure-cli | src/azure-cli-core/azure/cli/core/tests/test_cloud.py | Python | mit | 10,518 |
from django.db import models
from django.core.mail import EmailMessage
from django.template import loader, Context
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.template import Template
from django.core.urlresolvers import reverse
from django.utils.translation impo... | lasarux/PollXpress | apps/poll/models.py | Python | agpl-3.0 | 7,794 |
def _lsbStrToInt(str):
return ord(str[0]) + (ord(str[1]) << 8) + (ord(str[2]) << 16) + (ord(str[3]) << 24)
| mancoast/pycdc | tests/22_test_expressions.ref.py | Python | gpl-3.0 | 119 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CSchoolSite.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that ... | CSchool/SchoolSite | CSchoolSite/manage.py | Python | apache-2.0 | 809 |
# Copyright 2013 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 conditions and t... | vasiliykochergin/euca2ools | euca2ools/commands/autoscaling/createautoscalinggroup.py | Python | bsd-2-clause | 4,473 |
#!/usr/bin/env python2
# coding=utf-8
#
# Copyright 2014 Sascha Schirra
#
# This file is part of Ropper.
#
# Ropper 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 you... | idl3r/Ropper | ropperapp/loaders/pe_intern/__init__.py | Python | gpl-2.0 | 729 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | mattpap/sympy-polys | sympy/thirdparty/pyglet/pyglet/window/win32/types.py | Python | bsd-3-clause | 6,270 |
from mitmproxy.utils import emoji
from mitmproxy.tools.console.common import SYMBOL_MARK
def test_emoji():
assert emoji.emoji[":default:"] == SYMBOL_MARK
| mitmproxy/mitmproxy | test/mitmproxy/utils/test_emoji.py | Python | mit | 160 |
"""The CardConnectionDecorator is a Decorator around the CardConnection
abstract class, and allows dynamic addition of features to the
CardConnection, e.g. implementing a secure channel..
__author__ = "http://www.gemalto.com"
Copyright 2001-2010 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.co... | 12019/pyscard | smartcard/CardConnectionDecorator.py | Python | lgpl-2.1 | 3,082 |
import unittest
import numpy as np
import vtk
from vtk.util import numpy_support
from pymicro.crystal.lattice import Lattice
from pymicro.crystal.microstructure import Orientation
from pymicro.view.vtk_utils import lattice_grid, lattice_edges, apply_orientation_to_actor
class VtkUtilsTests(unittest.TestCase):
def... | heprom/pymicro | pymicro/view/tests/test_vtk_numpy_array.py | Python | mit | 1,827 |
#!/usr/bin/env python
#
# Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U
#
# This file is part of IoT orchestrator
#
# IoT orchestrator 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, eith... | telefonicaid/orchestrator | src/orchestrator/commands/createNewService.py | Python | agpl-3.0 | 5,528 |
from __future__ import with_statement
import collections
import gzip
import logging
import socket
from tornado.ioloop import IOLoop
from tornado.simple_httpclient import SimpleAsyncHTTPClient, _DEFAULT_CA_CERTS
from tornado.test.httpclient_test import HTTPClientCommonTestCase, ChunkHandler, CountdownHandler, HelloWor... | jordoncm/ft2json | tornado/test/simple_httpclient_test.py | Python | apache-2.0 | 7,246 |
from core import RedisCtl
from bpbase import Blueprint
__all__ = ['RedisCtl', 'Blueprint']
| HunanTV/redis-ctl | app/__init__.py | Python | mit | 92 |
from django import forms, template
from django.forms.formsets import all_valid
from django.forms.models import modelform_factory, inlineformset_factory
from django.forms.models import BaseInlineFormset
from django.contrib.contenttypes.models import ContentType
from django.contrib.admin import widgets
from django.contri... | marcydoty/geraldo | site/newsite/django_1_0/django/contrib/admin/options.py | Python | lgpl-3.0 | 35,888 |
from .pdfcell import PDFCell
class PDFRow(object):
def __init__(self, parent, row_index, num_cols, textcursor, bordercursor):
self.parent = parent
self.row_index = row_index
self.num_cols = num_cols
self.text_cursor = textcursor
self.border_cursor = bordercursor
sel... | katerina7479/pypdflite | pypdflite/pdfobjects/pdfrow.py | Python | mit | 1,452 |
# -*- coding: utf-8 -*-
#
# Python Developer's Guide documentation build configuration file, created by
# sphinx-quickstart on Tue Jan 4 10:34:03 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenera... | jython/devguide | conf.py | Python | cc0-1.0 | 7,653 |
r"""
Cython wrapper for the Parma Polyhedra Library (PPL)
The Parma Polyhedra Library (PPL) is a library for polyhedral computations over
the rationals. This interface tries to reproduce the C++ API as faithfully as possible
in Python. For example, the following C++ excerpt:
.. code-block:: c++
Variable x(0);
... | vinklein/pplpy | ppl/__init__.py | Python | gpl-3.0 | 5,010 |
from django.http import HttpResponse
from contamination.models import DVS
from contamination.models import Substance
from contamination.models import K7
from contamination.models import K4
from contamination.models import SpeedOfTransfer
from contamination.models import DepthZone
from contamination.models import Wind
... | maxshell/envcontamination | contamination/initializer.py | Python | mit | 3,149 |
# number of convolutional filters to use
NUMBER_OF_FILTERS = 32
# size of pooling area for max pooling
POOLING_SIZE = (2, 2)
# convolution kernel size
KERNEL_SIZE = (3, 3)
IMG_ROWS = 28
IMG_COLS = 28
BATCH_SIZE = 32
NUMBER_OF_EPOCHS = 15
NUMBER_OF_CLASSES = 10
| vishsangale/deep-learning | mnist/Config.py | Python | gpl-3.0 | 262 |
# Import our modules.
import numpy as np
import matplotlib.pyplot as plt
import seaborn
# Import our custom module
import pboc_utils as pboc
# Define the parameter values.
k = 5 # rate in 1 / s
dt = 1 / 50 # time step in seconds
# Set up the array for the probabilities.
num_boxes = 100
time_points = 100
prob = np... | RPGroup-PBoC/gist_pboc_2017 | code/inclass/master_equation_diffusion_in_class.py | Python | mit | 1,518 |
# 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... | citrix-openstack-build/tempest | tempest/api/compute/test_live_block_migration.py | Python | apache-2.0 | 6,686 |
##############################################################################
# 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... | skosukhin/spack | var/spack/repos/builtin/packages/wxpropgrid/package.py | Python | lgpl-2.1 | 1,938 |
#/usr/bin/python
class MOTOR_STATE:
"""
Motor states, to be added to AbstractMotor definition when the web-
application is in a more mature state.
"""
NOTINITIALIZED = "NOTINITIALIZED"
UNUSABLE = "UNUSABLE"
READY = "READY"
MOVESTARTED = "MOVESTARTED"
MOVING = "MOVING"
ONLIMIT =... | mguijarr/mxcube3 | mxcube3/ho_mediators/statedefs.py | Python | gpl-2.0 | 895 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | Jenselme/AutobahnPython | examples/asyncio/wamp/rpc/progress/backend.py | Python | mit | 2,167 |
# Copyright (C) 2011-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman 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 you... | adam-iris/mailman | src/mailman/app/tests/test_moderation.py | Python | gpl-3.0 | 6,858 |
#!/usr/bin/env python3
# Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.
# Basically, the deletion can be divided into two stages:
# Search for a node to remove.
# If the node is found, delete the node.
# Not... | eroicaleo/LearningPython | interview/leet/450_Delete_Node_in_a_BST.py | Python | mit | 2,059 |
from pylab import *
data = loadtxt('Data/dummy_data.dat')
posterior_sample = atleast_2d(loadtxt('posterior_sample.txt'))
ion()
for i in xrange(0, posterior_sample.shape[0]):
hold(False)
plot(data[:,0], data[:,1], 'bo')
hold(True)
plot(data[:,0], posterior_sample[i, -data.shape[0]:], 'r-')
ylim([0, 1.1*data[... | jchiang87/TimeBombs | display.py | Python | gpl-3.0 | 548 |
from django_nose.tools import assert_equal, assert_false, assert_is_none, assert_true
from pontoon.base.tests import ProjectFactory, RepositoryFactory, TestCase
from pontoon.base.utils import aware_datetime
from pontoon.sync.models import ProjectSyncLog
from pontoon.sync.tests import (
ProjectSyncLogFactory,
R... | participedia/pontoon | pontoon/sync/tests/test_models.py | Python | bsd-3-clause | 6,478 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Pyramidal bidirectional LSTM encoder."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
class PyramidBLSTMEncoder(object):
"""Pyramidal bidirectional LSTM Encoder.
Args:
... | hirofumi0810/tensorflow_end2end_speech_recognition | models/encoders/core/pyramidal_blstm.py | Python | mit | 7,080 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# (c) Copyright 2013 Hewlett-Pa... | cloudbase/nova-virtualbox | nova/virt/libvirt/driver.py | Python | apache-2.0 | 294,445 |
''' -- imports from python libraries -- '''
# import os -- Keep such imports here
import json
''' -- imports from installed packages -- '''
from django.shortcuts import render_to_response # , render
from django.template import RequestContext
from django.http import Http404
try:
from bson import ObjectId
except I... | AvadootNachankar/gstudio | gnowsys-ndf/gnowsys_ndf/ndf/views/dev_utils.py | Python | agpl-3.0 | 1,145 |
from django.views import generic
from .models import Page, ExtraContent
class IndexView(generic.ListView):
"""
List of pages
"""
model = Page
class PageDetailView(generic.DetailView):
"""
The page
"""
model = Page
def get_object(self, queryset=None):
"""
Get pag... | KlubJagiellonski/Politikon | cms/views.py | Python | gpl-2.0 | 691 |
# -*- test-case-name: txdav.common.datastore.upgrade.sql.test -*-
##
# Copyright (c) 2010-2017 Apple 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.a... | macosforge/ccs-calendarserver | txdav/common/datastore/upgrade/sql/upgrade.py | Python | apache-2.0 | 17,509 |
from xbmcswift2 import Plugin, xbmcgui
from resources.lib import cook
import pyxbmct.addonwindow as pyxbmct
plugin = Plugin()
SITE_URL = 'http://www.taste.com.au/'
@plugin.route('/')
def main_menu():
""" main menu """
item = [
{
'label': plugin.get_string(30000),
'path': plu... | DamonToumbourou/plugin.image.cook | addon.py | Python | mit | 9,778 |
from __future__ import absolute_import, division, print_function
import os
from idaskins import UI_DIR
from PyQt5 import uic
from PyQt5.Qt import qApp
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QCursor, QFont, QKeySequence
from PyQt5.QtWidgets import QShortcut, QWidget
Ui_ObjectInspector, ObjectInspectorBas... | zyantific/IDASkins | plugins/idaskins/objectinspector.py | Python | mit | 2,576 |
# Copyright (c) 2017 AT&T Intellectual Property. 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
#
... | stackArmor/security_monkey | security_monkey/tests/watchers/openstack/network/test_security_group.py | Python | apache-2.0 | 1,603 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | seankelly/buildbot | worker/buildbot_worker/commands/transfer.py | Python | gpl-2.0 | 12,909 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2012-2013 2Vive. All Rights Reserved.
# Author: Wang Zhenzhen <nifabric@gmail.com>
#
##############################################################... | wangeek/py_report_kit | run.py | Python | bsd-2-clause | 3,291 |
__author__ = 'purg'
| anguoyang/SMQTK | MASIR/python/masir/utils/__init__.py | Python | bsd-3-clause | 20 |
# encoding: utf-8
# 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.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY;... | luisza/dfva | src/institution/urls.py | Python | gpl-3.0 | 2,562 |
# coding: utf-8
import sys
from setuptools import setup, find_packages
NAME = "swagger_server"
VERSION = "1.0.0"
# To install the library, run the following
#
# python setup.py install
#
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools
REQUIRES = ["connexion"]
setup(
name=NAME,
version=V... | EarthLifeConsortium/elc_api | setup.py | Python | apache-2.0 | 709 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from flask import json
from flask import g
from os.path import abspath
from os.path import dirname
from os.path import join
from ggrc.app import app
from integration import ggrc
THIS_ABS_PATH = abspath(di... | edofic/ggrc-core | test/integration/ggrc/converters/__init__.py | Python | apache-2.0 | 1,471 |
import struct, random, socket
class Tile:
def __init__(self, stringData ): # floorType, direction, laserNums, laserDir):
line = stringData.split(",")
self.floorType = int(line[0])
self.direction = int(line[1])
self.laserNums = int(line[2])
self.laserDir = int(line[3])
walls = list(line[4])
out = []
f... | NathanMer/RoboRally | src/serverHelpers.py | Python | gpl-2.0 | 6,204 |
# -*- coding: utf-8 -*-
""" This module provides template tags for handeling plugins
"""
from django.conf import settings as djangosettings
from django import template
from django.urls import reverse
from common.models import InvenTreeSetting
from plugin import registry
register = template.Library()
@register.sim... | inventree/InvenTree | InvenTree/plugin/templatetags/plugin_extras.py | Python | mit | 1,634 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Small, simple and powerful template-engine for python.
This is a template-engine for python, which is very simple, easy to use,
small, fast, powerful and pythonic.
See documentation for a list of features, template-syntax etc.
:Version: 0.1.4 (2008-12-21)
:Status: ... | tlangerak/Multi-Agent-Systems | spade/pyratemp.py | Python | lgpl-2.1 | 41,649 |
import numpy as np
import dnest4.builder as bd
data = {"x": np.array([1.0, 2.0, 3.0, 4.0, 5.0]),\
"y": np.array([1.0, 2.0, 3.0, 3.9, 5.1]),\
"N": 5}
# Create the model
model = bd.Model()
# Slope and intercept
model.add_node(bd.Node("m", bd.Uniform(-100.0, 100.0)))
model.add_node(bd.Node("b", bd.Unifo... | eggplantbren/DNest4 | code/Templates/Builder/for_blog.py | Python | mit | 854 |
# ----------------------------------------------------------------------------
# Copyright (c) 2017-, LabControl development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -------------------------------------------------... | jdereus/labman | labcontrol/gui/handlers/process_handlers/test/test_gdna_extraction_process.py | Python | bsd-3-clause | 2,304 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Jérémie DECOCK (http://www.jdhp.org)
"""
Animation
Makes an animation and save it in a file
See:
- https://matplotlib.org/api/animation_api.html
- http://matplotlib.org/gallery/animation/basic_example_writer_sgskip.html
- http://matplotlib.org/exam... | jeremiedecock/snippets | python/matplotlib/animation_to_gif_file.py | Python | mit | 1,521 |
# 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... | nathanbjenx/cairis | cairis/daemon/main/errors.py | Python | apache-2.0 | 2,558 |
__author__ = 'chad'
| chadelofson/vbs2py3 | vbs2py3.py | Python | gpl-3.0 | 20 |
# Copyright (c) 2018 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
US Counties
===========
Demonstrate how to plot US counties at all three available resolutions.
"""
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from metpy.plots ... | metpy/MetPy | v1.1/_downloads/37fc469596f0b44f565b299efd380e76/US_Counties.py | Python | bsd-3-clause | 824 |
import sys
import os
import random
import tornado.gen
sys.path.insert(0,
os.path.dirname(
os.path.dirname(os.path.abspath(__file__))
)
)
from models.user.model import Tag
@tornado.gen.coroutine
def init_tag():
tb_tag = Tag()
for i in range(10):
result = yield tb_tag.insert({'name':... | wecatch/app-turbo | demos/script/init.py | Python | apache-2.0 | 479 |
#!/usr/bin/python
# nohup ./ReplayManager.py --mwpccal_sim < /dev/null > scriptlog.txt 2>&1 &
# nohup ./ReplayManager.py -s --rmin=20515 --rmax=20527 < /dev/null > scriptlog.txt 2>&1 &
# nohup ./ReplayManager.py -o --rmin=46 < /dev/null > scriptlog.txt 2>&1 &
# nohup ./ReplayManager.py -x --rmin=19873 --rmax=19898 --n... | UCNA/main | Scripts/launchers/ReplayManager.py | Python | gpl-3.0 | 5,719 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# publish-patches.py - publish patches for the given distribution
#
# Copyright © 2008 Canonical Ltd.
# Author: Scott James Remnant <scott@ubuntu.com>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of version 3 of the GNU Gene... | dbnicholson/merge-our-misc | publish_patches.py | Python | gpl-3.0 | 4,618 |
# -*- coding: utf-8 -*-
from flask_wtf import FlaskForm
from wtforms import IntegerField, StringField, HiddenField, TextAreaField
from wtforms.validators import NumberRange, InputRequired, EqualTo
class IntervalForm(FlaskForm):
hidden_pid = HiddenField('Hidden ID')
tem_interval = IntegerField('Temperature', ... | iascchen/eggduino-station | app/forms.py | Python | apache-2.0 | 2,823 |
"""
Support for interfacing with Russound via RNET Protocol.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.russound_rnet/
"""
import logging
import voluptuous as vol
from homeassistant.components.media_player import (
SUPPORT_TURN_OFF... | xifle/home-assistant | homeassistant/components/media_player/russound_rnet.py | Python | mit | 3,994 |
__version__ = '2.0.post6'
| Outernet-Project/librarian-netinterfaces | librarian_netinterfaces/__init__.py | Python | gpl-3.0 | 26 |
import concurrent.futures
import itertools
import os
import psutil
import subprocess
import sys
os.environ['GDAL_PAM_PROXY_DIR'] = '/tmp/gdal'
allOpts = ['-w', '--stats-full']
matrix = [[
[],
['--compression', 'none'],
['--compression', 'jpeg'],
['--compression', 'jpeg', '-q', '95'],
['--compressi... | DigitalSlideArchive/large_image | test/utils/compression_test.py | Python | apache-2.0 | 2,878 |
from contextlib import closing
from contextlib import suppress
from io import StringIO
from string import Template
import uuid
import html
from .. import config_context
class _VisualBlock:
"""HTML Representation of Estimator
Parameters
----------
kind : {'serial', 'parallel', 'single'}
kind ... | glemaitre/scikit-learn | sklearn/utils/_estimator_html_repr.py | Python | bsd-3-clause | 9,492 |
import argparse
parser = argparse.ArgumentParser(description='This is a description of')
parser.add_argument('-size', type=str, help='This line should give a short help message', required=True)
parser.add_argument('-o', type=str, help='This line gives the user a description of the argument', required=False)
# saving ... | m-a-ge/notes | python/ParsingArgumentsFromCommandLine.py | Python | gpl-2.0 | 1,049 |
# coding=utf-8
#
# This file is part of SickGear.
#
# Original author: Mr_Orange <mr_orange@hotmail.it>
#
# SickGear 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 yo... | SickGear/SickGear | sickbeard/clients/deluge.py | Python | gpl-3.0 | 5,898 |
import logging
import os
import sys
import time
from .AtomicBasicBlock import AtomicBasicBlock
from .common import *
from generator.tools import stack
class PassManager:
def __init__(self, system_graph):
self.passes = {}
self.analysis_pipe = []
self.verifiers = {}
self.system_graph ... | danceos/dosek | generator/analysis/PassManager.py | Python | lgpl-3.0 | 6,061 |
cars = ['audi','bmw','subaru','toyota']
for car in cars:
if car == 'bmw':
print(car.upper())
else:
print(car.title())
| lukeebhert/python_crash_course | Chapter_5/cars.py | Python | gpl-3.0 | 143 |
# Copyright (c) 2006-2013 Regents of the University of Minnesota.
# For licensing terms, see the file LICENSE.
from lxml import etree
import time
import conf
import g
from grax.access_level import Access_Level
from grax.user import User
from gwis.exception.gwis_error import GWIS_Error
from item import attachment
fro... | lbouma/Cyclopath | pyserver/item/attc/post.py | Python | apache-2.0 | 17,822 |
# coding: utf-8
import datetime, time
from django.conf import settings
from django.test import TestCase
from ..api import Client
from ..utils import User, insert_new_user
class TestUtils(TestCase):
def setUp(self):
self.list1 = settings.CLEVERREACH['list1']
self.list2 = settings.CLEVERREACH['list... | feinheit/django-cleverreach | cleverreach/tests/utils.py | Python | bsd-2-clause | 1,434 |
__version__="0.11.3"
| intip/da-apps | plugins/da_centrallogin/modules/soappy/SOAPpy/version.py | Python | gpl-2.0 | 23 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.