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 |
|---|---|---|---|---|---|
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 Lice... | bob123bob/Sick-Beard | sickbeard/show_name_helpers.py | Python | gpl-3.0 | 9,869 |
# -*- coding: utf-8 -*-
'''
Model file module, so that model files are only loaded once when imported
'''
import os
import sys
import tensorflow as tf
from facenet.src import facenet
from facenet.src.align import detect_face
fileDir = os.path.dirname(os.path.realpath(__file__))
facenetDir = os.path.join(fileDir, ... | lodemo/CATANA | src/face_recognition/MtcnnModel.py | Python | mit | 794 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | kawamon/hue | desktop/core/src/desktop/require_login_test.py | Python | apache-2.0 | 1,795 |
"""
Shared utilities for codejail tests.
"""
from .. import jail_code
class ResetJailCodeStateMixin:
"""
The jail_code module has global state.
Use this mixin to reset jail_code to its initial state before running a test function,
and then restore the existing state once the test function is complet... | edx/codejail | codejail/tests/util.py | Python | apache-2.0 | 1,093 |
#!/usr/bin/env python
from RunBase import *
import time
T=ParseModel("LCDM")
#T.setMnu(0.0)
L=ParseDataset("BBAO+CMBP+SN")#+CMBP")
T.printFreeParameters()
L.setTheory(T)
print T.WangWangVec()
t0 = time.time()
for i in range(30):
print i
loglike=L.loglike()
t= time.time()-t0
print loglike,t
| slosar/april | attick/SpeedTest.py | Python | gpl-2.0 | 303 |
from urllib.parse import urlparse, urljoin
from flask import request, url_for, redirect, session
from flask_wtf import Form
from wtforms import TextField, PasswordField, HiddenField
from wtforms.validators import InputRequired
class RedirectForm(Form):
next = HiddenField()
def __init__(self, *args, **kwargs... | heejongahn/hjlog | hjlog/forms/login.py | Python | mit | 1,344 |
import csv
with open('historical_data.csv', 'rb') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
if int(row["TIME"]) == 0 :
save = float(row["Speed"])
else:
if(float(row["Speed"]) - save >= 0.1*save or -float(row["Speed"]) + save >= 0.1*save ):
print row["SER"] + "->" , int(row["TIME"... | manglakaran/TrafficKarmaSent | extras/check_break.py | Python | mit | 361 |
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-binary-authorization | samples/generated_samples/binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_list_attestors_sync.py | Python | apache-2.0 | 1,638 |
import bs4
import copy
import datetime
import functools
import time
from django.conf import settings as django_settings
from django.core import management
from django.core import serializers
import django.core.mail
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client imp... | divio/askbot-devel | askbot/tests/email_alert_tests.py | Python | gpl-3.0 | 46,147 |
import time
import math
start = time.time()
primes = [2,3]
sum_primes = [0,2,5]
def is_prime(num):
for i in primes:
if i > math.sqrt(num):
break
if num % i == 0:
return False
return True
first = 6-1
second = 6+1
target = 1000000
while first < target and second < target... | fresky/ProjectEulerSolution | 050.py | Python | mit | 1,063 |
# Copyright (c) 2012 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | aristanetworks/arista-ovs-quantum | quantum/api/v2/base.py | Python | apache-2.0 | 23,673 |
# Wrapper for pomegranate.distributions.NormalDistribution
import sys
import numpy as np
from pomegranate.distributions import NormalDistribution as ND
import chippr
class gauss(object):
def __init__(self, mean, var, bounds=None):
"""
A univariate Gaussian probability distribution object
... | aimalz/chippr | chippr/gauss.py | Python | mit | 3,234 |
#
# This file is part of Dragonfly.
# (c) Copyright 2007, 2008 by Christo Butcher
# Licensed under the LGPL.
#
# Dragonfly is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3... | summermk/dragonfly | dragonfly/test/test_window.py | Python | lgpl-3.0 | 1,553 |
from django import forms
from django.utils.translation import ugettext_lazy as _
from knowledge import settings
from knowledge.models import Question, Response
OPTIONAL_FIELDS = ['alert', 'phone_number']
__todo__ = """
This is serious badness. Really? Functions masquerading as
clases? Lame. This should be fixed. So... | RDXT/django-knowledge | knowledge/forms.py | Python | isc | 3,574 |
import pandas as pd
import quandl
import math
import numpy as np
from sklearn import preprocessing, cross_validation, svm
from sklearn.linear_model import LinearRegression
import datetime
import matplotlib.pyplot as plt
from matplotlib import style
import pickle
style.use('ggplot')
quandl.ApiConfig.api_key = 'R7Wd_F... | rohitgadia/MachineLearningPractice | Regression/ex1.py | Python | gpl-3.0 | 1,872 |
'''
malis2profiles.py - build profiles from malis
=============================================
:Author: Andreas Heger
:Release: $Id$
:Date: |today|
:Tags: Python
Purpose
-------
convert a set of plain alignments to profiles.
Usage
-----
Example::
python malis2profiles.py --help
Type::
python malis2profil... | CGATOxford/Optic | scripts/malis2profiles.py | Python | mit | 1,696 |
# 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/.
from setuptools import setup
PACKAGE_NAME = 'mozdevice'
PACKAGE_VERSION = '0.33'
deps = ['mozfile >= 1.0',
'mo... | michath/ConMonkey | testing/mozbase/mozdevice/setup.py | Python | mpl-2.0 | 1,118 |
import os
from common.serializers.json_serializer import JsonSerializer
from ledger.compact_merkle_tree import CompactMerkleTree
from ledger.genesis_txn.genesis_txn_file_util import genesis_txn_file
from ledger.genesis_txn.genesis_txn_initiator import GenesisTxnInitiator
from ledger.ledger import Ledger
from storage i... | evernym/plenum | ledger/genesis_txn/genesis_txn_initiator_from_file.py | Python | apache-2.0 | 2,039 |
#
# The Qubes OS Project, https://www.qubes-os.org/
#
# Copyright (C) 2014-2015 Joanna Rutkowska <joanna@invisiblethingslab.com>
# Copyright (C) 2014-2015 Wojtek Porczyk <woju@invisiblethingslab.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser Genera... | QubesOS/qubes-core-admin | qubes/tests/vm/adminvm.py | Python | lgpl-2.1 | 6,926 |
from PyQt4 import QtCore,QtGui,uic
from servicemodel import ServiceModel
from servicedialog import ServiceDialog
from blur.Classes import Service, ServiceList
class MainWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
uic.loadUi("ui/mainwindow.ui",self)
self.setWindowTitle( 'A... | lordtangent/arsenalsuite | python/asstamer/mainwindow.py | Python | gpl-2.0 | 2,409 |
import json
from django.urls import reverse
from seaserv import seafile_api
from seahub.test_utils import BaseTestCase
from seahub.base.templatetags.seahub_tags import email2nickname, \
email2contact_email
class RepoViewTest(BaseTestCase):
def setUp(self):
self.user_name = self.user.username
... | miurahr/seahub | tests/api/endpoints/test_repos.py | Python | apache-2.0 | 3,930 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('polls', '0004_auto_20150504_1427'),
]
operations = [
migrations.AddField(
model_name='simplepoll',
n... | CivilHub/CivilHub | polls/migrations/0005_auto_20150504_1618.py | Python | gpl-3.0 | 5,847 |
"""Test the cross_validation module"""
import warnings
import numpy as np
from scipy.sparse import coo_matrix
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_raises
from sklearn... | B3AU/waveTree | sklearn/tests/test_cross_validation.py | Python | bsd-3-clause | 24,996 |
import numpy as np
np.random.seed(2016)
import os
import glob
import cv2
import datetime
import time
from sklearn.cross_validation import KFold
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from ke... | khushhallchandra/Deep-Learning | kaggle/ultrasoundNerveReco/src/kerasTest.py | Python | mit | 1,325 |
# -*- coding: utf-8 -*-
"""#Versión de la calculadora."""
version = '1.0.0'
| Ryszard-Ps/rsr-calculator | rsr_calculator/version.py | Python | gpl-3.0 | 77 |
""" Openssl Elliptic Curve Parameters
Run ``openssl ecparam -list_curves`` to show all of the curve identifiers supported in OpenSSL.
import the ``charm.toolbox.eccurve`` module for the full listing from Charm.
"""
prime192v1 = 409
prime192v2 = 410
prime192v3 = 411
prime239v1 = 412
prime239v2 = 413
prime239v3 = 414
... | JHUISI/charm | charm/toolbox/eccurve.py | Python | lgpl-3.0 | 5,184 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickGear.
#
# 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,... | SickGear/SickGear | sickbeard/metadata/generic.py | Python | gpl-3.0 | 53,307 |
#encoding=utf-8
from models import Soci, SalesInvoice, PurchaseInvoice, Client, Provider, PeriodClose, period, periodTaxes
from django.utils.translation import ugettext_lazy as _
from django import forms
from datetime import *
from django.http import HttpResponseRedirect
from decimal import Decimal
from localflavor.es.... | aleph1888/calaCOOP | Invoices/forms.py | Python | gpl-3.0 | 11,060 |
import os
from crpropa import *
import numpy as np
class Benchmark(object):
""" Benchmark scenario
Specs: https://www.auger.unam.mx/AugerWiki/BenchmarkScenario
PA GAP note: GAP-2012-138
"""
def __init__(self):
""" Initialize required objects and parameters on default values
... | adundovi/CRPropa3-scripts | scenarios/benchmark/BenchmarkClass.py | Python | gpl-3.0 | 5,796 |
'''
Live plots data recieved over serial
'''
import collections
import matplotlib.pyplot as plt
import serial
import serial.tools.list_ports as list_ports
import unittest
import threading
import atexit
import random
import enum
import time
DELIMETER = b","
ENDBYTE = b'\r'
STARTBYTE = b"\n"
class LivePlot:
'''
... | AIAANortheastern/NASA-SL-2017 | main/groundstation/groundstation.py | Python | gpl-2.0 | 19,621 |
from math import sin
from math import sqrt
from math import pi
from copy import deepcopy
from vector import *
class Structure(object):
#Radians = True tells the program to use radians through trigonometric calculations
#Debug = False tells the program to not print out information that can aid during the ... | Davenport-Physics/CS-Volume | Src/Structures.py | Python | mit | 9,113 |
"""The tests for the Script component."""
# pylint: disable=protected-access
import asyncio
from contextlib import contextmanager
from datetime import timedelta
import logging
from unittest import mock
import pytest
import voluptuous as vol
# Otherwise can't test just this file (import order issue)
from homeassistant... | pschmitt/home-assistant | tests/helpers/test_script.py | Python | apache-2.0 | 46,540 |
# -*- coding: utf-8 -*-
# Exploded Assembly Animation workbench for FreeCAD
# (c) 2016 Javier Martínez García
#***************************************************************************
#* (c) Javier Martínez García 2016 *
#* ... | JMG1/ExplodedAssembly | CameraAnimation.py | Python | gpl-2.0 | 5,428 |
from art_instructions.brain import BrainFSM, BrainInstruction
from transitions import State
import rospy
class GetReady(BrainInstruction):
pass
class GetReadyLearn(GetReady):
pass
class GetReadyRun(GetReady):
pass
class GetReadyFSM(BrainFSM):
states = [
State(name='get_ready', on_enter=[... | robofit/ar-table-itable | art_instructions/src/art_instructions/brain/get_ready.py | Python | lgpl-2.1 | 2,567 |
#!/usr/bin/python
# Copyright: (c) 2018, Pluribus Networks
# 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': ['... | alxgu/ansible | lib/ansible/modules/network/netvisor/pn_stp.py | Python | gpl-3.0 | 6,175 |
"""Parameter randomization
==========================
Provides the optional randomization for the parameters of a
:class:`~ceed.function.FuncBase`. Each parameter of the function may be
randomized according to :attr:`~ceed.function.FuncBase.noisy_parameters`, that
attaches a distribution to the parameter.
This module... | matham/Ceed | ceed/function/param_noise.py | Python | mit | 5,803 |
from filer.models import *
from django.core.files import File as DjangoFile
from os.path import basename
from urlparse import urlsplit
import urllib2
def url2name(url):
return basename(urlsplit(url)[2])
def download(url, dir):
local_name = url2name(url)
local_dir = dir
local_path = '%s/%s' % (... | hzlf/openbroadcast | website/lib/util/filer_extra.py | Python | gpl-3.0 | 1,532 |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# 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/.
#
# Copyright (C) 2011-2014 Star2Billing S.L.
#
# The Initia... | gale320/newfies-dialer | newfies/custom_admin_tools/dashboard.py | Python | mpl-2.0 | 8,479 |
from django.conf import settings
import logging
from django.utils.encoding import smart_unicode
from django.core.urlresolvers import reverse, NoReverseMatch
from splango.models import Subject, Experiment, Enrollment, GoalRecord
SPLANGO_STATE = "SPLANGO_STATE"
SPLANGO_SUBJECT = "SPLANGO_SUBJECT"
SPLANGO_QUEUED_UPDATE... | shimon/Splango | splango/__init__.py | Python | mit | 7,869 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# Copyright (c) 2008-2021 pyglet contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follo... | calexil/FightstickDisplay | pyglet/media/__init__.py | Python | gpl-3.0 | 5,683 |
import smtplib
from decimal import Decimal
from django.conf import settings
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import (
AbstractBaseUser,
BaseUserManager,
Group as DjangoGroup,
GroupManager as _GroupManager,
Permission,
PermissionsMixin,
)
from... | jwinzer/OpenSlides | server/openslides/users/models.py | Python | mit | 12,597 |
# Copyright (C) 2016 - Yevgen Muntyan
# Copyright (C) 2016 - Ignacio Casal Quinteiro
# Copyright (C) 2016 - Arnavion
#
# 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 t... | wingtk/gvsbuild | gvsbuild/projects/libarchive.py | Python | gpl-2.0 | 2,039 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2009 - 2014 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
__save__ = __name__
__name__ = 'omero'
try:
api = __import__('omero.api')
model = __import__('omero.model')
util = __import... | dominikl/openmicroscopy | components/tools/OmeroPy/src/omero/clients.py | Python | gpl-2.0 | 41,710 |
from django.db import models
from caya.models import Result, ResultItem
from caya.choices import RESULT_VALIDATION_STATUS
class MeditechResult(Result):
"""
Model for storing information about a specific FACS result obtained from MEDITECH.
This Model is a validation result.
"""
date_of_birth =... | elkingtowa/caya | src/models/meditech_result.py | Python | mit | 1,591 |
"""
A set of functions for generating statistics trees.
Annotates crystalized targets and number of ligands/target available in ChEMBL.
"""
from django.db.models import Count
from interaction.models import ResidueFragmentInteraction, StructureLigandInteraction
from ligand.models import AssayExperiment, AnalyzedExperim... | protwis/protwis | common/phylogenetic_tree.py | Python | apache-2.0 | 14,686 |
"""Convenience module for scripting PyDev Quick Assist proposals in Jyton.
USAGE
=====
Create pyedit_*.py file in your jython script dir of choice, import this
module, subclass AssistProposal, instantiate it and register the instance
with Pydev.
Example:
------------------------------------------------------------... | akurtakov/Pydev | plugins/org.python.pydev.jython/jysrc/assist_proposal.py | Python | epl-1.0 | 6,835 |
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from scrapy.exceptions import DropItem
import codecs
import json
class DianpingPipeline(object):
def __init__(self):
self.file = codecs.ope... | MircroCode/dpSpider | dianping/dianping/pipelines.py | Python | mit | 1,850 |
import cherrypy
# import datetime
#import pandas as pd
from cStringIO import StringIO
from mufflerDataBackEnd import MufflerVPRDataBackEnd
from mufflerDataBackEnd import MufflerVPRPlotLoader as plotLoader
class MufflerVPR(object):
exposed = True
def __init__(self, dataService):
self.dataService = d... | liufuyang/CS50_final_project | mufflerVPR/muffler.py | Python | mit | 2,568 |
# Copyright (C) 2012 David Rusk
#
# 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, distr... | drusk/pml | test/test_pml/test_data/test_loader.py | Python | mit | 3,218 |
import pytest
import json
from datetime import datetime, timedelta, timezone
from test.testexception import AuthorizationError, UnprocessableError
class TestEvent:
def test_system_errors(self, helper):
user, device = helper.given_new_user_with_device(self, "error_maker")
new_event_name = "systemE... | TheCacophonyProject/Full_Noise | test/test_event.py | Python | agpl-3.0 | 8,627 |
# -*- coding: utf-8 -*-
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
__author__ = "Ole Christian Weidner"
__copyright__ = "Copyright 2011-2012, Ole Christian Weidner"
__license__ = "MIT"
import bliss.saga
from bliss.saga.Object import Object
class File(Object):
'''Loosely represents a SAGA file a... | saga-project/bliss | bliss/saga/filesystem/File.py | Python | mit | 6,940 |
###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... | nielsbuwen/ilastik | ilastik/applets/iiboostFeatureSelection/iiboostFeatureSelectionApplet.py | Python | gpl-3.0 | 1,704 |
# -*- coding: utf-8 -*-
#
# javauserguide documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 21 21:46:23 2015.
#
# 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
# autogenerated file.... | BiuroCo/mega | bindings/doc/java/sphinx/source/conf.py | Python | bsd-2-clause | 11,589 |
import string
import os, sys
import types, traceback
try:
if sys.version_info[0] == 3:
from tkinter import Tk
from tkinter import messagebox
else:
from Tkinter import Tk
import tkMessageBox as messagebox
_hasTk = 1
except:
_hasTk = 0
def write_CSV(f,x):
"""write li... | imitrichev/cantera | interfaces/cython/cantera/mixmaster/utilities.py | Python | bsd-3-clause | 1,126 |
# Copyright (c) 2013 Tencent Inc.
# All rights reserved.
#
# Author: Feng Chen <phongchen@tencent.com>
"""Define resource_library target
"""
import os
import blade
import build_rules
from cc_targets import CcTarget
class ResourceLibrary(CcTarget):
"""A scons cc target subclass.
This class is derived fro... | project-zerus/blade | src/blade/resource_library_target.py | Python | bsd-3-clause | 5,386 |
# -*- coding: utf-8 -*-
"""Module containing classes with common behaviour for both VMs and Instances of all types."""
from datetime import date
from functools import partial
from wrapanapi import exceptions
from cfme import js
from cfme.common.vm_console import VMConsole
from cfme.exceptions import (
VmOrInstanc... | jkandasa/integration_tests | cfme/common/vm.py | Python | gpl-2.0 | 32,052 |
import ctypes
import numpy
import sys
import os
import os.path
from numpy.compat import asbytes, asstr
def _generate_candidate_libs():
# look for likely library files in the following dirs:
lib_dirs = [os.path.dirname(__file__),
'/lib',
'/usr/lib',
'/usr/local/l... | emmanuelle/scikits.image | skimage/io/_plugins/freeimage_plugin.py | Python | bsd-3-clause | 26,740 |
import re
import requests
from bs4 import BeautifulSoup
from cloudbot import hook
from cloudbot.util import web, formatting
# CONSTANTS
steam_re = re.compile('.*://store.steampowered.com/app/([0-9]+)', re.I)
API_URL = "https://store.steampowered.com/api/appdetails/"
STORE_URL = "https://store.steampowered.com/app/... | valesi/CloudBot | plugins/steam_store.py | Python | gpl-3.0 | 2,718 |
# This can be used to verify if a file contains a word or phrase
import sys,os
import datetime
import gzip
total_count=0
found_count=0
gzipfile=0
regularfile=0
KeyWord=str(raw_input("Enter the Key-Word to search for: "))
DateAfter=raw_input("Enter the date [Logs before this date will beignored] in DD-MM-YYYY forma... | satheeshgopalan/python | keyword_in_files.py | Python | mit | 2,592 |
# 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 use ... | mihaisoloi/conpaas | conpaas-services/contrib/libcloud/compute/drivers/gogrid.py | Python | bsd-3-clause | 14,949 |
#!/usr/bin/python
#
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
#
# Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
ANSIB... | rahushen/ansible | lib/ansible/modules/network/avi/avi_serverautoscalepolicy.py | Python | gpl-3.0 | 7,491 |
# pylint: disable-msg=W0614,W0401,W0611,W0622
# flake8: noqa
__docformat__ = 'restructuredtext'
# Let users know if they're missing any of our hard dependencies
hard_dependencies = ("numpy", "pytz", "dateutil")
missing_dependencies = []
for dependency in hard_dependencies:
try:
__import__(dependency)
... | NixaSoftware/CVis | venv/lib/python2.7/site-packages/pandas/__init__.py | Python | apache-2.0 | 5,466 |
import logging
import os
from lib.Settings import Settings
from lib.Wrappers.NullLogger import NullLogger
class Logger:
def __init__(self, name):
if 'UNITTESTING' in os.environ:
self.logging = NullLogger()
else:
settings = Settings().getSettings()
logging.basicC... | Open365/Open365 | lib/Wrappers/Logger.py | Python | agpl-3.0 | 1,007 |
from __future__ import absolute_import
from traits.testing.unittest_tools import unittest
from ..about_dialog import AboutDialog
from ..constant import OK, CANCEL
from ..gui import GUI
from ..toolkit import toolkit_object
from ..window import Window
ModalDialogTester = toolkit_object('util.modal_dialog_tester:ModalD... | geggo/pyface | pyface/tests/test_about_dialog.py | Python | bsd-3-clause | 3,554 |
# Copyright 2019, 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... | googleapis/python-pubsub | google/cloud/pubsub_v1/subscriber/client.py | Python | apache-2.0 | 11,505 |
#
# Copyright (c) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | NervanaSystems/coach | rl_coach/tests/conftest.py | Python | apache-2.0 | 3,681 |
from django.db import models
class Role(models.Model):
role_name = models.CharField(max_length=50)
active = models.BooleanField(default=1)
def __unicode__(self):
return self.role_name
class User(models.Model):
name = models.CharField(max_length=50)
user_type = models.ForeignKey(Role)
d... | andriyboychenko/books-online | catalogue/models.py | Python | apache-2.0 | 3,350 |
# -*- coding: utf-8 -*-
# Copyright 2021 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... | GoogleChrome/chromium-dashboard | api/logout_api.py | Python | apache-2.0 | 1,049 |
# -*- coding: utf-8 -*-
#
# 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
#... | edgarRd/incubator-airflow | tests/www/test_utils.py | Python | apache-2.0 | 9,275 |
from vesper.tests.test_case import TestCase
import vesper.util.yaml_utils as yaml_utils
class YamlUtilsTests(TestCase):
def test_dump_and_load(self):
x = {'x': 1, 'y': [1, 2, 3], 'z': {'one': 1}}
s = yaml_utils.dump(x)
y = yaml_utils.load(s)
self.assertEqual(x, y)
... | HaroldMills/Vesper | vesper/util/tests/test_yaml_utils.py | Python | mit | 1,582 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# seriesly - XBMC Plugin
# Conector para safelinking (ocultador de url)
# http://blog.tvalacarta.info/plugin-xbmc/seriesly/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
fr... | conejoninja/xbmc-seriesly | servers/safelinking.py | Python | gpl-3.0 | 800 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2002 Ben Escoto <ben@emerose.org>
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
# Copyright 2008 Ian Barton <ian@manor-farm.org>
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modify it
# ... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/duplicity/backends/imapbackend.py | Python | mit | 9,393 |
### Digitised data from [Firek1995]
import numpy as np
# Steady State Inactivation
def Inact_Firek():
"""
Steady-State inactivation curve [Firek1995]
cf Fig 3c
"""
x = [-50, -35, -25, -15, -5, 5, 15]
y = np.asarray([0.9478260869565218,
0.9356521739130435,
... | c22n/ion-channel-ABC | docs/examples/human-atrial/data/isus/Firek1995/data_Firek1995.py | Python | gpl-3.0 | 912 |
from ...utilities import COLUMN, ROW, index_1d, inverted, is_on_board_2d
from ..direction import Direction
from ..tessellation_base import TessellationBase
class HexobanTessellation(TessellationBase):
_LEGAL_DIRECTIONS = (
Direction.LEFT,
Direction.RIGHT,
Direction.NORTH_EAST,
Dire... | tadams42/sokoenginepy | src/sokoenginepy/tessellation/hexoban_tessellation/hexoban_tessellation.py | Python | gpl-3.0 | 2,950 |
import optparse
parser = optparse.OptionParser()
parser.add_option('--pdb_in', default=None, help='Input PDB file')
parser.add_option('--dms_out', default=None, help='Output dms file')
(args, options) = parser.parse_args()
import os
if not os.path.exists(args.pdb_in):
raise Exception(args.pdb_in+' does not exist')
... | gkumar7/AlGDock | Pipeline/_receptor_surface.chimera.py | Python | mit | 690 |
from flask import Flask
from flask import render_template
from random import randint
app = Flask('myApp')
@app.route('/')
def hello():
return '<style> h1 { color: red; text-align: center; } </style> <h1>Hello World</h1>'
# app.run()
# '@app.route()' = a decorator
# a decorator (lines 7-9) !== a function
@app.r... | madeleinel/Cheat-Sheets | advCFG/Session3/flaskApp/FlaskExs.py | Python | mit | 1,434 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Test for the piezo tensor class
"""
__author__ = "Shyam Dwaraknath"
__version__ = "0.1"
__maintainer__ = "Shyam Dwaraknath"
__email__ = "shyamd@lbl.gov"
__status__ = "Development"
__date__ = "4/1/16"
im... | dongsenfo/pymatgen | pymatgen/analysis/tests/test_piezo.py | Python | mit | 2,535 |
# Portions Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# hg.py - repository classes for mercurial
#
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
# Copyright 2006 Vadim Gelfer <vadim.gelfer... | facebookexperimental/eden | eden/scm/edenscm/mercurial/hg.py | Python | gpl-2.0 | 36,891 |
# -----------------------------------------------------------------------------
# Copyright (c) 2005-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.tx... | etherkit/OpenBeacon2 | client/linux-arm/venv/lib/python3.6/site-packages/PyInstaller/hooks/hook-pyexcel-xlsxw.py | Python | gpl-3.0 | 638 |
# This code runs the new_index script on a 24 hour basis
# Importing the file and time keeping
import new_index, time
# While loop to run the new_index code every 24 hours
while True:
# Run new_index
new_index
# Just to keep user aware
print ("I will check for a new file in 24 hours")
#... | Coding-Credibility/EDGAR | daily.py | Python | apache-2.0 | 368 |
#!/usr/bin/python
import os
import sys
from stat import *
import zmq
import netifaces
import threading
import signal
import time
import argparse
import ConfigParser
from machinekit import service
from machinekit import config
from message_pb2 import Container
from config_pb2 import *
from types_pb2 import *
class C... | EqAfrica/machinekit | src/machinetalk/config-service/configserver.py | Python | lgpl-2.1 | 9,656 |
#!/usr/bin/env python
#
#CustomScript extension
#
# Copyright 2014 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | Azure/azure-linux-extensions | AzureEnhancedMonitor/ext/test/test_aem.py | Python | apache-2.0 | 15,568 |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext as _
from django.http import HttpResponseBadRequest
import oauth2 as oauth
from oauth_provider.utils import send_oauth_error
INVALID_CONSUMER_RESPONSE = HttpResponseBadRequest('Invalid Consumer.')
def invalid_params_response(scheme, domain):
se... | ljwolford/ADL_LRS | oauth_provider/responses.py | Python | apache-2.0 | 698 |
# TODO: Needs a better name; too many modules are already called "concat"
from collections import defaultdict
import copy
import numpy as np
from pandas._libs import internals as libinternals, tslibs
from pandas.util._decorators import cache_readonly
from pandas.core.dtypes.cast import maybe_promote
from pandas.core... | cbertinato/pandas | pandas/core/internals/concat.py | Python | bsd-3-clause | 17,025 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
#
# Tests of the grammar
#
# Code takes a tab-delimited text file of the form:
#
# Func Test Valid InType Expected
# pm -+ True string
# pm * False one
# num 1|+1 ... | jmuhlich/hgvs | tests/test_hgvs_grammar_full.py | Python | apache-2.0 | 4,756 |
'''OpenGL extension VERSION.GL_1_5
This module customises the behaviour of the
OpenGL.raw.GL.VERSION.GL_1_5 to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/VERSION/GL_1_5.txt
'''
from OpenGL import platform, constants, constant,... | Universal-Model-Converter/UMC3.0a | data/Python/x86/Lib/site-packages/OpenGL/GL/VERSION/GL_1_5.py | Python | mit | 4,389 |
#!/usr/bin/env python
from fs.utils import movefile, movefile_non_atomic, contains_files
from fs.commands import fscp
import sys
class FSmv(fscp.FScp):
usage = """fsmv [OPTION]... [SOURCE] [DESTINATION]
Move files from SOURCE to DESTINATION"""
def get_verb(self):
return 'moving...'
... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/fs/commands/fsmv.py | Python | agpl-3.0 | 750 |
#!/usr/bin/env python3
# encoding: utf8
# license: ISC (MIT/BSD compatible) https://choosealicense.com/licenses/isc/
# This library is principally created for python 3. However python 2 support may be doable and is welcomed.
"""Use python in a more object oriented, saner and shorter way.
# WARNING
First: A word of w... | dwt/BayesianNetworks | fluent.py | Python | mit | 46,253 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-12-16 14:36
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('movies', '0021_auto_20161216_1406'),
]
operations = [
migrations.RenameField(
... | pdevetto/super-duper-disco | movies/migrations/0022_auto_20161216_1436.py | Python | gpl-3.0 | 429 |
def get_description():
"""Return random veather. Just like the pros"""
from random import choice
possibilities = ['rain', 'snow', 'sleet', 'fog',
'sun', 'who knows']
return choice(possibilities) | serggrom/python-projects | report.py | Python | gpl-3.0 | 231 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import os
import json
SPLIT_CHAR = '#'
MSG_SPLIT_CHAR = '@'
MIN_BETWEEN_BEFORE_AFTER = 1
if len(sys.argv) < 3:
print "引数が足りない(<infile1> <infile2>)"
sys.exit(1)
in_file_1 = sys.argv[1]
in_file_2 = sys.argv[2]
out_file = "combined_file.txt"
wf = open(out... | supertask/ChainX | server/websocket/recorded_operations/combiner.py | Python | mit | 1,425 |
import datetime
#See also:
#def fixdate(d):
#return u"%s-%s-%sT%s:%s:%s"%(d[0:4], d[4:6], d[6:8], d[8:10], d[10:12], d[12:14])
# return u"%s-%s-%s"%(d[0:4], d[4:6], d[6:8])
def webfeed(body):
import feedparser
#Abstracted from Akara demo/modules/atomtools.py
feed = feedparser.parse(body)
fro... | dpla/zen | lib/feeds.py | Python | apache-2.0 | 1,327 |
from setuptools import setup, find_packages
setup(
name="Coinbox-mod-currency",
version="0.2",
packages=find_packages(),
zip_safe=True,
namespace_packages=['cbmod'],
include_package_data=True,
install_requires=[
'sqlalchemy>=0.7, <1.0',
'... | coinbox/coinbox-mod-currency | setup.py | Python | mit | 654 |
import jwt
from glassfrog.models import Installation
from flask import escape
import Levenshtein
def createMessageDict(color, message, message_format="html"):
message_dict = {
"color": color,
"message": str(message),
"notify": False,
"message_format": message_format
}
r... | wardweistra/glassfrog-hipchat-bot | glassfrog/functions/messageFunctions.py | Python | lgpl-3.0 | 2,138 |
#!/usr/bin/python
########################################################################
# 15 May 2014
# Patrick Lombard, Centre for Stem Stem Research
# Core Bioinformatics Group
# University of Cambridge
# All right reserved.
########################################################################
import subproce... | pdl30/pychiptools | pychiptools/samtoucsc.py | Python | gpl-2.0 | 6,648 |
#!/usr/bin/python
#
# 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, software
# di... | silenceli/oga-windows | ovirt-guest-agent/ovirt-guest-agent.py | Python | apache-2.0 | 4,625 |
#!/usr/bin/env python
"""
This is a very small app using the FloatCanvas
It tests the Spline object, including how you can put points together to
create an object with curves and square corners.
"""
import wx
#### import local version:
#import sys
#sys.path.append("../")
#from floatcanvas import NavCanvas
#from f... | dnxbjyj/python-basic | gui/wxpython/wxPython-demo-4.0.1/samples/floatcanvas/TestSpline.py | Python | mit | 4,596 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | google-research/google-research | multiple_user_representations/models/parametric_attention_test.py | Python | apache-2.0 | 1,915 |
path_to_database = 'sqlite:////home/jcharante/Projects/Baxterite/baxterite/src/server/database.db' | baxter-oop/baxterite | src/server/config.py | Python | mit | 98 |
#
# 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... | Acehaidrey/incubator-airflow | airflow/providers/apache/pig/operators/pig.py | Python | apache-2.0 | 2,694 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.