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 |
|---|---|---|---|---|---|
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2013 Task Coach developers <developers@taskcoach.org>
Task Coach 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
... | TaskEvolution/Task-Coach-Evolution | taskcoach/buildlib/__init__.py | Python | gpl-3.0 | 979 |
from django.shortcuts import render
from rest_framework import viewsets
from waterfall_wall.serializers import ImageSerializer
from waterfall_wall.models import Image
def index(request):
context = {}
return render(request, 'waterfall_wall/index.html', context)
class ImageViewSet(viewsets.ModelViewSet):
"... | carlcarl/rcard | waterfall_wall/views.py | Python | mit | 455 |
#!/usr/bin/python
Settings.ActionLogs=1
Settings.InfoLogs=1
Settings.DebugLogs=1
import os
import sys
global f
f=open("/root/Documents/test.sikuli/result",'w')
global fp
def execute(fname,text):
fp=os.popen("date")
dt=fp.read()
f.write(dt)
f.write("start double click\n")
App.open("/usr/bin/leafpad "+fname)
#do... | elliott10/qemu-instru-tracer | sikulitest/test-leafpad.sikuli/test.py | Python | gpl-2.0 | 1,180 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
SCLEX_CONTAINER = 0
SCLEX_NULL = 1
SCLEX_PYTHON = 2
SCLEX_CPP = 3
SCLEX_HTML = 4
SCLEX_XML = 5
SCLEX_PERL = 6
SCLEX_SQL = 7
SCLEX_VB = 8
SCLEX_PROPERTIES = 9
SCLEX_ERRORLIST = 10
SCLEX_MAKEFILE = 11
SCLEX_BATCH = 12
SCLEX_XCODE = 13
SCLEX_LATEX = 14
SCLEX_LUA = 15
SCLEX_DI... | gejzenbug/scintilla-python-constants | scilexer_constants.py | Python | gpl-3.0 | 39,179 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-05 12:39
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('stein', '0014_auto_20161008_1817'),
]
operations = [
migrations.RenameField(
model_name='mineraltype',
... | GeoMatDigital/django-geomat | geomat/stein/migrations/0015_auto_20161105_1339.py | Python | bsd-3-clause | 408 |
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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... | ColdrickSotK/storyboard | storyboard/db/api/subscription_events.py | Python | apache-2.0 | 1,505 |
from django.conf import settings
from django.contrib import messages
from django.core.exceptions import MultipleObjectsReturned, PermissionDenied
from django.http.response import Http404, HttpResponse
from django.shortcuts import get_object_or_404
from django.utils.decorators import method_decorator
from django.utils.t... | ttsirkia/a-plus | exercise/views.py | Python | gpl-3.0 | 11,057 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Evan Purkhiser
# 2014 Ben Ockmore
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
"""AIFF audio stream information a... | RossLote/cloudplayer | mutagen/aiff.py | Python | mit | 10,838 |
# -*- coding: utf-8 -*-
#
# (c) 2016 Boundless, http://boundlessgeo.com
# This code is licensed under the GPL 2.0 license.
#
import traceback
from qgis.PyQt import QtCore
from qgis.core import *
from geoserverexplorer.qgis import layers as qgislayers
from geoserverexplorer.qgis.catalog import CatalogWrapper
from geoser... | boundlessgeo/qgis-geoserver-plugin | geoserverexplorer/gui/gsoperations.py | Python | gpl-2.0 | 8,115 |
"""@author David H. Roscoe, Matthew J. Wood and Sebastien E. Bourban
"""
"""@note ... this work is based on a collaborative effort between
.________. ,--.
| | . ( (
|,-. / HR Wallingford ... | ArteliaTelemac/PostTelemac | PostTelemac/meshlayerparsers/libs_telemac/parsers/parserSortie.py | Python | gpl-3.0 | 10,976 |
import random, string
from tests.testbase import TestBase
from mangopaysdk.mangopayapi import MangoPayApi
from mangopaysdk.types.pagination import Pagination
from mangopaysdk.tools.filtertransactions import FilterTransactions
from mangopaysdk.types.exceptions.responseexception import ResponseException
from mangopaysdk.... | ebewe/mangopay2-python-sdk | tests/testevents.py | Python | mit | 1,559 |
__author__ = 'fahadadeel'
import jpype
import os.path
from quickstart import HelloWorld
asposeapispath = os.path.join(os.path.abspath("../../../"), "lib")
print "You need to put your Aspose.Words for Java APIs .jars in this folder:\n"+asposeapispath
jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.ext.dirs=%s" % as... | aspose-words/Aspose.Words-for-Java | Plugins/Aspose_Words_Java_for_Python/tests/quickstart/HelloWorld/HelloWorld.py | Python | mit | 370 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/internal/more_extensions_dynamic.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import descr... | jerryjobs/thirdpartPushSystem | push/getui/google/protobuf/internal/more_extensions_dynamic_pb2.py | Python | apache-2.0 | 3,283 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import uuid
from odoo import api, fields, models
from odoo.modules.module import get_resource_path
RATING_LIMIT_SATISFIED = 5
RATING_LIMIT_OK = 3
RATING_LIMIT_MIN = 1
class Rating(models.Model):
_na... | ygol/odoo | addons/rating/models/rating.py | Python | agpl-3.0 | 8,091 |
# Copyright 2011 Viewfinder Inc. All Rights Reserved.
"""Utility tests.
ParseHostPort(): parses host:port string and returns tuple
"""
__authors__ = ['spencer@emailscrubbed.com (Spencer Kimball)'
'andy@emailscrubbed.com (Andy Kimball)']
import logging
import time
import unittest
from datetime impor... | qskycolor/viewfinder | backend/base/test/util_test.py | Python | apache-2.0 | 14,005 |
import numpy as np
import math
import itertools
from mlat import geodesy, constants
from mlat.server import config, solver
import scipy
import json
import datetime
import time
import sys
'''
伪逆法求解时差定位的非线性方程组
'''
def tdoa_pinv_solve(measurements, debug=None, altitude=10000, altitude_error=None):
'''
分组求解
... | bmeyang/mlat-server | mlat/server/pinvalg.py | Python | agpl-3.0 | 28,161 |
p.argma<caret> | siosio/intellij-community | python/testData/completion/notImportedQualifiedName/AliasAttributesShouldNotBeDuplicated/main.py | Python | apache-2.0 | 14 |
#!/usr/bin/python
#
# Copyright 2017 Google 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 a... | jamesmawm/tensorflow-image-classifier | scripts/show_image.py | Python | mit | 1,212 |
from __future__ import absolute_import
from collections import Iterable
__all__ = ['coerce_tuple']
def coerce_tuple(arg, *excludes):
"""
If the argument *arg* is:
* None, return empty tuple
* an Iterable but not instance of *excludes*, by default (basestring,)
* anything else as one element tupl... | katakumpo/nicedjango | nicedjango/utils/py/args.py | Python | mit | 561 |
import sys
import argparse
import numpy as np
def parseArgument():
# Parse the input
parser = argparse.ArgumentParser(description="Process results from LOLA")
parser.add_argument("--lolaResultsFileNameListFileName", required=True, help="List of file names with LOLA results")
parser.add_argument("--lolaHeadersFileN... | imk1/IMKTFBindingCode | processLolaResults.py | Python | mit | 4,260 |
from kqml import KQMLList, KQMLString
from tfta.tfta import TFTA
from tfta.tfta_module import TFTA_Module
from bioagents.tests.util import ekb_from_text, ekb_kstring_from_text, \
get_request, agent_clj_from_text
from bioagents.tests.integration import _IntegrationTest, _FailureTest
from... | xzhang2016/tfagent | tfta/test/test2_json.py | Python | bsd-2-clause | 40,826 |
# Author: echel0n <echel0n@sickrage.ca>
# URL: https://sickrage.ca
#
# This file is part of SickRage.
#
# SickRage 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... | SiCKRAGETV/SickRage | sickrage/libs/enzyme/ogm.py | Python | gpl-3.0 | 10,684 |
# Copyright (C) 2014-2015 The BET Development Team
import bet.calculateP.calculateP as calcP
import bet.calculateP.simpleFunP as sfun
import numpy as np
import scipy.io as sio
import bet.util as util
from bet.Comm import comm
# Import "Truth"
mdat = sio.loadmat('Q_2D')
Q = mdat['Q']
Q_ref = mdat['Q_true']
# Import D... | scottw13/BET-1 | examples/fromFile_ADCIRCMap/Q_2D_parallel.py | Python | gpl-3.0 | 3,038 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import unittest
from odoo.tests import common
#: Stores state information across multiple test classes
test_state = None
def setUpModule():
global test_state
test_state = {}
def tearDownModule():
global ... | ayepezv/GAD_ERP | openerp/addons/base/tests/test_phase.py | Python | gpl-3.0 | 1,729 |
# Copyright (C) 2013-2014 Computer Sciences Corporation
#
# 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 a... | ezbake/ezbake-base-thrift | src/main/python/ezbakeBasePurgeService/EzBakeBasePurgeService.py | Python | apache-2.0 | 38,932 |
# 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... | lonerr/ansible | lib/ansible/module_utils/urls.py | Python | gpl-3.0 | 17,295 |
import unittest
from tsb.tsb import TSB
from Tkinter import *
class TestTSB(unittest.TestCase):
def setUp(self):
root = Tk()
self.tsb = TSB(root)
def tearDown(self):
self.tsb = None
def test_toggle_mode(self):
"""Tests toggle_mode"""
self.assertEqual("move", self.tsb.mode)
self.tsb.toggle_mode()
sel... | Ghalko/tkinterSnapBoard | test/test_tsb.py | Python | gpl-2.0 | 584 |
import time
from watchdog.observers import Observer
from watchdog.events import FileModifiedEvent, FileSystemEventHandler
import sys
from subprocess import call
class MdCompileHandler(FileSystemEventHandler):
def on_modified(self, event):
if isinstance(event, FileModifiedEvent) and event.src_path.endswith(... | andersoncardoso/small_scripts | landslide_presentation/larc/md_watchdog.py | Python | mit | 777 |
"""
This config file follows the devstack enviroment, but adds the
requirement of a celery worker running in the background to process
celery tasks.
When testing locally, run lms/cms with this settings file as well, to test queueing
of tasks onto the appropriate workers.
In two separate processes on devstack:
pav... | edx/edx-platform | lms/envs/devstack_with_worker.py | Python | agpl-3.0 | 1,029 |
# Pickup.py
# Aaron Taylor
# Moose Abumeeiz
#
# This is the class for the HUD pickups (keys, bombs, coins)
#
from pygame import *
class Pickup:
"""The class for the HUD pickup counters"""
def __init__(self, variant, textures, font):
self.variant = variant
self.score = 0
self.font = font
self.digit1 = fon... | ExPHAT/binding-of-isaac | Pickup.py | Python | mit | 1,262 |
#
# This file is part of the PyMeasure package.
#
# Copyright (c) 2013-2017 PyMeasure Developers
#
# 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 limit... | TvBMcMaster/pymeasure | pymeasure/console.py | Python | mit | 2,125 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class Cloverleaf(MakefilePackage):
"""Proxy Application. CloverLeaf is a miniapp that solves the
compressible ... | iulian787/spack | var/spack/repos/builtin/packages/cloverleaf/package.py | Python | lgpl-2.1 | 3,330 |
# -*- coding: utf-8 -*-
"""Misc os module tests
Made for Jython.
"""
import os
import sys
import glob
import array
import errno
import struct
import unittest
import subprocess
from test import test_support
from java.io import File
class OSFileTestCase(unittest.TestCase):
def setUp(self):
open(test_sup... | EnviroCentre/jython-upgrade | jython/lib/test/test_os_jy.py | Python | mit | 17,752 |
# META: timeout=long
import pytest
from tests.support.asserts import (
assert_error,
assert_same_element,
assert_success,
assert_dialog_handled,
)
def find_elements(session, shadow_id, using, value):
return session.transport.send(
"POST", "session/{session_id}/shadow/{shadow_id}/elements... | scheib/chromium | third_party/blink/web_tests/external/wpt/webdriver/tests/find_elements_from_shadow_root/user_prompts.py | Python | bsd-3-clause | 4,738 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 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
... | vlegoff/tsunami | src/primaires/information/editeurs/hedit/edt_resume.py | Python | bsd-3-clause | 2,164 |
# ------------------------------------------------------------------------------
# This file is part of Appy, a framework for building applications in the Python
# language. Copyright (C) 2007 Gaetan Delannay
# Appy is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public ... | Eveler/libs | __Python__/ufms_blanks/appy3/fields/file.py | Python | gpl-3.0 | 20,693 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Grant AO. All rights reserved.
from da.dbutil import SqlRunner
from utils.email_ import SendEmail
def execute_stmt(stmt):
runner = SqlRunner()
rows, _ = runner.select(stmt)
return rows
@SendEmail('up_trend')
def send_up_trend_email():
stmt = '''
S... | aojwang/afxt | recommend_email.py | Python | gpl-3.0 | 2,053 |
#!/usr/bin/python
import logging
import flask
import json
import os
import sys
import signal
import time
import urllib2, urllib
import traceback
from collections import OrderedDict
from xml.etree import ElementTree as ET
from multiprocessing import Pipe, Event, Manager, Lock
from beekeeperwids.utils.errors import Err... | riverloopsec/beekeeperwids | beekeeperwids/wids/daemon.py | Python | gpl-2.0 | 17,388 |
#!/usr/bin/env python3
import sys
#variables from source_codes
Zero = [" *** ",
" * * ",
"* *",
"* *",
"* *",
" * * ",
" *** "]
One = [" * ", "** ", " * ", " * ", " * ", " * ", "***"]
Two = [" *** ", "* *", "* * ", " * ", " * ", "* ", "****... | XDindane/Programming-in-Python-3 | Lesson_1/8_making_and_calling_functions_bigdigits.py | Python | gpl-2.0 | 1,496 |
#!/usr/bin/env python
'''
A small script to convert dataset to pickle format file
'''
__author__ = "Nithish Divakar"
__copyright__ = "Copyright 2007, The Cogent Project"
__credits__ = ["", ""]
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "Nithish Divakar"
__email__ = "nithish.divakar@gmail.com"
__status__... | nithishdivakar/utilities | test/pickler.py | Python | gpl-3.0 | 1,713 |
from django.db import models
from elastic_django.models import ElasticModel
class Book(ElasticModel):
"""
Main 'Book' model.
"""
title = models.CharField(max_length=200)
author = models.CharField(max_length=100)
isbn = models.CharField(max_length=13, null=True, blank=True)
publication_yea... | jose-lpa/elastic-django | tests/models.py | Python | bsd-3-clause | 1,267 |
from flask import Flask, request, make_response
app = Flask(__name__)
# reading cookies
@app.route('/read')
def index():
username = request.cookies.get('username')
# storing cookies
@app.route('/store')
def index():
resp = make_response(render_template(...))
resp.set_cookie('username', 'the username')
return re... | HiroIshikawa/21playground | flask-sample/cookies/cookies.py | Python | mit | 322 |
# Copyright 2014 Telefonica Investigacion y Desarrollo, S.A.U
#
# This file is part of FIGWAY software (a set of tools for FIWARE Orion ContextBroker and IDAS2.6).
#
# FIGWAY 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 ... | telefonicaid/fiware-figway | python-IDAS4/ContextBroker/GetEntityById.py | Python | agpl-3.0 | 2,786 |
"""
Utilities related to API views
"""
import functools
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
from django.http import Http404
from django.utils.translation import ugettext as _
from rest_framework import status, response
from rest_framework.exceptions import APIException
from rest_framew... | simbs/edx-platform | openedx/core/lib/api/view_utils.py | Python | agpl-3.0 | 9,170 |
from unittest import skipIf
from django.conf import settings
def skipIfDefaultUser(test_func):
"""
Skip a test if a default user model is in use.
"""
return skipIf(settings.AUTH_USER_MODEL == "auth.User", "Default user model in use")(
test_func
)
def skipIfCustomUser(test_func):
"""... | yunojuno/django-request-profiler | tests/utils.py | Python | mit | 491 |
#
# 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
# ... | redhat-openstack/heat | heat/engine/resources/vpc.py | Python | apache-2.0 | 4,422 |
#!/usr/bin/env python
# encoding: utf-8
def singleton(cls, *args, **kw):
instances = {}
def _singleton():
if cls not in instances:
instances[cls] = cls(*args, **kw)
return instances[cls]
return _singleton
| iTaa/soja_box | singleton/soja_singleton.py | Python | mit | 248 |
#!/usr/bin/env python
import unittest
import challenge.basics
import challenge.converters
class SwigTestCase(unittest.TestCase):
"""Test case for for Swig typemaps for Doodads.
"""
def test_shared_ptr_return(self):
"""Test that a Swig-built module can return a "shared_ptr<Doodad>".
"""
... | TallJimbo/python-cpp-challenge | tests/converters_test.py | Python | mit | 2,510 |
"""
mbed SDK
Copyright (c) 2011-2015 ARM Limited
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 wr... | mnlipp/mbed | workspace_tools/compliance/ioper_test_fs.py | Python | apache-2.0 | 2,227 |
""" A collection of input methods that aren't necessarily buttons """
from rcfc.server import register_post_with_state, register_post_with_input
from rcfc.groups import convertGroup
class DIRECTIONAL:
LEFT = "left"
RIGHT = "right"
def slider(text, getter, input_range=(0, 100), group=None):
min_value, m... | pviafore/rcfc | rcfc/input_methods.py | Python | mit | 1,204 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditio... | Petr-Kovalev/nupic-win32 | tests/unit/py2/nupic/support/configuration_test.py | Python | gpl-3.0 | 29,985 |
# -*- coding: utf-8 -*-
from scrapy.spiders import CrawlSpider,Rule
from scrapy.selector import Selector
from scrapy.http import Request
from webspider.baseclass.base_spider import Base_Spider
from webspider.config.websetting import ZhixingCfg
class ZxSpider(CrawlSpider):
name = 'zhixing'
d... | haipersist/webspider | spider/jobspider/spiders/zhixing.py | Python | mit | 2,223 |
import os
import sys
if sys.version_info[0] == 2:
_ENCODE = sys.getfilesystemencoding()
def path_join(*args):
bin_args = map(lambda a: a.decode(_ENCODE), args)
return os.path.join(*bin_args).encode(_ENCODE)
def str_join(s, l):
bin_args = map(lambda a: a.decode(_ENCODE), l)
... | jcgruenhage/dendrite | vendor/src/github.com/apache/thrift/test/crossrunner/compat.py | Python | apache-2.0 | 552 |
try:
from setuptools import setup
except ImportError:
from distuils.core import setup
config = {
'description': 'My Project',
'author': 'JHD',
'author_email': 'jonathanhennessydoylety@gmail.com',
'version': '0.1',
'install_requires': ['nose'],
'packages': ['Battleship'],
'script... | jhd/pyBattleship | setup.py | Python | gpl-2.0 | 381 |
from PIL import Image
import os
# složka s obrázky
IMG_DIR = "obrazky"
# jména souborů v takovém uspořádání, jak se budou spojovat
names = [["Praha_4_0_13_rgb.jpg","Praha_4_0_14_rgb.jpg"],
["Praha_4_0_31_rgb.jpg","Praha_4_0_32_rgb.jpg"]]
images = []
for row in names:
imgrow = []
for name in row:
... | xtompok/uvod-do-prg | rastr/stitch.py | Python | mit | 793 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
try:
... | OneCoin-development/OneCoin | qa/rpc-tests/abandonconflict.py | Python | mit | 7,627 |
from scipy.optimize import minimize
import numpy as np
from linearRegCostFunction import linearRegCostFunction
def trainLinearReg(X, y, Lambda, method='CG', maxiter=200):
"""trains linear regression using
the dataset (X, y) and regularization parameter lambda. Returns the
trained parameters theta.
... | JediKoder/coursera-ML | ex5/trainLinearReg.py | Python | mit | 730 |
#! /usr/bin/env python
import sys
import os
import gtk
from arithmetic import Parser
class Editor(object):
'A minimal editor'
def __init__(self):
# path to UI file
scriptPath = os.path.split( sys.argv[0] )[0]
uiFilePath = os.path.join( scriptPath,'editor.ui' )
self.builder = ... | ppaez/arithmetic | editor-gtk.py | Python | gpl-2.0 | 2,609 |
from __future__ import division
import gzip
try:
from BytesIO import BytesIO
except ImportError:
from io import BytesIO
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
import hdfs
import networkx as nx
import pandas as pd
from mrjob.job import MRJob
from mrjo... | danjamker/DiffusionSimulation | MRJobNetworkXSimulations-Generator.py | Python | mit | 4,612 |
from django.contrib import admin
def list_apps():
apps = []
for model, model_admin in admin.site._registry.items():
app_label = model._meta.app_label
apps.append(app_label)
apps = [(a, a) for a in sorted(set(apps))]
return apps
def list_models():
apps = {}
for model, mode... | 20tab/twentytab-customadmin | customadmin/utils.py | Python | mit | 798 |
import os
import pytest
from rdflib.graph import Graph, ConjunctiveGraph
import unittest
from rdflib.term import Literal, URIRef
from rdflib.plugins.parsers.notation3 import BadSyntax, exponent_syntax
import itertools
from urllib.error import URLError
from test import TEST_DIR
test_data = """
# Definitions of term... | RDFLib/rdflib | test/test_n3.py | Python | bsd-3-clause | 8,671 |
from setuptools import find_packages, setup
setup(
name="intermix",
version="0.1.0",
description="HTML5 canvas output for Python applications",
long_description="Intermix is a library that provides Python applications with a real-time API to draw in an HTML5 canvas served by the builtin web server",
... | trehn/intermix | setup.py | Python | isc | 1,201 |
import unittest
from rx import Observable
from rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable
from rx.disposables import Disposable, SerialDisposable
from rx.subjects import Subject
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscr... | dbrattli/RxPY | tests/test_observable/test_pausablebuffered.py | Python | apache-2.0 | 12,262 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'SampleManifest'
db.create_table('sample_manifest', (
('id', self.gf('django.db.m... | chop-dbhi/varify-data-warehouse | vdw/samples/migrations/0028_auto__add_samplemanifest.py | Python | bsd-2-clause | 24,963 |
"""
Helper functions for mlab. These combine creation of the data sources,
and applying the modules to them to make standard visualization
operation. They should always return the module object created, for
consistency, and because retrieving the vtk data source from a module object
is possible via tools.get_vtk_src
E... | liulion/mayavi | mayavi/tools/helper_functions.py | Python | bsd-3-clause | 40,211 |
"""
sphinx.ext.mathjax
~~~~~~~~~~~~~~~~~~
Allow `MathJax <https://www.mathjax.org/>`_ to be used to display math in
Sphinx's HTML writer -- requires the MathJax JavaScript library on your
webserver/computer.
:copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
:license: BSD, se... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/sphinx/ext/mathjax.py | Python | mit | 4,630 |
"""
Component to keep track of user controlled booleans for within automation.
For more details about this component, please refer to the documentation
at https://home-assistant.io/components/input_boolean/
"""
import logging
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID, CONF_ICON, C... | tinloaf/home-assistant | homeassistant/components/input_boolean.py | Python | apache-2.0 | 3,609 |
import sys
from os.path import join, dirname
VERSION_FILE = join(dirname(__file__), "VERSION")
def get_version():
with open(VERSION_FILE, 'r') as ver:
return ver.readline().strip()
VERSION = get_version()
__version__ = VERSION
# Needed by setup.py and thus cannot live in Constants as it contains the
... | sophiavanvalkenburg/coala | coalib/__init__.py | Python | agpl-3.0 | 592 |
#!/usr/bin/python
"""
Main executable for the servers.
Copyright (C) 2009 by Steven Wallace <snwallace@gmail.com>,
Josh Bohde <josh.bohde@gmail.com >
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public Licen... | joshbohde/megaminer-framework | server/main.py | Python | agpl-3.0 | 3,641 |
from bearlibterminal import terminal
from clubsandwich.ui import (
UIScene,
SingleLineTextInputView,
LabelView,
CyclingButtonView,
ButtonView,
LayoutOptions,
WindowView,
)
from components.needs import Needs
from data.python_templates.classes import character_class_templates
from data.python... | ChrisLR/Python-Roguelike-Template | scenes/character_creation/scene.py | Python | mit | 9,203 |
from flask_restful import Api
from werkzeug.wrappers import Response
from flask import make_response
from redash.utils import json_dumps
from redash.handlers.base import org_scoped_rule
from redash.handlers.alerts import AlertResource, AlertListResource, AlertSubscriptionListResource, AlertSubscriptionResource
from re... | pubnative/redash | redash/handlers/api.py | Python | bsd-2-clause | 6,300 |
# -*- coding: utf-8 -*-
"""
================================================
:mod:`onebot.plugins.urlinfo` Urlinfo plugin
================================================
This plugin shows information about urls posted.
"""
from contextlib import closing
import re
import pickle
import ipaddress
import socket
import... | thomwiggers/onebot | onebot/plugins/urlinfo.py | Python | bsd-3-clause | 19,350 |
#!/usr/bin/env python
"""Shared classes between the client and the server for plist parsing."""
import calendar
import datetime
from grr.lib import lexer
from grr.lib import objectfilter
from grr.parsers import binplist
class PlistFilterParser(objectfilter.Parser):
"""Plist specific filter parser.
Because we ... | wandec/grr | lib/plist.py | Python | apache-2.0 | 5,405 |
#!/usr/bin/python
from __future__ import division
import sys
import math
from math import sin, cos
ALPHA = (math.pi / 6)
POWER = 75
ROTATION = 0
def s_constants(v, S, s):
a = (0.3333 / v)*(S - v * s[0]) - s[0]
b = (s[1]/(2*cos(ALPHA))) + (1 / (2*v*(1 + sin(ALPHA)))) * (S - v*s[0])
c = -(s[1]/(2*cos(ALPHA))... | koudis/robot | smile/sim/omni2.py | Python | gpl-2.0 | 1,555 |
import unittest
import os.path
import sys
import mtree.tests.fixtures as fixtures
import mtree.tests.fixtures.generator as generator
from mtree import MTree
import mtree.functions as f
class Test(unittest.TestCase):
def setUp(self):
# Removing randomness
def not_random_promotion(data_objects, distance_fun... | erdavila/M-Tree | py/mtree/tests/test_mtree.py | Python | mit | 7,248 |
from .bases import _StandardStemmer
from whoosh.compat import u
class SpanishStemmer(_StandardStemmer):
"""
The Spanish Snowball stemmer.
:cvar __vowels: The Spanish vowels.
:type __vowels: unicode
:cvar __step0_suffixes: Suffixes to be deleted in step 0 of the algorithm.
:type __step0_suff... | Backflipz/plugin.video.excubed | whoosh/lang/snowball/spanish.py | Python | gpl-2.0 | 10,997 |
# graphics.py
"""Simple object oriented graphics library
The library is designed to make it very easy for novice programmers to
experiment with computer graphics in an object oriented fashion. It is
written by John Zelle for use with the book "Python Programming: An
Introduction to Computer Science" (Franklin, Beedle ... | emilydolson/forestcat | pyrobot/pyrographics.py | Python | agpl-3.0 | 28,851 |
import json
from scholarScape.server.rpc import scholarScape
from scholarScape.server import rpc
from flexmock import flexmock
class TestJsonRPCIsolation:
def test_give_me_duplicates_no_cluster_id(self):
expected = [{"test1" : 1},{"test2" : 2},{"test3" : 3}]
Duplicates = flexmock(rpc.Duplicates)
... | medialab/scholarScape | scholarScape/test/isolation/test_jsonrpc.py | Python | lgpl-3.0 | 3,909 |
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, fields
class AccountAccountTag(models.Model):
... | ingadhoc/odoo-argentina | l10n_ar_ux/models/account_account_tag.py | Python | agpl-3.0 | 403 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Telemac2ContoursDialog
A QGIS plugin
Création de contours à partir d'un fichier TELEMAC
-------------------
begin : 2015-05-27
... | ArteliaTelemac/PostTelemac | PostTelemac/meshlayerdialogs/posttelemacvirtualparameterdialog.py | Python | gpl-3.0 | 6,099 |
from django.db import models
from django.dispatch import receiver
from django.db.models.signals import post_save
from sforce.api.client import JsonResource, ModelResource
from sforce.api.client import ModelBasedApi
class MyUser(models.Model):
first_name = models.CharField(max_length=64)
last_name = models.Ch... | liberation/django-sforce | testproject/testproject/testapp/models.py | Python | bsd-3-clause | 1,100 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##
## Author: Adriano Monteiro Marques <adriano@umitproject.org>
##
## Copyright (C) 2011 S2S Network Consultoria e Tecnologia da Informacao LTDA
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Publi... | umitproject/site-status | agent/__init__.py | Python | agpl-3.0 | 1,867 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test... | core-bitcoin/bitcoin | qa/rpc-tests/p2p-compactblocks.py | Python | mit | 44,312 |
import time
import socket
import struct
import urllib.parse
import io
import ssl
import utils
import simple_http_server
from .socket_wrap import SocketWrap
from . import global_var as g
import socks
from xlog import getLogger
xlog = getLogger("smart_router")
SO_ORIGINAL_DST = 80
fake_host = ""
class DontFakeCA(... | xyuanmu/XX-Net | code/default/smart_router/local/smart_route.py | Python | bsd-2-clause | 17,524 |
from decimal import Decimal
from cryptex.transaction import Deposit, Withdrawal
from cryptex.trade import Buy, Sell
from functools import partial
class PLCalculator(object):
def __init__(self, exchange):
self.exchange = exchange
@staticmethod
def convert_transaction(market, tx):
"""
... | coink/cryptex | cryptex/pl_calculator.py | Python | mit | 2,852 |
import sys, os, re, filefilter
inlineStyles = re.compile(r'(<style[^<>]*>)(.*)</style>', re.IGNORECASE | re.DOTALL)
scssImport = re.compile(r'@import\s+([\'"])/*((?:\\.|(?!\1).)+?)\.s?css\1;', re.IGNORECASE)
def parseImport(f, m):
cssPath = filefilter.findFile(f, m.group(2) + '.css')
scssPath = filefilter.findFile(f... | viswimmer1/PythonGenerator | data/python_files/38255832/scss-import.py | Python | gpl-2.0 | 842 |
#!/usr/bin/python3
# Script that finds a TL-WPA4230P powerline adapter in a network and opens its web interface.
# Copyright 2016 Javier Sevilla (Javier.SevBall@gmail.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publishe... | javiersevball/TL-WPA4230P_finder | finder.py | Python | lgpl-3.0 | 3,689 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import docx
def test_word_read():
doc = docx.Document('demo.docx')
print(len(doc.paragraphs))
print(doc.paragraphs[0].text)
print(doc.paragraphs[1].text)
print(len(doc.paragraphs[1].runs))
print(doc.paragraphs[1].runs[0].text)
def test_word_fu... | xu6148152/Binea_Python_Project | automate the boring stuff with python/word_handle/word_handle_test.py | Python | mit | 571 |
##########################################################################
#
# Copyright (c) 2017, Image Engine Design 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:
#
# * Redistrib... | lucienfostier/gaffer | python/GafferVDBUITest/DocumentationTest.py | Python | bsd-3-clause | 2,163 |
#!/usr/bin/python
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.logger import Logger
class SimpleWidget(BoxLayout):
# def __init__(self, **kwargs):
# super(SimpleWidget, self).__init__(**kwargs)
def on_text_update(self, new_text):
Logger.info("Received updates o... | samukasmk/kivy_examples | widgets/binding_events/simple.py | Python | apache-2.0 | 477 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import pytest
from pkg_resources import Requirement, parse_version
from pex.package import EggPackage, SourcePackage
def test_source_packages():
for ext in ('.tar.gz', '.tar', '.tgz',... | URXtech/pex | tests/test_package.py | Python | apache-2.0 | 1,829 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-compute | google/cloud/compute_v1/services/target_tcp_proxies/client.py | Python | apache-2.0 | 42,291 |
from django.conf.urls import patterns, url
from SocialNetworkModels import views
urlpatterns = patterns('SocialNetworkModels.views',
url(r'', 'user_logout', name='logout'),
)
| diego04/cmput410-project | Distributed_Social_Networking/SocialNetworkModels/url_logout.py | Python | apache-2.0 | 181 |
# coding=utf-8
# coding=utf-8
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Mercurial Contributors.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
from testutil.dott ... | facebookexperimental/eden | eden/hg-server/tests/test-convert-datesort-t.py | Python | gpl-2.0 | 3,988 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import requests
from bs4 import BeautifulSoup
import csv
import hashlib
import json
import time
import re
import os
basepath = os.path.dirname(__file__)
def stamp():
return time.strftime("%Y-%m-%d %H:%M")
def clean(term):
term = re.sub("\([^\)]+\... | CTcue/CTcUMLS | _scripts/farmaco/crawl.py | Python | mit | 4,125 |
# Initialize App Engine and import the default settings (DB backend, etc.).
# If you want to use a different backend you have to remove all occurences
# of "djangoappengine" from this file.
from djangoappengine.settings_base import *
import os
ROOTDIR = os.path.dirname(__file__)
# Language code for this installation.... | marcosmodesto/django-testapp | settings.py | Python | bsd-3-clause | 2,158 |
"""Demonstrates a Trace distributed across multiple machines.
A SpanContext's text representation is stored in the headers of an HTTP request.
Runs two threads, starts a Trace in the client and passes the SpanContext to the server.
"""
import argparse
import errno
import socket
import sys
import threading
try:
... | lightstephq/lightstep-tracer-python | examples/http/context_in_headers.py | Python | mit | 5,951 |
from pyvisfile.silo import SiloFile, DB_READ
db = SiloFile("qmesh.silo", create=False, mode=DB_READ)
print(db.get_toc().qmesh_names)
print(db.get_toc().qvar_names)
qmesh = db.get_quadmesh("meshxy")
print(qmesh.coords)
qvar = db.get_quadvar("value")
print(qvar.vals)
| inducer/pyvisfile | examples/read-qmesh.py | Python | mit | 268 |
"""
Matrix utility module based on numpy
"""
import math
import numpy
import scipy.linalg
from . import subblocked, blocked
class Matrix(numpy.ndarray):
"""
A subclass of numpy.ndarray for matrix syntax and better printing
"""
fmt = "%14.8f"
order = "F"
columnsperblock = 5
def __new__(c... | vahtras/util | util/full.py | Python | mit | 20,904 |
import io
import unittest
from unittest.mock import patch
from kattis import k_modulararithmetic
###############################################################################
class SampleInput(unittest.TestCase):
'''Problem statement sample inputs and outputs'''
def test_sample_input(self):
'''Run ... | ivanlyon/exercises | test/test_k_modulararithmetic.py | Python | mit | 1,431 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.