text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/python2
#-*- coding: utf-8 -*-
#
# This file is released under the MIT License.
#
# (C) Copyright 2012 Alessio Colucci
# 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
# res... | Alexey95/physpy | physpy/__init__.py | Python | mit | 1,808 | 0.001111 |
#!/usr/bin/env python
"""
==========================================================
NullPose.py - Pose Handler for single region without Vicon
==========================================================
"""
import sys, time
from numpy import *
from lib.regions import *
import lib.handlers.handlerTemplates as handlerT... | VerifiableRobotics/LTLMoP | src/lib/handlers/share/Pose/NullPoseHandler.py | Python | gpl-3.0 | 1,041 | 0.008646 |
from . import FixtureTest
class RoadShieldCleanup(FixtureTest):
def _check_network_relation(
self, way_id, rel_id, tile, expected_shield_text):
self.load_fixtures([
'https://www.openstreetmap.org/way/%d' % (way_id,),
'https://www.openstreetmap.org/relation/%d' % (rel_id... | mapzen/vector-datasource | integration-test/1062-road-shield-cleanup.py | Python | mit | 1,209 | 0 |
# -*- coding: UTF-8 -*-
logger.info("Loading 5 objects to table gfks_helptext...")
# fields: id, content_type, field, help_text
loader.save(create_gfks_helptext(1,contacts_Partner,u'language',u'Die Sprache, in der Dokumente ausgestellt werden sollen.'))
loader.save(create_gfks_helptext(2,gfks_HelpText,u'field',u'The na... | lino-framework/welfare | lino_welfare/projects/gerd/tests/dumps/18.8.0/gfks_helptext.py | Python | agpl-3.0 | 794 | 0.025189 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: https://sickrage.tv
# Git: https://github.com/SiCKRAGETV/SickRage
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, ei... | SerialShadow/SickRage | sickbeard/sab.py | Python | gpl-3.0 | 8,550 | 0.002924 |
from itertools import combinations
def check_adding_elements(integers_list):
if [item for i in range(len(integers_list), 0, -1) for item in
combinations(integers_list, i) if sum(item) == 0]:
return True
return False
| vigojug/reto | 201705/alexhermida/reto.py | Python | bsd-3-clause | 247 | 0 |
# 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 copy of t... | orbitfp7/nova | nova/tests/unit/test_fixtures.py | Python | apache-2.0 | 6,695 | 0 |
# -*- coding: utf-8 -*-
import os
import pytest
import boto3
from pontus.exceptions import ValidationError
from pontus.validators import FileSize
class TestFileSizeValidator(object):
@pytest.fixture
def jpeg_key(self, bucket):
with open(os.path.join(
os.path.dirname(__file__),
... | fastmonkeys/pontus | tests/test_file_size_validator.py | Python | mit | 2,007 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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, Ve... | jcshen007/cloudstack | scripts/util/migrate-dynamicroles.py | Python | apache-2.0 | 5,812 | 0.005678 |
#!/usr/bin/python
import logging
logger = logging.getLogger('pytest')
class AccountService:
'''
account service template
'''
def place_order(self):
'''authentication'''
print 'account service - authentication'
logger.info('account service - authentication')
@staticmethod
... | vollov/python-test | services/account_service.py | Python | mit | 437 | 0.002288 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011-2015 Slack
#
# 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
... | Slack06/yadg | descgen/tasks.py | Python | mit | 1,273 | 0.001571 |
#!/usr/bin/env python
from . import Stream, StreamError
from ..compat import str, bytes, urlparse
from ..utils import RingBuffer, swfdecompress, swfverify, urlget, urlopen
from ..packages.flashmedia import FLV, FLVError
from ..packages.flashmedia.tag import ScriptData
import base64
import hashlib
import hmac
import ... | derekzhang79/livestreamer | src/livestreamer/stream/akamaihd.py | Python | bsd-2-clause | 6,596 | 0.001819 |
class Solution(object):
def isPalindrome(self, s):
"""
:type s: str
:rtype: bool
"""
if not s:
return True
start = 0
end = len(s)-1
s = s.lower()
while start < end:
while start < end and not s[start].isalnum():
... | tedye/leetcode | Python/leetcode.125.valid-palindrome.py | Python | mit | 594 | 0.005051 |
#
# Copyright 2019 XEBIALABS
#
# 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, distribute, subli... | xebialabs-community/xlr-xldeploy-plugin | src/main/resources/xlr_xldeploy/XLDVersionsTile.py | Python | mit | 1,585 | 0.003785 |
#!/usr/bin/python
"""Test of multiline editable text."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(KeyComboAction("<Control>f"))
sequence.append(TypeAction("Application main window"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Tab"))
sequ... | pvagner/orca | test/keystrokes/gtk-demo/role_text_multiline.py | Python | lgpl-2.1 | 10,142 | 0.003155 |
"""
WSGI config for made_with_twd_project project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_... | leifos/tango_with_django | made_with_twd_project/made_with_twd_project/wsgi.py | Python | mit | 1,464 | 0.001366 |
from .engine import conf as engine_conf
from .conf import Conf
from .level import Level as EntryWorld
engine_conf.add(Conf)
| ikn/o | game/__init__.py | Python | gpl-3.0 | 125 | 0 |
import jinja2
import jinja2.nodes
from jinja2.ext import Extension
from django.template.loader import get_template
# to keep namespaces from colliding
from .templatetags import longclawcore_tags as lc_tags
def longclaw_vendors_bundle():
template = get_template('core/longclaw_script.html')
context = lc_tags... | JamesRamm/longclaw | longclaw/core/jinja2tags.py | Python | mit | 1,022 | 0 |
"""Disk Cache Recipes
"""
import functools
import math
import os
import random
import threading
import time
from .core import ENOVAL, args_to_key, full_name
class Averager(object):
"""Recipe for calculating a running average.
Sometimes known as "online statistics," the running average maintains the
to... | SickGear/SickGear | lib/diskcache_py3/recipes.py | Python | gpl-3.0 | 13,534 | 0 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2014 Tobias Weber <tobi-weber@gmx.de>
#
# 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 ... | tobi-weber/levitas | src/levitas/middleware/redirectMiddleware.py | Python | apache-2.0 | 1,326 | 0.002262 |
import re, collections
def words(text): return re.findall('[a-z]+', text.lower())
def train(features):
model = collections.defaultdict(lambda: 1)
for f in features:
model[f] += 1
return model
NWORDS = train(words(file('big.txt').read()))
alphabet = 'abcdefghijklmnopqrstuvwxyz'
def edits1(word):... | gusyussh/learntosolveit | languages/python/algorithm_spelling.py | Python | bsd-3-clause | 1,031 | 0.020369 |
#
# Albow - Controls
#
#-# Modified by D.C.-G. for translation purpose
from pygame import Rect, draw
from widget import Widget, overridable_property
from theme import ThemeProperty
import resource
from translate import _, getLang
class Control(object):
highlighted = overridable_property('highlighted')
enabl... | OniOniOn-/MCEdit-Unified | albow/controls.py | Python | isc | 9,986 | 0.001302 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010-2013 Código Sur Sociedad Civil.
# All rights reserved.
#
# This file is part of Cyclope.
#
# Cyclope 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 Foundat... | CodigoSur/cyclope | cyclope/apps/staticpages/admin.py | Python | gpl-3.0 | 4,331 | 0.003233 |
import PyQt5 # this force pyqtgraph to deal with Qt5
# For matplotlib to Qt5 :
# * this avoid tinker problem when not installed
# * work better with GUI
# * trigger a warning on notebook
import matplotlib
import warnings
with warnings.catch_warnings():
try: ... | tridesclous/tridesclous | tridesclous/gui/__init__.py | Python | mit | 2,001 | 0.005997 |
import os
import sys
from scrapy.selector import Selector
from parsers import xfirst
#
# Unfinished
#
with open('./output/sf_nbr_zillow_raw.tsv') as f:
for line in f:
parts = line.split('\t')
xml = parts[1]
sel = Selector(text = xml)
for page in sel.xpath('//pages/page'):
... | Derikulous/zillow_hackathon | data/clean_zillow_nbr_old.py | Python | mit | 605 | 0.004959 |
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of astroid.
#
# astroid 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
#... | lukaszpiotr/pylama_with_gjslint | pylama/checkers/pylint/astroid/mixins.py | Python | lgpl-3.0 | 4,313 | 0.001159 |
# -*- coding: utf-8 -*-
from functools import update_wrapper
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.translation import ugettext_lazy as _
from urllib.parse import urljoin
from cms import constants
from cms import __version__
__all__ = ['... | yakky/django-cms | cms/utils/conf.py | Python | bsd-3-clause | 10,383 | 0.002023 |
from django.test import TestCase
from ocrDoacao.models import Ong
class OngTest(TestCase):
def test_get_path(self):
nome_modulo = __name__.split(".")[0]
ong = Ong()
ong.nome = 'teste_ong'
self.assertEqual(ong.get_path(), nome_modulo + '/static/ongs/teste_ong') | ocr-doacao/ocr | ocrDoacao/testes/teste_ong.py | Python | apache-2.0 | 297 | 0.010101 |
import h5py
import sys
import os.path as op
from fos import *
import numpy as np
a=np.loadtxt(op.join(op.dirname(__file__), "data", "rat-basal-forebrain.swc") )
pos = a[:,2:5].astype( np.float32 )
radius = a[:,5].astype( np.float32 ) * 4
# extract parent connectivity and create full connectivity
parents = a[1:,6] - ... | fos/fos | examples/microcircuit_multi.py | Python | bsd-3-clause | 2,857 | 0.044802 |
import sqlite3
from flask import Flask, render_template, g
database = "test.db"
app = Flask(__name__)
@app.route("/")
def welcome():
return "<h1> Welcome to CMPUT 410 - Jinja lab </h1>"
@app.route('/task', methods = ['GET', 'POST'])
def task():
return render_template('show_entries.html', tasks = query_db... | cntnboys/410Lab5 | todolist.py | Python | apache-2.0 | 1,157 | 0.021608 |
__title__ = 'sdncli'
__author__ = 'Gary Berger'
__license__ = 'BSD'
__copyright__ = 'Brocade Communications'
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
| gaberger/sdncli | sdncli/__init__.py | Python | bsd-3-clause | 202 | 0 |
# -*- coding: utf-8 -*-
#
# Project Tasks
#
from __future__ import print_function, unicode_literals
import os
import time
import shutil
import webbrowser
from invoke import task
SPHINX_AUTOBUILD_PORT = int(os.environ.get('SPHINX_AUTOBUILD_PORT', '8340'))
def watchdog_pid(ctx):
"""Get watchdog PID via ``netstat... | pyroscope/pimp-my-box | tasks.py | Python | gpl-2.0 | 2,150 | 0.001395 |
from kulka import Kulka
from random import randint
import time
class HSV:
def __init__(self,hue,saturation,value):
import colorsys
self.h = hue
self.s = saturation
self.v = value
rgb = colorsys.hsv_to_rgb(self.h/255, self.s/255, self.v/255)
self.r = round(rgb[0] * 25... | TNT-Samuel/Coding-Projects | Kulka - Sphero/ex_move_rand.py | Python | gpl-3.0 | 5,169 | 0.008512 |
#
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
'''
Filter blocks and related functions.
'''
import os
from gnuradio.fft import window
try:
from .filter_python import *
except ImportError:
dirname, filename = os.path.split... | dl1ksv/gnuradio | gr-filter/python/filter/__init__.py | Python | gpl-3.0 | 624 | 0 |
from .. import x64dbg
class HardwareType:
HardwareAccess = x64dbg.HardwareAccess
HardwareWrite = x64dbg.HardwareWrite
HardwareExecute = x64dbg.HardwareExecute
def Wait():
x64dbg.Wait()
def Run():
x64dbg.Run()
def Stop():
x64dbg.Stop()
def StepIn():
x64dbg.StepIn()
def StepOver():
... | x64dbg/x64dbgpy | swig/x64dbgpy/pluginsdk/_scriptapi/debug.py | Python | mit | 744 | 0.016129 |
from __future__ import absolute_import
from sfepy.base.base import assert_
from sfepy.base.testing import TestCommon
##
# 28.08.2007, c
class Test( TestCommon ):
##
# 28.08.2007, c
def from_conf( conf, options ):
return Test( conf = conf, options = options )
from_conf = staticmethod( from_conf... | vlukes/sfepy | tests/test_base.py | Python | bsd-3-clause | 4,617 | 0.033788 |
#
# Copyright 2019 The FATE 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... | FederatedAI/FATE | examples/pipeline/homo_sbt/pipeline-homo-sbt-binary-with-memory-backend.py | Python | apache-2.0 | 4,517 | 0.004649 |
'''
Rigidity is a simple wrapper to the built-in csv module that allows for
validation and correction of data being read/written from/to CSV files.
This module allows you to easily construct validation and correction
rulesets to be applied automatically while preserving the csv interface.
This allows you to easily upg... | austinhartzheim/rigidity | rigidity/__init__.py | Python | gpl-3.0 | 8,662 | 0.000231 |
#This script is not really portable. It's just to automate some manual steps I usually do when releasing.
#It might evolve into someting more robust but for now it's ok for me.
import os
import shutil
def run(cmd):
print("\nRunning command: " + cmd)
if os.system(cmd) == 0: print("\nWarning, command failed... | CyanogenMod/android_external_mockito | releasing/release.undo.py | Python | mit | 676 | 0.014793 |
""" An example that defines two apps, one with a single hbox and
one with hboxes in vboxes in hboxes. For performance testing
"""
import time
import flexx
from flexx import ui
class MyApp1(ui.App):
def init(self):
with ui.VBox() as self.l1:
ui.Button(text='Box A', flex=0)
... | almarklein/flexx | examples/ui/box_performance.py | Python | bsd-2-clause | 4,634 | 0.004748 |
test = {
'name': '',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> print_kth_top_movie_year(4)
Year number 4 for total gross movie sales was: 2009
""",
'hidden': False,
'locked': False
},
],
'scored': Tru... | jamesfolberth/NGC_STEM_camp_AWS | notebooks/data8_notebooks/lab04/tests/q2_5.py | Python | bsd-3-clause | 400 | 0 |
"""The image module provides basic functions for working with images in nipy.
Functions are provided to load, save and create image objects, along with
iterators to easily slice through volumes.
load : load an image from a file
save : save an image to a file
fromarray : create an image from a numpy array... | yarikoptic/NiPy-OLD | nipy/io/files.py | Python | bsd-3-clause | 8,110 | 0.001603 |
import asyncio
import json
import uuid
import pytest
from photonpump import exceptions as exn
from photonpump import messages as msg
from photonpump import messages_pb2 as proto
from photonpump.conversations import CatchupSubscription
from ..fakes import TeeQueue
async def anext(it, count=1):
if count == 1:
... | madedotcom/photon-pump | test/conversations/test_catchup.py | Python | mit | 25,039 | 0.000679 |
#!/usr/bin/env python
import collections
import itertools
import os
import sys
from functools import partial
import six
from pathos.multiprocessing import Pool
import pandas as pd
from PyAnalysisTools.AnalysisTools.RegionBuilder import RegionBuilder
from PyAnalysisTools.base import get_default_argparser, default_ini... | morgenst/PyAnalysisTools | run_scripts/convert_root2numpy.py | Python | mit | 4,105 | 0.003898 |
from thinc.api import chain, Relu, reduce_max, Softmax, add
good_model = chain(Relu(10), Relu(10), Softmax())
reveal_type(good_model)
good_model2 = add(Relu(10), Relu(10), Softmax())
reveal_type(good_model2)
bad_model_undetected = chain(Relu(10), Relu(10), reduce_max(), Softmax())
reveal_type(bad_model_undetected)
... | spacy-io/thinc | thinc/tests/mypy/modules/success_no_plugin.py | Python | mit | 428 | 0 |
from __future__ import absolute_import, unicode_literals
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404
from wagtail.wagtailadmin.forms import PageViewRestrictionForm
from wagtail.wagtailadmin.modal_workflow import render_modal_workflow
from wagtail.wagtailcore.mode... | chrxr/wagtail | wagtail/wagtailadmin/views/page_privacy.py | Python | bsd-3-clause | 2,828 | 0.001414 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | sysadminmatmoz/odoo-clearcorp | veterinary/veterinary.py | Python | agpl-3.0 | 7,094 | 0.013251 |
# Copyright 2016 Open Source Robotics Foundation, 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... | ros2/demos | demo_nodes_py/demo_nodes_py/topics/talker_qos.py | Python | apache-2.0 | 2,757 | 0.000363 |
# Lint as: python2, python3
# Copyright 2021 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
#
... | tensorflow/tpu | models/official/detection/projects/vild/preprocessing/dataset_util.py | Python | apache-2.0 | 1,426 | 0.004208 |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | mkrupcale/ansible | lib/ansible/modules/cloud/amazon/ec2_vol.py | Python | gpl-3.0 | 19,393 | 0.004383 |
#
# SPDX-License-Identifier: MIT
#
import os
import json
import shutil
from oeqa.core.utils.test import getCaseFile, getCaseMethod
def get_package_manager(d, root_path):
"""
Returns an OE package manager that can install packages in root_path.
"""
from oe.package_manager import RpmPM, OpkgPM, DpkgPM
... | schleichdi2/OPENNFR-6.3-CORE | opennfr-openembedded-core/meta/lib/oeqa/utils/package_manager.py | Python | gpl-2.0 | 6,234 | 0.002406 |
# pylint: disable=C0111,R0201
"""
FUNCTIONALITY
"""
class Example(object):
"""
@summary: Demonstrates pylint error caused by method expecting tuple
but called method does not return tuple
"""
def method_expects_tuple(self, obj):
meth, args = self.method_doesnot_return_tuple(obj)
... | axbaretto/beam | sdks/python/.tox/lint/lib/python2.7/site-packages/pylint/test/input/func_noerror_crash_127416.py | Python | apache-2.0 | 546 | 0.001832 |
from django.db import models
GENDER=(
('Male','Male'),
('Female','Female'),
('Transgender','Transgender'),
('Unknown','Unknown'),
)
QUALIFICATION =(
('SSLC','SSLC'),
('Unknown','Unknown'),
)
ATTENDANCE =(
('Present','Present'),
('Absent','Absent'),
('N.A','N.A'),
)... | askyourgovt/nammamla2 | src/misc/models.py | Python | gpl-3.0 | 6,418 | 0.040044 |
from __future__ import absolute_import
import six
from base64 import b64encode
from django.core.urlresolvers import reverse
from sentry.models import UserAvatar
from sentry.testutils import APITestCase
class UserAvatarTest(APITestCase):
def test_get(self):
user = self.create_user(email='a@example.com')... | JackDanger/sentry | tests/sentry/api/endpoints/test_user_avatar.py | Python | bsd-3-clause | 2,972 | 0.001346 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("wagtailcore", "0015_add_more_verbose_names"),
]
operations = [
migrations.AlterField(
model_name="page",
name="url_path",
field=m... | wagtail/wagtail | wagtail/core/migrations/0016_change_page_url_path_to_text_field.py | Python | bsd-3-clause | 442 | 0.002262 |
"""
Accessors for related objects.
When a field defines a relation between two models, each model class provides
an attribute to access related instances of the other model class (unless the
reverse accessor has been disabled with related_name='+').
Accessors are implemented as descriptors in order to customize acces... | sadaf2605/django | django/db/models/fields/related_descriptors.py | Python | bsd-3-clause | 49,686 | 0.001771 |
import logging
from amqpstorm import Connection
from amqpstorm import Message
logging.basicConfig(level=logging.INFO)
with Connection('localhost', 'guest', 'guest') as connection:
with connection.channel() as channel:
# Declare a queue called, 'simple_queue'.
channel.queue.declare('simple_queue')... | eandersson/amqpstorm | examples/publish_message_with_expiration.py | Python | mit | 624 | 0 |
"""
You can enable picking by setting the "picker" property of an artist
(for example, a matplotlib Line2D, Text, Patch, Polygon, AxesImage,
etc...)
There are a variety of meanings of the picker property
None - picking is disabled for this artist (default)
boolean - if True then picking will be enabled and... | ajrichards/notebook | visualization/mpl-simple-pick-event.py | Python | bsd-3-clause | 6,330 | 0.000632 |
#!/usr/bin/env python
'''
Copyright (c) 2015, Mark Silliman
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of condit... | nvelaborja/CptS-483_Robotics | Lab 4/draw_a_square.py | Python | gpl-3.0 | 3,425 | 0.017518 |
#
# Copyright 2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version.
#... | trnewman/VT-USRP-daughterboard-drivers_python | gr-usrp/src/db_wbx.py | Python | gpl-3.0 | 20,483 | 0.010643 |
# Copyright 2017 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | infilect/ml-course1 | week4/attention_ocr/python/datasets/unittest_utils.py | Python | mit | 2,107 | 0.006645 |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | Kazade/NeHe-Website | google_appengine/google/appengine/tools/devappserver2/endpoints/api_config_manager_test.py | Python | bsd-3-clause | 14,958 | 0.003008 |
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.optimizers import SGD, Adam, RMSprop
from keras.utils import np_utils
from elephas.ml... | daishichao/elephas | examples/ml_mlp.py | Python | mit | 2,318 | 0.002588 |
import DbInspect
import subprocess
import DbInspect._utils as utils
def simple_printer(line):
print line
def SQL_to_MongoDB_all_complete(source_comms, dest_comms, printer = simple_printer):
tables = []
for table, _ in source_comms.get_tables()[0]:
tables.append(table)
S... | samuelcolvin/django-db-viewer | DbInspect/pipe.py | Python | gpl-2.0 | 3,166 | 0.012318 |
# Albert Cardona 2014-11-20
# This file is meant to be run from within ./manage.py shell in the environment, like:
# [1] load export_all_graphml.py
# [2] project_id = 12
# [2] export(project_id, "all.graphml")
#
# Will generate a gzip'ed file like "all.graphml.gz"
#
# Includes all skeletons with more than 1 treenode;
#... | catsop/CATMAID | scripts/export/export_all_graphml.py | Python | gpl-3.0 | 3,992 | 0.003758 |
#Exercise 1.2: Write a Hello World program
#Author: Andreas Solberg Sagen - University of Oslo
print("Hello World")
#Or we could do the more "classic one":
hello = "Hello"
world = "World"
print(hello + " " + world)
#samplerun
#Hello World
#Hello World
| exTerEX/PrimeOnScientificProgramming | Chapter 1/hello_world.py | Python | mit | 255 | 0.023529 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- http://www.mdanalysis.org
# Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
... | kain88-de/mdanalysis | testsuite/MDAnalysisTests/coordinates/test_pqr.py | Python | gpl-2.0 | 7,667 | 0.000261 |
# (c) 2014, James Tanner <tanner.jc@gmail.com>
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed i... | kaarolch/ansible | lib/ansible/cli/doc.py | Python | gpl-3.0 | 13,556 | 0.003467 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-12 09:50
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... | JackieLan/django-polls | polls/migrations/0001_initial.py | Python | apache-2.0 | 1,229 | 0.003255 |
from django.conf import settings
from django.conf.urls import patterns, url
from haystack.views import SearchView
from elections.forms import ElectionForm
from elections.views import ElectionsSearchByTagView, HomeView, ElectionDetailView,\
CandidateDetailView, SoulMateDetailView, FaceToFaceView, AreaDetailView, \
... | YoQuieroSaber/votainteligente-portal-electoral | elections/urls.py | Python | gpl-3.0 | 4,564 | 0.007011 |
import pytest
import re
import sqlalchemy as sa
from redshift_sqlalchemy.dialect import CopyCommand, RedshiftDialect
def clean(query):
return re.sub(r'\s+', ' ', query).strip()
def quote(s):
return "'%s'" % s
def compile_query(q):
return str(q.compile(dialect=RedshiftDialect(),
... | bouk/redshift_sqlalchemy | tests/test_copy_command.py | Python | mit | 2,969 | 0.000337 |
year = 2015
print(year)
| codermoji-contrib/python | start/Intro to variables/002/setvar2.py | Python | mit | 24 | 0 |
import sys, subprocess, time
"""
This script is made as a wrapper for sc2 bots to set a timeout to the bots (in case they cant find the last enemy structure or the game is ending in a draw)
Usage:
cd into python-sc2/ directory
docker build -t test_image -f test/Dockerfile .
docker run test_image -c "python test/travi... | Dentosal/python-sc2 | test/travis_test_script.py | Python | mit | 2,800 | 0.004643 |
# test builtin min and max functions with float args
try:
min
max
except:
import sys
print("SKIP")
sys.exit()
print(min(0,1.0))
print(min(1.0,0))
print(min(0,-1.0))
print(min(-1.0,0))
print(max(0,1.0))
print(max(1.0,0))
print(max(0,-1.0))
print(max(-1.0,0))
print(min(1.5,-1.5))
print(min(-1.5,1.5... | cwyark/micropython | tests/float/builtin_float_minmax.py | Python | mit | 553 | 0.079566 |
#
# ida_kernelcache/offset.py
# Brandon Azad
#
# Functions for converting and symbolicating offsets.
#
import re
import idc
import idautils
import ida_utilities as idau
import internal
import kernel
import stub
_log = idau.make_log(1, __name__)
def initialize_data_offsets():
"""Convert offsets in data segments... | bazad/ida_kernelcache | ida_kernelcache/offset.py | Python | mit | 4,124 | 0.005092 |
#!/usr/bin/env python
import os
import pkg_resources
import sys
from setuptools import setup
import chainerx_build_helper
if sys.version_info[:3] == (3, 5, 0):
if not int(os.getenv('CHAINER_PYTHON_350_FORCE', '0')):
msg = """
Chainer does not work with Python 3.5.0.
We strongly recommend to use anothe... | wkentaro/chainer | setup.py | Python | mit | 6,122 | 0 |
import re
import os
import sys
from optparse import make_option
from django.core.management.base import BaseCommand
from ella.photos.conf import photos_settings
class Command(BaseCommand):
help = 'Check consistence between database records and coresponding image files'
VERBOSITY_ERROR = 0
VERBOSITY_WARN... | WhiskeyMedia/ella | ella/photos/management/commands/check_photo_files_consistence.py | Python | bsd-3-clause | 5,635 | 0.004969 |
# -*- coding: utf-8 -*-
__author__ = 'linzhonghong'
__version__ = '2013.11.001'
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
import os
from signal import SIGTERM
import wx
import wx.lib.buttons as buttons
from gui import MyStatusBar,MyListCtrl,WarnDialog,LogoutDialog,LoginDialog,WarnDialog2
... | linzhonghong/dnspod_desktop | dnspod_desktop.py | Python | gpl-2.0 | 20,963 | 0.00844 |
import io
import panflute as pf
def test_all():
md = 'Some *markdown* **text** ~xyz~'
c_md = pf.convert_text(md)
b_md = [pf.Para(pf.Str("Some"), pf.Space,
pf.Emph(pf.Str("markdown")), pf.Space,
pf.Strong(pf.Str("text")), pf.Space,
pf.Subscript(pf.... | sergiocorreia/panflute | tests/test_convert_text.py | Python | bsd-3-clause | 4,653 | 0.004943 |
import socket
import datetime
import mock
from qpaca.monitoring.influx import InfluxDB
class TestInfluxDB(object):
@mock.patch('qpaca.monitoring.influx.InfluxDBClient')
def test_init(self, mocked_class):
client = InfluxDB(name='something', config={'client': {}})
assert mocked_class.called
... | WeLikeAlpacas/python-pubsub | tests/test_influxdb.py | Python | mit | 1,306 | 0 |
"""
This is an example automated test to help you learn Qxf2's framework
Our automated test will do the following action repeatedly to fill number of forms:
#Open Qxf2 selenium-tutorial-main page.
#Fill the example form
#Click on Click me! button and check if its working fine
"""
#The import statements impo... | qxf2/qxf2-page-object-model | tests/test_successive_form_creation.py | Python | mit | 6,309 | 0.014265 |
from menu import Menu, MenuItem
from django.core.urlresolvers import reverse
Menu.add_item(
"main",
MenuItem(
"Campaign",
reverse("campaigns_list"),
weight=10,
icon="tools",
)
)
| chbrun/behavui | behavui/campaigns/menus.py | Python | gpl-2.0 | 223 | 0 |
#!/usr/bin/env python3
#
# Copyright 2019 by Raytheon BBN Technologies Corp. All Rights Reserved.
"""
Create a test ChannelLibrary. 3 qubits, with a bidirectional edge between q1 and q2.
If we're assigning to HW (default not), do something APS2ish spreading across APS1-10.
Stores in an in-memory ChannelLibrary.
"""
d... | BBN-Q/pyqgl2 | src/python/pyqgl2/test_cl.py | Python | apache-2.0 | 7,256 | 0.006202 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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; eimcp.r version 2
# of the License, or (at your option) any later version.
#
# This program is distri... | jemandez/creaturas-magicas | Configuraciones básicas/scripts/addons/blendertools-1.0.0/makewalk/action.py | Python | gpl-3.0 | 6,035 | 0.003645 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Schema.immutable'
db.add_column('tardis_portal_schema', 'immutable', self.gf('django.db.mo... | steveandroulakis/mytardis | tardis/tardis_portal/migrations/0005_auto__add_field_schema_immutable.py | Python | bsd-3-clause | 16,169 | 0.00872 |
# This file is part of the Universal Schema.
#
# The Universal Schema is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... | genixpro/universal_schema | universal_schema/formats/emberdataformat.py | Python | lgpl-3.0 | 2,018 | 0.009911 |
# Copyright 2015 Cisco Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | Tehsmash/networking-cisco | networking_cisco/apps/saf/common/config.py | Python | apache-2.0 | 6,222 | 0 |
from datetime import date
from django.core.paginator import Paginator, InvalidPage
from django.db.models import Q
from django.shortcuts import render
from .models import Showing, Show
# All your search and not search needs in one place (as long as template is not missing any var assignments in links
# and etc.) - S... | WarwickAnimeSoc/aniMango | showings/views.py | Python | mit | 1,605 | 0.001869 |
from random import randrange
MAX = 100000
args = [randrange(MAX) for x in range(2 * MAX)]
args1 = [randrange(MAX) for x in range(MAX)]
args2 = [randrange(MAX) + MAX for x in range(MAX)]
def mkdel(s):
return "delete " + str(s)
def mkins(s):
return "insert " + str(s)
def mknext(s):
return "next " + str(s)
pr... | zakharvoit/discrete-math-labs | Season2/BinaryTrees/Tree23/gen.py | Python | gpl-3.0 | 449 | 0.028953 |
# 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... | ghchinoy/tensorflow | tensorflow/contrib/sparsemax/python/ops/sparsemax.py | Python | apache-2.0 | 3,656 | 0.000547 |
from aquarius.objects.Book import Book
class GetBookByTitleAndAuthor(object):
def __init__(self, connection):
self.__connection = connection
def execute(self, book):
b = Book()
sql = "SELECT Id, Title, Author FROM Book WHERE Title=? AND Author=?"
r = list(self.__connection.ex... | jeroanan/Aquarius | aquarius/persistence/sqlitepersistence/GetBookByTitleAndAuthor.py | Python | gpl-3.0 | 634 | 0.001577 |
# -*- coding: utf-8 -*-
"""
Test for the pseudo-form implementation (odoo.tests.common.Form), which should
basically be a server-side implementation of form views (though probably not
complete) intended for properly validating business "view" flows (onchanges,
readonly, required, ...) and make it easier to generate sen... | t3dev/odoo | odoo/addons/test_testing_utilities/tests/test_form_impl.py | Python | gpl-3.0 | 16,663 | 0.00102 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ComboBox.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_comboBoxDialog(object):
def setupUi(self, comboBoxDialog):
co... | AndrewReynen/Lazylyst | lazylyst/UI/ComboBox.py | Python | mit | 2,055 | 0.003406 |
from django.views.generic import ListView, TemplateView
class IndexView(TemplateView):
template_name = 'index.html'
| fiee/fiee-temporale | demo/views.py | Python | bsd-3-clause | 121 | 0.008264 |
import pydpx_meta
# High level class DpxHeaderEx sample
#dpx = pydpx_meta.DpxHeaderEx("/root/V14_37_26_01_v001.0186.dpx")
dpx = pydpx_meta.DpxHeaderEx()
print(dpx.describe())
| plinecom/pydpx_meta | sample2_ex.py | Python | mit | 176 | 0.005682 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import frappe
import unittest
import json
class TestPreparedReport(unittest.TestCase):
def setUp(self):
self.report = frappe.get_doc({
"doctype": "Report",
"name": "Permitted Documents For User"
}... | frappe/frappe | frappe/core/doctype/prepared_report/test_prepared_report.py | Python | mit | 862 | 0.024362 |
from setuptools import setup
setup(
name='behave-teamcity',
version="0.1.23",
packages=['behave_teamcity', ],
url='https://github.com/iljabauer/behave-teamcity',
download_url='https://github.com/iljabauer/behave-teamcity/releases/tag/0.1.23',
license='MIT',
author='Ilja Bauer',
author_e... | jronald01/behave-teamcity | setup.py | Python | mit | 861 | 0.001161 |
from __future__ import unicode_literals
from django.apps import AppConfig
class SequencerConfig(AppConfig):
name = 'sequencer'
| CARPEM/GalaxyDocker | data-manager-hegp/analysisManager/analysismanager/sequencer/apps.py | Python | mit | 134 | 0 |
# statusbar-1.py
from wax import *
import time
class MainFrame(VerticalFrame):
def Body(self):
statusbar = StatusBar(self, numpanels=3, add=1)
# "add=1" adds the statusbar to its parent automagically; if you omit
# this, you'll have to do self.SetStatusBar(statusbar) explicitly
# ... | MSMBA/msmba-workflow | msmba-workflow/srclib/wax/examples/statusbar-1.py | Python | gpl-2.0 | 728 | 0.002747 |
from south.db import db
from django.db import models
from cm.models import *
class Migration:
def forwards(self, orm):
"Write your forwards migration here"
for tv in orm.TextVersion.objects.all():
tv.key = orm.TextVersion.objects._gen_key()
tv.adminkey = orm.T... | co-ment/comt | src/cm/migrations/0003_update_keys_to_textversion.py | Python | agpl-3.0 | 15,210 | 0.008153 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.