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
# encoding: UTF-8
# Thomas Nagy 2008-2010 (ita)
"""
Doxygen support
Variables passed to bld():
* doxyfile -- the Doxyfile to use
* doxy_tar -- destination archive for generated documentation (if desired)
* install_path -- where to install the documentation
* pars -- dictionary overriding doxyg... | mfisher31/libjuce | waflib/extras/doxygen.py | Python | gpl-2.0 | 7,334 |
#!/c/Python27/python.exe
# Note: this one is used by Windows
import sys, os, _winreg
if __name__ == "__main__":
portable = False
if "--portable" in sys.argv:
sys.argv.remove("--portable")
portable = True
if portable:
# Running from current directory
path = "."
data_path = os.path.join(os.getcwd(), "da... | syncthing/syncthing-gtk | scripts/syncthing-gtk-exe.py | Python | gpl-2.0 | 2,544 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
ur"""Helper functions for work with collections.
Utils:
`unlist` -- extracts element from one-element collections:
>>> unlist([]) is None
True
>>> unlist(['hello'])
'hello'
>>> unlist(['hello', 'world'])
Traceback (most recent call last):
...
... | AOrazaev/maf | util/collection.py | Python | mit | 2,974 |
# Play old style sound files (Guido's private format)
import al, sys, time
import AL
BUFSIZE = 8000
def main():
if len(sys.argv) < 2:
f = sys.stdin
filename = sys.argv[0]
else:
if len(sys.argv) <> 2:
sys.stderr.write('usage: ' + \
sys.argv[0] + ' filename\n')
sys.exit(2)
filename = sys.argv[1]
... | sensysnetworks/uClinux | user/python/Demo/sgi/al/playold.py | Python | gpl-2.0 | 983 |
"""
Simple mode
Use SUMMON in simple single-window mode.
In single-window mode, these global functions can be used to interact
directly with the summon window. This is useful for people not familiar
with object-oriented programming.
Scripts executed by bin/summon have simple single-... | mdrasmus/summon | lib/summon/simple.py | Python | gpl-2.0 | 2,179 |
# Generic plugins
class EQUELPluginException(ValueError):
"""This exception is raised when a plugin fails in processing of an expression"""
pass
class BasePlugin:
"""Main interfaces shared across all plugin types"""
name = "Base Plugin"
description = "Plugin base class"
def __init__(self):
... | thomaspatzke/EQUEL | equel/plugins/generic.py | Python | lgpl-3.0 | 1,543 |
# encoding: utf-8
__author__ = "Nils Tobias Schmidt"
__email__ = "schmidt89 at informatik.uni-marburg.de"
from androlyze import action_query_result_db
from androlyze.error import AndroLyzeLabError
from androlyze.log.Log import clilog
class DBLyze(object):
''' This is the base class for all `DBLyze` scripts.
... | nachtmaar/androlyze | androlyze/model/script/dblyze/DBLyze.py | Python | mit | 2,050 |
import sys
sys.path.append('.')
sys.path.append('..')
from tasks import execute_search_timerange_task
if __name__ == '__main__':
execute_search_timerange_task()
| yzsz/weibospider | first_task_execution/search_timerange_first.py | Python | mit | 168 |
import os
import unittest
import inflection
from email.utils import parsedate
from datetime import datetime
from pyramid import testing
from six import text_type
from pyramid.config import Configurator
from .base import DATA_DIR
from .resource import BOOKS
from pyramlson import NoMethodFoundError
class ResourceFu... | ScanPlusGmbH/pyramlson | tests/test_resource.py | Python | apache-2.0 | 11,199 |
"""
Base IO code for all datasets
"""
# Copyright (c) 2007 David Cournapeau <cournape@gmail.com>
# 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr>
# 2010 Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
import csv
import hashlib
import os
import shutil
from collections im... | glemaitre/scikit-learn | sklearn/datasets/_base.py | Python | bsd-3-clause | 41,304 |
"""
collection of helper functions
"""
from __future__ import print_function, division, absolute_import
import os
from glob import glob
from collections import defaultdict
import tables
from .. import NcsFile, options
def check_sorted(channel_dirname):
"""
check how many 'sorted_...' folder there are
"""
... | jniediek/combinato | combinato/util/tools.py | Python | mit | 4,566 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2013 Matt Martz
# 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/lic... | sivel/rax-api-challenge | sdk/challenge8.py | Python | apache-2.0 | 2,478 |
from .main import OMGWTFNZBs
def start():
return OMGWTFNZBs()
config = [{
'name': 'omgwtfnzbs',
'groups': [
{
'tab': 'searcher',
'subtab': 'providers',
'list': 'nzb_providers',
'name': 'OMGWTFNZBs',
'description': 'See <a href="http://omg... | coolbombom/CouchPotatoServer | couchpotato/core/providers/nzb/omgwtfnzbs/__init__.py | Python | gpl-3.0 | 1,144 |
# Copyright (C) 2009-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... | trevor/mailman3 | src/mailman/interfaces/autorespond.py | Python | gpl-3.0 | 3,775 |
from enum import IntEnum
##
# Game Tags
class GameTag(IntEnum):
TIMEOUT = 7
TURN_START = 8
PLAYSTATE = 17
STEP = 19
TURN = 20
FATIGUE = 22
CURRENT_PLAYER = 23
FIRST_PLAYER = 24
RESOURCES_USED = 25
RESOURCES = 26
HERO_ENTITY = 27
MAXHANDSIZE = 28
STARTHANDSIZE = 29
DEFENDING = 36
PROPOSED_DEFENDER = 37... | butozerca/fireplace | fireplace/enums.py | Python | agpl-3.0 | 7,347 |
from __future__ import print_function, unicode_literals
import inspect
import six
from django import forms
from django.forms.forms import DeclarativeFieldsMetaclass
from rest_framework import serializers
from .. import fields
from ..utils import (
initialize_class_using_reference_object,
reduce_attr_dict_from... | pombredanne/django-rest-framework-braces | drf_braces/forms/serializer_form.py | Python | mit | 5,024 |
# -*- coding: utf-8 -*-
# try something like
@auth.requires_login()
@auth.requires_membership('editor')
def index():
# Determine tables
tables = []
for item in db.tables():
tables.append(item)
# Request which tables to edit
webform = SQLFORM.factory(Field(" ", default=" ", writable=False),
... | ShadeySecurity/pyAssetContext | controllers/editor.py | Python | gpl-2.0 | 3,208 |
# Copyright 2019 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
#
# Unless required by applicable law or agreed to in wri... | FireballDWF/cloud-custodian | tools/c7n_azure/c7n_azure/constants.py | Python | apache-2.0 | 4,200 |
from functools import reduce
import numpy as np
import tensorflow as tf
# TODO: check the methods of _TensorLike
class TensorTrainBase(object):
"""An abstract class that represents a collection of Tensor Train cores.
"""
def __init__(self, tt_cores):
"""Creates a `TensorTrainBase`."""
pass
def get_r... | Bihaqo/t3f | t3f/tensor_train_base.py | Python | mit | 5,565 |
# -*- coding: utf-8 -*-
import itertools
import functools
import os
import re
import logging
import pymongo
import datetime
from dateutil.parser import parse as parse_date
import urlparse
from collections import OrderedDict
import warnings
import pytz
from flask import request
from django.core.urlresolvers import reve... | ticklemepierce/osf.io | website/project/model.py | Python | apache-2.0 | 149,905 |
#============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope th... | jeffchao/xen-3.3-tcg | tools/python/xen/xend/server/SrvNode.py | Python | gpl-2.0 | 2,320 |
# Test performance evaluator
from pyopus.evaluator.performance import PerformanceEvaluator
from pyopus.evaluator.cost import formatParameters
if __name__=='__main__':
heads = {
'opus': {
'simulator': 'SpiceOpus',
'settings': {
'debug': 0
},
'moddefs': {
'def': { 'file': 'opam... | blorgon9000/pyopus | demo/evaluation/02-evaluator/runme.py | Python | gpl-3.0 | 4,194 |
# Copyright (C) 2012-2013 Linaro Limited
#
# Author: Andy Doan <andy.doan@linaro.org>
# Dave Pigott <dave.pigott@linaro.org>
#
# This file is part of LAVA Dispatcher.
#
# LAVA Dispatcher is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published b... | inwotep/lava-dispatcher | lava_dispatcher/device/sdmux.py | Python | gpl-2.0 | 10,140 |
#!/usr/bin/env python
from setuptools import setup
setup(
name='TheHitList',
description='Python library that wraps The Hit List\'s AppleScript api using appscript',
author='Paul Traylor',
url='http://github.com/kfdm/thehitlist/',
version='0.3',
packages=['TheHitList'],
install_requires=['appscript', 'clint'],... | kfdm-archive/thehitlist | setup.py | Python | mit | 389 |
#!/usr/bin/env python
#
# Electrum - lightweight ParkByte client
# Copyright (C) 2014 Thomas Voegtlin
#
# 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 withou... | parkbyte/electrumparkbyte | lib/synchronizer.py | Python | mit | 7,787 |
from __future__ import print_function
import re
import os
import sys
import time
try:
import IDF
except ImportError:
test_fw_path = os.getenv('TEST_FW_PATH')
if test_fw_path and test_fw_path not in sys.path:
sys.path.insert(0, test_fw_path)
import IDF
ENTERING_SLEEP_STR = 'Entering light sleep... | krzychb/rtd-test-bed | examples/system/light_sleep/example_test.py | Python | apache-2.0 | 2,143 |
#!/usr/bin/env python
"""
Originally from
https://github.com/chainer/chainer/blob/master/examples/mnist/train_mnist.py
But SklearnWrapperClassifier fit method is used for training,
instead of explicitly configure trainer.
"""
from __future__ import print_function
import os
import sys
import numpy as np
from chaine... | corochann/chainerex | examples/sklearn_wrapper/iris_classification/train_iris_fit.py | Python | mit | 3,509 |
# -*- Mode: Python; test-case-name: flumotion.test.test_config -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public L... | flyapen/UgFlu | flumotion/admin/config.py | Python | gpl-2.0 | 2,550 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | v-iam/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_service_community_paged.py | Python | mit | 918 |
from abapy.mesh import Mesh
from matplotlib import pyplot as plt
import numpy as np
N1,N2 = 10,5 # Number of elements
l1, l2 = 4., 2. # Mesh size
fs = 20. # fontsize
mesh = Mesh()
nodes = mesh.nodes
nodes.add_node(label = 1, x = 0., y = 0.)
nodes.add_node(label = 2, x = 1., y = 0.)
nodes.add_node(label = 3, x = 0., y... | lcharleux/abapy | doc/example_code/mesh/Mesh-centroids.py | Python | gpl-2.0 | 1,157 |
# Copyright 2015 Metaswitch Networks
#
# 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 w... | Symmetric/calico-docker | calico_containers/tests/st/test_diags.py | Python | apache-2.0 | 1,025 |
"""
A testing program that utilizes Googles Text To Speech (GTTS) engine and pyglet to speak text.
Ensure that AVbin is installed for pyglet to run properly: https://avbin.github.io/AVbin/Download.html
"""
from gtts import gTTS
import time
import os
from sys import platform
if platform == "linux" or platform == "linux... | SPARC-Auburn/Lab-Assistant | assistant/tests/gttstest.py | Python | apache-2.0 | 1,149 |
# encoding:utf-8
# Identificando la ruta del proyecto
import os
RUTA_PROYECTO = os.path.dirname(os.path.realpath(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('PyNef', 'pynef@gmail.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'pos... | pynef/turismo | mobile/settings.py | Python | mit | 5,499 |
# This file is generated by c:\users\ibm_ad~1\appdata\local\temp\easy_install-sv2t3w\numpy-1.9.2\setup.py
# It contains system_info results at the time of building this package.
__all__ = ["get_info","show"]
blas_info={}
atlas_3_10_blas_info={}
lapack_info={}
atlas_3_10_blas_threads_info={}
atlas_threads_info={}
blas_... | run2/citytour | 4symantec/Lib/site-packages/numpy-1.9.2-py2.7-win-amd64.egg/numpy/distutils/__config__.py | Python | mit | 1,095 |
import time
import unittest
from nive.portal import Portal
from nive.definitions import ConfigurationError
from nive.helper import Event
from nive.definitions import OperationalError
from test_nive import testapp, mApp2, mApp
class portalTest(unittest.TestCase):
def setUp(self):
self.portal = ... | nive-cms/nive | nive/tests/test_portal.py | Python | gpl-3.0 | 1,531 |
class Node(object):
def __init__(self, val):
self.val = val
self.duplicates = 1
self.left_children = 0
self.left = None
self.right = None
def addChild(self, child_val, left_children_count, duplicates_count):
if self.val < child_val:
if not self.right:... | TanakritBenz/leetcode-adventure | Count_of_Smaller_Numbers_After_Self.py | Python | gpl-2.0 | 1,838 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-01 09:05
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]... | libscie/liberator | doi/migrations/0001_initial.py | Python | cc0-1.0 | 1,417 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution.
#
# 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 Softw... | diagramsoftware/l10n-spain | l10n_es_aeat_mod111/models/__init__.py | Python | agpl-3.0 | 918 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utilities for dealing with the python unittest module."""
import fnmatch
import re
import sys
import unittest
class _TextTestResult(unittest._TextTestR... | endlessm/chromium-browser | build/util/lib/common/unittest_util.py | Python | bsd-3-clause | 5,082 |
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
#gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
hsv = cv2.cvtColor(frame,cv2.COLOR_BGR2HSV)
lower_lim = np.array([40,100,100])
uppe... | Burtt/IllumicatsVision | RaspberryPi/tests/cvtest5.py | Python | mit | 605 |
# Python - 3.6.0
numbers = {1: 0, 2: 1}
maxNumber = 2
def fib(n):
global numbers, maxNumber
if n > maxNumber:
for i in range(maxNumber + 1, n + 1):
numbers[i] = numbers[i - 1] + numbers[i - 2]
maxNumber = n
return numbers[n]
| RevansChen/online-judge | Codewars/6kyu/fibonacci-reloaded/Python/solution1.py | Python | mit | 267 |
x = 0
n, m = map(int, raw_input().split())
for a in range(0,int(n**0.5)+1):
b = n-a*a
if b>=0 and a+b*b==m:
x = x+1
print x
| Sarthak30/Codeforces | system_of_eqaution.py | Python | gpl-2.0 | 128 |
# Python Hello Client example
import sys, logging
logging.basicConfig()
import hello
def main():
# "http://hello.datawire.io/" is the URL of the simple "Hello" cloud
# microservice run by Datawire, Inc. to serve as a simple first test.
#
# You can test completely locally, too:
# - comment out th... | datawire/quark | examples/helloRPC/pyclient.py | Python | apache-2.0 | 1,167 |
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from time import sleep
import traceback
from cfme.configure.access_control import User, Group, Role, Tenant, Project
from utils import error
import cfme.fixtures.pytest_selenium as sel
from cfme import login, test_requirements
from cfme.base.credential import Cr... | rlbabyuk/integration_tests | cfme/tests/configure/test_access_control.py | Python | gpl-2.0 | 25,888 |
from unittest import TestCase
#try:
# import cPickle as pickle
#except ImportError:
# import pickle
import grab.spider.base
from grab import Grab
from grab.spider import Spider, Task, Data, SpiderMisuseError, NoTaskHandler
from test.server import SERVER
class SimpleSpider(Spider):
base_url = 'http://google... | subeax/grab | test/case/spider_task.py | Python | mit | 8,629 |
"""
This module implements python classes which inherit from
and extend the functionality of the ROOT canvas classes.
"""
import ROOT
from ..core import Object
class PadMixin(object):
def Clear(self, *args, **kwargs):
self.members = []
self.__class__.__bases__[-1].Clear(self, *args, **kwargs)
... | brynmathias/rootpy | rootpy/plotting/canvas.py | Python | gpl-3.0 | 890 |
import re
from webob.dec import wsgify
from webob.exc import HTTPMovedPermanently, HTTPFound
wh = re.compile('(www\.)*(.*)')
sl = re.compile('.+/$')
@wsgify
def app(r):
w, h = wh.match(r.host).groups()
p = r.path
q = r.query_string
if q:
q = '?' + q
if w or sl.match(p):
u = r.sche... | LukeStebbing/Site | Redirect/redirect.py | Python | apache-2.0 | 478 |
from setuptools import setup, find_packages
setup(name='MODEL1112110003',
version=20140916,
description='MODEL1112110003 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/MODEL1112110003',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/MODEL1112110003 | setup.py | Python | cc0-1.0 | 377 |
#!/usr/bin/python
#
# Copyright 2002 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# an... | pgoeser/gnuradio | gr-atsc/src/lib/gen_encoder.py | Python | gpl-3.0 | 1,567 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
doClipper.py
---------------------
Date : June 2010
Copyright : (C) 2010 by Giuseppe Sucameli
Email : brush dot tyler at gmail dot com
******************... | alexbruy/QGIS | python/plugins/GdalTools/tools/doClipper.py | Python | gpl-2.0 | 8,844 |
"""
Jocelyn - a shim to make Processing easier from jython.
"""
# Imports to do more importing
import os
import sys
import fnmatch
from java.net import URL, URLClassLoader
from java.lang import ClassLoader
from java.io import File
# Add Java Libraries to classpath
try:
import processing
except ImportError:
# ... | d0c0nnor/jocelyn | src/jocelyn/__init__.py | Python | apache-2.0 | 5,972 |
# -*- coding: utf-8 -*-
import logging
import werkzeug.utils
from openerp import http
from openerp.http import request
from openerp.addons.web.controllers.main import login_redirect, abort_and_redirect
_logger = logging.getLogger(__name__)
class PosController(http.Controller):
@http.route('/pos/web', type='htt... | addition-it-solutions/project-all | addons/point_of_sale/controllers/main.py | Python | agpl-3.0 | 1,015 |
# From: http://stackoverflow.com/questions/4652439/is-there-a-matplotlib-equivalent-of-matlabs-datacursormode/4674445#4674445
from matplotlib import cbook
import numpy as np
def _update_dict(old, new):
"""Update the elements of a (possibly nested) dictionary."""
if new is None:
return
for k,v in new.items()... | mthomure/glimpse-project | glimpse/util/gplot/datacursor.py | Python | mit | 5,144 |
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
# Parse ARGUS source.
#
# A script that uses the arguscard classes to read ARGUS assembly format source
# and parse instructions.
#
# This is intended for debugging assembler development.
from __future__ import print_function
import sys
from optparse import OptionPa... | jimlawton/h800 | tools/parse.py | Python | gpl-2.0 | 2,724 |
# Copyright 2009-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import itertools
import stat
from portage.const import PORTAGE_BIN_PATH, PORTAGE_PYM_PATH
from portage.tests import TestCase
from portage import os
from portage import _encodings
from portage import _unicode_dec... | clickbeetle/portage-cb | pym/portage/tests/lint/test_compile_modules.py | Python | gpl-2.0 | 1,345 |
#!/usr/bin/env python
# encoding: 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... | Pehat/tika-python | tika/tika.py | Python | apache-2.0 | 20,247 |
"""DOC: TODO"""
# -*- coding: utf-8 -*-
# -- This file is part of the Apio project
# -- (C) 2016-2019 FPGAwars
# -- Author Jesús Arroyo
# -- Licence GPLv2
import sys
import click
import requests
requests.packages.urllib3.disable_warnings()
def api_request(command, organization="FPGAwars"):
"""Perform a request ... | FPGAwars/apio | apio/api.py | Python | gpl-2.0 | 1,503 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>
# License: MIT (see LICENSE.TXT file)
import datetime
from random import shuffle
from dateutil.parser import parse
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from... | F483/bikesurf.org | apps/bike/views.py | Python | mit | 8,401 |
"""
========================
Plotting Learning Curves
========================
In the first column, first row the learning curve of a naive Bayes classifier
is shown for the digits dataset. Note that the training score and the
cross-validation score are both not very good at the end. However, the shape
of the curve can... | bnaul/scikit-learn | examples/model_selection/plot_learning_curve.py | Python | bsd-3-clause | 6,971 |
#############################################################################
##
## Copyright (c) 2013 Riverbank Computing Limited <info@riverbankcomputing.com>
##
## This file is part of PyQt.
##
## This file may be used under the terms of the GNU General Public
## License versions 2.0 or 3.0 as published by the Fre... | Distrotech/PyQt-x11 | pyuic/uic/port_v3/string_io.py | Python | gpl-2.0 | 1,350 |
# Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | tensorflow/hub | tensorflow_hub/compressed_module_resolver.py | Python | apache-2.0 | 3,271 |
from __future__ import absolute_import
import datetime
import email as eml
from email.parser import Parser
from email.utils import parseaddr, getaddresses, mktime_tz, parsedate_tz
import hashlib
import json
import magic
import re
import yaml
import StringIO
import sys
import olefile
from dateutil.parser import parse ... | seanthegeek/crits | crits/emails/handlers.py | Python | mit | 63,500 |
#!/usr/bin/env python
import logging
import sys
from pyixia import Ixia, Port
def link_state_str(link_state):
prefix = 'LINK_STATE_'
for attr in dir(Port):
if attr.startswith(prefix):
val = getattr(Port, attr)
if val == link_state:
return attr[len(prefix):]
... | jbaltes/python-ixia | examples/discover-chassis.py | Python | lgpl-2.1 | 1,376 |
# -*- coding: utf-8 -*-
""" Tests for bugzilla2fedmsg_schemas.
Authors: Adam Williamson <awilliam@redhat.com>
"""
from unittest import mock
import pytest
from jsonschema.exceptions import ValidationError
import bugzilla2fedmsg.relay
class TestSchemas(object):
# We are basically going to use the relays to ... | fedora-infra/bugzilla2fedmsg | tests/test_schemas.py | Python | lgpl-2.1 | 11,985 |
import numpy as np
import scipy.spatial.distance as ssdistance
def calc_distance_sqerror(arr, dist_func_name='cosine'):
"""
If you get an error, you might have cells with all nan.
"""
dist_func = getattr(ssdistance, dist_func_name)
distance = np.zeros((arr.shape[1], arr.shape[1]))
num_cells = a... | braysia/covertrace | covertrace/utils/sorting.py | Python | mit | 1,581 |
# Copyright 2013 - Mirantis, Inc.
# Copyright 2016 - Brocade Communications Systems, 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/LI... | openstack/mistral-extra | mistral_extra/actions/openstack/utils/context.py | Python | apache-2.0 | 1,246 |
import datetime
from billy.scrape.utils import url_xpath
from billy.utils.fulltext import pdfdata_to_text, text_after_line_numbers
from .bills import IDBillScraper
from .legislators import IDLegislatorScraper
from .committees import IDCommitteeScraper
metadata = {
'name': 'Idaho',
'abbreviation': 'id',
'le... | showerst/openstates | openstates/id/__init__.py | Python | gpl-3.0 | 8,553 |
from time import time
from fb2reader import getBook as getFb2
def getBook(conn, zippath, book_id=None):
book = search(conn, book_id=book_id)
if book['ok']:
if book['result']:
book = book['result'][0]
file_id = book['file']
else:
return {
'ok'... | iliakonnov/flibusta | api.py | Python | gpl-3.0 | 7,639 |
import calendar
from django.db import models
from django.utils.translation import ugettext, ugettext_lazy as _
from dateutil import rrule
from dateutil.relativedelta import weekdays
freqs = (
("YEARLY", _("Yearly")),
("MONTHLY", _("Monthly")),
("WEEKLY", _("Weekly")),
("DAILY", _("Daily")),
)
class Ru... | ixc/glamkit-eventtools | eventtools/models/rule.py | Python | bsd-3-clause | 4,206 |
import numpy as np
from bokeh.models import ColumnDataSource, CustomJSTransform
from bokeh.plotting import figure
from bokeh.io import output_file, show
from bokeh.sampledata.stocks import AAPL, GOOG
def datetime(x):
return np.array(x, dtype=np.datetime64)
plot = figure(x_axis_type="datetime", title="Normalized ... | Karel-van-de-Plassche/bokeh | examples/plotting/file/customjs_transform.py | Python | bsd-3-clause | 1,269 |
import json
from tobytes import tobytes
def tojson(x):
"""
python2/3 compatible conversion to json string
"""
return tobytes(json.dumps(x))
| janmojzis/letsencryptshell | source/tojson.py | Python | cc0-1.0 | 174 |
from datetime import datetime
from itertools import groupby
from pgpdump import BinaryData
from django.db import models
from django.db.models import Q
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from .fields import PositiveBigIntegerField
from .utils import set_created_fie... | ArchAssault-Project/archassaultweb | main/models.py | Python | gpl-2.0 | 17,678 |
from operator import attrgetter
from itertools import groupby
def distinct(sequence):
seen = set()
for i in sequence:
if i not in seen:
seen.add(i)
return seen
def parse_array_of(arr, typ):
"""Safe parse to list of given type"""
if arr is None:
return []
elif isin... | alikhil/pcms-standing-parser | models/standings.py | Python | mit | 4,728 |
#!/usr/bin/env python3
""" """
"""Script to add a location """
from npoapi import MediaBackend, MediaBackendUtil as MU
import requests
import pickle
import os.path
import time
api = MediaBackend().command_line_client()
api.add_argument('mid', type=str, nargs=1, help='The mid of the object to handle')
args = api.par... | npo-poms/scripts | python/netinnederlandAddNTRLocations.py | Python | gpl-2.0 | 2,483 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
'''
Copyright 2014-2015 Teppo Perä
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
Un... | Debith/py3traits | src/pytraits/core/composing/composer.py | Python | apache-2.0 | 5,705 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import copy
import json
import os
import pickle
import unittest
from django.core.exceptions import SuspiciousOperation
from django.core.serializers.json import DjangoJSONEncoder
from django.core.signals import request_finished
from django.db import clo... | iambibhas/django | tests/httpwrappers/tests.py | Python | bsd-3-clause | 26,654 |
try:
from molotov.api import (scenario, setup, global_setup, teardown, # NOQA
global_teardown, setup_session, # NOQA
teardown_session, scenario_picker, # NOQA
events) # NOQA
... | loads/ailoads | molotov/__init__.py | Python | apache-2.0 | 540 |
#!/usr/bin/python
# Copyright: Ansible Project
# 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': ['stableinterfa... | veger/ansible | lib/ansible/modules/cloud/amazon/ec2_ami.py | Python | gpl-3.0 | 27,401 |
from images_operations import calculateTheMostNearImageToMeanImage
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', help='Input folder', required=True)
args = parser.parse_args()
inputFolder = args.input
_, image = calculateTheMostNearImageToMeanImage(inputFolder)
print image | bregydoc/detechAlgorithm | core/mean_image.py | Python | gpl-3.0 | 317 |
#
# Extended field engine for eXe - handles fields and elements easier. This has a standard
# array format that can be used to generate forms / reduce the coding needed for each
# idevice.
#
#
import logging
from exe.engine.idevice import Idevice
from exe.engine.field import TextAreaField
from exe.engine.field i... | pedropena/iteexe | exe/engine/extendedfieldengine.py | Python | gpl-2.0 | 22,546 |
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
'''
Splitting of the XHTML flows. Splitting can happen on page boundaries or can be
forced at "likely" locations to conform to size limitations. This transform
a... | Eksmo/calibre | src/calibre/ebooks/oeb/transforms/split.py | Python | gpl-3.0 | 19,834 |
import unittest
import os, os.path
from gwf.parser import parse
testdir = os.path.dirname(__file__)
class SourceMissing(unittest.TestCase):
def setUp(self):
self.workflow = parse(os.path.join(testdir,'timestamps.gwf'))
def test_source_should_run(self):
source = self.workflow.targets['sour... | runefriborg/gwf2 | tests/test_timestamps.py | Python | gpl-3.0 | 8,291 |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse
from django.shortcuts import render
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_exempt
from django.v... | SphinxKnight/kuma | kuma/core/views.py | Python | mpl-2.0 | 1,861 |
# -*- coding: utf-8 -*-
'''
Specto Add-on
Copyright (C) 2015 lambda
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any l... | repotvsupertuga/tvsupertuga.repository | plugin.video.loganaddon/resources/lib/libraries/control.py | Python | gpl-2.0 | 9,799 |
from __future__ import unicode_literals
from django.contrib.auth.handlers.modwsgi import check_password, groups_for_user
from django.contrib.auth.models import User, Group
from django.test import TransactionTestCase
class ModWsgiHandlerTestCase(TransactionTestCase):
"""
Tests for the mod_wsgi authentication ... | RaoUmer/django | django/contrib/auth/tests/handlers.py | Python | bsd-3-clause | 1,588 |
# -*- coding: utf-8 -*-
"""
line.client
~~~~~~~~~~~
LineClient for sending and receiving message from LINE server.
:copyright: (c) 2014 by Taehoon Kim.
:license: BSD, see LICENSE for more details.
"""
import rsa
import requests
try:
import simplejson as json
except ImportError:
import json... | kimshuye/LINE | line/api.py | Python | bsd-3-clause | 12,045 |
# -*- coding: utf-8 -*-
from odoo import api, fields, models
class HrDepartment(models.Model):
_inherit = 'hr.department'
new_applicant_count = fields.Integer(
compute='_compute_new_applicant_count', string='New Applicant')
new_hired_employee = fields.Integer(
compute='_compute_recruitme... | chienlieu2017/it_management | odoo/addons/hr_recruitment/models/hr_department.py | Python | gpl-3.0 | 1,583 |
#!/usr/bin/env python3
# Copyright (c) 2016-2018 The DigiByte Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import re
import fnmatch
import sys
import subprocess
import datetime
import os
#######################... | digibyte/digibyte | contrib/devtools/copyright_header.py | Python | mit | 22,482 |
# -*- coding: utf-8 -*-
#
# Copyright 2016 Taŭga Tecnologia
# Aristides Caldeira <aristides.caldeira@tauga.com.br>
# License AGPL-3 or later (http://www.gnu.org/licenses/agpl)
#
from __future__ import division, print_function, unicode_literals
from odoo import fields, models
from odoo.addons.l10n_br_base.models.spe... | odoo-brazil/l10n-brazil-wip | sped/models/sped_documento_item_declaracao_importacao.py | Python | agpl-3.0 | 2,534 |
from strings import string_is_rectangular, string_join_horizontal
from random import choice
SNOWMAN = '\n'.join(
(' HHHHH ',
' HHHHH ',
'X(LNR)Y',
'X(TTT)Y',
' (BBB) ')
)
HAT = [
(r' '
r'_===_'),
(r' ___ '
r'.....'),
(r' _ '
r' /_\ '),
(r' ___ '
r'(_*_)')
]
NOSE = ',._ '
EYE_LE... | mkrieger1/snowman | snowman.py | Python | gpl-2.0 | 1,912 |
# -*- coding: utf-8 -*-
"""
tests.fixers
~~~~~~~~~~~~
Server / Browser fixers.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from tests import strict_eq
from werkzeug.datastructures import ResponseCacheControl
from werkzeug.http import parse_cache_control... | deadly11ama/werkzeug | tests/contrib/test_fixers.py | Python | bsd-3-clause | 7,009 |
#Interface to access CK+ data set within python
import cv2
import os
from data import FACDatum, FACLabel
from data.repositories import FACRepository
from util.paths import DataLoc
import util.constants as ks
FAC_DATA = 'fac_data'
BUFFER_SIZE = 50
IMAGE_EXT = '.jpg'
class CKRepository(FACRepository):
""" Repositor... | cosanlab/emote | src/data/repositories/ck.py | Python | mit | 2,101 |
import wx
import eos.db
import gui.mainFrame
from gui import globalEvents as GE
from service.fit import Fit
from .calc.fitRebaseItem import FitRebaseItemCommand
from .calc.fitSetCharge import FitSetChargeCommand
class GuiRebaseItemsCommand(wx.Command):
def __init__(self, fitID, rebaseMap):
wx.Command.__... | blitzmann/Pyfa | gui/fitCommands/guiRebaseItems.py | Python | gpl-3.0 | 1,962 |
VERSION = "1.4.2"
# noinspection PyBroadException
try:
from subprocess import check_output, DEVNULL
GIT_VERSION = check_output(["git", "describe", "--tags", "--always"], stderr=DEVNULL).decode().strip().lstrip("v")
except:
GIT_VERSION = VERSION
| danielhers/tupa | tupa/__version__.py | Python | gpl-3.0 | 257 |
from __future__ import absolute_import, unicode_literals
import random
import mock
from mopidy.models import Playlist, Ref, Track
from mopidy.mpd.protocol import stored_playlists
from tests.mpd import protocol
class IssueGH17RegressionTest(protocol.BaseTestCase):
"""
The issue: http://github.com/mopidy/m... | diandiankan/mopidy | tests/mpd/protocol/test_regression.py | Python | apache-2.0 | 7,175 |
from django import forms
from django.contrib.auth.models import User
from materials.models import Test
class AnalyticsUserTestForm(forms.Form):
user = forms.ModelChoiceField(queryset=User.objects.all())
test = forms.ModelChoiceField(queryset=Test.objects.all())
| starkdee/courseware | analytics/forms.py | Python | mit | 272 |
# PyTransit: fast and easy exoplanet transit modelling in Python.
# Copyright (C) 2010-2019 Hannu Parviainen
#
# 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 Licen... | hpparvi/PyTransit | pytransit/version.py | Python | gpl-2.0 | 830 |
## Copyright 2005-2007 Virtutech AB
##
## The contents herein are Source Code which are a subset of Licensed
## Software pursuant to the terms of the Virtutech Simics Software
## License Agreement (the "Agreement"), and are being distributed under
## the Agreement. You should have received a copy of the Agreem... | iniverno/RnR-LLC | simics-3.0-install/simics-3.0.31/amd64-linux/lib/python/mod_ppc32_linux_process_tracker_gcommands.py | Python | gpl-2.0 | 3,988 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.model.naming import append_number_if_name_exists
from frappe.website.utils import cleanup_page_name
from fr... | gangadhar-kadam/smrterpfrappe | frappe/website/website_generator.py | Python | mit | 4,308 |
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!\n'
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)
| hngkr/devops | docker/code/app.py | Python | apache-2.0 | 172 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.