commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
d3a6311d22e5ad447870607f1af711aad5e43eec | write test for get_vmx_path | k3rn/floki | floki/tests/__init__.py | floki/tests/__init__.py | import unittest
from floki.machines import Machines
class functions_with_return(unittest.TestCase):
def setUp(self):
self.config = 0
self.machine = Machines('config.yml')
def test_get_vmx_path(self):
self.assertEqual(self.machine.get_vmx_path('development',
... | import unittest
from floki.machines import Machines
class functions_with_return(unittest.TestCase):
def setUp(self):
self.config = 0
def test_get_list(self):
pass
if __name__ == "__main__":
unittest.main()
| mit | Python |
bb6aec5c809da5c57fa98fcf9d1edcf7de7fe587 | Update test init. | severb/flowy | flowy/tests/__init__.py | flowy/tests/__init__.py | from .test_swf import *
from .test_activity import *
| from flowy.tests.test_client import *
from flowy.tests.test_workflow import *
from flowy.tests.test_activity import *
| mit | Python |
2db3c6ef1b7ad172a48abbbde0af692a0c584f0b | return self from Transporter.__enter__ | yosida95/python-jsonrpc | jsonrpc/transport.py | jsonrpc/transport.py | # -*- coding: utf-8 -*-
import socket
class BaseSocketTransport:
def __init__(self, address):
self.address = address
self._socket = None
self._opened = False
self._buffer = None
def __enter__(self):
return self
def __exit__(self, exc_info, exc_value, traceback)... | # -*- coding: utf-8 -*-
import socket
class BaseSocketTransport:
def __init__(self, address):
self.address = address
self._socket = None
self._opened = False
self._buffer = None
def __enter__(self):
return
def __exit__(self, exc_info, exc_value, traceback):
... | bsd-3-clause | Python |
202c06dc84f2e79e20b594d69478412d15120b48 | create thread2 | wangwei7175878/tutorials | threading/thread2_add_thread.py | threading/thread2_add_thread.py | import threading
#def main():
# print(threading.active_count())
# print(threading.enumerate()) # see the thread list
# print(threading.current_thread())
def thread_job():
print('This is a thread of %s' % threading.current_thread())
def main():
thread = threading.Thread(target=thread_job,)
thread... | import threading
def thread_job():
print('This is an added Thread, number is %s' % threading.current_thread())
def main():
added_thread = threading.Thread(target=thread_job)
added_thread.start()
if __name__ == '__main__':
main() | mit | Python |
182fd87e18735d095fda6c37b2670bd7498ce9cd | change site name | GustavoVS/timtec,virgilio/timtec,mupi/timtec,hacklabr/timtec,mupi/tecsaladeaula,GustavoVS/timtec,virgilio/timtec,mupi/timtec,mupi/tecsaladeaula,GustavoVS/timtec,mupi/timtec,AllanNozomu/tecsaladeaula,mupi/timtec,mupi/tecsaladeaula,GustavoVS/timtec,mupi/tecsaladeaula,hacklabr/timtec,AllanNozomu/tecsaladeaula,virgilio/tim... | timtec/settings_local_design.py | timtec/settings_local_design.py | # configurations for the design server
# https://docs.djangoproject.com/en/dev/ref/settings/
DEBUG = False
TEMPLATE_DEBUG = DEBUG
SITE_ID = 1
SITE_NAME = 'Marca da instituição'
ALLOWED_HOSTS = [
'timtec-design.hacklab.com.br',
'.timtec.com.br',
]
DATABASES = {
'default': {
'ENGINE': 'django.db.bac... | # configurations for the design server
# https://docs.djangoproject.com/en/dev/ref/settings/
DEBUG = False
TEMPLATE_DEBUG = DEBUG
SITE_ID = 1
ALLOWED_HOSTS = [
'timtec-design.hacklab.com.br',
'.timtec.com.br',
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
... | agpl-3.0 | Python |
b9de3ef773abc7fd8f577707d40c013fcd65e049 | Fix cyclic import | SYNHAK/spiff,SYNHAK/spiff,SYNHAK/spiff | spiff/subscription/management/commands/process_subscriptions.py | spiff/subscription/management/commands/process_subscriptions.py | from django.core.management import BaseCommand
from spiff.api.plugins import find_api_classes
from spiff.subscription.models import SubscriptionPlan
from spiff.payment.models import Invoice
from spiff.membership.utils import monthRange
from spiff.membership.models import Member, RankLineItem
import stripe
class Comman... | from django.core.management import BaseCommand
from spiff.payment.models import Invoice
from spiff.subscription.models import SubscriptionPlan
from spiff.api.plugins import find_api_classes
from spiff.membership.utils import monthRange
from spiff.membership.models import Member, RankLineItem
import stripe
class Comman... | agpl-3.0 | Python |
0b4e7292fbc4497ebbfb37a436ff6a03e19fe5b3 | Make a variable name generic | IATI/iati.core,IATI/iati.core | iati/core/test/test_default.py | iati/core/test/test_default.py | """A module containing tests for the library representation of default values."""
import pytest
import iati.core.codelists
import iati.core.default
import iati.core.schemas
class TestDefault(object):
"""A container for tests relating to Default data."""
def test_default_codelist_valid(self):
"""Check... | """A module containing tests for the library representation of default values."""
import pytest
import iati.core.codelists
import iati.core.default
import iati.core.schemas
class TestDefault(object):
"""A container for tests relating to Default data."""
def test_default_codelist_valid(self):
"""Check... | mit | Python |
6a2fafa227c609ca2d856bb0dba41c8729db4241 | Remove debug comment. | carlohamalainen/nipype,glatard/nipype,iglpdc/nipype,mick-d/nipype,FCP-INDI/nipype,iglpdc/nipype,carolFrohlich/nipype,JohnGriffiths/nipype,pearsonlab/nipype,arokem/nipype,FCP-INDI/nipype,mick-d/nipype,FredLoney/nipype,JohnGriffiths/nipype,dmordom/nipype,pearsonlab/nipype,carolFrohlich/nipype,wanderine/nipype,sgiavasis/n... | tools/build_modref_templates.py | tools/build_modref_templates.py | #!/usr/bin/env python
"""Script to auto-generate our API docs.
"""
# stdlib imports
import os
# local imports
from apigen import ApiDocWriter
#*****************************************************************************
if __name__ == '__main__':
package = 'nipype'
outdir = os.path.join('api','generated')
... | #!/usr/bin/env python
"""Script to auto-generate our API docs.
"""
# stdlib imports
import os
# local imports
from apigen import ApiDocWriter
#*****************************************************************************
if __name__ == '__main__':
print 'In build_modref_templates.py'
package = 'nipype'
ou... | bsd-3-clause | Python |
f2b42f733b16fd69482d0ab93b65ba0b7198ccc6 | Add Party to admin interface | kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu | votes/admin.py | votes/admin.py | from django.contrib import admin
from kamu.votes.models import Session, Vote, Member, County, Party
class MemberAdmin(admin.ModelAdmin):
list_display = ['name', 'birth_date']
admin.site.register(Session)
admin.site.register(Vote)
admin.site.register(Member, MemberAdmin)
admin.site.register(County)
admin.site.regi... | from django.contrib import admin
from kamu.votes.models import Session, Vote, Member, County
class MemberAdmin(admin.ModelAdmin):
list_display = ['name', 'birth_date']
admin.site.register(Session)
admin.site.register(Vote)
admin.site.register(Member, MemberAdmin)
admin.site.register(County)
| agpl-3.0 | Python |
70bdb66e3ac6492dd6bbc97ef13c25c1184bfd44 | Fix black and flake8 | jodal/pykka | tests/proxy/test_traversable.py | tests/proxy/test_traversable.py | import pytest
class NestedWithNoMarker(object):
inner = 'nested_with_no_marker.inner'
class NestedWithAttrMarker(object):
pykka_traversable = True
inner = 'nested_with_attr_marker.inner'
class NestedWithAttrMarkerAndSlots(object):
__slots__ = ['pykka_traversable', 'inner']
def __init__(self):... | import pytest
class NestedWithNoMarker(object):
inner = 'nested_with_no_marker.inner'
class NestedWithAttrMarker(object):
pykka_traversable = True
inner = 'nested_with_attr_marker.inner'
class NestedWithAttrMarkerAndSlots(object):
__slots__ = ['pykka_traversable', 'inner']
def __init__(self):... | apache-2.0 | Python |
502848fab15e510db433acb7273aa9a344583634 | add droupout soft attention | GuessWhatGame/generic,GuessWhatGame/generic | tf_factory/attention_factory.py | tf_factory/attention_factory.py | import tensorflow as tf
from neural_toolbox.attention import compute_attention, compute_glimpse
def get_attention(feature_map, lstm, config, dropout_keep=1, reuse=False):
attention_mode = config.get("mode", None)
if attention_mode == "none":
image_out = feature_map
elif attention_mode == "max":... | import tensorflow as tf
from neural_toolbox.attention import compute_attention, compute_glimpse
def get_attention(feature_map, lstm, config, dropout_keep=1, reuse=False):
attention_mode = config.get("mode", None)
if attention_mode == "none":
image_out = feature_map
elif attention_mode == "max":... | apache-2.0 | Python |
4305696f1b6cdc57f52d9442beaea8e1a5fa8fc6 | Fix pep8 issue, use two spaces before inline comment | SectorLabs/django-localized-fields,SectorLabs/django-localized-fields,SectorLabs/django-localized-fields | localized_fields/descriptor.py | localized_fields/descriptor.py | from django.conf import settings
from django.utils import six, translation
class LocalizedValueDescriptor:
"""
The descriptor for the localized value attribute on the model instance.
Returns a :see:LocalizedValue when accessed so you can do stuff like::
>>> from myapp.models import MyModel
... | from django.conf import settings
from django.utils import six, translation
class LocalizedValueDescriptor:
"""
The descriptor for the localized value attribute on the model instance.
Returns a :see:LocalizedValue when accessed so you can do stuff like::
>>> from myapp.models import MyModel
... | mit | Python |
27b98e220bbf89c6b3853948b43e47a353ebda67 | Remove debugging code from multiprocessing runner. | TC01/Treemaker,TC01/Treemaker | Splitter/python/core.py | Splitter/python/core.py | # Splitter core.
# Splitter is a much-slimmed-down Treemaker that uses the same splitting logic.
import os
import multiprocessing
import sys
from Treemaker.Treemaker import core as tmcore
from Treemaker.Treemaker import filelist
def readConfig(jobfile):
# This is a silly hack and makes me sad.
# Import the (Python... | # Splitter core.
# Splitter is a much-slimmed-down Treemaker that uses the same splitting logic.
import os
import multiprocessing
import sys
from Treemaker.Treemaker import core as tmcore
from Treemaker.Treemaker import filelist
def readConfig(jobfile):
# This is a silly hack and makes me sad.
# Import the (Python... | mit | Python |
9fe79a8c62e1321608b002ac4337c78ab250aad1 | Update sectioncalculation.py | mitgobla/TopograPy | topograpy/sectioncalculation.py | topograpy/sectioncalculation.py | from PIL import Image as ImgLoad
class SectionCalculation:
"""Main class for the generation of coordinates"""
def __init__(self):
"""Initialise variables"""
self.topography_darkness = []
self.highest = 0
self.image = None
def return_darkness(self):
"""Returns the li... | from PIL import Image as ImgLoad
class SectionCalculation:
"""Main class for the generation of coordinates"""
def __init__(self):
"""Initialise variables"""
self.topography_darkness = []
self.highest = 0
self.image = None
def return_darkness(self):
"""Returns the li... | mit | Python |
28b0ec1f4896ccc23ae7050cd7d3b8c7ad00d101 | Comment out dashboard. | devilry/devilry-django,devilry/devilry-django,devilry/devilry-django,devilry/devilry-django | src/devilry_subjectadmin/devilry_subjectadmin/tests/__init__.py | src/devilry_subjectadmin/devilry_subjectadmin/tests/__init__.py | #from dashboard import *
from subject import *
from period import *
from assignment import *
from createnewassignment import *
from managestudents import *
from rest import *
| from dashboard import *
from subject import *
from period import *
from assignment import *
from createnewassignment import *
from managestudents import *
from rest import *
| bsd-3-clause | Python |
b39263e6fcc60755c2e28aba2ef875c0344be9e3 | make party nullable in api | Psycojoker/dierentheater,Psycojoker/dierentheater,Psycojoker/dierentheater | lachambre/api.py | lachambre/api.py | from tastypie_nonrel.resources import MongoResource
from tastypie_nonrel.fields import ForeignKeysListField
from tastypie.constants import ALL
from tastypie import fields
from models import (Deputy, Document, Commission, WrittenQuestion,
CommissionMembership, AnnualReport, Party)
class AnnualRepor... | from tastypie_nonrel.resources import MongoResource
from tastypie_nonrel.fields import ForeignKeysListField
from tastypie.constants import ALL
from tastypie import fields
from models import (Deputy, Document, Commission, WrittenQuestion,
CommissionMembership, AnnualReport, Party)
class AnnualRepor... | agpl-3.0 | Python |
38b010a2d86deef932d300a500d2da9e3e2bda52 | add more error tests | wesley1001/formhub,kobotoolbox/kobocat,GeoODK/onadata,ehealthafrica-ci/formhub,qlands/onadata,hnjamba/onaclone,ultimateprogramer/formhub,mainakibui/kobocat,piqoni/onadata,GeoODK/onadata,mainakibui/kobocat,hnjamba/onaclone,smn/onadata,GeoODK/formhub,eHealthAfrica/formhub,awemulya/fieldsight-kobocat,eHealthAfrica/formhub... | main/tests/test_form_errors.py | main/tests/test_form_errors.py | from test_base import MainTestCase
from odk_logger.models import XForm
from django.core.urlresolvers import reverse
from odk_viewer.views import xls_export
import os
class TestFormErrors(MainTestCase):
def test_bad_id_string(self):
self._create_user_and_login()
count = XForm.objects.count()
... | from test_base import MainTestCase
from odk_logger.models import XForm
import os
class TestFormErrors(MainTestCase):
def test_bad_id_string(self):
self._create_user_and_login()
count = XForm.objects.count()
xls_path = os.path.join(self.this_directory, "fixtures",
"transport... | bsd-2-clause | Python |
3872288ca5fd4f951ecf921812fc44a5576a0894 | update dbpedia dbm types | dragoon/kilogram,dragoon/kilogram,dragoon/kilogram | mapreduce/dbpedia_dbm_types.py | mapreduce/dbpedia_dbm_types.py | """
Creates DBPedia type dict with entity URIs as keys and types as values.
We use shelve here since the dict is quite large in memory(~2G) and we need a set as value.
It then shipped with the job.
Format: {'Tramore': ['Town', 'Settlement', 'PopulatedPlace', 'Place'], ...}
"""
import shelve
import subprocess
TYPES_FI... | """
Creates DBPedia type dict with entity URIs as keys and types as values.
We use shelve here since the dict is quite large in memory(~2G) and we need a set as value.
It then shipped with the job.
Format: {'<Tramore>': ['<Town>', '<Settlement>', '<PopulatedPlace>', '<Place>'], ...}
"""
import shelve
import subprocess... | apache-2.0 | Python |
fbc4b6ac5aee507401e528693c05e794af401ad9 | Remove unused code | ScottWales/ftools | ftools/writer/Writer.py | ftools/writer/Writer.py | #!/usr/bin/env python
"""
Copyright 2015 ARC Centre of Excellence for Climate Systems Science
author: Scott Wales <scott.wales@unimelb.edu.au>
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
h... | #!/usr/bin/env python
"""
Copyright 2015 ARC Centre of Excellence for Climate Systems Science
author: Scott Wales <scott.wales@unimelb.edu.au>
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
h... | apache-2.0 | Python |
aaa3764e476e29e0579fd27611b5c42c6bda1e61 | Fix upload button | jiivan/genoomy,jiivan/genoomy,jiivan/genoomy,jiivan/genoomy | genoome/disease/urls.py | genoome/disease/urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse_lazy
from . import views
urlpatterns = [
url(r'^upload/$', login_required(views.UploadGenome.as_view(), login_url=reverse_lazy('acco... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse_lazy
from . import views
urlpatterns = [
url(r'^upload/$', login_required(views.UploadGenome.as_view(), login_url=reverse_lazy('acco... | mit | Python |
9d84fa2529d87843946f2d98a376bb37618fb956 | Add cors | likr/websem,likr/websem,likr/websem,likr/websem | application.py | application.py | from flask import Flask
from flask import request
from flask import jsonify
from flask.ext.cors import CORS
import numpy
import sem
app = Flask(__name__)
CORS(app)
@app.route('/sem', methods=['POST'])
def semapp():
obj = request.json
n = obj['n']
alpha = obj['alpha']
sigma = obj['sigma']
sigma_fix... | from flask import Flask
from flask import request
from flask import jsonify
import numpy
import sem
app = Flask(__name__)
@app.route('/sem', methods=['POST'])
def semapp():
obj = request.json
n = obj['n']
alpha = obj['alpha']
sigma = obj['sigma']
sigma_fixed = obj['sigma_fixed'] if 'sigma_fixed' i... | mit | Python |
53c06f86150ed46d728930102fbc4f3ccec92d4c | Fix typo. | pandaproject/panda,pandaproject/panda,datadesk/panda,ibrahimcesar/panda,pandaproject/panda,PalmBeachPost/panda,NUKnightLab/panda,ibrahimcesar/panda,datadesk/panda,ibrahimcesar/panda,NUKnightLab/panda,PalmBeachPost/panda,NUKnightLab/panda,NUKnightLab/panda,PalmBeachPost/panda,datadesk/panda,datadesk/panda,pandaproject/p... | application.py | application.py | #!/usr/bin/env python
import os
import django.core.handlers.wsgi
# When serving under WSGI (rather than runserver) use deployed config
os.environ["DJANGO_SETTINGS_MODULE"] = "config.deployed.settings"
application = django.core.handlers.wsgi.WSGIHandler()
| #!/usr/bin/env python
import os
import django.core.handlers.wsgi
# When serving under WSGI (rather than runserver) use deployed config
os.environ["DJANGO_SETTINGS_MODULE"] = "config..deployed.settings"
application = django.core.handlers.wsgi.WSGIHandler()
| mit | Python |
66d79935f94f43e4f03d7e606c53fb2a769bd3c1 | Use Node.load correctly | acshi/osf.io,HalcyonChimera/osf.io,hmoco/osf.io,TomBaxter/osf.io,hmoco/osf.io,hmoco/osf.io,mfraezz/osf.io,felliott/osf.io,baylee-d/osf.io,icereval/osf.io,mattclark/osf.io,monikagrabowska/osf.io,CenterForOpenScience/osf.io,monikagrabowska/osf.io,HalcyonChimera/osf.io,aaxelb/osf.io,adlius/osf.io,adlius/osf.io,mluo613/osf... | website/discovery/views.py | website/discovery/views.py | from website import settings
from website.project import Node
from website.project import utils
from modularodm.query.querydialect import DefaultQueryDialect as Q
def activity():
"""Reads node activity from pre-generated popular projects and registrations.
New and Noteworthy projects are set manually or thro... | from website import settings
from website.project import Node
from website.project import utils
from modularodm.query.querydialect import DefaultQueryDialect as Q
def activity():
"""Reads node activity from pre-generated popular projects and registrations.
New and Noteworthy projects are set manually or thro... | apache-2.0 | Python |
a3a0ef8bf4eebbe7dbcfc18daa62202d4b1efa3d | refactor discovery | laurenrevere/osf.io,petermalcolm/osf.io,adlius/osf.io,SSJohns/osf.io,barbour-em/osf.io,haoyuchen1992/osf.io,ticklemepierce/osf.io,ckc6cz/osf.io,binoculars/osf.io,samanehsan/osf.io,caneruguz/osf.io,binoculars/osf.io,crcresearch/osf.io,hmoco/osf.io,MerlinZhang/osf.io,aaxelb/osf.io,mattclark/osf.io,GageGaskins/osf.io,matt... | website/discovery/views.py | website/discovery/views.py | from website import settings
from website.project import Node
from modularodm.query.querydialect import DefaultQueryDialect as Q
from framework.analytics.piwik import PiwikClient
def activity():
client = PiwikClient(
url=settings.PIWIK_HOST,
auth_token=settings.PIWIK_ADMIN_TOKEN,
site_id... | from framework import db as analytics
from website import settings
from website.project import Node
from pymongo import DESCENDING
from modularodm.query.querydialect import DefaultQueryDialect as Q
from framework.analytics.piwik import PiwikClient
from itertools import islice
def activity():
client = PiwikCli... | apache-2.0 | Python |
01261a05573a6502eac1a2f64ba3c6e4b4e17694 | Fix in LDA model for older scikit-learn versions | capergroup/bayou,capergroup/bayou,capergroup/bayou | src/ml/bayou/lda/model.py | src/ml/bayou/lda/model.py | import numpy as np
import pickle
from collections import OrderedDict
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.decomposition import LatentDirichletAllocation
class LDA():
def __init__(self, args=None, from_file=None):
# Initialize LDA model from either arguments or a file.... | import numpy as np
import pickle
from collections import OrderedDict
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.decomposition import LatentDirichletAllocation
class LDA():
def __init__(self, args=None, from_file=None):
# Initialize LDA model from either arguments or a file.... | apache-2.0 | Python |
08fbfa49129a42821b128913e4aa9fbacf966f20 | Fix the build so it no longer double-shades. This removes all the warnings it printed. | yunspace/FrameworkBenchmarks,grob/FrameworkBenchmarks,herloct/FrameworkBenchmarks,Ocramius/FrameworkBenchmarks,nbrady-techempower/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,jeevatkm/FrameworkBenchmarks,nkasvosve/FrameworkBenchmarks,grob/FrameworkBenchmarks,victorbriz/FrameworkBenchmarks,sxend/FrameworkBenchmarks,jet... | grizzly-jersey/setup.py | grizzly-jersey/setup.py | import subprocess
import sys
import setup_util
import os
def start(args):
try:
subprocess.check_call("mvn clean package", shell=True, cwd="grizzly-jersey")
subprocess.Popen("java -jar target/grizzly-jersey-example-0.1.jar".rsplit(" "), cwd="grizzly-jersey")
return 0
except subprocess.CalledProcessError... | import subprocess
import sys
import setup_util
import os
def start(args):
try:
subprocess.check_call("mvn clean package shade:shade", shell=True, cwd="grizzly-jersey")
subprocess.Popen("java -jar target/grizzly-jersey-example-0.1.jar".rsplit(" "), cwd="grizzly-jersey")
return 0
except subprocess.Called... | bsd-3-clause | Python |
933f5698faf89db017cf7a5b96c57e9186d92764 | Use builtin tempdir fixture | bbiskup/purkinje,bbiskup/purkinje,bbiskup/purkinje,bbiskup/purkinje | src/purkinje/util_test.py | src/purkinje/util_test.py | #!/usr/bin/env python
"""Test cases for utility functions"""
import pytest
import os
from os.path import exists
import stat
import util as sut
def test_ensure_dir_new(unique_filename, tmpdir):
path = str(tmpdir) + unique_filename
assert not exists(path)
sut.ensure_dir(path)
assert exists(path)
a... | #!/usr/bin/env python
"""Test cases for utility functions"""
import pytest
import os
from os.path import exists
import stat
import util as sut
def test_ensure_dir_new(unique_filename):
path = '/tmp/' + unique_filename
assert not exists(path)
sut.ensure_dir(path)
assert exists(path)
assert os.sta... | mit | Python |
b0fe11b8a4e66801961141e9293666a7c0a2af0e | Add unit tests for PythonLoader.is_plugin | ironman5366/W.I.L.L,ironman5366/W.I.L.L | will/plugins/test_pythonLoader.py | will/plugins/test_pythonLoader.py | import os
from will.unittests import TestCase
from expects import * # noqa
from mock import patch
from will.plugins.pyplugins import PythonLoader
class PythonLoader_ImportName(TestCase):
def test_ShouldReturnModuleNameSutableForImport(self):
plugin_file = PythonLoader("plugin/my_plugin.py")
plugi... | import os
from will.unittests import TestCase
from expects import *
from mock import MagicMock, patch
from will.plugins.pyplugins import PythonLoader
class PythonLoader_ImportName(TestCase):
def test_ShouldReturnModuleNameSutableForImport(self):
plugin_file = PythonLoader("plugin/my_plugin.py")
pl... | mit | Python |
70065935341273d847b1b6959c1c9116073ebe29 | Split xbee.helpers.dispatch Dispatch.run() into while loop and dispatch() | thom-nic/python-xbee,acrosby/python-xbee,markfickett/python-xbee,blalor/python-xbee,epsilonorion/python-xbee,thom-nic/python-xbee,acrosby/python-xbee,blalor/python-xbee,epsilonorion/python-xbee,EnerNOC/python-xbee | xbee/helpers/dispatch/dispatch.py | xbee/helpers/dispatch/dispatch.py | """
dispatch.py
By Paul Malmsten, 2010
pmalmsten@gmail.com
Provides the Dispatch class, which allows one to filter incoming data
packets from an XBee device and call an appropriate method when
one arrives.
"""
from xbee import XBee
class Dispatch(object):
def __init__(self, ser=None, xbee=None):
if xbee... | """
dispatch.py
By Paul Malmsten, 2010
pmalmsten@gmail.com
Provides the Dispatch class, which allows one to filter incoming data
packets from an XBee device and call an appropriate method when
one arrives.
"""
from xbee import XBee
class Dispatch(object):
def __init__(self, ser=None, xbee=None):
if xbee... | mit | Python |
59673f051ee7888b47736e44d6c3fbf97cd8b80b | set upb secure: false to avoid circular dependency on itself | vjpai/grpc,grpc/grpc,stanley-cheung/grpc,firebase/grpc,grpc/grpc,stanley-cheung/grpc,donnadionne/grpc,firebase/grpc,vjpai/grpc,stanley-cheung/grpc,jtattermusch/grpc,ejona86/grpc,donnadionne/grpc,jtattermusch/grpc,jtattermusch/grpc,firebase/grpc,firebase/grpc,ejona86/grpc,jtattermusch/grpc,nicolasnoble/grpc,jboeuf/grpc,... | src/upb/gen_build_yaml.py | src/upb/gen_build_yaml.py | #!/usr/bin/env python2.7
# Copyright 2015 gRPC authors.
#
# 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 l... | #!/usr/bin/env python2.7
# Copyright 2015 gRPC authors.
#
# 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 l... | apache-2.0 | Python |
5cb7481067eb61e75836d8cdf29855b16ba21c08 | Fix GalaxyZoo3DVAC docstring | sdss/marvin,sdss/marvin,sdss/marvin,sdss/marvin | python/marvin/contrib/vacs/galaxyzoo3d.py | python/marvin/contrib/vacs/galaxyzoo3d.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# @Author: José Sánchez-Gallego (gallegoj@uw.edu)
# @Date: 2018-07-03
# @Filename: galaxyzoo3d.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
#
# @Last modified by: José Sánchez-Gallego
# @Last modified time: 2018-07-07 13:08:20
from __futu... | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# @Author: José Sánchez-Gallego (gallegoj@uw.edu)
# @Date: 2018-07-03
# @Filename: galaxyzoo3d.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
#
# @Last modified by: José Sánchez-Gallego
# @Last modified time: 2018-07-07 12:27:11
from __futu... | bsd-3-clause | Python |
6358b8841e1ae0e7e41bfeeeecfc8eb7b48e46ce | Enable selecting Pyblish GUI via environment PYBLISHGUI environment variable. | getavalon/core,MoonShineVFX/core,getavalon/core,mindbender-studio/core,mindbender-studio/core,MoonShineVFX/core | mindbender/maya/pythonpath/userSetup.py | mindbender/maya/pythonpath/userSetup.py | """Maya initialisation for Mindbender pipeline"""
from maya import cmds
import os
def setup():
assert __import__("pyblish_maya").is_setup(), (
"mindbender-core depends on pyblish_maya which has not "
"yet been setup. Run pyblish_maya.setup()")
from mindbender import api, maya
api.instal... | """Maya initialisation for Mindbender pipeline"""
from maya import cmds
import os
def setup():
assert __import__("pyblish_maya").is_setup(), (
"mindbender-core depends on pyblish_maya which has not "
"yet been setup. Run pyblish_maya.setup()")
from pyblish import api
api.register_gui("p... | mit | Python |
138576c92cfb2b2025632bfac6af303282a0d144 | add deb external dependencies | OCA/reporting-engine,OCA/reporting-engine,OCA/reporting-engine,OCA/reporting-engine | report_py3o_fusion_server/__manifest__.py | report_py3o_fusion_server/__manifest__.py | # Copyright 2017 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Py3o Report Engine - Fusion server support",
"summary": "Let the fusion server handle format conversion.",
"version": "14.0.1.0.0",
"category": "Reporting",
"license": "AGPL-3"... | # Copyright 2017 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Py3o Report Engine - Fusion server support",
"summary": "Let the fusion server handle format conversion.",
"version": "14.0.1.0.0",
"category": "Reporting",
"license": "AGPL-3"... | agpl-3.0 | Python |
c954211b6b912ff7c34d82fb4667bea5cc95c718 | Document API `new()` | Synss/python-mbedtls,Synss/python-mbedtls | src/mbedtls/cipher/ARIA.py | src/mbedtls/cipher/ARIA.py | # SPDX-License-Identifier: MIT
# Copyright (c) 2019, Mathias Laurin
"""The ARIA algorithm is a symmetric block cipher that can encrypt and
decrypt information. It is defined by the Korean Agency for Technology
and Standards (KATS) in *KS X 1213:2004* (in Korean, but see
http://210.104.33.10/ARIA/index-e.html in Englis... | # SPDX-License-Identifier: MIT
# Copyright (c) 2019, Mathias Laurin
"""The ARIA algorithm is a symmetric block cipher that can encrypt and
decrypt information. It is defined by the Korean Agency for Technology
and Standards (KATS) in *KS X 1213:2004* (in Korean, but see
http://210.104.33.10/ARIA/index-e.html in Englis... | mit | Python |
a576b9f0b6e782265d3a5c2357512d6d9664c698 | Set proper fallbacks for start and end date (#4568) | StrellaGroup/frappe,ESS-LLP/frappe,manassolanki/frappe,paurosello/frappe,tundebabzy/frappe,saurabh6790/frappe,RicardoJohann/frappe,vjFaLk/frappe,saurabh6790/frappe,mhbu50/frappe,yashodhank/frappe,saurabh6790/frappe,chdecultot/frappe,paurosello/frappe,paurosello/frappe,neilLasrado/frappe,mhbu50/frappe,vjFaLk/frappe,tmim... | frappe/desk/calendar.py | frappe/desk/calendar.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
import json
@frappe.whitelist()
def update_event(args, field_map):
"""Updates Event (called via calendar) based on passed `field_map`"""
arg... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
import json
@frappe.whitelist()
def update_event(args, field_map):
"""Updates Event (called via calendar) based on passed `field_map`"""
arg... | mit | Python |
8ae44c47037d99b228916aa7fb526c109a55f7ee | update docstring in opendirectoryd_build_number | chilcote/unearth,chilcote/unearth | artifacts/opendirectoryd_build_number.py | artifacts/opendirectoryd_build_number.py | import subprocess
factoid = 'opendirectoryd_build_number'
def fact():
'''
Returns the current build number of opendirectoryd
'''
result = 'None'
try:
proc = subprocess.Popen(
['/usr/libexec/opendirectoryd', '-v'],
stdout=subprocess.PIPE,
... | import subprocess
factoid = 'opendirectoryd_build_number'
def fact():
'''
Returns the "project version" number used to build opendirectoryd
per https://support.apple.com/en-gb/HT208315 to check that
"Security Update 2017-001" is installed
'''
result = 'None'
try:
proc = subproces... | apache-2.0 | Python |
de60e8e6a93129808415c7a3e19ff8d52dd39a5d | add certifiers-of and certified-by in wot | ucoin-io/cutecoin,Insoleet/cutecoin,ucoin-io/cutecoin,ucoin-bot/cutecoin,ucoin-io/cutecoin | ucoinpy/api/bma/wot/__init__.py | ucoinpy/api/bma/wot/__init__.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 it will be useful,
# ... | #
# 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 it will be useful,
# ... | mit | Python |
2cf659c03d42fba423ceb11aedfb7046672843d8 | add highscore methods to MeowDatabase | ana-balica/meow_letters_py | meow_letters/storage/meowdb.py | meow_letters/storage/meowdb.py | import sqlite3
class SqliteDatabase(object):
"""Wrapper class for working with sqlite databases
"""
def __init__(self, dbname):
"""Initializes a connection to the database and creates a cursor to it
:param dbname: string name of database
"""
self.conn = sqlite3.connect(dbn... | import sqlite3
class SqliteDatabase(object):
"""Wrapper class for working with sqlite databases
"""
def __init__(self, dbname):
"""Initializes a connection to the database and creates a cursor to it
:param dbname: string name of database
"""
self.conn = sqlite3.connect(dbn... | mit | Python |
79e2f3ab762c29087a0902f19bb9c71c07313b4e | Test function for exp. | charanpald/APGL | exp/__init__.py | exp/__init__.py | def test():
"""
A function which uses the unittest library to find all tests (those files
matching "*Test.py"), and run those tests.
"""
try:
import traceback
import sys
import os
import unittest
import logging
logging.disable(logging.WARNING)
... | bsd-3-clause | Python | |
ec60f2dfc9159a5c662d1abe1ef924688f5867f9 | update version | mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf | src/ezdxf/version.py | src/ezdxf/version.py | # version scheme: (major, minor, micro, release_level)
#
# major:
# 0 .. not all planned features done
# 1 .. all features available
# 2 .. if significant API change (2, 3, ...)
#
# minor:
# changes with new features or minor API changes
#
# micro:
# changes with bug fixes, maybe also minor API changes
#
# re... | # version scheme: (major, minor, micro, release_level)
#
# major:
# 0 .. not all planned features done
# 1 .. all features available
# 2 .. if significant API change (2, 3, ...)
#
# minor:
# changes with new features or minor API changes
#
# micro:
# changes with bug fixes, maybe also minor API changes
#
# re... | mit | Python |
0831f16cbc0fbbc969df87e1b0077327a05850be | fix bugs with method calls | ucdavis-kanvinde-group/abaqus-pso-calibration,ucdavis-kanvinde-group/abaqus-pso-calibration | Calibration/odbFetchFieldOutput.py | Calibration/odbFetchFieldOutput.py | """
Vincente Pericoli
UC Davis
for more info, including license information,
see: https://github.com/ucdavis-kanvinde-group/abaqus-odb-tools
Set of functions to use with ABAQUS output databases (ODB files).
These functions rely on the abaqus-odb-tools library (see above).
They exist purely for backward-compatibilit... | """
Vincente Pericoli
UC Davis
for more info, including license information,
see: https://github.com/ucdavis-kanvinde-group/abaqus-odb-tools
Set of functions to use with ABAQUS output databases (ODB files).
These functions rely on the abaqus-odb-tools library (see above).
They exist purely for backward-compatibilit... | bsd-3-clause | Python |
a99a1bd0c8de90e37b59452d71ebfc0b24a5dcc4 | Tag new release: 3.1.7 | Floobits/floobits-sublime,Floobits/floobits-sublime | floo/version.py | floo/version.py | PLUGIN_VERSION = '3.1.7'
# The line above is auto-generated by tag_release.py. Do not change it manually.
try:
from .common import shared as G
assert G
except ImportError:
from common import shared as G
G.__VERSION__ = '0.11'
G.__PLUGIN_VERSION__ = PLUGIN_VERSION
| PLUGIN_VERSION = '3.1.6'
# The line above is auto-generated by tag_release.py. Do not change it manually.
try:
from .common import shared as G
assert G
except ImportError:
from common import shared as G
G.__VERSION__ = '0.11'
G.__PLUGIN_VERSION__ = PLUGIN_VERSION
| apache-2.0 | Python |
76f35232f5b68ebf94db976032a758dd27859fb0 | Bump versino to 1.7.8 | artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin | fpr/__init__.py | fpr/__init__.py | """
:mod:`fpr` -- Format Policy Registry
.. module:: fpr
:platform: Unix
:synopsis: Allow interaction with the Format Policy Registry
.. moduleauthor:: Joseph Perry <joseph@artefactual.com>
.. moduleauthor:: Justin Simpson <jsimpson@artefactual.com>
"""
__version__ = '1.7.8'
| """
:mod:`fpr` -- Format Policy Registry
.. module:: fpr
:platform: Unix
:synopsis: Allow interaction with the Format Policy Registry
.. moduleauthor:: Joseph Perry <joseph@artefactual.com>
.. moduleauthor:: Justin Simpson <jsimpson@artefactual.com>
"""
__version__ = '1.7.6'
| agpl-3.0 | Python |
466e419fb62be5df4ffeaffd2004610e3c662fb9 | Add additional question slices | HazyResearch/metal,HazyResearch/metal | metal/mmtl/glue/glue_slices.py | metal/mmtl/glue/glue_slices.py | import warnings
question_words = set(["who", "what", "where", "when", "why", "how"])
def ends_with_question_word(dataset, idx):
"""Returns True if a question word is in the last three tokens of any sentence"""
# HACK: For now (speedy POC), just use the BERT tokens
# Eventually, we'd like to have access t... | import warnings
question_words = set(["who", "what", "where", "when", "why", "how"])
def ends_with_question_word(dataset, idx):
"""Returns True if a question word is in the last three tokens of any sentence"""
# HACK: For now (speedy POC), just use the BERT tokens
# Eventually, we'd like to have access t... | apache-2.0 | Python |
7fcd5e52b0f7e7133789b2f4392295f3d01120d6 | remove schema from default settings IN_RESOURCES | viatoriche/microservices,viatoriche/microservices,viatoriche/microservices,viatoriche/microservices | microservices/http/settings.py | microservices/http/settings.py | from flask_api import settings
from microservices.http.renderers import MicroserviceJSONRenderer, MicroserviceBrowsableAPIRenderer
from microservices.http.parsers import MicroserviceXMLParser
from microservices.http.resources import ResourceSchema
class MicroserviceAPISettings(settings.APISettings):
@property
... | from flask_api import settings
from microservices.http.renderers import MicroserviceJSONRenderer, MicroserviceBrowsableAPIRenderer
from microservices.http.parsers import MicroserviceXMLParser
from microservices.http.resources import ResourceSchema
class MicroserviceAPISettings(settings.APISettings):
@property
... | mit | Python |
8e741a576cc378040c54a4e529f0f19d5d4d963c | Change import sha256 | nabla-c0d3/sslyze | sslyze/plugins/certificate_info/_certificate_utils.py | sslyze/plugins/certificate_info/_certificate_utils.py | from hashlib import sha256
from typing import List, cast
from cryptography import x509
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
from cryptography.x509 import ExtensionOID, DNSName, ExtensionNotFound, NameOID
from cryptography.x509.extensions import DuplicateExtension
def extrac... | from _sha256 import sha256
from typing import List, cast
from cryptography import x509
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
from cryptography.x509 import ExtensionOID, DNSName, ExtensionNotFound, NameOID
from cryptography.x509.extensions import DuplicateExtension
def extrac... | agpl-3.0 | Python |
f26d487dac4207826746714e600b1fd5afc802bc | reformat keys file to make room for comments | eEcoLiDAR/eEcoLiDAR | laserchicken/keys.py | laserchicken/keys.py | # Name of point data section in point cloud structure
point = 'vertex'
#
point_cloud = 'pointcloud'
#
provenance = 'log'
| point = 'vertex'
point_cloud = 'pointcloud'
provenance = 'log'
| apache-2.0 | Python |
3591833a764db35efa5902a3dd7bab2f00ba4fd4 | Update platform_detect.py | adafruit/Adafruit_Python_DHT,brianchou428/ntutlab610,PMudra/Adafruit_Python_DHT,Gadgetoid/Adafruit_Python_DHT,JoBergs/Adafruit_Python_DHT,brianchou428/ntutlab610,e2dmax/Adafruit_Python_DHT,brianchou428/ntutlab610,mh03r932/raspi2dht11,warkanum/Adafruit_Python_DHT,mala-zaba/Adafruit_Python_DHT,e2dmax/Adafruit_Python_DHT,... | Adafruit_DHT/platform_detect.py | Adafruit_DHT/platform_detect.py | # Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# 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, mo... | # Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# 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, mo... | mit | Python |
e3af08b47c8f96d8598515cc0eb57373b1f6f434 | Load manifest for DOS2 declaration | alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend | app/__init__.py | app/__init__.py | from datetime import timedelta, datetime
from flask import Flask, request, redirect
from flask.ext.bootstrap import Bootstrap
from flask_login import LoginManager
from flask_wtf.csrf import CsrfProtect
import dmapiclient
from dmutils import init_app, flask_featureflags, formats
from dmutils.user import User
from dmco... | from datetime import timedelta, datetime
from flask import Flask, request, redirect
from flask.ext.bootstrap import Bootstrap
from flask_login import LoginManager
from flask_wtf.csrf import CsrfProtect
import dmapiclient
from dmutils import init_app, flask_featureflags, formats
from dmutils.user import User
from dmco... | mit | Python |
8ae763c69bbba11a264f8404b8189a53c63d4f40 | Move log print to after_step | Yelp/paasta,gstarnberger/paasta,gstarnberger/paasta,Yelp/paasta,somic/paasta,somic/paasta | marathon_itests/environment.py | marathon_itests/environment.py | import time
from itest_utils import wait_for_marathon
from itest_utils import print_container_logs
def before_all(context):
wait_for_marathon()
def after_scenario(context, scenario):
"""If a marathon client object exists in our context, delete any apps in Marathon and wait until they die."""
if context... | import time
from itest_utils import wait_for_marathon
from itest_utils import print_container_logs
def before_all(context):
wait_for_marathon()
def after_scenario(context, scenario):
"""If a marathon client object exists in our context, delete any apps in Marathon and wait until they die."""
if scenari... | apache-2.0 | Python |
ed8aafcffb401680adb9d55c1858731195239f58 | Fix pep8 | techbureau/zaifbot,techbureau/zaifbot | zaifbot/indicators/macd.py | zaifbot/indicators/macd.py | import pandas as pd
from .indicator import Indicator
class MACD(Indicator):
_NAME = 'macd'
def __init__(self, currency_pair='btc_jpy', period='1d', short=12, long=26, signal=9):
super().__init__(currency_pair, period)
self._short = self._bounded_length(short)
self._long = self._bounde... | import pandas as pd
from .indicator import Indicator
class MACD(Indicator):
_NAME = 'macd'
def __init__(self, currency_pair='btc_jpy', period='1d', short=12, long=26, signal=9):
super().__init__(currency_pair, period)
self._short = self._bounded_length(short)
self._long = self._bounde... | mit | Python |
605443886582d13c2b45b19fad86854bf4e8ddbd | Add more fields to Release serializer. | ThreeDRadio/playlists,ThreeDRadio/playlists,ThreeDRadio/playlists | backend/catalogue/serializers.py | backend/catalogue/serializers.py | from rest_framework import serializers
from .models import Release, Track, Comment
class CommentSerializer(serializers.ModelSerializer):
class Meta:
model = Comment
fields = ('id', 'comment')
class TrackSerializer(serializers.ModelSerializer):
class Meta:
model = Track
fields... | from rest_framework import serializers
from .models import Release, Track, Comment
class CommentSerializer(serializers.ModelSerializer):
class Meta:
model = Comment
fields = ('id', 'comment')
class TrackSerializer(serializers.ModelSerializer):
cdid = serializers.StringRelatedField(
re... | mit | Python |
b93137545f8db44383985ddf02c7b2a8500afd04 | Support for importing a profile. Contributes to CURA-1667 Profile import/export | Curahelper/Cura,Curahelper/Cura,totalretribution/Cura,senttech/Cura,ynotstartups/Wanhao,fieldOfView/Cura,totalretribution/Cura,senttech/Cura,fieldOfView/Cura,ynotstartups/Wanhao,hmflash/Cura,hmflash/Cura | plugins/CuraProfileReader/CuraProfileReader.py | plugins/CuraProfileReader/CuraProfileReader.py | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
import os.path
from UM.Application import Application #To get the machine manager to create the new profile in.
from UM.Logger import Logger
from UM.Settings.InstanceContainer import InstanceContainer #The new profile to m... | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from UM.Application import Application #To get the machine manager to create the new profile in.
from UM.Logger import Logger
from cura.ProfileReader import ProfileReader
## A plugin that reads profile data from Cura pro... | agpl-3.0 | Python |
0c8fcce3dad293731f6c816f421133a16732b6a8 | fix factor_combinations | amaozhao/algorithms,keon/algorithms | backtrack/factor_combinations.py | backtrack/factor_combinations.py | """
Numbers can be regarded as product of its factors. For example,
8 = 2 x 2 x 2;
= 2 x 4.
Write a function that takes an integer n and return all possible combinations of its factors.
Note:
You may assume that n is always positive.
Factors should be greater than 1 and less than n.
Examples:
input: 1
output:
[]
in... | """
Numbers can be regarded as product of its factors. For example,
8 = 2 x 2 x 2;
= 2 x 4.
Write a function that takes an integer n and return all possible combinations of its factors.
Note:
You may assume that n is always positive.
Factors should be greater than 1 and less than n.
Examples:
input: 1
output:
[]
in... | mit | Python |
2d58592b6aecc568e11b3619f4b3deeb00d938f5 | Correct query param | looker/sentry,looker/sentry,jean/sentry,looker/sentry,fotinakis/sentry,ifduyue/sentry,JamesMura/sentry,nicholasserra/sentry,daevaorn/sentry,fotinakis/sentry,imankulov/sentry,BayanGroup/sentry,fotinakis/sentry,jean/sentry,daevaorn/sentry,JamesMura/sentry,zenefits/sentry,gencer/sentry,hongliang5623/sentry,JamesMura/sentr... | src/sentry/search/utils.py | src/sentry/search/utils.py | from __future__ import absolute_import, division, print_function
def parse_query(query):
# TODO(dcramer): make this better
tokens = query.split(' ')
results = {'tags': {}, 'query': []}
for token in tokens:
if ':' in token:
key, value = token.split(':', 1)
results['tags... | from __future__ import absolute_import, division, print_function
def parse_query(query):
# TODO(dcramer): make this better
tokens = query.split(' ')
results = {'tags': {}, 'query': []}
for token in tokens:
if ':' in token:
key, value = token.split(':', 1)
results['tags... | bsd-3-clause | Python |
7849e1b389ee250f43f4fef8938afa4392c41c33 | Fix some texts in export script | aleksigron/kokko,aleksigron/kokko,aleksigron/graphics-toolkit,aleksigron/graphics-toolkit | scripts/blender_custom_format/__init__.py | scripts/blender_custom_format/__init__.py | bl_info = {
"name": "Custom mesh export",
"description": "Export mesh to custom file format",
"author": "Aleksi Grön",
"version": (0, 2),
"blender": (2, 57, 0),
"location": "File > Export",
"category": "Import-Export"
}
import bpy
from bpy.props import StringProperty, BoolProperty
from bpy_... | bl_info = {
"name": "Custom file export",
"description": "Export to custom file format",
"author": "Aleksi Grön",
"version": (0, 2),
"blender": (2, 57, 0),
"location": "File > Export",
"category": "Import-Export"
}
import bpy
from bpy.props import StringProperty, BoolProperty
from bpy_extra... | mit | Python |
4622977ea419a58769cc4195e805dde4faf52eab | Update forms.py | jmennen/group5,jmennen/group5,jmennen/group5,jmennen/group5 | Code/buzzit/buzzit_app/forms.py | Code/buzzit/buzzit_app/forms.py | from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
#form to display the user registration, check if the username already exists or password don't match
#and throw errors to interact with user
class RegistrationForm(forms.Form):
# form fiel... | from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
#form to display the user registration, check if the username already exists or password don't match
#and throw errors to interact with user
class RegistrationForm(forms.Form):
username = ... | bsd-2-clause | Python |
ebca867496366dd6ee0011500ac54eb446026297 | update (#8005) | tmerrick1/spack,iulian787/spack,krafczyk/spack,LLNL/spack,krafczyk/spack,LLNL/spack,iulian787/spack,matthiasdiener/spack,LLNL/spack,tmerrick1/spack,iulian787/spack,matthiasdiener/spack,krafczyk/spack,LLNL/spack,mfherbst/spack,matthiasdiener/spack,mfherbst/spack,mfherbst/spack,krafczyk/spack,matthiasdiener/spack,mfherbs... | var/spack/repos/builtin/packages/py-cython/package.py | var/spack/repos/builtin/packages/py-cython/package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
52d22471c6226c07a6f2dd9d4f0470b7655e7c28 | Fix the `AUTH_USER_MODEL` value in the example auth settings file. | leekchan/djangae,jscissr/djangae,wangjun/djangae,armirusco/djangae,potatolondon/djangae,asendecka/djangae,asendecka/djangae,armirusco/djangae,stucox/djangae,jscissr/djangae,SiPiggles/djangae,chargrizzle/djangae,armirusco/djangae,trik/djangae,kirberich/djangae,nealedj/djangae,wangjun/djangae,nealedj/djangae,trik/djangae... | djangae/contrib/gauth/settings.py | djangae/contrib/gauth/settings.py |
AUTHENTICATION_BACKENDS = (
'djangae.contrib.gauth.backends.AppEngineUserAPI',
)
AUTH_USER_MODEL = 'djangae.GaeDatastoreUser'
LOGIN_URL = 'djangae_login_redirect'
|
AUTHENTICATION_BACKENDS = (
'djangae.contrib.gauth.backends.AppEngineUserAPI',
)
AUTH_USER_MODEL = 'djangae.User'
LOGIN_URL = 'djangae_login_redirect'
| bsd-3-clause | Python |
f7b9b8e6b006d9bbb8ba19e50c0a4c642f8f7639 | rename to IRDatetimeFieldType | kata198/indexedredis,kata198/indexedredis | IndexedRedis/AdvancedFieldTypes.py | IndexedRedis/AdvancedFieldTypes.py |
from datetime import datetime
__all__ = ('IRDatetimeFieldType',)
class IRDatetimeFieldType(datetime):
'''
IRDatetimeFieldType - A field type that is a datetime. Pass this as "valueType" to an IRField to use a datetime
'''
def __new__(self, *args, **kwargs):
if len(args) == 1:
... |
from datetime import datetime
__all__ = ('IRDatetimeType',)
class IRDatetimeType(datetime):
'''
IRDatetimeType - A field type that is a datetime. Pass this as "valueType" to an IRField to use a datetime
'''
def __new__(self, *args, **kwargs):
if len(args) == 1:
if type(args[0... | lgpl-2.1 | Python |
1118541b1cdea7f6079bb63d000ba54f69dfa119 | Use form.save for receipt creation | trimailov/finance,trimailov/finance,trimailov/finance | books/views.py | books/views.py | from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.shortcuts import render
from books import models
from books import forms
@login_required
def receipt_list(request, user_... | from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render
from books import models
from books import forms
@login_required
def receipt_list(request... | mit | Python |
e9de1d533d6ceb6ca3f1661d77144abfd8403e1c | Remove memory benchmark "special" bounds for CircleCI. | dhermes/bezier,dhermes/bezier,dhermes/bezier | benchmarks/memory/test_curves.py | benchmarks/memory/test_curves.py | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | apache-2.0 | Python |
4f5001787e6a80563e49a11b010ef79d71afd79c | Remove old TODO items | chubbymaggie/barf-project,chubbymaggie/barf-project,cnheitman/barf-project,programa-stic/barf-project,programa-stic/barf-project,cnheitman/barf-project,cnheitman/barf-project,chubbymaggie/barf-project | barf/arch/helper.py | barf/arch/helper.py | # Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# 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... | # Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# 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... | bsd-2-clause | Python |
adad4442502c4c75b94ca2757f29165d084b9dce | test collections.Counter | xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples | pythonPractiseSamples/collectionsExcercises.py | pythonPractiseSamples/collectionsExcercises.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Damian Ziobro <damian@xmementoit.com>
import unittest
from collections import deque
from collections import defaultdict
from collections import namedtuple
from collections import Counter
class TestCollectionsMethods(unittest.TestCas... | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Damian Ziobro <damian@xmementoit.com>
import unittest
from collections import deque
from collections import defaultdict
from collections import namedtuple
class TestCollectionsMethods(unittest.TestCase):
def setUp(self):
... | apache-2.0 | Python |
bafa6fc6d8fb6d1f3c2ad7edf70ccd3d2440f2a2 | Add comment in pytest conftest | LibreTime/libretime,LibreTime/libretime,LibreTime/libretime,LibreTime/libretime,LibreTime/libretime,LibreTime/libretime | python_apps/airtime_analyzer/tests/conftest.py | python_apps/airtime_analyzer/tests/conftest.py | import os
import shutil
from tempfile import TemporaryDirectory
import pytest
AUDIO_FILE = "tests/test_data/44100Hz-16bit-mono.mp3"
AUDIO_FILENAME = os.path.basename(AUDIO_FILE)
AUDIO_IMPORT_DEST = "Test Artist/Test Album/44100Hz-16bit-mono.mp3"
# TODO: Use pathlib for file manipulation
@pytest.fixture()
def dest_... | import os
import shutil
import tempfile
import pytest
AUDIO_FILE = "tests/test_data/44100Hz-16bit-mono.mp3"
AUDIO_FILENAME = os.path.basename(AUDIO_FILE)
AUDIO_IMPORT_DEST = "Test Artist/Test Album/44100Hz-16bit-mono.mp3"
@pytest.fixture()
def dest_dir():
with tempfile.TemporaryDirectory(prefix="dest") as tmpdi... | agpl-3.0 | Python |
557615922182f65fb51153e28613b37ae07356be | Fix reload after errors | edne/pineal | bin/py/vision.py | bin/py/vision.py | from core import of_log
from py.utils import hy_eval_code
class Vision(object):
template = """
(require py.dsl)
(--header--)
(defn --draw-- [] {})
"""
def __init__(self):
self.history = []
self.ns = {}
self.last_error = ""
self.update("")
def update(self, ... | from core import of_log
from py.utils import hy_eval_code
class Vision(object):
template = """
(require py.dsl)
(--header--)
(defn --draw-- [] {})
"""
def __init__(self):
self.history = []
self.last_error = ""
self.update("")
def update(self, code):
code =... | agpl-3.0 | Python |
232e4891682a9c02b6ad9ef2d6e9dfc72654b0cf | fix toombs tomb | NCSSM-CS/CSAssess,NCSSM-CS/CSAssess,NCSSM-CS/CSAssess,NCSSM-CS/CSAssess | controller/request.py | controller/request.py | #!/usr/local/bin/python3
# Author : Caeman + Sam
import cgi
import cgitb
#import json
import sys
import constants
def processRequest(unprocessedForm):
""" Receives cgi.FieldStorage() and returns JSON to be printed"""
if "requestType" in unprocessedForm:
requestType = unprocessedForm.getvalue("re... | #!/usr/bin/local/python3
# Author : Caeman + Sam
import cgi
import cgitb
#import json
import sys
import constants
def processRequest(unprocessedForm):
""" Receives cgi.FieldStorage() and returns JSON to be printed"""
if "requestType" in unprocessedForm:
requestType = unprocessedForm.getvalue("re... | mit | Python |
c39324ed8727e204731514d744e0c81b7c4cc9d0 | move db-connection to db.py | crucl0/gps_tracker,crucl0/gps_tracker,crucl0/gps_tracker | gps_tracker/__init__.py | gps_tracker/__init__.py | from pyramid.config import Configurator
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings)
config.add_static_view('static', 'static', cache_max_age=3600)
config.include('.db')
config.add_route('main', '/')
... | from pyramid.config import Configurator
from urllib.parse import urlparse
import pymongo
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings)
config.add_static_view('static', 'static', cache_max_age=3600)
db_url = ... | mit | Python |
36ede8f6372a506f588838b862785ae9bd7a5550 | Remove delegated commands | mwilliamson/mayo | blah/commands.py | blah/commands.py | import os
import subprocess
import sys
def find_command(name):
return commands[name]
def what_is_this_command():
repository = find_current_repository()
if repository is None:
print "Could not find source control repository"
else:
print "{0}+file://{1}".format(repository.type, repositor... | import os
import subprocess
import sys
def find_command(name):
return commands[name]
def what_is_this_command():
repository = find_current_repository()
if repository is None:
print "Could not find source control repository"
else:
print "{0}+file://{1}".format(repository.type, repositor... | bsd-2-clause | Python |
2037a4f3b5084346c85b324d2f925f7852fc832a | debug on | tgsd96/gargnotes,tgsd96/gargnotes,tgsd96/gargnotes,tgsd96/gargnotes | blog/settings.py | blog/settings.py | """
Django settings for blog project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... | """
Django settings for blog project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... | mit | Python |
36c4a3c67008c7838ec391e41e1ce4e28d094c33 | work on v5 | bndl/bndl,bndl/bndl | bndl/__init__.py | bndl/__init__.py | # 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
# distributed under th... | # 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
# distributed under th... | apache-2.0 | Python |
8f9ecc6629c783395e5449452839bc1d7a2dbee8 | fix bug in addGameAnalysis | clarkerubber/irwin,clarkerubber/irwin | modules/game/GameAnalysisStore.py | modules/game/GameAnalysisStore.py | from collections import namedtuple
from pprint import pprint
from modules.game.GameAnalysis import GameAnalysis
import numpy as np
import math
class GameAnalysisStore(namedtuple('GameAnalysisStore', ['games', 'gameAnalyses'])):
def gamesWithoutAnalysis(self, excludeIds=[]):
return [game for game in self.... | from collections import namedtuple
from pprint import pprint
from modules.game.GameAnalysis import GameAnalysis
import numpy as np
import math
class GameAnalysisStore(namedtuple('GameAnalysisStore', ['games', 'gameAnalyses'])):
def gamesWithoutAnalysis(self, excludeIds=[]):
return [game for game in self.... | agpl-3.0 | Python |
afed4a17fcdd2f8ac7bba15178c81219f596a734 | Simplify F.floor test | wkentaro/chainer,pfnet/chainer,okuta/chainer,okuta/chainer,wkentaro/chainer,keisuke-umezawa/chainer,chainer/chainer,hvy/chainer,hvy/chainer,wkentaro/chainer,niboshi/chainer,niboshi/chainer,keisuke-umezawa/chainer,hvy/chainer,wkentaro/chainer,keisuke-umezawa/chainer,niboshi/chainer,niboshi/chainer,okuta/chainer,chainer/... | tests/chainer_tests/functions_tests/math_tests/test_floor.py | tests/chainer_tests/functions_tests/math_tests/test_floor.py | import numpy
from chainer import functions
from chainer import testing
@testing.parameterize(*testing.product({
'shape': [(3, 2), ()],
'dtype': [numpy.float16, numpy.float32, numpy.float64],
}))
@testing.fix_random()
@testing.inject_backend_tests(
None,
# CPU tests
[
{},
]
# GPU t... | import unittest
import numpy
import chainer
from chainer.backends import cuda
import chainer.functions as F
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
class UnaryFunctionsTestBase(unittest.TestCase):
def make_data(self):
raise NotImplementedError
... | mit | Python |
6821627e2d7ae96f3d903e33ea8f43b2ca1375c6 | handle item names that aren't title case | bd4/monster-hunter-scripts,bd4/monster-hunter-scripts,bd4/monster-hunter-scripts | bin/mhrewards.py | bin/mhrewards.py | #!/usr/bin/env python
import _pathfix
from mhapi.db import MHDB
from mhapi import rewards
from mhapi.util import get_utf8_writer
def print_rewards(item_name):
out = get_utf8_writer(sys.stdout)
err_out = get_utf8_writer(sys.stderr)
db = MHDB(_pathfix.db_path)
# TODO: implement fuzzy search like in ... | #!/usr/bin/env python
import codecs
import _pathfix
from mhapi.db import MHDB
from mhapi import rewards
def get_utf8_writer(writer):
return codecs.getwriter("utf8")(writer)
if __name__ == '__main__':
import sys
import os
import os.path
if len(sys.argv) != 2:
print("Usage: %s 'item na... | mit | Python |
b955059917f8521aa7eb9d794eac2ccb211cc80e | fix typo in validator and test case thereby | byteweaver/django-coupons,byteweaver/django-coupons | coupons/validators.py | coupons/validators.py | from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from coupons.models import CouponUser
def validate_redeem(coupon, user=None):
if coupon.is_redeemed:
raise ValidationError(_("This code has already been used."))
try: # check if there is a user bound co... | from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from coupons.models import CouponUser
def validate_redeem(coupon, user=None):
if coupon.is_redeemed:
raise ValidationError(_("This code has already been used."))
try: # check if there is a user bound co... | bsd-3-clause | Python |
38560dbcbf183d1fe90a4c562969ced5c7277f96 | tidy the people files as well | mhorvvitz/codeandtalk.com,shaylavi/codeandtalk.com,shaylavi/codeandtalk.com,szabgab/codeandtalk.com,mhorvvitz/codeandtalk.com,mhorvvitz/codeandtalk.com,szabgab/codeandtalk.com,shaylavi/codeandtalk.com,rollandf/codeandtalk.com,szabgab/codeandtalk.com,szabgab/codeandtalk.com,rollandf/codeandtalk.com,rollandf/codeandtalk.... | bin/tidy_json.py | bin/tidy_json.py | #!/usr/bin/env python3
import json
import glob
# format the json files
def tidy(filename):
with open(filename) as fh:
data = json.load(fh)
with open(filename, 'w') as fh:
json.dump(data, fh, sort_keys=True, indent=4, separators=(',', ': '), ensure_ascii=False)
for filename in glob.glob("data/... | #!/usr/bin/env python3
import json
import glob
# format the json files
def tidy(filename):
with open(filename) as fh:
data = json.load(fh)
with open(filename, 'w') as fh:
json.dump(data, fh, sort_keys=True, indent=4, separators=(',', ': '), ensure_ascii=False)
for filename in glob.glob("data/... | apache-2.0 | Python |
b5f47cc47a7be36dade2de608cd8f9a15f0f0828 | allow some future lumi types | xiezhen/brilws,xiezhen/brilws | brilws/params.py | brilws/params.py | _timeopt_pattern = '^\d\d/\d\d/\d\d \d\d:\d\d:\d\d$|^\d{6}$|^\d{4}$'
_fillnum_pattern = '^\d{4}$'
_runnum_pattern = '^\d{6}$'
_time_pattern = '^\d\d/\d\d/\d\d \d\d:\d\d:\d\d$'
_hltpath_pattern = '^HLT_[\w\*\?\[\]\!]+$'
_hltconfig_pattern = '^\d+$|^[0-9a-zA-Z\_\.\/\*\?\[\]\!]+$'
_bxlist_pattern = r'(\d+)(,\s*\d+)*'
_amo... | _timeopt_pattern = '^\d\d/\d\d/\d\d \d\d:\d\d:\d\d$|^\d{6}$|^\d{4}$'
_fillnum_pattern = '^\d{4}$'
_runnum_pattern = '^\d{6}$'
_time_pattern = '^\d\d/\d\d/\d\d \d\d:\d\d:\d\d$'
_hltpath_pattern = '^HLT_[\w\*\?\[\]\!]+$'
_hltconfig_pattern = '^\d+$|^[0-9a-zA-Z\_\.\/\*\?\[\]\!]+$'
_bxlist_pattern = r'(\d+)(,\s*\d+)*'
_amo... | mit | Python |
082a67eb25c482b2ebd40b8a7ae821b115fca260 | fix heading generation | csquaredphd/ipyxact,csquaredphd/ipyxact,olofk/ipyxact,csquaredphd/ipyxact,olofk/ipyxact | gen_markdown.py | gen_markdown.py | #ipyxact example. Parses an IP-XACT XML file called generic_example.xml
#and prints out extended Markdown of the register maps found
import sys
import xml.etree.ElementTree as ET
from ipyxact import MemoryMap, Ipxact
def print_memorymaps(memory_maps, offset=0, title=None):
s = """{}
===========
Register Map
---... | #ipyxact example. Parses an IP-XACT XML file called generic_example.xml
#and prints out extended Markdown of the register maps found
import sys
import xml.etree.ElementTree as ET
from ipyxact import MemoryMap, Ipxact
def print_memorymaps(memory_maps, offset=0, title=None):
s = """{}
===========
Register Map
---... | mit | Python |
4a42ea5d19b088c6e59f18379970b297ce00c70f | fix path to mapnik_settings.js | mapnik/node-mapnik,langateam/node-mapnik,tomhughes/node-mapnik,Uli1/node-mapnik,langateam/node-mapnik,langateam/node-mapnik,mapnik/node-mapnik,MaxSem/node-mapnik,Uli1/node-mapnik,stefanklug/node-mapnik,tomhughes/node-mapnik,CartoDB/node-mapnik,mapnik/node-mapnik,CartoDB/node-mapnik,stefanklug/node-mapnik,tomhughes/node... | gen_settings.py | gen_settings.py | import os
settings = os.path.join(os.path.dirname(__file__),'lib/binding','mapnik_settings.js')
# this goes into a mapnik_settings.js file beside the C++ _mapnik.node
settings_template = """
module.exports.paths = {
'fonts': %s,
'input_plugins': %s
};
"""
def write_mapnik_settings(fonts='undefined',input_plu... | import os
settings = os.path.join(os.path.dirname(__file__),'lib','mapnik_settings.js')
# this goes into a mapnik_settings.js file beside the C++ _mapnik.node
settings_template = """
module.exports.paths = {
'fonts': %s,
'input_plugins': %s
};
"""
def write_mapnik_settings(fonts='undefined',input_plugins='un... | bsd-3-clause | Python |
1e01e66f23f7a2ca541a29d29658749f95352c41 | Print last 10 generated keys when no arguments were given. | ZeitOnline/content-api,ZeitOnline/content-api | generate-key.py | generate-key.py | #!/usr/bin/python
import os
import sqlite3
import sys
import time
db = sqlite3.connect('/var/lib/zon-api/data.db')
if len(sys.argv) < 3:
print('Usage: %s "Firstname Lastname" email@example.com' % sys.argv[0])
print('\nLast keys:')
query = 'SELECT * FROM client ORDER by reset DESC limit 10'
for client... | #!/usr/bin/python
import os
import sqlite3
import sys
import time
if len(sys.argv) < 3:
raise ValueError('Usage: %s "Firstnam Lastname" email@example.com' % sys.argv[0])
db = sqlite3.connect('/var/lib/zon-api/data.db')
api_key = str(os.urandom(26).encode('hex'))
tier = 'free'
name = sys.argv[1]
email = sys.argv[... | bsd-3-clause | Python |
c1c2a824f7eed20ec51895465517bab6f5c05947 | Remove deprecated urls for paperclip | Anaethelion/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,Anaethelion/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,Anaethelion/Geotrek,Anaethelion/Geotrek,makinacorpus/Geotrek | geotrek/urls.py | geotrek/urls.py | from django.conf import settings
from django.conf.urls import patterns, include, url, static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
admin.autodiscover()
handler403 = 'mapentity.views.handler403'
handler404 = 'mapentity.views.handler404'
handler500 = 'mape... | from django.conf import settings
from django.conf.urls import patterns, include, url, static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
from mapentity.forms import AttachmentForm
admin.autodiscover()
handler403 = 'mapentity.views.handler403'
handler404 = 'ma... | bsd-2-clause | Python |
b392a30579b99b05a4ff527ccdf9d809e717d63d | Fix path 2/ | swails/mdtraj,ctk3b/mdtraj,jchodera/mdtraj,casawa/mdtraj,dwhswenson/mdtraj,mattwthompson/mdtraj,rmcgibbo/mdtraj,hainm/mdtraj,tcmoore3/mdtraj,mdtraj/mdtraj,mattwthompson/mdtraj,dwhswenson/mdtraj,rmcgibbo/mdtraj,msultan/mdtraj,jchodera/mdtraj,mattwthompson/mdtraj,mpharrigan/mdtraj,mdtraj/mdtraj,mpharrigan/mdtraj,ctk3b/md... | MDTraj/html/__init__.py | MDTraj/html/__init__.py | from .install import enable_notebook
from .trajectory_widget import TrajectoryWidget | from .mixins import enable_notebook
from .trajectory_widget import TrajectoryWidget | lgpl-2.1 | Python |
7d118c9c4727e739587c052ffc09f6c6c976e791 | add debug statement | TheCodeEngine/server-compose | pkg/cli.py | pkg/cli.py | import click
from pkg.database import Cluster
from pkg.table import ClusterTable
from pkg.config import Config
class AppInfo:
@staticmethod
def version_info():
return 'Version 1.2.1 Copyright TheCodeEngine\nUnder MIT License http://opensource.org/licenses/MIT'
class GaleraCLI:
@staticmethod
def check(hosts, u... | import click
from pkg.database import Cluster
from pkg.table import ClusterTable
from pkg.config import Config
class AppInfo:
@staticmethod
def version_info():
return 'Version 1.2.1 Copyright TheCodeEngine\nUnder MIT License http://opensource.org/licenses/MIT'
class GaleraCLI:
@staticmethod
def check(hosts, u... | mit | Python |
5d56ae08ce94db96ff1a739c804bc97a834bcaa8 | Handle case when uploadSequenceToken is not returned in describe_log_streams (for new stream). | TimNooren/bokchoi,TimNooren/bokchoi | bokchoi/aws/cloudwatch_logger.py | bokchoi/aws/cloudwatch_logger.py | #!/usr/bin/env python3
import os
import sys
import time
import boto3
class CloudwatchLogger:
"""Reads messages from stdin and logs them to Cloudwatch Logs"""
def __init__(self):
self.logs_client = boto3.client('logs', region_name=os.environ['REGION'])
self.log_group_name = os.environ['BO... | #!/usr/bin/env python3
import os
import sys
import time
import boto3
class CloudwatchLogger:
"""Reads messages from stdin and logs them to Cloudwatch Logs"""
def __init__(self):
self.logs_client = boto3.client('logs', region_name=os.environ['REGION'])
self.log_group_name = os.environ['BO... | mit | Python |
4957e2be82afa136b130b18f4357e82556275f28 | Simplify imports | c-w/gutenberg-http,c-w/gutenberg-http | gutenberg_http/views.py | gutenberg_http/views.py | from datetime import datetime
from datetime import timezone
from os.path import getmtime
from urllib.parse import quote
from flask import redirect
from flask import request
from flask import jsonify
from gutenberg_http import app
from gutenberg_http import config
from gutenberg_http import errors
from gutenberg_http ... | from datetime import datetime
from datetime import timezone
from os.path import getmtime
from urllib.parse import quote
from flask import redirect
from flask import request
from flask import jsonify
from gutenberg_http import app
from gutenberg_http import config
from gutenberg_http.errors import InvalidUsage
from gu... | apache-2.0 | Python |
4a610e6891e78eef67cb04422d5106a487d87ace | Support new osprofiler API | noironetworks/heat,openstack/heat,noironetworks/heat,openstack/heat | heat/common/profiler.py | heat/common/profiler.py | #
# 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
# ... | #
# 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
# ... | apache-2.0 | Python |
b425965bad205b497b4b959daf27f33b6e75d097 | Fix ANN 19.06.16. | DisposaBoy/GoSublime,DisposaBoy/GoSublime | gosubl/about.py | gosubl/about.py | import re
import sublime
TAG = '19.06.16-1'
ANN = 'a'+TAG
VERSION = 'r'+TAG
VERSION_PAT = re.compile(r'\d{2}[.]\d{2}[.]\d{2}-\d+', re.IGNORECASE)
DEFAULT_GO_VERSION = 'go?'
GO_VERSION_OUTPUT_PAT = re.compile(r'go\s+version\s+(\S+(?:\s+[+]\w+|\s+\([^)]+)?)', re.IGNORECASE)
GO_VERSION_NORM_PAT = re.compile(r'[^\w.+-]+',... | import re
import sublime
TAG = '18.11.28-1'
ANN = 'a'+TAG
VERSION = 'r'+TAG
VERSION_PAT = re.compile(r'\d{2}[.]\d{2}[.]\d{2}-\d+', re.IGNORECASE)
DEFAULT_GO_VERSION = 'go?'
GO_VERSION_OUTPUT_PAT = re.compile(r'go\s+version\s+(\S+(?:\s+[+]\w+|\s+\([^)]+)?)', re.IGNORECASE)
GO_VERSION_NORM_PAT = re.compile(r'[^\w.+-]+',... | mit | Python |
1ca21a3cce74e5a388aa1b7efea00318a236cad2 | Add funcname scope to _sum_attention() | raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten | nn/models/attention_sum_reader.py | nn/models/attention_sum_reader.py | from functools import partial
import tensorflow as tf
from .. import slmc, train, batch
from ..embedding import embeddings, bidirectional_id_sequence_to_embeddings
from ..dynamic_length import id_sequence_to_length
from ..softmax import softmax
from ..flags import add_flag, FLAGS
from ..optimize import minimize
from .... | from functools import partial
import tensorflow as tf
from .. import slmc, train, batch
from ..embedding import embeddings, bidirectional_id_sequence_to_embeddings
from ..dynamic_length import id_sequence_to_length
from ..softmax import softmax
from ..flags import add_flag, FLAGS
from ..optimize import minimize
from .... | unlicense | Python |
c12b35ef47e143bc290153bd8429aeca54c3d199 | Update comments | jtomasevic/cs | graphs/graph.py | graphs/graph.py | import Queue
class Graph:
def __init__(self):
self.nodes = []
'''
(Wikipadia):"Breadth-first search (BFS) is an algorithm for traversing graph data structures.
It starts at some arbitrary node of a graph, and explores the neighbor nodes first, before moving to the next level
neighbors."
... | import Queue
class Graph:
def __init__(self):
self.nodes = []
'''
(Wikipadia):"Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph data structures.
It starts at the tree root (or some arbitrary node of a graph, sometimes referred to as a 'search key'[1]) and
... | mit | Python |
ce0b62a63766aea3b1b53cb3064efdc2ab6535f0 | Rename api call | uberVU/elasticboard,uberVU/elasticboard,uberVU/elasticboard | data_processor/api.py | data_processor/api.py | import queries
from utils import crossdomain
from flask import Flask, jsonify
app = Flask(__name__)
app.debug = True
def index_name(user, repo):
return '-'.join((user, repo))
# api endpoints that call the queries
@app.route('/<user>/<repo>/most_active_people')
@crossdomain(origin='*')
def most_active_people(u... | import queries
from utils import crossdomain
from flask import Flask, jsonify
app = Flask(__name__)
app.debug = True
def index_name(user, repo):
return '-'.join((user, repo))
# api endpoints that call the queries
@app.route('/<user>/<repo>/most_active_people')
@crossdomain(origin='*')
def most_active_people(u... | mit | Python |
c69abfe271f6efcfef993ab1680dd6e67bc0220b | Fix text prefix requirement in webhook form | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | byceps/blueprints/admin/webhook/forms.py | byceps/blueprints/admin/webhook/forms.py | """
byceps.blueprints.admin.webhook.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from __future__ import annotations
from flask_babel import lazy_gettext
from wtforms import BooleanField, StringField
from wtforms.vali... | """
byceps.blueprints.admin.webhook.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from __future__ import annotations
from flask_babel import lazy_gettext
from wtforms import BooleanField, StringField
from wtforms.vali... | bsd-3-clause | Python |
b285755d3da94285c15e8f64760bdb7fccc8f106 | Update timeline.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,mecax/pyrobotlab,sstocker46/pyrobotlab,sstocker46/pyrobotlab,mecax/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab | home/Markus/timeline.py | home/Markus/timeline.py | import time
millis = time.time()
keyboard = Runtime.createAndStart("keyboard", "Keyboard")
keyboard.addListener("keyCommand", python.getName(), "input")
def input(cmd):
global millis
if (cmd == "A"):
interval = time.time() - millis
millis = time.time()
print ("sleep(" + str(round(in... |
keyboard = Runtime.createAndStart("keyboard", "Keyboard")
keyboard.addListener("keyCommand", python.getName(), "input")
import time
millis = time.time()
def input(cmd):
global millis
# print 'python object is',msg_[service]_[method]
cmd = msg_keyboard_keyCommand.data[0]
# print 'python data is', c... | apache-2.0 | Python |
5e900d29af8c11a2e7db13a8cd3a417fab8457a3 | Add type hints to image service | m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps | byceps/services/image/service.py | byceps/services/image/service.py | """
byceps.services.image.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from typing import BinaryIO, FrozenSet, Iterable, Set
from ...util.image import read_dimensions
from ...util.image.models import Dimensions, ImageType
from .... | """
byceps.services.image.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from ...util.image import read_dimensions
from ...util.image.models import ImageType
from ...util.image.typeguess import guess_type
ALL_IMAGE_TYPES = frozen... | bsd-3-clause | Python |
abbf7ad7820c41127d00db2fdd6a7a4b09e3be3b | Remove quote marks and fix generated query link. | gedare/gci_tasks,joelsherrill/gci_tasks,gedare/gci_tasks,joelsherrill/gci_tasks | 2013/citations/citations.py | 2013/citations/citations.py | #!/bin/python
##
## generate GCI tasks for updating citations
##
import getopt
import os
import sys
def usage():
print "\
Usage: citations.py -[hy:p:]\n\
-h --help print this help\n\
-y --year year to generate\n\
-p --pages number of pages in search results for the given year\n\
"... | #!/bin/python
##
## generate GCI tasks for updating citations
##
import getopt
import os
import sys
def usage():
print "\
Usage: citations.py -[hy:p:]\n\
-h --help print this help\n\
-y --year year to generate\n\
-p --pages number of pages in search results for the given year\n\
"... | bsd-2-clause | Python |
8c01d9c3b7d1938e78a52a86dfb4d8536987c223 | Change search url regexp to match all characters | Hackfmi/Diaphanum,Hackfmi/Diaphanum | hackfmi/urls.py | hackfmi/urls.py | from django.conf.urls import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from members import views
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', views.homepage, name='homepage'),
# Examples:
# ... | from django.conf.urls import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from members import views
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', views.homepage, name='homepage'),
# Examples:
# ... | mit | Python |
b0bb3cf5074fcef4f9b5efa5b3216ed854a8ea97 | Remove spurious prints | kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu | opinions/templatetags/opinions.py | opinions/templatetags/opinions.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import collections
from kamu.opinions.models import Question, Option, Answer, \
VoteOptionCongruence, QuestionSessionRelevance, QuestionSource
from kamu.opinions.views import LAST_QUESTION_KEY
from kamu.votes.models import Party, Session, Member
from kamu.user_voting impor... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import collections
from kamu.opinions.models import Question, Option, Answer, \
VoteOptionCongruence, QuestionSessionRelevance, QuestionSource
from kamu.opinions.views import LAST_QUESTION_KEY
from kamu.votes.models import Party, Session, Member
from kamu.user_voting impor... | agpl-3.0 | Python |
144fc3b86a2aecb04eb16b834518e51bc4dfb8d1 | fix cyclic reference | greencase/broadway,crazcalm/broadway | broadway/context.py | broadway/context.py | class Props():
def __init__(self, actor_class: type, *args, **kwargs):
self.actor_class = actor_class
self.args = args
self.kwargs = kwargs
class ActorRefFactory():
def actor_of(self, props: Props, actor_name=None):
raise NotImplementedError()
class ActorContext(ActorRefFacto... | from broadway.actorsystem import ActorSystem
class Props():
def __init__(self, actor_class: type, *args, **kwargs):
self.actor_class = actor_class
self.args = args
self.kwargs = kwargs
class ActorRefFactory():
def actor_of(self, props: Props, actor_name=None):
raise NotImplem... | apache-2.0 | Python |
fa71ca75ac46baa5b70748eb9970d8bef884d4c0 | Tweak to correct units. | jbwhit/CaliCompari | Python/FTS-continuum.py | Python/FTS-continuum.py | #!/usr/bin/env python
# encoding: utf-8
"""
FTS-continuum.py
Created by Jonathan Whitmore on 2011-09-30.
Copyright (c) 2011. All rights reserved.
"""
import sys
import os
import pylab as pl
import numpy as np
from scipy.interpolate import splrep, splev
import heapq
def smoothContinuum(binsize, nlarge, plot=False):
... | #!/usr/bin/env python
# encoding: utf-8
"""
FTS-continuum.py
Created by Jonathan Whitmore on 2011-09-30.
Copyright (c) 2011. All rights reserved.
"""
import sys
import os
import pylab as pl
import numpy as np
from scipy.interpolate import splrep, splev
import heapq
def smoothContinuum(binsize, nlarge, plot=False):
... | mit | Python |
f0b0e0ae3d7ce6c5014c07e58337b354f288423f | Implement find_parent() method | edgedb/edgedb,edgedb/edgedb,edgedb/edgedb | edgedb/lang/common/ast/visitor.py | edgedb/lang/common/ast/visitor.py | # Portions Copyright 2009 Sprymix Inc.
# Portions Copyright 2008 by Armin Ronacher.
# License: Python License
from semantix.ast.base import *
class NodeVisitor(object):
"""
A node visitor base class that walks the abstract syntax tree and calls a
visitor function for every node found. This function may r... | # Portions Copyright 2009 Sprymix Inc.
# Portions Copyright 2008 by Armin Ronacher.
# License: Python License
from semantix.ast.base import *
class NodeVisitor(object):
"""
A node visitor base class that walks the abstract syntax tree and calls a
visitor function for every node found. This function may r... | apache-2.0 | Python |
afbc9fea650a608472fbdf7d6e78a38133b56de7 | Tidy api tests some more | takeyourmeds/takeyourmeds-web,takeyourmeds/takeyourmeds-web,takeyourmeds/takeyourmeds-web,takeyourmeds/takeyourmeds-web | takeyourmeds/api/tests.py | takeyourmeds/api/tests.py | from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from rest_framework import status
from rest_framework.test import APITestCase
class ReminderTests(APITestCase):
def setUp(self):
self.u = User.objects.create(username='test')
self.u2 = User.objects.create(user... | from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from rest_framework import status
from rest_framework.test import APITestCase
from rest_framework.test import force_authenticate
class ReminderTests(APITestCase):
def setUp(self):
self.u = User.objects.create(username... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.