text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2014-02-07 17:05:11
import itertools
import json
import logging
import os
import time
from collections import deque
from six import iteritems, itervalues... | nicozhang/pyspider | pyspider/scheduler/scheduler.py | Python | apache-2.0 | 46,109 | 0.001431 |
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenSesame is distri... | smathot/qnotero | libqnotero/qt/QtCore.py | Python | gpl-2.0 | 777 | 0.003861 |
# -*- 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 field 'Category.description'
db.add_column('submissions_category', 'description',
... | mozilla/gameon | gameon/submissions/migrations/0005_auto__add_field_category_description.py | Python | bsd-3-clause | 6,583 | 0.007899 |
# Author: Vikram Raman
# Date: 09-12-2015
import time
# edit distance between two strings
# e(i,j) = min (1 + e(i-1,j) | 1 + e(i,j-1) | diff(i,j) + e(i-1,j-1))
def editdistance(s1, s2):
m = 0 if s1 is None else len(s1)
n = 0 if s2 is None else len(s2)
if m == 0:
return n
elif n == 0:
... | vikramraman/algorithms | python/editdistance.py | Python | mit | 928 | 0.017241 |
#!/usr/bin/env python
# coding:utf-8
# Copyright (c) 2011, Vadim Velikodniy <vadim-velikodniy@yandex.ru>
#
# This library 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 2.1 of the Lic... | velikodniy/python-fotki | fotki/user.py | Python | lgpl-3.0 | 3,334 | 0.002105 |
# coding: utf-8
# # Pipeline processing using serial workflows.
#
# This notebook demonstrates the continuum imaging and ICAL pipelines. These are based on ARL functions wrapped up as SDP workflows using the serial class.
# In[1]:
#get_ipython().run_line_magic('matplotlib', 'inline')
import os
import sys
sys.pa... | SKA-ScienceDataProcessor/algorithm-reference-library | deprecated_code/workflows/mpi/imaging-pipelines_serial.py | Python | apache-2.0 | 12,979 | 0.018106 |
# Copyright (C) 2011 REES Marche <http://www.reesmarche.org>
#
# This file is part of ``django-flexi-auth``.
# ``django-flexi-auth`` is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the Lic... | seldon/django-flexi-auth | flexi_auth/tests/models.py | Python | agpl-3.0 | 4,238 | 0.014158 |
"""
Deploy state manager
"""
from py_mina.utils import _AttributeDict
################################################################################
# Default state
################################################################################
state = _AttributeDict({
'pre_deploy': None,
'deploy': No... | py-mina-deploy/py-mina | py_mina/state.py | Python | mit | 845 | 0.008284 |
import logging
# Note: do not introduce unnecessary library dependencies here, e.g. gym.
# This file is imported from the tune module in order to register RLlib agents.
from ray.rllib.env.base_env import BaseEnv
from ray.rllib.env.external_env import ExternalEnv
from ray.rllib.env.multi_agent_env import MultiAgentEnv
... | richardliaw/ray | rllib/__init__.py | Python | apache-2.0 | 2,272 | 0 |
import math
def factor(n):
d = 2
factors = []
while n > 1 and d < math.sqrt(n):
if n % d == 0:
factors.append(d)
n = n/d
else:
d=d+1
return factors
| aarestad/gradschool-stuff | crypto/python/factor.py | Python | gpl-2.0 | 217 | 0.009217 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
"""
oauthlib.oauth2.rfc6749
~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of various logic needed
for consuming and providing OAuth 2.0 RFC6749.
"""
from .base import Client
from ..parameters import prepare_grant_uri
from ..pa... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/oauthlib/oauth2/rfc6749/clients/mobile_application.py | Python | mit | 9,122 | 0.00285 |
# The MIT License (MIT)
#
# Copyright (c) 2016 Frederic Guillot
#
# 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, ... | kanboard/kanboard-cli | kanboard_cli/shell.py | Python | mit | 3,401 | 0.000588 |
import pytest
from clustaar.authorize.conditions import TrueCondition
@pytest.fixture
def condition():
return TrueCondition()
class TestCall(object):
def test_returns_true(self, condition):
assert condition({})
| Clustaar/clustaar.authorize | tests/authorize/conditions/test_true_condition.py | Python | mit | 231 | 0 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
""" An extensible ASCII table reader and writer.
"""
from .core import (InconsistentTableError,
ParameterError,
NoType, StrType, NumType, FloatType, IntType, AllType,
Column,
Ba... | stargaser/astropy | astropy/io/ascii/__init__.py | Python | bsd-3-clause | 1,565 | 0.000639 |
import numpy as np
import matplotlib.pyplot as pl
def tvbox(box=(1,1), xcen=0, ycen=0, center=None,**kwargs):
"""
draw a circle on an image.
radius
xcen
ycen
center= tuple in (Y,X) order.
"""
if center is not None:
xcen=center[1]
... | mperrin/misc_astro | idlastro_ports/tvbox.py | Python | bsd-3-clause | 511 | 0.013699 |
# @file plugin.py
#
# Connect Zen Coding to Pluma.
#
# Adapted to pluma by Joao Manoel (joaomanoel7@gmail.com)
#
# Original Author Franck Marcia (franck.marcia@gmail.com)
#
import pluma, gobject, gtk, os
from zen_editor import ZenEditor
zencoding_ui_str = """
<ui>
<menubar name="MenuBar">
<menu name="EditMenu"... | jmanoel7/pluma-plugins-0 | plugins/zencoding/plugin.py | Python | gpl-3.0 | 6,126 | 0.003591 |
"""
This script is an example of how to use the random gaussian noise generator (type 2)
module. |br|
In this example only one signal is generated.
Both the minimum and the maximum frequency component in the signal is regulated.
After the generation, spectrum fo the signal is analyzed with an Welch analysis
and p... | JacekPierzchlewski/RxCS | examples/signals/gaussNoise2_ex1.py | Python | bsd-2-clause | 1,832 | 0.002183 |
# -*- coding: utf-8 -*-
#
# Pontoon documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 4 21:51:51 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.
#
# A... | jotes/pontoon | docs/conf.py | Python | bsd-3-clause | 9,297 | 0.006133 |
from .db_utils import PostgresController
from .enums import Action, Change
__all__ = ['PostgresController', 'Action', 'Change']
| dashwav/nano-chan | cogs/utils/__init__.py | Python | mit | 129 | 0 |
# Copyright 2013 Huawei Technologies Co.,LTD.
# 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
#
# Unl... | queria/my-tempest | tempest/api/compute/security_groups/test_security_group_rules_negative.py | Python | apache-2.0 | 7,051 | 0 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
Copyright (c) 2011 Tyler Kenendy <tk@tkte.ch>
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... | mcdevs/Burger | burger/toppings/topping.py | Python | mit | 1,295 | 0.000772 |
from libcloud.loadbalancer.types import Provider
from libcloud.loadbalancer.providers import get_driver
ACCESS_ID = 'your access id'
SECRET_KEY = 'your secret key'
cls = get_driver(Provider.ELB)
driver = cls(key=ACCESS_ID, secret=SECRET_KEY)
print(driver.ex_list_balancer_policy_types())
| mistio/libcloud | docs/examples/loadbalancer/elb/ex_list_balancer_policy_types.py | Python | apache-2.0 | 291 | 0 |
"""Support for Synology DSM cameras."""
from typing import Dict
from synology_dsm.api.surveillance_station import SynoSurveillanceStation
from homeassistant.components.camera import SUPPORT_STREAM, Camera
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
... | tchellomello/home-assistant | homeassistant/components/synology_dsm/camera.py | Python | apache-2.0 | 3,046 | 0.000657 |
# Copyright 2015-2016 Hewlett Packard Enterprise Development Company, LP
#
# 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/li... | noironetworks/neutron | neutron/services/auto_allocate/db.py | Python | apache-2.0 | 17,334 | 0.000404 |
from __future__ import absolute_import
import copy
from six.moves.urllib.parse import urlencode
from sentry.models import GroupHash
from sentry.testutils import APITestCase, SnubaTestCase
from sentry.testutils.factories import DEFAULT_EVENT_DATA
from sentry.testutils.helpers.datetime import iso_format, before_now
fr... | mvaled/sentry | tests/sentry/api/endpoints/test_group_hashes.py | Python | bsd-3-clause | 3,716 | 0.000807 |
# -*- coding: utf-8 -*-
# Octopasty is an Asterisk AMI proxy
# Copyright (C) 2011 Jean Schurger <jean@schurger.org>
# 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 Li... | jeansch/octopasty-og | octopasty/internal.py | Python | gpl-3.0 | 5,463 | 0.000366 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2020 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net>
#
# This file is part of qutebrowser.
#
# qutebrowser 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... | t-wissmann/qutebrowser | tests/unit/misc/test_keyhints.py | Python | gpl-3.0 | 7,603 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
NetGen is a tool for financial network analysis
Copyright (C) 2013 Tarik Roukny (troukny@ulb.ac.be)
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, v... | troukny/NetGen | src/network_handler.py | Python | gpl-3.0 | 2,563 | 0.014046 |
#!/usr/bin/env python
# Copyright (c) 2012 Cloudera, 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 requir... | mapr/impala | tests/stress/test_ddl_stress.py | Python | apache-2.0 | 3,153 | 0.011418 |
import rethinkdb as r
import db
def _forget_project(name, conn):
db.get_table().filter(r.row['name'] == name).delete().run(conn)
def forget_project(name):
conn = db.get_conn()
return _forget_project(name, conn)
| boryas/eidetic | lib/forget.py | Python | mit | 226 | 0.00885 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from datetime import datetime
from textwrap import dedent
import psutil
import pyexcel as p
from _compact import StringIO, OrderedDict
from nose.tools import eq_
def test_bug_01():
"""
if first row of csv is shorter than the rest of the rows,
the ... | chfw/pyexcel | tests/test_bug_fixes.py | Python | bsd-3-clause | 15,003 | 0 |
# -*- coding: utf-8 -*-
import click
from trips import oslo
@click.command()
@click.argument('from_place')
@click.argument('to_place')
def main(from_place, to_place):
proposals = oslo.proposals(from_place, to_place)
oslo.print_proposals(proposals)
if __name__ == "__main__":
main()
| staticaland/trips | trips/cli.py | Python | mit | 302 | 0 |
import spidev
import RPi.GPIO as GPIO
import time
class DoorSensor:
def __init__(self, pin = None, verbose = False, dblogger = None):
self.results = ()
self.device = None
self.pin = pin
self.dblogger = dblogger
self.verbose = verbose
# assign default pin if none provided
if self.pin == ... | georgetown-analytics/classroom-occupancy | SensorDataCollection/Sensors/Asynchronous/DoorSensor.py | Python | mit | 2,071 | 0.021246 |
######################################################################
#
# Copyright 2012 Zenoss, Inc. All Rights Reserved.
#
######################################################################
from zope.interface import Interface
try:
from Products.Zuul.interfaces.actions import IActionContentInfo
except Impo... | ssplatt/slack-zenoss | ZenPacks/community/Slack/interfaces.py | Python | gpl-2.0 | 960 | 0.001042 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# TEST_UNICODE_LITERALS
from ... import table
from .. import pprint
class MyRow(table.Row):
def __str__(self):
return str(self.as_void())
class MyColumn(table.Column):
pass
class MyMaskedColumn(table.MaskedCo... | AustereCuriosity/astropy | astropy/table/tests/test_subclass.py | Python | bsd-3-clause | 2,488 | 0 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | DailyActie/Surrogate-Model | 01-codes/tensorflow-master/tensorflow/python/framework/tensor_util_test.py | Python | mit | 16,873 | 0.001008 |
first_name = raw_input("Type your name here ")
last_name = raw_input("Type your last name here ")
print "Hello " + first_name +' '+last_name + " nice to meet you, welcome to the height conversion program"
def info():
a = raw_input("type your height here: ")
return a
def height_in_inches():
height_in_inches = flo... | deedee1886-cmis/deedee1886-cmis-cs2 | simpleprogram.py | Python | cc0-1.0 | 888 | 0.022523 |
#!/usr/bin/python
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way wit... | Southpaw-TACTIC/TACTIC | src/pyasm/application/maya/maya_builder_exec.py | Python | epl-1.0 | 2,188 | 0.00457 |
from struct import pack, unpack
from time import time
from communication.ComAPI.packet import Packet
class PacketLogin(Packet):
"""Class for constructing binary data based
on a common API between client / server."""
def __init__(self):
super().__init__()
self.packetID = 3
def encode(self, username, avatar... | DanAurea/Trisdanvalwen | communication/ComAPI/packetLogin.py | Python | mit | 1,024 | 0.037109 |
from django import forms
from django.contrib import messages
from django.core.exceptions import ValidationError
from django.db.models import ObjectDoesNotExist
from django.shortcuts import get_object_or_404, redirect, render_to_response
from django.template import RequestContext
from django.utils.translation import uge... | ixc/plata | examples/simple/views.py | Python | bsd-3-clause | 1,810 | 0.001105 |
#!/home/pi/.virtualenvs/cv2/bin/python
from picamera.array import PiRGBArray
from picamera import PiCamera
import picamera
from time import sleep
import time
import cv2
import numpy as np
import sys
import datetime
import boto3
import subprocess
import os
import pyowm
import commands
import multiprocessing
import thr... | tangowhisky37/RaspiPythonProjects | OpenCV/CaptureVideoStream/CaptureVideoStream_v0.21.py | Python | gpl-3.0 | 10,532 | 0.028959 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 03 09:36:48 2018
@author: tih
"""
import os
import sys
from DataAccess import DownloadData
def main(Dir, Startdate='', Enddate='', latlim=[-60, 70], lonlim=[-180, 180], Waitbar = 1):
"""
This function downloads monthly ETmonitor data
Keyword arguments:
... | wateraccounting/wa | Collect/ETmonitor/Es_monthly.py | Python | apache-2.0 | 817 | 0.017136 |
# -*- coding: utf-8 -*-
from Node import Node
res = float("-inf")
# 只有顶层root节点才可能即经过左边 又经过右边
def maxPathSum(root):
if not root:
return 0
max_l = maxPathSum(root.left)
max_r = maxPathSum(root.right)
max_single = max(max(max_l, max_r) + root.data, root.data)
max_top = max(max_single, ma... | sonymoon/algorithm | src/main/python/geeksforgeeks/tree/max-path-sum.py | Python | apache-2.0 | 707 | 0.010463 |
# Aspect Ratio 3D
import SMESH_mechanic_tetra
import SMESH
smesh = SMESH_mechanic_tetra.smesh
mesh = SMESH_mechanic_tetra.mesh
salome = SMESH_mechanic_tetra.salome
# Criterion : ASPECT RATIO 3D > 4.5
ar_margin = 4.5
aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_AspectRatio3D, SMESH.FT_MoreThan, ar_margin)
a... | FedoraScientific/salome-smesh | doc/salome/examples/quality_controls_ex20.py | Python | lgpl-2.1 | 708 | 0.018362 |
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Copyright (c) 2011 Cubic ERP - Teradata SAC. (https://cubicerp.com).
{
"name": "Bolivia - Accounting",
"version": "2.0",
"description": """
Bolivian accounting chart and tax localization.
Plan contable ... | vileopratama/vitech | src/addons/l10n_bo/__openerp__.py | Python | mit | 656 | 0 |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error
class perl_Carp_Clan(test.test):
"""
Autotest module for testing basic functionality
of perl_Carp_Clan
@author Kumuda G <kumuda.govind@in.ibm.com> ##... | PoornimaNayak/autotest-client-tests | linux-tools/perl_Carp_Clan/perl_Carp_Clan.py | Python | gpl-2.0 | 1,270 | 0.004724 |
import wx
from ..utils.generic_class import GenericClass
from ..utils.constants import control, dtype
import os
import yaml
import pkg_resources as p
import sys
ID_RUN_EXT = 11
ID_RUN_MEXT = 12
class DataConfig(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, title="CP... | erramuzpe/C-PAC | CPAC/GUI/interface/windows/dataconfig_window.py | Python | bsd-3-clause | 16,681 | 0.020562 |
from unittest import TestCase
from preggy import expect
from remotecv.image_processor import ImageProcessor
from tests import read_fixture
class ImageProcessorTest(TestCase):
def test_when_detector_unavailable(self):
image_processor = ImageProcessor()
with expect.error_to_happen(AttributeError):... | thumbor/remotecv | tests/test_image_processor.py | Python | mit | 1,812 | 0.000552 |
import os
import binascii
import json
from txjsonrpc.web.jsonrpc import Proxy
from txjsonrpc.web import jsonrpc
from twisted.web import server
from twisted.internet import reactor
try:
from OpenSSL import SSL
from twisted.internet import ssl
except:
pass
from .base import (get_current_blockheight, CoinSwap... | AdamISZ/CoinSwapCS | coinswap/csjson.py | Python | gpl-3.0 | 12,462 | 0.004574 |
#!/usr/bin/python3
import requests
import bs4
import sys
url = input('Enter URL -> ')
pattern = input('Enter search pattern-> ')
html = requests.get(url)
dir_download = "./download/"
if html.text.find("400 Bad Request") != -1:
print ("Bad Request")
sys.exit()
soup = bs4.BeautifulSoup(html.text)
tags = soup(... | ecrespo/pyurldownload_file | pyurldownload_file.py | Python | gpl-3.0 | 906 | 0.027594 |
# ~*~ coding: utf-8 ~*~
from django.conf.urls import *
import virtenviro.registration.views
import django.contrib.auth.views
urlpatterns = [
url(r'^signup/$', virtenviro.registration.views.signup),
url(r'^login/$', django.contrib.auth.views.login, {"template_name": "virtenviro/accounts/login.html"}),
url(r... | Haikson/virtenviro | virtenviro/registration/urls_new.py | Python | apache-2.0 | 396 | 0.005051 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | airodactyl/qutebrowser | qutebrowser/browser/webkit/webkittab.py | Python | gpl-3.0 | 30,341 | 0 |
# A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
# The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).
# How many possible unique paths are there?
... | abawchen/leetcode | solutions/062_unique_paths.py | Python | mit | 837 | 0.002389 |
#!/usr/bin/python
# inbuild - Exception - python exception - parent clas
# InvalidAgeException - Child class
class InvalidAgeException(Exception):
def __init__(self,age):
self.age = age
def validate_age(age):
if age > 18:
return "welcome to the movie!!!"
else:
raise InvalidAgeException(age)
if __name__ == ... | tuxfux-hlp-notes/python-batches | archieves/batch-62/oop/movie.py | Python | gpl-3.0 | 538 | 0.031599 |
"""
Example ussage of the read_multi_vars function
This was tested against a S7-319 CPU
"""
import ctypes
import struct
import snap7
from snap7.common import check_error
from snap7.snap7types import S7DataItem, S7AreaDB, S7WLByte
client = snap7.client.Client()
client.connect('10.100.5.2', 0, 2)
data_items = (S7Da... | SimplyAutomationized/python-snap7 | example/read_multi.py | Python | mit | 2,021 | 0.000495 |
from django.contrib import admin
from .models import Gallery
class GalleryAdmin(admin.ModelAdmin):
list_display = ('title', 'gallery_image', 'alt_text', 'display_order', 'visibility')
search_fields = ['title', 'alt_text']
admin.site.register(Gallery, GalleryAdmin) | zacherytapp/wedding | weddingapp/apps/gallery/admin.py | Python | bsd-3-clause | 269 | 0.022305 |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... | rvs/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/storage/lib/dbstate.py | Python | apache-2.0 | 3,081 | 0.009737 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0004_add_default_ordering_of_categories_by_name'),
]
operations = [
migrations.AlterField(
model_name='ca... | lgp171188/xpens | xpens/app/migrations/0005_make_description_optional_provide_default_value.py | Python | agpl-3.0 | 606 | 0 |
#!/usr/bin/env python
"""
setup.py file for augeas
"""
import os
prefix = os.environ.get("prefix", "/usr")
from distutils.core import setup
setup (name = 'python-augeas',
version = '0.3.0',
author = "Harald Hoyer",
author_email = "augeas-devel@redhat.com",
description = """Python bi... | giraldeau/python-augeas | setup.py | Python | lgpl-2.1 | 420 | 0.045238 |
import os
import sys
import lit.formats
import lit.llvm
# Configuration file for the 'lit' test runner.
lit.llvm.initialize(lit_config, config)
config.name = "RISC-V tests"
config.test_format = lit.formats.ShTest(True)
config.suffixes = [".run"]
config.environment["BUILD_RISCV_DIR"] = os.getenv("BUILD_RISCV_DIR")
... | google/iree | build_tools/kokoro/gcp_ubuntu/cmake/linux/riscv64/tests/lit.cfg.py | Python | apache-2.0 | 756 | 0 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for core additions
From build dir, run: ctest -R PyPythonRepr -V
.. note:: 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,... | rduivenvoorde/QGIS | tests/src/python/test_python_repr.py | Python | gpl-2.0 | 15,282 | 0.003807 |
#!/usr/bin/env python3
import locale
import os
import sys
try:
# suppress warnings from GI
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Poppler', '0.18')
gi.require_version('PangoCairo', '1.0')
except:
pass
try:
from gi.repository import GLib
from gi.repository impor... | Starch/paperwork | src/paperwork/deps.py | Python | gpl-3.0 | 7,285 | 0.000549 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
An implementation of the time frequency phase misfit and adjoint source after
Fichtner et al. (2008).
:copyright:
Lion Krischer (krischer@geophysik.uni-muenchen.de), 2013
:license:
GNU General Public License, Version 3
(http://www.gnu.org/copyleft/gpl.html)... | Phlos/LASIF_scripts | lasif_code/ad_src_tf_phase_misfit.py | Python | gpl-3.0 | 13,183 | 0.00129 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Menu manager.
A dictionary of menu instance() functions (see MenuFactory)
"""
class MenuManager:
menus = { }
def register(menuName, menuFactory):
MenuManager.menus[menuName] = menuFactory
register = staticmethod(register)
def get(menuName):
return Me... | non-official-SD/base | src/tools/ceguidemo/menumanager.py | Python | gpl-3.0 | 375 | 0.045333 |
# Copyright (c) - 2013 Mitchell Peabody.
# See COPYRIGHT.txt and LICENSE.txt in the root of this project.
from functools import wraps
import inspect
import logging
from google.appengine.api import xmpp, users
from google.appengine.ext.webapp import xmpp_handlers
from model import User, Variable, Value
from nl import... | mizhi/tictic | xmpp.py | Python | gpl-2.0 | 3,475 | 0.010072 |
#
# Copyright (C) 2012-2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it wi... | mairin/anaconda | pyanaconda/ntp.py | Python | gpl-2.0 | 6,933 | 0.001731 |
"""Internal module for human-friendly color generation.
.. important::
End users of this library should not use anything in this module.
Code adapted from:
- https://github.com/davidmerfield/randomColor (CC0)
- https://github.com/kevinwuhoo/randomcolor-py (MIT License)
Additional reference from:
- https://en.wi... | joke2k/faker | faker/providers/color/color.py | Python | mit | 10,362 | 0.000676 |
from PySide.QtCore import *
from PySide.QtGui import *
import managers
class lineNumberBarClass(QWidget):
def __init__(self, edit, parent=None):
QWidget.__init__(self, parent)
self.edit = edit
self.highest_line = 0
self.setMinimumWidth(30)
self.edit.installEventFilter(self)
... | cineuse/CNCGToolKit | apps/pw_multiScriptEditor/widgets/numBarWidget.py | Python | mit | 3,802 | 0.00263 |
from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Axe Cop'
language = 'en'
url = 'http://www.axecop.com/'
start_date = '2010-01-02'
rights = 'Ethan Nicolle'
class Crawler(CrawlerBase):
hist... | datagutten/comics | comics/comics/axecop.py | Python | agpl-3.0 | 766 | 0 |
#
# LayerImage.py -- Abstraction of an generic layered image.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import numpy
import time
import Bunch
import BaseImage
... | astrofrog/ginga | ginga/LayerImage.py | Python | bsd-3-clause | 7,562 | 0.003835 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from .sitemap import BlogSitemap
from .views import RobotPageView, HumanPageView, GooglePageView
admin.autodiscover()
sitemaps = {
'blog': BlogSitemap,
}
urlpatterns = patterns('',
url(
regex=r"^robots\.txt$",
... | vandorjw/notes | vandorjw/vandorjw/urls.py | Python | mit | 1,049 | 0.00286 |
# 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 django.conf import settings
from django.http import HttpResponseRedirect
import l10n_utils
def secure_required(v... | davidwboswell/documentation_autoresponse | lib/bedrock_util.py | Python | mpl-2.0 | 995 | 0.001005 |
from Screen import Screen
from Components.Label import Label
class PVRState(Screen):
def __init__(self, session):
Screen.__init__(self, session)
self["state"] = Label(text="")
class TimeshiftState(PVRState):
pass
| blzr/enigma2 | lib/python/Screens/PVRState.py | Python | gpl-2.0 | 224 | 0.017857 |
from django.conf import settings
BACKENDS = getattr(settings, 'FAIREPART_BACKENDS', (
'fairepart.backends.facebook.FacebookBackend',
'fairepart.backends.google.GoogleOAuth2Backend',
))
RELATION_LIST_PAGINATE_BY = getattr(settings, 'FAIREPART_RELATION_LIST_PAGINATE_BY', 5)
GOOGLE_APP_NAME = getattr(settings,... | thoas/django-fairepart | fairepart/settings.py | Python | mit | 354 | 0.002825 |
## Does "land_surface_air__latent_heat_flux" make sense? (2/5/13)
# Copyright (c) 2001-2014, Scott D. Peckham
#
# Sep 2014. Fixed sign error in update_bulk_richardson_number().
# Ability to compute separate P_snow and P_rain.
# Aug 2014. New CSDMS Standard Names and clean up.
# Nov 2013. Con... | mperignon/component_creator | topoflow_creator/topoflow/met_base.py | Python | gpl-2.0 | 109,509 | 0.01031 |
# -*- coding: utf-8 -*-
from . import models
from .hooks import set_default_map_settings
| brain-tec/partner-contact | partner_external_map/__init__.py | Python | agpl-3.0 | 90 | 0 |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
ckanutils
~~~~~~~~~
Provides methods for interacting with a CKAN instance
Examples:
literal blocks::
python example_google.py
Attributes:
CKAN_KEYS (List[str]): available CKAN keyword arguments.
"""
from __future__ import (
absolute_import... | reubano/ckanutils | ckanutils.py | Python | mit | 29,704 | 0.000135 |
#!/usr/bin/env python
###
#
# Copyright (C) 2007 Mola Pahnadayan
#
# 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 ... | mola/jalali-calendar | src/holiday.py | Python | gpl-2.0 | 1,532 | 0.106397 |
import pytest
import klondike
def test_popis_rubem_nahoru():
karta = 13, 'Pi', False
assert klondike.popis_karty(karta) == '[???]'
def test_popis_srdcova_kralovna():
karta = 12, 'Sr', True
assert klondike.popis_karty(karta) in ['[Q ♥]', '[Q S]']
def test_otoc_kralovnu():
karta = 12, 'Sr', True... | PyLadiesCZ/pyladies.cz | original/v1/s007-cards/klondike/test_popis_karty.py | Python | mit | 1,114 | 0.000907 |
# -*- coding: utf-8 -*-
# @author: vuolter
from __future__ import absolute_import, unicode_literals
import os
import re
from future import standard_library
from pyload.utils import convert, purge, web
from pyload.utils.convert import to_str
from pyload.utils.layer.legacy import hashlib
from pyload.utils.time import... | pyblub/pyload | pyload/utils/parse.py | Python | agpl-3.0 | 4,211 | 0 |
#!/usr/bin/python
"""Scrapes websvc and adds them to SimpleDB"""
from __future__ import print_function
import boto
import time
import datetime
import re
import pytz
import sys
import urllib
import collections
import yaml
from musicbrainz2.webservice import Query, TrackFilter, WebServiceError, \
... | alexjh/whatson | whats_on_to_simpledb.py | Python | gpl-2.0 | 9,735 | 0.009245 |
import logging
from autotest.client.shared import error
def run(test, params, env):
"""
QMP Specification test-suite: this checks if the *basic* protocol conforms
to its specification, which is file QMP/qmp-spec.txt in QEMU's source tree.
IMPORTANT NOTES:
o Most tests depend heavily on QMP'... | PyLearner/tp-qemu | qemu/tests/qmp_basic_rhel6.py | Python | gpl-2.0 | 14,327 | 0 |
from django.db import models
class AbstractFormSetting(models.Model):
form = models.OneToOneField(
"wagtailstreamforms.Form",
on_delete=models.CASCADE,
related_name="advanced_settings",
)
class Meta:
abstract = True
def __str__(self):
return self.form.title
| AccentDesign/wagtailstreamforms | wagtailstreamforms/models/abstract.py | Python | mit | 318 | 0 |
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
import re
import portage
from portage import os
from portage.dbapi.porttree import _parse_uri_map
from portage.dbapi.IndexedPortdb import IndexedPortdb
from portage.dbapi.... | ptisserand/portage | pym/_emerge/search.py | Python | gpl-2.0 | 13,055 | 0.035619 |
# 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 u... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/python/mxnet/module/module.py | Python | apache-2.0 | 37,421 | 0.003233 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softwa... | bl4ckdu5t/registron | tests/import/relimp/relimp1.py | Python | mit | 795 | 0.005031 |
# Copyright 2014 Dietrich Epp.
# This file is part of SGLib. SGLib is licensed under the terms of the
# 2-clause BSD license. For more information, see LICENSE.txt.
BASE_CONFIG = {
'Config.PlatformToolset': 'v120',
'Config.CharacterSet': 'Unicode',
'ClCompile.WarningLevel': 'Level3',
'ClCompile.SDLCh... | depp/sglib | script/d3build/msvc/base.py | Python | bsd-2-clause | 1,042 | 0 |
def extractNotoriousOnlineBlogspotCom(item):
'''
Parser for 'notorious-online.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated')... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractNotoriousOnlineBlogspotCom.py | Python | bsd-3-clause | 569 | 0.033392 |
from .app import App
from .decorators import action
| whatisjasongoldstein/beagle | beagle/__init__.py | Python | mit | 52 | 0 |
##Copyright 2011-2014 Thomas Paviot (tpaviot@gmail.com)
##
##This file is part of pythonOCC.
##
##pythonOCC 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 of the License, or
##(at your... | sven-hm/pythonocc-core | src/addons/Display/WebGl/threejs_renderer.py | Python | lgpl-3.0 | 12,135 | 0.003049 |
#
# Copyright (c) 2009, 2011, 2012 Tom Keffer <tkeffer@gmail.com>
#
# See the file LICENSE.txt for your full rights.
#
# $Revision: 1046 $
# $Author: tkeffer $
# $Date: 2013-02-21 06:38:26 -0800 (Thu, 21 Feb 2013) $
#
"""Almanac data
This module can optionally use PyEphem, which offers high quality
astr... | hoevenvd/weewx_poller | bin/weewx/almanac.py | Python | gpl-3.0 | 17,450 | 0.009685 |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from treeio.finance.models import Currency
from treeio.sales.models import SaleOrder,... | rogeriofalcone/treeio | sales/migrations/0003_treeiocurrency.py | Python | mit | 30,418 | 0.007594 |
#!/usr/bin/python
# contains configuration, parameters can be accessed as attributes
class Config:
# init from argparse.ArgumentParser
def __init__(self, parser):
self.args = vars(parser.parse_args())
def __getattr__(self, name):
return self.args[name]
| artem-smotrakov/httpooh | config.py | Python | gpl-3.0 | 285 | 0.003509 |
from flask import Blueprint, render_template, json, g, current_app, redirect, url_for, session
from datetime import datetime as dt
from scrim2.extensions import oid, db, lm
from scrim2.models import User
from sqlalchemy.orm.exc import NoResultFound
from flask.ext.login import login_user, logout_user, current_user
impor... | vlttnv/scrimfinder2 | scrim2/views/home.py | Python | gpl-2.0 | 2,491 | 0.00562 |
#!/usr/bin/python
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | caioserra/apiAdwords | examples/adspygoogle/dfa/v1_19/get_user_roles.py | Python | apache-2.0 | 2,451 | 0.008568 |
import pandas as pd
from matplotlib import cm
import matplotlib.pyplot as plt
from pydlv import dl_model_3, data_reader, data_analyser, dl_generator, dl_plotter, trajectory_plotter
'''
This script demonstrates how, using coefficients from the csv file generated previously,
plot a 3d surface of decision landscapes fitt... | cherepaha/PyDLV | demos/plot_compare_dlv_three_blocks.py | Python | gpl-3.0 | 2,266 | 0.01015 |
import copy
import pandas as pd
from bokeh.plotting import figure, show, output_notebook
from bokeh.models import Legend, Span
# from bokeh.models import HoverTool
from ..utils import in_ipynb
from .plotobj import BasePlot
from .plotutils import get_color
_INITED = False
class BokehPlot(BasePlot):
def __init__(s... | timkpaine/lantern | lantern/plotting/plot_bokeh.py | Python | apache-2.0 | 5,812 | 0.001721 |
#!/usr/bin/env python
"""
Status of DIRAC components using runsvstat utility
"""
#
from __future__ import print_function
from DIRAC.Core.Base import Script
Script.disableCS()
Script.setUsageMessage('\n'.join([__doc__.split('\n')[1],
'Usage:',
' %s [... | fstagni/DIRAC | FrameworkSystem/scripts/dirac-status-component.py | Python | gpl-3.0 | 1,235 | 0.008097 |
from __future__ import unicode_literals
from django.db import migrations
from django.contrib.postgres.operations import HStoreExtension
class Migration(migrations.Migration):
dependencies = [
('product', '0020_attribute_data_to_class'),
]
operations = [
HStoreExtension(),
]
| tfroehlich82/saleor | saleor/product/migrations/0021_add_hstore_extension.py | Python | bsd-3-clause | 312 | 0 |
from django import forms
class CommentForm(forms.Form):
content_type = forms.CharField(widget=forms.HiddenInput)
object_id = forms.CharField(widget=forms.HiddenInput)
parent_id = forms.IntegerField(widget=forms.HiddenInput, required=False)
content = forms.CharField(label='',widget=forms.Textarea)
| tyagow/AdvancingTheBlog | src/comments/forms.py | Python | mit | 304 | 0.016447 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.