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 |
|---|---|---|---|---|---|---|
# 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 compliance with the License. You may obtain
# a ... | tmenjo/cinder-2015.1.0 | cinder/volume/manager.py | Python | apache-2.0 | 115,641 | 0 |
# Joey Velez-Ginorio
# Gridworld Implementation
# ---------------------------------
from mdp import MDP
from grid import Grid
from scipy.stats import uniform
from scipy.stats import beta
from scipy.stats import expon
import numpy as np
import random
import pyprind
import matplotlib.pyplot as plt
class GridWorld(MDP):... | joeyginorio/Action-Understanding-with-Rational-Rules | model_src/grid_world.py | Python | mit | 9,591 | 0.033886 |
import pylab
import string
import matplotlib
matplotlib.rcParams['figure.subplot.hspace']=.45
matplotlib.rcParams['figure.subplot.wspace']=.3
labels=('Step=1','Step=.5','Step=.25','Step=.01')
steps=(1,.5,.25,.01)
pylab.figure(figsize=(8.5,11))
for i,intxt in enumerate(('O_RK1.txt','O_RK_5.txt','O_RK_25.txt','O_RK_... | justincely/classwork | UMD/AST615/HW6_2/plot_orbit.py | Python | bsd-3-clause | 1,806 | 0.035991 |
import os
import sys
import json
import pytest
import subprocess
import time
from kat.harness import Query, is_ingress_class_compatible
from abstract_tests import AmbassadorTest, HTTP, ServiceType
from kat.utils import namespace_manifest
from tests.utils import KUBESTATUS_PATH
from ambassador.utils import parse_bool
... | datawire/ambassador | python/tests/kat/t_ingress.py | Python | apache-2.0 | 16,179 | 0.00309 |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2011,2012,2013,2014,2015,2016,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... | quattor/aquilon | tests/broker/test_add_alias.py | Python | apache-2.0 | 18,764 | 0.001439 |
from datetime import date
from mock import patch
from nose.tools import eq_
from kitsune.sumo import googleanalytics
from kitsune.sumo.tests import TestCase
from kitsune.wiki.tests import document, revision
class GoogleAnalyticsTests(TestCase):
"""Tests for the Google Analytics API helper."""
@patch.object... | dbbhattacharya/kitsune | kitsune/sumo/tests/test_googleanalytics.py | Python | bsd-3-clause | 15,153 | 0 |
# coding: utf-8
import sys
from setuptools import setup, find_packages
NAME = "pollster"
VERSION = "2.0.2"
# To install the library, run the following
#
# python setup.py install
#
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools
REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-da... | huffpostdata/python-pollster | setup.py | Python | bsd-2-clause | 756 | 0.003968 |
#!/usr/bin/env python3
import argparse
import datetime
import getpass
import json
import logging
import logging.config
import os
import re
import sys
import tabulate
import uuid
from critsapi.critsapi import CRITsAPI
from critsapi.critsdbapi import CRITsDBAPI
from lib.pt.common.config import Config
from lib.pt.commo... | IntegralDefense/ptauto | bin/pt_query.py | Python | apache-2.0 | 19,839 | 0.00005 |
from __future__ import absolute_import, print_function
from datetime import timedelta
from django.utils import timezone
from freezegun import freeze_time
from sentry.models import CheckInStatus, Monitor, MonitorCheckIn, MonitorStatus, MonitorType
from sentry.testutils import APITestCase
@freeze_time("2019-01-01")
c... | mvaled/sentry | tests/sentry/api/endpoints/test_monitor_checkins.py | Python | bsd-3-clause | 5,664 | 0.001589 |
from dataclasses import asdict, dataclass
from typing import List, Optional
from license_grep.licenses import UnknownLicense, canonicalize_licenses
from license_grep.utils import unique_in_order
@dataclass
class PackageInfo:
name: str
version: str
type: str
raw_licenses: Optional[List[str]]
locat... | akx/license-grep | license_grep/models.py | Python | mit | 1,190 | 0.002521 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Top level script for running all python unittests in the NaCl SDK.
"""
from __future__ import print_function
import argparse
i... | M4sse/chromium.src | native_client_sdk/src/test_all.py | Python | bsd-3-clause | 3,095 | 0.006462 |
import unittest
from ncclient.devices.alu import *
from ncclient.xml_ import *
import re
xml = """<rpc-reply xmlns:junos="http://xml.alu.net/alu/12.1x46/alu">
<routing-engin>
<name>reX</name>
<commit-success/>
<!-- This is a comment -->
</routing-engin>
<ok/>
</rpc-reply>"""
class TestAluDevice(unittest.TestCase):
... | ncclient/ncclient | test/unit/devices/test_alu.py | Python | apache-2.0 | 1,917 | 0.003652 |
"""Commands related to networks are in this module"""
import click
import sys
from hil.cli.client_setup import client
@click.group()
def network():
"""Commands related to network"""
@network.command(name='create', short_help='Create a new network')
@click.argument('network')
@click.argument('owner')
@click.opti... | SahilTikale/haas | hil/cli/network.py | Python | apache-2.0 | 2,277 | 0 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012 Alex Forencich
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 righ... | elopezga/ErrorRate | ivi/lecroy/lecroyWR64XIA.py | Python | mit | 1,644 | 0.001825 |
# -*- coding: utf-8 -*-
#
# test_pp_psc_delta_stdp.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 ... | HBPNeurorobotics/nest-simulator | testsuite/manualtests/test_pp_psc_delta_stdp.py | Python | gpl-2.0 | 2,827 | 0 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
r"""Pychemqt, Chemical Engineering Process simulator
Copyright (C) 2009-2017, Juan José Gómez Romera <jjgomera@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Softwa... | jjgomera/pychemqt | lib/EoS/cubic.py | Python | gpl-3.0 | 18,485 | 0.000759 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('taxbrain', '0002_taxoutput_tax_result'),
]
operations = [
migrations.AddField(
model_name='taxsaveinputs',
... | talumbau/webapp-public | webapp/apps/taxbrain/migrations/0003_taxsaveinputs_parameters.py | Python | mit | 448 | 0 |
from __future__ import absolute_import
from rest_framework.response import Response
from sentry import filters
from sentry.api.bases.project import ProjectEndpoint
class ProjectFiltersEndpoint(ProjectEndpoint):
def get(self, request, project):
"""
List a project's filters
Retrieve a lis... | JackDanger/sentry | src/sentry/api/endpoints/project_filters.py | Python | bsd-3-clause | 923 | 0.001083 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/virtual_machine_update.py | Python | mit | 6,810 | 0.001028 |
class resonance():
"""
This class represents a resonance.
"""
def __init__(self,cR=1.0,wR=[],w0=1.,r0=.5,phase=0.):
self.wR=wR
self.cR=cR
self.w0=w0
self.r0=r0
self.phase=phase
def toString(self):
"""
Returns a string of the resonance data mem... | bdell/pyPWA | pythonPWA/dataTypes/resonance.py | Python | mit | 464 | 0.032328 |
'''
Convert a table from a nested list to a nested dictionary and back.
-----------------------------------------------------------
(c) 2013 Allegra Via and Kristian Rother
Licensed under the conditions of the Python License
This code appears in section 7.4.3 of the book
"Managing Biological Data with Py... | raymonwu/Managing_Your_Biological_Data_with_Python_3 | 07-tabular_data/7.4.3_convert_table.py | Python | mit | 1,222 | 0 |
# encoding: utf-8
#
#
# 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/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divisi... | klahnakoski/ActiveData | vendor/pyLibrary/aws/s3.py | Python | mpl-2.0 | 18,596 | 0.001559 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_pitchtools_PitchClass_is_pitch_class_number_01():
assert pitchtools.PitchClass.is_pitch_class_number(0)
assert pitchtools.PitchClass.is_pitch_class_number(0.5)
assert pitchtools.PitchClass.is_pitch_class_number(11)
assert pitchtools.PitchClass.is... | mscuthbert/abjad | abjad/tools/pitchtools/test/test_pitchtools_PitchClass_is_pitch_class_number.py | Python | gpl-3.0 | 727 | 0.001376 |
# OpenShot Video Editor is a program that creates, modifies, and edits video files.
# Copyright (C) 2009 Jonathan Thomas
#
# This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
#
# OpenShot Video Editor is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | i5o/openshot-sugar | openshot/openshot/blender/scripts/neon_curves.py | Python | gpl-3.0 | 5,877 | 0.020759 |
#!/user/bin/python
'''
This script uses SimpleCV to grab an image from the camera and numpy to find an infrared LED and report its position relative to the camera view centre and whether it is inside the target area.
Attempted stabilisation of the output by tracking a circular object instead and altering exposure of t... | dotCID/Graduation | Robot code/Sensors/simpleCV_3.py | Python | gpl-2.0 | 4,363 | 0.013981 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 NLPY.ORG
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
import numpy as np
from line_iterator import LineIterator
class FeatureContainer(object):
def __init__(self, path=None, dtype="libsvm", feature_n=-1):
s... | zomux/nlpy | nlpy/util/feature_container.py | Python | gpl-3.0 | 1,660 | 0.001205 |
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2010 Task Coach developers <developers@taskcoach.org>
Task Coach 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
... | wdmchaft/taskcoach | tests/unittests/widgetTests/DragAndDropTest.py | Python | gpl-3.0 | 2,283 | 0.005694 |
from django import http
from django.apps import apps
from django.conf import settings
from django.contrib import admin
from django.core.exceptions import PermissionDenied
from django.core.files.storage import default_storage as storage
from django.shortcuts import get_object_or_404, redirect
from django.views import de... | kumar303/addons-server | src/olympia/zadmin/views.py | Python | bsd-3-clause | 9,220 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | ViaSat/luigi | luigi/format.py | Python | apache-2.0 | 14,652 | 0.001092 |
import unittest
from card import Card
class CardTest(unittest.TestCase):
def test_create(self):
suit = 'Hearts'
rank = 'Ace'
card1 = Card(suit, rank)
self.assertEqual((suit, rank), card1.get_value())
def test___eq__(self):
card1 = Card('Spades', 'Queen')
card2... | munhyunsu/Hobby | 2018F_SCSCAlgorithm/week2/card_tests.py | Python | gpl-3.0 | 528 | 0 |
import logging
from logging.handlers import RotatingFileHandler
from flask import Flask, render_template
from flask_login import LoginManager
from flask_restful import Api
from flask_wtf.csrf import CsrfProtect
from itsdangerous import URLSafeTimedSerializer
from sqlalchemy import create_engine
import AppConfig
from R... | mandrive/FlaskTest | __init__.py | Python | mit | 2,578 | 0.002327 |
import pytest
from bughouse.models import (
BLACK,
WHITE,
OVERALL_OVERALL,
)
from bughouse.ratings.engines.overall import (
rate_teams,
rate_players,
)
def test_rate_single_game(factories, models, elo_settings):
game = factories.GameFactory()
r1, r2 = rate_teams(game)
assert r1.ratin... | simpleenergy/bughouse-ranking | tests/bughouse/ratings/test_overall_overall_ratings.py | Python | mit | 2,377 | 0 |
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import mod123
| OCA/l10n-spain | l10n_es_aeat_mod123/models/__init__.py | Python | agpl-3.0 | 87 | 0 |
__problem_title__ = "Integer sided triangles for which the area/perimeter ratio is integral"
__problem_url___ = "https://projecteuler.net/problem=283"
__problem_description__ = "Consider the triangle with sides 6, 8 and 10. It can be seen that the " \
"perimeter and the area are both equal t... | jrichte43/ProjectEuler | Problem-0283/solutions.py | Python | gpl-3.0 | 1,243 | 0.008045 |
"""
#;+
#; NAME:
#; spec_guis
#; Version 1.0
#;
#; PURPOSE:
#; Module for Spectroscopy Guis with QT
#; These call pieces from spec_widgets
#; 12-Dec-2014 by JXP
#;-
#;------------------------------------------------------------------------------
"""
from __future__ import print_function, absolute_import, ... | profxj/old_xastropy | xastropy/xguis/spec_guis.py | Python | bsd-3-clause | 22,801 | 0.006316 |
# -*- coding: utf-8 -*-
"""
example1-simpleloop
~~~~~~~~~~~~~~~~~~~
This example shows how to use the loop block backend and frontend.
:copyright: 2015 by Lantz Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
# From lantz, you import a helper function.
from... | varses/awsch | examples/using_blocks/example1-simpleloop.py | Python | bsd-3-clause | 1,304 | 0.003067 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ImageTranslationTranslation'
db.create_table('cmsplugin_filer_image_translated_imagetranslat... | bitmazk/cmsplugin-filer-image-translated | cmsplugin_filer_image_translated/migrations/0004_auto__add_imagetranslationtranslation__add_unique_imagetranslationtran.py | Python | mit | 12,501 | 0.007919 |
#!/usr/bin/env python
'''
create ardupilot terrain database files
'''
from MAVProxy.modules.mavproxy_map import srtm
import math, struct, os, sys
import crc16, time, struct
# MAVLink sends 4x4 grids
TERRAIN_GRID_MAVLINK_SIZE = 4
# a 2k grid_block on disk contains 8x7 of the mavlink grids. Each
# grid block overlaps... | matternet/ardupilot | libraries/AP_Terrain/tools/create_terrain.py | Python | gpl-3.0 | 11,310 | 0.004156 |
import os
class Program:
socketColorBoTe = "255 255 255 255"
socketColorBa = "77 87 152 255"
progColorRareBoTe = "0 0 0 255"
progColorRareBa = "240 220 180 255"
progColorElseBoTe = "77 87 152 255"
progColorElseBa = "0 0 0 255"
def createFile(self):
filepath = os.path.join('~/dest',... | sundrome21/FilterZZ | program.py | Python | mit | 519 | 0.001927 |
# Generated by Django 2.2.12 on 2020-05-09 06:28
from django.db import migrations
# Can't use fixtures because load_fixtures method is janky with django-tenant-schemas
def load_initial_data(apps, schema_editor):
Grade = apps.get_model('courses', 'Grade')
# add some initial data if none has been created yet
... | timberline-secondary/hackerspace | src/courses/migrations/0016_grades_initialdata.py | Python | gpl-3.0 | 963 | 0.001038 |
"""A Python module for interacting and consuming responses from Slack."""
import logging
import slack.errors as e
from slack.web.internal_utils import _next_cursor_is_present
class AsyncSlackResponse:
"""An iterable container of response data.
Attributes:
data (dict): The json-encoded content of th... | slackhq/python-slackclient | slack/web/async_slack_response.py | Python | mit | 6,347 | 0.000788 |
"""
Dynamic DNS updates
===================
Ensure a DNS record is present or absent utilizing RFC 2136
type dynamic updates.
:depends: - `dnspython <http://www.dnspython.org/>`_
.. note::
The ``dnspython`` module is required when managing DDNS using a TSIG key.
If you are not using a TSIG key, DDNS is allow... | saltstack/salt | salt/states/ddns.py | Python | apache-2.0 | 4,297 | 0.000699 |
# Copyright 2016 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... | rabipanda/tensorflow | tensorflow/python/debug/wrappers/local_cli_wrapper.py | Python | apache-2.0 | 25,959 | 0.003929 |
from django.test import TestCase
from store.forms import ReviewForm
from store.models import Review
from .factories import *
class ReviewFormTest(TestCase):
def test_form_validation_for_blank_items(self):
p1 = ProductFactory.create()
form = ReviewForm(
data={'name':'', 'text': '', '... | kevgathuku/compshop | store/tests/test_forms.py | Python | bsd-3-clause | 1,654 | 0.008464 |
{
"name" : "Add sales team to website leads (OBSOLETE)",
"version" : "0.1",
"author" : "IT-Projects LLC, Ivan Yelizariev",
'license': 'GPL-3',
"category" : "Website",
"website" : "https://yelizariev.github.io",
"depends" : ["website_crm"],
#"init_xml" : [],
#"update_xml" : [],
#"... | veryberry/website-addons | website_crm_sales_team/__openerp__.py | Python | lgpl-3.0 | 361 | 0.024931 |
#-*- coding: utf-8 -*-
# Author : Jeonghoonkang, github.com/jeonghoonkang
import platform
import sys
import os
import time
import traceback
import requests
import RPi.GPIO as GPIO
from socket import gethostname
hostname = gethostname()
SERVER_ADDR = '211.184.76.80'
GPIO.setwarnings(False)
GPIO.cleanup()
GPIO.setm... | jeonghoonkang/BerePi | apps/check/monitor.py | Python | bsd-2-clause | 1,308 | 0.021407 |
import time
import os
import posixpath
import datetime
import math
import re
import logging
from django import template
from django.utils.encoding import smart_unicode
from django.utils.safestring import mark_safe
from forum.models import Question, Answer, QuestionRevision, AnswerRevision, NodeRevision
from django.util... | CLLKazan/iCQA | qa-engine/forum/templatetags/extra_tags.py | Python | gpl-3.0 | 7,925 | 0.007823 |
# Copright (C) 2015 Eric Skoglund
#
# 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 distributed in t... | EricIO/pasteit | pasteit/PasteSites.py | Python | gpl-2.0 | 3,878 | 0.005931 |
###########################################################
#
# 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 without written permi... | sadanandb/pmt | src/pyasm/prod/checkin/maya_checkin_test.py | Python | epl-1.0 | 1,263 | 0.008709 |
# Copyright 2016 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... | sandeepdsouza93/TensorFlow-15712 | tensorflow/contrib/learn/python/learn/learn_io/pandas_io.py | Python | apache-2.0 | 6,001 | 0.004999 |
from euler_functions import is_pandigital_set, number_digits
for x in range(9123, 9876): # much smaller range: http://www.mathblog.dk/project-euler-38-pandigital-multiplying-fixed-number/
products = []
n = 1
num_digits_in_products = 0
while num_digits_in_products < 9:
products.append(x * n)
n += 1
num_di... | aarestad/euler-solutions | euler_38.py | Python | gpl-2.0 | 471 | 0.029724 |
"""Test Yeelight."""
import asyncio
from datetime import timedelta
from unittest.mock import AsyncMock, patch
import pytest
from yeelight import BulbException, BulbType
from yeelight.aio import KEY_CONNECTED
from homeassistant.components.yeelight.const import (
CONF_DETECTED_MODEL,
CONF_NIGHTLIGHT_SWITCH,
... | mezz64/home-assistant | tests/components/yeelight/test_init.py | Python | apache-2.0 | 22,950 | 0.001438 |
# Copyright 2018 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... | nburn42/tensorflow | tensorflow/python/grappler/hierarchical_controller.py | Python | apache-2.0 | 43,598 | 0.005069 |
# -*- coding: utf-8 -*-
import json
import os
import random
import requests
import re
import subprocess
import string
from django import forms
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.core.mail import send_mail
from djang... | osamak/medcloud-registration | register/temp/views.py | Python | agpl-3.0 | 9,644 | 0.002771 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils import timezone
from django.db import models, migrations
def fill_tables(apps, schema_editor):
eventsforbusv2 = apps.get_model('AndroidRequests', 'EventForBusv2')
eventsforbusstop = apps.get_model('AndroidRequests', 'EventForBus... | InspectorIncognito/visualization | AndroidRequests/migrations/0904_transformation_eventforbusv2_half_hour_period.py | Python | gpl-3.0 | 2,254 | 0.00976 |
import exceptions
# throws by anything which doesn't like what was passed to it
class DataError(exceptions.StandardError):
pass
# thrown by MojoMessage
class MojoMessageError(DataError):
pass
# thrown by DataTypes
class BadFormatError(DataError):
pass
# throws by things which do block reassembly
class R... | zooko/egtp | common/MojoErrors.py | Python | agpl-3.0 | 355 | 0.014085 |
from setuptools import setup
setup(
name = "zml",
packages = ["zml"],
version = "0.8.1",
description = "zero markup language",
author = "Christof Hagedorn",
author_email = "team@zml.org",
url = "http://www.zml.org/",
download_url = "https://pypi.python.org/pypi/zml",
keywords = ["zml... | babadoo/zml | setup.py | Python | bsd-3-clause | 1,343 | 0.018615 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import dataclasses
import inspect
import json
from dataclasses import dataclass
from enum import Enum
from typing import Any, Callable, Dict, Generic, L... | jsirois/pants | src/python/pants/help/help_info_extracter.py | Python | apache-2.0 | 19,574 | 0.002963 |
#!/usr/bin/env python
# coding: utf-8
import os
import shutil
import tempfile
import unittest
from mkdocs import build, nav, config
from mkdocs.compat import zip
from mkdocs.exceptions import MarkdownNotFound
from mkdocs.tests.base import dedent
class BuildTests(unittest.TestCase):
def test_empty_document(self... | xeechou/mkblogs | mkblogs/tests/build_tests.py | Python | bsd-2-clause | 10,943 | 0.001828 |
def func():
value = "not-none"
# Is none
<caret>if value is None:
print("None")
else:
print("Not none") | siosio/intellij-community | python/testData/intentions/PyInvertIfConditionIntentionTest/commentsIf.py | Python | apache-2.0 | 136 | 0.014706 |
from geojson_rewind import rewind
from geomet import wkt
import decimal
import statistics
def wkt_rewind(x, digits=None):
"""
reverse WKT winding order
:param x: [str] WKT string
:param digits: [int] number of digits after decimal to use for the return string.
by default, we use the mean num... | sckott/pygbif | pygbif/utils/wkt_rewind.py | Python | mit | 1,305 | 0.003065 |
from ..broker import Broker
class DeviceServiceServiceBroker(Broker):
controller = "device_service_services"
def show(self, **kwargs):
"""Shows the details for the specified device service service.
**Inputs**
| ``api version min:`` None
| ``api version max:`` N... | infobloxopen/infoblox-netmri | infoblox_netmri/api/broker/v3_8_0/device_service_service_broker.py | Python | apache-2.0 | 49,305 | 0.002109 |
"""
Library for autotest-remote usage.
"""
import sys, os, re, traceback, signal, time, logging, getpass
try:
import autotest.common as common
except ImportError:
import common
from autotest.client.shared.global_config import global_config
require_atfork = global_config.get_config_value(
'AUTOSERV', ... | ColinIanKing/autotest | server/autoserv.py | Python | gpl-2.0 | 8,389 | 0.001788 |
import copy
import logging
import os
import tempfile
from collections import OrderedDict
from contextlib import contextmanager
import numpy as np
from pimp.importance.importance import Importance
from smac.runhistory.runhistory import RunHistory, DataOrigin
from smac.utils.io.input_reader import InputReader
from smac.... | automl/SpySMAC | cave/reader/configurator_run.py | Python | bsd-3-clause | 16,612 | 0.003792 |
from django.contrib import admin
from workflow.models import State, StateLog, NextState, Project, Location
from workflow.activities import StateActivity
class NextStateInline(admin.StackedInline):
model = NextState
fk_name = 'current_state'
extra = 0
class StateAdmin(admin.ModelAdmin):
inlines = [N... | django-stars/dash2011 | presence/apps/workflow/admin.py | Python | bsd-3-clause | 703 | 0 |
import unittest
import instruction_set
class TestInstructionSet(unittest.TestCase):
def test_generate(self):
self.assertIsInstance(instruction_set.generate(), list)
self.assertEqual(len(instruction_set.generate()), 64)
self.assertEqual(len(instruction_set.generate(32)), 32)
inse... | chuckeles/genetic-treasures | test_instruction_set.py | Python | mit | 2,849 | 0.002808 |
import json
import time
from cStringIO import StringIO
import pytest
from Crypt import CryptBitcoin
from Content.ContentManager import VerifyError, SignError
from util.SafeRe import UnsafePatternError
@pytest.mark.usefixtures("resetSettings")
class TestContent:
privatekey = "5KUh3PvNm5HUWoCfSUfcYvfQ2g3PrRNJWr6Q... | OliverCole/ZeroNet | src/Test/TestContent.py | Python | gpl-2.0 | 12,511 | 0.004876 |
# pylint: disable=missing-module-docstring, missing-class-docstring
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('rdrhc... | studybuffalo/studybuffalo | study_buffalo/rdrhc_calendar/migrations/0014_auto_20171016_1922.py | Python | gpl-3.0 | 813 | 0 |
from sdoc.sdoc1.data_type.DataType import DataType
class StringDataType(DataType):
"""
Class for string data types.
"""
# ------------------------------------------------------------------------------------------------------------------
def __init__(self, value: str):
"""
Object c... | SDoc/py-sdoc | sdoc/sdoc1/data_type/StringDataType.py | Python | mit | 3,015 | 0 |
import pytest
from mitmproxy.addons import intercept
from mitmproxy import exceptions
from mitmproxy.test import taddons
from mitmproxy.test import tflow
@pytest.mark.asyncio
async def test_simple():
r = intercept.Intercept()
with taddons.context(r) as tctx:
assert not r.filt
tctx.configure(r... | mitmproxy/mitmproxy | test/mitmproxy/addons/test_intercept.py | Python | mit | 1,632 | 0 |
"""
==============
Non-linear SVM
==============
Perform binary classification using non-linear SVC
with RBF kernel. The target to predict is a XOR of the
inputs.
The color map illustrates the decision function learned by the SVC.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from sklearn imp... | glemaitre/scikit-learn | examples/svm/plot_svm_nonlinear.py | Python | bsd-3-clause | 1,136 | 0.002641 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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 versio... | AnnalisaS/migration_geonode | geonode/layers/models.py | Python | gpl-3.0 | 29,589 | 0.004968 |
__author__ = 'tauren'
from flask import abort
from flask_restful import Resource
from flask.ext.restful import fields, marshal, reqparse
from flask_login import current_user
from models import User, db
user_fields = {
'username': fields.String,
'id': fields.Integer,
'uri': fields.Url('user')
}... | taurenk/Flask-Angular-TaskList | backend/app/user_api.py | Python | mit | 1,159 | 0.001726 |
from flask.ext.wtf import Form
from wtforms import StringField, BooleanField, PasswordField, SelectField, DateTimeField, TextAreaField
| MansoorMajeed/encrypted-notes | app/forms.py | Python | gpl-2.0 | 138 | 0.014493 |
#!/usr/bin/python
'''
Wrapper for the SRTM module (srtm.py)
It will grab the altitude of a long,lat pair from the SRTM database
Created by Stephen Dade (stephen_dade@hotmail.com)
'''
import os
import sys
import time
import numpy
from MAVProxy.modules.mavproxy_map import srtm
class ElevationModel():
'''Elevation... | bugobliterator/MAVProxy | MAVProxy/modules/mavproxy_map/mp_elevation.py | Python | gpl-3.0 | 3,785 | 0.004756 |
# Copyright (C) 2016 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | osrg/bgperf | quagga.py | Python | apache-2.0 | 5,099 | 0.003334 |
#!/usr/bin/env python3
# Copyright (c) 2009-2019 The Bitcoin Core developers
# Copyright (c) 2014-2019 The DigiByte Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Check RPC argument consistency."""
from collect... | digibyte/digibyte | test/lint/check-rpc-mappings.py | Python | mit | 6,062 | 0.003299 |
# Linker - the linker for assembled objects
#
# Input: one or more ObjectFile objects
# Output: an executable suitable for loading into the Luz
# simulator or CPU memory.
#
# Luz micro-controller assembler
# Eli Bendersky (C) 2008-2010
#
import pprint, os, sys, string
from collections import defaultdict
from ..commonl... | eliben/luz-cpu | luz_asm_sim/lib/asmlib/linker.py | Python | unlicense | 17,370 | 0.001267 |
#!/usr/bin/env python
"""Distutils installer for extras."""
from setuptools import setup
import os.path
import extras
testtools_cmd = extras.try_import('testtools.TestCommand')
def get_version():
"""Return the version of extras that we are building."""
version = '.'.join(
str(component) for componen... | testing-cabal/extras | setup.py | Python | mit | 1,687 | 0.000593 |
#!/usr/bin/env python3
# Copyright (c) 2016-2017 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 the SegWit changeover logic."""
from test_framework.test_framework import BitcoinTestFramework
fr... | laudaa/bitcoin | test/functional/segwit.py | Python | mit | 42,732 | 0.007208 |
"""Yelp API setup and random business selection function"""
import io
import json
import random
from yelp.client import Client
from yelp.oauth1_authenticator import Oauth1Authenticator
with io.open('config_yelp_secret.json') as cred:
creds = json.load(cred)
auth = Oauth1Authenticator(**creds)
yelp_clien... | neonbadger/DestinationUnknown | yelp_api.py | Python | mit | 2,082 | 0.004803 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | tkingless/webtesting | venvs/dev/lib/python2.7/site-packages/selenium/webdriver/support/select.py | Python | mit | 9,249 | 0.003027 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..minc import Voliso
def test_Voliso_inputs():
input_map = dict(args=dict(argstr='%s',
),
avgstep=dict(argstr='--avgstep',
),
clobber=dict(argstr='--clobber',
usedefault=True,
),
environ=... | mick-d/nipype | nipype/interfaces/minc/tests/test_auto_Voliso.py | Python | bsd-3-clause | 1,379 | 0.023205 |
from decimal import Decimal
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.gis.db.models.sql import AreaField
from django.contrib.gis.measure import (
Area as AreaMeasure, Distance as DistanceMeasure,
)
from django.core.exceptions import FieldError
from django.db.models i... | yephper/django | django/contrib/gis/db/models/functions.py | Python | bsd-3-clause | 16,825 | 0.002377 |
"""
fields - Lists the variables stored in the file, a default value, and a description
"""
from . import _fileutils as fu
import warnings
# List of file data variables, default values, and documentation
# This is used in both reader and writer
fields = [
(
"tsaisq",
0.0,
"total chi2 fr... | bendudson/freegs | freegs/_aeqdsk.py | Python | lgpl-3.0 | 12,250 | 0.001551 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from appengine_module.test_results.handlers import redirector
class RedirectorTest(unittest.TestCase):
def test_url_from_commit_position... | nicko96/Chrome-Infra | appengine/test_results/appengine_module/test_results/handlers/test/redirector_test.py | Python | bsd-3-clause | 1,228 | 0.008143 |
#!/usr/bin/env python
# -*- coding: utf-8-*-
import getopt
import time
import re
import os,sys
reload(sys)
sys.setdefaultencoding('utf-8')
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from bs4 import BeautifulSoup
import requests
import webbrowser
import subprocess
class Ou... | roscopecoltran/scraper | .staging/meta-engines/xlinkBook/outline.py | Python | mit | 2,141 | 0.012611 |
import numpy as np
import matplotlib.pyplot as plt
def bernstein(t, n, i):
cn = 1.0
ci = 1.0
cni = 1.0
for k in range(2, n, 1):
cn = cn * k
for k in range(1, i, 1):
if i == 1:
break
ci = ci * k
for k in range(1, n - i + 1, 1):
if n == i:
... | o-kei/design-computing-aij | ch5/curve.py | Python | mit | 983 | 0.001017 |
from pygraz_website import filters
class TestFilters(object):
def test_url_detection(self):
"""
Test that urls are found correctly.
"""
no_urls_string = '''This is a test without any urls in it.'''
urls_string = '''This string has one link in it: http://pygraz.org . But it a... | pygraz/old-flask-website | pygraz_website/tests/test_filters.py | Python | bsd-3-clause | 1,577 | 0.005707 |
#!/usr/bin/env python3
import configparser, subprocess, platform
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib, Gdk
class SleepTimer(Gtk.Builder):
def __init__(self):
super().__init__()
self.add_from_file("main.glade")
self.connect_signals(self)
sel... | jhasse/sleeptimer | main.py | Python | gpl-3.0 | 8,446 | 0.004026 |
#!/usr/bin/env python
"""
Send message to '#gis.lab' IRC chat room.
Requires to run script 'utils/join-gislab-network.py' first to get connection
with server.
USAGE: send-message.py <message>
"""
import os, sys
import re
import socket
try:
message = sys.argv[1]
except IndexError:
print __doc__
sys.exit(0... | imincik/gis-lab | utils/send-message.py | Python | gpl-3.0 | 1,440 | 0.008333 |
#!/usr/bin/python3
import logging
from operator import itemgetter
from timeit import default_timer as timer
import rdflib
from .abstract_instruction_set import AbstractInstructionSet
from readers import rdf
from writers import rule_set, pickler
from samplers import by_definition as sampler
from algorithms.semantic_rul... | wxwilcke/MINOS | directives/pakbonLD_B3.py | Python | gpl-3.0 | 7,661 | 0.00496 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# #Copyright (C) 2015, Delft University of Technology, Faculty of Electrical Engineering, Mathematics and Computer Science, Network Architectures and Services and TNO, ICT - Service Enabling and Management, Mani Prashanth Varma Manthena, Niels van Adrichem, Casper van den ... | TUDelftNAS/SDN-NaaSPlatform | NaaSPlatform/Load_Balancing_App.py | Python | gpl-3.0 | 62,701 | 0.003397 |
import itertools
import numpy
import math
def ncr(n, r):
f = math.factorial
return f(n) // f(r) // f(n-r)
def subset_pairs(s):
for a_size in range(1, len(s)):
for a in itertools.combinations(s, a_size):
remaining = s.difference(a)
for b_size in range(1, len(remaining) + 1... | simonolander/euler | euler-106.py | Python | mit | 450 | 0.002222 |
from PyQt5 import QtCore
from src.business.configuration.constants import project as p
from src.ui.commons.verification import cb
class ConfigProject:
def __init__(self):
self._settings = QtCore.QSettings(p.CONFIG_FILE, QtCore.QSettings.IniFormat)
def get_value(self, menu, value):
return sel... | pliniopereira/ccd10 | src/business/configuration/configProject.py | Python | gpl-3.0 | 2,363 | 0.003386 |
from Scouting2017.model.models2017 import ScoreResult
from django.db.models.aggregates import Avg
from django.db.models.expressions import Case, When
import json
import math
import collections
def get_statistics(regional_code, teams_at_competition, team=0):
'''
The get_statistics function() returns two lists ... | ArcticWarriors/scouting-app | ScoutingWebsite/Scouting2017/model/get_stastics.py | Python | mit | 4,360 | 0.004358 |
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
import re
from django import forms
from django.utils.translation import ugettext as _
from identityprovider.widgets import CommaSeparatedWidget
class CommaSeparatedField(forms.M... | miing/mci_migo | identityprovider/fields.py | Python | agpl-3.0 | 1,229 | 0 |
from GangaCore.testlib.GangaUnitTest import GangaUnitTest
from GangaGUI.api import internal
# ******************** Test Class ******************** #
# Templates API Tests
class TestGangaGUIInternalTemplatesAPI(GangaUnitTest):
# Setup
def setUp(self, extra_opts=[]):
super(TestGangaGUIInternalTemplat... | ganga-devs/ganga | ganga/GangaGUI/test/test_internal_templates_api.py | Python | gpl-3.0 | 3,358 | 0.001489 |
# CamJam EduKit 3 - Robotics
# Worksheet 7 - Controlling the motors with PWM
import RPi.GPIO as GPIO # Import the GPIO Library
import time # Import the Time library
# Set the GPIO modes
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# Set variables for the GPIO motor pins
pinMotorAForwards = 10
pinMotorABackwards ... | CamJam-EduKit/EduKit3 | CamJam Edukit 3 - RPi.GPIO/Code/7-pwm.py | Python | mit | 2,662 | 0 |
#!/usr/bin/python
# Script to Check the difference in 2 files
# 1 fevereiro de 2015
# https://github.com/thezakman
file1 = raw_input('[file1:] ')
modified = open(file1,"r").readlines()[0]
file2 = raw_input('[file2:] ')
pi = open(file2, "r").readlines()[0] # [:len(modified)]
result... | thezakman/CTF-Scripts | Differ.py | Python | artistic-2.0 | 631 | 0.011094 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.