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 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio 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 t... | PXke/invenio | invenio/legacy/docextract/utils.py | Python | gpl-2.0 | 1,606 | 0.010585 |
# SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint
"""Google (Scholar)
For detailed description of the *REST-full* API see: `Query Parameter
Definitions`_.
.. _Query Parameter Definitions:
https://developers.google.com/custom-search/docs/xml_results#WebSearch_Query_Parameter_Definitions
"""
# pylint: dis... | dalf/searx | searx/engines/google_scholar.py | Python | agpl-3.0 | 4,416 | 0.003397 |
import unittest
from aquarius.Aquarius import Aquarius
class ConsoleTestBase(unittest.TestCase):
def initialise_app_mock(self):
self.app = Aquarius(None, None, None)
def assert_called(self, method):
self.assertTrue(method.called) | jeroanan/Aquarius | tests/output/console/ConsoleTestBase.py | Python | gpl-3.0 | 257 | 0.003891 |
#
# This file is part of ROSbots Setup Tools.
#
# Copyright
#
# Copyright (C) 2017 Jack Pien <jack@rosbots.com>
#
# License
#
# This program 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 Foundatio... | ROSbots/rosbots_setup_tools | rpi_setup/fabfile.py | Python | gpl-3.0 | 34,336 | 0.006291 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will b... | BhallaLab/moose | moose-gui/suds/xsd/__init__.py | Python | gpl-3.0 | 2,613 | 0.004592 |
# 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 model 'Contact'
db.create_table('storybase_user_contact', (
('id', self.gf('django.db... | denverfoundation/storybase | apps/storybase_user/migrations/0006_auto__add_contact.py | Python | mit | 14,929 | 0.007636 |
#!/usr/bin/env python
#Protocol:
# num_files:uint(4)
# repeat num_files times:
# filename:string
# size:uint(8)
# data:bytes(size)
import sys, socket
import os
from time import time
DEFAULT_PORT = 52423
PROGRESSBAR_WIDTH = 50
BUFSIZE = 1024*1024
CONNECTION_TIMEOUT = 3.0
RECEIVE_TIMEOUT = 5.0
if os.name == "nt... | lorian1333/netcopy | netcopy.py | Python | mit | 5,187 | 0.04492 |
# Copyright 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.
import os
import subprocess
from telemetry.core.platform import profiler
from telemetry.core import util
from telemetry.internal.backends.chrome import andr... | SaschaMester/delicium | tools/telemetry/telemetry/core/platform/profiler/android_screen_recorder_profiler.py | Python | bsd-3-clause | 1,492 | 0.005362 |
# Copyright (C) 2020 Red Hat, Inc., Jake Hunsaker <jhunsake@redhat.com>
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU Gen... | TurboTurtle/sos | sos/policies/init_systems/systemd.py | Python | gpl-2.0 | 1,563 | 0 |
# coding: utf-8
from app.settings.dist import *
try:
from app.settings.local import *
except ImportError:
pass
from app.settings.messages import *
from app.settings.dist import INSTALLED_APPS
DEBUG = True
DEV_SERVER = True
USER_FILES_LIMIT = 1.2 * 1024 * 1024
SEND_MESSAGES = False
DATABASES = {
'default':... | tarvitz/djtp | app/settings/test.py | Python | bsd-3-clause | 721 | 0.001387 |
"""
Shopify Trois
---------------
Shopify API for Python 3
"""
from setuptools import setup
setup(
name='shopify-trois',
version='1.1-dev',
url='http://masom.github.io/shopify-trois',
license='MIT',
author='Martin Samson',
author_email='pyrolian@gmail.com',
maintainer='Martin Samson',
... | masom/shopify-trois | setup.py | Python | mit | 1,267 | 0 |
class node:
def __init__(self):
self.outputs=[]
def set(self):
for out in self.outputs:
out.set()
def clear(self):
for out in self.outputs:
out.clear()
class switch:
def __init__(self):
self.outputs=[]
self.state=False
self.input=False
def set(self):
self.input=True
if(self.state):
... | mikadam/LadderiLogical | tests/node.py | Python | mit | 1,030 | 0.067961 |
"""Concrete date/time and related types.
See http://www.iana.org/time-zones/repository/tz-link.html for
time zone and DST data sources.
"""
import time as _time
import math as _math
def _cmp(x, y):
return 0 if x == y else 1 if x > y else -1
MINYEAR = 1
MAXYEAR = 9999
_MAXORDINAL = 3652059 # date.max.toordinal(... | bgris/ODL_bgris | lib/python3.5/datetime.py | Python | gpl-3.0 | 75,899 | 0.000751 |
from math import sqrt
def is_prime(x):
for i in xrange(2, int(sqrt(x) + 1)):
if x % i == 0:
return False
return True
def rotate(v):
res = []
u = str(v)
while True:
u = u[1:] + u[0]
w = int(u)
if w == v:
break
res.append(w)
ret... | neutronest/eulerproject-douby | e35/35.py | Python | mit | 586 | 0.006826 |
"""
homeassistant.components.mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MQTT component, using paho-mqtt.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/mqtt/
"""
import json
import logging
import os
import socket
import time
from homeassistant.exceptions impo... | badele/home-assistant | homeassistant/components/mqtt/__init__.py | Python | mit | 9,508 | 0 |
"""
Empty
"""
| fallisd/validate | unittests/__init__.py | Python | gpl-2.0 | 14 | 0 |
from __future__ import absolute_import
from celery import shared_task
import praw
from .commonTasks import *
from .models import Redditor, RedditorStatus, Status
@shared_task
def test(param):
return 'The test task executed with argument "%s" ' % param
@shared_task
def update_user(redditor):
update_user_st... | a-harper/RedditorProfiler | tasks.py | Python | gpl-3.0 | 532 | 0.00188 |
"""
WSGI config for spendrbackend project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | sawmurai/spendrbackend | spendrbackend/wsgi.py | Python | apache-2.0 | 404 | 0 |
import os
import sys
path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.insert(0, path)
| phha/taskwiki | tests/__init__.py | Python | mit | 115 | 0 |
# Created By: Virgil Dupras
# Created On: 2010-02-05
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/g... | stuckj/dupeguru | qt/base/details_dialog.py | Python | gpl-3.0 | 1,600 | 0.00875 |
#!/usr/bin/env python
from django.core.management import call_command
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
call_command(
'dumpdata',
"waffle.flag",
indent=4,
use_natural_foreign_k... | uclouvain/OSIS-Louvain | base/management/commands/dump_waffle_flags.py | Python | agpl-3.0 | 436 | 0 |
'''
Copyright 2017, Fujitsu Network Communications, 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 w... | warriorframework/warriorframework | warrior/WarriorCore/__init__.py | Python | apache-2.0 | 581 | 0.001721 |
from pprint import pprint
from amazon_cf import Environment
from amazon_client import Cloudformation
from helper import (
Listener,
SecurityGroupRules,
UserPolicy,
get_my_ip,
get_local_variables,
convert_to_aws_list,
ContainerDefinition
)
if __name__ == "__main__":
# Manually created it... | martyni/amazon | my_env.py | Python | mit | 5,433 | 0.001104 |
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from finance.models import Payment
from .models import BookingVehicle
@receiver([post_save, post_delete], sender=Payment)
def update_booking_payment_info(sender, instance, **kwargs):
if instance.item_content_type.ap... | rtnpro/opencabs | opencabs/signals.py | Python | gpl-3.0 | 635 | 0 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
class QualityMeeting(Document):
pass | Zlash65/erpnext | erpnext/quality_management/doctype/quality_meeting/quality_meeting.py | Python | gpl-3.0 | 242 | 0.012397 |
# Copyright (c) 2012 - 2014 EMC Corporation, 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
#
# ... | hguemar/cinder | cinder/tests/test_emc_vnxdirect.py | Python | apache-2.0 | 125,902 | 0.000246 |
# Copyright (C) 2011 Jeff Forcier <jeff@bitprophet.org>
#
# This file is part of ssh.
#
# 'ssh' is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# ... | bitprophet/ssh | ssh/transport.py | Python | lgpl-2.1 | 88,838 | 0.002161 |
'''
Audio
=====
The :class:`Audio` is used for recording audio.
Default path for recording is set in platform implementation.
.. note::
On Android the `RECORD_AUDIO`, `WAKE_LOCK` permissions are needed.
Simple Examples
---------------
To get the file path::
>>> audio.file_path
'/sdcard/testrecorde... | johnbolia/plyer | plyer/facades/audio.py | Python | mit | 1,873 | 0 |
from .. utils import TranspileTestCase, UnaryOperationTestCase, BinaryOperationTestCase, InplaceOperationTestCase
class StrTests(TranspileTestCase):
def test_setattr(self):
self.assertCodeExecution("""
x = "Hello, world"
x.attr = 42
print('Done.')
""")
... | Felix5721/voc | tests/datatypes/test_str.py | Python | bsd-3-clause | 9,931 | 0.000101 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | mpasternak/pyglet-fix-issue-552 | pyglet/input/__init__.py | Python | bsd-3-clause | 7,205 | 0.001249 |
#! /usr/bin/python
#should move this file inside docker image
import ast
import solution
'''driver file running the program
takes the test cases from the answers/question_name file
and executes each test case. The output of each execution
will be compared and the program outputs a binary string.
Eg : 1110111 mea... | akhilerm/Castle | storage/app/public/drivers/driver.py | Python | mit | 1,024 | 0.019531 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
import datetime
import hashlib
import json
import time
import urlparse
from cont... | hwine/build-relengapi | relengapi/blueprints/tooltool/test_tooltool.py | Python | mpl-2.0 | 32,335 | 0.000526 |
# -*- coding: utf-8 -*-
# Copyright 2021 Google LLC
#
# 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... | googleapis/python-shell | docs/conf.py | Python | apache-2.0 | 12,306 | 0.00065 |
import re
import numpy as np
from scipy import special
from .common import with_attributes, safe_import
with safe_import():
from scipy.special import cython_special
FUNC_ARGS = {
'airy_d': (1,),
'airy_D': (1,),
'beta_dd': (0.25, 0.75),
'erf_d': (1,),
'erf_D': (1+1j,),
'exprel_d': (1e-6,)... | WarrenWeckesser/scipy | benchmarks/benchmarks/cython_special.py | Python | bsd-3-clause | 1,956 | 0 |
# -*- coding: utf-8 -*-
# This exploit template was generated via:
# $ pwn template ./vuln
from pwn import *
# Set up pwntools for the correct architecture
exe = context.binary = ELF('./vuln')
def start(argv=[], *a, **kw):
'''Start the exploit against the target.'''
if args.GDB:
return gdb.debug([exe.... | Caesurus/CTF_Writeups | 2019-PicoCTF/exploits/exploit_overflow-1.py | Python | apache-2.0 | 624 | 0.00641 |
"""Request/Response Schemas are defined here"""
# pylint: disable=invalid-name
from marshmallow import Schema, fields, validate
from todo.constants import TO_DO, IN_PROGRESS, DONE
class TaskSchema(Schema):
"""Schema for serializing an instance of Task"""
id = fields.Int(required=True)
title = fields.Str... | kokimoribe/todo-api | todo/schemas.py | Python | mit | 1,124 | 0 |
import asyncio
import discord
from discord.ext import commands
from cogs.utils import checks
from cogs.utils.storage import RedisDict
class TemporaryVoice:
"""A cog to create TeamSpeak-like voice channels."""
def __init__(self, liara):
self.liara = liara
self.config = RedisDict('pandentia.te... | Pandentia/Liara-Cogs | cogs/tempvoice.py | Python | mit | 3,721 | 0.00215 |
import brickpi3
ZZ
| nextdude/robogator-controller | src/test-motor.py | Python | mit | 19 | 0 |
#!/usr/bin/env python
"""
Copyright 2014 Jirafe, 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 applicab... | concerned3rdparty/jirafe-python | jirafe/models/Category.py | Python | mit | 944 | 0.007415 |
#!/usr/bin/env python
from nose.tools import *
import networkx as nx
class TestGeneratorsGeometric():
def test_random_geometric_graph(self):
G=nx.random_geometric_graph(50,0.25)
assert_equal(len(G),50)
def test_geographical_threshold_graph(self):
G=nx.geographical_threshold_graph(50,10... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/networkx/generators/tests/test_geometric.py | Python | bsd-2-clause | 1,036 | 0.029923 |
# Copyright (c) 2011 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 ... | openstack/nova | nova/compute/utils.py | Python | apache-2.0 | 63,683 | 0.000094 |
NOERROR = 0
NOCONTEXT = -1
NODISPLAY = -2
NOWINDOW = -3
NOGRAPHICS = -4
NOTTOP = -5
NOVISUAL = -6
BUFSIZE = -7
BADWINDOW = -8
ALREADYBOUND = -100
BINDFAILED = -101
SETFAILED = -102
| xbmc/atv2 | xbmc/lib/libPython/Python/Lib/plat-irix6/GLWS.py | Python | gpl-2.0 | 181 | 0 |
#!/usr/bin/python
# Copyright 2017 Google Inc.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Python sample demonstrating use of the Google Genomics Pipelines API.
This sample demonstrates a pipe... | googlegenomics/pipelines-api-examples | bioconductor/run_bioconductor.py | Python | bsd-3-clause | 6,448 | 0.004498 |
# Copyright 2019 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... | alsrgv/tensorflow | tensorflow/lite/testing/generate_examples_lib.py | Python | apache-2.0 | 176,619 | 0.005588 |
#!/usr/bin/env python
# vim: sw=4:ts=4:sts=4:fdm=indent:fdl=0:
# -*- coding: UTF8 -*-
#
# A sword KJV indexed search module.
# Copyright (C) 2012 Josiah Gordon <josiahg@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... | zepto/biblesearch.web | sword_search.old/search.py | Python | gpl-3.0 | 146,124 | 0.000561 |
# Copyright (c) 2015 Mirantis 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 writ... | openstack/sahara | sahara/tests/unit/service/api/test_v10.py | Python | apache-2.0 | 11,635 | 0 |
from cinder.exception import *
from cinder.i18n import _
class ProviderMultiVolumeError(CinderException):
msg_fmt = _("volume %(volume_id)s More than one provider_volume are found")
class ProviderMultiSnapshotError(CinderException):
msg_fmt = _("snapshot %(snapshot_id)s More than one provider_snapshot are fo... | hybrid-storage-dev/cinder-fs-111t-hybrid-cherry | volume/drivers/ec2/exception_ex.py | Python | apache-2.0 | 1,031 | 0.012609 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorflow_serving/config/platform_config.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.pr... | diplomacy/research | diplomacy_research/proto/tensorflow_serving/config/platform_config_pb2.py | Python | mit | 6,119 | 0.00621 |
from django.conf.urls import url
from DjangoTaskManager.task import views
urlpatterns = [
url(r'^$', views.all_tasks, name='all_tasks'),
url(r'^add/$', views.add, name='task_add'),
url(r'^mark-done/(?P<task_id>[\w+:-]+)/$',
views.mark_done, name='task_mark_done'),
url(r'^edit/(?P<task_id>[\w+:... | MaxwellCoriell/DjangoTaskManager | DjangoTaskManager/task/urls.py | Python | mit | 544 | 0 |
class Node(object):
#a binary search tree has a left node (smaller values) and a right node (greater values)
def __init__(self, data):
self.data = data;
self.left_child = None;
self.right_child = None;
class BinarySearchTree(object):
def __init__(self):
self.root = None;
#inserting ite... | prk327/CoAca | Algo - DataStru/bst.py | Python | gpl-3.0 | 4,916 | 0.058381 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from decimal import Decimal as D
class NexmoResponse(object):
"""A convenient wrapper to manipulate the Nexmo json response.
The class makes it easy to retrieve information about sent messages, total
price, etc.
Example::
>>>... | thibault/libnexmo | libnexmo/response.py | Python | mit | 1,868 | 0.000535 |
#PROJECT
from outcome import Outcome
from odds import Odds
class Bin:
def __init__(
self,
*outcomes
):
self.outcomes = set([outcome for outcome in outcomes])
def add_outcome(
self,
outcome
):
self.outcomes.add(outcome)
def __str__(self):
re... | ddenhartog/itmaybeahack-roulette | bin.py | Python | mit | 4,662 | 0.000858 |
from django.conf.urls import include, url
from django.conf import settings
from django.contrib import admin
from djgeojson.views import GeoJSONLayerView
from wagtail.contrib.wagtailsitemaps.views import sitemap
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtaildocs import urls as wagtaildo... | spketoundi/CamODI | waespk/urls.py | Python | mit | 1,548 | 0.001292 |
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
#
# module_dumper.py - WIDS/WIPS framework file dumper module
# Copyright (C) 2009 Peter Krebs, Herbert Haas
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by the
# Fr... | pkrebs/WIDPS | fw_modules/module_dumper.py | Python | gpl-2.0 | 3,313 | 0.00815 |
#
# 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... | apache/incubator-airflow | tests/providers/apache/hive/operators/test_hive_stats.py | Python | apache-2.0 | 14,564 | 0.003158 |
"""
raven.utils
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import hashlib
import hmac
import logging
try:
import pkg_resources
except ImportError:
pkg_resources = None
import sys
import raven
def construct_check... | mitsuhiko/raven | raven/utils/__init__.py | Python | bsd-3-clause | 3,540 | 0.003107 |
"""
Copyright 2017 Robin Verschueren
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, softw... | SteveDiamond/cvxpy | cvxpy/reductions/complex2real/atom_canonicalizers/__init__.py | Python | gpl-3.0 | 4,337 | 0.003459 |
#----------------------------------------------------------------------
# Copyright (c) 2014 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | yippeecw/sfa | sfa/trust/credential_factory.py | Python | mit | 5,023 | 0.002588 |
# -*- python -*-
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later versio... | jocelynmass/nrf51 | toolchain/arm_cm0/arm-none-eabi/lib/thumb/v7-ar/libstdc++.a-gdb.py | Python | gpl-2.0 | 2,483 | 0.006444 |
"""
Tests specific to the collections module.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import io
from nose.tools import assert_equal
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from nose.... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/matplotlib/tests/test_collections.py | Python | bsd-2-clause | 21,429 | 0 |
# Generated by Django 2.2.6 on 2019-10-23 09:06
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import olympia.amo.models
class Migration(migrations.Migration):
dependencies = [
('scanners', '0008_auto_20191021_1718'),
]
operations = [
... | bqbn/addons-server | src/olympia/scanners/migrations/0009_auto_20191023_0906.py | Python | bsd-3-clause | 1,450 | 0.004138 |
"""Support for vacuum cleaner robots (botvacs)."""
from dataclasses import dataclass
from datetime import timedelta
from functools import partial
import logging
from typing import final
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( # noqa: F401 # STAT... | rohitranjan1991/home-assistant | homeassistant/components/vacuum/__init__.py | Python | mit | 11,915 | 0.000587 |
# Copyright 2013 Radware LTD.
#
# 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 agree... | shakamunyi/neutron-vrrp | neutron/services/loadbalancer/drivers/radware/driver.py | Python | apache-2.0 | 45,498 | 0.000374 |
'''longtroll: Notify you when your long-running processes finish.'''
import argparse
import getpass
import os
import pickle
import re
import subprocess
import time
collapse_whitespace_re = re.compile('[ \t][ \t]*')
def spawn_notify(notifier, proc_ended):
cmd = notifier.replace('<cmd>', proc_ended[0])
cmd = cmd.r... | haldean/longtroll | longtroll/longtroll.py | Python | mit | 3,588 | 0.015886 |
"""
Decode all-call reply messages, with downlink format 11
"""
from pyModeS import common
def _checkdf(func):
"""Ensure downlink format is 11."""
def wrapper(msg):
df = common.df(msg)
if df != 11:
raise RuntimeError(
"Incorrect downlink format, expect 11, got {}"... | junzis/pyModeS | pyModeS/decoder/allcall.py | Python | gpl-3.0 | 1,888 | 0.003178 |
# Copyright 2012-2013, Andrey Kislyuk and argcomplete contributors.
# Licensed under the Apache License. See https://github.com/kislyuk/argcomplete for more info.
from argparse import ArgumentParser, ArgumentError, SUPPRESS, _SubParsersAction
from argparse import OPTIONAL, ZERO_OR_MORE, ONE_OR_MORE, REMAINDER, PARSER
... | catapult-project/catapult | third_party/gsutil/third_party/argcomplete/argcomplete/my_argparse.py | Python | bsd-3-clause | 15,351 | 0.000912 |
import wx
from ui.custom_checkbox import CustomCheckBox
class CustomMenuBar(wx.Panel):
def __init__(self, parent, *args, **kwargs):
wx.Panel.__init__(self, parent, *args, **kwargs)
self.parent = parent
self.SetBackgroundColour(self.parent.GetBackgroundColour())
self.SetForegroundColo... | jeff-alves/Tera | ui/custom_menu_bar.py | Python | mit | 2,593 | 0.00617 |
from urlparse import urlparse
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from cabot.cabotapp.models import Service
from cabot.metricsapp.models import MetricsSourceBase, ElasticsearchStatusCheck, GrafanaInstance, GrafanaPanel
class TestM... | Affirm/cabot | cabot/metricsapp/tests/test_views.py | Python | mit | 4,754 | 0.004417 |
"""
script_watcher.py: Reload watched script upon changes.
Copyright (C) 2015 Isaac Weaver
Author: Isaac Weaver <wisaac407@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 Software Foundation; eith... | kilbee/blender-script-watcher | script_watcher.py | Python | gpl-2.0 | 12,299 | 0.007887 |
#!/usr/bin/env python3
# copyright (C) 2021- The University of Notre Dame
# This software is distributed under the GNU General Public License.
# See the file COPYING for details.
# Example on how to execute python code with a Work Queue task.
# The class PythonTask allows users to execute python functions as Work Que... | btovar/cctools | work_queue/src/bindings/python3/PythonTask_example.py | Python | gpl-2.0 | 2,499 | 0.002001 |
#!/usr/bin/env python
''' Python DB API 2.0 driver compliance unit test suite.
This software is Public Domain and may be used without restrictions.
"Now we have booze and barflies entering the discussion, plus rumours of
DBAs on drugs... and I won't tell you what flashes through my mind each
time I read... | d33tah/bpgsql | tests/dbapi20.py | Python | lgpl-2.1 | 31,413 | 0.010251 |
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import test_ui
| Vauxoo/e-commerce | website_sale_require_legal/tests/__init__.py | Python | agpl-3.0 | 88 | 0 |
from survey.management.commands.import_location import Command
__all__ = [''] | antsmc2/mics | survey/management/commands/__init__.py | Python | bsd-3-clause | 77 | 0.012987 |
# -*- coding: utf-8 -*-
from mesa_pd.accessor import create_access
from mesa_pd.utility import generate_file
def create_property(name, type, defValue=""):
"""
Parameters
----------
name : str
name of the property
type : str
type of the property
defValue : str
default valu... | lssfau/walberla | python/mesa_pd/kernel/HCSITSRelaxationStep.py | Python | gpl-3.0 | 2,010 | 0.006468 |
#! /usr/bin/env python
""" Create files for shuf unit test """
import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p
d, a = pipe.read("time_complex.fid")
d, a = p.shuf(d, a, mode="ri2c")
pipe.write("shuf1.glue", d, a, overwrite=True)
d, a = pipe.read("time_complex.fid")
d, a = p.shuf(d, a, mode="c... | atomman/nmrglue | tests/pipe_proc_tests/shuf.py | Python | bsd-3-clause | 963 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import os
from core.base_processor import xBaseProcessor
from utilities.export_helper import xExportHelper
from utilities.file_utility import xFileUtility
from definitions.constant_data impo... | xLemon/xExcelConvertor | excel_convertor/processors/processor_php.py | Python | mit | 7,054 | 0.026398 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain th... | htc-msm8960/android_kernel_htc_msm8930 | scripts/gcc-wrapper.py | Python | gpl-2.0 | 3,965 | 0.002774 |
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... | chotchki/servo | python/licenseck.py | Python | mpl-2.0 | 1,985 | 0.002519 |
from . import db
from .assoc import section_professor
class Professor(db.Model):
__tablename__ = 'professors'
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('users.id'), unique=True)
first_name = db.Column(db.Text, nullable=False)
last_name = db.Column... | SCUEvals/scuevals-api | scuevals_api/models/professor.py | Python | agpl-3.0 | 905 | 0.00221 |
#!/usr/bin/python
#
# This module 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.
#
# This software is distributed in the hope that it ... | tersmitten/ansible-modules-core | cloud/openstack/os_router.py | Python | gpl-3.0 | 12,382 | 0.001373 |
# -*- coding: utf-8 -*-
# Copyright 2010-2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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
#
# htt... | opstooling/python-cratonclient | cratonclient/tests/base.py | Python | apache-2.0 | 1,608 | 0.000622 |
# -*- coding: utf-8 -*-
"""
Написать функцию is_prime, принимающую 1 аргумент: число от 0 до 1000.
Если число простое, то функция возвращает True, а в противном случае - False.
"""
prime_1000 = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, ... | victorivanovspb/challenge-accepted | resp_simple/is_prime.py | Python | gpl-3.0 | 1,857 | 0.005675 |
"""
Clone server Model Six
"""
import random
import time
import zmq
from clone import Clone
SUBTREE = "/client/"
def main():
# Create and connect clone
clone = Clone()
clone.subtree = SUBTREE
clone.connect("tcp://localhost", 5556)
clone.connect("tcp://localhost", 5566)
try:
while ... | soscpd/bee | root/tests/zguide/examples/Python/clonecli6.py | Python | mit | 638 | 0.007837 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('zeltlager_registration', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='jugendgruppe',
... | jjbgf/eventbooking | zeltlager_registration/migrations/0002_auto_20150211_2011.py | Python | gpl-2.0 | 675 | 0 |
"""
Utility classes and functions to handle Virtual Machine creation using qemu.
:copyright: 2008-2009 Red Hat Inc.
"""
import time
import os
import logging
import fcntl
import re
import commands
from autotest.client.shared import error
from autotest.client import utils
import utils_misc
import virt_vm
import test_se... | spcui/virt-test | virttest/qemu_vm.py | Python | gpl-2.0 | 146,685 | 0.000389 |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | flgiordano/netcash | +/google-cloud-sdk/lib/googlecloudsdk/api_lib/compute/firewalls_utils.py | Python | bsd-3-clause | 6,885 | 0.003631 |
#!/usr/bin/env python3
import random
import numpy as np
import sympy
mod_space = 29
'''
Generate Encryption Key
'''
# In --> size of matrix (n x n)
# Out --> List of lists [[1,2,3],[4,5,6],[7,8,9]]
def generate_encryption_key(size):
determinant = 0
# Need to make sure encryption key is invertible, IE det(k... | jbloom512/Linear_Algebra_Encryption | Generate_Encryption_Key.py | Python | mit | 3,446 | 0.006384 |
from django.forms import ModelForm
from bug_reporting.models import Feedback
from CoralNet.forms import FormHelper
class FeedbackForm(ModelForm):
class Meta:
model = Feedback
fields = ('type', 'comment') # Other fields are auto-set
#error_css_class = ...
#required_css_class = ...
d... | DevangS/CoralNet | bug_reporting/forms.py | Python | bsd-2-clause | 661 | 0.006051 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mobilepolls.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| jacol12345/TP-ankiety-web-app | mobilepolls/manage.py | Python | mit | 254 | 0 |
#
# Copyright (c) 2001 - 2019 The SCons Foundation
#
# 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... | kayhayen/Nuitka | nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/vc.py | Python | apache-2.0 | 33,537 | 0.006202 |
# 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... | yanchen036/tensorflow | tensorflow/contrib/cudnn_rnn/python/kernel_tests/cudnn_rnn_test.py | Python | apache-2.0 | 57,239 | 0.006918 |
# Copyright (c) 2013 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 law or agreed to in ... | citrix-openstack-build/python-cinderclient | cinderclient/tests/v2/fakes.py | Python | apache-2.0 | 24,282 | 0.000124 |
from registrator.models.registration_entry import RegistrationEntry
from uni_info.models import Section
class RegistrationProxy(RegistrationEntry):
"""
Proxy class which handles actually doing the registration in a system
of a :model:`registrator.RegistrationEntry`
"""
# I guess functions for reg... | squarebracket/star | registrator/models/registration_proxy.py | Python | gpl-2.0 | 1,141 | 0.001753 |
import argparse
import docker
import logging
import os
import docket
logger = logging.getLogger('docket')
logging.basicConfig()
parser = argparse.ArgumentParser(description='')
parser.add_argument('-t --tag', dest='tag', help='tag for final image')
parser.add_argument('--verbose', dest='verbose', action='store_true',... | clarete/docket | docket/command_line.py | Python | mit | 1,369 | 0.005844 |
"""
Utilities for validating inputs to user-facing API functions.
"""
from textwrap import dedent
from types import CodeType
from functools import wraps
from inspect import getargspec
from uuid import uuid4
from toolz.curried.operator import getitem
from six import viewkeys, exec_, PY3
_code_argorder = (
('co_ar... | bartosh/zipline | zipline/utils/preprocess.py | Python | apache-2.0 | 7,205 | 0 |
# Name: controls.py
# Purpose: Control components
# Author: Roman Rolinsky <rolinsky@femagsoft.com>
# Created: 31.05.2007
# RCS-ID: $Id: core.py 47823 2007-07-29 19:24:35Z ROL $
from wx.tools.XRCed import component, images, attribute, params
from wx.tools.XRCed.globals import TRACE
import... | 163gal/Time-Line | libs64/wx/tools/XRCed/plugins/controls.py | Python | gpl-3.0 | 19,978 | 0.00866 |
# Copyright (C) 2009-2012 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman 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 you... | hcs/mailman | src/mailman/commands/cli_version.py | Python | gpl-3.0 | 1,359 | 0.000736 |
#
# Copyright 2007-2009 Fedora Unity Project (http://fedoraunity.org)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2, or (at your option) any
# later version.
#
# This program is di... | sanjayankur31/pyjigdo | pyJigdo/__init__.py | Python | gpl-2.0 | 827 | 0 |
"""
Tests for functionality in openedx/core/lib/courses.py.
"""
import ddt
from django.test.utils import override_settings
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from ..course... | ahmedaljazzar/edx-platform | openedx/core/lib/tests/test_courses.py | Python | agpl-3.0 | 3,146 | 0.001271 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import datetime
import itertools
import os
import subprocess
im... | hipnusleo/laserjet | resource/pypi/cryptography-1.7.1/tests/hazmat/backends/test_openssl.py | Python | apache-2.0 | 28,781 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.