code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# 1、`if __name__ == "__main__":`
'''
__name__是指示当前py文件调用方式的方法。
如果它等于"__main__"就表示是直接执行,如果不是,则用来被别的文件调用。
一般写在文件的最后。
查看format.py和wordsCount.py的布局
'''
# 2、函数
'''
查看format.py中的formatLines函数
def xxx():
# 函数体
'''
# 3、if条件语句
'''
if xx:
# xxx
elif xxx:
# xxx
elif xxx:
# xxx
else:
# xxx
`else` 表示剩下的所有情况,该... | inkfountain/learn-py-a-little | lesson_file/lesson.py | Python | gpl-2.0 | 1,662 |
# Copyright 2002, 2004 John T. Reese.
# email: jtr at ofb.net
#
# This file is part of Yammer.
#
# Yammer 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... | nandub/yammer | lib/TicketExceptionHandler.py | Python | gpl-2.0 | 9,659 |
import os, logging, imp
from autotest_lib.client.bin import test
from autotest_lib.client.common_lib import error
from autotest_lib.client.virt import virt_utils, virt_env_process
class kvm(test.test):
"""
Suite of KVM virtualization functional tests.
Contains tests for testing both KVM kernel code and us... | wuzhy/autotest | client/tests/kvm/kvm.py | Python | gpl-2.0 | 5,376 |
"""
Interfaces to the QEMU monitor.
:copyright: 2008-2010 Red Hat Inc.
"""
from __future__ import division
import socket
import time
import threading
import logging
import select
import re
import os
import six
try:
import json
except ImportError:
logging.warning("Could not import json module. "
... | lmr/avocado-vt | virttest/qemu_monitor.py | Python | gpl-2.0 | 92,751 |
from apiclient import APIClient, RateLimiter
class FreebaseAPI(APIClient):
API_FILE = '.freebase_api_key'
API_KEY = open(API_FILE).read()
BASE_URL = 'https://www.googleapis.com/freebase/v1/'
def search(self,params):
params['apikey'] = self.API_KEY
path = 'search'
print params
return self.call(... | andynu/RottenTomatoesActorQuality | src/freebase.py | Python | gpl-2.0 | 1,013 |
# -*- coding: utf-8 -*-
import cv2
from flexvi import cvoutput
from flexvi.core.images import open_images_from_mask, open_image
from glob import glob
flags = {
'default': cv2.CALIB_CB_ADAPTIVE_THRESH + cv2.CALIB_CB_NORMALIZE_IMAGE,
'at_or_fq': cv2.CALIB_CB_ADAPTIVE_THRESH | cv2.CALIB_CB_FILTER_QUADS
}
d... | semeniuta/FlexVi | flexvi/core/chessboard.py | Python | gpl-2.0 | 7,063 |
# Copyright © 2020, Joseph Berry, Rico Tabor (opendrop.dev@gmail.com)
# OpenDrop is released under the GNU GPL License. You are free to
# modify and distribute the code, but always under the same license
# (i.e. you cannot make commercial derivatives).
#
# If you use this software in your research, please cite the foll... | ricotabor/opendrop | opendrop/app/common/image_acquisition/configurator/__init__.py | Python | gpl-2.0 | 1,447 |
# -*- coding: utf-8 -*-
##############################################################################
# 2014 E2OpenPlugins #
# #
# This file is open source software; you can redistribute... | MDXDave/ModernWebif | plugin/controllers/models/owibranding.py | Python | gpl-2.0 | 15,558 |
def nth_combination(start_combination, combination_options, n_value):
"""
Calculate the N-th combination of a string. The function does not evaluate
n combination before outputing the n combination. The function acts upon
the combination as a "natural number" with radix equals to the number of
comb... | yosi-dediashvili/nth_combination | nth_combination.py | Python | gpl-2.0 | 2,156 |
import mock, unittest
from mercurial import ui
from tortoisehg.hgqt import thgrepo
def mockrepo(ui, path):
m = mock.MagicMock(ui=ui, root=path)
m.unfiltered = lambda: m
return m
LOCAL_SIGNALS = ['repositoryOpened', 'repositoryClosed']
MAPPED_SIGNALS = ['configChanged', 'repositoryChanged', 'repositoryDest... | velorientc/git_test7 | tests/qt_repomanager_test.py | Python | gpl-2.0 | 2,859 |
# encoding: utf-8
# module samba.dcerpc.dnsserver
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/dnsserver.so
# by generator 1.135
""" dnsserver DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class DNS_RPC_FORWARDERS_LONGHORN(__talloc.Object):
# no doc
def __init__(self, *arg... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/dnsserver/DNS_RPC_FORWARDERS_LONGHORN.py | Python | gpl-2.0 | 1,128 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
menus.py
---------------------
Date : February 2016
Copyright : (C) 2016 by Victor Olaya
Email : volayaf at gmail dot com
*******************************... | NaturalGIS/QGIS | python/plugins/processing/gui/menus.py | Python | gpl-2.0 | 13,513 |
# -*- coding: utf-8 -*-
# This code is part of Amoco
# Copyright (C) 2006-2011 Axel Tillequin (bdcht3@gmail.com)
# published under GPLv2 license
"""
render.py
=========
This module implements amoco's pygments interface to allow pretty printed
outputs of tables of tokens built from amoco's expressions and instruction... | bdcht/amoco | amoco/ui/render.py | Python | gpl-2.0 | 18,256 |
# -*- coding: utf-8 -*-
#Copyright (C) Fiz Vazquez vud1@sindominio.net
#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.
#T... | pytrainer/pytrainer | pytrainer/gui/windowcalendar.py | Python | gpl-2.0 | 1,204 |
import codecs
from collections import defaultdict
import copy
import csv
from functools import reduce
import json
import prettytable
import operator
import os.path
try:
import matplotlib.pylab as plt
import matplotlib.patches as mpatches
import matplotlib.lines as Line2D
except:
plt = None
mpatches ... | versae/ipython-cypher | src/cypher/run.py | Python | gpl-2.0 | 19,870 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2018 Kevin Deldycke <kevin@deldycke.com>
# and contributors.
# All Rights Reserved.
#
# 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 F... | torkelsson/meta-package-manager | meta_package_manager/base.py | Python | gpl-2.0 | 11,025 |
class Solution(object):
def commonChars(self, A):
"""
:type A: List[str]
:rtype: List[str]
"""
# 把每个字符串编程 char,count的dict放入数组
# 可以用直接用 str.count统计26个字母的个数
res: list = []
for a in A:
d = {}
for c in a:
d[c] = d.ge... | lmmsoft/LeetCode | LeetCode-Algorithm/1002. Find Common Characters/solution.py | Python | gpl-2.0 | 1,499 |
""" This module contains testcase_03_running_services test """
from testcase import Testcase
import yaml
class testcase_03_running_services(Testcase):
"""
Check for running services
"""
stages = ['stage1']
tags = ['default']
def test(self, connection, params):
""" Perform test """
... | dparalen/dva | dva/test/testcase_03_running_services.py | Python | gpl-2.0 | 1,272 |
try:
import unittest2 as unittest
except ImportError:
import unittest
import rope.base.project
import rope.base.builtins
from rope.base import libutils
from ropetest import testutils
class ObjectInferTest(unittest.TestCase):
def setUp(self):
super(ObjectInferTest, self).setUp()
self.proj... | emacsway/rope | ropetest/objectinfertest.py | Python | gpl-2.0 | 14,587 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from four1 import four1
from math import sin
def correl(data1, data2, n):
ans=(2*n+1)*[0.0]
correl_r(data1[:], data2[:], n, ans)
return ans
# Computes the correlation of two real data sets data1[1..n] and data2[1..n]
# (including any user-specified zero-padding). n MUST b... | leleobhz/phonetica | high_experimental/mvuorine/correl.py | Python | gpl-2.0 | 3,929 |
# Copyright © 2016-2017 Simon McVittie
# SPDX-License-Identifier: GPL-2.0+
# (see vectis/__init__.py)
import os
import pwd
import shutil
import subprocess
from tempfile import TemporaryDirectory
from debian.debian_support import (
Version,
)
from vectis.commands.new import vmdebootstrap_argv
from vectis.error im... | smcv/vectis | vectis/commands/bootstrap.py | Python | gpl-2.0 | 4,115 |
"""add JSONic proposal event targets
Revision ID: 3e7de5c31b2b
Revises: 4cb574d6501a
Create Date: 2016-03-21 07:13:24.424092
"""
# revision identifiers, used by Alembic.
revision = '3e7de5c31b2b'
down_revision = '4cb574d6501a'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql impor... | n6151h/pyconau2016 | alembic/versions/3e7de5c31b2b_add_jsonic_proposal_event_targets.py | Python | gpl-2.0 | 1,366 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2008 Zsolt Foldvari
#
# 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) ... | arunkgupta/gramps | gramps/gen/lib/styledtexttag.py | Python | gpl-2.0 | 4,127 |
"""
/***************************************************************************
Name : ProfileTenureView
Description : A widget for rendering a profile's social tenure
relationship.
Date : 9/October/2016
copyright : John Kahiu
email ... | gltn/stdm | stdm/ui/wizard/profile_tenure_view.py | Python | gpl-2.0 | 67,557 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DsgTools
A QGIS plugin
Brazilian Army Cartographic Production Tools
-------------------
begin : 2019-09-03
git sha ... | lcoandrade/DsgTools | gui/CustomWidgets/OrderedPropertyWidgets/orderedTableWidget.py | Python | gpl-2.0 | 24,412 |
import os, sys
import vtktools
import fluidity_tools
import numpy as np
import matplotlib as mpl
mpl.use('ps')
import matplotlib.pyplot as plt
label0 = 'm_25_3b'
label1 = 'm_25_3b'
basename1 = 'mli_checkpoint'
basename0 = 'mli'
path0 = '/tamay2/mensa/fluidity/'+label0+'/'
path1 = '/tamay2/mensa/fluidity/'+label1+'/'... | jungla/ICOM-fluidity-toolbox | 2D/U/plot_vKE_mli.py | Python | gpl-2.0 | 1,416 |
#! /usr/bin/env python
# coding:utf-8
from numpy import *
from matplotlib.pyplot import *
from scipy.optimize import fmin_bfgs
class ML():
def __init__(self,x=[],y=[]):
self.X=x
self.Y=y
self.Theta=[]
self.Alpha=0.01
self.Iterations=1500
def load(self,fname,d=','):
data=loadtxt(fname,delimiter=d)
sel... | Urinx/Machine_Learning | Logistic-Regression/LogisticRegression.py | Python | gpl-2.0 | 2,429 |
from db.testing import DatabaseTestCase, TEST_DATA_PATH
import db.exceptions
import db.data
import os.path
import json
import mock
import copy
class DataDBTestCase(DatabaseTestCase):
def setUp(self):
super(DataDBTestCase, self).setUp()
self.test_mbid = "0dad432b-16cc-4bf0-8961-fd31d124b01b"
... | abhinavjain241/acousticbrainz-server | db/test/test_data.py | Python | gpl-2.0 | 14,021 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015-2016 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 2... | unioslo/cerebrum | Cerebrum/modules/pwcheck/__init__.py | Python | gpl-2.0 | 1,022 |
# -*- coding: utf-8 -*-
"""
uds.data.check
~~~~~~~~~~~~~~
:copyright: Copyright (c) 2015, National Institute of Information and Communications Technology.All rights reserved.
:license: GPL2, see LICENSE for more details.
"""
import re
import datetime
import dateutil.parser
import pytz
import uds.logging
from uds.data... | nict-isp/uds-sdk | uds/data/check.py | Python | gpl-2.0 | 4,491 |
import numpy as np
import deap.gp
import cv2
from creamas.core.artifact import Artifact
class GPImageArtifact(Artifact):
"""An artifact implementation for the images created using genetic programming, :class:`GPImageArtifact` requiring
``pip install creamas[extras]``. The artifact implementation is coupled w... | assamite/creamas | creamas/domains/image/gp/artifact.py | Python | gpl-2.0 | 8,831 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-24 23:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
... | paulopinda/eventex | eventex/core/migrations/0002_auto_20160124_2350.py | Python | gpl-2.0 | 1,299 |
#-*-coding:utf-8-*-
'''
@author: Hung-Hsin Chen
@mail: chenhh@par.cse.nsysu.edu.tw
@license: GPLv2
'''
import functools
def symbol(sym):
'''
Decorator that assigns a symbol to a function.
The symbol is stored in the function.symbol attribute.
@param sym: symbol to a function
'''
def decorator(... | chenhh/PyMOGEP | src/PyMOGEP/decorator.py | Python | gpl-2.0 | 2,384 |
from unittest import TestCase
from netcontrol.util import singleton
@singleton
class SingletonClass(object):
pass
@singleton
class SingletonClassWithAttributes(object):
@classmethod
def setup_attributes(cls):
cls.value = 1
class SingletonTest(TestCase):
def test_that_only_instance_is_crea... | drimer/NetControl | netcontrol/test/util/test_singleton.py | Python | gpl-2.0 | 593 |
from say import *
from say.styling import StyleDef
import six
def test_basic_styling():
fmt = Fmt()
assert fmt('this', style='green+underline') == six.u('\x1b[32;4mthis\x1b[0m')
assert fmt('this', style='bold+red') == six.u('\x1b[31;1mthis\x1b[0m')
def test_readme_example():
fmt = Fmt()
fmt.st... | nrgaway/qubes-tools | builder-tools/libs/say-1.4.2/test/test_styling.py | Python | gpl-2.0 | 4,257 |
# Copyright 2004-2012 Tom Rothamel <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, m... | MSEMJEJME/Get-Dumped | renpy/text/text.py | Python | gpl-2.0 | 43,754 |
import clean_group
| 3dfxsoftware/cbss-addons | clean_user_groups/wizard/__init__.py | Python | gpl-2.0 | 19 |
import datetime
import astropy
'''Boxing day is celebrated on the 26th of December, each year.
If Boxing day falls on the weekend it is moved to the following Monday or Tuesday
Boxing Day is observed on the 28th if the 26th falls on a Saturday or Sunday
'''
def get_holiday(year):
'''
Calculate the observed da... | shaneHowearth/Statutory_Holidays | Christmas_and_New_Year/Boxing_day.py | Python | gpl-2.0 | 1,049 |
'''
Created on Jul 27, 2012
@author: Peyman Kazemian
'''
from headerspace.tf import TF
from headerspace.hs import headerspace
from utils.wildcard import wildcard_create_bit_repeat
from net_plumber import NetPlumber
from time import time
from config_parser.cisco_router_parser import cisco_router
from examples.utils.net... | Br1an6/ACS_Netplumber_Implementation | hsa-python/net_plumbing/demo.py | Python | gpl-2.0 | 2,719 |
# Copyright 2004 Mark Rose <mkrose@users.sourceforge.net>
#
# 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 pro... | nsmoooose/csp | csp/base/applog.py | Python | gpl-2.0 | 1,162 |
from django.test import TestCase
# Create your tests here.
from kriek.globalsettings.models import GlobalSettings
class GlobalSettingsTestCase(TestCase):
def setUp(self):
GlobalSettings.objects.create(key='UNITS', value='metric')
def test_defaults(self):
units = GlobalSettings.objects.get_setting('UNITS').valu... | jsproull/kriek | kriek/globalsettings/tests.py | Python | gpl-2.0 | 357 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2010 TUBITAK/UEKAE
#
# 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.
#
# ... | forYali/yali | yali/gui/ScrBootloader.py | Python | gpl-2.0 | 4,461 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009 Zuza Software Foundation
#
# This file is part of translate.
#
# 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 o... | lehmannro/translate | misc/lru.py | Python | gpl-2.0 | 4,388 |
# -*- coding: iso-8859-1 -*-
#Copyright (C) Fiz Vazquez vud1@sindominio.net
# Modified by dgranda
#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 opt... | deuxpi/pytrainer | pytrainer/main.py | Python | gpl-2.0 | 21,967 |
#!/usr/bin/python
# -*- coding: utf8 -*-
#
#****************************************************************************
#* *
#* base classes for generating part models in STEP AP214 *
#* ... | easyw/kicad-3d-models-in-freecad | cadquery/FCAD_script_generator/Button_Switch_Nidec/cq_base_model.py | Python | gpl-2.0 | 23,507 |
"""Example to solve mixture model
"""
import foam_controlwrapper
from simphony.core.cuba import CUBA
from simphony.api import CUDS, Simulation
from simphony.cuds.meta import api
from simphony.engine import EngineInterface
from mayavi.scripts import mayavi2
import dahl_mesh
import tempfile
case_name = 'dahl'
mesh_na... | simphony/simphony-openfoam | foam_controlwrapper/examples/dahl_rel_vel.py | Python | gpl-2.0 | 6,807 |
import cv2
import logging
import numpy as np
import os
import sys
from lib.warping import ImageBlobWarping
from lib.singleton import Singleton
from logging import FileHandler, StreamHandler
from multiprocessing import Pool
from ocr import Ocr
from timeit import default_timer as timer
from vlogging import VisualRecord
... | MirichST/patchcap | src/daemon/platedetector.py | Python | gpl-2.0 | 11,192 |
#!/usr/bin/env python
import paho.mqtt.client as mqtt
# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
# Subscribing in on_connect() means that if we lose the connection and
# reconnect... | frink182/pi_temps | mqtt_listener.py | Python | gpl-2.0 | 882 |
import bongo.external.simplejson as simplejson
import bongo.external.vobject as vobject
import logging
import os
import re
import time
import random
import md5
import email
from email.MIMEText import MIMEText
from email.MIMEMessage import MIMEMessage
from email.MIMEMultipart import MIMEMultipart
from email.Message imp... | bongo-project/bongo | src/apps/storetool/bongo/storetool/CalendarCommands.py | Python | gpl-2.0 | 14,791 |
from mock import Mock
from landscape.lib.testing import FakeReactor
from landscape.client.tests.helpers import (
LandscapeTest, FakeBrokerServiceHelper)
from landscape.client.monitor.config import MonitorConfiguration, ALL_PLUGINS
from landscape.client.monitor.service import MonitorService
from landscape.clien... | CanonicalLtd/landscape-client | landscape/client/monitor/tests/test_service.py | Python | gpl-2.0 | 3,091 |
# -*- coding: utf-8 -*-
#
from .auth import *
from .token import *
from .mfa import *
from .access_key import *
| eli261/jumpserver | apps/authentication/api/__init__.py | Python | gpl-2.0 | 113 |
#encoding=utf-8
# python3
import asyncio
@asyncio.coroutine
def hello():
print("Hello world!")
# 异步调用asyncio.sleep(1):
r = yield from asyncio.sleep(1)
print("Hello again!")
# 获取EventLoop:
loop = asyncio.get_event_loop()
# 执行coroutine
loop.run_until_complete(hello())
loop.close()
| solvery/lang-features | python/use_lib/asyncio_1.py | Python | gpl-2.0 | 314 |
# data.py: Contains the backend to the gconf database
# Copyright (C) 2004, 2005 Philip Van Hoof <me at pvanhoof dot be>
# Copyright (C) 2004 - 2009 Gaute Hope <eg at gaute dot vetsj dot com>
# Copyright (C) 2004, 2005 Kristof Vansant <de_lupus at pandora dot be>
#
# This program is free software; you can redistribut... | GNOME/gnome-schedule | src/data.py | Python | gpl-2.0 | 3,607 |
import os
import six
import sys
import shutil
import subprocess as spr
import tempfile
from unittest import TestCase
from get_ref_dir import get_ref_dir
import numpy as np
ref_dir = get_ref_dir()
test_dir = os.path.dirname(__file__)
remove_temp_files = True
# check if the seaborn version is smaller than 0.8 (withou... | Chilipp/psy-simple | tests/_base_testing.py | Python | gpl-2.0 | 3,925 |
x = 1
x = x + 1
x = x + x + 2
print("x:",x,"\n")
x = "Hallo Welt"
print("x:",x,"\n")
y = "Gute Nacht"
print("y:",y,"\n")
v = "Und bis morgen"
print("y:"+ y+ " " + v +"\n")
| pez2001/sVimPy | test_scripts/test5.py | Python | gpl-2.0 | 172 |
#!/usr/bin/python3
# Cbenchsuite - A C benchmarking suite for Linux benchmarking.
# Copyright (C) 2013 Markus Pargmann <mpargmann@allfex.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; ... | scosu/cbenchsuite | plot_utils.py | Python | gpl-2.0 | 22,008 |
#! /usr/bin/env python
# coding: utf-8
"""
Copyright 2014 Tatsuro Yasukawa.
Distributed under the GNU General Public License at
gnu.org/licenses/gpl.html.
"""
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
hello_modules = [Extension("hello", ["hello... | SamuraiT/extensionpy | cythonexample/setup.py | Python | gpl-2.0 | 447 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# server_gui.py
#############################################################################
# Copyright (C) Labomedia February 2015
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as ... | sergeLabo/pygame_server_gui | server_gui.py | Python | gpl-2.0 | 6,213 |
# -*- coding: utf-8 -*
"""
Module for polling the various sensors.
"""
import time
import logging
import threading
import traceback
try:
import cStringIO as StringIO
except ImportError:
import StringIO
from datetime import datetime, timedelta
from decoder import read433
from parser import parsePacketStream
from ut... | jaycedowell/wxPi | polling.py | Python | gpl-2.0 | 4,492 |
#!/usr/bin/python -O
#
# /usr/sbin/webapp-config
# Python script for managing the deployment of web-based
# applications
#
# Originally written for the Gentoo Linux distribution
#
# Copyright (c) 1999-2007 Authors
# Released under v2 of the GNU GPL
#
# ===========================================... | Feandil/webapp-config | WebappConfig/selinux.py | Python | gpl-2.0 | 4,699 |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _
from exams.models import import_candidates
class Command(BaseCommand):
args = '<candidates.xml>'
help = _('Imports candidates from XML file')
def handle(self, *arg... | annavonzansen/exams | exams/management/commands/importcandidates.py | Python | gpl-2.0 | 931 |
from urwid import MainLoop, ExitMainLoop, Text, Filler, AttrMap
PALETTE = [
('banner', 'black', 'light gray'),
('streak', 'black', 'dark red'),
('bg', 'black', 'dark blue'),
]
def exit_on_q(key):
if key == 'Q':
raise ExitMainLoop()
txt = Text(('banner', u"Hello World"), align='center')
map1... | Tjorriemorrie/pokeraide | tui/demos/demo.py | Python | gpl-2.0 | 495 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from django.urls import path, include, re_path
from rest_framework_bulk.routes import BulkRouter
from common import api as capi
from .. import api
app_name = 'terminal'
router = BulkRouter()
router.register(r'sessions', api.SessionViewSet, 'session')
router.register(r... | zsjohny/jumpserver | apps/terminal/urls/api_urls.py | Python | gpl-2.0 | 2,203 |
# -*- coding: utf-8 -*-
"""
RED Plugin
Copyright (C) 2015, 2017 Matthias Bolte <matthias@tinkerforge.com>
Copyright (C) 2017 Ishraq Ibne Ashraf <ishraq@tinkerforge.com>
red_tab_importexport_systemlogs.py: RED import/export system logs tab implementation
This program is free software; you can redistribute it and/or
mo... | Tinkerforge/brickv | src/brickv/plugin_system/plugins/red/red_tab_importexport_systemlogs.py | Python | gpl-2.0 | 9,261 |
import pprint
import sys
from xml.dom import xmlbuilder, expatbuilder, Node
from xml.dom.NodeFilter import NodeFilter
class Filter(xmlbuilder.DOMBuilderFilter):
whatToShow = NodeFilter.SHOW_ELEMENT
def startContainer(self, node):
assert node.nodeType == Node.ELEMENT_NODE
if node.tagName == "s... | Pikecillo/genna | external/PyXML-0.8.4/test/test_filter.py | Python | gpl-2.0 | 5,625 |
#!/usr/bin/python
import Image
import time
import datetime
import csv
import thermal_config as tcfg
millis_at_start = int(round(time.time() * 1000))
temp_data = list(csv.reader(open(tcfg.files['csv'])))
img = Image.new('RGB', (tcfg.fov['horizontal'], tcfg.fov['vertical']), "black")
pixels = img.load()
print 'Proce... | simium/PyThermal | thermal_image_generator.py | Python | gpl-2.0 | 1,461 |
import threading
class BuckysMessenger(threading.Thread):
def run(self):
for _ in range(10000):
print(threading.current_thread().getName() + str(_))
# Diese Klasse kann also gethreaded werden, d.h. mehrere Objekte davon
# können zur gleichen Zeit laufen!
x = BuckysMessenger(name='Sender')
y... | eHanseJoerg/learning-machine-learning | 00 python basics/threadingexample.py | Python | gpl-2.0 | 513 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Description: File system resilience testing application
# Author: Hubert Kario <hubert@kario.pl>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Hubert Kario. All rights reserved.
#
# This ... | tomato42/fsresck | fsresck/nbd/request.py | Python | gpl-2.0 | 3,965 |
# -*- coding: utf-8 -*-
## begin license ##
#
# "Digitale Collectie ErfGeo Enrichment" is a service that attempts to automatically create
# geographical enrichments for records in "Digitale Collectie" (http://digitalecollectie.nl)
# by querying the ErfGeo search API (https://erfgeo.nl/search).
# "Digitale Collectie Erf... | seecr/dc-erfgeo-enrich | digitalecollectie/erfgeo/pittoannotation.py | Python | gpl-2.0 | 7,137 |
'''
The Pitt API, to access workable data of the University of Pittsburgh
Copyright (C) 2015 Ritwik Gupta
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 ... | Rahi374/PittAPI | PittAPI/textbook.py | Python | gpl-2.0 | 5,449 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ..model.attack import Attack
from ..config import Configuration
from ..tools.hashcat import HcxDumpTool, HcxPcapTool, Hashcat
from ..util.color import Color
from ..util.timer import Timer
from ..model.pmkid_result import CrackResultPMKID
from threading import Thread
... | derv82/wifite2 | wifite/attack/pmkid.py | Python | gpl-2.0 | 7,652 |
#!/usr/bin/python3
#############
# this is to be leaded by every module.
# I think
#import mysglobal as g # args,loggerr @every module
#################
import logging
from logzero import setup_logger,LogFormatter,colors
import argparse
import os,sys
import json
from blessings import Terminal
import getpass # ... | jaromrax/myservice | version2/mysglobal.py | Python | gpl-2.0 | 4,226 |
"""
KeepNote
Editor widget in main window
"""
#
# KeepNote
# Copyright (c) 2008-2009 Matt Rasmussen
# Author: Matt Rasmussen <rasmus@mit.edu>
#
# 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... | vatslav/perfectnote | keepnote/gui/editor_richtext.py | Python | gpl-2.0 | 52,254 |
from trackers.fitbit_tracker import FitbitTracker
__author__ = 'doughyde'
# FitBit connection
f = FitbitTracker()
f.authenticate()
f.get_devices() | doughyde/fitbit-cal-sync | fitbit-cal-sync.py | Python | gpl-2.0 | 149 |
# Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
from kippo.core.honeypot import HoneyPotCommand
from twisted.internet import reactor
import time, re, hashlib, getopt
commands = {}
class command_ssh(HoneyPotCommand):
def start(self):
try:
op... | jullrich/dshieldhoneypot | kippo/kippo-0.8/kippo/commands/ssh.py | Python | gpl-2.0 | 3,350 |
# Copyright 2015 Arx Libertatis Team (see the AUTHORS file)
#
# This file is part of Arx Libertatis.
#
# Arx Libertatis 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... | xoddark/libretro-arxlibertatis | plugins/blender/arx_addon/main.py | Python | gpl-3.0 | 5,305 |
../../../../share/pyshared/duplicity/robust.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/duplicity/robust.py | Python | gpl-3.0 | 46 |
import numpy as np
tansig = lambda n: 2 / (1 + np.exp(-2 * n)) - 1
sigmoid = lambda n: 1 / (1 + np.exp(-n))
hardlim = lambda n: 1 if n >= 0 else 0
purelin = lambda n: n
relu = lambda n: np.fmax(0, n)
square_error = lambda x, y: np.sum(0.5 * (x - y)**2)
sig_prime = lambda z: sigmoid(z) * (1 - sigmoid(z))
relu_pr... | alexvlis/shape | nnmath.py | Python | gpl-3.0 | 518 |
import matplotlib.pyplot as plt
# Aux functions for trainer.
def display_image(image):
plt.ion()
plt.imshow(image, cmap='Greys_r')
plt.draw() | vevurka/pbc | image_detector/utils.py | Python | gpl-3.0 | 157 |
'''
Convert an image file to a data uri.
Copyright 2012 GoodCrypto
Last modified: 2013-11-13
This file is open source, licensed under GPLv3 <http://www.gnu.org/licenses/>.
'''
import os.path
from django import template
import reinhardt.data_image
register = template.Library()
@reg... | goodcrypto/goodcrypto-libs | reinhardt/templatetags/data_img.py | Python | gpl-3.0 | 828 |
# This file is part of pylabels, a Python library to create PDFs for printing
# labels.
# Copyright (C) 2012, 2013, 2014 Blair Bonnett
#
# pylabels 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 versio... | bcbnz/pylabels | demos/nametags.py | Python | gpl-3.0 | 3,046 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-28 00:55
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('clog', '0010_auto_20160410_2149'),
]
operations = [
migrations.AlterUniqueTogether(
... | jaufrec/whatnext | clog/migrations/0011_auto_20160528_0055.py | Python | gpl-3.0 | 419 |
#!/usr/bin/python2.6
# -*- coding: utf-8 -*-
# This file is a part of Metagam project.
#
# Metagam 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
# any later version.
#
#... | JoyTeam/metagam | mg/test/testmemcached.py | Python | gpl-3.0 | 3,304 |
#!/usr/bin/python
from __future__ import print_function
import weather, time
a = time.time(); weather.hourly.load("ottawa"); print time.time() - a
raw_input()
| endlisnis/weather-records | testHourly.py | Python | gpl-3.0 | 159 |
__author__ = 'kiruba'
import numpy as np
# import matplotlib.pyplot as plt
import pandas as pd
import itertools
from fractions import Fraction
from bisect import bisect_left
import math
from datetime import datetime
from datetime import timedelta
import meteolib as met
# import evaplib
import scipy as sp
date_format =... | tejasckulkarni/hydrology | checkdam/checkdam.py | Python | gpl-3.0 | 22,747 |
"""
Quickly, quickly deploy and manage cloud servers
Copyright (C) 2014 Trey Tabner <trey@tabner.com>
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 opti... | treytabner/quickly | quickly/shell.py | Python | gpl-3.0 | 2,887 |
T = int(input())
for _ in range(T):
T1 = int(input())
s = map(int, raw_input().split())
count = 0
if T1==len(s):
for i in range(len(s)-1):
if s[i+1]>s[i]:
count = s[i]-s[i+1]
if s[i+1]<=s[i]:
count = 0
print count
| Dawny33/Code | Hackerrank/Back2School/stockmax.py | Python | gpl-3.0 | 299 |
import scripts
import json
def onReceive(dat, rowIndex, message, bytes, peer):
res = json.loads(json.loads(message))
print(res)
if res['tag'] != "Err":
scripts.apply(json.loads(json.loads(res['contents'])))
return | ulyssesp/oscillare | TD/scripts/tcpipinput.py | Python | gpl-3.0 | 238 |
# Copyright (c) 2013 Jose M. Dana
#
# This file is part of memprof.
#
# memprof 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 (version 3 of the License only).
#
# memprof is distributed in the hope that it wi... | jmdana/memprof | memprof/__init__.py | Python | gpl-3.0 | 835 |
#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under the
# terms of the GNU General Public License as published by ... | RedhawkSDR/integration-gnuhawk | components/tagged_file_sink_f/tests/test_tagged_file_sink_f.py | Python | gpl-3.0 | 4,079 |
#!/usr/bin/python2
import kplugs
try:
kernel_func = r'''
STATIC("my_helper")
def my_function():
try:
my_helper()
print "OK"
except word as err:
print "Exception number: %d" % -err
raise err
def my_helper():
KERNEL_undefined_function()
'''
plug = kplugs.Plug(ip='127... | avielw/kplugs | examples/1.1/undefined_func_remote.py | Python | gpl-3.0 | 432 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | belokop/indico_bare | indico/modules/events/timetable/controllers/legacy.py | Python | gpl-3.0 | 26,827 |
__author__ = 'Carlos'
from time import sleep, time
import minimalmodbus as mb
import csv
class Torch200:
def __init__(self, com_port):
mb.BAUDRATE = 9600
mb.TIMEOUT = 3
self.profile = mb.Instrument(com_port, 1)
self.control = mb.Instrument(com_port, 2)
self.start_time = No... | nanodude/Torch200 | Torch200.py | Python | gpl-3.0 | 2,015 |
import subprocess
from django.views.generic import View
from django.shortcuts import render, redirect
from django.http import HttpResponse, request, response
from django.conf import settings
from common.utils import Zone, App
class Named(View):
def get(self, request):
# app install status
# check... | ragibkl/blackhole | website/configure/named/views.py | Python | gpl-3.0 | 510 |
# -*- coding: utf-8 -*-
# Copyright 2016, 2017 Kevin Reid and the ShinySDR contributors
#
# This file is part of ShinySDR.
#
# ShinySDR 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... | kpreid/shinysdr | shinysdr/units.py | Python | gpl-3.0 | 1,966 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Blei's LDA-C format.
"""
from __future__ import with_statement
import logging
from gensim import interfaces, utils
from gensim.c... | auduno/gensim | gensim/corpora/bleicorpus.py | Python | gpl-3.0 | 3,768 |
#!/bin/env python3
"""
Copyright (C) 2014 by Yichao Zhou <broken.zhou AT gmail DOT com>
License: http://www.gnu.org/licenses/gpl.html GPL version 3 or higher
Any comments are welcome through email and github!
"""
import codecs
import re
import random
import os
import pexpect
import sys
import string
import time
from ... | zhou13/qtunneler | qtunneler.py | Python | gpl-3.0 | 16,827 |
# -*- coding: utf-8 -*-
__author__ = 'byron'
import datetime
import traceback
import os
import re
import time
from spider_core import SpiderCore
url = "http://www.lagou.com/"
maxcount = 2000
maxlevel = 5
SpiderCore = SpiderCore(url, maxcount, maxlevel)
SpiderCore.start()
def getAutomaticId(name):
global db
i... | byron1655/spider | spider.py | Python | gpl-3.0 | 496 |
#!/usr/bin/env python3
from pathlib import Path
p = Path('.')
| qilicun/python | python3/tutorials/filepath.py | Python | gpl-3.0 | 65 |
#!/usr/bin/env python
#! -O
#
# python equivalent for grouplisten, works same way
#
#EIBD client library
#Copyright (C) 2006 Tony Przygienda, Z2 GmbH
#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 Fr... | Makki1/old-svn | avr/sketchbook/GiraRM_Debug/freebus/freebus_ets/software/freebus-ets/eibnet/grouplisten.py | Python | gpl-3.0 | 2,687 |