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 |
|---|---|---|---|---|---|
import time, os
import paho.mqtt.client as mqtt
from pymongo import MongoClient
cliente = MongoClient(os.getenv('MONGO_SERVER', 'nuvem.sj.ifsc.edu.br'))
db = cliente[os.getenv('DATABASE', 'estacao')]
def on_connect(client, userdata, flags, rc):
client.subscribe(os.getenv('TOPIC', 'estacao/#'))
def on_message(cl... | kididcca/mqtt-mongo | assinante.py | Python | mit | 951 |
import rospy
from std_msgs.msg import String
#name, type, readQuery, readResponse
UsedServices = ()
| mpomarlan/UE_ROS_Bridge | scripts/UE_ROS_Bridge_UsedServices.py | Python | bsd-2-clause | 101 |
#! /usr/bin/env python3
### Author: Kevin Pouget, Grenoble, France, July 2014
import queue
import sh
SOURCE_DIR = "/home/kevin/cl-specfem3d/SPECFEM3D_GLOBE"
BUILD_DIR = "/home/kevin/specfem-testsuite"
PAR_FILE = "DATA/Par_file"
DEBUG = False
to_import = ("cd", "mkdir", "make", "sed", "grep", "gnuplot", "{}/configu... | geodynamics/specfem3d_globe | utils/BuildBot/test_suite_for_BuildBot.py | Python | gpl-3.0 | 4,675 |
"""Python wrappers around Brain.
This file is MACHINE GENERATED! Do not edit.
"""
import collections as _collections
from google.protobuf import text_format as _text_format
from tensorflow.core.framework import op_def_pb2 as _op_def_pb2
# Needed to trigger the call to _set_call_cpp_shape_fn.
from tensorflow.python... | jjas0nn/solvem | tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/gen_resource_variable_ops.py | Python | mit | 9,981 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | agry/NGECore2 | scripts/mobiles/dantooine/janta_tribesman.py | Python | lgpl-3.0 | 1,720 |
# WSAdminExtras is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# WSAdminExtras is distributed in the hope that i... | durdyev/WSAdminExtras | lib/ru/durdyev/wsadminextras/server/RequestHandler.py | Python | gpl-3.0 | 6,507 |
# in case setuptools become default in RHEL
from setuptools import setup, find_packages
import os, glob, sys, re
from distutils.core import setup
import distutils.sysconfig
name = 'scutools'
version = '0.6.3'
setup(
name = name,
version = version,
packages = find_packages(),
scripts = glob.glob('scrip... | somsak/scutools | setup.py | Python | gpl-3.0 | 1,930 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | JavaRabbit/CS496_capstone | pubsub/cloud-client/publisher_test.py | Python | apache-2.0 | 1,655 |
# -*- coding: utf-8 -*-
#! \file ./tests/test_text/test_pgen/__init__.py
#! \author Jiří Kučera, <sanczes@gmail.com>
#! \stamp 2016-04-07 09:49:32 (UTC+01:00, DST+01:00)
#! \project DoIt!: Tools and Libraries for Building DSLs
#! \license MIT
#! \version 0.0... | i386x/doit | tests/test_text/test_pgen/__init__.py | Python | mit | 1,811 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 by Filip H.F. "FiXato" Slagter <fixato+weechat@gmail.com>
#
# Shutup: a quick WeeChat script to replace text from specified users with
# random or preset text as a way to hide their actual text.
#
# This program is free software; you can redistribute it and/or modi... | qguv/config | weechat/plugins/python/shutup.py | Python | gpl-3.0 | 7,664 |
""" Test ``dockci.api.jwt`` against the DB """
import json
import pytest
class TestJwtServiceNew(object):
""" Test the ``JwtServiceNew`` resource """
@pytest.mark.usefixtures('db')
def test_agent_role(self, client, admin_user):
""" Test creating a service token with the agent internal role """
... | RickyCook/DockCI | tests/db/api/test_jwt_api_db.py | Python | isc | 2,180 |
from unittest.mock import Mock, MagicMock, patch, call, DEFAULT, mock_open
from .util import mock_globbing, mock_path, mock_multiple_opens
import toml
import itertools
import sh
import click
import os
import sys
import glob
from click.testing import CliRunner
from borg_summon import command_line, config_parser
from lo... | grensjo/borg-summon | test/test_cmd.py | Python | mit | 7,815 |
"""Compute statistics over midi files.
Usage
-----
# Run with default parameters
$ python midi_tools.py "data/*.mid" stats.json
# Run with full verbosity
$ python midi_tools.py "data/*.mid" stats.json --verbose 50
# Run with only one CPU
$ python midi_tools.py "data/*.mid" stats.json --n_jobs 1
# Run with two CPUs ... | ejhumphrey/osr-intro | midi_tools.py | Python | mit | 2,374 |
#!/usr/bin/env python
# coding: utf-8
from .settings_manager import Settings
__all__ = ['settings']
settings = Settings()
| ymero/workin | workin/conf/__init__.py | Python | bsd-3-clause | 125 |
import random
import threading
class Proxy(object):
def __init__(self, proxy_string=None):
if proxy_string:
self.parse_proxy_string(proxy_string)
else:
self.proxy_string = None
def parse_proxy_string(self, proxy_string):
split_string = proxy_string.strip('\n').s... | kfichter/proxy-manager | proxymanager/manager.py | Python | mit | 1,780 |
import ssl
from amqpstorm import AMQPInvalidArgument
from amqpstorm import Connection
from amqpstorm.tests.utility import TestFramework
class ConnectionExceptionTests(TestFramework):
def test_connection_set_hostname(self):
connection = Connection('127.0.0.1', 'guest', 'guest', lazy=True)
self.as... | eandersson/amqpstorm | amqpstorm/tests/unit/connection/test_connection_exception.py | Python | mit | 4,722 |
#!/usr/bin/env python3
"""Get a TSV of (insertion size, length, seq, genome) sampled from a HAL
file."""
from argparse import ArgumentParser
from sonLib.bioio import popenCatch, system, getTempFile, fastaRead
from jobTree.scriptTree.stack import Stack
from jobTree.scriptTree.target import Target
def countMaskedBases(s... | glennhickey/hal | extra/insertionStats/getInsertionStats.py | Python | mit | 7,825 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a ... | berrange/nova | nova/tests/api/ec2/test_middleware.py | Python | apache-2.0 | 8,424 |
from enum import IntEnum
class Commands:
WALK_FORWARD = 1
DO_PUSHUPS = 2
STAND_UP = 3
STOP = 5
HOME = 6
READY = 10
DONE = 19
SUCCESS = 20
FAILURE = 21 | bobbyluig/Eclipse | src/cerebral/pack2/commands.py | Python | mit | 191 |
# -*- coding: utf-8 -*-
'''Statystyka liter
'''
# http://www.prezydent.pl/prezydent/priorytety#nowoczesny_patriotyzm
TEXT = '''
W opinii Prezydenta RP patriotyzm – pozostając miłością Ojczyzny i troską o jej bezpieczeństwo – przejawia się w budowaniu nowoczesnego państwa, w działaniach obywatelskich na rzecz regionu ... | CodeCarrots/warsztaty | sesja03/letters_stat.py | Python | cc0-1.0 | 1,796 |
# -*- coding: utf-8 -*-
import requests
from modularodm import Q
from modularodm.exceptions import ModularOdmException
from framework.auth import Auth
from website import util
from website import settings
from website.project import new_node
from website.models import Node, MailRecord
def record_message(message, n... | monikagrabowska/osf.io | website/conferences/utils.py | Python | apache-2.0 | 2,561 |
import gdb
import bp
from objdumpfile import ObjDumpFile
import subprocess
class MEMMAPIO:
cycles, cyclesMSB, wasteCycles, wasteCyclesH, \
cyclesSinceReset, cyclesSinceCP, addrOfCP, addrOfRestoreCP, \
resetAfterCycles, do_reset, do_logging, wdt_seed, \
wdt_val, md5_0, md5_1, md5_2, md5_3, md5_4 = r... | impedimentToProgress/Ratchet | thumbulator/bareBench/python/commands.py | Python | mit | 2,442 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^auth/signin/$', 'auth.views.signin', name='auth.signin'),
url(r'^auth/signup/$', 'auth.views.signup', name='auth.signup'),
url(r'^auth/signout/$', 'auth.views.signout', name='auth.signout'),
url(r'^auth/forgot/initial... | rajeshvaya/aftore.com | src/aftore/auth/urls.py | Python | mit | 731 |
import unittest
import itertools
import pickle
import rpy2.rinterface as rinterface
import sys, os, subprocess, time, tempfile, signal
rinterface.initr()
def onlyAQUAorWindows(function):
def res(self):
platform = rinterface.baseenv.get('.Platform')
platform_gui = [e for i, e in enumerate(platfo... | lbouma/Cyclopath | pyserver/bin/rpy2/rinterface/tests/test_EmbeddedR.py | Python | apache-2.0 | 12,996 |
# Copyright (c) 2011 Jeff Garzik
#
# Previous copyright, from python-jsonrpc/jsonrpc/proxy.py:
#
# Copyright (c) 2007 Jan-Klaas Kollhof
#
# This file is part of jsonrpc.
#
# jsonrpc is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# th... | gjhiggins/vcoincore | test/functional/test_framework/authproxy.py | Python | mit | 8,665 |
from openerp import models, fields, api
from openerp.tools.translate import _
import logging
#from fingerprint import Fingerprint
from dateutil import relativedelta
from datetime import datetime as dt
from dateutil import parser
import xlsxwriter
import StringIO
from io import BytesIO
import base64
import hashlib
impor... | stanta/darfchain | darfchain/models/sale_order.py | Python | gpl-3.0 | 7,313 |
import flask
from flask_mongoengine import MongoEngine
from tests import FlaskMongoEngineTestCase
class DummyEncoder(flask.json.JSONEncoder):
'''
An example encoder which a user may create and override
the apps json_encoder with.
This class is a NO-OP, but used to test proper inheritance.
'''
cla... | losintikfos/flask-mongoengine | tests/test_json.py | Python | bsd-3-clause | 1,287 |
#!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
import glob
import operator
import os
import sys
OUT_CPP="qt/arcstrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' format ... | ArcticCore/arcticcoin | share/qt/extract_strings_qt.py | Python | mit | 1,848 |
###
# Copyright 2008-2018 Diamond Light Source Ltd.
# This file is part of Diffcalc.
#
# Diffcalc is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | DiamondLightSource/diffcalc | diffcalc/gdasupport/scannable/qtrans.py | Python | gpl-3.0 | 5,532 |
##
#
# Copyright 2013 Netflix, 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 l... | korrelate/genie | genie-web/src/test/python/jobs/hiveVersionOverrideTest.py | Python | apache-2.0 | 2,176 |
#!/usr/bin/env python
import rospy
from cv_bridge import CvBridge
import cv, cv2
import numpy
from sensor_msgs.msg import Image
import sys
bridge = CvBridge()
pub = rospy.Publisher("/image_out", Image)
shift_by = 128
def image_callback(image):
""" Shifts bit(s) from image and displays the result. """
image_... | OSUrobotics/privacy-interfaces | filtering/text_filters/scripts/bit_shifter.py | Python | mit | 888 |
#!/usr/bin/python
# coding: utf-8
import commands
import re
import datetime
import os.path
now = datetime.datetime.today()
timestamp = now.strftime("%Y-%m-%d %H:%M:%S")
# recording state
recording_size = os.path.getsize("../chinachu/data/recording.json")
recording_state = "standby"
if 2 < recording_size:
# when not ... | remonbonbon/rec-stats | cron.py | Python | mit | 1,259 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2006-2008 Lukáš Lalinský
# Copyright (C) 2014 Sophist-UK
# Copyright (C) 2014, 2018, 2020-2021 Laurent Monin
# Copyright (C) 2016-2018 Sambhav Kothari
# Copyright (C) 2018 Vishal Choudhary
# Copyright (C) 2019-2021 Philipp Wolf... | musicbrainz/picard | picard/ui/__init__.py | Python | gpl-2.0 | 7,063 |
import engine
import re
from sqlalchemy.sql import select
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import MetaData, Table
from sqlalchemy import Column, Integer, String, Text
Base = declarative_base()
class Message(Base):
__tablename__ = 'messages'
DASHES = '-'
id = Col... | parkr/steve | message.py | Python | mit | 2,527 |
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))
from cocos.layer import *
from cocos.text import *
from cocos.actions import *
import py... | shujunqiao/cocos2d-python | samples/tetrico/HUD.py | Python | bsd-3-clause | 3,045 |
import psycopg2
from flask import Blueprint, current_app, render_template, session, request, redirect, url_for
groups_app = Blueprint('groups_app', __name__)
@groups_app.route('/create_group')
def create_group():
if not session.get('user_id'):
return redirect(url_for('home_page'))
with psycopg2.conn... | itucsdb1621/itucsdb1621 | groups.py | Python | gpl-3.0 | 3,749 |
# -*- coding: utf-8 -*-
from unittest import TestSuite, TestLoader
from flask import url_for
from flask.ext.security import url_for_security
from lxml.html import fromstring
from spkrepo.ext import db
from spkrepo.tests.common import BaseTestCase, BuildFactory, UserFactory
class IndexTestCase(BaseTestCase):
def... | Dr-Bean/spkrepo | spkrepo/tests/test_frontend.py | Python | mit | 5,912 |
#!/usr/bin/env python
from subprocess import check_output
from netInfo import Information_Gathering
info = Information_Gathering()
iface = info.IFACE()
def getIP(iface=iface):
ifconfig = check_output(["ifconfig", "%s"%iface])
ip, mac = ifconfig.split()[6], ifconfig.split()[4]
return ip.split(":")[1], mac
| securecurebt5/ARPySnitch | mylocalip.py | Python | gpl-3.0 | 315 |
import wget
import os
import tensorflow as tf
# The URLs where the MNIST data can be downloaded.
_DATA_URL = 'http://yann.lecun.com/exdb/mnist/'
_TRAIN_DATA_FILENAME = 'train-images-idx3-ubyte.gz'
_TRAIN_LABELS_FILENAME = 'train-labels-idx1-ubyte.gz'
_TEST_DATA_FILENAME = 't10k-images-idx3-ubyte.gz'
_TEST_LABELS_FILEN... | ybao2016/tf-slim-model | download_data_wget.py | Python | apache-2.0 | 1,531 |
################################################################################
# $Id: output.py 2552 2007-02-08 21:40:46Z b4rt $
# $Date: 2007-02-08 15:40:46 -0600 (Thu, 08 Feb 2007) $
# $Revision: 2552 $
################################################################################
# ... | sulaweyo/torrentflux-b4rt-php7 | html/bin/clients/fluazu/fluazu/output.py | Python | gpl-2.0 | 3,408 |
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Class representing instrumentation test apk and jar."""
import os
from devil.android import apk_helper
from pylib.instrumentation import test_jar
... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/build/android/pylib/instrumentation/test_package.py | Python | mit | 1,335 |
#!/usr/bin/python3
# requirements: btrfs on /dev/sdc1 with qgroups 0/257, 1/0 and 2/0
from storage import *
from storageitu import *
set_logger(get_logfile_logger())
environment = Environment(False)
storage = Storage(environment)
storage.probe()
staging = storage.get_staging()
print(staging)
blk_device = BlkD... | aschnell/libstorage-ng | integration-tests/filesystems/btrfs/quota/assign-qgroup.py | Python | gpl-2.0 | 836 |
#!/usr/bin/env python
from __future__ import with_statement
import sys
from distutils.core import setup, Extension, Command
from distutils.command.build_ext import build_ext
from distutils.errors import CCompilerError, DistutilsExecError, \
DistutilsPlatformError
IS_PYPY = hasattr(sys, 'pypy_translation_info')
VE... | dbbhattacharya/kitsune | vendor/packages/simplejson/setup.py | Python | bsd-3-clause | 3,691 |
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from duelify_app.views import logout_page, discussions,\
discussion_add_edit, register_page, RegisterSuccess, ChooseCategoryView, CategoryCreate, CategoryUpdate, CategoryDelete,\
filter_discus... | houmie/duelify | duelify/urls.py | Python | gpl-2.0 | 4,489 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './Helpviewer/CookieJar/CookieDetailsDialog.ui'
#
# Created: Tue Nov 18 17:53:58 2014
# by: PyQt5 UI code generator 5.3.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Cook... | davy39/eric | Helpviewer/CookieJar/Ui_CookieDetailsDialog.py | Python | gpl-3.0 | 5,194 |
#!/usr/bin/env python
'''
Multithreaded video processing sample.
Usage:
video_threaded.py {<video device number>|<video file name>}
Shows how python threading capabilities can be used
to organize parallel captured frame processing pipeline
for smoother playback.
Keyboard shortcuts:
ESC - exit
spac... | DamianPilot382/Rubiks-Cube-Solver | opencv/sources/samples/python/video_threaded.py | Python | apache-2.0 | 2,365 |
from flask import g
from .opml_import import opml_to_dict
from server import app, init_db
from server.database.models import Feed
import sys
from urllib.request import urlopen, URLError
feeds_dir = app.root_path + "/test_resources/feeds/"
app.config['DATABASE_PATH'] = 'sqlite:///server/test_resources/posts.db'
if len... | flacerdk/smoke-signal | utils/create_local_feeds.py | Python | mit | 935 |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 8 15:10:34 2016
@author: mhurst
"""
#import modules
import matplotlib
#matplotlib.use('Agg')
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
#setup figure
fig = plt.figure(1,figsize=(6,6))
ax1 = fig.add_subplot(211)
ax2 = fig.add_subplot(2... | mdhurst1/RoBoCoP_CRN | plotting_functions/plot_RockyCoastCRN_output.py | Python | gpl-3.0 | 1,667 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'WorkFlowStep.fields_list'
db.alter_column(u'calc_workf... | thesgc/shergar | shergar/calc/migrations/0003_auto__chg_field_workflowstep_fields_list.py | Python | mit | 9,991 |
import re
import requests
from flask import Flask
from flask import request
from flask import Response
from werkzeug import LocalProxy
from ws4py.client.geventclient import WebSocketClient
app = Flask(__name__)
app.debug = True
PROXY_DOMAIN = "127.0.0.1:8888"
PROXY_FORMAT = u"http://%s/%s" % (PROXY_DOMAIN, u"%s")
... | versae/hidra | hidra/hidra.py | Python | mit | 3,120 |
# Testing if feature collisions are detected accross recursive features
expected_results = {
"K64F": {
"desc": "test recursive feature collisions",
"exception_msg": "Configuration conflict. The feature UVISOR both added and removed."
}
}
| arostm/mbed-os | tools/test/config_test/test25/test_data.py | Python | apache-2.0 | 264 |
# coding=utf-8
def get_remote_addr(request):
addr = request.META.get('REMOTE_ADDR')
if not addr:
addr = request.META.get('HTTP_X_FORWARDED_FOR').split(',')[-1:][0].strip()
return addr
| manazag/hopper.pw | hopperpw/main/utils.py | Python | bsd-3-clause | 206 |
import numpy as np
import pytest
from numpy.testing import assert_array_almost_equal
from sklearn.neighbors import KDTree
from sklearn.preprocessing import normalize
from umap import distances as dist
from umap.umap_ import (
nearest_neighbors,
smooth_knn_dist,
)
# ===========================================... | lmcinnes/umap | umap/tests/test_umap_nn.py | Python | bsd-3-clause | 5,348 |
'''
Collection of tests to verify presets parsing correctness
'''
from nose.tools import eq_, raises
from presets.presetManager import Preset
from presets.presetManager import PresetMissingFieldException
from presets.presetManager import PresetFieldTypeException
from presets.presetManager import PresetException
def ... | leophys/libreant | presets/test/test_preset_parsing.py | Python | agpl-3.0 | 5,337 |
from setuptools import setup, find_packages
version = "5.2.0"
with open("requirements.txt", "r") as f:
install_requires = f.readlines()
setup(
name='erpnext',
version=version,
description='Open Source ERP',
author='Frappe Technologies',
author_email='info@erpnext.com',
packages=find_packages... | netfirms/erpnext | setup.py | Python | agpl-3.0 | 415 |
from django.contrib.admin import (
HORIZONTAL, VERTICAL, AdminSite, ModelAdmin, StackedInline, TabularInline,
autodiscover, site,
)
from django.contrib.gis.admin.options import GeoModelAdmin, OSMGeoAdmin
from django.contrib.gis.admin.widgets import OpenLayersWidget
__all__ = [
'autodiscover', 'site', 'Admi... | huang4fstudio/django | django/contrib/gis/admin/__init__.py | Python | bsd-3-clause | 464 |
import re
import sys
import copy
import types
import inspect
import keyword
import builtins
import functools
import _thread
__all__ = ['dataclass',
'field',
'Field',
'FrozenInstanceError',
'InitVar',
'MISSING',
# Helper functions.
'fields',... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/dataclasses.py | Python | gpl-2.0 | 48,530 |
###########################################################
#
# Copyright (c) 2005-2013, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written ... | Southpaw-TACTIC/TACTIC | src/tactic/ui/app/message_wdg.py | Python | epl-1.0 | 47,704 |
# -*- coding: utf-8 -*-
from config.config import ARTICLE_PER_PAGE
from exception import Unauthorized
from helper.model_control import get_board, get_article_page
from helper.permission import is_anybody, can_write
from helper.resource import YuzukiResource
from helper.template import render_template
class Board(Yuzu... | TintypeMolly/Yuzuki | resource/board.py | Python | mit | 1,155 |
# coding: utf-8
import functools
import hashlib
import math
import numpy as np
import pandas
import neural_network.neural_network as nn
from neural_network.Dropout import Dropout
from neural_network.EarlyStop import EarlyStop
from neural_network.L2Decay import L2Decay
SUBSET_NUM = 5
def preprocess_train(data_raw:... | gonglinyuan/titanic | main.py | Python | gpl-3.0 | 11,931 |
"""
Create slides for a slideshow
TODO: would be nice if it did not give eog focus.
"""
import os
from PIL import Image, ImageDraw, ImageFont
FONT = '/usr/share/fonts/TTF/Vera.ttf'
FONTSIZE = 36
WIDTH = 1024
HEIGHT = 768
class SlideShow:
def __init__(self):
self.pos = 0
self.cache = 'show'
... | openbermuda/ripl | ripl/caption.py | Python | gpl-3.0 | 3,205 |
"""Test module for export class."""
import pytest
from export.models import ExportDocument
from home.models.profile import Profile
def test_export(export_document):
"""Test the object."""
if not isinstance(export_document, ExportDocument):
raise AssertionError()
@pytest.mark.usefixtures('db')
def t... | executive-consultants-of-los-angeles/rsum | rsum/export/tests/test_export.py | Python | unlicense | 576 |
import time
import datetime
import traceback
import multiprocessing
import urllib2
import xml.sax
import redis
import random
import pymongo
import re
import requests
import dateutil.parser
import isodate
import urlparse
from django.conf import settings
from django.db import IntegrityError
from django.core.cache import ... | mihaip/NewsBlur | utils/feed_fetcher.py | Python | mit | 46,750 |
# -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the ... | sahilTakiar/spark | python/pyspark/sql/tests.py | Python | apache-2.0 | 276,859 |
from django.contrib import admin
from .models import CodilityTask
admin.site.register(CodilityTask)
| JacekKarnasiewicz/HomePage | apps/codility/admin.py | Python | mit | 102 |
#!/usr/bin/env python3
import sys
import math
#class Shape:
# def __init__(self, name):
class Triangle:
"""equilateral triangle class"""
def __init__(self, name):
"""creating triangle"""
self.name= name
self.shape_type ='Triangle'
#self.edge_length=2
self.tr... | artopping/nyu-python | course2/npd_c2_a3/redo_classes.py | Python | mit | 3,742 |
"""
Get your own public IP address or that of any host.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.dnsip/
"""
import asyncio
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.const import STATE_UNKNOWN... | MungoRae/home-assistant | homeassistant/components/sensor/dnsip.py | Python | apache-2.0 | 2,565 |
from keras.datasets import cifar100
from keras.utils import np_utils
from keras import backend
from keras.models import Sequential
from keras.layers import Dense, Activation, Conv2D, MaxPooling2D, Flatten
from keras.utils import plot_model
from keras.callbacks import EarlyStopping
from keras.optimizers import SGD, RMSp... | juanlao7/CIFAR100-CNN | optimizer.py | Python | mit | 4,299 |
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This libra... | plq/spyne | spyne/util/gencpp.py | Python | lgpl-2.1 | 7,178 |
# Copyright 2020 KMEE INFORMATICA LTDA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ResCompany(models.Model):
_inherit = "res.company"
provedor_nfse = fields.Selection(
selection_add=[
("paulistana", "Paulistana"),
]
)... | OCA/l10n-brazil | l10n_br_nfse_paulistana/models/res_company.py | Python | agpl-3.0 | 321 |
from pylab import *
import numpy
import ardustat_library_simple as ard
import time
import subprocess
import os
import glob
import sys
#connecto to ardustat and setup resistance table
a = ard.ardustat()
a.trial_connect(7777)
a.debug = False
a.load_resistance_table(16)
#create arrays + a function for logging data
time... | kjiang8/Ardustat | Deprecated_Unsupported/Python_Client/sanitycheck_with_connect.py | Python | bsd-2-clause | 1,727 |
#
# Copyright 2004 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
#... | atzengin/OCC | ocvc-runtime/python/ocvc/oc/exceptions.py | Python | gpl-3.0 | 918 |
import logging
import StringIO
import csv
from django.utils.unittest.case import skipIf,skip
from datetime import datetime
from django.test import TestCase
from django.contrib.auth.models import User
from django.core import mail
from transit_subsidy.models import TransitSubsidy,Mode,TransitSubsidyModes,OfficeLocation
i... | cfpb/transit_subsidy | tests/transit_subsidy/view_tests.py | Python | cc0-1.0 | 10,909 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""An experimental library for reading and converting SVG.
This is an experimental converter from SVG to RLG (ReportLab Graphics)
drawings. It converts mainly basic shapes, paths and simple text.
The current intended usage is either as module within other projects:
f... | simonv3/svglib | src/svglib/svglib.py | Python | lgpl-3.0 | 38,674 |
#!/usr/bin/env pvbatch
from paraview.simple import *
import pviz
import sys
oviz = pviz.viz(sys.argv) # instantiate viz object (and load data)
part = pviz.makeSlice( y = 0. ) # make slice
oviz.view.CameraViewUp = [0,0,1]
oviz.view.CameraPosition = [0,1,0]
ResetCamera() # auto-adapt ca... | ruizanthony/pviz | examples/simple/cut_y0.py | Python | lgpl-3.0 | 573 |
from prices import Price
from saleor.cart.models import Cart
from saleor.dashboard.order.forms import ChangeQuantityForm
from saleor.order import models
from saleor.order.utils import add_items_to_delivery_group
def test_total_property():
order = models.Order(total_net=20, total_tax=5)
assert order.total.gro... | HyperManTT/ECommerceSaleor | tests/test_order.py | Python | bsd-3-clause | 2,747 |
# mako/parsetree.py
# Copyright (C) 2006-2015 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""defines the parse tree components for Mako templates."""
from mako import exceptions, ast, u... | sunze/py_flask | venv/lib/python3.4/site-packages/mako/parsetree.py | Python | mit | 20,434 |
# Grayscale Binary Filter Example
#
# This script shows off the binary image filter. You may pass binary any
# number of thresholds to segment the image by.
import sensor, image, time
sensor.reset()
sensor.set_framesize(sensor.QVGA)
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.skip_frames(time = 2000)
clock = time.c... | kwagyeman/openmv | scripts/examples/OpenMV/04-Image-Filters/grayscale_binary_filter.py | Python | mit | 1,098 |
# test if eval raises SyntaxError
try:
print(eval("[1, *a]"))
except SyntaxError:
print("SyntaxError")
| rubencabrera/micropython | tests/basics/builtin_eval_error.py | Python | mit | 112 |
# -*- python -*-
# Copyright (C) 2009-2013 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later versio... | darth-vader-lg/glcncrpi | tools/arm-bcm2708/gcc-linaro-arm-none-eabi-4.8-2014.04/arm-none-eabi/lib/thumb/v7ve/simdvfpv4/softfp/libstdc++.a-gdb.py | Python | gpl-3.0 | 2,462 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
SPELL=u'tàixī'
CN=u'太溪'
NAME=u'taixi41'
CHANNEL='kidney'
CHANNEL_FULLNAME='KidneyChannelofFoot-Shaoyin'
SEQ='KI3'
if __name__ == '__main__':
pass
| sinotradition/meridian | meridian/acupoints/taixi41.py | Python | apache-2.0 | 228 |
# Copyright (C) 2010-2017 GRNET S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed i... | grnet/synnefo | snf-cyclades-app/synnefo/logic/management/commands/floating-ip-create.py | Python | gpl-3.0 | 2,746 |
from fuzzconfig import FuzzConfig
import nonrouting
import fuzzloops
import re
cfg = FuzzConfig(job="REGCFG", device="LIFCL-40", sv="../shared/empty_40.v", tiles=["R2C2:PLC"])
def main():
cfg.setup()
empty = cfg.build_design(cfg.sv, {})
cfg.sv = "ff.v"
def per_slice(slicen):
for r in range(2)... | gatecat/prjoxide | fuzzers/LIFCL/011-reg-config/fuzzer.py | Python | isc | 4,624 |
"""Provides helper classes for testing option handling in pip
"""
import os
from pip._internal.cli import cmdoptions
from pip._internal.cli.base_command import Command
from pip._internal.commands import commands_dict
class FakeCommand(Command):
name = 'fake'
summary = name
def main(self, args):
... | techtonik/pip | tests/lib/options_helpers.py | Python | mit | 792 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# sale_contractmanagement
# (C) 2014 big-consulting GmbH
# (C) 2014 OpenGlobe
# Author: Thorsten Vocks (openBIG.org)
# Author: Mikołaj Dziurzyński, Grzegorz Grzelak (OpenGlobe)
#
# All Rights res... | openbig/odoo-contract | sale_contractmanagement/__openerp__.py | Python | agpl-3.0 | 4,630 |
import sys
if sys.version_info[:2] == (2, 6): # pragma: no cover
import unittest2 as unittest
else: # pragma: no cover
import unittest
class Test_asbool(unittest.TestCase):
def _callFUT(self, s):
from waitress.adjustments import asbool
return asbool(s)
def test_s_is_None(self):
... | grepme/CMPUT410Lab01 | virt_env/virt1/lib/python2.7/site-packages/waitress-0.8.9-py2.7.egg/waitress/tests/test_adjustments.py | Python | apache-2.0 | 5,260 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017, Zhijiang Yao, Jie Dong and Dongsheng Cao
# All rights reserved.
# This file is part of the PyBioMed.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the PyBioMed source tree.
"""
Used ... | gadsbyfly/PyBioMed | PyBioMed/PyPretreat/PyPretreatDNA.py | Python | bsd-3-clause | 15,091 |
import os
import pytest
from stingray.simulator import transfer
class TestSimulator(object):
@classmethod
def setup_class(self):
arr = [[1 for j in range(5)] for i in range(10)]
self.transfer = transfer.TransferFunction(arr)
def test_incorrect_rows(self):
"""Test if exception is ... | abigailStev/stingray | stingray/simulator/tests/test_transfer.py | Python | mit | 3,165 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from mock import Mock, patch
from sentry.models import Group
from sentry.testutils import TestCase
from sentry.tasks.post_process import (
post_process_group, record_affected_user, record_affected_code,
record_additional_tags
)
class PostProces... | llonchj/sentry | tests/sentry/tasks/post_process/tests.py | Python | bsd-3-clause | 5,333 |
import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, json_output
@click.command('show_repository')
@click.argument("toolShed_id", type=str)
@pass_context
@custom_exception
@json_output
def cli(ctx, toolShed_id):
"""Get details of a given Tool Shed repository... | galaxy-iuc/parsec | parsec/commands/toolshed/show_repository.py | Python | apache-2.0 | 875 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 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 indico.web.http_api.metadata.json import JSONSerializer
class JSONPSerializer(JSONSerializer):
... | pferreir/indico | indico/web/http_api/metadata/jsonp.py | Python | mit | 563 |
"""This script finds all '.properties-MERGED' files and writes relative path, key, and value to a CSV file.
This script requires the python libraries: gitpython, jproperties, pyexcel-xlsx, xlsxwriter and pyexcel. As a
consequence, it also requires git >= 1.7.0 and python >= 3.4. This script relies on fetching 'HEAD' ... | eugene7646/autopsy | release_scripts/localization_scripts/allbundlesscript.py | Python | apache-2.0 | 2,950 |
# coding=utf-8
"""Test cases for Zinnia's feeds"""
try:
from urllib.parse import urljoin
except ImportError: # Python 2
from urlparse import urljoin
from django.test import TestCase
from django.utils import timezone
from django.utils.encoding import smart_text
from django.contrib.sites.models import Site
from... | Maplecroft/django-blog-zinnia | zinnia/tests/test_feeds.py | Python | bsd-3-clause | 18,700 |
# TODO: Setup
| mjkmoynihan/ReleaseRadar | setup.py | Python | apache-2.0 | 15 |
import abc
import string
import numpy as np
class BaseConstituent(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def speed(self, astro):
pass
@abc.abstractmethod
def V(self, astro):
pass
@abc.abstractmethod
def u(self, astro):
pass
@abc.abstractmet... | sealevelresearch/pytides | pytides/constituent/base_constituent.py | Python | mit | 993 |
# ebscopy __init__
import os
import logging
from ebscopy import *
log_levels = {
'DEBUG': logging.DEBUG,
'INFO': logging.INFO,
'WARNING': logging.WARNING,
'ERROR': logging.ERROR,
'CRITICAL': logging.CRITICAL,
}
if os.environ.get('EDS_L... | jessejensen/ebscopy | ebscopy/__init__.py | Python | gpl-3.0 | 629 |
from nose.tools import *
from git_orm.testcases import GitTestCase
from git_orm import transaction, GitError
class TestException(Exception): pass
class TestTransaction(GitTestCase):
def test_commit(self):
transaction.begin()
trans = transaction.current()
trans.set_blob(['foo'], 'bar'.en... | natano/python-git-orm | git_orm/tests/test_transaction.py | Python | isc | 3,962 |
import random
# generate a random bit order
# you'll need to save this mapping permanently, perhaps just hardcode it
# map how ever many bits you need to represent your integer space
mapping = range(34)
mapping.reverse()
# alphabet for changing from base 10
chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
# shuffle t... | klanestro/vortaro | words/tools.py | Python | gpl-3.0 | 1,001 |
import ConfigParser
import requests
import datetime
import pytz
import pika
import sys
import json
from pymongo import MongoClient
integration_name = 'venmo'
access_token = ''
venmo_id = ''
g_user_id = ''
connection = None
channel = None
def setup_pika():
global connection
global channel
connection = pika... | golf1052/yhackslackpack | integrations/venmo/venmo.py | Python | mit | 16,352 |
# tests/products/test_ninja.py ----------------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.tx... | rudkx/swift | utils/swift_build_support/tests/products/test_ninja.py | Python | apache-2.0 | 4,144 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.