text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#############################################################################
##
## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
## Contact: Qt Software Information (qt-info@nokia.com)
##
## This file is part of the Graphics Dojo project on Qt Labs.
##
## This file may be used under the terms of th... | anak10thn/graphics-dojo-qt5 | snapscroll/snapscroll.py | Python | gpl-2.0 | 3,660 | 0.007104 |
'''"Executable documentation" for the pickle module.
Extensive comments about the pickle protocols and pickle-machine opcodes
can be found here. Some functions meant for external use:
genops(pickle)
Generate all the opcodes in a pickle, as (opcode, arg, position) triples.
dis(pickle, out=None, memo=None, indentl... | wdv4758h/ZipPy | lib-python/3/pickletools.py | Python | bsd-3-clause | 79,093 | 0.000582 |
from tests import BaseTestCase
import mock
import time
from redash.models import User
from redash.authentication.account import invite_token
from tests.handlers import get_request, post_request
class TestInvite(BaseTestCase):
def test_expired_invite_token(self):
with mock.patch('time.time') as patched_ti... | easytaxibr/redash | tests/handlers/test_authentication.py | Python | bsd-2-clause | 2,187 | 0.003201 |
#!/usr/bin/env python
# Notes:
# 1) ini file items:
# NGCGUI_PREAMBLE
# NGCGUI_SUBFILE
# NGCGUI_POSTAMBLE
# NGCGUI_OPTIONS
# nonew disallow new tabs
# noremove disallow removal of tabs
# noauto don't automatically send result file
# ... | bmwiedemann/linuxcnc-mirror | lib/python/pyngcgui.py | Python | lgpl-2.1 | 128,675 | 0.015924 |
from __future__ import (absolute_import, division, print_function)
import unittest
import os
import shutil
import sys
import mantid.kernel.plugins as plugins
from mantid.api import AlgorithmFactory, AlgorithmManager
__TESTALG__ = \
"""from mantid.api import PythonAlgorithm, AlgorithmFactory
class TestPyAlg(PythonAl... | dymkowsk/mantid | Framework/PythonInterface/test/python/mantid/kernel/PythonPluginsTest.py | Python | gpl-3.0 | 1,990 | 0.002513 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | staslev/incubator-beam | sdks/python/apache_beam/metrics/metric_test.py | Python | apache-2.0 | 5,205 | 0.003842 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (C) 2005-2007 Juan David Ibáñez Palomar <jdavid@itaapy.com>
# Copyright (C) 2007 Sylvain Taverne <sylvain@itaapy.com>
# Copyright (C) 2008 David Versmisse <david.versmisse@itaapy.com>
#
# This program is free software: you can redistribute it and/or modify
# it ... | hforge/ikaaro | scripts/icms-stop.py | Python | gpl-3.0 | 1,970 | 0 |
import math
def digitFactorialSum(n):
return sum([math.factorial(int(x)) for x in str(n)])
def repeatedLength(n):
repeatedList = []
while n not in repeatedList:
repeatedList.append(n)
n = digitFactorialSum(n)
return len(repeatedList)
if __name__ == "__main__":
cnt = 0
for i in... | python27/AlgorithmSolution | ProjectEuler/51_100/Problem#74.py | Python | agpl-3.0 | 411 | 0.007299 |
class NotifyCenter(object):
"""docstring for NotifyCenter"""
def __init__(self, arg):
super(NotifyCenter, self).__init__()
self.arg = arg
| Bargetor/chestnut | bargetor/notifiction/__init.py | Python | gpl-2.0 | 163 | 0.006135 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | asimshankar/tensorflow | tensorflow/contrib/distribute/python/parameter_server_strategy.py | Python | apache-2.0 | 21,809 | 0.006098 |
from setuptools import setup
from sample import __version__, __author__
setup(name='sample',
version=__version__,
description='an example of python module',
url='http://github.com/josanly/python-module-project',
author=__author__,
author_email='josso.adrien@gmail.com',
license='GPL ... | josanly/python-module-project | resources/setup.template.py | Python | gpl-3.0 | 419 | 0.002387 |
# -*- coding: utf-8 -*-
#
#
# File to preform some standard tasks on a neuroConstruct project
#
# Author: Padraig Gleeson
#
# This file has been developed as part of the neuroConstruct project
# This work has been funded by the Medical Research Council and the
# Wellcome Trust
#
#
import sys
im... | rgerkin/neuroConstruct | pythonNeuroML/nCUtils/ncutils.py | Python | gpl-2.0 | 66,510 | 0.014705 |
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function)
__license__ = 'GPL 3'
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
from PyQt5.Qt import QDialog, QUrl
from calibre import url_slash_cleaner
from calibre.... | ashang/calibre | src/calibre/gui2/store/web_store_dialog.py | Python | gpl-3.0 | 1,721 | 0.001743 |
"""Convert ASTs into L{pydoctor.model.Documentable} instances."""
from pydoctor import model, ast_pp
from compiler import visitor, transformer, ast
import symbol, token
class str_with_orig(str):
"""Hack to allow recovery of the literal that gave rise to a docstring in an AST.
We do this to allow the users to... | jelmer/pydoctor | pydoctor/astbuilder.py | Python | isc | 17,654 | 0.002322 |
"""empty message
Revision ID: 7ab3e266f711
Revises: 0152d9c6e677
Create Date: 2016-08-09 20:14:58.552655
"""
# revision identifiers, used by Alembic.
revision = '7ab3e266f711'
down_revision = '0152d9c6e677'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | schinke/solid-fortnight-ba | flask/migrations/versions/7ab3e266f711_.py | Python | mit | 5,512 | 0.007438 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Dimitrios Tydeas Mengidis <tydeas.dr@gmail.com>
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version... | mscherer/ansible-modules-extras | packaging/language/composer.py | Python | gpl-3.0 | 6,165 | 0.008597 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | airbnb/airflow | airflow/contrib/operators/imap_attachment_to_s3_operator.py | Python | apache-2.0 | 1,222 | 0.001637 |
# Copyright (c) 2017 The sqlalchemy-bigquery Authors
#
# 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, mer... | mxmzdlv/pybigquery | tests/unit/test_dialect_types.py | Python | mit | 1,632 | 0.004902 |
# -*- encoding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | ikoula/cloudstack | tools/marvin/marvin/sandbox/demo/simulator/testcase/test_vm_life_cycle.py | Python | gpl-2.0 | 20,302 | 0.003546 |
"""
Contains the relevant conversions of HTML and LaTeX entities that will not be
correctly converted elsewhere. This is taken from adsabs/adsdata authored by
J. Luke.
"""
__author__ = 'J. Luke'
__maintainer__ = 'J. Elliott'
__copyright__ = 'Copyright 2015'
__version__ = '1.0'
__email__ = 'ads@cfa.harvard.edu'
__statu... | adsabs/ADSfulltext | adsft/entitydefs.py | Python | gpl-3.0 | 48,476 | 0.000041 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Unit tests for the ninja.py file. """
import sys
import unittest
import gyp.generator.ninja as ninja
class TestPrefixesAndSuffixes(u... | onecoolx/picasso | tools/gyp/pylib/gyp/generator/ninja_test.py | Python | bsd-3-clause | 1,909 | 0.004191 |
from datetime import datetime
# Defaults
def noop(*args, **kw):
"""No operation. Returns nothing"""
pass
def identity(x):
"""Returns argument x"""
return x
def default_now():
return datetime.utcnow()
def default_comparer(x, y):
return x == y
def default_sub_comparer(x, y):
return x... | dbrattli/RxPY | rx/internal/basic.py | Python | apache-2.0 | 498 | 0 |
"""Group module
Groups are intented to cluster users together for logical reasons,
such as a list of users for whom patient notifications apply.
Groups should not be used to grant or restrict access - see `Role`.
"""
import re
from sqlalchemy import UniqueConstraint
from werkzeug.exceptions import BadRequest
from ... | uwcirg/true_nth_usa_portal | portal/models/group.py | Python | bsd-3-clause | 1,907 | 0 |
import testlib
import test_combinators
fee = 20
initialsend = 200000
capacity = 1000000
def forward(env):
lit1 = env.lits[0]
lit2 = env.lits[1]
test_combinators.run_break_test(env, lit1, lit2, lit1)
def reverse(env):
lit1 = env.lits[0]
lit2 = env.lits[1]
test_combinators.run_break_test(env, l... | mit-dci/lit | test/itest_break.py | Python | mit | 337 | 0.005935 |
# encoding: utf-8
# module PyQt4.QtCore
# from /usr/lib/python3/dist-packages/PyQt4/QtCore.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import sip as __sip
class QTextStream(): # skipped bases: <class 'sip.simplewrapper'>
"""
QTextStream()
QTextStream(QIODevice)
QTextStream... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyQt4/QtCore/QTextStream.py | Python | gpl-2.0 | 7,395 | 0.010007 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-10-23 19:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workshops', '0118_auto_20160922_0009'),
]
operations = [
migrations.AlterFie... | vahtras/amy | workshops/migrations/0119_auto_20161023_1413.py | Python | mit | 1,244 | 0.001608 |
import dolfin
from nanopores.physics.params_physical import *
def lscale(geo):
# TODO: "lscale" is confusing since it is actually 1 over the length scale
try:
return geo.parameter("lscale")
except:
try:
return geo.parameter("nm")/nm
except:
return 1e9
def gr... | mitschabaude/nanopores | nanopores/physics/default.py | Python | mit | 792 | 0.013889 |
import dredd_hooks as hooks
import imp
import os
import json
import uuid
#if you want to import another module for use in this workflow
utils = imp.load_source("utils",os.path.join(os.getcwd(),'utils.py'))
###############################################################################
#################################... | benneely/duke-data-service-dredd | dredd/dredd_scripts/21_auth_provider.py | Python | gpl-3.0 | 1,178 | 0.006791 |
# Copyright 2016 Dell 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 agree... | ge0rgi/cinder | cinder/volume/drivers/dell/dell_storagecenter_common.py | Python | apache-2.0 | 83,512 | 0 |
#
# Code by Alexander Pruss and under the MIT license
#
#
# pysanka.py [filename [height [oval|N]]]
# oval: wrap an oval image onto an egg
# N: wrap a rectangular image onto an egg N times (N is an integer)
#
# Yeah, these arguments are a mess!
from mine import *
import colors
import sys
import os
... | arpruss/raspberryjam-pe | p2/scripts3/pysanka.py | Python | mit | 4,144 | 0.017133 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-11-04 17:41
from __future__ import unicode_literals
from django.db import migrations
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
('museum', '0032_auto_20161104_1839'),
]
operations = [
migrati... | Sound-Colour-Space/sound-colour-space | website/apps/museum/migrations/0033_collection_tags.py | Python | mit | 594 | 0.001684 |
"""
This module gathers tree-based methods, including decision, regression and
randomized trees. Single and multi-output problems are both handled.
"""
# Authors: Gilles Louppe <g.louppe@gmail.com>
# Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Brian Holt <bdholt1@gmail.com>
# Noel Da... | sonnyhu/scikit-learn | sklearn/tree/tree.py | Python | bsd-3-clause | 41,818 | 0.000072 |
from django import forms
from django.conf import settings
from django.forms.util import ErrorDict
import happyforms
from tower import ugettext_lazy as _lazy
import amo
from amo import helpers
from search.utils import floor_version
collection_sort_by = (
('weekly', _lazy(u'Most popular this week')),
('monthly... | clouserw/olympia | apps/search/forms.py | Python | bsd-3-clause | 5,239 | 0.000191 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a ... | bigswitch/nova | nova/tests/unit/scheduler/test_scheduler.py | Python | apache-2.0 | 11,503 | 0.000435 |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.views import serve
from django.views.decorators.cache import never_cache
urlpatterns = patterns('',
url(r'^admin/', include... | danijar/invoicepad | invoicepad/invoicepad/urls.py | Python | gpl-3.0 | 1,168 | 0.011986 |
from task import Task
class SyncTask(Task):
def __init__(self, *remotes):
'''Init this task with all of the remote tasks'''
super(SyncTask, self).__init__()
self.remote_tasks = []
for arg in remotes:
print arg
self.remote_tasks.append(arg)
for tas... | bhylak/trello_things3_sync | tasks/sync_task.py | Python | mit | 2,101 | 0.002856 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any later
# version.
#
# This program is distributed in the... | Splawik/pytigon | pytigon/appdata/plugins/standard/autocomplete/__init__.py | Python | lgpl-3.0 | 4,308 | 0.001857 |
am = imp.load_source( 'am', 'artifact-manager' )
| paulovn/artifact-manager | test/__init__.py | Python | gpl-2.0 | 50 | 0.04 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Aureus 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 AureusTestFramework
from test_framework.util import *
from bina... | hideoussquid/aureus-12-bitcore | qa/rpc-tests/getblocktemplate_proposals.py | Python | mit | 6,330 | 0.005055 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 24 12:05:24 2015
@author: jean
"""
def hill_climbing(neighborhood, x):
y = neighborhood.randomNeighbor(x)
if y is not None and y.isBetterThan(x):
return y
return x
| jeanpm/pof | methods/hc.py | Python | gpl-2.0 | 234 | 0.008547 |
# 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 ag... | Sorsly/subtle | google-cloud-sdk/lib/surface/spanner/databases/create.py | Python | mit | 2,377 | 0.002945 |
# -*- coding: utf-8 -*-
from odoo.exceptions import ValidationError
from odoo import models, api, _
class ProductProduct(models.Model):
_inherit = 'product.product'
_rec_name = 'config_name'
"""
Copy the function from product_configurator to show price using price list.
To Fix :
- Extra ... | microcom/odoo-product-configurator | product_configurator_use_default_pricelist/models/product.py | Python | agpl-3.0 | 2,350 | 0.001277 |
# -*- coding: utf-8 -*-
"""
@author: Fabio Erculiani <lxnay@sabayon.org>
@contact: lxnay@sabayon.org
@copyright: Fabio Erculiani
@license: GPL-2
B{Entropy Framework repository database module}.
Entropy repositories (server and client) are implemented as relational
databases. Currently, Ent... | kidaa/entropy | lib/entropy/db/__init__.py | Python | gpl-2.0 | 1,423 | 0 |
#!/usr/bin/env python
"""API Extension (requires the ORM extension).
This extension provides a base class to create API views.
Setup is as follows:
.. code:: python
from kit import Flask
from kit.ext import API
app = Flask(__name__)
api = API(app)
View = api.View # the base API view
Views can then b... | mtth/kit | kit/ext/api.py | Python | mit | 15,315 | 0.008554 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-16 17:59
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookings', '0001_initial'),
]
operations = [
... | aniruddha-adhikary/bookit | bookit/bookings/migrations/0002_ticket.py | Python | mit | 794 | 0.003778 |
#! /usr/bin/env python3
assert __name__ == '__main__'
'''
To update ANGLE in Gecko, use Windows with git-bash, and setup depot_tools, python2, and
python3. Because depot_tools expects `python` to be `python2` (shame!), python2 must come
before python3 in your path.
Upstream: https://chromium.googlesource.com/angle/an... | ppy/angle | scripts/export_targets.py | Python | bsd-3-clause | 10,578 | 0.003781 |
# coding: utf-8
import decimal
from . import settings as price_settings
from .utils import price_amount
from .currency import Currency
from .tax import NO_TAX
class Price(object):
def __init__(self, net, currency=None, tax=None, gross=None):
if currency is None:
currency = price_settings.DEFAU... | ddanier/django_price | django_price/price.py | Python | bsd-3-clause | 8,910 | 0.005387 |
"""
Weather component that handles meteorological data for your location.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/weather/
"""
import asyncio
import logging
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.he... | persandstrom/home-assistant | homeassistant/components/weather/__init__.py | Python | apache-2.0 | 4,851 | 0 |
# Flexlay - A Generic 2D Game Editor
# Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.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 option)... | SuperTux/flexlay | flexlay/tools/zoom2_tool.py | Python | gpl-3.0 | 1,822 | 0 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import print_function
import os
import sys
import uuid
import logging
import simplejson as json
import paho.mqtt.client as mqtt
from time import sleep
try:
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')
from sanji.connect... | imZack/sanji | sanji/connection/mqtt.py | Python | mit | 4,240 | 0 |
"""Views for the node settings page."""
# -*- coding: utf-8 -*-
from dateutil.parser import parse as dateparse
import httplib as http
import logging
from flask import request, make_response
from framework.exceptions import HTTPError
from website.addons.base import generic_views
from website.addons.github.api import ... | RomanZWang/osf.io | website/addons/github/views.py | Python | apache-2.0 | 10,973 | 0.001185 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Backend.AI Library documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 1 21:26:20 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present i... | lablup/sorna | docs/conf.py | Python | lgpl-3.0 | 6,409 | 0.004681 |
import logging
from sft.common.commands.base import CommandFinished, ProgramFinished, CommandIds, ErrorIds
from sft.common.socket_manager import SocketManager
from .base import ClientCommandBase
from sft.common.utils.packets import (generate_packet, get_error_code)
from sft.common.config import Config
from sft.common.... | AlexeiBuzuma/LocalComputeNetworks | sft/client/commands/close.py | Python | mit | 1,397 | 0.002147 |
##
# Copyright 2020 NVIDIA
#
# This file is triple-licensed under GPLv2 (see below), MIT, and
# BSD three-clause licenses.
#
# 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 Superc... | boegel/easybuild-easyblocks | easybuild/easyblocks/x/xalt.py | Python | gpl-2.0 | 9,134 | 0.003065 |
import copy
from typing import Any # noqa: F401
from typing import Dict # noqa: F401
from typing import Iterable # noqa: F401
from typing import List # noqa: F401
from typing import Optional # noqa: F401
from typing import Text # noqa: F401
import botocore.session
from botocore.exceptions import... | robotblake/pdsm | src/pdsm/glue.py | Python | mit | 6,425 | 0.001712 |
from django.test import TestCase
from .templatetags.staticpages_tags import render_page_with_shortcode
ESCAPED_TEXT = '<div class="magnifier"><a href="x"><img src="x" class="img-responsive" />' + \
'</a></div><b>XSS</b>'
MULTILINE_TEXT = '<div class="magnifier"><a href="xxx"><img src="xxx"... | watchdogpolska/watchdog-kj-kultura | watchdog_kj_kultura/staticpages/tests.py | Python | mit | 1,351 | 0.003701 |
# Create your views here.
from django.shortcuts import render
from .froms import SampleSearchForm
def index(request):
form = SampleSearchForm(request.GET)
results = form.search()
return render(request,'index.html', {'samples':results})
| srkama/haysolr | dataview/testapi/views.py | Python | apache-2.0 | 251 | 0.015936 |
# -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils.six import PY3
from ansible.utils.unsafe_proxy imp... | azaghal/ansible | test/units/utils/test_unsafe_proxy.py | Python | gpl-3.0 | 3,234 | 0.000618 |
import json
from autobahn.twisted.websocket import WebSocketClientProtocol, WebSocketClientFactory
class SocketClientProtocol(WebSocketClientProtocol):
def emit(self, event_name, **kwargs):
payload = self._format_outbound_data(event_name, **kwargs)
self.sendMessage(payload)
def _format_out... | CptLemming/django-socket-server | socket_server/client.py | Python | bsd-3-clause | 1,594 | 0.000627 |
'''
Created on Jan 5, 2014
@author: Rob
'''
import unittest
class ObjectTreeTests(unittest.TestCase):
def setUp(self):
from byond.objtree import ObjectTree
self.tree = ObjectTree()
def test_consumeVariable_basics(self):
test_string = 'var/obj/item/weapon/chainsaw = new'
... | ComicIronic/ByondToolsv3 | tests/ObjectTree.py | Python | mit | 2,925 | 0.004444 |
from questionnaire import *
from django.conf import settings
from django.utils.translation import ugettext as _
from json import dumps
@question_proc('range', 'number')
def question_range_or_number(request, question):
cd = question.getcheckdict()
rmin, rmax = parse_range(cd)
rstep = parse_step(cd)
... | daniboy/seantis-questionnaire | questionnaire/qprocessors/range_or_number.py | Python | bsd-3-clause | 2,702 | 0.007772 |
#!/usr/bin/env python
from ZSI import Binding
MESSAGE = "Hello from Python!"
def main():
binding = Binding(url='http://localhost:8080/server.py')
print ' Sending: %s' % MESSAGE
response = binding.echo(MESSAGE)
print 'Response: %s' % MESSAGE
if __name__ == '__main__':
main()
| acigna/pywez | zsi/doc/examples/client/send_request/simple/Binding/client.py | Python | mit | 301 | 0.003322 |
import re
import datetime
from pymongo import MongoClient
from bson import ObjectId
from .exception import RecorderException, StructureException
__all__ = ['get_database', 'Recorder', 'Structure']
def get_database(db_name, host, port=27017):
return MongoClient(host, port)[db_name]
class Structure(dict):
__... | teitei-tk/ice-pick | icePick/recorder.py | Python | mit | 4,310 | 0.000928 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. E Y.'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = 'j. E Y. H:i'
YEAR_MONTH... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/conf/locale/hr/formats.py | Python | bsd-3-clause | 1,758 | 0 |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8... | ChameleonCloud/openstack-nagios-plugins | setup.py | Python | gpl-3.0 | 4,527 | 0.001546 |
# chat_client.py
import sys
import socket
import select
def chat_client():
if(len(sys.argv) < 3) :
print('Usage : python chat_client.py hostname port')
sys.exit()
host = sys.argv[1]
port = int(sys.argv[2])
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(2... | Professor-RED/Erik | TestPrograms/Chat_Client.py | Python | mit | 1,527 | 0.018337 |
class Solution(object):
def __init__(self):
self.l=[]
def helper(self,root,level):
if not root:
return None
else:
if level<len(self.l):
self.l[level].append(root.val)
else:
self.l.append([root.val])
self.help... | sadad111/leetcodebox | Binary Tree Level Order Traversal.py | Python | gpl-3.0 | 603 | 0.016584 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache/incubator-airflow | airflow/providers/cncf/kubernetes/sensors/spark_kubernetes.py | Python | apache-2.0 | 5,015 | 0.001994 |
from ..base import ShopifyResource
class Location(ShopifyResource):
pass
| asiviero/shopify_python_api | shopify/resources/location.py | Python | mit | 79 | 0 |
from chatterbot import ChatBot
from chatterbot.adapters import Adapter
from .base_case import ChatBotTestCase
class AdapterValidationTests(ChatBotTestCase):
def test_invalid_storage_adapter(self):
kwargs = self.get_kwargs()
kwargs['storage_adapter'] = 'chatterbot.input.TerminalAdapter'
wi... | maclogan/VirtualPenPal | tests/test_adapter_validation.py | Python | bsd-3-clause | 4,912 | 0.000814 |
# -*- coding: utf-8 -*-
import copy
import datetime
import json
import logging
import subprocess
import sys
import warnings
from email.mime.text import MIMEText
from email.utils import formatdate
from smtplib import SMTP
from smtplib import SMTP_SSL
from smtplib import SMTPAuthenticationError
from smtplib import SMTPEx... | rprabhat/elastalert | elastalert/alerts.py | Python | apache-2.0 | 60,947 | 0.00274 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from unittest import TestCase
import mock
from preggy import expect... | gi11es/thumbor | tests/test_server.py | Python | mit | 9,543 | 0.000838 |
# -*- coding: utf-8 -*-
import webview
"""
This example demonstrates how to localize GUI strings used by pywebview.
"""
if __name__ == '__main__':
localization = {
'global.saveFile': u'Сохранить файл',
'cocoa.menu.about': u'О программе',
'cocoa.menu.services': u'Cлужбы',
'cocoa.me... | r0x0r/pywebview | examples/localization.py | Python | bsd-3-clause | 1,251 | 0 |
from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt
from PyQt5.QtWidgets import QDialog
from urh.signalprocessing.Filter import Filter, FilterType
from urh.ui.ui_filter_dialog import Ui_FilterDialog
class FilterDialog(QDialog):
filter_accepted = pyqtSignal(Filter)
def __init__(self, dsp_filter: Filter, parent... | jopohl/urh | src/urh/controller/dialogs/FilterDialog.py | Python | gpl-3.0 | 4,227 | 0.001183 |
"""
This file should only work on Python 3.6 and newer.
Its purpose is to test a correct installation of Python 3.
"""
from random import randint
print("Generating one thousand random numbers...")
for i in range(1000):
random_number = randint(0, 100000)
print(f"Number {i} was: {random_number}")
| PhantomAppDevelopment/python-getting-started | step-1/myscript.py | Python | mit | 308 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Creates a regular polygon (triangles, pentagrams, ...)
as a special case of a :class:`~psychopy.visual.ShapeStim`'''
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2020 Open Science Tools Ltd.
# Distributed under the terms of the GNU ... | psychopy/versions | psychopy/visual/polygon.py | Python | gpl-3.0 | 3,361 | 0 |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | jiaphuan/models | research/adversarial_text/graphs.py | Python | apache-2.0 | 24,710 | 0.004816 |
from common_fixtures import * # NOQA
from gdapi import ApiError
_USER_LIST = [
"Owner",
"Member",
"Stranger",
"OutThereUser"
]
PROJECTS = set([])
@pytest.fixture(autouse=True, scope="module")
def clean_up_projects(super_client, request):
# This randomly times out, don't know why, disabling it... | gpndata/cattle | tests/integration/cattletest/core/test_projects.py | Python | apache-2.0 | 17,330 | 0 |
from ceph_deploy.lib import remoto
from ceph_deploy.hosts.centos.install import repo_install, mirror_install # noqa
from ceph_deploy.hosts.util import install_yum_priorities
def install(distro, version_kind, version, adjust_repos, **kw):
# note: when split packages for ceph land for Fedora,
# `kw['components... | alfredodeza/ceph-deploy | ceph_deploy/hosts/fedora/install.py | Python | mit | 3,044 | 0.0023 |
# -*- coding: utf-8 -*-
#
# Copyright(C) 2013 Binson Zhang.
#
# 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 applicabl... | bin3/bobo | bobo/fileutil.py | Python | apache-2.0 | 2,554 | 0.006265 |
from typing import Optional, Iterable, Iterator, List
import itertools
import os.path
from pydev_docker import models
from pydev_docker import utils
class ContainerOptions:
"""
Options for running a docker container
"""
DEFAULT_PYPATH_DIR = "/pypath"
DEFAULT_SRC_DIR = "/src"
def __init__(sel... | Rastii/pydev_docker | pydev_docker/options.py | Python | mit | 4,867 | 0.006575 |
import json
import logging
from tornado.web import RequestHandler
from tornado.gen import coroutine
from db import RealDb
class RealDataHandler(RequestHandler):
def initialize(self):
self.db = RealDb()
self.db.get_all()
def set_default_headers(self):
self.set_header("Access-Control... | evemorgen/GdzieJestTenCholernyTramwajProject | backend/schedule_worker/handlers/real_data_handler.py | Python | mit | 1,218 | 0.001642 |
"""
File: tonal_permutation.py
Purpose: Class defining a function whose cycles are composed of tone strings (no None).
"""
from function.permutation import Permutation
from tonalmodel.diatonic_tone_cache import DiatonicToneCache
from tonalmodel.diatonic_tone import DiatonicTone
class TonalPermutation(Permutation):... | dpazel/music_rep | transformation/functions/tonalfunctions/tonal_permutation.py | Python | mit | 3,907 | 0.003583 |
import datetime
from django.db import models
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django.urls import reverse
import reversion
from users.models import Lageruser
from devicetypes.models import Type
from devicegroups.models import Devicegroup
from locations.models... | vIiRuS/Lagerregal | devices/models.py | Python | bsd-3-clause | 10,243 | 0.002831 |
## $id: webstatadmin.py,v 1.28 2007/04/01 23:46:46 tibor exp $
##
## This file is part of Invenio.
## Copyright (C) 2007, 2008, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; ... | NikolaYolov/invenio_backup | modules/webstat/lib/webstatadmin.py | Python | gpl-2.0 | 10,293 | 0.004372 |
#
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
# License: http://pyasn1.sf.net/license.html
#
import sys
from pyasn1.codec.der import decoder as der_decoder
from pyasn1.codec.der import encoder as der_encoder
from pyasn1_modules import pem
from pyasn1_m... | catapult-project/catapult | third_party/gsutil/third_party/pyasn1-modules/tests/test_rfc2511.py | Python | bsd-3-clause | 1,591 | 0.000629 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2017 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the h... | cprov/snapcraft | snapcraft/internal/project_loader/_env.py | Python | gpl-3.0 | 4,619 | 0.000649 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 thomasv@gitorious
#
# 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... | mazaclub/electrum-nmc | lib/commands.py | Python | gpl-3.0 | 19,964 | 0.010068 |
import os
import hashlib
import flask
from sparkpost import SparkPost
from infosystem.common import exception
from infosystem.common.subsystem import manager
from infosystem.common.subsystem import operation
_HTML_EMAIL_TEMPLATE = """
<div style="width: 100%; text-align: center">
<h1>{app_name}</h1>
... | samueldmq/infosystem | infosystem/subsystem/user/manager.py | Python | apache-2.0 | 6,277 | 0 |
from . import conn
class Contest(object):
def __init__(self, contestId, name, length, description, problems):
self._contestId = contestId
self._name = name
self._length = length
self._description = description
self._problems = problems
@classmethod
def load(cls, contestId):
with conn.cursor() as cur:
... | aioc/aminiaio | aminiaio/db/contest.py | Python | mit | 1,280 | 0.035156 |
#! /usr/bin/env python
def Test():
text ='hi from'
k = text + "call "
print k
return k
def euro():
print "high"
| peterheim1/robbie_ros | robbie_ai/nodes/aiml/know.py | Python | bsd-3-clause | 147 | 0.027211 |
from .exceptions import MalformedRequestException
class Request(object):
def __init__(self, version, metadata, arguments):
self._version = version
self._metadata = metadata
self._arguments = arguments
@property
def version(self):
return self._version
@property
def... | cbigler/jackrabbit | jackrabbit/request.py | Python | mit | 977 | 0.002047 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
GridNearestNeighbor.py
---------------------
Date : October 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*****... | SrNetoChan/QGIS | python/plugins/processing/algs/gdal/GridNearestNeighbor.py | Python | gpl-2.0 | 8,683 | 0.003685 |
# -*- coding: utf-8 -*-
"""Parses for MacOS Wifi log (wifi.log) files."""
from __future__ import unicode_literals
import re
import pyparsing
from dfdatetime import time_elements as dfdatetime_time_elements
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import errors
fro... | rgayon/plaso | plaso/parsers/mac_wifi.py | Python | apache-2.0 | 10,515 | 0.006182 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import Permission
class Migration(DataMigration):
depends_on = (
("guardian", "0005_auto... | makinacorpus/formhub | odk_logger/migrations/0012_add_permission_view_xform.py | Python | bsd-2-clause | 7,685 | 0.007547 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json
from frappe.model.document import Document
from frappe.permissions import (get_valid_perms, update_permission_property)
from f... | manassolanki/frappe | frappe/core/doctype/user_permission/user_permission.py | Python | mit | 1,295 | 0.026255 |
from cherry import *
robot=Cherry.setup()
Cherry.serve()
Cherry.connect()
| Cherry-project/primitiveWS | startup.py | Python | gpl-3.0 | 76 | 0.026316 |
# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
import os, random
from jenkinsflow import jobload
from .framework import api_select
here = os.path.abspath(os.path.dirname(__file__))
_context = dict(
exec_time=1,
params... | lhupfeldt/jenkinsflow | test/job_load_test.py | Python | bsd-3-clause | 3,177 | 0.002833 |
from rest_framework.filters import (
FilterSet
)
from trialscompendium.trials.models import Treatment
class TreatmentListFilter(FilterSet):
"""
Filter query list from treatment database table
"""
class Meta:
model = Treatment
fields = {'id': ['exact', 'in'],
'no_r... | nkoech/trialscompendium | trialscompendium/trials/api/treatment/filters.py | Python | mit | 934 | 0 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Top Block
# Generated: Tue Dec 27 19:28:14 2016
##################################################
if __name__ == '__main__':
import ctypes
import sys
if sys.platform.sta... | james-tate/gnuradio_projects | ettus_lab/lab1/top_block.py | Python | gpl-3.0 | 3,795 | 0.016074 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.