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 python3
"""
Utility to ensure correctness of the CircleCI workflow
"""
import sys
from difflib import unified_diff
import click
import yaml
from yaml.parser import ParserError
def _red(string):
return click.style(string, fg="red")
def _green(string):
return click.style(string, fg="green")
... | hackaugusto/raiden | tools/check_circleci_config.py | Python | mit | 1,876 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('warehouse', '0017_auto_20141223_1024'),
]
operations = [
migrations.AddField(
model_name='profile',
... | smn/goggles | goggles/warehouse/migrations/0018_profile_username.py | Python | bsd-2-clause | 451 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Open Data Portal.
# Copyright (C) 2018 CERN.
#
# CERN Open Data Portal 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, o... | RaoOfPhysics/opendata.cern.ch | cernopendata/modules/records/serializers/schemaorg.py | Python | gpl-2.0 | 2,117 |
from Embedded_OpenOrange import Embedded_Field
#from core.database.Database import Database
from decimal import Decimal
class Field(Embedded_Field):
def __init__(self, record, fieldname_or_fielddef):
Embedded_Field.__init__(self, record, fieldname_or_fielddef)
def setValue(self, v):
if isinst... | ancho85/pylint-playero-plugin | corepy/embedded/Field.py | Python | gpl-2.0 | 1,010 |
# META: timeout=long
import pytest
from tests.support.asserts import assert_dialog_handled, assert_error, assert_png, assert_success
def take_screenshot(session):
return session.transport.send(
"GET", "session/{session_id}/screenshot".format(**vars(session)))
@pytest.fixture
def check_user_prompt_clos... | scheib/chromium | third_party/blink/web_tests/external/wpt/webdriver/tests/take_screenshot/user_prompts.py | Python | bsd-3-clause | 3,719 |
#akara.resource
"""
There is no superclass for an Akara resource. It's any object with an id data mamber
self.policy - instance of L{akara.policy.manager}
"""
#__all__ = ['manager', 'standard_index']
CREATED = 'akara:created'
UPDATED = 'akara:updated'
CONTENT_LENGTH = 'akara:size'
CONTENT_TYPE = 'akara:type'
clas... | uogbuji/akara | lib/resource/__init__.py | Python | apache-2.0 | 2,414 |
from application.photo2song_handler import BaseHandler
from collections import namedtuple
from api.echonest import Track
import api.photo2song as p2s
class DummyHandler(BaseHandler):
def post(self):
image_urls = self.get_image_urls()
self.respond(image_urls)
def get(self):
image_urls... | icoxfog417/music_hack_day_onpasha | application/dummy.py | Python | mit | 3,954 |
#!/usr/bin/env python
"""
DigitalOcean external inventory script
======================================
Generates Ansible inventory of DigitalOcean Droplets.
In addition to the --list and --host options used by Ansible, there are options
for generating JSON of other DigitalOcean data. This is useful when creating
d... | tareqalayan/ansible | contrib/inventory/digital_ocean.py | Python | gpl-3.0 | 21,187 |
#!/usr/bin/python
# encoding: utf-8
# -*- coding: utf8 -*-
"""
Example of program with many options using docopt, control system service.
Usage:
docoptOps.py SERVICE_NAME SERVICE_ACTION
docoptOps.py SERVICE_ACTION SERVICE_NAME
docoptOps.py --version | -v
docoptOps.py --help | -h
Arguments:
SERVICE_NAME servi... | WZQ1397/automatic-repo | python/choose_opt/docoptOps.py | Python | lgpl-3.0 | 1,053 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | nii-cloud/dodai-compute | nova/auth/ldapdriver.py | Python | apache-2.0 | 27,954 |
import MySQLdb
import datetime
import logging
def addWhereClause(whereClauses, clause):
if (whereClauses is None):
whereClauses = " WHERE "
else:
whereClauses += " AND "
whereClauses += clause
return whereClauses;
def getTemperaturesWhereClause(dateMin, dateMax, sonde):
return getWhereClause([
{'field':'da... | manuelsimon/domotique | lib/repository.py | Python | mit | 10,444 |
import subprocess,os,sys
from mymerge import mymerge
def file_len(fname):
p = subprocess.Popen(['wc', '-l', fname], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
result, err = p.communicate()
if p.returncode != 0:
raise IOError(err)
return int(re... | davidaknowles/epidiff | myjaccard2.py | Python | gpl-2.0 | 1,566 |
"""Support for devices connected to UniFi POE."""
import logging
from homeassistant.components import unifi
from homeassistant.components.switch import SwitchDevice
from homeassistant.const import CONF_HOST
from homeassistant.core import callback
from homeassistant.helpers import entity_registry
from homeassistant.hel... | fbradyirl/home-assistant | homeassistant/components/unifi/switch.py | Python | apache-2.0 | 9,137 |
from rpython.rtyper.lltypesystem import rffi, lltype, llmemory
from rpython.translator.tool.cbuild import ExternalCompilationInfo
from rpython.translator import cdir
import py, sys
from rpython.rlib import jit, rgc
from rpython.rlib.debug import ll_assert
from rpython.rlib.objectmodel import we_are_translated, speciali... | oblique-labs/pyVM | rpython/rlib/rthread.py | Python | mit | 16,729 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | noironetworks/heat | heat/tests/clients/test_magnum_client.py | Python | apache-2.0 | 2,840 |
# wikirandom.py: Functions for downloading random articles from Wikipedia
#
# Copyright (C) 2010 Matthew D. Hoffman
#
# 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 Lic... | BigBayes/SGRLD | wikirandom.py | Python | gpl-3.0 | 4,851 |
#!/usr/bin/env python3
# coding=utf-8
"""
@version:0.1
@author: ysicing
@file: blog/views.py
@time: 2017/9/9 13:10
"""
from flask import render_template, Blueprint
views = Blueprint('views', __name__)
@views.route('/')
@views.route('/<any(index,home):path>')
def home(path=None):
return render_template('home.... | dc-project/blog | app/views.py | Python | agpl-3.0 | 504 |
import re
import pafy
class PlaylistData:
UNSUPPORTED_CHARS = ['\\', '/', '?', '*', '"', ':', '<', '>', '#', '%']
def __init__(self, url):
self._url = url
self._songs_names = None
self._best_streams = None
self._pafy_data = None
@property
def url(self):
retur... | dragonator/ytsync | src/playlist_data.py | Python | mit | 2,015 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/bandwidth/auto_bandwidth/underflow/state/__init__.py | Python | apache-2.0 | 29,125 |
"""
Multi-panel Scatter Plot with Linked Brushing
---------------------------------------------
This is an example of using an interval selection to control the color of
points across multiple panels.
"""
# category: interactive charts
import altair as alt
from vega_datasets import data
source = data.cars()
brush = a... | altair-viz/altair | altair/examples/scatter_linked_brush.py | Python | bsd-3-clause | 641 |
#! /usr/bin/python
from FB15k_exp import *
launch(op='SME_bil', simfn='Dot', ndim=50, nhid=50, marge=1., lremb=0.01,
lrparam=1., nbatches=100, totepochs=1000, test_all=10, neval=1000,
savepath='FB15k_SME_bil', datapath='../data/')
| masoodking/LinkPrediction | SME/FB15k/FB15k_SME_bil.py | Python | bsd-3-clause | 240 |
from __future__ import absolute_import
from .dedup import MultiqcModule
| ewels/MultiQC | multiqc/modules/dedup/__init__.py | Python | gpl-3.0 | 73 |
# Copyright (C) 2008 One Laptop Per Child
#
# 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 program is distribu... | nemesiscodex/JukyOS-sugar | src/jarabe/model/notifications.py | Python | gpl-2.0 | 3,325 |
import numpy as np
import instance_occlsegm_lib
def view_object_data(object_data):
for objd in object_data:
lbl = instance_occlsegm_lib.image.mask_to_lbl(
objd['mask'], objd['label'])
lbl_viz = instance_occlsegm_lib.datasets.visualize_label(
lbl, objd['img'], seg_dataset.c... | start-jsk/jsk_apc | demos/instance_occlsegm/tests/aug_tests/check_seg_dataset_to_object_data.py | Python | bsd-3-clause | 789 |
# Copyright 2016 Hewlett Packard Enterprise Development, 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 req... | HewlettPackard/python-proliant-sdk | examples/Rest/ex51_import_ssl.py | Python | apache-2.0 | 2,037 |
"""
Copyright 2017-present Airbnb, 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 writing, sof... | airbnb/streamalert | streamalert_cli/athena/helpers.py | Python | apache-2.0 | 9,745 |
import sys
import time
import unittest
import numpy as np
import numpy.random as rnd
import gpflow
sys.path.append('..')
import opt_tools as ot
class TestGPflowHelper(unittest.TestCase):
def setUp(self):
X = np.linspace(0, 5, 100)[:, None]
Y = 0.3 * np.sin(2 * X) + 0.05 * rnd.randn(*X.shape)
... | markvdw/opt_tools | testing/test_helpers.py | Python | apache-2.0 | 1,578 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | 111pontes/ydk-py | cisco-ios-xe/ydk/models/cisco_ios_xe/_meta/_ATM_FORUM_TC_MIB.py | Python | apache-2.0 | 1,135 |
# -*- coding: utf-8 -*-
from mrjob.job import MRJob
from mrjob.step import MRStep
from mrjob.compat import jobconf_from_env
import string
class MRTf_Idf(MRJob):
def tf_mapper(self, _, line):
for x in string.punctuation:
line = line.replace(x,' ')
line = line.split()
for word... | tayebzaidi/PPLL_Spr_16 | tf-idf_map_reduce/02-tf_idf.py | Python | gpl-3.0 | 1,341 |
from sys import exit, version_info
import logging
logger = logging.getLogger(__name__)
try:
from smbus import SMBus
except ImportError:
if version_info[0] < 3:
logger.warning("Falling back to mock SMBus. This library requires python-smbus. Install with: sudo apt-get install python-smbus")
elif ver... | WayneKeenan/picraftzero | picraftzero/thirdparty/pimoroni/pantilthat/__init__.py | Python | mit | 1,293 |
from .interfaces import IAppEusFeaturedApp
from five import grok
from plone import api
from plone.app.contenttypes.interfaces import ICollection
from plone.registry.interfaces import IRegistry
from zope.component import getUtility
grok.templatedir('templates')
class Home(grok.View):
grok.context(ICollection)
... | codesyntax/appeus.theme | appeus/theme/browser/home.py | Python | gpl-2.0 | 791 |
import doctest
import sys
import os
sys.path.insert(0, '..')
sys.path.insert(0, os.path.join('..','plugins'))
doctest.testfile("arturo.doctest")
| systempuntoout/Arturo | test/all_test.py | Python | gpl-3.0 | 145 |
"""
raven.contrib.django.middleware
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
import threading
from django.conf import settings
from django... | mottosso/mindbender-setup | bin/pythonpath/raven/contrib/django/middleware/__init__.py | Python | mit | 3,690 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import shu... | kwlzn/pants | src/python/pants/backend/jvm/tasks/jar_task.py | Python | apache-2.0 | 18,301 |
from kmediatorrent import plugin
from kmediatorrent.scrapers import scraper
from kmediatorrent.ga import tracked
from kmediatorrent.caching import cached_route
from kmediatorrent.utils import ensure_fanart
from kmediatorrent.library import library_context
# Temporary, will be fixed later by them
IMMUNICITY_TPB_URL = ... | jmarth/plugin.video.kmediatorrent | resources/site-packages/kmediatorrent/scrapers/tpb.py | Python | gpl-3.0 | 3,157 |
from __future__ import division, print_function, absolute_import
# todataframe()
###############
import petl as etl
table = [('foo', 'bar', 'baz'),
('apples', 1, 2.5),
('oranges', 3, 4.4),
('pears', 7, .1)]
df = etl.todataframe(table)
df
# fromdataframe()
#################
import petl a... | thatneat/petl | examples/io/pandas.py | Python | mit | 524 |
import mxnet as mx
import numpy as np
from numpy.testing import assert_allclose
def check_multi_softmax_with_shape(shape, xpu):
X = mx.symbol.Variable('X')
L = mx.symbol.Variable('L')
Y = mx.symbol.SoftmaxOutput(data=X, label=L, multi_output=True)
x = mx.random.uniform(-1, 1, shape, ctx = xpu)
l = ... | JiJingYu/MXNet-using | multi_softmax/test_multi_softmax.py | Python | gpl-3.0 | 758 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2010 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... | NetApp/manila | manila/tests/api/test_wsgi.py | Python | apache-2.0 | 2,214 |
#!/usr/bin/env python3.6
# Stress tests for the geometric median.
import numpy as np
from kinback.pointset import geommedian
p1 = np.array([[0.95964001, 0.57039492], [0.49983666, 0.38651292], [0.24228648, 0.18275922], [0.92150915, 0.73461902]])
p2 = np.array([[0.95964001, 0.57039492], [0.5, 0.2], [0.24228648, 0.182759... | Parclytaxel/Kinross | stresstests/gm.py | Python | mit | 1,985 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-25 21:48
from __future__ import unicode_literals
from django.db import migrations
def add_exam_types(apps, schema_editor):
Exam = apps.get_model('exams', 'Exam')
ExamType = apps.get_model('exams', 'ExamType')
for exam in Exam.objects.all():
... | Zahajamaan/Fudulbank | exams/migrations/0034_fill_exam_exam_types.py | Python | agpl-3.0 | 986 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Spirograph Activity
Author: tennessee
Created on: 2017-03-21
Copyright 2017, Tennessee Carmel-Veilleux.
"""
import numpy as np
from activity import Activity, NumericalActivityParam
class SpirographActivity(Activity):
def __init__(self, parent, drawbot, *args, **... | tcarmelveilleux/CheapDrawBot | Software/activities/spirograph.py | Python | mit | 2,618 |
"""
Create python docs for dash easily.
"""
__version__ = '0.2.1'
__author__ = 'whtsky'
__license__ = 'MIT'
| whtsky/Dash.py | dash_py/__init__.py | Python | mit | 109 |
#!/usr/local/bin/python
import requests
import json
import sys
sys.path.append('../conn/')
import conn
vol_name = raw_input('Input volume name:')
url = conn.url+'storage/volume/'+vol_name+'/datasets/'
auth = conn.auth
headers = conn.headers
payload = {
"avail": "2.44G",
"mountpoint": "/mnt/"+vol_name+"/foo",
"n... | PatriQ7/freenas-test-api | storage/dataset.py | Python | bsd-3-clause | 1,053 |
#!/usr/bin/env python3
"""
Shortcodes
==========
A library for parsing customizable WordPress-style shortcodes. Useful as a
drop-in component in text-processing applications.
Supports shortcodes with space-separated positional and keyword arguments::
[% tag arg1 "arg 2" key1=arg3 key2="arg 4" %]
Shortcodes can ... | dmulholland/shortcodes | setup.py | Python | unlicense | 1,694 |
from faulhaber_const import commands as FMCC
fautmel=['GTYP', 'GSER', 'VER', 'GN', 'GCL', 'GRM', 'GKN', 'RM', 'KN', 'ANSW', 'NET', 'CST', 'CO', 'SO', 'TO', 'SAVE', 'BAUD', 'NODEADR', 'GNODEADR', 'GADV', 'EN', 'DI', 'GTIMEOUT', 'TIMEOUT', 'UPTIME', 'SADV']
from crcmod.predefined import mkCrcFun as mkCrcFunPre
from crcm... | wittrup/crap | python/fmcc.py | Python | mit | 1,737 |
#!/usr/bin/env python
# Copyright 2019 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-ios-sdk | Firestore/Protos/lib/pretty_printing.py | Python | apache-2.0 | 12,729 |
import random
import copy
from mainbot.commands import Command
class cardClasses():
class Card():
suits = ["H", "D", "C", "S"]
ranks = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"]
def __init__(self, suit, rank):
self.suit = suit
self.ran... | MrMindImplosion/Slack-Bots | games/card.py | Python | gpl-2.0 | 18,345 |
# Copyright (c) 2012 OpenStack Foundation
#
# 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 ... | yosshy/nova | nova/api/openstack/compute/certificates.py | Python | apache-2.0 | 3,279 |
#-------------------------------------------------------------------------------
# Name: modulo1
# Purpose:
#
# Author: tasora
#
# Created: 14/02/2012
# Copyright: (c) tasora 2012
# Licence: <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/... | andrewseidl/chrono | src/demos/python/demo_solidworks_irrlicht.py | Python | bsd-3-clause | 2,784 |
from __future__ import division
from __future__ import print_function
from bisect import insort
from boxbranding import getMachineBrand, getMachineName
from datetime import datetime
from os import fsync, remove, rename, system
from os.path import exists
from time import ctime, time, strftime, localtime, mktime
from en... | openatv/enigma2 | lib/python/PowerTimer.py | Python | gpl-2.0 | 45,978 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations ... | Mariatta/pythondotorg | blogs/migrations/0001_initial.py | Python | apache-2.0 | 5,940 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "topthecharts.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that... | brycematsuda/top-the-charts | manage.py | Python | mit | 810 |
# coding=utf-8
from django.conf.urls import url
import views
urlpatterns = [
url(r'^$', views.post_list, name='post_list'),
url(r'^post/(?P<pk>\d+)/$', views.post_detail, name='post_detail'),
url(r'^post/new/$', views.post_new, name='post_new'),
url(r'^post/(?P<pk>\d+)/edit/$', views.post_edit, name='p... | Ninad998/FinalYearProject | django_app/urls.py | Python | mit | 565 |
import operator
def version_compare(v1, operator, v2):
"""
The function first replaces _, - and + with a dot . in the version strings and also inserts dots . before and
after any non number so that for example '4.3.2RC1' becomes '4.3.2.RC.1'. Then it compares the parts starting
from left to right. If ... | cernbox/smashbox | python/smashbox/utilities/version.py | Python | agpl-3.0 | 5,305 |
# mod_11_10.py - functions for performing the ISO 7064 Mod 11, 10 algorithm
#
# Copyright (C) 2010, 2011, 2012, 2013 Arthur de Jong
#
# 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; eithe... | dchoruzy/python-stdnum | stdnum/iso7064/mod_11_10.py | Python | lgpl-2.1 | 2,129 |
# Generated by Django 3.1.7 on 2021-03-29 16:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('system_settings', '0008_auto_20210325_2015'),
]
operations = [
migrations.CreateModel(
name='Sitename',
fields=[
... | GovReady/govready-q | system_settings/migrations/0009_sitename.py | Python | gpl-3.0 | 528 |
"""
Testing and training events.
There are:
* TestResult
* BeginIteration
* EndIteration
* BeginPass
* EndPass
"""
__all__ = [
'EndIteration', 'BeginIteration', 'BeginPass', 'EndPass', 'TestResult'
]
class WithMetric(object):
def __init__(self, evaluator):
import py_paddle.swig_paddle as api
... | yu239/Paddle | python/paddle/v2/event.py | Python | apache-2.0 | 1,763 |
import os
class path_helper(object):
"""
This is a path object to allow for root, base, and full path storage to create relative paths
"""
# base_path = '';
# obj_path = '';
# root_path = '';
def __init__(self, path, root):
self.obj_path = os.path.normpath(path);
self.b... | samdmarshall/xcparse | xcparse/Helpers/path_helper.py | Python | bsd-3-clause | 1,026 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2022, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Tests for Physical Constants
#############################################
Physical constants are created using the factory paradigm.
"""
from exatomic.exa.util import constants
... | exa-analytics/exatomic | exatomic/exa/util/tests/test_constants.py | Python | apache-2.0 | 762 |
#!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Schema of the JSON summary file written out by the GM tool.
This must be kept in sync with the kJsonKey_ constants in gm_expect... | trevorlinton/skia | gm/gm_json.py | Python | bsd-3-clause | 5,464 |
import collections
import cobble
def paragraph(style_id=None, style_name=None, numbering=None):
return ParagraphMatcher(style_id, style_name, numbering)
ParagraphMatcher = collections.namedtuple("ParagraphMatcher", ["style_id", "style_name", "numbering"])
ParagraphMatcher.element_type = "paragraph"
def run(s... | mwilliamson/python-mammoth | mammoth/document_matchers.py | Python | bsd-2-clause | 1,864 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pugixml(CMakePackage):
"""Light-weight, simple, and fast XML parser for C++ with XPath su... | rspavel/spack | var/spack/repos/builtin/packages/pugixml/package.py | Python | lgpl-2.1 | 1,016 |
# Copyright 2015 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... | yaroslavvb/tensorflow | tensorflow/tools/docs/parser.py | Python | apache-2.0 | 39,565 |
"""
Tests for dnstools module.
"""
import pytest
from ..dnstools import add, delete, update, query_ns, parse_name, update_ns, SameIpError
from django.conf import settings
BASEDOMAIN = settings.BASEDOMAIN
from dns.resolver import NXDOMAIN
class TestIntelligentUpdater(object):
def test_double_update(self):
... | asmaps/nsupdate.info | nsupdate/main/_tests/test_dnstools.py | Python | bsd-3-clause | 6,223 |
#!/usr/bin/env python
"""
Keyboard teleoperation node for the Axis camera.
Use WSAD to control pan-tilt, and QE to control zoom. Shift increases speed.
Do not hold the buttons all the time, the commands need some time to get executed.
"""
import rospy
from axis_camera.msg import PTZ
import sys, select, termios, tty... | tradr-project/axis_camera | nodes/keyboard_teleop.py | Python | bsd-3-clause | 2,403 |
import logging
from sqlalchemy.orm.attributes import InstrumentedAttribute
from sqlalchemy.orm import joinedload
from sqlalchemy.sql.expression import desc
from sqlalchemy import Column, Boolean, func, or_
from sqlalchemy.exc import IntegrityError
from flask import flash
from flask.ext.admin._compat import string_ty... | pawl/flask-admin | flask_admin/contrib/sqla/view.py | Python | bsd-3-clause | 31,396 |
# Copyright 2017 The UAI-SDK 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 applicable... | ucloud/uai-sdk | uaitrain_tool/caffe/caffe_tool.py | Python | apache-2.0 | 3,505 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | veger/ansible | lib/ansible/modules/network/f5/bigip_gtm_monitor_tcp_half_open.py | Python | gpl-3.0 | 23,412 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "coogger.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | hakancelik96/coogger | manage.py | Python | mit | 805 |
from __future__ import print_function
import argparse
from base64 import b64decode
from collections import namedtuple
from errno import ENOENT
from hashlib import md5
import json
from operator import methodcaller
import sys
from time import time
from six.moves import map, ran... | jwodder/doapi | doapi/cli/droplet.py | Python | mit | 19,747 |
from abc import ABCMeta, abstractmethod
import logging
from parsl.utils import RepresentationMixin
logger = logging.getLogger(__name__)
class Launcher(RepresentationMixin, metaclass=ABCMeta):
"""Launchers are basically wrappers for user submitted scripts as they
are submitted to a specific execution resourc... | Parsl/parsl | parsl/launchers/launchers.py | Python | apache-2.0 | 15,164 |
#!/usr/bin/python
import os, re, ujson
DATABASE_FILE = 'dls/mtg_database.txt'
COLOR_REGEX = '[wburgWBURG]'
COLOR_MAP = {
'W' : 'White', 'B': 'Black', 'U': 'Blue', 'R': 'Red', 'G': 'Green'
}
GENERIC_TYPES = [
'Enchant', 'Creature', 'Land', 'Sorcery', 'Instant', 'Planeswalker',
'Artifact'
]
OUT_DIR = 'generate... | golmansax/mtg-cube | data/mtg_lookup.py | Python | mit | 3,547 |
import time
import urllib.request, urllib.parse, urllib.error
import json
import datetime
from urllib.parse import parse_qs, urlparse
from django.conf import settings
from django.test.client import RequestFactory
import oauth2 as oauth
from oauth_provider.tests.auth import BaseOAuthTestCase, METHOD_AUTHORIZATION_HEA... | adlnet/ADL_LRS | oauth_provider/tests/issues.py | Python | apache-2.0 | 21,813 |
"""Abstract base classe for vCard Properties.
"""
import warnings
from abc import abstractmethod, ABCMeta
from collections.abc import Sequence
from ..param import from_string as param_from_string
from ..tools.base import CRLF
from ..tools.lexer import escape_value, split_list
__all__ = ["Prop", "StringProp", "Tuple... | Jorispilot/pycard | pycard/prop/base.py | Python | mit | 4,158 |
"""Declares different exceptions as used throughout WsgiService."""
import logging
logger = logging.getLogger(__name__)
class ValidationException(Exception):
"""Exception thrown when a validation fails. See
:func:`wsgiservice.decorators.validate` for it's use.
"""
def __init__(self, *args, **kwargs)... | pneff/wsgiservice | wsgiservice/exceptions.py | Python | bsd-2-clause | 746 |
#!/usr/bin/env python
from distutils.core import setup
setup(name='pyinputevent',
version='0.1c',
description='Python interface to Linux input subsystem',
author='Robert Thomson',
author_email='git@corporatism.org',
license="BSD",
url='http://blog.corporatism.org/blog/2010/02/',
... | makei/pyinputevent | setup.py | Python | bsd-3-clause | 362 |
# -*- coding: utf-8 -*-
import os
import re
from stat import S_IMODE
from enigma import eEnv
SCOPE_TRANSPONDERDATA = 0
SCOPE_SYSETC = 1
SCOPE_FONTS = 2
SCOPE_SKIN = 3
SCOPE_SKIN_IMAGE = 4
SCOPE_USERETC = 5
SCOPE_CONFIG = 6
SCOPE_LANGUAGE = 7
SCOPE_HDD = 8
SCOPE_PLUGINS = 9
SCOPE_MEDIA = 10
SCOPE_PLAYLIST = 11
SCOPE_CU... | kingvuplus/Test-OBH | lib/python/Tools/Directories.py | Python | gpl-2.0 | 8,320 |
#!/usr/bin/python
# create_project.py
# Create cross-platform cocos2d-x project
# Copyright (c) 2012 cocos2d-x.org
# Author: WangZhe
# define global variables
context = {
"input" : "undefined",
"output" : "undefined",
"cocos2d" : "undefined",
}
# begin
import sys
import os, os.path
def ... | arca1n/cocos2d-x_nextpeer_integration | tools/closure-compiler/obfuscate.py | Python | mit | 4,456 |
''' Copyright 2015 Neokami GmbH. '''
from .NeokamiBaseException import NeokamiBaseException
class NeokamiSDKException(NeokamiBaseException):
'''raise this when there's a SDK error''' | NeokamiCode/Python-SDK | src/Neokami/Exceptions/NeokamiSDKException.py | Python | apache-2.0 | 185 |
#
# This tests that we can't reparent items to places where
# they don't make sense, or result in broken system.
# In addition, it tests the attrs.locked behavior to
# ensure things are locked that should be locked, etc.
#
# This gives the ui hints about what things should be
# drop targets, or dragable, etc.
#
import... | rcbops/opencenter | tests/full_bad_state.py | Python | apache-2.0 | 15,583 |
#!/usr/bin/env python
# coding: utf-8
'''
create_six_angle_depth_map.pyで生成した、階層構造になった深度マップを
一つのnpyファイルにまとめる
'''
import os
import re
import sys
import time
import numpy as np
if __name__ == '__main__':
dir_path, save_array_path = sys.argv[1:]
# 整数抜き出し用正規表現
c = re.compile("\d+")
def sort_str(s_it... | kanairen/DepthProjector | scripts/compose_depth_array.py | Python | apache-2.0 | 1,826 |
# -*- coding:utf-8 -*-
import struct
from Tribler.Core.Config.tribler_config import TriblerConfig
from Tribler.Core.Modules.restapi.util import convert_search_torrent_to_json, convert_db_channel_to_json,\
get_parameter, fix_unicode_array, fix_unicode_dict
from Tribler.Core.Session import Session
from Tribler.Test.... | Captain-Coder/tribler | Tribler/Test/Core/Modules/RestApi/test_util.py | Python | lgpl-3.0 | 4,881 |
# do not import anythung here so the standalone tileserver can run without django
| c3nav/c3nav | src/c3nav/mapdata/render/__init__.py | Python | apache-2.0 | 82 |
from abc import ABCMeta, abstractproperty
class UpdatingMetadataWrapperBase(object):
__metaclass__ = ABCMeta
@abstractproperty
def _wrapped(self):
pass
def __getattr__(self, name):
return getattr(self._wrapped, name)
def __getitem__(self, idx):
return self._wrapped[idx]
... | carlyeks/cassandra-dtest | tools/metadata_wrapper.py | Python | apache-2.0 | 2,439 |
"""
Copyright (c) 2015, 2019 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import os
import json
from datetime import datetime, timedelta
from copy import deepcopy
from textwrap import dedent
from flexmock imp... | DBuildService/atomic-reactor | tests/plugins/test_store_metadata.py | Python | bsd-3-clause | 28,357 |
from __future__ import unicode_literals
from pyramid.view import view_config
from pyramid.response import Response
from pyramid.path import AssetResolver
@view_config(route_name='static_files.favicon')
def favicon_view(request):
resolver = AssetResolver()
path = resolver.resolve('ez2pay:static/favicon.ico').... | victorlin/ez2pay | ez2pay/modules/static_files/views.py | Python | mit | 425 |
## This code for LED BD 00
import serial,os,time
import sys
import RPi.GPIO as GPIO
# RASPI2 PIN OUT NUMBER
# check pin location, http.............
bled = 16
gled = 20
rled = 21
# HW setup, GPIO
GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
GPIO.setup(bled, GPIO.OUT)
GPIO.setup(gled, GPIO.OUT)
GPIO.setup(rled, GPIO.OUT)
GPI... | jeonghoonkang/BerePi | apps/led_berepi/led0_simple.py | Python | bsd-2-clause | 1,147 |
"""
Django settings.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from .settings_default import *
ADMINS = (
('Sebastian Braun', 'sebastian@elmnt.de'),
)
... | glomium/elmnt.de | homepage/settings.py | Python | mit | 1,341 |
from clsNaipeEspaniol import clsNaipeEspaniol
import random
class clsRevisaTruco():
def aleatorio(self):
"""
:description: genera un objeto naipe al azar le asigna un palo y numero aleatorio
return: devuelve un objeto naipe
"""
x = random.randint(1, 4)
palo = ''
... | GrupoDos/TP3_Ejercicio13 | clsRevisaTruco.py | Python | gpl-2.0 | 4,563 |
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
import unittest
from context import src
class NewTestCase(unittest.TestCase):
def test_connections_handling(self):
assert sr... | Drrechu/rna2d | tests/TestConnections.py | Python | gpl-3.0 | 610 |
# Controls the bidding System in which a player can pass or bid
import pycurl
from io import BytesIO
from verbose import *
class AuctionSession:
# This function returns a list containing the history of a bidding session, the declarer, and winning bid.
@staticmethod
def bidding(bid, playerlst, history, dea... | ACBL-Bridge/Bridge-Application | Logic/auction.py | Python | mit | 4,304 |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | google/tangent | tangent/tangents.py | Python | apache-2.0 | 6,571 |
from collections import defaultdict
from datetime import datetime
import requests
from requests import HTTPError
from cloudbot import hook
from cloudbot.util import colors
from cloudbot.util.formatting import pluralize_auto
from cloudbot.util.pager import paginated_list
search_pages = defaultdict(dict)
user_url = "... | weylin/CloudBot | plugins/reddit_info.py | Python | gpl-3.0 | 8,222 |
def list_users_in_account(request_ctx, account_id, search_term=None,
include=None, per_page=None, **request_kwargs):
"""
Retrieve the list of users associated with this account.
@example_request
curl https://<canvas>/api/v1/accounts/self/users?search_term=<search value> \
... | penzance/canvas_python_sdk | static_methods/users.py | Python | mit | 2,009 |
from rest_framework.routers import Route, SimpleRouter
class NestedRouter(object):
def __init__(self, parent_router, parent_prefix, *args, **kwargs):
self.parent_router = parent_router
self.parent_prefix = parent_prefix
this.router = SimpleRouter()
parent_registry = [registered for registered in self.parent_r... | alexkyllo/school-manager | school_manager/api/routers.py | Python | apache-2.0 | 377 |
'''Test helper functions and classes.'''
import ckan.config.middleware
import pylons.config as config
import webtest
def _get_test_app():
'''Return a webtest.TestApp for CKAN, with legacy templates disabled.
For functional tests that need to request CKAN pages or post to the API.
Unit tests shouldn't nee... | aptivate/ckanext-mapactionevent | ckanext/mapactionevent/tests/helpers.py | Python | agpl-3.0 | 2,156 |
'''@file lstm_decoder.py
contains the LstmDecoder class'''
import tensorflow as tf
from nabu.neuralnetworks.classifiers.layer import Linear
class LstmDecoder(object):
'''The decoder object used in a LSTM language model'''
def __init__(self, numlayers, numunits, dropout=1, name=None):
'''speller const... | JeroenBosmans/nabu | nabu/neuralnetworks/classifiers/lm/lm_decoders/lstm_decoder.py | Python | mit | 3,535 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("DummyClassifier" , "BreastCancer" , "mysql")
| antoinecarme/sklearn2sql_heroku | tests/classification/BreastCancer/ws_BreastCancer_DummyClassifier_mysql_code_gen.py | Python | bsd-3-clause | 142 |
""" Certificate namespace commands. """
import os
import click
import requests
# define basestring for python3
try:
basestring
except NameError:
basestring = (str, bytes)
from gandi.cli.core.cli import cli
from gandi.cli.core.utils import output_cert, output_cert_oper, display_rows
from gandi.cli.core.params... | grigouze/gandi.cli | gandi/cli/commands/certificate.py | Python | gpl-3.0 | 18,463 |
#
# 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 us... | h2oai/sparkling-water | py-scoring/tests/conftest.py | Python | apache-2.0 | 1,284 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.