code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
"""Provide the BaseListingMixin class."""
from urllib.parse import urljoin
from ...base import PRAWBase
from ..generator import ListingGenerator
def _prepare(praw_object, arguments_dict, target):
"""Fix for Redditor methods that use a query param rather than subpath."""
if praw_object.__dict__.get("_listing_... | leviroth/praw | praw/models/listing/mixins/base.py | Python | bsd-2-clause | 4,779 |
NAME='pypy'
LDFLAGS = []
LIBS = []
GCC_LIST = ['pypy_plugin']
BINARY_LIST = [ ('uwsgi_pypy_setup','pypy_setup.py')]
CFLAGS = []
| alex/uwsgi | plugins/pypy/uwsgiplugin.py | Python | gpl-2.0 | 128 |
#!/usr/bin/python
# -*-coding:Utf-8 -*
from rest import *
pinMode(6, OUTPUT)
digitalWrite(6, 0)
| Champitoad/Bi0Cube | modules/tests/capt_o2_on.py | Python | gpl-3.0 | 99 |
from service_manager import ServiceManager
from series_service import SeriesService
from cv_service import CVService
from edit_service import EditService
from record_service import RecordService
from export_service import ExportService
__all__ = [
'EditService',
'CVService',
'SeriesService',
'RecordSer... | UCHIC/h2outility | src/GAMUTRawData/odmservices/__init__.py | Python | bsd-3-clause | 371 |
# 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... | kamcpp/tensorflow | tensorflow/contrib/distributions/python/ops/transformed_distribution.py | Python | apache-2.0 | 10,329 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from flask_multipass import IdentityInfo
from indico.legacy.common.cache import GenericCache
from indico.... | mvidalgarcia/indico | indico/modules/users/legacy.py | Python | mit | 10,195 |
from django.contrib import admin
from .models import Order
class OrderAdmin(admin.ModelAdmin):
pass
admin.site.register(Order, OrderAdmin)
| amyth/django-spin | apps/orders/admin.py | Python | mit | 148 |
# -*- coding: utf-8 -*-
#########################################################################
# #
# Copyright (C) 2012 Factor Libre SL #
# #
... | jaumemarti/l10n-spain-txerpa | __unported__/base_vat_vies/__openerp__.py | Python | agpl-3.0 | 1,814 |
"""
WSGI config for videplo 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... | mQuadrics/videplo | videplo/wsgi.py | Python | mit | 391 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Script de comprobación de entrega de ejercicio
Para ejecutarlo, desde la shell:
$ python check.py login_github
"""
import os
import random
import sys
ejercicio = 'X-Serv-14.5-Sumador-Simple'
student_files = [
'servidor-sumador.py'
]
repo_files = [
'check... | begea/X-Serv-14.5-Sumador-Simple | check.py | Python | gpl-3.0 | 1,680 |
from . import test_redsys
| factorlibre/l10n-spain | payment_redsys/tests/__init__.py | Python | agpl-3.0 | 27 |
'''
@author: Frank
'''
import os
import sys
import traceback
import string
import zstacklib.utils.xmlobject as xmlobject
class TemplateError(Exception):
'''zstack template parser exception'''
class DeployConfig(object):
def __init__(self, deploy_config_path, deploy_tmpt_path = None):
self.deploy_con... | cloudcache/zstack-utility | zstackcli/zstackcli/parse_config.py | Python | apache-2.0 | 5,206 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from pathpicker.screen_flags import ScreenFlags
MANPAGE_HEADER = """= fpp(1)
"""
MANPAGE_NAME_SECTION = """
== NAME
fpp - Facebook PathPicke... | facebook/PathPicker | src/pathpicker/usage_strings.py | Python | mit | 4,776 |
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | lrocheWB/navitia | source/jormungandr/jormungandr/scenarios/tests/qualifier_tests.py | Python | agpl-3.0 | 13,540 |
# Copyright (c) 2011, Found IT A/S and Piped Project Contributors.
# See LICENSE for details.
from twisted.trial import unittest
from twisted.internet import defer
from piped import processing, dependencies
from piped.processors import spread_processors
class FakeRoot(object):
def __init__(self):
self.c... | alexbrasetvik/Piped | piped/processors/test/test_spread_processors.py | Python | mit | 2,258 |
class Trie:
def __init__(self, node):
self.root = node
def add(self, word):
node = self.root
for i in range(len(word)):
if word[i] in node.children:
node = node.children[word[i]]
else:
n_node = TrieNode(word[i])
... | YiqunPeng/Leetcode-pyq | solutions/212WordSearchII.py | Python | gpl-3.0 | 2,030 |
__all__ = [
'AbortHandshake', 'InvalidHandshake', 'InvalidHeader', 'InvalidMessage',
'InvalidOrigin', 'InvalidState', 'InvalidStatusCode', 'NegotiationError',
'InvalidParameterName', 'InvalidParameterValue', 'DuplicateParameter',
'InvalidURI', 'ConnectionClosed', 'PayloadTooBig',
'WebSocketProtocolE... | technologiescollege/Blockly-rduino-communication | scripts_XP/Lib/site-packages/websockets/exceptions.py | Python | gpl-3.0 | 4,625 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import csv, sys, codecs
from pysqlite2 import dbapi2 as sqlite3
import cStringIO
class UTF8Recoder:
"""
Iterator that reads an encoded stream and reencodes the input to UTF-8
"""
def __init__(self, f, encoding):
self.reader = codecs.getreader(encoding)(f)
def __ite... | Akeru/tagainijisho | src/core/jmdict/extractjlptlevels3.py | Python | gpl-3.0 | 3,750 |
#!/usr/bin/python
import math
import sys
from laser.laser import Rectangle, Polygon, Circle, Arc, Collection, Config
from laser.laser import Text, degrees
from laser.render import DXF as dxf
#
#
thick = 3
#
#
def make_lens(draw):
h = 100
r = 100
t = 2
work = Collection()
c = Polygon()
c.ad... | DaveBerkeley/lasercut | lens.py | Python | gpl-2.0 | 1,513 |
#--------------------------------------------------------------------------
# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas
# Copyright: (C) 2001 Centro de Pesquisas Renato Archer
# Homepage: http://www.softwarepublico.gov.br
# Contact: invesalius@cti.gov.br
# License: GNU ... | fabio-otsuka/invesalius3 | invesalius/gui/task_tools.py | Python | gpl-2.0 | 5,584 |
READ_DOCSTRING = """
Read the input ``table`` and return the table. Most of
the default behavior for various parameters is determined by the Reader
class.
See also:
- https://docs.astropy.org/en/stable/io/ascii/
- https://docs.astropy.org/en/stable/io/ascii/read.html
Parameters
-----... | larrybradley/astropy | astropy/io/ascii/docs.py | Python | bsd-3-clause | 7,417 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-08-02 13:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fitter', '0001_initial'),
]
operations = [
migrations.AddField(
... | odedrim/kfits | afgui/fitter/migrations/0002_kfitssession_kinetic_params.py | Python | gpl-3.0 | 447 |
from __future__ import unicode_literals, division, absolute_import
import copy
import logging
import hashlib
from datetime import datetime, timedelta
from sqlalchemy import Column, Integer, String, DateTime, PickleType, Unicode, ForeignKey
from sqlalchemy.orm import relation
from flexget import db_schema
from flexget... | ratoaq2/Flexget | flexget/utils/cached_input.py | Python | mit | 7,780 |
#!/usr/bin/python
import unittest
import json
import sys
import os
import string
sys.path.append(os.path.join(os.path.dirname(__file__),
os.pardir,
os.pardir))
from nysa.cbuilder import sdb_component as sdbc
from nysa.cbuilder import sdb_object_model as som
... | CospanDesign/nysa | test/unit/test_som_rom_parser.py | Python | mit | 19,288 |
import imp
import os
import sys
base_dir = os.path.dirname(__file__) or '.'
print('Base directory:', base_dir)
# Insert the package_dir_a directory at the front of the path.
package_dir_a = os.path.join(base_dir, 'package_dir_a')
sys.path.insert(0, package_dir_a)
# Import the example module
import example
print('Imp... | jasonwee/asus-rt-n14uhp-mrtg | src/lesson_runtime_features/sys_path_modify.py | Python | apache-2.0 | 679 |
#!/usr/bin/env python
# encoding: utf-8
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import input
import logging
import signal
import sys
from SimpleWebSocketServer import WebSocket, SimpleWebSocketServer
def get_args():
parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter... | geekspark-rh/dimo-2015-server | server.py | Python | gpl-2.0 | 1,496 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
import pytest
from indico.web.flask.util import endpoint_for_url... | mic4ael/indico | indico/web/flask/util_test.py | Python | mit | 1,064 |
''' Check for certain dependencies
.. Created on Mar 20, 2014
.. codeauthor:: Robert Langlois <rl2528@columbia.edu>
'''
from distutils.core import Command
from distutils import log
import sys
class check_dep(Command):
''' Check if the dependencies listed in `install_requires` and `extras_require`
are currentl... | ezralanglois/arachnid | arachnid/distutils/check_dep.py | Python | gpl-2.0 | 1,595 |
# 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
# d... | celebdor/kuryr | kuryr/lib/config.py | Python | apache-2.0 | 2,741 |
#~*~ coding: utf-8 ~*~
from django.contrib import admin
from django.forms import CheckboxSelectMultiple
from django import forms
from django.conf import settings
from virtenviro.content.models import *
class TemplateAdmin(admin.ModelAdmin):
search_fields = ['title', 'filename']
class ContentAdminForm(forms.Mode... | Haikson/virtenviro | virtenviro/content/admin.py | Python | apache-2.0 | 5,341 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# 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 the above copyright notice, this
# ... | vlegoff/tsunami | src/secondaires/auberge/commandes/auberge/editer.py | Python | bsd-3-clause | 2,784 |
"""Copyright 2008 Orbitz WorldWide
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... | moira-alert/worker | moira/graphite/datalib.py | Python | gpl-3.0 | 5,815 |
# 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 applicable ... | eadgarchen/tensorflow | tensorflow/contrib/training/python/training/evaluation.py | Python | apache-2.0 | 18,000 |
from six.moves import cStringIO as StringIO
from mitmproxy import filt
from mitmproxy.models import Error
from mitmproxy.models import http
from netlib.http import Headers
from . import tutils
class TestParsing:
def _dump(self, x):
c = StringIO()
x.dump(fp=c)
assert c.getvalue()
def ... | fimad/mitmproxy | test/mitmproxy/test_filt.py | Python | mit | 7,220 |
# coding: utf-8
import unittest
import os
from sqlalchemy.engine.reflection import Inspector
from niamoto.testing import set_test_path
set_test_path()
from niamoto.conf import settings, NIAMOTO_HOME
from niamoto.testing.test_database_manager import TestDatabaseManager
from niamoto.testing.base_tests import BaseTes... | dimitri-justeau/niamoto-core | tests/data_marts/test_dimensional_model.py | Python | gpl-3.0 | 6,621 |
import gtk
import pango
class TabLabel:
"""Tab label wrapper class"""
def __init__(self, application, parent):
self._container = gtk.EventBox()
self._application = application
self._parent = parent
# initialize tab events
self._container.add_events(gtk.gdk.BUTTON_RELEASE_MASK)
self._container.conne... | Azulinho/sunflower-file-manager-with-tmsu-tagging-support | application/widgets/tab_label.py | Python | gpl-3.0 | 4,147 |
# 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 agreed to in writing, ... | google-research/plur | plur/stage_1/code2seq_dataset.py | Python | apache-2.0 | 16,900 |
from setuptools import setup
setup(
name = "slowaes",
version = "0.1a1",
license = "Apache License, Version 2.0",
py_modules=['aes'],
url = "http://code.google.com/p/slowaes/",
author = "Josh Davis, Alex Martelli",
description = "implementation of AES in Python",
)
| davedoesdev/simple-crypt | slowaes/trunk/python/setup.py | Python | mit | 295 |
#!/usr/bin/env python
# encoding: utf-8
from . import routes, views, model, oldels
MODELS = [
oldels.OsfStorageFileTree,
oldels.OsfStorageFileRecord,
model.OsfStorageFileNode,
model.OsfStorageGuidFile,
model.OsfStorageFileVersion,
model.OsfStorageNodeSettings,
model.OsfStorageTrashedFileNo... | jmcarp/osf.io | website/addons/osfstorage/__init__.py | Python | apache-2.0 | 954 |
#Calculating the factorial
#imports
#Function delcerations
def inputs():
number = raw_input("Enter the number you wish to find the factorial of ")
return number
def factorial(num1):
n = [""]
for x in range (1, int(num1) + 1):
n.append(x)
fact = n[1]
for counter in range (1, int(num1) + 1):
fact = fact * ... | Cgboal/Stuff | Python/Calculator thing/factorial.py | Python | mit | 398 |
# pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
# Smartsheet Python SDK.
#
# Copyright 2018 Smartsheet.com, 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.... | smartsheet-platform/smartsheet-python-sdk | smartsheet/models/copy_or_move_row_destination.py | Python | apache-2.0 | 1,531 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-04 22:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('domain_api', '0009_remove_topleveldomain_slug'),
]
operations = [
migration... | heytrav/drs-project | domain_api/migrations/0010_topleveldomain_slug.py | Python | mit | 478 |
"""
Django settings for example_project project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
i... | urda/django-letsencrypt | example_project/example_project/settings.py | Python | apache-2.0 | 3,190 |
from grid.cell import Cell
from grid.vertex import Vertex
from grid.triangle import Triangle
import numpy
import matplotlib.pyplot as plt
class Mesh(object):
'''
Description: (Quad) Mesh object
Attributes:
bounding_box: [xmin, xmax, ymin, ymax]
children: Cell, list of cel... | hvanwyk/drifter | src/grid/mesh.py | Python | mit | 15,658 |
#coding:utf-8
import sys,os
with open(sys.path[0]+'/pid','r') as f:
pid_list = f.read().split('|')
for pid in pid_list:
if pid:
os.system('kill '+pid)
print('stop process '+pid+' ok')
else:
print('nothing to stop')
with open(sys.path[0]+'/pid','w') as f:
f.truncate()
| chenyanclyz/http_proxy | bin/stop.py | Python | gpl-2.0 | 311 |
import numpy as np
def assert_array_shape(a, ndim=None, shape=None, dims={}):
if not type(a) is np.ndarray:
raise TypeError("Provided object type (%s) is not nunpy.array." % str(type(a)))
if ndim is not None:
if not a.ndim == ndim:
raise ValueError("Provided array dimensions (... | karlnapf/kernel_exp_family | kernel_exp_family/tools/assertions.py | Python | bsd-3-clause | 1,107 |
import time
import xbmc
from resources.lib.service_entry import Service
if __name__ == '__main__':
monitor = xbmc.Monitor()
service = Service()
while not monitor.abortRequested():
# Sleep/wait for abort for 10 seconds
if monitor.waitForAbort(10):
# Abort was requested while ... | sebastian-steinmann/kodi-repo | plugins/service.library.video/service.library.video/service.py | Python | mit | 466 |
# 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... | sarvex/tensorflow | tensorflow/examples/speech_commands/accuracy_utils.py | Python | apache-2.0 | 6,159 |
import numpy
import logging
import sys
import os
import multiprocessing
from sandbox.recommendation.MaxLocalAUC import MaxLocalAUC
from sandbox.util.PathDefaults import PathDefaults
from sandbox.util.Sampling import Sampling
from wallhack.rankingexp.DatasetUtils import DatasetUtils
"""
Test the Rademacher bound on a ... | charanpald/wallhack | wallhack/rankingexp/RademacherExp.py | Python | gpl-3.0 | 4,465 |
# o programa calcula quantos dígitos há em 1 milhão
print("O programa calcula o total de dígitos de 2 elevado a 1000000")
potencia = str(2 ** 1000000)
total_de_digitos = len(potencia)
print("O total de dígitos de 2 elevado a 1000000 são: %d" % total_de_digitos)
| luis-fonseca/python_para_zumbis | lista_1/questao11.py | Python | gpl-3.0 | 271 |
# coding=utf-8
from __future__ import nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals
import os, tempfile
from uuid import uuid4
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import abcv.tunebook as tunebook
from abcv.abc_di... | JasonFruit/abcviewer | abcv/tune_editor.py | Python | mit | 3,863 |
"""Code not usually available to C libnl user applications but used by libnl itself."""
| Robpol86/libnl | libnl/netlink_private/__init__.py | Python | lgpl-2.1 | 88 |
# Copyright (c) 2015-2019, Activision Publishing, Inc.
# 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 ... | ActivisionGameScience/assertpy | tests/test_fail.py | Python | bsd-3-clause | 1,948 |
import os.path
from tornado.testing import AsyncHTTPTestCase
from tornado.ioloop import IOLoop
from thumbor.app import ThumborServiceApp
from thumbor.importer import Importer
from thumbor.config import Config
from thumbor.context import Context, ServerParameters
from thumbor.integration_tests.urls_helpers import sing... | abaldwin1/thumbor | thumbor/integration_tests/__init__.py | Python | mit | 2,000 |
# from django.contrib.auth import logout, login, authenticate
# from django.contrib.auth.models import User
# from django.contrib.auth.decorators import login_required
# from django.shortcuts import render
# from Bugz.views.login_view import LoginViewSet
# from django.views.decorators.csrf import csrf_exempt
# from res... | jessica-younker/I-Got-Bugs | api/Bugz/views/news_view.py | Python | apache-2.0 | 791 |
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
#
# 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, m... | WxOutside/software | telemetry/sensors/weatherPiArduino/Adafruit_Python_GPIO/Adafruit_GPIO/FT232H.py | Python | unlicense | 33,008 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pipes import quote
from bundlewrap.exceptions import BundleError
from bundlewrap.items import Item
from bundlewrap.utils.text import mark_for_translation as _
def svc_start(node, svcname):
return node.run("systemctl start -- {}".format(quote(s... | timbuchwaldt/bundlewrap | bundlewrap/items/svc_systemd.py | Python | gpl-3.0 | 3,133 |
#!/usr/bin/env python3
# Copyright (c) 2018-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test createwallet watchonly arguments.
"""
from test_framework.blocktools import COINBASE_MATURITY
fro... | domob1812/bitcoin | test/functional/wallet_watchonly.py | Python | mit | 4,784 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'PlayerLocation.point'
db.alter_column('udj_playerlocation', 'point', self.gf('django.cont... | klnusbaum/UDJ-Server | udjserver/udj/migrations/0015_auto__chg_field_playerlocation_point.py | Python | gpl-2.0 | 9,809 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import tensorflow as tf
from niftynet.layer.base_layer import Layer
from niftynet.layer.layer_util import infer_spatial_rank
class SpatialGradientLayer(Layer):
"""
Computing image spatial gradients.
"""
def __init__(self... | NifTK/NiftyNet | niftynet/layer/spatial_gradient.py | Python | apache-2.0 | 2,571 |
import interface
class DispatcherBase(interface.IDispatcher):
def __init__(self):
interface.IDispatcher.__init__(self)
self._param = {}
self._job = []
def getparam(self):
return self._param
def setvalue(self, key, value):
self._param[key] = value
def getvalue... | plinecom/JobManager | dispatcher/abstract.py | Python | mit | 425 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013-2021 Pytroll developers
#
# Author(s):
#
# Adam.Dybbroe <adam.dybbroe@smhi.se>
#
# 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 Founda... | pytroll/pyspectral | pyspectral/tests/test_reflectance.py | Python | gpl-3.0 | 11,180 |
'''
Created on 2013-3-27
pysa - reverse a complete computer setup
Copyright (C) 2013 MadeiraCloud Ltd.
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 Li... | VisualOps/pysa | pysa/scanner/actions/base.py | Python | gpl-3.0 | 7,996 |
# -*- coding: utf-8 -*-
"""Get the pollen count for a UK postcode."""
import dave.module
from bs4 import BeautifulSoup
from requests import get
from twisted.words.protocols.irc import assembleFormattedText, attributes as A
import dave.config
@dave.module.help("Syntax: pollen [first part of postcode]. Get the forecast... | w4/belle | dave/modules/pollen.py | Python | gpl-3.0 | 1,618 |
#!/usr/bin/env python
# trapezoid2.py
import numpy
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank(); size = comm.Get_size()
N = 8; a = 0; b = 1; h = (b - a)/N
def f(x):
return x*x
local_N = N / size
local_a = a + rank * local_N * h
partial_result = numpy.zeros(1)
sum = numpy.zeros(1)
for i in ran... | linhbngo/cpsc-4770_6770 | codes/mpi4py/trapezoid2.py | Python | gpl-3.0 | 604 |
#
# 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... | sassoftware/rmake3 | rmake/messagebus/config.py | Python | apache-2.0 | 2,287 |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico 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... | Ictp/indico | indico/MaKaC/plugins/RoomBooking/default/roomblocking.py | Python | gpl-3.0 | 15,951 |
'''MobileNetV2 in PyTorch.
See the paper "Inverted Residuals and Linear Bottlenecks:
Mobile Networks for Classification, Detection and Segmentation" for more details.
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class Block(nn.Module):
'''expand + depthwise + pointwise'''
def __init... | kuangliu/pytorch-cifar | models/mobilenetv2.py | Python | mit | 3,092 |
import os
"""An implementation of the slide "presentation" software used by
dbeazley in the video from the PyOhio talk found here:
https://youtu.be/j6VSAsKAj98
Great talk, by the way. Go see it!
Usage is:
>>> from slides import Slide
>>> a_text = '''# A Header
...
... Some text with **ordinary** markup _inside_
...... | manniche/ohioslides | slides.py | Python | mit | 3,623 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013 Contributor
#
# 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... | jrha/aquilon | lib/python2.6/aquilon/aqdb/model/observed_mac.py | Python | apache-2.0 | 2,216 |
from textwrap import dedent
import py, pytest
from _pytest.config import PytestPluginManager
from _pytest.main import EXIT_NOTESTSCOLLECTED, EXIT_USAGEERROR
@pytest.fixture(scope="module", params=["global", "inpackage"])
def basedir(request, tmpdir_factory):
from _pytest.tmpdir import tmpdir
tmpdir = tmpdir(r... | mhils/pytest | testing/test_conftest.py | Python | mit | 13,814 |
"""
Simple Uploader Class, handles node, base, virgin uploads
"""
### INCLUDES ###
import os
import logging
from distutils.version import StrictVersion
from gate import strings
from gate.conversions import find_version
from .snap_uploader import SnapUploader, SUCCESS, CANCEL
### CONSTANTS ###
FORCE_NODE_UPLOAD = ... | Barmaley13/BA-Software | gate/sleepy_mesh/uploader/simple_uploader.py | Python | gpl-3.0 | 8,430 |
"""
Local Settings
"""
from .development import *
SECRET_KEY = 'Ev4Ma#*qQtuJj7j6!%JMxXxZEbeuQzTxG(lW!!n#Z5vx2wtbXD'
| ba1dr/tplgenerator | templates/django/__APPNAME__/settings/local.py | Python | mit | 118 |
# Copyright (C) 2018 Collin Capano
# 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
# self.option) any later version.
#
# This program is distributed ... | cmbiwer/pycbc | pycbc/inference/io/base_multitemper.py | Python | gpl-3.0 | 10,381 |
import test_factories
import pyfactory
import crits.models as models
from crits.utils import clear_cache
from django.test import TestCase
class RecommendationTest(TestCase):
def setUp(self):
clear_cache()
self.users = map(
lambda a: pyfactory.Factory.create('user'),
xrange(... | mop/twit-miner | twit_miner/crits/tests/test_recommendation.py | Python | mit | 1,687 |
# Copyright (C) 2012-2013 Red Hat, 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 la... | zhimin711/nova | nova/virt/libvirt/blockinfo.py | Python | apache-2.0 | 22,399 |
# Copyright 2015-2016, Google Inc.
# 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 the above copyright
# notice, this list of conditions and ... | tamihiro/grpc | tools/run_tests/report_utils.py | Python | bsd-3-clause | 4,910 |
# -*- coding: utf-8 -*-
#
# Copyright 2012 Zhang ZY<http://idupx.blogspot.com/>
#
# 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 ... | bufferx/twork | twork/options.py | Python | apache-2.0 | 1,399 |
####################
# Author: Nathan Mador-House
####################
#######################
# Index:
# 1. Imports and Readme
# 2. Functions
# 3. Main
# 4. Testing
#######################
###################################################################
# 1. IMPORTS AND README
####################################... | NathanMH/scripts | bc_bounty_check.py | Python | mit | 3,423 |
# -*- coding: utf-8 -*-
"""
flask.ext.security.forms
~~~~~~~~~~~~~~~~~~~~~~~~
Flask-Security forms module
:copyright: (c) 2012 by Matt Wright.
:license: MIT, see LICENSE for more details.
"""
import inspect
import urlparse
import flask_wtf as wtf
from flask import request, current_app
from flas... | alexsalo/genenetwork2 | wqflask/flask_security/forms.py | Python | agpl-3.0 | 8,871 |
#
# Python LiveReload documentation build configuration file, created by
# sphinx-quickstart on Sat May 5 18:36:44 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration... | lepture/python-livereload | docs/conf.py | Python | bsd-3-clause | 8,217 |
from paradrop.lib.utils import addresses
from mock import MagicMock
def test_addresses():
ch = MagicMock()
ch.getCache.return_value = [{'type': 'test'}]
assert addresses.getGatewayIntf(ch) == (None, None)
assert addresses.getWANIntf(ch) == None
| ParadropLabs/Paradrop | tests/paradrop/lib/utils/test_addresses.py | Python | apache-2.0 | 262 |
# -*- coding: utf-8 -*-
# © <YEAR(S)> ClearCorp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Exchange Rate Calculated',
'summary': 'It will compute the amount currency to set credit or debit',
'version': '9.0.1.0',
'category': 'Accounting & Finance',
'website': 'ht... | ClearCorp/odoo-clearcorp | exchange_rate_calculated/__openerp__.py | Python | agpl-3.0 | 678 |
#def f(num):
# num.append(2)
#
#num =[1]
#print num
#f(num)
#print num
print " What is your name?"
name = raw_input("")
print "welcome %s" % name
| ajayaa/python-akhada | test.py | Python | mit | 149 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Unix SMB/CIFS implementation.
# Copyright (C) Kamen Mazdrashki <kamenim@samba.org> 2011
# Copyright (C) Andrew Bartlett <abartlet@samba.org> 2016
# Copyright (C) Catalyst IT Ltd. 2016
#
# This program is free software; you can redistribute it and/or modify
# it under t... | kernevil/samba | source4/torture/drs/python/drs_base.py | Python | gpl-3.0 | 24,898 |
#!/home/mlawson/miniconda3/bin/python
import os
import numpy as np
class OpenFOAMInput(object):
'''OpenFOAM input data object
'''
def __init__(self,input_file):
self.data = {}
self.file = os.path.abspath(input_file)
self._read()
def _read(self):
'''
Note that ... | lawsonro3/python-scripts | python_scripts/openfoam/read_input_files/read.py | Python | apache-2.0 | 1,637 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | xzturn/tensorflow | tensorflow/python/ops/control_flow_ops.py | Python | apache-2.0 | 138,665 |
# This file is part of DmpBbo, a set of libraries and programs for the
# black-box optimization of dynamical movement primitives.
# Copyright (C) 2014 Freek Stulp, ENSTA-ParisTech
#
# DmpBbo is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publis... | stulp/dmpbbo | demos_cpp/dynamicalsystems/demoExponentialSystemWrapper.py | Python | lgpl-2.1 | 2,205 |
# Copyright 2021 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, fields, models
class HrEmployee(models.Model):
_inherit = "hr.employee"
equipment_request_ids = fields.One2many(
comodel_name="hr.personal.equipment.request",
inverse_name="emplo... | OCA/hr | hr_personal_equipment_request/models/hr_employee.py | Python | agpl-3.0 | 1,781 |
from sarpaminfohub.infohub.tests.sarpam_test_case import SarpamTestCase
from sarpaminfohub.infohub.sarpam_table import SarpamTable
class SarpamTableTest(SarpamTestCase):
def test_rounds_to_three_decimal_places(self):
table = SarpamTable(None)
test_data = [0.12346]
first_column = 0
ta... | aptivate/sarpaminfohub | django/sarpaminfohub/infohub/tests/sarpam_table_tests.py | Python | gpl-3.0 | 755 |
import bluetooth
target_name = "M-Bwoi"
target_address = None
nearby_devices = bluetooth.discover_devices()
for bdaddr in nearby_devices:
if target_name == bluetooth.lookup_name( bdaddr ):
target_address = bdaddr
break
if target_address is not None:
print "found target bluetooth device with ... | CallanIwan/Aranha | prototypes/bluetooth/bluetooth_test_connection.py | Python | gpl-2.0 | 410 |
"""
==========================================================
Comparison of kernel ridge and Gaussian process regression
==========================================================
Both kernel ridge regression (KRR) and Gaussian process regression (GPR) learn
a target function by employing internally the "kernel trick... | glemaitre/scikit-learn | examples/gaussian_process/plot_compare_gpr_krr.py | Python | bsd-3-clause | 5,199 |
from ahh import vis, ext, sci
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import datetime
from scipy.stats import pearsonr
sleep_df = pd.read_pickle('sleep_data_fmt.pkl')
sleep_hours = sleep_df['minutes'] / 60
sleep_quality = sleep_df['quality'] * ... | ahuang11/ahh | sketches/my_sleep/my_sleep.py | Python | mit | 8,823 |
"""
Tests for locust api module
These tests requires locust installed
"""
#pylint: disable=W0403,C0103,too-many-public-methods
import unittest
from subprocess import call
from netifaces import interfaces
from locust.api import Agent
from time import time, sleep
STATUSES = {'success': 'success',
'error': ... | arozumenko/locust | tests/locust/tests_enable_network_adapters.py | Python | apache-2.0 | 8,175 |
# vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | grehx/spark-tk | regression-tests/sparktkregtests/testcases/models/linear_regression_test.py | Python | apache-2.0 | 5,967 |
#!/usr/bin/env python3
import unittest
import logging
from dipper.sources.Coriell import Coriell
from tests.test_source import SourceTestCase
logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger(__name__)
class CoriellTestCase(SourceTestCase):
def setUp(self):
self.source = Coriell('rdf... | TomConlin/dipper | tests/test_coriell.py | Python | bsd-3-clause | 698 |
"""Binary sensor for Shelly."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_GAS,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_OPENING,
DEVICE_CLASS_POWER,
DEVICE_CLASS_PROBLEM,
DEVICE_CLASS_SMOKE,
DEVICE_CLASS_VIBRATION,
... | partofthething/home-assistant | homeassistant/components/shelly/binary_sensor.py | Python | apache-2.0 | 4,935 |
#!/usr/bin/python
#*-* coding: utf-8 *-*
from Bio import SeqIO
files_chr = open("lista.txt").readlines() #cargar lista ficheros fasta
file_hap = SeqIO.parse(open("hap_output.fas"), "fasta") #cargar fichero haplotipos
count_dict = {}
count_table = {}
header = ""
#i = 0
#crear diccionarios con los haplotipos
for se... | fjruizruano/amplicon-pyroseq | 05haplotyper.py | Python | gpl-3.0 | 2,206 |
from __future__ import unicode_literals
import re
from setuptools import find_packages, setup
def get_version(filename):
content = open(filename).read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", content))
return metadata['version']
setup(
name='Mopidy-Bassdrive',
version=get_versio... | felixb/mopidy-bassdrive | setup.py | Python | apache-2.0 | 1,422 |
# Generated by Django 2.2.dev20181026000358 on 2018-10-27 09:42
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0040_page_draft_title'),
]
operations = [
migrations.AlterModelOptions(
name='groupcollectionpermission',... | zerolab/wagtail | wagtail/core/migrations/0041_group_collection_permissions_verbose_name_plural.py | Python | bsd-3-clause | 462 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.