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/env python3
# -*- coding: utf-8 -*-
# Copyright 2022 Daniel Estevez <daniel@destevez.net>
#
# This file is part of gr-satellites
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
from gnuradio import gr, blocks, gr_unittest
import numpy as np
import pmt
# bootstrap satellites module, even from build dir
try... | daniestevez/gr-satellites | python/qa_crc.py | Python | gpl-3.0 | 6,774 | 0 |
## update-hue-ini.py
##
## This script will extract the appropriate IBM Analytics for Apache Hadoop credentials from the VCAP_SERVICES
## environment variable inside a running container. It will add the username and password to the hue.ini file
## so that the hue application has access to a specific instance
import s... | vmanoria/bluemix-hue-filebrowser | update-hue-ini.py | Python | gpl-2.0 | 1,829 | 0.02515 |
#! /usr/bin/env python
from urllib2 import urlopen
from urllib import urlencode
from urlparse import urlparse, urljoin
import os.path
from numpy import *
from astrometry.util.file import *
from astrometry.util.usnob_get_image import *
from optparse import OptionParser
if __name__ == '__main__':
parser = OptionPa... | blackball/an-test6 | util/usnob_get_region.py | Python | gpl-2.0 | 3,265 | 0.033691 |
# 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.
from infra_libs.infra_types.infra_types import freeze
from infra_libs.infra_types.infra_types import thaw
from infra_libs.infra_types.infra_types import Froz... | endlessm/chromium-browser | tools/swarming_client/third_party/infra_libs/infra_types/__init__.py | Python | bsd-3-clause | 327 | 0 |
import time
def check_vertical(matrix):
max_product = 0
for row in xrange(0, len(matrix)-3):
for col in xrange(0, len(matrix)):
product = matrix[row][col] * matrix[row+1][col] * matrix[row+2][col] * matrix[row+3][col]
max_product = max(product, max_product)
return max_product
def check_horizontal(matrix)... | CianciuStyles/project-euler | 011.py | Python | mit | 1,763 | 0.028361 |
# The MIT License (MIT)
#
# Copyright (c) 2014 Steve Milner
#
# 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, modi... | pombredanne/flagon | src/flagon/status_api/__init__.py | Python | mit | 3,360 | 0 |
'''Main simulation run: Simulation of a stationary bump.'''
from __future__ import absolute_import, print_function, division
from numpy.random import choice
from nest.hl_api import NESTError
from grid_cell_model.models.parameters import getOptParser
from grid_cell_model.models.gc_net_nest import BasicGridCellNetwork
... | MattNolanLab/ei-attractor | grid_cell_model/simulations/common/simulation_stationary.py | Python | gpl-3.0 | 3,476 | 0.000575 |
import pytest
import os
import shutil
import core
virtuallinks = core.import_package('virtuallinks')
def setup_function(function):
shutil.rmtree('temporary', ignore_errors=True)
os.mkdir('temporary')
os.chdir('temporary')
def teardown_function(function):
os.chdir('..')
shutil.rmtree('temporar... | ffunenga/virtuallinks | tests/core/test_installing.py | Python | mit | 2,693 | 0 |
#!/usr/bin/env python
# encoding: utf-8
"""
trend.datasource.trendfile.py
Handling and parsing of trendfiles (*.hdb)
Copyright (C) 2016/2017 Stefan Braun
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 Foundat... | stefanbraun-private/pyVisiToolkit | src/trend/datasource/trendfile.py | Python | gpl-3.0 | 49,022 | 0.023622 |
from acoustics.decibel import *
def test_dbsum():
assert(abs(dbsum([10.0, 10.0]) - 13.0103) < 1e-5)
def test_dbmean():
assert(dbmean([10.0, 10.0]) == 10.0)
def test_dbadd():
assert(abs(dbadd(10.0, 10.0) - 13.0103) < 1e-5)
def test_dbsub():
assert(abs(dbsub(13.0103, 10.0) - 10.0) < 1e-5)
def tes... | FRidh/python-acoustics | tests/test_decibel.py | Python | bsd-3-clause | 451 | 0.019956 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os, shutil, subprocess, glob
from setup import Command, __appname__, __versio... | yeyanchao/calibre | setup/publish.py | Python | gpl-3.0 | 3,819 | 0.008117 |
################################################################################
######### MS11-080 - CVE-2011-2005 Afd.sys Privilege Escalation Exploit ########
######### Author: ryujin@offsec.com - Matteo Memelli ########
######### Spaghetti & Pwnsauce ##... | SecWiki/windows-kernel-exploits | MS11-080/CVE-2011-2005.py | Python | mit | 12,217 | 0.014161 |
from setuptools import setup
setup(name='powerlab',
version='0.1',
description='Power System Tools',
url='https://github.com/Faggioni/powerlab',
author='Miguel Faggioni',
author_email='miguelfaggioni@gmail.com',
license='MIT',
packages=['powerlab'],
install_requires=[
... | Faggioni/powerlab | setup.py | Python | mit | 405 | 0.004938 |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from os import path
here = path.abspath(path.dirname(__file__))
setup(
name='dicom2fem',
description='Generation of finite element meshes from DICOM images',
long_desctioption="Generation of finite element meshes using c... | mjirik/dicom2fem | setup.py | Python | bsd-3-clause | 3,561 | 0.000842 |
#
# The Python Imaging Library.
# $Id$
#
# transform wrappers
#
# History:
# 2002-04-08 fl Created
#
# Copyright (c) 2002 by Secret Labs AB
# Copyright (c) 2002 by Fredrik Lundh
#
# See the README file for information on usage and redistribution.
#
from PIL import Image
class Transform(Image.ImageTransformHandler)... | DanteOnline/free-art | venv/lib/python3.4/site-packages/PIL/ImageTransform.py | Python | gpl-3.0 | 2,878 | 0 |
'''
plans.py
'''
from forex_python.converter import CurrencyCodes
from .base import Base
class Plan(Base):
'''
Plan class for making payment plans
'''
interval = None
name = None
amount = None
plan_code = None
currency = None
id = None
send_sms = True
send_invoices = True
... | Chibuzor-IN/python-paystack | python_paystack/objects/plans.py | Python | mit | 1,566 | 0.001916 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PhotoLoader.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| SerSamgy/PhotoLoader | manage.py | Python | mit | 254 | 0 |
#!/usr/bin/env python
import argparse
import logging
from functools import partial
from domain import date, transaction
# Parse command line arguments
parser = argparse.ArgumentParser(description="Convert currency using MasterCard exchange rates",
epilog='If no date is specified, the... | XanderXAJ/mastercardConvert | mastercardConvert.py | Python | gpl-3.0 | 2,462 | 0.004874 |
# DPLib - Asynchronous bot framework for Digital Paint: Paintball 2 servers
# Copyright (C) 2017 Michał Rokita
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the L... | mRokita/DPLib | dplib/parse.py | Python | agpl-3.0 | 3,545 | 0.005079 |
import unittest
from ctypes import *
import _ctypes_test
class SlicesTestCase(unittest.TestCase):
def test_getslice_cint(self):
a = (c_int * 100)(*xrange(1100, 1200))
b = range(1100, 1200)
self.failUnlessEqual(a[0:2], b[0:2])
self.failUnlessEqual(len(a), len(b))
self.failUn... | ztane/zsos | userland/lib/python2.5/ctypes/test/test_slicing.py | Python | gpl-3.0 | 3,845 | 0.00156 |
"""Here is defined the IndexArray class."""
from bisect import bisect_left, bisect_right
from .node import NotLoggedMixin
from .carray import CArray
from .earray import EArray
from . import indexesextension
# Declarations for inheriting
class CacheArray(indexesextension.CacheArray, NotLoggedMixin, EArray):
""... | avalentino/PyTables | tables/indexes.py | Python | bsd-3-clause | 5,884 | 0 |
from authenticators.simple_authenticators import RandomAuthenticator, \
HeuristicAuthenticator, OracleAuthenticator, NeverSecondAuthenticator, \
AlwaysSecondAuthenticator
from simulator import parameters
from simulator.transaction_model import TransactionModel
from experiments import rewards
import numpy as np
... | lmzintgraf/MultiMAuS | experiments/run_multimaus.py | Python | mit | 2,970 | 0.001684 |
# -*- coding: utf-8 -*-
#
# 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, soft... | devdattakulkarni/test-solum | solum/tests/api/handlers/test_workflow.py | Python | apache-2.0 | 4,365 | 0.000229 |
# Copyright 2020 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 agreed to in writing, ... | google/fedjax | fedjax/fedjax_test.py | Python | apache-2.0 | 1,219 | 0.003281 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | chopmann/warehouse | warehouse/i18n/translations.py | Python | apache-2.0 | 2,912 | 0 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cvirtual.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the... | Serchcode/cvirtual | manage.py | Python | gpl-3.0 | 806 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-15 16:12
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateM... | Alt90/Student_progress_bar | achievement/migrations/0001_initial.py | Python | mit | 819 | 0.003745 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup
from fairu import __version__
def packages():
packages = []
for root, dirnames, filenames in os.walk('fairu'):
if '__init__.py' in filenames:
packages.append(".".join(os.path.split(root)).str... | dfleury/fairu | setup.py | Python | gpl-3.0 | 2,511 | 0.018319 |
from seabreeze.pyseabreeze.features._base import SeaBreezeFeature
# Definition
# ==========
#
# TODO: This feature needs to be implemented for pyseabreeze
#
class SeaBreezeDataBufferFeature(SeaBreezeFeature):
identifier = "data_buffer"
def clear(self) -> None:
raise NotImplementedError("implement in ... | ap--/python-seabreeze | src/seabreeze/pyseabreeze/features/databuffer.py | Python | mit | 1,040 | 0 |
# Working Unit Test Benches for Network Simulator
# Last Revised: 14 November 2015 by Sushant Sundaresh & Sith Domrongkitchaiporn
'''
IMPORTANT: Please turn off logging (MEASUREMENT_ENABLE = False) in constants.py
before running these testbenches.
'''
# Unit Testing Framework
import unittest
# Test Modules
import r... | sssundar/NetworkSimulator | Code/Python/unit_test_benches.py | Python | gpl-2.0 | 12,927 | 0.044403 |
''' Example script to run a full analysis on telescope data. The original data
can be found in the example folder of the EUTelescope framework.
Data in https://github.com/eutelescope/eutelescope/tree/v1.0-tag/jobsub/examples/datura-150mm-DAF
The residuals are calculated with different cuts on prealigned a... | YannickDieter/testbeam_analysis | testbeam_analysis/examples/eutelescope.py | Python | mit | 14,587 | 0.001303 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<http://www.micronaet.it>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebrush>)
# This pro... | Micronaet/micronaet-migration | sale_exchange/__init__.py | Python | agpl-3.0 | 1,139 | 0.002634 |
import openvoronoi as ovd
import ovdvtk
import time
import vtk
import datetime
import math
import random
import os
import sys
import pickle
import gzip
if __name__ == "__main__":
# w=2500
# h=1500
# w=1920
# h=1080
w = 1024
h = 1024
myscreen = ovdvtk.VTKScreen(width=w, height=h)
ovdvt... | aewallin/openvoronoi | python_examples/spike_1.py | Python | lgpl-2.1 | 4,238 | 0.001416 |
#!/usr/bin/env python
# #To familiarize yourself with pyinotify, run a first example like this:
#
# # $ cd pyinotify-x-x-x && python setup.py build
# # $ python src/pyinotify/pyinotify.py -v my-dir-to-watch
#
# # Let's start a more detailed example. Say, we want to monitor the temp directory '/tmp' and all its subdire... | relic7/prodimages | python/DirWatchManager.py | Python | mit | 15,047 | 0.009238 |
"""
send mail with html template
"""
import logging
from django.template.loader import render_to_string
from common.notify import Notify
class Email:
def __init__(self):
self.logger = logging.getLogger('userquery')
def send(self, data):
self.logger.info("Sending mail by template %s" % dat... | linea-it/dri | api/userquery/email.py | Python | gpl-3.0 | 519 | 0.007707 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/lair/base/shared_poi_all_lair_thicket_large_evil_fire_red.iff"
resu... | obi-two/Rebelion | data/scripts/templates/object/tangible/lair/base/shared_poi_all_lair_thicket_large_evil_fire_red.py | Python | mit | 468 | 0.047009 |
# python3
import sys
class Bracket:
def __init__(self, bracket_type, position):
self.bracket_type = bracket_type
self.position = position
def Match(self, c):
if self.bracket_type == '[' and c == ']':
return True
if self.bracket_type == '{' and c == '}':... | supermikol/coursera | Data Structures/Week 1/check_brackets_in_code/check_brackets.py | Python | mit | 1,323 | 0.005291 |
#!/usr/bin/env python
# Source: https://gist.github.com/jtriley/1108174
import os
import shlex
import struct
import platform
import subprocess
def get_terminal_size():
""" getTerminalSize()
- get width and height of console
- works on linux,os x,windows,cygwin(windows)
originally retrieved from:
... | graveljp/smugcli | smugcli/terminal_size.py | Python | mit | 2,716 | 0.002577 |
# coding: utf-8
# Given code that can extract the contents of the inner rectangles (boxes), we can determine whether the
# contents have changed.
#
# Here, take an image of the previous box and see whether the same contents are still there. The idea is that
# a name does not only get erased, it may also be replac... | dirkjot/pingpongcam | opencv/exploration-3.py | Python | gpl-3.0 | 8,044 | 0.010816 |
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from btcrpc.utils.config_file_reader import ConfigFileReader
import json
import socket, errno
from btcrpc.utils.log import *
log = get_log("BTCRPCCall:")
class BTCRPCCall(object):
def __init__(self, wallet="receive", currency="btc"):
yml_conf... | BTCX/BTCX_blockchain | btcxblockchainapi/btcrpc/utils/btc_rpc_call.py | Python | mit | 3,371 | 0.009789 |
import random
import string
from collection.models import CollectionVersion, Collection
from concepts.models import Concept, ConceptVersion, LocalizedText
from oclapi.models import ACCESS_TYPE_EDIT, ACCESS_TYPE_VIEW
from orgs.models import Organization
from sources.models import Source, SourceVersion
from users.model... | snyaggarwal/oclapi | ocl/test_helper/base.py | Python | mpl-2.0 | 10,616 | 0.004333 |
#
# Copyright (c) 2008--2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | jhutar/spacewalk | client/tools/rhncfg/actions/script.py | Python | gpl-2.0 | 9,141 | 0.002297 |
# -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
#
# 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.apac... | Dev-Cloud-Platform/Dev-Cloud | dev_cloud/cc1/src/wi/tests/cm_networks_test.py | Python | apache-2.0 | 4,435 | 0.00203 |
from app_loader import app_loader
urlpatterns = app_loader.urlpatterns
| michaelkuty/python-app-loader | tests/testapp1/urls.py | Python | bsd-3-clause | 73 | 0 |
from django.core.management.base import NoArgsCommand
from django.contrib.auth.models import User
from api.models import EyeHistory
class Command(NoArgsCommand):
help = 'Detects and removes duplicated history entries'
def handle(self, **options):
self.stdout.write('Beginning update...\n')
us... | haystack/eyebrowse-server | common/management/commands/remove_duplicate_history.py | Python | mit | 949 | 0 |
#
# 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... | ChugR/qpid-dispatch | python/qpid_dispatch_internal/router/link.py | Python | apache-2.0 | 3,006 | 0.002329 |
from google.appengine.ext import db
class MyEntity(db.Model):
name = db.StringProperty()
| toomoresuch/pysonengine | parts/gaeunit/sample_app/model.py | Python | mit | 92 | 0.021739 |
#!/usr/bin/env python
# Copyright (c) Sasha Goldshtein
# Licensed under the Apache License, Version 2.0 (the "License")
import bcc
import unittest
from time import sleep
import distutils.version
import os
import subprocess
def kernel_version_ge(major, minor):
# True if running kernel is >= X.Y
version = distu... | shodoco/bcc | tests/python/test_tracepoint.py | Python | apache-2.0 | 2,128 | 0.00282 |
#
# Copyright (C) 2004 SIPfoundry Inc.
# Licensed by SIPfoundry under the GPL license.
#
# Copyright (C) 2004 SIP Forum
# Licensed to SIPfoundry under a Contributor Agreement.
#
#
# This file is part of SIP Forum User Agent Basic Test Suite which
# belongs to the SIP Forum Test Framework.
#
# SIP Forum User Agent Basic... | ezigman/sftf | UserAgentBasicTestSuite/case207.py | Python | gpl-2.0 | 3,360 | 0.018155 |
import libnacl.secret
import libnacl.utils
from StringIO import StringIO
from .response import FileObjResponse
from pyramid.httpexceptions import HTTPBadRequest
def generate_secret_key():
return libnacl.utils.salsa_key().encode('hex')
def encrypt_file(key, fileobj, nonce=None):
if nonce is None:
non... | Leits/openprocurement.api.encryprion | openprocurement/api/encryprion/utils.py | Python | apache-2.0 | 1,144 | 0 |
# encoding: utf-8
'''
Tests for various attachment thingies
Created on Oct 21, 2013
@author: pupssman
'''
import pytest
from hamcrest import has_entries, assert_that, is_, contains, has_property
from allure.constants import AttachmentType
from allure.utils import all_of
@pytest.mark.parametrize('package', ['pytes... | pvarenik/PyCourses | allure-python-master/tests/test_attach.py | Python | gpl-2.0 | 2,550 | 0.002402 |
SCORES = {'A': 100, 'B': 14, 'C': 9, 'D': 28, 'E': 145, 'F': 12, 'G': 3,
'H': 10, 'I': 200, 'J': 100, 'K': 114, 'L': 100, 'M': 25,
'N': 450, 'O': 80, 'P': 2, 'Q': 12, 'R': 400, 'S': 113, 'T': 405,
'U': 11, 'V': 10, 'W': 10, 'X': 3, 'Y': 210, 'Z': 23}
def sexy_name(name):
name_score =... | the-zebulan/CodeWars | katas/beta/how_sexy_is_your_name.py | Python | mit | 566 | 0 |
# external imports
import unittest
# local imports
import nautilus
from nautilus.api.endpoints import GraphQLRequestHandler
from ..util import Mock
class TestUtil(unittest.TestCase):
def setUp(self):
# create a service without an explict name
class MyService(nautilus.Service): pass
# save ... | aaivazis/nautilus | tests/services/test_service.py | Python | mit | 2,991 | 0.003678 |
import json
from stats import read_stats
@read_stats
def read_file(file_name, default='"?"'):
try:
file = open(file_name, 'r')
except FileNotFoundError:
print('Creating file {}'.format(file_name))
file = open(file_name, 'w+')
file.write(default)
contents = json.loads(file.... | nickdrozd/ecio-lisp | fileio.py | Python | mit | 581 | 0.003442 |
import os
import pytest
import requests
import requests_mock
import glob
import shutil
from moulinette import m18n
from moulinette.utils.filesystem import read_json, write_to_json, write_to_yaml
from yunohost.utils.error import YunohostError
from yunohost.app import (
_initialize_apps_catalog_system,
_read_ap... | YunoHost/moulinette-yunohost | src/yunohost/tests/test_appscatalog.py | Python | agpl-3.0 | 9,247 | 0.001406 |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import sys
import numpy
from math import floor
def movingAverage(x, N):
cumsum = numpy.cumsum(numpy.insert(x, 0, 0))
return (cumsum[N:] - cumsum[:-N])/N
filename = "reports/configuration.confrewardRecordReport.txt"
if (len(sys.argv) > 1):
filename = sys.argv[1]... | Jacques-Florence/schedSim | src/analysis/reward.py | Python | bsd-3-clause | 847 | 0.022432 |
# -*- coding: utf-8 -*-
import attr
from navmazing import NavigateToAttribute, NavigateToSibling
from widgetastic.widget import View, Select
from widgetastic_manageiq import (
Accordion, BaseEntitiesView, BootstrapSelect, BreadCrumb, ItemsToolBarViewSelector,
ManageIQTree, SummaryTable, Text, TextInput)
from w... | akarol/cfme_tests | cfme/cloud/security_groups.py | Python | gpl-2.0 | 8,515 | 0.001292 |
import gpbo
xrange=range
from gpbo.core import GPdc as GPdc
import scipy as sp
class eimledefault():
"""
fixed s, space is [-1,1]^D
"""
def __init__(self,f,D,n,s,path,fname):
self.aqfn = gpbo.core.acquisitions.EIMAPaq
self.aqpara= {
'ev': {'s': s, 'd': [sp.NaN]},
... | markm541374/gpbo | gpbo/core/config.py | Python | agpl-3.0 | 19,809 | 0.01575 |
#!/usr/bin/env python
""" This is a draft modification of the RRT algorithm for the sepcial case
that sampling the goal region is computationally expensive """
import random
import numpy
import time
import math
import logging
import copy
from rtree import index
class SampleData:
def __init__(self, config, d... | kth-ros-pkg/hfts_grasp_planner | src/hfts_grasp_planner/rrt.py | Python | bsd-3-clause | 28,198 | 0.003511 |
import logging
from savu.plugins.base_recon import BaseRecon
from savu.data.process_data import CitationInfomration
from savu.plugins.cpu_plugin import CpuPlugin
import skimage.transform as transform
import numpy as np
from scipy import ndimage
class ScikitimageFilterBackProjection(BaseRecon, CpuPlugin):
"""
... | swtp1v07/Savu | savu/plugins/scikitimage_filter_back_projection.py | Python | apache-2.0 | 3,515 | 0 |
# Partname: ATmega644A
# generated automatically, do not edit
MCUREGS = {
'ADCSRB': '&123',
'ADCSRB_ACME': '$40',
'ACSR': '&80',
'ACSR_ACD': '$80',
'ACSR_ACBG': '$40',
'ACSR_ACO': '$20',
'ACSR_ACI': '$10',
'ACSR_ACIE': '$08',
'ACSR_ACIC': '$04',
'ACSR_ACIS': '$03',
'DIDR1': '&127',
'DIDR1... | hickey/amforth | core/devices/atmega644a/device.py | Python | gpl-2.0 | 7,375 | 0.071458 |
def extractWhatzombiesfearCom(item):
'''
Parser for 'whatzombiesfear.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractWhatzombiesfearCom.py | Python | bsd-3-clause | 551 | 0.034483 |
distributable = FastLmmSet(
phenofile = 'datasets/phenSynthFrom22.23.bin.N30.txt',
alt_snpreader = 'datasets/all_chr.maf0.001.N30',
altset_list = 'datasets/set_input.23_17_11.txt',
covarfile = None,
filenull = None,
autoselect = False,
mindist = 0,
idist=2,
nperm = ... | MicrosoftGenomics/FaST-LMM | tests/inputs/buggy/lrt_one_kernel_mixed_effect_laplace_l2_logistic_qqfit.N30.py | Python | apache-2.0 | 956 | 0.041841 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis | base/forms/entity.py | Python | agpl-3.0 | 2,540 | 0.001182 |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_documents_delete_document_async.py | Python | apache-2.0 | 1,580 | 0.000633 |
count = 0
total = 0
average = 0
while True:
inputNumber = raw_input('Enter a number : ')
# Edge Cases
if inputNumber == 'done':
break
if len(inputNumber) < 1:
break
# Logical work
try:
number = float(inputNumber)
except:
print 'Invalid Number'
conti... | rahulbohra/Python-Basic | 35_sum_count_avg_by_user_input.py | Python | mit | 454 | 0.002203 |
#! /usr/bin/python
#
# Copyright 2009, 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
import errno
import grp
import os
import pwd
import socket
import subprocess
import sys
import tempfile
from lazr.config import as_username_groupname
f... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/buildmailman.py | Python | agpl-3.0 | 7,591 | 0 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RRots(RPackage):
"""Reproducibility-Optimized Test Statistic
Calculates the Reprod... | LLNL/spack | var/spack/repos/builtin/packages/r-rots/package.py | Python | lgpl-2.1 | 1,117 | 0.000895 |
# -*- coding: utf-8 -*-
#
# Cherokee-admin
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2001-2010 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free S... | chetan/cherokee | admin/market/ows_consts.py | Python | gpl-2.0 | 1,407 | 0.012082 |
# coding=utf-8
# Author: Mr_Orange <mr_orange@hotmail.it>
# URL: http://code.google.com/p/sickbeard/
#
# 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, either versi... | elit3ge/SickRage | sickbeard/providers/kat.py | Python | gpl-3.0 | 9,861 | 0.003752 |
PRIORITY_EMAIL_NOW = 0
PRIORITY_HIGH = 1
PRIORITY_NORMAL = 3
PRIORITY_LOW = 5
RESULT_SENT = 0
RESULT_SKIPPED = 1
RESULT_FAILED = 2
PRIORITIES = {
'now': PRIORITY_EMAIL_NOW,
'high': PRIORITY_HIGH,
'normal': PRIORITY_NORMAL,
'low': PRIORITY_LOW,
}
PRIORITY_HEADER = 'X-Mail-Queue-Priority'
try:
fro... | mfwarren/django-mailer-2 | django_mailer/constants.py | Python | mit | 475 | 0 |
## Copyright 2017 Knossos authors, see NOTICE file
##
## 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... | MjnMixael/knossos | knossos/launcher.py | Python | apache-2.0 | 12,595 | 0.003335 |
#!/usr/bin/env python
# coding=utf-8
import pprint
import csv
import click
import requests
import datetime as datetime
from datetime import date
from xml.etree import ElementTree as ET
import os
# from random import sample
import random
import json
# import logging
import subprocess
import glob
impor... | Fatman13/gta_swarm | ctripmultiplus.py | Python | mit | 1,017 | 0.013766 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cases', '0021_migrate_case_contacts'),
('msgs', '0008_messageaction'),
]
operations = [
migrations.RemoveField(
... | xkmato/casepro | casepro/cases/migrations/0022_delete_mesageaction.py | Python | bsd-3-clause | 697 | 0 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""Unit tests for the :func:`iris.analysis.maths.divide` function."""
# Import iris.tests first so that some things can be ini... | pp-mo/iris | lib/iris/tests/unit/analysis/maths/test_divide.py | Python | lgpl-3.0 | 2,496 | 0 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
import os
from setuptools import setup, find_packages
def get_version():
basedir = os.path.dirname(__file__)
with open(os.path.join(basedir, 'instapush/version.py')) as f:
locals = {}
exec(f.rea... | adamwen829/instapush-py | setup.py | Python | mit | 894 | 0.025727 |
# -*- coding: utf-8 -*-
# © 2013-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError, UserError
class AccountInvoiceLine(models.Model):
_inherit = 'accou... | stellaf/sales_rental | account_invoice_start_end_dates/models/account_invoice.py | Python | gpl-3.0 | 3,875 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
if sys.version_info >= (3, 0):
from unittest.mock import patch
else:
from mock import patch
from pyfakefs import fake_filesystem_unittest
from shellfoundry.utilities.config.config_context import ConfigContext
from shellfoundry.utilities.config.config_file_... | QualiSystems/shellfoundry | tests/test_utilities/config/test_config_record.py | Python | apache-2.0 | 5,062 | 0.001185 |
#!/usr/bin/env python
'''
mission editor module
Michael Day
June 2104
'''
from MAVProxy.modules.lib import mp_module
from MAVProxy.modules.lib import mp_util
from MAVProxy.modules.mavproxy_misseditor import me_event
MissionEditorEvent = me_event.MissionEditorEvent
from pymavlink import mavutil
import multiprocessin... | njoubert/MAVProxy | MAVProxy/modules/mavproxy_misseditor/__init__.py | Python | gpl-3.0 | 13,978 | 0.00651 |
# -*- coding: utf-8 -*-
import time
import pycurl
from module.plugins.captcha.ReCaptcha import ReCaptcha
from module.plugins.internal.misc import json
from module.plugins.internal.SimpleHoster import SimpleHoster
class RapiduNet(SimpleHoster):
__name__ = "RapiduNet"
__type__ = "hoster"
__version__ = "0.... | rlindner81/pyload | module/plugins/hoster/RapiduNet.py | Python | gpl-3.0 | 3,047 | 0.001313 |
#!/usr/bin/env python2
from SettingsWidgets import *
from gi.repository import Gtk, Gdk, GLib, Pango
import os, json, subprocess, re
from xml.etree import ElementTree
import gettext
LOCK_DELAY_OPTIONS = [
(0, _("Immediately")),
(15, _("After 15 seconds")),
(30, _("After 30 seconds")),
(60, _("After 1 ... | mattthur/Cinnamon | files/usr/lib/cinnamon-settings/modules/cs_screensaver.py | Python | gpl-2.0 | 16,729 | 0.003288 |
import pytest, py
from _pytest.main import Session, EXIT_NOTESTSCOLLECTED
class TestCollector:
def test_collect_versus_item(self):
from pytest import Collector, Item
assert not issubclass(Collector, Item)
assert not issubclass(Item, Collector)
def test_compat_attributes(self, testdir,... | jaraco/pytest | testing/test_collection.py | Python | mit | 26,378 | 0.000986 |
# Lint as: python3
# 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 ... | tensorflow/lingvo | lingvo/tasks/mt/model_test.py | Python | apache-2.0 | 35,425 | 0.011066 |
# -*- coding: utf-8 -*-
from django.shortcuts import render, redirect
from django.views.generic import View
from django.http import HttpResponse
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import inch
from... | CallmeTorre/Idalia | ESCOM/ConsultarDocumento/views.py | Python | apache-2.0 | 2,955 | 0.012864 |
#! /usr/bin/python
import collections
import sys
import json
DepEntry = collections.namedtuple('DepEntry', 'widget dep enable die hide')
dep_map = (
DepEntry("title", "queue_add", "none", True, False),
DepEntry("title", "queue_add_menu", "none", True, False),
DepEntry("title", "queue_add_multiple_menu", "... | utensil-star/HandBrake | gtk/src/makedeps.py | Python | gpl-2.0 | 5,589 | 0.004831 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import math
import random
import unittest
from measurement_stats import angle
from measurement_stats import value
from measurement_stats import value2D
HALF_SQRT_2 = 0.... | sernst/RefinedStatistics | measurement_stats/test/test_value2D.py | Python | mit | 2,275 | 0.002198 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.capnproto
~~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for the Cap'n Proto schema language.
:copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, default
from... | wakatime/wakatime | wakatime/packages/py27/pygments/lexers/capnproto.py | Python | bsd-3-clause | 2,194 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Cloudbase Solutions Srl
# 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.ap... | ntt-sic/nova | nova/virt/hyperv/vhdutils.py | Python | apache-2.0 | 7,795 | 0.000257 |
"""
Tests for the test server itself.
Not intended to be run by the greater test suite, only by specifically
targeting it on the command-line. Rationale: not really testing Fabric itself,
no need to pollute Fab's own test suite. (Yes, if these tests fail, it's likely
that the Fabric tests using the test server may als... | jaraco/fabric | tests/test_server.py | Python | bsd-2-clause | 2,975 | 0 |
from datetime import datetime
import io
import os
import tempfile
import zipfile
from PIL import Image, ImageFont
from PIL.Image import LANCZOS
from PIL.ImageDraw import Draw
from django.conf import settings
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.fields import GenericForeign... | cmjatai/cmj | cmj/sigad/models.py | Python | gpl-3.0 | 49,449 | 0.000243 |
# -- coding: utf-8 --
# Copyright 2015 Tim Santor
#
# This file is part of proprietary software and use of this file
# is strictly prohibited without written consent.
#
# @author Tim Santor <tsantor@xstudios.agency>
"""Generates HTML for HTML5 banner ads."""
# ------------------------------------------------------... | tsantor/banner-ad-toolkit | adkit/generate_html.py | Python | mit | 5,427 | 0.00129 |
# -*- coding: utf-8 -*-
"""
Discord API Wrapper
~~~~~~~~~~~~~~~~~~~
A basic wrapper for the Discord API.
:copyright: (c) 2015-2016 Rapptz
:license: MIT, see LICENSE for more details.
"""
__title__ = 'discord'
__author__ = 'Rapptz'
__license__ = 'MIT'
__copyright__ = 'Copyright 2015-2016 Rapptz'
__version__ = '0.11... | Aurous/Magic-Discord-Bot | discord/__init__.py | Python | gpl-3.0 | 1,365 | 0.001465 |
# Copyright (c) 2008-2009 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.web.distrib}.
"""
from os.path import abspath
from xml.dom.minidom import parseString
try:
import pwd
except ImportError:
pwd = None
from zope.interface.verify import verifyObject
from twisted.python im... | Donkyhotay/MoonPy | twisted/web/test/test_distrib.py | Python | gpl-3.0 | 9,985 | 0.002203 |
#
# Copyright (c) SAS Institute 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... | fedora-conary/conary | conary/build/defaultrecipes.py | Python | apache-2.0 | 27,584 | 0.000435 |
import random
def markov_analysis( fname, n ):
"""Reads a text file and perfom Markov analysis.
Return a dictionary that maps from prefixes to a collection of suffixes.
fname: a text file
n: n order
"""
d = {}
prefix = tuple()
fin = open( fname )
for line in fin:
words = ... | JohnHwee/show-me-the-code | Python/0052/main.py | Python | gpl-2.0 | 1,327 | 0.024115 |
def migrate_ip(self):
"""
Migrate to the latest schema version.
"""
migrate_1_to_2(self)
migrate_2_to_3(self)
def migrate_2_to_3(self):
"""
Migrate from schema 2 to 3.
"""
if self.schema_version < 2:
migrate_1_to_2(self)
if self.schema_version == 2:
self.schem... | Lambdanaut/crits | crits/ips/migrate.py | Python | mit | 869 | 0.003452 |
async def fun():
"""Note coroutine function must be declared with async def."""
async for a in b:
if a > 5:
break
else:
continue
| pyta-uoft/pyta | examples/ending_locations/async_for.py | Python | gpl-3.0 | 169 | 0 |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 12 09:56:42 2012
@author: truiz
"""
from sys import argv
import xlrd
import xmlrpclib
from datetime import datetime
from ustr_test import ustr
def loadProjectsTasks(fileName, HOST, PORT, DB, USER, PASS):
ISSUES_PAGE = 0
TASKS_PAGE = 1
WORKS_PAGE = 2
'''... | 3dfxsoftware/cbss-addons | issue_load/wizard/migrate.py | Python | gpl-2.0 | 6,250 | 0.00128 |
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gio
UI_PATH = '/io/github/ImEditor/ui/'
class ImEditorHeaderBar():
__gtype_name__ = 'ImEditorHeaderBar'
def __init__(self):
builder = Gtk.Builder.new_from_resource(UI_PATH + 'headerbar.ui')
self.header_bar = builder.get... | ImEditor/ImEditor | src/interface/headerbar.py | Python | gpl-3.0 | 711 | 0.004219 |
# -*- coding: utf-8 -*-
""" standard """
from random import randint
import re
""" custom """
from examples.working_init import *
from threatconnect.Config.ResourceType import ResourceType
#
# CHANGE FOR YOUR TESTING ENVIRONMENT
# - These incidents must be created before running this script
#
owner = 'Example Communi... | percipient/threatconnect-python | examples/commit/incidents_commit.py | Python | apache-2.0 | 8,526 | 0.002698 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.