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
# -*- encoding: utf-8 -*-
# Copyright 2011-2016, Nigel Small
#
# 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
#
# Unle... | nigelsmall/py2neo | test/test_merge.py | Python | apache-2.0 | 11,075 |
from pytest import fixture
from pytest import mark
class TestMercatorProposal:
@fixture
def meta(self):
from .mercator import mercator_proposal_meta
return mercator_proposal_meta
def test_meta(self, meta):
from adhocracy_mercator.resources import mercator
from adhocracy_c... | liqd/adhocracy3.mercator | src/adhocracy_mercator/adhocracy_mercator/resources/test_mercator.py | Python | agpl-3.0 | 3,884 |
# Test various argument semantics for openconn
#a dummy method so there is something to connect to
def nothing(rip,rport,sock,th,lh):
pass
# test that the locaip used by openconn is getmyip
def test_remoteip(rip,rport,sock,th,lh):
if rip != getmyip():
print 'remoteip did not equal getmyip: '+rip+' vs '+ge... | sburnett/seattle | network_semantics_tests/tests/openconn/openconn_arg.py | Python | mit | 2,110 |
import os, sys
sys.path.append(os.path.abspath('EGG.egg'))
import EGG.import_handled_exception
try:
import EGG.import_unhandled_exception
except ValueError:
pass
| msunardi/PTVS | Python/Tests/TestData/DebuggerProject/EGGceptionOnImport.py | Python | apache-2.0 | 181 |
#
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | fedora-conary/conary | conary/build/defaultrecipes.py | Python | apache-2.0 | 27,584 |
#! /usr/bin/python
from __future__ import print_function
import os
import sys
def main():
dxsdk_dir = os.getenv("DXSDK_DIR")
if not dxsdk_dir:
print("DXSDK_DIR is not set. You need to install the DirectX SDK", file=sys.stderr)
sys.exit(1)
if dxsdk_dir[1] == ":":
dxsdk_dir = dxsdk_di... | pyokagan/node-pyksdl2 | deps/libsdl2/getdxsdkdir.py | Python | mit | 421 |
import os
from dateutil import parser
from django.conf import settings
from hs_core.models import ResourceFile
from hs_core.hydroshare import add_resource_files
from hs_core.views.utils import create_folder, move_or_rename_file_or_folder, zip_folder, \
unzip_file, remove_folder
from hs_core.views.utils import run... | FescueFungiShare/hydroshare | hs_core/testing.py | Python | bsd-3-clause | 35,732 |
from distutils.core import setup
import py2exe
setup(
name = 'dbf2xml',
description = 'Converts last line of dbf file to xml',
version = '1.0',
windows = [
{
'script': 'gui.py',
'icon_resources': [(1, "xml-icon.ico")],
... | Salamek/DBF2XML | setup.py | Python | gpl-3.0 | 647 |
#------------------------------------------------------------------------------
# Copyright (C) 2009 Richard Lincoln
#
# 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; version 2 dated June... | rwl/openpowersystem | dynamics/dynamics/excitation_systems/exc_dc4_b.py | Python | agpl-3.0 | 3,500 |
import os
from django.utils.translation import ugettext_lazy as _
from horizon.test.settings import *
from horizon.utils.secret_key import generate_or_read_from_file
from openstack_dashboard.exceptions import NOT_FOUND
from openstack_dashboard.exceptions import RECOVERABLE
from openstack_dashboard.exceptions import ... | fajoy/horizon-example | openstack_dashboard/test/settings.py | Python | apache-2.0 | 3,367 |
"""!
BlenderFDS, preferences panel.
"""
import bpy
import logging
from bpy.types import AddonPreferences
from bpy.props import (
BoolProperty,
StringProperty,
FloatProperty,
IntProperty,
EnumProperty,
)
log = logging.getLogger(__name__)
# Get preference value like this:
# prefs = context.prefere... | firetools/blenderfds | bl/preferences.py | Python | gpl-3.0 | 3,069 |
#!/bin/python
# VPNConnect.bundle test suite
# Michael Bianco, <http://mabblog.com/>
from Cocoa import *
import time
b = NSBundle.bundleWithPath_("vpnconnect.bundle")
vpn = b.principalClass().new()
testVPNName = 'Test VPN'
connectionExists = vpn.connectionExists_type_(testVPNName, "PPTP")
if not connectionExists:
... | iloveitaly/osx-vpn-connection-management | test.py | Python | mit | 823 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from Data import Data
from Fonts.custom_font import *
from init_logging import log_string
class RainData(Data):
forecast_range_hour = 24 # use len(hourly) for full data (48h)
percent = "%"
def rain_probability(self):
rain_probability = self.rain_perce... | LoveBootCaptain/WeatherPi | Modules/RainData.py | Python | mit | 2,270 |
"""
/***************************************************************************
Name : FKMapperDialog
Description : class supporting access to foreign key attribute of another class
foreign key relations.
Date : 8/April/2015
copyright : (C) 20... | olivierdalang/stdm | ui/fkbase_form.py | Python | gpl-2.0 | 3,440 |
# -*- coding:utf-8 -*-
'''
Created on 2018/05/26
@author: Jackie Liao
'''
import unittest
import tushare.stock.indictor as idx
import tushare as ts
class Test(unittest.TestCase):
def test_plot_all(self):
data = ts.get_k_data("601398", start="2018-01-01", end="2018-05-27")
data = data.sort_value... | waditu/tushare | test/indictor_test.py | Python | bsd-3-clause | 505 |
import pandas as pd
# ==============================================================================
# GROUPED_TALLY
# ==============================================================================
def grouped_tally(df=None, x=None, group=None, normaliz... | ronrest/convenience_py | df/grouped_tally.py | Python | apache-2.0 | 4,582 |
#!/usr/bin/env python
# STL splitter
# splits a STL file containing separate objects
#
# copyright 2014 Francesco Santini <francesco.santini@gmail.com>
#
# based on https://github.com/cmpolis/convertSTL by Chris Polis
# and BinarySTL https://github.com/sukhbinder/python by Sukhbinder Singh
#
# Released under the MIT/X ... | fsantini/python-stlsplitter | stlSplitter.py | Python | mit | 2,277 |
from django.conf.urls.defaults import *
from models import Article
from feeds import RSSv1LatestArticles, RSSv2LatestArticles, AtomLatestArticles
rss_v1_feeds = {
'latest': RSSv1LatestArticles
}
rss_v2_feeds = {
'latest': RSSv2LatestArticles,
}
atom_v1_feeds = {
'latest': AtomLatestArticles,
}
urlpatter... | LimpidTech/django-edict | edict/urls.py | Python | mit | 1,343 |
import math
import numpy as np
import matplotlib
matplotlib.use('SVG')
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
x1 = 2.
x = np.linspace(0, x1, 100)
ax.plot(x, np.exp(-5. * x), linewidth=2, label = '$x(t)$')
N = 4
h = x1 / N
sx = np.linspace(0, x1, N + 1)
sy = [(1 + 5. * h)**(-n) for n in range(N +... | rekka/intro-fortran-2016 | web/python/implicit_euler.py | Python | mit | 1,047 |
"""
This modue manages the "Show Series" view.
"""
from __future__ import unicode_literals, print_function
import json
import logging
from flask import render_template, request, Blueprint
from google.appengine.ext import ndb
from handlers.database import Database
from handlers.utils import date_handler, to_json
fr... | aaleotti-unimore/ComicsScraper | views/show_series.py | Python | apache-2.0 | 1,871 |
from django.db import models
import logging
log = logging.getLogger(__name__)
class Indicator(models.Model):
name = models.CharField(max_length=100, unique=True)
description = models.TextField()
# Auto-Generated Metadata
date_created = models.DateTimeField(auto_now_add=True)
date_modified = mode... | policycompass/policycompass-services | apps/indicatorservice/models.py | Python | agpl-3.0 | 454 |
# How to bind to MS AD with python-ldap and various methods
import ldap,ldap.sasl
ldap_uri = "ldap://dc1.example.com"
dn = "CN=Anna Blume,CN=Users,DC=addomain,DC=example,DC=com"
sAMAccountName = "ABlume"
userPrincipalName = "ablume@addomain.example.com"
password = 'testsecret'
trace_level = 2
l = ldap.initialize(ld... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/core/ext-py/python-ldap-2.3.13/Demo/ms_ad_bind.py | Python | gpl-2.0 | 1,059 |
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import account_asset_line
from . import account_asset
from . import account_move
| OCA/operating-unit | account_asset_operating_unit/models/__init__.py | Python | agpl-3.0 | 159 |
import json
import time
import jps
class MessageHolder(object):
def __init__(self):
self.saved_msg = []
def __call__(self, msg):
self.saved_msg.append(msg)
def test_pubsub_with_serialize_json():
holder = MessageHolder()
sub = jps.Subscriber('/serialize_hoge1', holder,
... | OTL/jps | test/test_serialize.py | Python | apache-2.0 | 697 |
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013--, biocore development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------... | ekopylova/burrito-fillings | bfillings/tests/test_rdp_classifier.py | Python | bsd-3-clause | 23,029 |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.tapi_oam_meg_ref import TapiOamMegRef # noqa: F401,E501
from tapi_server import util
class T... | karthik-sethuraman/ONFOpenTransport | RI/flask_server/tapi_server/models/tapi_oam_mip_ref.py | Python | apache-2.0 | 2,530 |
import os
import pytest
from smartchangelog.gitcmd import GitCmdError, is_inside_work_tree, get_gitdir, tag
from tests.unit import data_dir_path
@pytest.fixture(scope='function')
def cmd():
old_cmd = os.getcwd()
yield None
os.chdir(old_cmd)
@pytest.mark.usefixtures('cmd')
def test_is_inside_work_tree_o... | ngouzy/smartchangelog | tests/unit/test_gitcmd.py | Python | mit | 1,215 |
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2019, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or modify
# it unde... | chetan51/nupic.research | nupic/research/support/__init__.py | Python | gpl-3.0 | 933 |
from django.conf.urls import patterns, url, include
from oauth import oauth_callback
urlpatterns = patterns('',
url(r'^canvas_redirect$', oauth_callback, name='oauth_page'),
)
| penzance/ab-testing-tool | django_canvas_oauth/urls.py | Python | mit | 181 |
# Copyright 2011 Justin Santa Barbara
# 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 requ... | HybridF5/nova | nova/tests/functional/test_extensions.py | Python | apache-2.0 | 1,780 |
# -*- coding: utf-8 -*-
#
# Karel the Robot documentation build configuration file, created by
# sphinx-quickstart on Thu Feb 06 16:38:05 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fil... | luocheng/Karel | conf.py | Python | gpl-2.0 | 8,236 |
#! /usr/bin/env python
"""
This script modifies the Mothur taxonomy-summary file by including the full
phylogeny in the taxon field. It also outputs additional files at different
taxonomic levels
Copyright:
modify_tax_summary modifies the Mothur taxonomy-summary file to including the full phylogeny in the taxo... | Brazelton-Lab/lab_scripts | modify_tax_summary.py | Python | gpl-2.0 | 6,277 |
#!/usr/bin/python
# Copyright 2016 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.
"""api_static_checks.py - Enforce Cronet API requirements."""
import argparse
import os
import re
import shutil
import sys
import tempfile... | endlessm/chromium-browser | components/cronet/tools/api_static_checks.py | Python | bsd-3-clause | 8,950 |
# Experiment with boundary for collections
L = [0, 1, 2, 3]
print('-------- Part A --------')
# Index beyond, generates a IndexError exception
try:
L[4] # part (a) of question
except IndexError as err:
print('IndexError Exception', err)
print('-------- Part B --------')
# Slice out of bounds
sliced = L[-10:10... | skellykiernan/pylearn | II/q2.py | Python | bsd-3-clause | 809 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
aspect.py
---------------------
Date : October 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
******************... | drnextgis/QGIS | python/plugins/processing/algs/gdal/aspect.py | Python | gpl-2.0 | 3,795 |
# encoding=utf8
import numpy as np
from mathpy.special.gamma import k_function
def test_kfunction():
expected = [1., 1., 4., 108., 27648.]
np.testing.assert_array_equal(expected, k_function(5))
| aschleg/mathpy | mathpy/special/tests/test_gamma.py | Python | mit | 207 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# admin.py
#
# Copyright 2014 Gary Dalton <gary@ggis.biz>
#
# 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 Licen... | gary-dalton/Twenty47 | twenty47/admin_dispatch.py | Python | mit | 7,059 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-02 05:04
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('opconsole', '0020_auto_20170501_2250'),
]
operations = [
mi... | baalkor/timetracking | opconsole/migrations/0021_auto_20170501_2304.py | Python | apache-2.0 | 655 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-01-07 22:05
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('computer_shop_app', '0002_auto_2... | marin117/django_computer_shop | computer_shop_app/migrations/0003_auto_20170107_2205.py | Python | gpl-3.0 | 1,494 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# main.py
# Copyleft (CC) 2016 martins <martins.mednis@llu.lv>
#
# ModeRator-gtk 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
... | MartinsMednis/moderator | src/moderator_gtk.py | Python | gpl-2.0 | 56,308 |
#!/usr/bin/python
import os, shutil, time
from ssh_exec import *
from scp_fetch import *
from pexpect_scp import *
from memstat import *
from sysmem import *
class TargetMachine:
def __init__(self, ip, port, user, password):
self.ip = ip
self.user = user
self.password = password
se... | neofang7/MyTools | memuse-python/src/target_machine.py | Python | apache-2.0 | 4,828 |
from login_form import LoginForm
| faical-yannick-congo/ddsm-cloud | smt_view/forms/__init__.py | Python | mit | 33 |
# coding: utf-8
'''
Copyright (c) 2010, Alexandru Dancu
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of condit... | BackupTheBerlios/kimchi | src/ui/mvc/delegate/KTableDelegate.py | Python | bsd-3-clause | 2,652 |
from math import log, exp, isnan
from random import random
def MH_acceptance(cur, prop, fb, acceptance_temperature=1.0):
"""Return a true/false, do we accept the proposal given the current sample.
Also handles all the weird corner cases for computing MH acceptance ratios.
"""
# If we get infs or are... | ebigelow/LOTlib | LOTlib/Inference/MHShared.py | Python | gpl-3.0 | 769 |
#!/usr/bin/env python3
from .proc_base import ProcBase
class ProcStack(ProcBase):
'''Object represents the /proc/[pid]/stack file.'''
def __init__(self, pid):
'''
Read file by calling base class constructor
which populates self.content. Since this
file is already ASCII printa... | EwanC/pyProc | proc_scraper/proc_stack.py | Python | mit | 608 |
__all__ = [
'InvalidHandshake', 'InvalidOrigin', 'InvalidState', 'InvalidURI',
'PayloadTooBig', 'WebSocketProtocolError',
]
class InvalidHandshake(Exception):
"""Exception raised when a handshake request or response is invalid."""
class InvalidOrigin(InvalidHandshake):
"""Exception raised when the o... | andrewyoung1991/websockets | websockets/exceptions.py | Python | bsd-3-clause | 809 |
###############################################################################
##
## Copyright (C) 2014 Tavendo GmbH
##
## 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:/... | frewsxcv/AutobahnPython | examples/twisted/wamp/basic/pubsub/decorators/backend.py | Python | apache-2.0 | 1,505 |
"""
Boolean geometry disjoin.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utilities.geometry.geometry_tools import path
from fab... | Pointedstick/ReplicatorG | skein_engines/skeinforge-44/fabmetheus_utilities/geometry/manipulation_meta/disjoin.py | Python | gpl-2.0 | 5,328 |
'''
Run tests listed in a package's definition file.
'''
from __future__ import print_function
def setup_parser(parser, completions=False):
parser.add_argument(
"-l", "--list", action="store_true",
help="list package's tests and exit")
parser.add_argument(
"--paths", type=str, default=... | cwmartin/rez | src/rez/cli/test.py | Python | lgpl-3.0 | 2,141 |
try:
from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QApplication
from PyQt5.QtOpenGL import QGLWidget, QGLFormat, QGLContext
QT_VERSION = 5
except:
from PyQt4.QtCore import QTimer
from PyQt4.QtGui import QApplication
from PyQt4.QtOpenGL import QGLWidget, QGLFormat, QGLContext
... | ethertricity/bluesky | utils/gltest.py | Python | gpl-3.0 | 2,241 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: Mcl_Cmd_RegistryKeys_DataHandler.py
def DataHandlerMain(namespace, InputFilename, OutputFilename):
import mcl.imports
import mcl.data.Input... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/DataHandlers/Mcl_Cmd_RegistryKeys_DataHandler.py | Python | unlicense | 1,571 |
#coding=UTF-8
from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext
from pyspark.sql.types import *
from datetime import date, datetime, timedelta
import sys, re, os
st = datetime.now()
conf = SparkConf().setAppName('PROC_O_CEN_CBOD_LNLNSJRN1').setMaster(sys.argv[2])
sc = SparkContext(conf = conf)
... | cysuncn/python | spark/crm/PROC_O_CEN_CBOD_LNLNSJRN1.py | Python | gpl-3.0 | 4,198 |
from flask import Flask, session, render_template, request, redirect, url_for
from random import randint
### Globals ###
app = Flask(__name__)
app.secret_key = '9*TGIKi7tggkuyUPJKdY%W^$WKLHOyjv,liIUFL>N>'
### Service / Utility Methods ###
def parsenum (s):
try:
return int(s)
except ValueError:
... | rfinz/flasktactoe | main.py | Python | cc0-1.0 | 6,516 |
"""Rename submission_window table to banner
Revision ID: 7b70f7defa50
Revises: 6f9353ce5ae9
Create Date: 2020-08-20 12:14:46.382634
"""
# revision identifiers, used by Alembic.
revision = '7b70f7defa50'
down_revision = '6f9353ce5ae9'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as... | fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/7b70f7defa50_rename_submission_window_table_to_banner.py | Python | cc0-1.0 | 1,026 |
import numpy
import chainer
from chainer import cuda
from chainer import function
from chainer.utils import type_check
if cuda.cudnn_enabled:
cudnn = cuda.cudnn
libcudnn = cudnn.cudnn
_algorithm = libcudnn.CUDNN_SOFTMAX_LOG
_mode = libcudnn.CUDNN_SOFTMAX_MODE_CHANNEL
def logsumexp(x):
xp = cuda.... | kiyukuta/chainer | chainer/functions/activation/log_softmax.py | Python | mit | 4,253 |
from numpy import dot, sum, tile, exp, log, pi, shape, reshape
from numpy.linalg import inv, pinv, LinAlgError, det
import logging
logger = logging.getLogger("KalmanFilter")
# X: state vector at k-1
# P: covariance matrix at k-1
# A: state transition matrix
# Q: process noise covariance matrix
# B: input ... | timdelbruegger/freecopter | src/python3/sensorfusion/kalman.py | Python | mit | 3,579 |
"""Test Entitlements models"""
import unittest
from datetime import timedelta
from django.conf import settings
from django.test import TestCase
from django.utils.timezone import now
from lms.djangoapps.certificates.models import CertificateStatuses # pylint: disable=import-error
from lms.djangoapps.certificates.api... | proversity-org/edx-platform | common/djangoapps/entitlements/tests/test_models.py | Python | agpl-3.0 | 9,335 |
from rest_framework import routers
from person_api.views import PersonViewSet
# Add in our routing for the person api
router = routers.DefaultRouter()
router.register(r'api/person', PersonViewSet, basename='person')
urlpatterns = router.urls | JustinWingChungHui/MyFamilyRoot | person_api/urls.py | Python | gpl-2.0 | 244 |
# vim:ts=4:sw=4:et:
# Copyright 2016-present Facebook, Inc.
# Licensed under the Apache License, Version 2.0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# no unicode literals
try:
import unittest2 as unittest
except ImportError:
import unittest
... | kwlzn/watchman | tests/integration/test_cppclient.py | Python | apache-2.0 | 1,527 |
#! /usr/bin/python3
def frange(start, stop, step):
i = start
while i < stop:
yield i
i += step
for i in frange(0,10,0.5):
print (i)
| mkhuthir/learnPython | Book_pythonlearn_com/04_loops/while_yield.py | Python | mit | 160 |
#!/usr/bin/env python
import sys
def ip2str(ip):
l = [
(ip >> (3*8)) & 0xFF,
(ip >> (2*8)) & 0xFF,
(ip >> (1*8)) & 0xFF,
(ip >> (0*8)) & 0xFF,
]
return '.'.join([str(i) for i in l])
def str2ip(line):
a, b, c, d = [int(s) for s in line.split('.')]
ip = 0
ip +... | owalch/oliver | linux/config/scripts/ipblock.py | Python | bsd-2-clause | 870 |
#
# APIInterface.py
#
# 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 in the hope that i... | octronic-uk/python-web-apis | octronic/webapis/common/APIInterface.py | Python | gpl-3.0 | 690 |
#!/usr/bin/python
import unittest
import os
import common
import remote
import data_dir
class RemoteFileTest(unittest.TestCase):
tmp_dir = data_dir.get_tmp_dir()
test_file_path = os.path.join(tmp_dir, "remote_file")
default_data = ["RemoteFile Test.\n", "Pattern Line."]
def __del__(self):
i... | CongSmile/virt-test | virttest/remote_unittest.py | Python | gpl-2.0 | 3,289 |
__author__ = 'williewonka'
#script that encodes a given symbol using hamming code
#import modules
import argparse
from math import ceil, log2
#function definitions
#Yield successive n-sized chunks from l
def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i+n]
#find number of bits needed for a sym... | williewonka/hamming_coder | hamming_code.py | Python | gpl-2.0 | 3,154 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
default_lead_sources = ["Existing Customer", "Reference", "Advertisement",
"Cold Calling", "Exhibition", "Supplie... | indictranstech/erpnext | erpnext/setup/setup_wizard/install_fixtures.py | Python | agpl-3.0 | 15,090 |
#! /usr/bin/env python
from openturns import *
from math import *
TESTPREAMBLE()
try :
# TEST NUMBER ZERO : DEFAULT CONSTRUCTOR AND STRING CONVERTER
print "test number zero : default constructor and string converter"
# Default constructor
symmetricMatrix0 =SymmetricMatrix()
# String converter
... | dbarbier/privot | python/test/t_SymmetricMatrix_std.py | Python | lgpl-3.0 | 4,523 |
from __future__ import unicode_literals
import warnings
from django.db import models
from django.db.utils import DatabaseError
from django.template import Context, Template
from django.test import TestCase, override_settings, skipUnlessDBFeature
from django.test.utils import isolate_apps
from django.utils.deprecation... | kawamon/hue | desktop/core/ext-py/Django-1.11.29/tests/managers_regress/tests.py | Python | apache-2.0 | 25,410 |
from local import (
generate_keypair,
sign
)
import transaction
from remote import Remote
from amount import Amount
| johansten/stellar-py | stellar/__init__.py | Python | bsd-3-clause | 120 |
from django.conf.urls import *
urlpatterns = patterns('',
(r'^setlang/$', 'django.views.i18n.set_language', {}, 'satchmo_set_language'),
)
| russellmayhew/satchmo | satchmo/apps/l10n/urls.py | Python | bsd-3-clause | 144 |
#!/bin/env python2.7
# -*- coding: utf-8 -*-
# This file is part of AT-Platform.
#
# EPlatform 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 ... | bjura/EPlatform | spellerMistake.py | Python | gpl-3.0 | 33,564 |
#
# Copyright (c) 2015 Christopher Felton, Nick Shaffner
#
# Master .UCF Reference:
# https://digilentinc.com/Data/Products/ANVYL/ANVYL-Master_UCF.zip
#
# Reference Manual:
# https://reference.digilentinc.com/_media/anvyl:anvyl_rm.pdf
#
from rhea.build import FPGA
from rhea.build.extintf import Port
from rhea.buil... | cfelton/rhea | rhea/build/boards/xilinx/_anvyl.py | Python | mit | 12,164 |
"""
Show how to use a lasso to select a set of points and get the indices
of the selected points. A callback is used to change the color of the
selected points
This is currently a proof-of-concept implementation (though it is
usable as is). There will be some refinement of the API.
"""
from matplotlib.widgets import... | digitie/magneto | native/wxmplplot/lasso.py | Python | unlicense | 2,364 |
# 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 agree... | nparley/mylatitude | lib/endpoints/apiserving.py | Python | mit | 21,729 |
from array import *
num_of_trips = {} # 0 means untouched, 1 means touched once, 2 means more than once
for i in xrange(0,1500001):
num_of_trips[i] = 0
triples = {}
for m in xrange(2,1225):
for n in xrange(1,m):
m2 = m*m
n2 = n*n
a = m2 - n2
b = 2*m*n
c = m2 + n2
... | kbrose/project_euler | p70-79/p75.py | Python | unlicense | 1,102 |
from setuptools import setup, find_packages
setup(name='BIOMD0000000405',
version=20140916,
description='BIOMD0000000405 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/BIOMD0000000405',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/BIOMD0000000405 | setup.py | Python | cc0-1.0 | 377 |
from framework.dependency_management.dependency_resolver import ServiceLocator
from framework.lib.general import get_file_as_list
DESCRIPTION = "Runs commands on an agent server via SSH -i.e. for IDS testing-"
CHANNEL = 'SSH'
def run(PluginInfo):
Content = []
plugin_params = ServiceLocator.get_component("pl... | DarKnight24/owtf | plugins/auxiliary/rce/SSH_Commander@OWTF-ARCE-001.py | Python | bsd-3-clause | 1,959 |
#!/usr/bin/env python
"""Setting up closed-form-matting package during pip installation"""
import os
import re
import setuptools
# Project root directory
root_dir = os.path.dirname(__file__)
# Get version string from __init__.py in the package
with open(os.path.join(root_dir, 'closed_form_matting', '__init__.py')) ... | MarcoForte/closed-form-matting | setup.py | Python | mit | 1,729 |
#!/usr/bin/python
#
# Copyright (c) 2017 David LePage
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: firewall_rule_facts
shor... | gabstopper/ansible-stonesoft | library/firewall_rule_facts.py | Python | apache-2.0 | 10,465 |
# Copyright 2013 Douglas Linder
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | shadowmint/py-test-watcher | lib/nark/tests/nark/implements_tests.py | Python | apache-2.0 | 2,812 |
# This program plots the void fraction in the radial direction for the Couette-Tetlow case
#Usage : python plotSingleTetlow.py NAME_OF_FILE
#Data in the file must be in the format "r voidfraction"
# Author : Bruno Blais
# Last modified : 03-03-2014
#Python imports
import os
import math
import numpy
import matplotli... | blaisb/cfdemUtilities | couette/compareSingleTetlow.py | Python | lgpl-3.0 | 1,145 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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.
T... | JamesLinEngineer/RKMC | addons/plugin.video.salts/scrapers/wmo_scraper.py | Python | gpl-2.0 | 3,207 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pyQode documentation build configuration file, created by
# sphinx-quickstart on Thu Jan 3 17:16:17 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogene... | eugeniodilo/OpenCobolIDE | doc/source/conf.py | Python | gpl-3.0 | 8,555 |
# Copyright 2011-2012 James McCauley
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | kulawczukmarcin/mypox | tests/__init__.py | Python | apache-2.0 | 1,172 |
##
# Copyright 2016-2019 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | gppezzi/easybuild-framework | easybuild/framework/easyconfig/style.py | Python | gpl-2.0 | 6,388 |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns
from django.conf.urls.defaults import url
urlpatterns = patterns('user_profile.views',
#profile rest
url(r'^',
'profile',
name="api_profile"),
)
| geonition/django_user_profile | user_profile/urls.py | Python | mit | 305 |
from django.contrib import admin
from simple_history.admin import SimpleHistoryAdmin
from .models import ContactNumber, InstituteAddress, Program, SecondaryEmail, SentMessage
class InstituteAddressAdmin(SimpleHistoryAdmin):
list_display = ['id', 'user', 'hostel', 'room']
list_filter = ['hostel']
search_f... | DheerendraRathor/ldap-oauth2 | user_resource/admin.py | Python | gpl-3.0 | 1,652 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | windskyer/nova | nova/tests/unit/scheduler/filters/test_exact_ram_filter.py | Python | gpl-2.0 | 1,505 |
import os
import numpy as np
import h5py
import time
from pyscf import gto, scf, mp, cc, ci, fci, ao2mo
from pyscf.cc import ccsd_rdm
from frankenstein.be.sd import SD
from frankenstein.tools.tensor_utils import get_symm_mat_pow
from frankenstein.be.sd import schmidt_decomposition, schmidt_decomposition_new
from fran... | hongzhouye/frankenstein | pyscf_be/pysd.py | Python | bsd-3-clause | 35,392 |
# Copyright (c) 2016 Jon Cooper
#
# This file is part of py-collide.
# Documentation, related files, and licensing can be found at
#
# <https://github.com/joncoop/py-collide>.
# Imports
import pygame
import intersects
# Initialize game engine
pygame.init()
# Window
SIZE = (800, 600)
TITLE... | joncoop/py-collide | collision_tester.py | Python | mit | 2,518 |
import requests
import json
import httplib as http
import celery
from celery.utils.log import get_task_logger
from framework.celery_tasks import app as celery_app
from framework.celery_tasks.utils import logged
from framework.exceptions import HTTPError
from website.archiver import (
ARCHIVER_SUCCESS,
ARCHIV... | aaxelb/osf.io | website/archiver/tasks.py | Python | apache-2.0 | 11,540 |
# Copyright 2015-2019 Cedric RICARD
#
# This file is part of CloudMailing.
#
# CloudMailing is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... | ricard33/cloud-mailing | cloud_mailing/common/cm_logging.py | Python | agpl-3.0 | 5,409 |
from __future__ import print_function, absolute_import
import numpy as np
from numba import cuda, config, int32, int64, float32, float64
from numba.cuda.testing import unittest, SerialMixin, skip_on_cudasim
def useful_syncwarp(ary):
i = cuda.grid(1)
if i == 0:
ary[0] = 42
cuda.syncwarp(0xffffffff)... | jriehl/numba | numba/cuda/tests/cudapy/test_warp_ops.py | Python | bsd-2-clause | 7,921 |
# -*-mode: python; py-indent-offset: 4; tab-width: 8; coding: utf-8; encoding: utf-8-dos -*-
# This Python script requires pyzmq
# http://pypi.python.org/packages/source/p/pyzmq/
import sys
import traceback
import time
import zmq
from OTMql427.ZmqListener import ZmqMixin
from OTLibLog import vError, vWarn, vInfo, v... | MetaMemoryT/OTMql4Zmq | bin/ZmqBinListener.py | Python | mit | 4,556 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# no... | nuagenetworks/vsdcli | setup.py | Python | bsd-3-clause | 2,411 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | stitchfix/pybossa | test/test_model/test_model_base.py | Python | agpl-3.0 | 3,576 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.utils.timezone import utc
import datetime
class Migration(migrations.Migration):
dependencies = [
('jobs', '0006_image'),
]
operations = [
migrations.AddField(
... | marchchad/GatorApp | jobs/migrations/0007_auto_20150323_2226.py | Python | gpl-2.0 | 1,410 |
# -*- coding: utf-8 -*-
from module.plugins.internal.Crypter import Crypter, create_getInfo
class XupPl(Crypter):
__name__ = "XupPl"
__type__ = "crypter"
__version__ = "0.13"
__status__ = "testing"
__pattern__ = r'https?://(?:[^/]*\.)?xup\.pl/.+'
__config__ = [("activated" , ... | fzimmermann89/pyload | module/plugins/crypter/XupPl.py | Python | gpl-3.0 | 971 |
#!/usr/bin/env python
from app.main import app
if __name__ == '__main__':
app.run(debug=True, host="127.0.0.1")
#app.run(debug=True, host="ignalion.me")
| Ignalion/bookshelf | run.py | Python | gpl-2.0 | 163 |
#
# Copyright (C) 2013 by Gilbert Ramirez <gram@alumni.rice.edu>
#
# SPDX-License-Identifier: GPL-2.0-or-later
import os.path
import unittest
# Run by unittest.defaultTestLoader.discover in test.py
def load_tests(loader, standard_tests, pattern):
this_dir = os.path.dirname(__file__)
package_tests = loader.d... | zzqcn/wireshark | test/suite_dissectors/__init__.py | Python | gpl-2.0 | 439 |
#!/usr/bin/env python3
# Copyright (c) 2017-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test message sending before handshake completion.
Before receiving a VERACK, a node should not send an... | JeremyRubin/bitcoin | test/functional/p2p_leak.py | Python | mit | 7,392 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.