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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
from distutils.core import setup
from os.path import dirname, join
from codecs import open
setup(name='hashids',
version='1.1.0',
description='Python implementation of hashids (http://www.hashids.org).'
'Compatible with python 2.6-3.',
long_description=open(joi... | pombredanne/hashids-python | setup.py | Python | mit | 576 |
# This file is part of 'NTLM Authorization Proxy Server'
# Copyright 2001 Dmitry A. Rozmanov <dima@xenon.spb.ru>
#
# NTLM APS is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the Licens... | Vaysman/ntlmaps | ntlmaps/config_affairs.py | Python | gpl-2.0 | 5,763 |
from django.apps import AppConfig
class GeocodingConfig(AppConfig):
name = 'geode-geocoding'
| Geode/Geocoding | geode_geocoding/apps.py | Python | agpl-3.0 | 99 |
#
# 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... | nathanielvarona/airflow | airflow/providers/qubole/hooks/qubole_check.py | Python | apache-2.0 | 4,061 |
#!/usr/bin/python
import requests
import json
import string, random
import base64, hashlib, os
from http.server import BaseHTTPRequestHandler,HTTPServer
from datetime import datetime, timezone, timedelta
from pymongo import MongoClient
import pymysql
VERSION = "1.0-alpha3"
PORT_NUMBER = 8080
'''
ToDo:
- gestione e... | paolostivanin/soasec-proj | utility/unused/web_server.py | Python | mit | 3,216 |
from zipfile import ZipFile
from cStringIO import StringIO
from string import punctuation
from django.template import Context
from django.template.loader import get_template
from _base import BaseExporter
from _csv import CSVExporter
class RExporter(BaseExporter):
short_name = 'R'
long_name = 'R Programming L... | murphyke/avocado | avocado/export/_r.py | Python | bsd-2-clause | 3,135 |
# Basic setup.py structure from:
# http://stackoverflow.com/questions/16981921/relative-imports-in-python-3
from setuptools import setup, find_packages
setup(name='tmd', packages=find_packages(),
install_requires=[
'numpy',
'matplotlib',
'ase',
'pyyaml',
... | tflovorn/tmd | setup.py | Python | mit | 357 |
from rest_framework import serializers
class SentenceSerializer(serializers.Serializer):
words = serializers.CharField() | lahdo/sentence-suggester | back-end/suggestions/serializers.py | Python | mit | 125 |
from gusto import *
from gusto import thermodynamics
from firedrake import (PeriodicIntervalMesh, ExtrudedMesh,
SpatialCoordinate, conditional, cos, pi, sqrt, NonlinearVariationalProblem,
NonlinearVariationalSolver, TestFunction, dx, TrialFunction, Constant, Function,
... | firedrakeproject/gusto | examples/moist_bf_bubble.py | Python | mit | 7,797 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Windows specific tests."""
import errno
import glob
import os
import platform
import signal
import subpro... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/psutil/tests/test_windows.py | Python | gpl-3.0 | 25,170 |
import os
from cwrap import BaseCClass
from res import ResPrototype
from res.job_queue import ErtScript, FunctionErtScript, ErtPlugin, ExternalErtScript
from res.config import ContentTypeEnum
class WorkflowJob(BaseCClass):
TYPE_NAME = "workflow_job"
_alloc = ResPrototype("void* workflow_job_all... | Statoil/libres | python/res/job_queue/workflow_job.py | Python | gpl-3.0 | 7,293 |
from decimal import Decimal
from sys import float_info
from unittest import TestCase
from django.utils.numberformat import format as nformat
class TestNumberFormat(TestCase):
def test_format_number(self):
self.assertEqual(nformat(1234, '.'), '1234')
self.assertEqual(nformat(1234.2, '.'), '1234.2... | mitya57/django | tests/utils_tests/test_numberformat.py | Python | bsd-3-clause | 3,750 |
#!/usr/bin/env python
import sys
import math
"""
--config---
"""
SP="/" #INPUT separator
OSP=" " #OUTPUT separator
def n2m(n):
p=int(n)
if p > 32:
sys.exit("Error: Wrong input...")
r=[]
f=[255,255,255,255]
z=[0,0,0,0]
r=f[:p/8]+[(255>>(p%8))^255]
r+=z[len(r):]
return "%d.%d.%d.%... | dkluffy/dkluff-code | code/maskconvert.py | Python | apache-2.0 | 1,229 |
# -*- coding: utf-8 -*-
"""
Some string utilities.
Created on Fri Apr 27 08:06:06 2018
@author: Fabio Kasper
"""
N_CHARS = 80
def _assert_is_list(items):
assert isinstance(items, list), _reason('Must be a list', items)
def _assert_is_list_of_strings(items):
_assert_is_list(items)
assert len(items) =... | frkasper/MacroUtils | tests/common/strings.py | Python | bsd-3-clause | 1,136 |
# coding: utf-8
import json
import functools
import tornado.web
from tornado.log import app_log
from tornado.util import import_object
from .base import Base
from tt.model.user import User
def load_model(func):
"""注入一个Model参数给函数."""
@functools.wraps(func)
def wrapper(self, *args, **kwargs):
... | yunlzheng/tomatodo | tt/handle/backbone.py | Python | mit | 3,975 |
# pylint: disable=too-few-public-methods,import-error, no-absolute-import
"""check use of super"""
from unknown import Missing
class Aaaa: # <3.0:[old-style-class]
"""old style"""
def hop(self): # <3.0:[super-on-old-class]
"""hop"""
super(Aaaa, self).hop()
def __init__(self): # <3.0:[s... | Titulacion-Sistemas/PythonTitulacion-EV | Lib/site-packages/pylint/test/functional/super_checks.py | Python | mit | 1,232 |
def render_page_home(request):
"""
рендер старовой/главной страницы
"""
return render(request, 'pages/index.html', {}) | glad-web-developer/zab_sno | src/core/views.py | Python | apache-2.0 | 164 |
# Code to configure miscellaneous chips
#
# Copyright (C) 2017-2021 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
PIN_MIN_TIME = 0.100
RESEND_HOST_TIME = 0.300 + PIN_MIN_TIME
MAX_SCHEDULE_TIME = 5.0
class PrinterOutputPin:
def __init__(self, config... | KevinOConnor/klipper | klippy/extras/output_pin.py | Python | gpl-3.0 | 4,906 |
from .import test_system
from xmodule.modulestore import Location
from xmodule.modulestore.xml import ImportSystem, XMLModuleStore
from xmodule.tests.test_export import DATA_DIR
OPEN_ENDED_GRADING_INTERFACE = {
'url': 'blah/',
'username': 'incorrect',
'password': 'incorrect',
'staff_grading': 'staff_gr... | elimence/edx-platform | common/lib/xmodule/xmodule/tests/test_util_open_ended.py | Python | agpl-3.0 | 1,811 |
###############################################################################
#
# Copyright 2010 Locomatix, 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.... | locomatix/locomatix-python | locomatix/lql/query.py | Python | apache-2.0 | 2,642 |
#!/usr/bin/env python
# Copyright 2015 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 argparse
import json
import os
import subprocess
import sys
import urllib2
from utils import commit
from utils import system
imp... | mxia/engine | sky/tools/roll/roll.py | Python | bsd-3-clause | 5,022 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-26 23:00
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration... | crowdresearch/daemo | mturk/migrations/0001_initial.py | Python | mit | 8,322 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Nova Billing
# Copyright (C) 2010-2012 Grid Dynamics Consulting Services, Inc
# All Rights Reserved
#
# 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 Fo... | altai/nova-billing | nova_billing/populate.py | Python | lgpl-2.1 | 8,244 |
# -*- coding: utf-8 -*-
from neo.io.basefromrawio import BaseFromRaw
from neo.rawio.rawmcsrawio import RawMCSRawIO
class RawMCSIO(RawMCSRawIO, BaseFromRaw):
_prefered_signal_group_mode = 'group-by-same-units'
def __init__(self, filename):
RawMCSRawIO.__init__(self, filename=filename)
BaseFro... | rgerkin/python-neo | neo/io/rawmcsio.py | Python | bsd-3-clause | 350 |
#
# Remote ssh cmds
#
import pty, re, os, sys, stat, getpass
class SSHError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class SSH:
def __init__(self, ip, passwd, user, port):
self.ip = ip
self.passwd = passwd
... | Aelshafei/a2lr | ssh.py | Python | apache-2.0 | 3,327 |
# -*- coding: utf-8 -*-
# This file is part of wger Workout Manager.
#
# wger Workout Manager 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 License, or
# (at your option) any ... | rolandgeider/wger | wger/core/views/misc.py | Python | agpl-3.0 | 7,169 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
def function():
return "pineapple"
def function2():
return "tractor"
class Class(object):
def method(self):
return "parrot"
class AboutMethodBindings(Koan):
def test_methods_are_bound_to_an_object(self):
obj... | Krakn/learning | src/python/python_koans/python2/about_method_bindings.py | Python | isc | 2,892 |
from . import windows
from . import fast
from .fast import cmdct, icmdct, mclt, imclt, mdct, imdct, mdst, imdst
""" Module for calculating lapped MDCT
.. note::
This module exposes all needed transforms.
"""
__all__ = [
'mdct', 'imdct',
'mdst', 'imdst',
'cmdct', 'icmdct',
'mclt', 'imclt',
]
| audiolabs/mdct | mdct/__init__.py | Python | mit | 316 |
#!/usr/bin/env python
from time import sleep
class ButtonListener():
"""
Service that polls the button status device and calls a
callback funtion for each button pressed.
Callback function should return a boolean to show whether
or not the listening should continue.
"""
def __init__(se... | kd0kfo/pi_lcd_controller | python/picontroller/button_listener.py | Python | gpl-3.0 | 1,373 |
# Copyright: (c) 2012 Justin Patrin <papercrane@reversefold.com>
import errno
import greenlet
import inspect
import logging
import select
__socket__ = __import__('socket')
from jevent import ioloop
log = logging.getLogger(__name__)
from errno import EINVAL, EWOULDBLOCK, EINPROGRESS, EALREADY, EAGAIN, EISCONN
from p... | reversefold/jevent | jevent/socket.py | Python | mit | 4,631 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import HTMLParser
import smtplib
from frappe import msgprint, throw, _
from frappe.email.smtp import SMTPServer, get_outgoing_email_account
from frappe.email.email_b... | indictranstech/omnitech-frappe | frappe/email/bulk.py | Python | mit | 9,318 |
#! /usr/bin/env python
import ctypes
from ctypes.util import find_library
__author__ = 'Suresh Sundriyal'
__license__ = 'CC0 - No rights reserved.'
__version__ = '0.0.1'
__credits__ = [ 'Joongi Kim: https://gist.github.com/achimnol/3021995',
'sqlite3.org: http://www.sqlite.org/backup.html' ]
SQLITE_O... | sureshsundriyal/pysqlitebkup | pysqlitebkup.py | Python | cc0-1.0 | 4,083 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/storage/azure-storage-file-datalake/tests/perfstress_tests/append.py | Python | mit | 1,397 |
from decimal import Decimal
def moneyfmt(value, places=2, curr='', sep=',', dp='.',
pos='', neg='-', trailneg=''):
"""Convert Decimal to a money formatted string.
places: required number of places after the decimal point
curr: optional currency symbol before the sign (may be blank)
s... | sunlightlabs/clearspending | helpers/format.py | Python | bsd-3-clause | 1,693 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import re
import json
import MySQLdb
from MySQLdb.cursors import DictCursor
PACKET_SIZE = 1000
ADD_THRESHOLD = 0.3
def find_sentences(dbh):
dbh.execute("SELECT MAX(sent_id) AS sent_max FROM sentences")
sent_max = dbh.fetchone()['sent_max']
i = 0
... | OpenCorpora/opencorpora | scripts/find_good_sentences.py | Python | gpl-2.0 | 2,105 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A line bisection task.
This example is appropriate to illustrates the use of the Android runtime environment for Exypriment on tablet PC.
"""
from expyriment import control, stimuli, io, design, misc
#control.set_develop_mode(True)
# settings
design.defaults.experi... | expyriment/expyriment-android-runtime | examples/line-bisection.py | Python | gpl-3.0 | 2,946 |
#!/usr/bin/env python
import argparse
import csv
import locale
import sys
from pprint import pprint
class Corrige:
def __init__(self):
# parametros - valor default (ou None)
self._inventario = None
self._compras = None
self._saida = None
@property
def inventario(self):
... | anselmobd/fo2 | script/inventario_check.py | Python | mit | 6,181 |
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | Donkyhotay/MoonPy | zope/testing/testrunner-ex/sample1/sampletests_ntd.py | Python | gpl-3.0 | 1,221 |
# -*- coding: utf-8 -*-
import base64
import binascii
import re
from Crypto.Cipher import AES
from module.plugins.Crypter import Crypter
from module.plugins.internal.CaptchaService import ReCaptcha
class NCryptIn(Crypter):
__name__ = "NCryptIn"
__type__ = "crypter"
__version__ = "1.33"
__pat... | mariusbaumann/pyload | module/plugins/crypter/NCryptIn.py | Python | gpl-3.0 | 10,913 |
"""dodo file. test + management stuff"""
import glob
import os
import pytest
from doit.tools import create_folder
DOIT_CONFIG = {'default_tasks': ['checker', 'ut']}
CODE_FILES = glob.glob("doit/*.py")
TEST_FILES = glob.glob("tests/test_*.py")
TESTING_FILES = glob.glob("tests/*.py")
PY_FILES = CODE_FILES + TESTING_... | swayf/doit | dodo.py | Python | mit | 4,830 |
"""
Saltbridge extension
Find all salt bridges as determined by the cutoff distance below.
Uses PDB2PQR to determine atom identities and distances, and write
out all located salt bridges to stdout.
NOTE: A bond may be labeled BOTH hbond and salt-bridge if you use both
options in on... | MonZop/BioBlender | bin/pdb2pqr-1.6/extensions/salt.py | Python | bsd-2-clause | 2,994 |
# -*- coding: utf-8 -*-
"""Reflection Assistant: Evaluation XBlock"""
import pkg_resources
from xblock.core import XBlock
from xblock.fields import Boolean, Float, Integer, Scope, String
from xblock.fragment import Fragment
from .utils import render_template
@XBlock.needs('i18n')
class ReflectionAssistantEvalXBloc... | MEdXcognition/reflection | reflection/reflection_eval.py | Python | apache-2.0 | 10,499 |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from import_export.admin import ImportExportModelAdmin
from backend.api_v3.models import Result
class TempoListFilter(admin.SimpleListFilter):
# Human-readable title which will be displayed in the
# right admin sidebar ju... | AstroMatt/esa-time-perception | backend/api_v3/admin.py | Python | mit | 3,822 |
"""
# 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... | OBIGOGIT/etch | binding-python/runtime/src/main/python/etch/binding/support/Validator_void.py | Python | apache-2.0 | 1,587 |
# coding=utf-8
# Copyright 2020 The Gin-Config Authors.
#
# 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... | google/gin-config | tests/tf/utils_test.py | Python | apache-2.0 | 7,699 |
# -*- coding: utf-8
# Testing sphere-sphere interaction in periodic case.
# Pass, if the spheres moves along the X axis, interacting through the period.
from woo import utils
sphereRadius=0.1
tc=0.001# collision time
en=1 # normal restitution coefficient
es=1 # tangential restitution coefficient
density=2700
fric... | tarthy6/dozer-thesis | scripts/test-OLD/sphere-sphere-ViscElBasic-peri.py | Python | gpl-2.0 | 1,066 |
# -*- coding: utf-8 -*-
"""
Created on 29/10/2016
@author: Amaury Ortega <amauryocortega@gmail.com>
"""
trans = {'0': 'ling', '1': 'yi', '2': 'er', '3': 'san', '4': 'si',
'5': 'wu', '6': 'liu', '7': 'qi', '8': 'ba', '9': 'jiu', '10': 'shi'}
def convert_to_mandarin(text):
"""Assumes text is a string of ... | AmauryOrtega/Python-6.00.1x | Final/File1.py | Python | gpl-3.0 | 3,080 |
from beard import pos
import base_test
import unittest
class TestPosModule(base_test.RequireTokens):
def test_create_from_tokens(self):
data = pos.create_from_tokens(self.tokens_01)
w = data.get('words', {})
p = data.get('parts_of_speech', {})
self.assertTrue(w)
self.ass... | YuukanOO/beard | tests/test_pos.py | Python | mit | 454 |
class Solution:
def conbition(self, input_str):
if not input_str:
return list()
length = len(input_str)
res = list()
for i in range(1, length+1):
self.pick_n_from_str(input_str, '', i, res)
return res
def pick_n_from_str(self, input_str, pre_str,... | ResolveWang/algrithm_qa | 分类代表题目/字符串/排列组合问题.py | Python | mit | 1,170 |
from urllib import urlopen
optionsUrl = 'http://www.setlist.fm/venue/the-boathouse-norfolk-va-usa-2bd6387a.html'
optionsPage = urlopen(optionsUrl)
from bs4 import BeautifulSoup
soup = BeautifulSoup(optionsPage)
b = soup.find_all("div", class_="row contentBox visiblePrint")
print b | jalbertbowden/setlist.fm-scraper | boathouse/scrape.py | Python | cc0-1.0 | 283 |
#!/usr/bin/env python
# encoding: utf-8
import pika
import sys
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
channel.exchange_declare(
exchange='logs',
exchange_type='fanout')
message = ' '.join(sys.argv[1:]) or "info: Hello World!"
cha... | MrLYC/test_RabbitMQ | RabbitMQ/tutorial/psmode/emit_log.py | Python | mit | 452 |
#!/bin/env python2.6
import smtplib, time
# fromaddr must be from an email that looks like it comes from our domain (i.e. *****@ourdomain.com)
fromaddr = 'frob@somedomain.com'
toaddr = 'bork@somedomain.com'
header = ("From: %s\r\nTo: %s\r\n"
% (fromaddr, toaddr))
server = smtplib.SMTP(host='email-smtp.us-e... | dcherry-calamp/linux-scripts | aws/example_scripts/ses_smtp_example.py | Python | lgpl-2.1 | 701 |
import endpoints
from google.appengine.ext import ndb
from protorpc import remote
from endpoints_proto_datastore.ndb import EndpointsModel
class Quote(EndpointsModel):
_message_fields_schema = ('id', 'content', 'created')
content = ndb.StringProperty(indexed=False)
created = ndb.DateTimeProperty(auto_now_ad... | andrew-codechimp/cloudyfortunes | models.py | Python | apache-2.0 | 328 |
import collections
from operator import add
import numpy as np
import pytest
import dask
import dask.array as da
from dask.array.utils import assert_eq
from dask.blockwise import (
_BLOCKWISE_DEFAULT_PREFIX,
Blockwise,
_unique_dep,
index_subs,
optimize_blockwise,
rewrite_blockwise,
)
from dask... | dask/dask | dask/array/tests/test_atop.py | Python | bsd-3-clause | 21,399 |
# -*- coding: utf-8 -*-
import system_tests
class CheckNikonTimezoneWithoutCruft(metaclass=system_tests.CaseMeta):
url = "http://dev.exiv2.org/issues/1062"
filename = system_tests.path("$data_path/exiv2-bug1062.jpg")
commands = [ "$exiv2 -pa -g zone $filename" ]
stdout = [ """Exif.NikonWt.Timezone ... | AlienCowEatCake/ImageViewer | src/ThirdParty/Exiv2/exiv2-0.27.5-Source/tests/bugfixes/redmine/test_issue_1062.py | Python | gpl-3.0 | 414 |
# -*- coding: utf-8 -*-
'''
Created on 26/06/2013
Copyright (c) 2010-2012 Shai Bentin.
All rights reserved. Unpublished -- rights reserved
Use of a copyright notice is precautionary only, and does
not imply publication or disclosure.
Licensed under Eclipse Public License, Version 1.0
In... | guymakam/Kodi-Israel | plugin.video.reshet.video/resources/appCaster/APUUIDCreateRequest.py | Python | gpl-2.0 | 1,502 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
QFieldCloudCreateProjectWidget
A QGIS plugin
Sync your projects to QField on android
-------------------
begin : 2021-057-22
... | opengisch/QFieldSync | qfieldsync/gui/cloud_create_project_widget.py | Python | lgpl-3.0 | 15,472 |
from django.http import HttpResponseBadRequest, HttpResponseForbidden
from groupbank_crypto import ec_secp256k1 as crypto # we might want to change the underlying crypto
class VerifySignatureMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
# One-time configu... | GroupBank/global-server | rest_app/middleware.py | Python | agpl-3.0 | 2,541 |
#!/usr/bin/env python
################################################################################
# Copyright (C) The Qt Company Ltd.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * R... | openmv/openmv-swd | module/V2-Application/scripts/deployqt.py | Python | mit | 12,694 |
__author__ = 'pascal'
class LSFEventType:
cancelled_event = 'cancelled'
normal_event = 'normal'
| pascalweiss/LSFEventScraper | LSFEventType.py | Python | mit | 105 |
# -*- coding: utf-8 -*-
#
# Copyright 2015 Simone Campagna
#
# 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... | simone-campagna/sheru | packages/sheru/options_config.py | Python | apache-2.0 | 1,083 |
import sys
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from ctapipe.visualization import CameraDisplay
from matplotlib.ticker import FormatStrFormatter, MaxNLocator
from matplotlib.widgets import Button, RadioButtons, CheckButtons
from digicampipe.instrument.camera import DigiCam
class Even... | calispac/digicampipe | digicampipe/visualization/__init__.py | Python | gpl-3.0 | 16,839 |
"""Copyright 2011 The University of Michigan
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 writi... | jieyu/maple | script/maple/core/testing.py | Python | apache-2.0 | 8,304 |
# encoding: utf-8
#
# Copyright (C) 2013 midnightBITS/Marcin Zdun
#
# 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, c... | mzdun/uml-seq | src/uml/__init__.py | Python | mit | 1,212 |
# from operator import add
#
# class Fibber(object):
#
# @staticmethod
# def fib(n):
# a, b = 0, 1
# for i in range(n):
# a, b = b, add(a, b)
# return b
#
# print(Fibber.fib(10))
(___________, ____________, _____________) = (0, 1, 10)
(________, _________, _________... | huan/Underscore | examples/underscored/readme_example.py | Python | mit | 688 |
#!/usr/bin/python
from ernest.srv import SetMood, GetMood
from ernest.brain import Brain
import rospy
ernest_brain = Brain()
def set_mood(req):
print "Set mood to %s" % req.mood
ernest_brain.set_mood(req.mood)
return "ok"
def get_mood(req):
return ernest_brain.mood
def main():
rospy.init_node... | simkim/ernest | scripts/soul.py | Python | gpl-3.0 | 517 |
#!flask/bin/python
from flask import Flask, jsonify,abort,send_from_directory
from flask import request
import os
import pickle
import nltk
import string
from itertools import chain
from nltk.corpus import stopwords
from nltk.probability import FreqDist
from nltk.classify import NaiveBayesClassifier as nbc
from nltk.c... | MissaouiAhmed/NLP-rest-service-Python | NLP-rest-service/src/NLP_Service_LINUX.py | Python | gpl-3.0 | 5,204 |
#coding: utf8
"""
归档镜像功能
"""
import os.path
from bottle import post,get,request,abort,response,redirect
from utils import wrapdb,login
from config import ARCHIVED_DIR
def readone(packedfile,name):
if not os.path.exists(packedfile):
return None
fd = open(packedfile,"rb")
cnt = int(fd.readline().strip())
meta = ... | D-L/SimpleBookMarks | src/archive.py | Python | gpl-2.0 | 2,387 |
#!/usr/bin/python
import http, sys, json
# get the latest value from one of the streams at Joakim's COSM account
# configuration for the account
# host = [2001:6b0:3a:1:211d:384b:8968:3cc4]
host = "sense.sics.se"
user = "simon"
device = "phone"
sensor = "sensors/compass"
# first argument used as sensor id if any
if l... | liamjjmcnamara/sicsthsense | tools/csl-lab/python/getcompass.py | Python | apache-2.0 | 557 |
#!/usr/bin/python
# Copyright 2008 Jurko Gospodnetic
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Test that the expected default toolset is used when no toolset is explicitly
# specified on the command line or used fro... | mxrrow/zaicoin | src/deps/boost/tools/build/v2/test/default_toolset.py | Python | mit | 7,735 |
from maths2 import square
def test_square():
x = 4
assert square(x) == 16
| jni/maths2 | tests/test_maths2.py | Python | bsd-3-clause | 83 |
import unittest
from datasets import *
def test_simple_parsable():
t = Parsable('mine', keyword=True)
assert t.stringify('hello') == 'mine-hello'
assert Parsable('mine', keyword=False).stringify('hello') == 'hello'
def test_list_parsable():
t = Parsable('mylist', keyword=True)
assert t.stringify(... | dreadsci/forget-me-not | test_datasets.py | Python | unlicense | 15,777 |
"""a decoy python script that can be run like `python nosepassthru.py` to test using an executable chain"""
if __name__ == '__main__':
from nose.core import main
main() | yongshengwang/hue | build/env/lib/python2.7/site-packages/nosetty-0.4-py2.7.egg/nosetty/test/nosepassthru.py | Python | apache-2.0 | 178 |
#!/usr/bin/python
# Three clause BSD license: https://opensource.org/licenses/BSD-3-Clause
# Copyright (c) 2017, Bruce Badger 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... | bwbadger/mifid2-rts | rts/rts23_table2.py | Python | bsd-3-clause | 18,682 |
import socket
def listen_iter_connection(host, port, backlog):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind((host, port))
sock.listen(backlog)
sock.settimeout(0.5)
while True:
try:
conn, addr = sock.accept()
yield conn
except socket.tim... | vbkaisetsu/clopure | examples/listen_iter.py | Python | mit | 343 |
#!/usr/bin/env python
# Copyright (c) 2007-9 Qtrac Ltd. All rights reserved.
# This program or 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 2 of the License, or
# version 3 of the Lice... | Rareson/LammpsRelated | tools/mkpyqt.py | Python | gpl-3.0 | 8,680 |
from eLCS.Constants import cons
from eLCS.Classifier import Classifier
import random
import copy
class ClassifierSet(object):
"""This module handles all the classifier sets
This includes the population, match set and correct sets along with mechanisms and
heuristics that act on these sets.
This cla... | ScottMcCormack/CITS4404 | eLCS/ClassifierSet.py | Python | mit | 29,824 |
#!/usr/bin/python -B
""" Usage: make-normalize-generateddata-input.py PATH_TO_MOZILLA_CENTRAL
This script generates test input data for String.prototype.normalize
from intl/icu/source/data/unidata/NormalizationTest.txt
to js/src/tests/ecma_6/String/normalize-generateddata-input.js
"""
from __future__ imp... | JasonGross/mozjs | js/src/tests/ecma_6/String/make-normalize-generateddata-input.py | Python | mpl-2.0 | 2,992 |
from expects import *
from doublex_expects import have_been_called_with
from doublex import Spy
from spec.object_mother import *
from mamba import reporter, formatters, example_group
with description(reporter.Reporter):
with before.each:
self.example = an_example()
self.formatter = Spy(formatte... | alejandrodob/mamba | spec/reporter_spec.py | Python | mit | 3,544 |
# -*- coding: utf-8 -*-
import time
from django.core.cache import get_cache
from helpers import CachetestCase
from nose import tools
class TestMintCache(CachetestCase):
def test_cache_expires(self):
self.cache.set('cache-key', 'cache value', timeout=0.1)
time.sleep(0.1)
tools.assert_equa... | ella/django-versionedcache | test_versionedcache/test_basic.py | Python | bsd-3-clause | 3,868 |
#! /usr/bin/env python
'''visualisation tools for make-magic'''
def write_dot_from_items(items, outfile):
'''generate dot file output for dependencies amongst supplied items
writes output to a supplied file already opened for writing.
Does not have any idea what a group is and will treat it just like anything el... | anchor/make-magic | lib/vis.py | Python | bsd-3-clause | 1,463 |
# 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... | os-cloud-storage/openstack-workload-disaster-recovery | dragon/flow_utils.py | Python | apache-2.0 | 1,348 |
from nose.tools import * # flake8: noqa
from api.base.settings.defaults import API_BASE
from tests.base import ApiTestCase
from tests.factories import ProjectFactory, AuthUserFactory, CommentFactory
class TestCommentReportsView(ApiTestCase):
def setUp(self):
super(TestCommentReportsView, self).setUp()
... | samanehsan/osf.io | api_tests/comments/views/test_comment_report_list.py | Python | apache-2.0 | 11,892 |
# -*- coding: utf-8 -*-
from nose.tools import eq_
from olympia import amo
from olympia.amo.tests import TestCase
from olympia.addons.models import Addon, AddonCategory, AddonUser, Category
from olympia.users.models import UserProfile
from olympia.landfill.user import (
generate_addon_user_and_category, generate_u... | jpetto/olympia | src/olympia/landfill/tests/test_users.py | Python | bsd-3-clause | 1,008 |
from fabric.api import run, local, hosts, cd
from fabric.contrib import django
#Muestra infomacion del host
def informacion():
run('uname -a')
#Descarga la aplicacion del repositorio git
def descargar():
run('sudo apt-get update')
run('sudo apt-get install -y git')
run('sudo git clone https://github.com/romilg... | romilgildo/Proyecto-IV | fabfile.py | Python | gpl-3.0 | 979 |
#!/usr/bin/env python
from datetime import datetime
import unittest
from pyvcs.backends import get_backend
from pyvcs.exceptions import FileDoesNotExist, FolderDoesNotExist
class BzrTest(unittest.TestCase):
def setUp(self):
bzr = get_backend('bzr')
self.repo = bzr.Repository('/home/andrew/junk/dja... | alex/pyvcs | tests/andrew_tests.py | Python | bsd-3-clause | 1,801 |
import numpy as np
'''
pps = packets per second
rand = the randomly generated number
'''
def exponential(pps, rand):
X = (-1 / pps) * np.log(1 - rand)
return X
def generate_random():
# this needs to include 1 though?
# currently its [0, 1)
s = np.random.uniform
return s
'''
ticks * ti... | seeARMS/Computer-Network-Queue-Simulation | rando.py | Python | mit | 774 |
# 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... | sfriesel/suds | suds/reader.py | Python | lgpl-3.0 | 5,300 |
#!/usr/bin/env python2
import logging.config
import signal
from flask import Flask, send_from_directory, jsonify
from flask_socketio import SocketIO
from gpio_stinkomat_6000_controller import AeromeScentController
SERIAL_PORT = "TODO"
SCENT_DURATION_SEC = 1
# Instanciate Flask (Static files and REST API)
app = F... | j-be/vj-aerome-scent-controller | aerome_scent_control_server.py | Python | mit | 2,262 |
###
### $Release: 0.8.1 $
### copyright(c) 2007-2009 kuwata-lab.com all rights reserved.
###
#import unittest
import os, sys, difflib, re, traceback
import yaml
__all__ = ['TestCaseHelper', 'read_file', 'write_file',
'remove_unmatched_test_methods',
'python3', 'python2', '_unicode', '_bytes']
p... | mikedougherty/tenjin | test/testcase_helper.py | Python | mit | 4,741 |
'''
Copyright (c) Pyaisa 2015 - Alberto Lorenzo (alorenzo.md@gmail.com)
Distributed under the MIT License.
(See accompanying file "copying" or copy at
http://opensource.org/licenses/MIT)
'''
from pyaisa.isa import *
__author__ = 'Alberto Lorenzo'
__version__ = '0.8.5'
__date__ = '02/07/2015'
__email__ = 'alorenzo.m... | newlawrence/Pyaisa | pyaisa/__init__.py | Python | mit | 353 |
# -*- coding: utf-8 -*-
import datetime as dt
from flask.ext.login import UserMixin
from foobar.extensions import bcrypt
from foobar.database import (
Column,
db,
Model,
ReferenceCol,
relationship,
SurrogatePK,
)
class Role(SurrogatePK, Model):
__tablename__ = 'roles'
name = Column(d... | ghofranehr/foobar | foobar/user/models.py | Python | bsd-3-clause | 1,860 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011, 2012 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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 ... | unioslo/cerebrum | Cerebrum/modules/no/uio/PostmasterCommands.py | Python | gpl-2.0 | 4,574 |
import numpy as np
import matplotlib.pyplot as plt
import libstarid
ls = libstarid.libstarid()
def test_sky(pathsky):
read_sky(pathsky)
imgdict = ls.image_generator(3)
plt.matshow(-1 * imgdict['pixels'], cmap='Greys', interpolation='nearest')
plt.show()
def read_sky(pathsky):
ls.read_sky(pathsky)
... | noahhsmith/starid | starid/util.py | Python | mit | 987 |
##############################################################################
#
# 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-Louvain | program_management/ddd/domain/service/generate_node_code.py | Python | agpl-3.0 | 5,298 |
from .base import SprintMetric
class PersonalCodeOwnership(SprintMetric):
def _calculate_score(self, sprint, team):
data = self._result_getter(sprint, team)
amount = len(data['rows'])
# 11 incidents gets you a 50 rating
r = 100-(amount*4.84)
return 0 if r<0 else r
| chrisma/ScrumLint | metricsapp/models/personal_code_ownership.py | Python | mit | 278 |
import numpy as np
from nose.tools import assert_raises, assert_equal, assert_true
from numpy.testing import assert_array_equal
from os import path as op
import warnings
import mne
from mne.io import read_raw_fif
from mne.utils import sum_squared
from mne.time_frequency import csd_epochs, csd_array, tfr_morlet
warni... | jniediek/mne-python | mne/time_frequency/tests/test_csd.py | Python | bsd-3-clause | 13,553 |
from wtforms import Form, StringField, validators
class AdminUsers(Form):
"""
"""
username = StringField('Username', [validators.Length(min=4, max=25)], id='username')
email = StringField('Email Address', [validators.Length(min=5, max=35)], id='userEmail')
class AdminPatients(Form):
"""
"""
... | SLU-Capstone/Recover | recover/forms/AdminViewer.py | Python | mit | 543 |
import os
import sys
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root)
# ----------------------------------------------------------------------------
import asyncio # noqa: E402
import time # noqa: E402
from ccxt.async_support.base.throttler import Throttler ... | ccxt/ccxt | python/ccxt/test/test_throttle.py | Python | mit | 3,123 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | derekjchow/models | official/resnet/resnet_model.py | Python | apache-2.0 | 22,825 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.