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 |
|---|---|---|---|---|---|---|
"""Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2013 Benjamin Peterson
#
# 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 with... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sure/six.py | Python | agpl-3.0 | 12,755 | 0.001803 |
import subprocess
from music21 import *
from pyPdf import PdfFileReader, PdfFileWriter
from reportlab.pdfgen import canvas
from reportlab.lib import pagesizes
from reportlab.lib.units import inch
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
# some important constants
MUSIC_XML_... | SyntaxBlitz/syntaxblitz.github.io | portfolio/pdf-scripts/do-page-generate.py | Python | mit | 3,014 | 0.023557 |
# -*- coding: utf-8 -*-
import json
from axe.http_exceptions import BadJSON
def get_request(request):
return request
def get_query(request):
return request.args
def get_form(request):
return request.form
def get_body(request):
return request.data
def get_headers(request):
return request.header... | soasme/axe | axe/default_exts.py | Python | mit | 680 | 0.011765 |
from protocols.forms import forms
from core.utils import TIME_UNITS
class DiscardForm(forms.VerbForm):
name = "Discard"
slug = "discard"
has_manual = True
layers = ['item_to_act','item_to_retain','conditional_statement','settify']
item_to_act = forms.CharField(required=False, label='item to disca... | Bionetbook/bionetbook | bnbapp/protocols/forms/verbs/discard.py | Python | mit | 870 | 0.018391 |
##############################################################################
# Copyright (c) 2000-2016 Ericsson Telecom AB
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available ... | BenceJanosSzabo/titan.core | etc/scripts/tpd_graph_xml2dot.py | Python | epl-1.0 | 978 | 0.005112 |
# Copyright 2018 - Nokia 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 agre... | openstack/mistral | mistral/scheduler/scheduler_server.py | Python | apache-2.0 | 2,019 | 0 |
class Foo(object):
def mm(self, barparam):
'''
@param barparam: this is barparam
'''
f = Foo()
f.mm(barparam=10)
| aptana/Pydev | tests/com.python.pydev.refactoring.tests/src/pysrcrefactoring/reflib/renameparameter/methoddef2.py | Python | epl-1.0 | 145 | 0.006897 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.datetime_safe
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('topics'... | andychase/codebook | topics/migrations/0015_auto_20151218_1823.py | Python | mit | 1,259 | 0.002383 |
# e Django settings for dss project.
import os
import mimetypes
from django.core.urlresolvers import reverse_lazy
import djcelery
from django.conf import global_settings
from dss import logsettings
from utils import here
from localsettings import *
from pipelinesettings import *
from storagesettings impor... | fergalmoran/dss | dss/settings.py | Python | bsd-2-clause | 6,629 | 0.000905 |
#!/usr/bin/python
import os,sys,json,re
for dirpath,dirnames,filenames in os.walk("data/courts/us"):
indexPath = os.path.join(dirpath,"index.txt")
if not os.path.exists(indexPath):
print "Oops: %s" % indexPath
sys.exit()
fh = open(indexPath)
lines = []
template = None
firstCon... | fbennett/legal-resource-registry | attic/WALK-FILES.py | Python | bsd-2-clause | 1,115 | 0.011659 |
#! /usr/bin/env python
from pySecDec.loop_integral import loop_package
import pySecDec as psd
li = psd.loop_integral.LoopIntegralFromPropagators(
propagators = ['k1**2-msq','(k1+p1+p2)**2-msq','k2**2-msq','(k2+p1+p2)**2-msq','(k1+p1)**2-msq','(k1-k2)**2','(k2-p3)**2-msq','(k2+p1)**2','(k1-p3)**2'],
powerlist = [1,1,0,... | mppmu/secdec | examples/elliptic2L_physical/generate_elliptic2L_physical.py | Python | gpl-3.0 | 1,518 | 0.049407 |
"""
# create a virtualenv
mkvirtualenv test_api
# install dependencies
pip install flask
pip install flasgger
# run the following script
python simple_test.py
"""
from flask import Flask, jsonify, request
from flasgger import Swagger
app = Flask(__name__)
Swagger(app)
@app.route("/recs", methods=['GET'])
def recs... | Navisite/flasgger | flasgger/simple_test.py | Python | mit | 916 | 0.001092 |
import sys
import time
from mpi4py.futures import MPICommExecutor
x0 = -2.0
x1 = +2.0
y0 = -1.5
y1 = +1.5
w = 1600
h = 1200
dx = (x1 - x0) / w
dy = (y1 - y0) / h
def julia(x, y):
c = complex(0, 0.65)
z = complex(x, y)
n = 255
while abs(z) < 3 and n > 1:
z = z**2 + c
n -= 1
retur... | mpi4py/mpi4py | demo/futures/run_julia.py | Python | bsd-2-clause | 1,252 | 0.00639 |
from uuid import uuid4
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User, Group
from django.test import RequestFactory
from txtalert.core.clinic_admin import VisitAdmin, PatientAdmin
from txtalert.core.models import Visit, Clinic, Patient
from txtalert.core.tests.base import... | praekelt/txtalert | txtalert/core/tests/test_clinic_admin.py | Python | gpl-3.0 | 5,959 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
from glob import glob
from setuptools import find_packages, setup
from os.path import join, dirname
execfile(join(dirname(__file__), 'openerp', 'release.py')) # Load release variables
lib_name = 'openerp'
def py2exe_datafiles():
data_files = {}... | ToiDenGaAli/odoo | setup.py | Python | gpl-3.0 | 5,678 | 0.001585 |
from heat.engine.resources.cloudmanager.util.conf_util import *
class HwsCloudInfoPersist:
def __init__(self, _access_cloud_install_info_file, cloud_id):
self.info_handler = CloudInfoHandler(_access_cloud_install_info_file, cloud_id)
def write_vpc_info(self, vpc_id, vpc_name, vpc_cidr, security_group... | hgqislub/hybird-orchard | code/cloudmanager/install/hws/hws_cloud_info_persist.py | Python | apache-2.0 | 3,963 | 0.005804 |
# Copyright 2014 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | zerovm/zerovm-cli | zpmlib/zpm.py | Python | apache-2.0 | 26,716 | 0 |
#!/usr/bin/env python
###########################################################################
# Copyright (C) 2008-2016 by SukkoPera #
# software@sukkology.net #
# ... | SukkoPera/audiotrans | AudioTrans/Process.py | Python | gpl-3.0 | 2,826 | 0.023355 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import urllib
import time
import datetime
#From PatMap by Jason Young, available on GitHub at github.com/JasYoung314/PatMap
#Function to get distance between 2 points from google maps. By default route is by car, distance is given in miles and time in minutes... | MatthewGWilliams/Staff-Transport | emergencyTransport/RouteFinder/GoogleDistances.py | Python | mit | 1,984 | 0.043851 |
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
from ansible_playbook_wrapper.command.play import PlayCommand
def main():
parser = ArgumentParser()
sub_parsers = parser.add_subparsers(help='commands')
play_parser = sub_parsers.add_parser('play', help='play playbook')
for arg_info in P... | succhiello/ansible-playbook-wrapper | ansible_playbook_wrapper/__init__.py | Python | mit | 556 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('mainsite', '0005_auto_20150909_0246'),
... | srenner/photerva | mainsite/migrations/0006_auto_20150916_0219.py | Python | apache-2.0 | 2,722 | 0.001102 |
# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain s... | greenlion/mysql-server | storage/ndb/mcc/request_handler.py | Python | gpl-2.0 | 23,716 | 0.009529 |
import os
import sys
sys.path.append( '../' )
from PyRTF import *
def MakeExample1() :
doc = Document()
ss = doc.StyleSheet
section = Section()
doc.Sections.append( section )
# text can be added directly to the section
# a paragraph object is create as needed
section.append( 'Image Example 1' )
sec... | lambdamusic/testproject | konproj/libs/PyRTF/examples/examples2.py | Python | gpl-2.0 | 1,338 | 0.076233 |
blah = 33
| sjdv1982/seamless | seamless/graphs/multi_module/mytestpackage/mod4.py | Python | mit | 10 | 0 |
import mock
import unittest
import mycroft.stt
from mycroft.configuration import ConfigurationManager
class TestSTT(unittest.TestCase):
@mock.patch.object(ConfigurationManager, 'get')
def test_factory(self, mock_get):
mycroft.stt.STTApi = mock.MagicMock()
config = {'stt': {
'... | epaglier/Project-JARVIS | mycroft-core/test/unittests/stt/test_stt.py | Python | gpl-3.0 | 5,110 | 0 |
import sys
n, m = map(int, raw_input().strip().split())
v1, v2 = map(int, raw_input().strip().split())
x, y = map(int, raw_input().strip().split())
route_map = {}
distance_map = {}
def get_edge_name(x, y):
if x > y:
x, y = y, x
return str(x) + '_' + str(y)
def get_edge_distance(x,y):
edge_name = get... | shams-sam/logic-lab | DfsShortestPath/dfs_solution.py | Python | mit | 2,348 | 0.008518 |
import distribute3Sphere
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import logging, sys
from sklearn.neighbors import NearestNeighbors
#from scipy.spatial import Delaunay
_logger = logging.getLogger(__name__)
_logger.setLevel(logging.DEBUG)
def get_S2(q):
try:
assert(q.shape[0] > 3)
excep... | hstau/manifold-cryo | S2tessellation.py | Python | gpl-2.0 | 1,976 | 0.039474 |
import time
import unittest
import os
import tempfile
import numpy as np
from urh.util import util
util.set_windows_lib_path()
from urh.dev.native.lib import hackrf
from urh.dev.native.HackRF import HackRF
class TestHackRF(unittest.TestCase):
def callback_fun(self, buffer):
print(buffer)
for i... | splotz90/urh | tests/HackRFTests.py | Python | gpl-3.0 | 4,709 | 0.004247 |
# Copyright (c) 2013 Yogesh Panchal, yspanchal@gmail.com
# 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 ... | yspanchal/bitbucketcli | bitbucket/wiki.py | Python | apache-2.0 | 4,056 | 0.000247 |
"""
Functions:
primer3
primer3_core
parse
"""
import sys
def primer3(sequence, **params):
# See primer3_core for more options.
# Return list of (left_primer, right_primer, product_size)
from StringIO import StringIO
handle = StringIO()
primer3_core(sequence, outhandle=handle, **params)
... | jefftc/changlab | genomicode/primer3.py | Python | mit | 5,865 | 0.004774 |
from temboo.Library.Nexmo.Voice.CaptureTextToSpeechPrompt import CaptureTextToSpeechPrompt, CaptureTextToSpeechPromptInputSet, CaptureTextToSpeechPromptResultSet, CaptureTextToSpeechPromptChoreographyExecution
from temboo.Library.Nexmo.Voice.ConfirmTextToSpeechPrompt import ConfirmTextToSpeechPrompt, ConfirmTextToSpeec... | jordanemedlock/psychtruths | temboo/core/Library/Nexmo/Voice/__init__.py | Python | apache-2.0 | 565 | 0.00531 |
from __future__ import unicode_literals
from django.contrib.auth.models import AnonymousUser
from django.db.models import Q
from haystack import indexes
from reviewboard.reviews.models import ReviewRequest
from reviewboard.search.indexes import BaseSearchIndex
class ReviewRequestIndex(BaseSearchIndex, indexes.Index... | chipx86/reviewboard | reviewboard/reviews/search_indexes.py | Python | mit | 5,009 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Poodle implementation with a client <--> proxy <--> server
'''
import argparse
import random
import re
import select
import socket
import SocketServer
import ssl
import string
import sys
import struct
import threading
import time
from utils.color import draw
from ... | rtbn/TER_Project | poodle-PoC/poodle.py | Python | gpl-2.0 | 12,158 | 0.005511 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/yc/code/calibre/calibre/src/calibre/gui2/wizard/library.ui'
#
# Created: Thu Oct 25 16:54:55 2012
# by: PyQt4 UI code generator 4.8.5
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
... | yeyanchao/calibre | src/calibre/gui2/wizard/library_ui.py | Python | gpl-3.0 | 3,115 | 0.002889 |
import os
import unittest
from math import pi
import numpy
from kiva import agg
def save_path(filename):
return filename
def draw_arcs(gc, x2, y2, radiusstep=25.0):
gc.set_stroke_color((0.2,0.2,0.2)) # lightgray
gc.move_to(0, 0)
gc.line_to(100, 0)
gc.line_to(x2, y2)
gc.stroke_path()
gc... | tommy-u/enable | integrationtests/kiva/agg/test_arc.py | Python | bsd-3-clause | 3,344 | 0.006878 |
from flask import request, flash, render_template, url_for, redirect, abort, Blueprint, g
from aalert import app, db
from flask_login import login_required, logout_user, login_user, current_user
from aalert.forms import *
from aalert.models import *
from sqlalchemy_searchable import search
from flask_admin import Admin... | nravic/py-amber_alert | aalert/views.py | Python | mit | 2,721 | 0.005513 |
import _plotly_utils.basevalidators
class TickformatstopsValidator(_plotly_utils.basevalidators.CompoundArrayValidator):
def __init__(
self, plotly_name="tickformatstops", parent_name="contour.colorbar", **kwargs
):
super(TickformatstopsValidator, self).__init__(
plotly_name=plotly... | plotly/python-api | packages/python/plotly/plotly/validators/contour/colorbar/_tickformatstops.py | Python | mit | 2,290 | 0.000873 |
from abc import ABCMeta, abstractmethod
#Node object, important for traversing the search graph. Abstract class
#that contain abstract methods that has to be implemented by subclasses.
#These abstract methods, is what constitute the specialization of the A*
#for this problem domain.
class Node(object):
__metaclass... | olavvatne/agac | abstractnode.py | Python | mit | 2,220 | 0.009459 |
import numpy as np
from scipy.sparse import csr_matrix
from .symbolic import Operator
SPARSITY_N_CUTOFF = 600 # TODO lower after fixing sparse matrices
def sparsify(mat):
assert SPARSITY_N_CUTOFF > 5, 'The SPARSITY_N_CUTOFF is set to a very low number.'
if min(mat.shape) > SPARSITY_N_CUTOFF:
return cs... | Krastanov/cutiepy | cutiepy/operators.py | Python | bsd-3-clause | 1,593 | 0.032116 |
import os
import inspect
from lib import BaseTest
def changesRemove(_, s):
return s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "changes"), "")
class EditRepo1Test(BaseTest):
"""
edit repo: change comment
"""
fixtureCmds = [
"aptly repo create repo1",
]
... | neolynx/aptly | system/t09_repo/edit.py | Python | mit | 2,278 | 0.000878 |
#################################### IMPORTS ###################################
from __future__ import generators
if __name__ == '__main__':
import sys
import os
pkg_dir = os.path.split(os.path.abspath(__file__))[0]
parent_dir, pkg_name = os.path.split(pkg_dir)
is_pygame_pkg = (pkg_name == 'tests... | gmittal/aar-nlp-research-2016 | src/pygame-pygame-6625feb3fc7f/test/_vlcmovietest.py | Python | mit | 4,005 | 0.009488 |
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from copy import deepcopy
from django import forms
from dj... | lawzou/shoop | shoop/admin/modules/methods/views/edit.py | Python | agpl-3.0 | 4,422 | 0.002488 |
#!/usr/bin/python
######################################################################
#
# File: kafka_to_mysql.py
#
# Copyright 2015 TiVo Inc. All Rights Reserved.
#
######################################################################
"""
Usage: kafka_to_mysql.py <kafka_topic> <kafka_broker> <mysql-ip> <mysql-port... | TiVo/wombat | correctness/kafka_to_mysql.py | Python | apache-2.0 | 5,895 | 0.008142 |
# -*- coding: utf-8 -*-
from PyQt4 import QtGui, uic
import os
#from qgis.utils import iface
FORM_CLASS, _ = uic.loadUiType(os.path.join(os.path.dirname(__file__), 'padrohabitants_dialog.ui'))
class PadroHabitantsDialog(QtGui.QDialog, FORM_CLASS):
def __init__(self, parent=None):
"""Constructor."""
... | psigcat/padrohabitants | plugin/ui/padrohabitants_dialog.py | Python | gpl-2.0 | 844 | 0.007109 |
#!/usr/bin/env python
#
# Author: Veronica G. Vergara L.
#
#
from .scheduler_factory import SchedulerFactory
from .jobLauncher_factory import JobLauncherFactory
from abc import abstractmethod, ABCMeta
import os
import shutil
class BaseMachine(metaclass=ABCMeta):
""" BaseMachine represents a compute resourc... | verolero86/ooh-py | base_machine.py | Python | mit | 7,770 | 0.007336 |
from django.core.urlresolvers import reverse
from rest_framework import serializers
from casenotes.api import CaseNoteSerializer
from .. import models
class ViewTicketSerializer(serializers.ModelSerializer):
case_note = CaseNoteSerializer()
claim_url = serializers.SerializerMethodField()
resolve_url = s... | Kvoti/ditto | ditto/tickets/api/serializers.py | Python | bsd-3-clause | 900 | 0.004444 |
from __future__ import absolute_import
import six
import pytest
import base64
from sentry.utils.compat import mock
from exam import fixture
from six.moves.urllib.parse import urlencode, urlparse, parse_qs
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
from ... | beeftornado/sentry | tests/sentry/web/frontend/test_auth_saml2.py | Python | bsd-3-clause | 6,945 | 0.001728 |
#!/usr/bin/env python
from __future__ import print_function, division
import numpy as np
import astropy.cosmology
from astropy import units as u
from astropy import constants as const
def compute_sigma_crit(zl, zs, weights=None, cosmology=None):
"""Compute the critical surface mass density.
Parameters:
... | joergdietrich/reduced_shear_correction | reduced_shear_correction.py | Python | mit | 3,647 | 0.001097 |
#
# Licensed to Intel Corporation under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# Intel Corporation licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this fi... | zhichao-li/BigDL | dl/src/main/python/util/common.py | Python | apache-2.0 | 7,567 | 0.000529 |
def test_delete_first_group(app):
app.session.login(username="admin", password="secret")
app.group.delete_first_group()
app.session.logout()
| alexzoo/python | selenium_tests/test/test_del_group.py | Python | apache-2.0 | 156 | 0.00641 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/structure/dantooine/shared_dant_small_mudhut.iff"
result.attribute_temp... | obi-two/Rebelion | data/scripts/templates/object/static/structure/dantooine/shared_dant_small_mudhut.py | Python | mit | 457 | 0.04814 |
import pytest
import socket as s
@pytest.fixture
def socket(request):
_socket = s.socket(s.AF_INET, s.SOCK_STREAM)
def socket_teardown():
_socket.close()
request.addfinalizer(socket_teardown)
return _socket
def test_server_connect(socket):
socket.connect(('127.0.0.1',8123))
assert so... | ainich/politraf | _test.py | Python | mit | 375 | 0.005333 |
from django import template
register = template.Library()
@register.inclusion_tag('admin/cerci_issue/issue/submit_line.html', takes_context=True)
def submit_issue_row(context):
"""
Displays the row of buttons for delete and save.
"""
opts = context['opts']
change = context['change']
is_popup =... | cercisanat/cercisanat.com | cerci_admin/templatetags/issue_submit.py | Python | gpl-3.0 | 1,033 | 0.00484 |
from django.apps import AppConfig
class MemosConfig(AppConfig):
name = 'memos'
| a-kirin/Dockerfiles | sample01/web/sample01/memos/apps.py | Python | mit | 85 | 0 |
# Copyright (c) 2013 Matthieu Huguet
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, dist... | madmatah/lapurge | lapurge/purge.py | Python | mit | 3,000 | 0.000333 |
#
# plots.py -- Utility functions for plotting.
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import numpy
import matplotlib as mpl
from matplotlib.figure import Figure
# fix issue of negative numbers rendering incorrectly with default font
mpl.rcParams[... | stscieisenhamer/ginga | ginga/util/plots.py | Python | bsd-3-clause | 17,329 | 0.002193 |
#!/usr/bin/env python
#-*- coding: utf-8 -*
import argparse
from lib.Parser import Parser
from lib.Vectorizer import Vectorizer
# 引数設定
parser = argparse.ArgumentParser()
parser.add_argument('menu')
parser.add_argument('in_path')
parser.add_argument('out_path', nargs='?')
def get_input():
pos = []
neg = []
... | smrmkt/sample_mecab_word2vec | corpus.py | Python | bsd-3-clause | 1,144 | 0.004401 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2018 CERN.
#
# INSPIRE 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 ... | inspirehep/inspire-next | inspirehep/modules/records/serializers/schemas/json/authors/common/position.py | Python | gpl-3.0 | 1,690 | 0 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_configuration.py | Python | mit | 2,950 | 0.004407 |
# -*- coding: utf-8 -*-
# Author: David Goodger
# Contact: goodger@users.sourceforge.net
# Revision: $Revision: 4229 $
# Date: $Date: 2005-12-23 00:46:16 +0100 (Fri, 23 Dec 2005) $
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, pleas... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/docutils/parsers/rst/languages/gl.py | Python | gpl-2.0 | 3,711 | 0.001886 |
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import get_current_site
from django.http import Http404, HttpResponse, HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.template import loader, RequestContext
fr... | Beeblio/django | django/contrib/flatpages/views.py | Python | bsd-3-clause | 2,846 | 0.000703 |
'''
1.create private vpc router network with cidr
2.check dhcp ip address
@author Antony WeiJiang
'''
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.operations.resource_operations as res_ops
import zs... | zstackorg/zstack-woodpecker | integrationtest/vm/simulator/dhcp_server_ip/test_dhcp_for_vpcrouter_cidr.py | Python | apache-2.0 | 2,037 | 0.018164 |
"""Process User Interface and execute commands.
License:
MCC - Command-Line Instance Control for AWS, Azure, GCP and AliCloud.
Copyright (C) 2017-2018 Robert Peteuil
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published... | robertpeteuil/multi-cloud-control | mcc/uimode.py | Python | gpl-3.0 | 12,295 | 0.000081 |
# -*- coding: utf-8 -*-
from datetime import datetime
import json
from pytz import UTC
from django.core.urlresolvers import reverse
from django.test import TestCase
from edxmako import add_lookup
import mock
from django_comment_client.tests.factories import RoleFactory
from django_comment_client.tests.unicode import ... | mtlchun/edx | lms/djangoapps/django_comment_client/tests/test_utils.py | Python | agpl-3.0 | 33,221 | 0.001355 |
__version__ = '1.3'
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import NumericProperty
from gmaps import GMap, run_on_ui_thread
gmap_kv = '''
<Toolbar@BoxLayout>:
size_hint_y: None
height: '48dp'
padding: '4dp'
spacing: '4dp'
canvas:
Color:
rgb... | SwordGO/SwordGO_app | example/kivy-gmaps/main.py | Python | gpl-3.0 | 2,807 | 0.00285 |
import sys
import platform
import twisted
import scrapy
from scrapy.command import ScrapyCommand
class Command(ScrapyCommand):
def syntax(self):
return "[-v]"
def short_desc(self):
return "Print Scrapy version"
def add_options(self, parser):
ScrapyCommand.add_options(self, pars... | pablohoffman/scrapy | scrapy/commands/version.py | Python | bsd-3-clause | 1,277 | 0.003132 |
#!/usr/bin/env python
# pykram
#
# Created by nicerobot on 2012-02-03.
# Copyright (c) 2012 Nice Robot Corporation. All rights reserved.
#
# This file is part of pykram.
#
# pykram is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# ... | pombredanne/pykram | src/main/py/pyelyts.py | Python | gpl-3.0 | 1,729 | 0.019665 |
# Copyright (c) 2018 PaddlePaddle 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 appli... | reyoung/Paddle | benchmark/fluid/models/se_resnext.py | Python | apache-2.0 | 10,123 | 0.000296 |
#!/usr/bin/env python3
"""
Test for Hintidentifier
"""
import datetime
import unittest
from base_test import PschedTestBase
from pscheduler.limitprocessor.identifier.hint import *
DATA = {
"hint": "value",
"match": {
"style": "exact",
"match": "testing",
"case-insensitive": False
... | perfsonar/pscheduler | python-pscheduler/pscheduler/tests/limitprocessor_identifier_hint_test.py | Python | apache-2.0 | 1,127 | 0.002662 |
# -*- coding: utf-8 -*-
class Condition(object):
operator = ''
def __init__(self, operator):
super(Condition, self).__init__()
self.operator = operator
def equal(self, value1, value2):
return (str(value1) == str(value2))
def nequal(self, value1, value2):
return (str(... | OpenSpaceProgram/pyOSP | library/components/Condition.py | Python | mit | 917 | 0.001091 |
"""
Utils module tests.
"""
import shutil
from unittest import TestCase
from microtbs_rl import envs
from microtbs_rl.utils.exploration import LinearDecay
from microtbs_rl.utils.record_policy_execution import record
from microtbs_rl.utils.common_utils import get_test_logger, experiment_dir
from microtbs_rl.algori... | alex-petrenko/hierarchical-rl | microtbs_rl/utils/tests/test_utils.py | Python | mit | 1,981 | 0.000505 |
"""
ICH flash descriptor
"""
import struct
from raw import RAW
from fd import FD
_SIG = '5AA5F00F'.decode('hex')
_SIG_OFFSET = 0x10
_SIG_SIZE = 0x4
_S_HEADER = struct.Struct('< 16s 4s BBBB BBBB BBBB')
_S_REGION = struct.Struct('< H H')
_REGIONS = [('ich', RAW), ('bios', FD), ('me', RAW), ('gbe', RAW), ('plat', RA... | fesh0r/romdump | ichdesc.py | Python | mit | 3,000 | 0.001 |
"""All permissions are defined here.
They are also defined in permissions.zcml.
The two files must be kept in sync.
"""
# Add Permissions:
AddCountry = 'BIKA: Add Country'
AddRegion = 'BIKA: Add Region'
AddCultivar = 'BIKA: Add Cultivar'
AddWineType = 'BIKA: Add Wine type'
AddTransportCondition = 'BIKA: Add Transport... | bikalabs/bika.wine | bika/wine/permissions.py | Python | agpl-3.0 | 669 | 0 |
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404
from wagtail.wagtailcore.models import Page, PageViewRestriction
from wagtail.wagtailadmin.forms import PageViewRestrictionForm
from wagtail.wagtailadmin.modal_workflow import render_modal_workflow
def set_privacy(requ... | mephizzle/wagtail | wagtail/wagtailadmin/views/page_privacy.py | Python | bsd-3-clause | 3,072 | 0.001302 |
#!/usr/bin/python
#======================================================================
#
# Project : hpp_IOStressTest
# File : IOST_WMain_CTRL.py
# Date : Oct 20, 2016
# Author : HuuHoang Nguyen
# Contact : hhnguyen@apm.com
# : hoangnh.hpp@gmail.com
# License : MIT License
# Copyright : 2016
#... | HPPTECH/hpp_IOSTressTest | Refer/IOST_OLD_SRC/IOST_0.10/IOST_WMain_CTRL.py | Python | mit | 2,475 | 0.006061 |
"""Support for Peewee ORM (https://github.com/coleifer/peewee)."""
from __future__ import annotations
import typing as t
import marshmallow as ma
import muffin
import peewee as pw
from apispec.ext.marshmallow import MarshmallowPlugin
from marshmallow_peewee import ForeignKey, ModelSchema
from muffin.typing import JS... | klen/muffin-rest | muffin_rest/peewee/__init__.py | Python | mit | 5,302 | 0.000943 |
"""
Chaotic series
"""
from plotting import plot_iteration
from generic_iteration import generic_iteration
class Iterator:
"""Iterator object to compute iterative processes or magnitudes.
"""
def __init(self, iter_f, stop_f):
"""Instantiation of the iteration.
Parameters
-----... | tgquintela/ChaosFunctions | ChaosFunctions/chaotic_series.py | Python | mit | 1,312 | 0 |
# encoding: utf-8
__import__('pkg_resources').declare_namespace(__name__)
| NicoVarg99/daf-recipes | ckan/ckan/ckan/ckanext/stats/__init__.py | Python | gpl-3.0 | 75 | 0 |
# -*- coding: utf-8 -*-
from gluon import *
from s3 import *
from s3layouts import *
try:
from .layouts import *
except ImportError:
pass
import s3menus as default
# =============================================================================
class S3MainMenu(default.S3MainMenu):
"""
Custom Main ... | flavour/eden | modules/templates/historic/WACOP/menus.py | Python | mit | 8,445 | 0.003671 |
#!/usr/bin/env python
import os
import random
import types
import uuid
import msgpack
import MySQLdb
#from MySQLdb.cursors import DictCursor
#from MySQLdb.cursors import Cursor
from warnings import filterwarnings
from cocaine.worker import Worker
from cocaine.logging import Logger
#Suppressing warnings
filterwarnin... | kartvep/Combaine | plugins/datagrid/mysqldg.py | Python | lgpl-3.0 | 5,281 | 0.00303 |
#!/usr/bin/python
# encoding: utf-8
# -*- coding: utf8 -*-
from gevent import monkey
monkey.patch_all()
hosts = [
'https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info', # 公众平台接口通用域名
'https://qyapi.weixin.qq.com/cgi-bin/menu/get', # 企业号域名
'https://login.weixin.qq.com/', # 微信网页版
'https://wx2... | WZQ1397/automatic-repo | python/checkWeixinApi.py | Python | lgpl-3.0 | 1,022 | 0.002075 |
# -*- coding: utf-8 -*-
"""
{{ cookiecutter.app_name }}.api.v1
{{ "~" * (cookiecutter.app_name ~ ".api.v1")|count }}
:author: {{ cookiecutter.author }}
:copyright: © {{ cookiecutter.copyright }}
:license: {{ cookiecutter.license }}, see LICENSE for more details.
templated from https://github.c... | ryanolson/cookiecutter-webapp | {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/api/v1/__init__.py | Python | mit | 946 | 0.001058 |
# coding: utf-8
import os
import sys
import logging
import webbrowser
import socket
import time
import json
import traceback
import cv2
import tornado.ioloop
import tornado.web
import tornado.websocket
from tornado.concurrent import run_on_executor
from concurrent.futures import ThreadPoolExecutor # `pip install fu... | Andy-hpliu/AirtestX | atx/cmds/webide.py | Python | apache-2.0 | 7,985 | 0.002385 |
#!/bin/env dls-python2.6
'''Channel Access Example'''
from __future__ import print_function
# load correct version of catools
import require
from cothread.catools import *
print(caget('SR21C-DI-DCCT-01:SIGNAL'))
| epicsdeb/cothread | examples/simple.py | Python | gpl-2.0 | 216 | 0 |
from . import check_academic_calendar
from celery.schedules import crontab
from backoffice.celery import app as celery_app
celery_app.conf.beat_schedule.update({
'|Education group| Check academic calendar': {
'task': 'education_group.tasks.check_academic_calendar.run',
'schedule': crontab(minute=0,... | uclouvain/osis | education_group/tasks/__init__.py | Python | agpl-3.0 | 391 | 0.002558 |
"""
" "
" This file is part of the 20n/act project. "
" 20n/act enables DNA prediction for synthetic biology/bioengineering. "
" Copyright (C) 2017 20n Labs, Inc. "
" ... | 20n/act | reachables/src/main/python/DeepLearningLcmsPeak/netcdf/netcdf_parser.py | Python | gpl-3.0 | 2,813 | 0.000711 |
#!/usr/bin/env python3
# encoding: utf-8
'''
Other good PDF utils available on Debian/Ubuntu Linux:
pdfshuffler a gui of PyPDF.
pdfgrep search pdf files for a regular expression. For example, "pdfgrep -n scare *.pdf" search a word among pdf files under current directory.
cups-pdf PDF printer for CUPS. It does what Sm... | yuzhichang/pdf_shuffer | pdf_shuffer.py | Python | gpl-3.0 | 34,766 | 0.006041 |
from wheelcms_axle.content import Content, FileContent, ImageContent
from wheelcms_axle.spoke import Spoke, action, FileSpoke
from wheelcms_axle.content import type_registry
from django.db import models
class Type1(Content):
t1field = models.TextField(null=True, blank=True)
class Type1Type(Spoke):
model = T... | wheelcms/wheelcms_axle | wheelcms_axle/tests/models.py | Python | bsd-2-clause | 2,181 | 0.006419 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ExtractSpecificVertices.py
--------------------
Date : October 2016
Copyright : (C) 2016 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
******... | mhugo/QGIS | python/plugins/processing/algs/qgis/ExtractSpecificVertices.py | Python | gpl-2.0 | 6,483 | 0.002314 |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
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 opti... | JamesLinEngineer/RKMC | addons/plugin.video.phstreams/resources/lib/sources/phdmovies_mv_tv.py | Python | gpl-2.0 | 6,645 | 0.017306 |
# Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | beagles/neutron_hacking | neutron/tests/unit/ml2/test_rpcapi.py | Python | apache-2.0 | 5,110 | 0 |
from .thetvdb import TheTVDB
from .tmdb import TheMDB
| aminotti/converter | lib/scrapper/__init__.py | Python | gpl-3.0 | 54 | 0 |
import datetime
from judge.utils.timedelta import nice_repr
from . import registry
@registry.filter
def timedelta(value, display='long'):
if value is None:
return value
return nice_repr(value, display)
@registry.filter
def timestampdelta(value, display='long'):
value = datetime.timedelta(second... | DMOJ/site | judge/jinja2/timedelta.py | Python | agpl-3.0 | 584 | 0 |
from setuptools import setup, find_packages
__name__ = 'deanslist'
__version__ = '0.6'
setup(
name=__name__,
version=__version__,
url='https://github.com/donowsolutions/%s' % __name__,
author='Jonathan Elliott Blum',
author_email='jon@donowsolutions.com',
description='DeansList API wrapper',
... | donowsolutions/deanslist | setup.py | Python | mit | 1,127 | 0 |
"""
fstab - file ``/etc/fstab``
===========================
Parse the ``/etc/fstab`` file into a list of lines. Each line is a dictionary
of fields, named according to their definitions in ``man fstab``:
* ``fs_spec`` - the device to mount
* ``fs_file`` - the mount point
* ``fs_vfstype`` - the type of file system
* ... | wcmitchell/insights-core | insights/parsers/fstab.py | Python | apache-2.0 | 6,335 | 0.00221 |
# Copyright 2015 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.
class BaseError(Exception):
"""Base error for all test runner errors."""
def __init__(self, message, is_infra_error=False):
super(BaseError, self).... | catapult-project/catapult | devil/devil/base_error.py | Python | bsd-3-clause | 747 | 0.008032 |
#!/usr/bin/env python
config = {
"exes": {
# Get around the https warnings
"hg": ['/usr/local/bin/hg', "--config", "web.cacerts=/etc/pki/tls/certs/ca-bundle.crt"],
"hgtool.py": ["/usr/local/bin/hgtool.py"],
"gittool.py": ["/usr/local/bin/gittool.py"],
},
'gecko_pull_url': 'ht... | kartikgupta0909/gittest | configs/b2g_bumper/master.py | Python | mpl-2.0 | 3,963 | 0.003028 |
import pymake.data, pymake.functions, pymake.util
import unittest
import re
def multitest(cls):
for name in cls.testdata.keys():
def m(self, name=name):
return self.runSingle(*self.testdata[name])
setattr(cls, 'test_%s' % name, m)
return cls
class SplitWordsTest(unittest.TestCase... | mozilla/pymake | tests/datatests.py | Python | mit | 6,946 | 0.001152 |
#!/usr/bin/python
'''
The MIT License (MIT)
Copyright (c) 2013-2015 SRS(simple-rtmp-server)
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 r... | drunknbass/srs | trunk/research/code-statistic/cs.py | Python | mit | 3,920 | 0.006633 |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test behavior of headers messages to announce blocks.
Setup:
- Two nodes:
- node0 is the node-und... | Flowdalic/bitcoin | test/functional/p2p_sendheaders.py | Python | mit | 26,404 | 0.002197 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.