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
# coding:utf-8
import os
from bottle import Bottle
from toughradius.console.base import *
app = Bottle()
@app.route('/static/:path#.+#')
def route_static(path, render):
static_path = os.path.join(os.path.split(os.path.split(__file__)[0])[0], 'static')
return static_file(path, root=sta... | tx137884746/IzayoiMiku | toughradius/console/control/control.py | Python | agpl-3.0 | 521 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.test import TestCase, Client
from django.contrib.auth.models import User
import models
import json
import forms
import requests
import random
from datetime import date
from decimal import *
import string
import os
import sys
#import settings
"""
Test Login
... | exildev/Piscix | usuarios/tests.py | Python | mit | 17,758 |
"""hal9000-scheduler __init__.py"""
# pylint: disable=C0103,C0111
import logging
from time import sleep
import dataset
import praw
import requests
import schedule
__author__ = 'PraiseBeToScience'
__copyright__ = 'Copyright 2017 PraiseBeToScience'
__credits__ = ['PraiseBeToScience']
__license__ = 'MIT'
__version__ = '... | r-worldnews/hal9000-scheduler | hal9000/__init__.py | Python | mit | 1,895 |
#!/usr/bin/python
# System imports
# Panda Engine imports
# Game imports
from eventManager import EventMgr
from physicsManager import PhysicsMgr
from input.input import Input
from camera.camera import Camera
from level.level import Level
from player.player import Player
#----------------------------... | grimfang/lext | core/game.py | Python | mit | 2,260 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import... | tysonholub/twilio-python | twilio/rest/sync/v1/service/sync_list/sync_list_item.py | Python | mit | 20,321 |
# Apple modle
#encoding=utf-8
from Category.Fruit import Fruit
class Apple(Fruit):
def __init__(self, name, size):
super(Apple, self).__init__(name)
self.size = size
def getSize(self):
return self.size
apple = Apple("apple", 12)
print(apple.getName())
print(apple.getSize()) | InverseLina/python-practice | Category/Apple.py | Python | apache-2.0 | 318 |
# Scan an Apple header file, generating a Python file of generator calls.
import sys
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
LONG = "Fonts"
SHORT = "fm"
def main():
input = "Fonts.h"
output = SHORT + "gen.py"
defsoutput = TOOLBOXDIR + LONG + ".... | teeple/pns_server | work/install/Python-2.7.4/Mac/Modules/fm/fmscan.py | Python | gpl-2.0 | 2,554 |
"""Plotting module for Sympy.
A plot is represented by the ``Plot`` class that contains a reference to the
backend and a list of the data series to be plotted. The data series are
instances of classes meant to simplify getting points and meshes from sympy
expressions. ``plot_backends`` is a dictionary with all the bac... | hrashk/sympy | sympy/plotting/plot.py | Python | bsd-3-clause | 62,275 |
"""
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2017 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
-----------------------------------... | pupil-labs/hmd-eyes | python_reference_client/zmq_tools.py | Python | lgpl-3.0 | 5,307 |
# Copyright (c) 2011 Stanford University
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ... | taschik/ramcloud-load-manager | scripts/dumpstr.py | Python | isc | 3,952 |
import os
import pipes
import re
from subprocess import Popen, PIPE
from django.utils import six
from assetfiles.exceptions import FilterError
class CommandMixin(object):
def run_command(self, command, extra_env=None, exception_type=None):
if not exception_type:
exception_type = FilterError
... | localmed/django-assetfiles | assetfiles/filters/mixins.py | Python | mit | 5,408 |
#!/usr/bin/env python
import numpy as np
# matplotlib requires wxPython 2.8+
# set the wxPython version in lib\site-packages\wx.pth file
# or if you have wxversion installed un-comment the lines below
#import wxversion
#wxversion.ensureMinimal('2.8')
import wx
import matplotlib
matplotlib.interactive(False)
matplotli... | bundgus/python-playground | matplotlib-playground/examples/user_interfaces/fourier_demo_wx.py | Python | mit | 8,955 |
#!/usr/bin/env python
# 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that i... | avocado-framework/avocado-misc-tests | memory/libhugetlbfs.py | Python | gpl-2.0 | 4,479 |
#!/usr/bin/env python3
# Author: Fupan Li <fupan.li@windriver.com>, Amy Fong <amy.fong@windriver.com>
import os
from distutils.core import setup
packages = [
"Overc",
"Overc.backends"
]
setup(name = "overc",
scripts=["overc"],
version="1.2",
description="OverC ... | masselstine/meta-overc | meta-cube/recipes-support/overc-system-agent/files/overc-system-agent-1.2/setup.py | Python | mit | 475 |
#!/usr/bin/env python
"""
Retrieve list up Slurm controllers
"""
import socket
import pyslurm
def controller_up(controller=0):
"""Check if controller up via ping"""
try:
pyslurm.slurm_ping(controller)
except ValueError as ping_error:
print(f"Failed - {ping_error.args[0]}")
else:
... | PySlurm/pyslurm | examples/controllers.py | Python | gpl-2.0 | 1,261 |
# -*- test-case-name: twisted.conch.test.test_conch -*-
#
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
#
# $Id: conch.py,v 1.65 2004/03/11 00:29:14 z3p Exp $
#""" Implementation module for the `conch` command.
#"""
from twisted.conch.client import connect, default, options
from t... | hlzz/dotfiles | graphics/VTK-7.0.0/ThirdParty/Twisted/twisted/conch/scripts/conch.py | Python | bsd-3-clause | 18,638 |
# encoding: utf-8
import ctypes
from evdev import ecodes
_u8 = ctypes.c_uint8
_u16 = ctypes.c_uint16
_u32 = ctypes.c_uint32
_s16 = ctypes.c_int16
class Replay(ctypes.Structure):
'''
Defines scheduling of the force-feedback effect
@length: duration of the effect
@delay: delay before effect should st... | twitchyliquid64/misc-scripts | rfid_reader/python-evdev-master/evdev/ff.py | Python | mit | 4,643 |
from numpy.testing import *
from numpy import array
import math
import util
class TestF77Callback(util.F2PyTest):
code = """
subroutine t(fun,a)
integer a
cf2py intent(out) a
external fun
call fun(a)
end
subroutine func(a)
cf2py intent(in,out) a
integer a
... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/numpy/f2py/tests/test_callback.py | Python | agpl-3.0 | 1,740 |
import pytest
from tests.support.asserts import assert_success
"""
Tests that WebDriver can transcend site origins.
Many modern browsers impose strict cross-origin checks,
and WebDriver should be able to transcend these.
Although an implementation detail, certain browsers
also enforce process isolation based on si... | scheib/chromium | third_party/blink/web_tests/external/wpt/webdriver/tests/get_title/iframe.py | Python | bsd-3-clause | 2,183 |
#!/usr/bin/env python
# Unix SMB/CIFS implementation.
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008
#
# Based on the original in EJS:
# Copyright (C) Andrew Tridgell <tridge@samba.org> 2005
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General P... | gwr/samba | source4/scripting/python/samba/__init__.py | Python | gpl-3.0 | 11,696 |
from numpy import sqrt, cos
def objective_function(params):
x1 = params[0]
x2 = params[1]
# return (x1**2 + x2**2)
return ( 1.0 + 1.0/4000.0*(x1**2 + x2**2) - ( cos(x1/sqrt(1.0))*cos(x2/sqrt(2.0)) ) )
| jkleve/Optimization-Algorithms | particle_swarm_optimization/pso_objective_function.py | Python | mit | 218 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import serpscrap
keywords = ['stellar']
config = serpscrap.Config()
config.set('scrape_urls', False)
scrap = serpscrap.SerpScrap()
scrap.init(config=config.get(), keywords=keywords)
results = scrap.as_csv('/tmp/output')
| ecoron/SerpScrap | examples/example_csv.py | Python | mit | 266 |
'''
Copyright (C) Espec North America, INC. - All Rights Reserved
Written by Myles Metzler mmetzler@espec.com, Dec. 2017
SCP220 debug port handler.
'''
import struct
import serial
from serial import SerialException
class SCP220DebugError(Exception):
'''generic error'''
pass
class SCP220Debug(object):
'''... | EspecNorthAmerica/ChamberConnectLibrary | chamberconnectlibrary/scp220debug.py | Python | mit | 6,095 |
config = {
# application name
'app_name': "RouteEdu",
'environment': "boilerplate",
# the default language code for the application.
# should match whatever language the site uses when i18n is disabled
'app_lang': 'en',
# contact page email settings
'contact_sender': "gettingback2bas... | Back2Basics/routeedu | bp_content/themes/redu/config/config.py | Python | lgpl-3.0 | 3,398 |
import unittest
from unittest.mock import (
call, _Call, create_autospec, MagicMock,
Mock, ANY, _CallList, patch, PropertyMock
)
from datetime import datetime
class SomeClass(object):
def one(self, a, b):
pass
def two(self):
pass
def three(self, a=None):
pass
class AnyT... | timm/timmnix | pypy3-v5.5.0-linux64/lib-python/3/unittest/test/testmock/testhelpers.py | Python | mit | 25,759 |
#!/usr/bin/python
#
# Copyright (c) 2018 Yunge Zhu <yungez@microsoft.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | Jorge-Rodriguez/ansible | lib/ansible/modules/cloud/azure/azure_rm_virtualnetworkpeering.py | Python | gpl-3.0 | 15,198 |
#
# Copyright 2015 Free Software Foundation, Inc.
#
# This file is part of PyBOMBS
#
# PyBOMBS 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.
#
# PyB... | namccart/pybombs | pybombs/utils/sysutils.py | Python | gpl-3.0 | 4,522 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 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
# l... | stormi/tsunami | src/primaires/objet/commandes/oedit/__init__.py | Python | bsd-3-clause | 3,339 |
import json
import os
import socket
import sys
import threading
import time
import traceback
import urlparse
import uuid
from .base import (CallbackHandler,
RefTestExecutor,
RefTestImplementation,
TestharnessExecutor,
extra_timeout,
... | larsbergstrom/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorwebdriver.py | Python | mpl-2.0 | 18,381 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-04-07 16:21
from __future__ import unicode_literals
from decimal import Decimal
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migration(migr... | libretees/libreshop | libreshop/inventory/migrations/0001_initial.py | Python | gpl-3.0 | 3,631 |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# projectRasters.py
# Created on: 2017-04-06 13:38:29.00000
# (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------
# Import arcpy module
im... | SouthForkResearch/StreamTemperature | Python_utilities/projectRasters.py | Python | gpl-3.0 | 1,438 |
#!/usr/bin/python
import plmd.plotData as myPlot
# == Takes energy data from MD logs and plots it
# ==============================================
# Function for running the actual analysis
def runAnalysis( caseDir ):
print "Creating plot of potential energy"
myPlot.plotData(
caseDir+"/analysis/plot... | MathiasGruber/plmd | src/plmd/caseAnalyses/energy.py | Python | gpl-2.0 | 997 |
import cv2
import numpy as np
from matplotlib import pyplot as plt
#roi is the object or region of object we need to find
roi = cv2.imread('rose_red.png')
hsv = cv2.cvtColor(roi,cv2.COLOR_BGR2HSV)
#target is the image we search in
target = cv2.imread('rose.png')
hsvt = cv2.cvtColor(target,cv2.COLOR_BGR2HSV)
M = cv2.... | abidrahmank/MyRoughWork | blog_works/hist_backprojection_implementation.py | Python | mit | 1,091 |
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2012, Luis Pedro Coelho <luis@luispedro.org>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# License: MIT. See COPYING.MIT file in the milk distribution
from __future__ import division
import numpy as np
__all__ = [
'pdist',
'plike',
]
def pdist(X, Y=Non... | pombredanne/milk | milk/unsupervised/pdist.py | Python | mit | 1,948 |
import unittest
from fault_detection.binomial_detector import BinomialDetector
from test_case_reports.status import Status
from fault_detection.tests.results_builder import a_test_result_history
class TestDetector(unittest.TestCase):
def setUp(self):
self.detector = BinomialDetector(10, 0.1, lambda x: x... | droc/prob_fail_detector | fault_detection/tests/test_detector.py | Python | mit | 1,659 |
from robot.api.deco import keyword
def defined_twice():
1/0
@keyword('Defined twice')
def this_time_using_custom_name():
2/0
def defined_thrice():
1/0
def definedThrice():
2/0
def Defined_Thrice():
3/0
@keyword('Embedded ${arguments} twice')
def embedded1(arg):
1/0
@keyword('Embedded ${a... | ChrisHirsch/robotframework | atest/testdata/keywords/DupeKeywords.py | Python | apache-2.0 | 372 |
# Straight import from https://github.com/simonw/django-queryset-transform
"""
django_queryset_transform
=========================
Allows you to register a transforming map function with a Django QuerySet
that will be executed only when the QuerySet itself has been evaluated.
This allows you to build optimisations l... | feincms/feincms | feincms/utils/queryset_transform.py | Python | bsd-3-clause | 4,315 |
from __future__ import print_function
import os
from fabric.operations import local
from fabric.context_managers import hide
from harvest.decorators import cli
__doc__ = """\
Updates this Harvest package.
"""
@cli(description=__doc__)
def parser(options):
with hide('running'):
bindir = os.path.dirname(loc... | chop-dbhi/harvest | harvest/commands/update.py | Python | bsd-2-clause | 487 |
# This file is part of ZS
# Copyright (C) 2013-2014 Nathaniel Smith <njs@pobox.com>
# See file LICENSE.txt for license information.
# Quirky things about how the command system works here:
# - we use docopt: http://docopt.org
# - we store the --help text for each command as the docstring for the
# relevant function.... | njsmith/zs | zs/cmdline/main.py | Python | bsd-2-clause | 4,511 |
import src
import random
class TeleporterArtwork(src.items.Item):
"""
ingame item that allows the player the convert ressources and
items by trading
"""
type = "TeleporterArtwork"
def __init__(self):
"""
configure the superclass
"""
self.doAutoTrade = True
... | MarxMustermann/OfMiceAndMechs | src/itemFolder/artworks/teleporterArtwork.py | Python | gpl-3.0 | 1,977 |
"""CGI-savvy HTTP Server.
This module builds on SimpleHTTPServer by implementing GET and POST
requests to cgi-bin scripts.
If the os.fork() function is not present (e.g. on Windows),
os.popen2() is used as a fallback, with slightly altered semantics; if
that function is not present either (e.g. on Macintosh), only Py... | remybaranx/qtaste | tools/jython/lib/Lib/CGIHTTPServer.py | Python | gpl-3.0 | 10,968 |
#!/usr/bin/env python
# Copyright 2020 The Cobalt 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 r... | youtube/cobalt | tools/download_from_gcs.py | Python | bsd-3-clause | 5,315 |
from __future__ import division
from datetime import datetime
import collect_ncs_files
from glob import glob
import cPickle as pickle
import unittest
import get_mtz
import shutil
import sys
import os
def run():
c = collect_ncs_files.ncs_paper_data_collection()
file_list = glob(os.path.join(c.model_vs_data_dir,'*.... | youdar/work | work/NCS/ncs_paper/find_files_without_model_vs_data.py | Python | mit | 600 |
# 1. Strip non alphabetic
inputStr = "I may opt for a top yam for Amy, May, and Tommy."
import re
regex = re.compile('[^a-zA-Z ]')
output = regex.sub('',inputStr)
# 2. Convert letters to lower case
output = output.lower()
# 3. sort all the letters within each word
# 4. also eliminate duplicates
DicOfWords = {}
for word... | meisamhe/GPLshared | Research_Projects_UTD/Data_Science/some_python.py | Python | gpl-3.0 | 988 |
"""
Test suite for ParasitoidModel, for use with py.test
Created on Fri May 08 12:12:19 2015
Author: Christopher Strickland
Email: wcstrick@live.unc.edu
"""
import pytest
import numpy as np
import math
from scipy import sparse, signal
import ParasitoidModel as PM
import globalvars
##################################... | mountaindust/Parasitoids | tests/test_ParsitoidModel.py | Python | gpl-3.0 | 14,934 |
# This file is part of rhizi, a collaborative knowledge graph editor.
# Copyright (C) 2014-2015 Rhizi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of... | ozFri/rhizi | rhizi/rz_api_websocket.py | Python | agpl-3.0 | 5,219 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2013, 2014, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of th... | dset0x/invenio | invenio/legacy/bibclassify/config.py | Python | gpl-2.0 | 9,975 |
# -*- coding: utf-8 -*-
#
# setup.py
# cjktools
#
"""
Package setup file for the cjktools package.
"""
import sys
from setuptools import setup
from scripts.load_as_rst import convert
try:
from setuptools_scm import get_version
VERSION = get_version()
with open('cjktools/__version__.py', 'w') as f:
... | larsyencken/cjktools | setup.py | Python | bsd-3-clause | 1,700 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.conf import settings
from django.utils.translation import ungettext, ugettext_lazy as _
from events.models import Event, EventDate, ImageGallery, VideoGallery
from widgets import AdminImageWidget, AdminYoutubeWidget
class EventDateInline(admin.Tabul... | jtuz/django-events-calendar | events/admin.py | Python | bsd-3-clause | 4,157 |
from kuai import Kuai, set_backend
from time import sleep
x = 0
def test_kuai_events():
set_backend('threaded')
def increment():
global x
x += 1
Kuai.on('test', increment)
Kuai.emit('test')
sleep(0.01)
assert x == 1
Kuai.emit('test')
sleep(0.01)
assert x == 2
| Duroktar/Kuai | tests/test_threaded_backend.py | Python | mit | 318 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | tsdmgz/ansible | lib/ansible/module_utils/vyos.py | Python | gpl-3.0 | 5,298 |
# -*- coding: utf-8 -*-
"""Test the MediaFile object."""
import os
import pytest
from parker import mediafile, client
from test_client import client_fixture
import utils
TEST_URI = "http://www.staples.co.uk/content/images/product/uk_412852_1_xnl.jpg"
TEST_FILE = "/tmp/somewhere"
EXPECTED_FILENAME = "/tmp/somewhere.jp... | nefarioustim/parker | test/test_mediafile.py | Python | gpl-3.0 | 1,392 |
from django.conf.urls import patterns, include, url
from . import views
urlpatterns = patterns('',
# Examples:
url(r'^$', views.home, name='home'),
)
| sisch/django_weltherrschaft | weltherrschaft/blog/urls.py | Python | gpl-3.0 | 165 |
import random
import numpy
num_bees=1000
num_workers=1000
class Bee:
at=1
hp=2
mp=0
ammo=1
panic=False
def __init__(self):
self.warmonger=numpy.random.power(2)
def be_alert(self,defcon,enemy):
if defcon >= (1.0-self.warmonger):##go attack!
self.attack(enemy)
... | omsktransmash/ScientificPythonTutorial | Aerry Choi/behive_2.py | Python | apache-2.0 | 1,460 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | jeffery9/mixprint_addons | stock/wizard/stock_inventory_merge.py | Python | agpl-3.0 | 3,815 |
# 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 use ... | apache/libcloud | libcloud/dns/drivers/google.py | Python | apache-2.0 | 12,381 |
from mongrel2.config import *
main = Server(
uuid="f400bf85-4538-4f7a-8908-67e313d515c2",
access_log="/logs/access.log",
error_log="/logs/error.log",
chroot="./",
default_host="localhost",
name="test",
pid_file="/run/mongrel2.pid",
port=6767,
hosts = [
Host(name="localhost"... | bnoordhuis/mongrel2 | examples/configs/multi_conf.py | Python | bsd-3-clause | 1,384 |
# ScummVM - Graphic Adventure Engine
#
# ScummVM is the legal property of its developers, whose names
# are too numerous to list here. Please refer to the COPYRIGHT
# file distributed with this source distribution.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU ... | chrisws/scummvm | devtools/tasmrecover/tasm/parser.py | Python | gpl-2.0 | 7,312 |
from blog import app, db, create_token, validate_token
from blog.comments import Comment
from blog.posts import get_post
from flask import Blueprint, abort, flash, render_template, request, \
session, url_for, redirect, g, jsonify
blueprint = Blueprint('comments', __name__)
def get_comment(id):
try:
... | FelixLoether/blog-project | blog/comments/views.py | Python | mit | 4,603 |
# (c) 2018 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is dis... | alxgu/ansible | test/units/modules/network/cnos/test_cnos_vlan.py | Python | gpl-3.0 | 7,341 |
from pathlib import PurePath
import pytest
from fauxfactory import gen_string
from nailgun import entities
from robottelo.cli.factory import make_scapcontent
from robottelo.config import robottelo_tmp_dir
from robottelo.config import settings
from robottelo.constants import OSCAP_PROFILE
from robottelo.helpers import... | rplevka/robottelo | pytest_fixtures/oscap_fixtures.py | Python | gpl-3.0 | 2,237 |
"""
Author: Ramaneek Gill
This program uses Multinomial Naive Bayes to predict tweet sentiments.
By default this trains on only 10% of the available dataset so that
old machines or laptops don't run into 12+ GB RAM usage.
Also by default this program only uses the top 2000 most common words
as features to save compu... | RamaneekGill/Twitter-Sentiment-Analysis | NaiveBayes/train_sklearn_NaiveBayes.py | Python | gpl-3.0 | 11,388 |
import unittest
from meteora import requestor
class TestRequestor(unittest.TestCase):
def setUp(self):
self.url = 'http://echo.jsontest.com/'
def test_generate_one_request(self):
my_requestor = requestor.Requestor(number_of_requests=1, url=self.url)
my_requestor.start_requests()
... | raulcd/meteora | tests/test_requestor.py | Python | mit | 960 |
"""
Iterator based sre token scanner
"""
import sre_parse, sre_compile, sre_constants
from sre_constants import BRANCH, SUBPATTERN
from re import VERBOSE, MULTILINE, DOTALL
import re
__all__ = ['Scanner', 'pattern']
FLAGS = (VERBOSE | MULTILINE | DOTALL)
class Scanner(object):
def __init__(self, lexicon, flags=FL... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-0.96/django/utils/simplejson/scanner.py | Python | bsd-3-clause | 2,009 |
#
# 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... | datawire/qpid-proton | proton-c/bindings/python/proton/reactor.py | Python | apache-2.0 | 26,371 |
import xmltodict
with open('plugin.video.flix2kodi/addon.xml') as fd:
doc = xmltodict.parse(fd.read())
print doc['addon']['@version'] | marcelveldt/plugin.video.flix2kodi | read_version.py | Python | gpl-2.0 | 142 |
import argparse, sys, unittest
CODE = {'A': '.-', 'B': '-...', 'C': '-.-.',
'D': '-..', 'E': '.', 'F': '..-.',
'G': '--.', 'H': '....', 'I': '..',
'J': '.---', 'K': '-.-', 'L': '.-..',
'M': '--', 'N': '-.', 'O': '---',
'P': '.--.', 'Q': '--.-',... | AndreeaChiurciu/morse | morse_enc_dec/mencdec.py | Python | apache-2.0 | 2,937 |
import subprocess
subprocess.call("""
adb -d shell am start -a android.media.action.IMAGE_CAPTURE
& adb -d shell input keyevent 27
""")
| carabri/carabri | test_script/take_picture.py | Python | apache-2.0 | 138 |
"""
ideskeleton
=====
Build required files to work with IDE's such as solution and project files.
-----------------
Notes
-----
Currently just Visual Studio is supported.
"""
from .builder import build
| jruizaranguren/ideskeleton | ideskeleton/__init__.py | Python | mit | 208 |
from smoid.languages import Check, CheckCollection
class PythonConsoleLineStartCheck (Check):
def __init__ (self):
Check.__init__(self)
self.name = "PythonConsole:LineStart"
self.example = ">>> 1 + 1"
self.add_language("python_console")
self.add_multiple_matches("(?:^|\n|\r... | ThQ/p8ste | src/libs/smoid/languages/lang_python_console.py | Python | gpl-3.0 | 482 |
from django.db import models
from livefield import LiveField
from livefield import LiveManager
from livefield import LiveModel
class Item(LiveModel):
pass
class Person(models.Model):
name = models.CharField(max_length=20)
live = LiveField()
class Meta:
unique_together = ('name', 'live')
... | hearsaycorp/django-livefield | tests/models.py | Python | mit | 404 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import shutil
import subprocess
import sys
import tempfile
def _Usage():
print 'Usage: merge_static_libs OUTPUT_LIB IN... | HalCanary/skia-hc | tools/merge_static_libs.py | Python | bsd-3-clause | 2,162 |
from zeit.cms.interfaces import ICMSContent
import mock
import zeit.push.influxdb
import zeit.push.testing
import zeit.push.urbanairship
class ConnectionTest(zeit.push.testing.TestCase):
def test_posts_data_as_json(self):
api = zeit.push.influxdb.Connection(
None, None, None, None, None)
... | ZeitOnline/zeit.push | src/zeit/push/tests/test_influxdb.py | Python | bsd-3-clause | 874 |
# coding=utf-8
from query import Query
from sql import build_select
from exception import MonSQLException
class DataRow:
def __init__(self, keyvalue_map):
self.__data = keyvalue_map
def __getattr__(self, attrname):
if self.data.has_key(attrname):
return self.data[attrname]
... | firstprayer/monsql | monsql/queryset.py | Python | mit | 3,349 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
## emu-net-device.h: ns3::EmuNetDevice [class]
module.add_class('EmuNetDevice', parent=root_module['ns3::NetDevice'])
## emu-net-device.h: ns3::EmuNetDevice... | subailong/ns3-wireless-planning.ns-3 | bindings/python/apidefs/gcc-LP64/ns3_module_emu.py | Python | gpl-2.0 | 13,640 |
# Copyright 2018 The trfl 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 law... | deepmind/trfl | trfl/clipping_ops_test.py | Python | apache-2.0 | 2,945 |
import unittest
import json
from autosportlabs.racecapture.data.sampledata import Sample
TEST_SAMPLE1 = '{"s":{"t":33,"meta":[{"nm":"Battery","ut":"Volts","sr":1},{"nm":"AccelX","ut":"G","sr":25},{"nm":"AccelY","ut":"G","sr":25},{"nm":"AccelZ","ut":"G","sr":25},{"nm":"Yaw","ut":"Deg/Sec","sr":25},{"nm":"Latitude","ut"... | ryandoherty/RaceCapture_App | test/autosportlabs/racecapture/data/test_sampledata.py | Python | gpl-3.0 | 1,940 |
from setuptools import setup, find_packages
version = '0.1'
with open('README.rst', 'rt') as readme:
description = readme.read()
with open('CHANGES.txt', 'rt') as changes:
history = changes.read()
setup(
name='keyboardtools',
version=version,
description="",
long_description=description + '... | regebro/keyboardtools | setup.py | Python | mit | 1,032 |
from __future__ import absolute_import, print_function, division, unicode_literals
import numpy as np
def normalize_saliency_map(saliency_map, cdf, cdf_bins):
""" Normalize saliency to make saliency values distributed according to a given CDF
"""
smap = saliency_map.copy()
shape = smap.shape
sma... | matthias-k/pysaliency | pysaliency/metrics.py | Python | mit | 3,414 |
# -*- encoding: utf-8 -*-
from shapely.wkt import loads as wkt_loads
import dsl
from . import FixtureTest
class DisusedRailwayStations(FixtureTest):
def test_old_south_ferry(self):
# Old South Ferry (1) (disused=yes)
self.generate_fixtures(dsl.way(2086974744, wkt_loads('POINT (-74.01325716895789 ... | mapzen/vector-datasource | integration-test/368-disused-railway-stations.py | Python | mit | 1,153 |
#!python3
def get_longest_lines(n, in_list):
'''(int, list of strings) -> (list of strings)
Returns n longest lines in the given list of strings in_list.
The returned list are sorted by string length in descending order.
>>> get_longest_lines(2, ['Hello World', 'CodeEval', 'Quick Fox', 'A', 'Sa... | tvotyakov/codeeval | moderate/longest-lines/code.py | Python | gpl-2.0 | 1,477 |
# Copyright 2012 Lee Verberne <lee@blarg.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is dis... | kafana/ubik | lib/ubik/fab/distutils.py | Python | gpl-3.0 | 6,747 |
# 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... | gunan/tensorflow | tensorflow/python/keras/layers/preprocessing/text_vectorization_test.py | Python | apache-2.0 | 69,871 |
#!/usr/bin/env python
import pprint
import re
import os, sys
import unittest
sys.path[0:0] = ['.', '..']
from pycparser import c_parser
from pycparser.c_ast import *
from pycparser.c_parser import CParser, Coord, ParseError
_c_parser = c_parser.CParser(
lex_optimize=False,
yacc_debug... | rwbogl/gbg | pycparser/tests/test_c_parser.py | Python | mit | 63,146 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A script for generating contributor lists for astropy.
Note that this requires GitPython (https://gitpython.readthedocs.org).
"""
from __future__ import print_function, division
import os
from git import Repo
def log_repos(repos, logformat, moreargs=None, append_repo... | astropy/astropy-tools | discontinued_usage/author_lists.py | Python | bsd-3-clause | 2,940 |
# This Python file uses the following encoding: utf-8
# (C) 2020 Muthiah Annamalai
# This file is part of open-tamil project
import string
from tamil.numeral import num2tamilstr
from tamil.utf8 import get_letters
def normalize_numeral_text(text_tokens):
"""
Input @text_tokens = ["இரு","நண்பர்கள்","௹","100","... | Ezhil-Language-Foundation/open-tamil | tamiltts/normalize.py | Python | mit | 3,157 |
#!/usr/bin/env python
import sys
import json
import codecs
import traceback
import zipimport
importer = zipimport.zipimporter('landmark.mod')
extraction = importer.load_module('extraction')
postprocessing = importer.load_module('postprocessing')
from extraction.Landmark import RuleSet
current_id = None
with codec... | usc-isi-i2/landmark-extraction | src/mr_landmark_seq_mapper.py | Python | apache-2.0 | 1,564 |
'''
Created on Dec 21, 2013
This program is a work in progress and is not yet finished
Requires Python3
@author: Mgamerz
'''
import os
import time
import configparser
import imagehandler
import threading
import sqlite3
from distutils.version import StrictVersion
from datetime import datetime
from tkinter import *
from... | Mgamerz/Fresh-Set-of-Images | FSOI/freshsetofimages.py | Python | gpl-3.0 | 14,258 |
import time
import datetime
import sys
import getopt, argparse
from collections import defaultdict
import json
import MySQLdb
import unicodecsv
import pprint
ITEM_MAP_VARCHAR_INSERT = "insert into item_map_varchar (item_id, attr_id, value) values ((select item_id from items where client_item_id = %(id)s),(select attr_... | smrjan/seldon-server | python/seldon/cli/import_items_utils.py | Python | apache-2.0 | 7,792 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | markope/AutobahnPython | autobahn/wamp/websocket.py | Python | mit | 10,461 |
'''
Usage:
$ python ss13_genchangelog.py [--dry-run] html/changelog.html html/changelogs/
ss13_genchangelog.py - Generate changelog from YAML.
Copyright (C) 2013-2015 Rob "N3X15" Nelson <nexis@7chan.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated ... | mph55/lanstation13 | tools/ss13_genchangelog.py | Python | gpl-3.0 | 8,613 |
# -*- coding: utf-8 -*-
# Copyright(C) 2011-2012 Romain Bignon, Laurent Bachelier, Benjamin Drieu
#
# This file is part of weboob.
#
# weboob 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 ver... | sputnick-dev/weboob | modules/trictractv/browser.py | Python | agpl-3.0 | 2,569 |
# coding=utf-8
# Copyright 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... | redhat-imaging/novaimagebuilder | novaimagebuilder/OSInfo.py | Python | apache-2.0 | 9,961 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2004-2012 Pexego Sistemas Informáticos All Rights Reserved
# $Marta Vázquez Rodríguez$ <marta@pexego.es>
#
# This program is free software: you can redistribute it and/or modify
# it unde... | Pexego/alimentacion | sales_forecast/__openerp__.py | Python | agpl-3.0 | 1,741 |
import kindred
import pytest
import pickle
import tempfile
from kindred.datageneration import generateData,generateTestData
def test_pickle():
trainCorpus, testCorpusGold = generateTestData(positiveCount=100,negativeCount=100)
predictionCorpus = testCorpusGold.clone()
predictionCorpus.removeRelations()
classifi... | jakelever/kindred | tests/test_pickle.py | Python | mit | 707 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from mock import patch
from sentry.api.serializers import serialize
from sentry.models import (
GroupResolution, GroupResolutionStatus, GroupSnooze, GroupSubscription,
GroupStatus, ... | alexm92/sentry | tests/sentry/api/serializers/test_group.py | Python | bsd-3-clause | 3,998 |
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
import re
class ComplexPasswordValidator(object):
def validate(self, password, user=None):
regex = '(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@#!%*?&])[A-Za-z\d$@#!%*?&]'
if not re.match(regex, passwo... | foundertherapy/django-users-plus | accountsplus/validators.py | Python | mit | 711 |
import os
import random
import time
import ConfigParser
from unittest import TestCase
from pysphere import VIServer, VMPowerState, ToolsStatus
class VIVirtualMachineTest(TestCase):
@classmethod
def setUpClass(cls):
config_path = os.path.join(os.path.dirname(__file__), "config.ini")
cls.config... | MountainMan22/Boto-Automation | tests/test_vi_virtual_machine.py | Python | gpl-2.0 | 11,730 |
# Copyright (c) 2008-2010, Michigan State University
"""
A simple wrapper implementing a pygr-compatible SequenceDB based on screed.
There are two implementions:
- ScreedSequenceDB
- ScreedSequenceDB_ByIndex
ScreedSequenceDB uses the sequence name as the sequence ID, which
mimics the behavior of pygr's SequenceFil... | poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/screed-0.7.1-py2.7.egg/screed/pygr_api.py | Python | apache-2.0 | 4,937 |
# This file is part of Pimlico
# Copyright (C) 2020 Mark Granroth-Wilding
# Licensed under the GNU LGPL v3.0 - https://www.gnu.org/licenses/lgpl-3.0.en.html
"""
Text normalization for raw text documents.
Similar to :mod:`~pimlico.modules.text.normalize` module, but operates on raw text,
not pre-tokenized text, so pro... | markgw/pimlico | src/python/pimlico/modules/text/text_normalize/info.py | Python | gpl-3.0 | 1,542 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.