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
import os
import sys
import logging
import unittest
sys.path.insert(0, os.path.abspath(".."))
sys.path.insert(0, os.path.abspath("../problem/.libs")) # because of _pyabrt
os.environ["PATH"] = "{0}:{1}".format(os.path.abspath(".."), os.environ["PATH"])
from nose import tools
from base import Pr... | mhabrnal/abrt | src/python-problem/tests/test_get.py | Python | gpl-2.0 | 944 |
from globals import *
import libtcodpy as tcod
import alife
import life
def create_menu(menu=[], position=[0,0], title='Untitled', format_str='$k: $v', padding=MENU_PADDING,
on_select=None, on_change=None, on_close=None, on_move=None, dim=True, alignment='', action=None,
close_on_sele... | flags/Reactor-3 | menus.py | Python | mit | 10,705 |
from . import base
from . import mixins
from datetime import date
class TransformedRecord(
mixins.GenericCompensationMixin,
mixins.GenericDepartmentMixin, mixins.GenericIdentifierMixin,
mixins.GenericJobTitleMixin, mixins.GenericPersonMixin,
mixins.MembershipMixin, mixins.Organization... | texastribune/tx_salaries | tx_salaries/utils/transformers/houston.py | Python | apache-2.0 | 3,915 |
from setuptools import setup
setup(
name='pyqode-uic',
version='0.1.1',
py_modules=['pyqode_uic'],
url='https://github.com/pyQode/pyqode-pyuic',
license='MIT',
author='Colin Duquesnoy',
author_email='colin.duquesnoy',
description='pyQode Qt ui compiler',
entry_points={
'cons... | pyQode/pyqode-uic | setup.py | Python | mit | 958 |
import traceback
import sys
try:
from django.apps import AppConfig
except ImportError:
AppConfig = object
class WooeyConfig(AppConfig):
name = 'wooey'
verbose_name = 'Wooey'
def ready(self):
from .backend import utils
try:
utils.load_scripts()
except:
... | wooey/django-djangui | wooey/apps.py | Python | bsd-3-clause | 434 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v10/resources/types/conversion_value_rule_set.py | Python | apache-2.0 | 4,631 |
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
import excel
from models import *
from forms import *
from decorators import super... | alextreme/Django-Bingo | querybuilder/views.py | Python | bsd-3-clause | 4,415 |
# fail early, fail often
import cairo # noqa:F401
| tdsmith/elisascripts | elisa/__init__.py | Python | bsd-3-clause | 51 |
#import OpenGL
#OpenGL.FULL_LOGGING = True
import functools
import logging
from PySide.QtOpenGL import QGLFormat
logging.basicConfig()
LOG = logging.getLogger(__name__)
from time import time
from PySide import QtCore, QtGui
from UI import QAppCtx, QGLView, QTimeline, createAction
from UI.QGLViewer import Camera
from U... | davidsoncolin/IMS | Example/GViewer.py | Python | mit | 10,433 |
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
import sys
import matplotlib.pyplot as plt
sys.path.append("../")
from controller.Controller_Result_Experiment import ControllerScreenResultExperiment
from Window import Main, Gtk, GdkPixbuf
controller = ControllerScreenResultExperiment()
class WindowResultExperime... | Experiments-Data-Base-Managment/data-base-managment | view/Screen_Result_Experiment.py | Python | gpl-3.0 | 5,238 |
from jinja2 import Environment, PackageLoader
env = Environment(
loader=PackageLoader('.', 'templates'),
)
def render(name, **kwargs):
return env.get_template(f'{name}.tmplt').render(**kwargs).split('\n')
| ttaanngg/petal | uniform_model/functions/utils.py | Python | bsd-3-clause | 216 |
# -*- test-case-name: twisted.test.test_stdio.StandardInputOutputTestCase.test_consumer -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Main program for the child process run by
L{twisted.test.test_stdio.StandardInputOutputTestCase.test_consumer} to test
that process transports implemen... | waseem18/oh-mainline | vendor/packages/twisted/twisted/test/stdio_test_consumer.py | Python | agpl-3.0 | 1,113 |
"""The tests for the Mikrotik device tracker platform."""
from datetime import timedelta
from homeassistant.components import mikrotik
import homeassistant.components.device_tracker as device_tracker
from homeassistant.helpers import entity_registry
from homeassistant.setup import async_setup_component
import homeassi... | partofthething/home-assistant | tests/components/mikrotik/test_device_tracker.py | Python | apache-2.0 | 4,677 |
# -*- coding: utf-8 -*-
"""
signals.py - module containing Signal class
**Classes**
* Signal - signal class for data objects
Created on Tue Jun 23 2015
@author: hyuh
"""
from __future__ import print_function
from .globals import FdpError
import numpy as np
import types
import inspect
import sys
if sys.version_info ... | drsmith48/fdp | fdp/lib/signal.py | Python | mit | 10,302 |
#!/usr/bin/env python
# Copyright (c) 2003 Phil Gregory
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This pro... | yuxans/badgirl | src/coin.py | Python | gpl-2.0 | 1,861 |
#
# Copyright (c) 2008-2015 Citrix 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/LICENSE-2.0
#
# Unless required by applicable l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/aaa/aaauser_vpntrafficpolicy_binding.py | Python | apache-2.0 | 6,888 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-29 21:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mturk', '0005_remove_mturkassignment_worker_id'),
]
operations = [
migrations.... | aginzberg/crowdsource-platform | mturk/migrations/0006_auto_20160129_2154.py | Python | mit | 543 |
#Domain managing
import sys
import os
import threading
#from distutils.core import setup
#import py2exe
#setup(console=['domain_management.py'])
domains = []
path = os.getcwd()
#print(path)
if(os.path.exists(path+"\conf") and os.path.isdir(path+"\conf")):
path = path + "\conf"
path = path + ... | astinaam/Server | Server_Final/bin/domain_management.py | Python | mit | 2,699 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tombstone/models | research/object_detection/utils/dataset_util_test.py | Python | apache-2.0 | 1,416 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright 2015, Durachenko Aleksey V. <durachenko.aleksey@gmail.com>
#
# 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 Lice... | AlekseyDurachenko/podfmdog | src/podfmdog_ctl.py | Python | gpl-3.0 | 3,769 |
import os
import re
class ConfigType:
"""Enum-like class that represents the Configuration Type"""
LOCAL = 0
REMOTE = 1
@staticmethod
def name(type):
if ConfigType.LOCAL == type:
return "local"
elif ConfigType.REMOTE == type:
return "remote"
else:
return "unknown"
class Conf... | marvinfy/YABM | config.py | Python | gpl-3.0 | 4,321 |
"""
scikit-learn copy of scipy/sparse/linalg/eigen/lobpcg/lobpcg.py v1.8.0
to be deleted after scipy 1.3.0 becomes a dependency in scikit-lean
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Locally Optimal Block Preconditioned Conjugate Gradient Method (LOBPCG).
References
----------
.. [1] A... | manhhomienbienthuy/scikit-learn | sklearn/externals/_lobpcg.py | Python | bsd-3-clause | 27,320 |
"""Test the TcEx API Module."""
# standard library
import time
from datetime import datetime, timedelta
from random import randint
# third-party
import pytest
from pytest import FixtureRequest
# first-party
from tcex.api.tc.v3.tql.tql_operator import TqlOperator
from tests.api.tc.v3.v3_helpers import TestV3, V3Helper... | ThreatConnect-Inc/tcex | tests/api/tc/v3/artifacts/test_artifact_interface.py | Python | apache-2.0 | 24,882 |
#!/usr/bin/env python
"""
A basic example of how to get a password from the default
keyring of you environment.
"""
import keyring
password = keyring.get_password(u"dummyapp", u"mark.veltzer@gmail.com")
print("your password is [{}]".format(password))
| veltzer/demos-python | src/examples/short/keyring/get.py | Python | gpl-3.0 | 253 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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,... | bcorbet/SickRage | sickbeard/classes.py | Python | gpl-3.0 | 7,984 |
import os
from ftplib import FTP
import sys
import getpass
from tkinter import *
def clearScreen():
os.system('cls')
def connect(host, user, passwd):
try:
ftp = FTP(host)
ftp.login(user=user, passwd=passwd)
print("Successfully connected to " + host + " as " + user + "...")
retu... | zach-king/Python-Miscellaneous | Networking/ftpClient.py | Python | gpl-2.0 | 3,235 |
from distutils.core import setup
import os
# Stolen from django-registration
# Compile the list of packages available, because distutils doesn't have
# an easy way to do this.
packages, data_files = [], []
root_dir = os.path.dirname(__file__)
if root_dir:
os.chdir(root_dir)
for dirpath, dirnames, filenames in os.... | texastribune/tt_disposal_wells | setup.py | Python | apache-2.0 | 1,566 |
# (c) Crown Owned Copyright, 2016. Dstl.
import csv
from django import forms
from django.core.urlresolvers import reverse
from django.db.models import Count
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect
from django.utils import timezone
from django.utils.text import ... | dstl/lighthouse | apps/links/views.py | Python | mit | 11,986 |
from src import cron
from src.api import Api
api = Api()
def fetch_photo():
api.fetch_photo()
@cron.route('/worker', methods=['GET'])
def scheduler_worker():
fetch_photo()
return 'fetch photo...'
| Assassinss/daily-artwork | src/worker.py | Python | gpl-3.0 | 229 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This script understands various command-line arguments:
Task commands:
-featured use this script for featured articles. Default task if no task
command is specified
-good use this script for good articles.
-lists use thi... | legoktm/pywikipedia-rewrite | scripts/featured.py | Python | mit | 26,345 |
import pytest
from os import getcwd, listdir, mkdir
from os.path import join, isfile, isdir, getsize
from apio.commands.install import cli as cmd_install
from apio.commands.uninstall import cli as cmd_uninstall
from apio.commands.init import cli as cmd_init
from apio.commands.upload import cli as cmd_upload
from apio... | set-soft/apio | test/packages/test_complete.py | Python | gpl-2.0 | 6,054 |
import numpy as np
import cv2
img = cv2.imread('check_video.png')
dst = cv2.fastNlMeansDenoisingColored(img, None, 10, 10, 7, 21)
cv2.imshow('before', img)
cv2.imshow('after', dst)
cv2.waitKey(0)
| FYP-DES5/deepscan-core | misc/Denoiser2D.py | Python | mit | 199 |
from flask.ext.wtf import Form
from wtforms import TextField, PasswordField, TextAreaField, SelectField, BooleanField, IntegerField
from wtforms.validators import Required
class LoginForm(Form):
username = TextField('username', validators = [Required()])
password = PasswordField('password', validators = [Requi... | TinnedTuna/speakeasyspeeches | wsgi/speakeasy/forms.py | Python | bsd-2-clause | 1,385 |
from imports import *
from sklearn.datasets import load_iris
iris_dataset = load_iris()
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
X_train, X_test, y_train, y_test = train_test_split(iris_dataset["data"], iris_dataset["target"], random_state=0)
knn = KNeig... | TNT-Samuel/Coding-Projects | Machine Learning with Python/Chapter 1/P_31.py | Python | gpl-3.0 | 450 |
from django import forms
from django.contrib import admin
from bluechannel.page.models import Highlight, Type, Event, Template, Page
class HighlightAdmin(admin.ModelAdmin):
save_on_top = True
pass
admin.site.register(Highlight, HighlightAdmin)
class TypeAdmin(admin.ModelAdmin):
save_on_top = True
pas... | davemerwin/blue-channel | bluechannel/page/admin.py | Python | bsd-3-clause | 1,616 |
# Copyright (c) 2015 Cloudbase Solutions SRL
# 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
#
# Unle... | jcsp/manila | manila/share/drivers/windows/windows_smb_helper.py | Python | apache-2.0 | 6,517 |
#(C) Copyright Syd Logan 2016
#(C) Copyright Thousand Smiles Foundation 2016
#
#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 a... | slogan621/tscharts | queue/urls.py | Python | apache-2.0 | 735 |
import os
import unittest
import uuid
import floe
import webtest
import json
import wsgiadapter
import logging
import socket
import floe.restapi
import floe.connector
import time
import pymysql
wsgiadapter.logger.addHandler(logging.NullHandler())
mysql_user = os.getenv('MYSQL_USER', 'root')
mysql_pass = os.getenv('MY... | happybits/floe | test.py | Python | mit | 11,685 |
KARMA_COST_NEW_TOPIC = 0
KARMA_COST_NEW_LINK = 0
SITE = 'reddit.com'
MAX_CHANGE_PER_VOTE = 10
DEFAULT_PROFILE_KARMA = 20
CREATORS_KARMA_PER_VOTE = 1
DAMP_FACTOR = 1.1
DAMPEN_POINTS_AFTER = 100
TOP_TOPICS_ON_MAINPAGE = 3
NEW_TOPICS_ON_MAINPAGE = 3
TAGS_ON_MAINPAGE = 3
DATE_FORMAT = '%Y-%m-%d'
CALCULATE... | agiliq/django-socialnews | socialnews/news/defaults.py | Python | bsd-3-clause | 1,029 |
from jinja2 import Template
from autonetkit.design.utils import filters
from autonetkit.design.utils.filters import find_node_by_label
from autonetkit.design.utils.general import group_by
from autonetkit.design.utils.graph_utils import topology_to_nx_graph, wrap_node_ids
from autonetkit.network_model.network_model imp... | sk2/autonetkit | autonetkit/tutorial/tutorial.py | Python | bsd-3-clause | 7,027 |
# Copyright (c) 2012-2013 Paul Tagliamonte <paultag@debian.org>
#
# 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, ... | Debian/debile | debile/master/incoming_changes.py | Python | mit | 9,566 |
from project import app, db
from flask_testing import TestCase
from flask import url_for
from project.config import TestConfig
from project.models import User
import json
class UserTestSetup(TestCase):
def create_app(self):
app.config.from_object(TestConfig)
return app
def setUp(self):
... | lingxz/todoapp | project/users/user_test.py | Python | mit | 6,148 |
# Copyright 2016 IBM Corp.
#
# 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 a... | powervm/pypowervm | pypowervm/tests/tasks/test_vopt.py | Python | apache-2.0 | 7,973 |
# -*- coding: utf-8 -*-
"""
使用文本
"""
import numpy as np
import matplotlib.pyplot as plt
# 随机数种子
np.random.seed(19680801)
mu, sigma = 100, 15
x = mu + sigma * np.random.randn(10000)
plt.figure(1)
plt.subplot(211)
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)
plt.xlabel('x')
plt.ylabel('... | zhoujiagen/giant-data-analysis | data-computing-giants/python-computing/src/gda/matplotlib/text.py | Python | mit | 761 |
#!/usr/bin/env python
import couchdb
import json
import argparse
import logbook
import sys
import os
import yaml
import base64
from Crypto.Cipher import AES
from couchdb import PreconditionFailed
#Set up logging
l = logbook.Logger('CouchDB-Replicator')
class AESDecrypt():
def __init__(self, key):
sel... | vezzi/standalone_scripts | couchdb_replication.py | Python | mit | 10,270 |
# -*- coding: utf-8 -*-
#
# Doqu is a lightweight schema/query framework for document databases.
# Copyright © 2009—2010 Andrey Mikhaylenko
#
# This file is part of Docu.
#
# Doqu is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as pub... | neithere/doqu | doqu/ext/forms.py | Python | gpl-3.0 | 11,916 |
#!/usr/bin/env python2.7
import cgi
import json
import os
import re
import SimpleHTTPServer
import SocketServer
import subprocess
import sys
import threading
VERSION = 'v0.14.6'
hostname = ''
try:
command = "bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || wget -q -O - icanhazip.com'"
hostname = s... | alexquick/dokku | contrib/dokku-installer.py | Python | mit | 13,390 |
from mock import MagicMock, patch
from . import unittest
from kafka import SimpleConsumer, KafkaConsumer, MultiProcessConsumer
from kafka.common import (
KafkaConfigurationError, FetchResponsePayload, OffsetFetchResponsePayload,
FailedPayloadsError, OffsetAndMessage,
NotLeaderForPartitionError, UnknownTop... | gamechanger/kafka-python | test/test_consumer.py | Python | apache-2.0 | 5,524 |
# 442. Find All Duplicates in an Array
# DescriptionHintsSubmissionsDiscussSolution
# DiscussPick One
# Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
#
# Find all the elements that appear twice in this array.
#
# Could you do it without extra space an... | shawncaojob/LC | PY/442_find_all_duplicates_in_an_array.py | Python | gpl-3.0 | 786 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 CERN.
##
## Invenio 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 ve... | pombredanne/invenio | modules/bibformat/lib/bibformat_engine_tests.py | Python | gpl-2.0 | 40,916 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, CRS4
#
# 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,... | lucalianas/ProMort | promort/slides_manager/migrations/0006_slidequalitycontrol_notes.py | Python | mit | 1,522 |
# -*- 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-service-management | samples/generated_samples/servicemanagement_v1_generated_service_manager_create_service_sync.py | Python | apache-2.0 | 1,564 |
from abc import abstractmethod
from threading import Lock
from typing import TYPE_CHECKING, Dict
from treehopper.api.device_commands import DeviceCommands
from treehopper.api.interfaces import DigitalOut, Pwm, AdcPin, DigitalIn
if TYPE_CHECKING:
from treehopper.api.treehopper_usb import TreehopperUsb, Pin
class... | treehopper-electronics/treehopper-sdk | Python/treehopper/api/pin.py | Python | mit | 19,107 |
# (C) Copyright 2014-2015 Hewlett Packard Enterprise Development Company LP
#
# 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 requir... | sapcc/python-monascaclient | monascaclient/ksclient.py | Python | apache-2.0 | 4,615 |
#!/usr/bin/env python
# Copyright 2020 Google
#
# 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 agr... | firebase/firebase-cpp-sdk | scripts/gha/install_prereqs_desktop.py | Python | apache-2.0 | 3,388 |
#!/usr/bin/env python
from setuptools import setup, find_packages
tests_require = [
]
setup(
name='kleenex',
version='0.15.0',
author='David Cramer',
author_email='dcramer@gmail.com',
description='A discovery plugin for Nose which relies on code coverage.',
url='http://github.com/dcramer/klee... | dcramer/kleenex | setup.py | Python | apache-2.0 | 1,030 |
# 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) 2014 Mozilla Corporation
#
# Contributors:
# Jeff Bryner jbryner@mozilla.com
import os
import sys
from c... | serbyy/MozDef | rest/plugins/facebookThreatExchange.py | Python | mpl-2.0 | 6,352 |
#!/usr/bin/env zmpython
#
# ***** BEGIN LICENSE BLOCK *****
# Zimbra Collaboration Suite Server
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Zimbra, Inc.
#
# The contents of this file are subject to the Zimbra Public License
# Version 1.3 ("License"); you may not use this file except in
# compliance w... | nico01f/z-pec | ZimbraServer/src/libexec/client_usage_report.py | Python | mit | 2,449 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0026_auto_20151014_0813'),
]
operations = [
migrations.AlterField(
model_name='problem',
na... | Alaxe/judgeSystem | judge/migrations/0027_auto_20151014_0817.py | Python | gpl-2.0 | 814 |
'''
This illustrates the NonUniformImage class, which still needs
an axes method interface; either a separate interface, or a
generalization of imshow.
'''
from matplotlib.pyplot import figure, show
import numpy as np
from matplotlib.image import NonUniformImage
from matplotlib import cm
interp = 'nearest'
x = np.li... | bundgus/python-playground | matplotlib-playground/examples/pylab_examples/image_nonuniform.py | Python | mit | 1,509 |
# -*- coding: utf-8 -*-
import pyvabamorf.vabamorf as vm
import atexit
if not vm.FSCInit():
raise Exception('Could not initiate pyvabamorf library. FSCInit() returned false!')
@atexit.register
def terminate():
vm.FSCTerminate()
from morf import analyze, synthesize
from morf import PyVabamorf
| estnltk/pyvabamorf | pyvabamorf/__init__.py | Python | lgpl-3.0 | 304 |
# Copyright 2015 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | ruyang/ironic | ironic/objects/fields.py | Python | apache-2.0 | 4,120 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | rcbops/melange-buildpackage | melange/ipv4/db_based_ip_generator.py | Python | apache-2.0 | 1,576 |
"""
Wrapper for loading templates from "static" templates directories in INSTALLED_APPS
packages. (Code borrowed from django.template.loaders.app_directories.py)
"""
import os
import sys
from django.apps import apps
from django.conf import settings
from django.template import TemplateDoesNotExist
from django.template... | storeys/django-storeys | storeys/templateloaders.py | Python | bsd-2-clause | 2,341 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ve... | sparkslabs/kamaelia_ | Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/Apps/JsonRPC/BDJsonRPC.py | Python | apache-2.0 | 35,300 |
#
# 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/google/cloud/hooks/kms.py | Python | apache-2.0 | 6,513 |
# 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 https://mozilla.org/MPL/2.0/.
from __future__ import print_function, unicode_literals
import os
import platform
import sys
from distutils.spawn impo... | DominoTree/servo | python/mach_bootstrap.py | Python | mpl-2.0 | 10,973 |
#!/usr/bin/env python
# Calculate the 1000th element of the Fibonacci series. Fast.
# (Another popular tech interview question.)
import numpy;
# Definition of Fibonacci numbers:
# F(1) = 1
# F(2) = 1
# For n = 3, 4, 5, ...: F(n) = F(n-2) + F(n-1).
# Method one: recursion.
# Very inefficient: F(n) is called once, it ... | bencebeky/etudes | fibonacci.py | Python | gpl-3.0 | 3,792 |
import binascii
import base64
import dateutil.parser
from datetime import timezone
from rest_framework.decorators import api_view
from rest_framework import status
from rest_framework.response import Response
from appliances.models import Appliance
from appliances.reading import (new_reading_from_data,
... | piotrb5e3/Dyeus | collect/views.py | Python | gpl-3.0 | 3,159 |
import websocket
import json
import time
from threading import Thread
class OBSRemoteSwitcher():
"""Handler to talk to OBSRemote by websocket.
Handles authentication, SceneChanges and SceneUpdates
"""
def switch_to_scene(self, scene):
# Set the current scene
data = {"request-... | sistason/dota2_overlayswitcher | utils/sceneswitcher_obsremote.py | Python | gpl-2.0 | 3,613 |
#!/usr/bin/env python
"""
orfTest.py
Author: Tony Papenfuss
Date: Tue Aug 22 20:14:57 EST 2006
"""
import os, sys
import fasta, sequence
header,seq = fasta.load('NKC.fa')
orfIterator = fasta.load_iter('ORFs.fa')
writer = fasta.MfaWriter('ORFs2.fa')
for h,orf in orfIterator:
chrom,block,orfId,limits = h.split... | PapenfussLab/Mungo | snippets/orfTest.py | Python | artistic-2.0 | 721 |
from flask import Blueprint
posts = Blueprint('posts', __name__)
from . import routes
| goalong/flask-demo | app/posts/__init__.py | Python | mit | 89 |
# This file is part of Androguard.
#
# Copyright (c) 2012 Geoffroy Gueguen <geoffroy.gueguen@gmail.com>
# 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://... | 0x0mar/androguard | androguard/decompiler/dad/graph.py | Python | apache-2.0 | 17,086 |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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 applicable... | vthorsteinsson/tensor2tensor | tensor2tensor/models/research/lm_experiments.py | Python | apache-2.0 | 4,751 |
import numpy as np
import pandas
import os
import pdb
#pdb.set_trace()
dircount = 0
rootdirs = os.walk('.').next()[1]
mean_mat = np.zeros((193,len(rootdirs)))
se_mat = np.zeros((193,len(rootdirs)))
N_mat = np.zeros((3,len(rootdirs)))
#for each directory found, iterate round...
for myrootdir in rootdirs:
myfi... | biol75/PER | video_analysis/align_graph.py | Python | mit | 7,276 |
# Copyright 2022. ThingsBoard
#
# 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 ... | thingsboard/thingsboard-gateway | thingsboard_gateway/gateway/tb_client.py | Python | apache-2.0 | 5,963 |
# encoding=utf-8
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2016 Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de>
# Copyright (C) 2016 Marek Marczykowski-Górecki
# <marmarek@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or mod... | marmarek/qubes-core-mgmt-client | qubesadmin/tools/qvm_device.py | Python | lgpl-2.1 | 11,687 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-19 20:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('experiments_manager', '0006_experiment_public'),
]
operations = [
migration... | MOOCworkbench/MOOCworkbench | experiments_manager/migrations/0007_experiment_publish_url_zip.py | Python | mit | 468 |
import pytest
from unittest import mock
from django.core.urlresolvers import reverse
from django.core import mail
from taiga.base.utils import json
from taiga.hooks.github import event_hooks
from taiga.hooks.github.api import GitHubViewSet
from taiga.hooks.exceptions import ActionSyntaxException
from taiga.projects.... | 19kestier/taiga-back | tests/integration/test_hooks_github.py | Python | agpl-3.0 | 16,224 |
#!/usr/bin/env python3
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
import json
import argparse
import os, sys
# Parsing Elastic Search documents to Vespa documents
# Example of usage: python ES_Vespa_parser.py my_index.json my_index_mapping.json
__author__ =... | vespa-engine/vespa | config-model/src/main/python/ES_Vespa_parser.py | Python | apache-2.0 | 8,528 |
# Copyright: (c) 2013, James Cammarata <jcammarata@ansible.com>
# Copyright: (c) 2018, 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
import os.path
import re
import sh... | anryko/ansible | lib/ansible/cli/galaxy.py | Python | gpl-3.0 | 60,443 |
from django.db import models
from sigma_core.models.custom_field import CustomField
from sigma_core.models.group_field import GroupField
class Group(models.Model):
#########################
# Constants and choices #
#########################
##########
# Fields #
##########
name = models... | ProjetSigma/backend | sigma_core/models/group.py | Python | agpl-3.0 | 2,650 |
fib = [1, 2]
while fib[-1] < 4000000:
fib.append(fib[-1] + fib[-2])
print(sum((el for el in fib if el % 2 == 0)))
| maxiimou/project_euler | exercice2.py | Python | lgpl-3.0 | 119 |
import sys
import redis
import logging
import threading
from polling_engine.src import config
from polling_engine.src import core
class Listener(threading.Thread):
def __init__(self, rds, channels):
threading.Thread.__init__(self)
self.redis = rds
self.pubsub = self.redis.pubsub()
... | pythias-io/polling_engine | src/main.py | Python | apache-2.0 | 1,498 |
import random
from axelrod import Actions
def random_choice(p=0.5):
"""
Return 'C' with probability `p`, else return 'D'
Emulates Python's random.choice(['C', 'D']) since it is not consistent
across Python 2.7 to Python 3.4"""
r = random.random()
if r < p:
return Actions.C
return ... | marcharper/Axelrod | axelrod/random_.py | Python | mit | 528 |
from bcbio.ngsalign.bowtie2 import filter_multimappers
def clean_chipseq_alignment(data):
config = data["config"]
aligner = config["algorithm"].get("aligner", None)
assert aligner == "bowtie2", "ChIP-seq only supported for bowtie2."
if aligner == "bowtie2":
work_bam = filter_multimappers(data[... | hjanime/bcbio-nextgen | bcbio/chipseq/__init__.py | Python | mit | 393 |
from django.contrib.auth.models import User
from django.db import models
from django.core.urlresolvers import reverse_lazy
import datetime
MAX_CHAR_LENGTH = 50
COUNTY_OPTIONS = (
("Alamance", "Alamance"),
("Forsyth", "Forsyth"),
("Guilford", "Guilford"),
("Montgomery", "Montgomery"),
("Randolph"... | Bryconc/JA-Social | ja_social/models.py | Python | mit | 3,327 |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015 Daniel Rodriguez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pub... | nicoddemus/backtrader | tests/test_ind_momentumoscillator.py | Python | gpl-3.0 | 1,621 |
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('misc',parent_package,top_path)
config.add_data_files('*.dat')
config.add_data_dir('tests')
return config
if __name__ == '__main__':
from numpy.distutils.core import ... | WarrenWeckesser/scipy | scipy/misc/setup.py | Python | bsd-3-clause | 375 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
def allSame(s):
return not any(filter(lambda x: x != s[0], s))
def hasDigit(s):
return any(char.isdigit() for char in s)
def getVersion(data):
"""
Parse version from changelog written in RST format.
"""
da... | edeposit/edeposit.amqp.models | docs/__init__.py | Python | mit | 520 |
# -*- coding: utf-8 -*-
# (c) 2017 Diagram Software S.L.
# (c) 2017 Consultoría Informática Studio 73 S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import api, models, fields, _
class L10nEsAeatSii(models.Model):
_name = 'l10n.es.aeat.sii'
name = fields.Char(string="Name")
... | acysos/odoo-addons | l10n_es_aeat_sii/models/aeat_sii.py | Python | agpl-3.0 | 1,679 |
import os
import commands
import sys
import json
from optparse import OptionParser
global CROSSWALK_VERSION
with open("../../tools/VERSION", "rt") as pkg_version_file:
pkg_version_raw = pkg_version_file.read()
pkg_version_file.close()
pkg_version_json = json.loads(pkg_version_raw)
CROSSWALK_VERSION = pk... | JianfengXu/crosswalk-test-suite | usecase/usecase-cordova-android-tests/samples/SharedModeLibraryDownload4.x/res/test.py | Python | bsd-3-clause | 3,685 |
#!/usr/bin/python
import kudzu
devices = kudzu.probe (kudzu.CLASS_MOUSE,
kudzu.BUS_UNSPEC,
kudzu.PROBE_ONE);
for device in devices:
# (dev, driver, desc) = device
print device
| fullstory-morgue/kudzu-kanotix | testit.py | Python | gpl-2.0 | 232 |
"""
Copyright (2010-2014) INCUBAID BVBA
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, so... | Incubaid/arakoon | pylabs/extensions/arakoon_ext/server/RemoteControlProtocol.py | Python | apache-2.0 | 2,133 |
# -*- 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-network-connectivity | google/cloud/networkconnectivity_v1/services/hub_service/async_client.py | Python | apache-2.0 | 55,234 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('virtualfolder', '0003_drop_virtualfolder_ordering'),
]
operations = [
migrations.RemoveField(
model_name='virtua... | Avira/pootle | pootle/apps/virtualfolder/migrations/0004_rename_is_browsable_to_is_public.py | Python | gpl-3.0 | 664 |
# Copyright (c) 2012 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.
import sys
from docs_server_utils import ToUnicode
from file_system import FileNotFoundError
from future import Future
from path_util import AssertIsDir... | s20121035/rk3288_android5.1_repo | external/chromium_org/chrome/common/extensions/docs/server2/compiled_file_system.py | Python | gpl-3.0 | 10,792 |
#
# (c) 2015, Peter Sprygada <psprygada@ansible.com>
#
# 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, or
# (at your option) any late... | yesbox/ansible | lib/ansible/utils/module_docs_fragments/nxos.py | Python | gpl-3.0 | 2,822 |
"""Support for Spider Smart devices."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.const import (
CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.discovery import load_platform
REQUIRE... | HydrelioxGitHub/home-assistant | homeassistant/components/spider/__init__.py | Python | apache-2.0 | 1,643 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'State'
db.create_table(u'analytics_state', (
(u'id', self.gf('django.db.models.f... | arpitprogressive/arpittest | apps/analytics/migrations/0001_initial.py | Python | bsd-3-clause | 9,867 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.