commit stringlengths 40 40 | old_file stringlengths 5 117 | new_file stringlengths 5 117 | old_contents stringlengths 0 1.93k | new_contents stringlengths 19 3.3k | subject stringlengths 17 320 | message stringlengths 18 3.28k | lang stringclasses 1
value | license stringclasses 13
values | repos stringlengths 7 42.4k | completion stringlengths 19 3.3k | prompt stringlengths 21 3.65k |
|---|---|---|---|---|---|---|---|---|---|---|---|
ac3c855583a023fc76b8720aa7e38419b28a26d4 | falcom/api/hathi.py | falcom/api/hathi.py | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
import json
def get_counts_from_item_list (items, htid):
a = len([x for x in items if x["htid"] == htid])
b = len(items) - a
ret... | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
import json
class HathiItems:
def __init__ (self):
pass
def __len__ (self):
return 0
def get_counts_from_item_list... | Refactor empty tuple into empty object with len() | Refactor empty tuple into empty object with len()
| Python | bsd-3-clause | mlibrary/image-conversion-and-validation,mlibrary/image-conversion-and-validation | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
import json
class HathiItems:
def __init__ (self):
pass
def __len__ (self):
return 0
def get_counts_from_item_list... | Refactor empty tuple into empty object with len()
# Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
import json
def get_counts_from_item_list (items, htid):
a = len([x for x in items if ... |
cdf60bc0b07c282e75fba747c8adedd165aa0abd | index.py | index.py | #!/usr/bin/env python2.7
from werkzeug.wrappers import Request, Response
from get_html import get_html, choose_lang
@Request.application
def run(request):
lang = choose_lang(request)
if request.url.startswith("https://") or request.args.get("forcenossl") == "true":
html = get_html("launch", lang)
else:
html = ... | #!/usr/bin/env python2.7
from werkzeug.wrappers import Request, Response
from get_html import get_html, choose_lang
@Request.application
def run(request):
lang = request.args.get("lang") if request.args.get("lang") else choose_lang(request)
if request.url.startswith("https://") or request.args.get("forcenossl") == ... | Make the language changeable via a GET parameter. | Make the language changeable via a GET parameter.
| Python | mit | YtvwlD/dyluna,YtvwlD/dyluna,YtvwlD/dyluna | #!/usr/bin/env python2.7
from werkzeug.wrappers import Request, Response
from get_html import get_html, choose_lang
@Request.application
def run(request):
lang = request.args.get("lang") if request.args.get("lang") else choose_lang(request)
if request.url.startswith("https://") or request.args.get("forcenossl") == ... | Make the language changeable via a GET parameter.
#!/usr/bin/env python2.7
from werkzeug.wrappers import Request, Response
from get_html import get_html, choose_lang
@Request.application
def run(request):
lang = choose_lang(request)
if request.url.startswith("https://") or request.args.get("forcenossl") == "true":... |
b08e7fd64da5342508807420e5c9aa6c3686a68e | scripts/analytics/institutions.py | scripts/analytics/institutions.py | from modularodm import Q
from website.app import init_app
from website.models import User, Node, Institution
def get_institutions():
institutions = Institution.find(Q('_id', 'ne', None))
return institutions
def get_user_count_by_institutions():
institutions = get_institutions()
user_counts = []
... | Add basic script without the ability to send the data anywhere | Add basic script without the ability to send the data anywhere
| Python | apache-2.0 | Johnetordoff/osf.io,hmoco/osf.io,laurenrevere/osf.io,mattclark/osf.io,baylee-d/osf.io,icereval/osf.io,laurenrevere/osf.io,sloria/osf.io,HalcyonChimera/osf.io,caseyrollins/osf.io,binoculars/osf.io,caseyrollins/osf.io,alexschiller/osf.io,acshi/osf.io,CenterForOpenScience/osf.io,cslzchen/osf.io,crcresearch/osf.io,felliott... | from modularodm import Q
from website.app import init_app
from website.models import User, Node, Institution
def get_institutions():
institutions = Institution.find(Q('_id', 'ne', None))
return institutions
def get_user_count_by_institutions():
institutions = get_institutions()
user_counts = []
... | Add basic script without the ability to send the data anywhere
| |
f4b50b12ae8ad4da6e04ddc186c077c31af00611 | SimpleHTTP404Server.py | SimpleHTTP404Server.py | import os
import SimpleHTTPServer
class GitHubHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
"""
Overrides the default request handler to handle GitHub custom 404 pages.
(Pretty much a 404.html page in your root.)
See https://help.github.com/articles/custom-404-pages
This currently only wor... | import os
import SimpleHTTPServer
class GitHubHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
"""
Overrides the default request handler to handle GitHub custom 404 pages.
(Pretty much a 404.html page in your root.)
See https://help.github.com/articles/custom-404-pages
This currently only wor... | Remove some print lines from the fake server. | Remove some print lines from the fake server.
| Python | mit | clokep/SimpleHTTP404Server,clokep/SimpleHTTP404Server | import os
import SimpleHTTPServer
class GitHubHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
"""
Overrides the default request handler to handle GitHub custom 404 pages.
(Pretty much a 404.html page in your root.)
See https://help.github.com/articles/custom-404-pages
This currently only wor... | Remove some print lines from the fake server.
import os
import SimpleHTTPServer
class GitHubHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
"""
Overrides the default request handler to handle GitHub custom 404 pages.
(Pretty much a 404.html page in your root.)
See https://help.github.com/article... |
78e24093f314821d7818f31574dbe521c0ae5fef | sharepa/__init__.py | sharepa/__init__.py | from sharepa.search import ShareSearch, basic_search # noqa
from sharepa.analysis import bucket_to_dataframe, merge_dataframes # noqa
| from sharepa.search import ShareSearch, basic_search # noqa
from sharepa.analysis import bucket_to_dataframe, merge_dataframes # noqa
def source_counts():
return bucket_to_dataframe(
'total_source_counts',
basic_search.execute().aggregations.sourceAgg.buckets
)
| Make it so that source_counts is only executed on purpose | Make it so that source_counts is only executed on purpose
| Python | mit | erinspace/sharepa,CenterForOpenScience/sharepa,fabianvf/sharepa,samanehsan/sharepa | from sharepa.search import ShareSearch, basic_search # noqa
from sharepa.analysis import bucket_to_dataframe, merge_dataframes # noqa
def source_counts():
return bucket_to_dataframe(
'total_source_counts',
basic_search.execute().aggregations.sourceAgg.buckets
)
| Make it so that source_counts is only executed on purpose
from sharepa.search import ShareSearch, basic_search # noqa
from sharepa.analysis import bucket_to_dataframe, merge_dataframes # noqa
|
627217b13482fff5451d3aa03867923925c49ec8 | sale_order_add_variants/__openerp__.py | sale_order_add_variants/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Hugo Santos
# Copyright 2015 FactorLibre
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Hugo Santos
# Copyright 2015 FactorLibre
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published... | Fix typo in author FactorLibre | Fix typo in author FactorLibre
| Python | agpl-3.0 | kittiu/sale-workflow,Endika/sale-workflow,alexsandrohaag/sale-workflow,xpansa/sale-workflow,diagramsoftware/sale-workflow,BT-ojossen/sale-workflow,brain-tec/sale-workflow,brain-tec/sale-workflow,luistorresm/sale-workflow,numerigraphe/sale-workflow,anybox/sale-workflow,open-synergy/sale-workflow,BT-fgarbely/sale-workflo... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Hugo Santos
# Copyright 2015 FactorLibre
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published... | Fix typo in author FactorLibre
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Hugo Santos
# Copyright 2015 FactorLibre
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General ... |
82da444753249df9bbd4c516a7b1f9f5a4a7a29a | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='yg.emanate',
use_scm_version=True,
description="Lightweight event system for Python",
author="YouGov, plc",
author_email='dev@yougov.com',
url='https://github.com/yougov/yg.emanate',
packages=[
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='yg.emanate',
use_scm_version=True,
description="Lightweight event system for Python",
author="YouGov, plc",
author_email='dev@yougov.com',
url='https://github.com/yougov/yg.emanate',
packages=[
... | Remove deprecated 'zip_safe' flag. It's probably safe anyhow. | Remove deprecated 'zip_safe' flag. It's probably safe anyhow.
| Python | mit | yougov/emanate | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='yg.emanate',
use_scm_version=True,
description="Lightweight event system for Python",
author="YouGov, plc",
author_email='dev@yougov.com',
url='https://github.com/yougov/yg.emanate',
packages=[
... | Remove deprecated 'zip_safe' flag. It's probably safe anyhow.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='yg.emanate',
use_scm_version=True,
description="Lightweight event system for Python",
author="YouGov, plc",
author_email='dev@yougov.com',
url=... |
c7611391de40d2ac296f3a8dcb1579400eac0bdf | setup.py | setup.py | import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
'pyramid_zodbconn',
'pyramid_tm',
'pyramid_debugtoolbar',
... | import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
'pyramid_zodbconn',
'pyramid_tm',
'pyramid_debugtoolbar',
... | Move requests pin to versions.cfg in buildout | Move requests pin to versions.cfg in buildout
| Python | bsd-3-clause | ucla/PushHubCore | import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
'pyramid_zodbconn',
'pyramid_tm',
'pyramid_debugtoolbar',
... | Move requests pin to versions.cfg in buildout
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
'pyramid_zodbconn',
... |
6e426e4ae0dd3841ea7d92b7434c858cf39e9ef4 | setup.py | setup.py | #!/usr/bin/env python
import os, sys, glob
from setuptools import setup, find_packages
setup(
name='aegea',
version='0.6.0',
url='https://github.com/kislyuk/aegea',
license=open('LICENSE.md').readline().strip(),
author='Andrey Kislyuk',
author_email='kislyuk@gmail.com',
description='Amazon... | #!/usr/bin/env python
import os, sys, glob, subprocess
from setuptools import setup, find_packages
try:
version = subprocess.check_output(["git", "describe", "--tags", "--match", "v*.*.*"]).strip("v\n")
except:
version = "0.0.0"
setup(
name='aegea',
version=version,
url='https://github.com/kislyu... | Use git describe output for version | Use git describe output for version
| Python | apache-2.0 | kislyuk/aegea,wholebiome/aegea,wholebiome/aegea,kislyuk/aegea,wholebiome/aegea,kislyuk/aegea | #!/usr/bin/env python
import os, sys, glob, subprocess
from setuptools import setup, find_packages
try:
version = subprocess.check_output(["git", "describe", "--tags", "--match", "v*.*.*"]).strip("v\n")
except:
version = "0.0.0"
setup(
name='aegea',
version=version,
url='https://github.com/kislyu... | Use git describe output for version
#!/usr/bin/env python
import os, sys, glob
from setuptools import setup, find_packages
setup(
name='aegea',
version='0.6.0',
url='https://github.com/kislyuk/aegea',
license=open('LICENSE.md').readline().strip(),
author='Andrey Kislyuk',
author_email='kislyu... |
7955e777d6ba3bbbd104bd3916f131ab7fa8f8b5 | asyncmongo/__init__.py | asyncmongo/__init__.py | #!/bin/env python
#
# Copyright 2010 bit.ly
#
# 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... | #!/bin/env python
#
# Copyright 2010 bit.ly
#
# 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... | Support Sort Order For TEXT Index | Support Sort Order For TEXT Index
| Python | apache-2.0 | RealGeeks/asyncmongo | #!/bin/env python
#
# Copyright 2010 bit.ly
#
# 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... | Support Sort Order For TEXT Index
#!/bin/env python
#
# Copyright 2010 bit.ly
#
# 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 r... |
dc4307a781e34bf051b20b18935d4939b2de1f8e | examples/unicode_commands.py | examples/unicode_commands.py | #!/usr/bin/env python
# coding=utf-8
"""A simple example demonstrating support for unicode command names.
"""
import math
import cmd2
class UnicodeApp(cmd2.Cmd):
"""Example cmd2 application with unicode command names."""
def __init__(self):
super().__init__()
self.intro = 'Welcome the Unicode... | #!/usr/bin/env python
# coding=utf-8
"""A simple example demonstrating support for unicode command names.
"""
import math
import cmd2
class UnicodeApp(cmd2.Cmd):
"""Example cmd2 application with unicode command names."""
def __init__(self):
super().__init__()
self.intro = 'Welcome the Unicode... | Fix flake8 error due to extra blank line in example | Fix flake8 error due to extra blank line in example
| Python | mit | python-cmd2/cmd2,python-cmd2/cmd2 | #!/usr/bin/env python
# coding=utf-8
"""A simple example demonstrating support for unicode command names.
"""
import math
import cmd2
class UnicodeApp(cmd2.Cmd):
"""Example cmd2 application with unicode command names."""
def __init__(self):
super().__init__()
self.intro = 'Welcome the Unicode... | Fix flake8 error due to extra blank line in example
#!/usr/bin/env python
# coding=utf-8
"""A simple example demonstrating support for unicode command names.
"""
import math
import cmd2
class UnicodeApp(cmd2.Cmd):
"""Example cmd2 application with unicode command names."""
def __init__(self):
super()... |
f22945907bafb189645800db1e9ca804104b06db | setup.py | setup.py | """
The setup package to install TensorPy dependencies
*> This does NOT include TensorFlow installation
*> To install TensorFlow, use "./install_tensorflow.sh"
"""
from setuptools import setup, find_packages # noqa
setup(
name='tensorpy',
version='1.0.1',
url='http://tensorpy.com',
author='Michael Mi... | """
The setup package to install TensorPy dependencies
*> This does NOT include TensorFlow installation
*> To install TensorFlow, use "./install_tensorflow.sh"
"""
from setuptools import setup, find_packages # noqa
setup(
name='tensorpy',
version='1.0.1',
url='http://tensorpy.com',
author='Michael Mi... | Update the "six" to force version 1.10.0 | Update the "six" to force version 1.10.0
| Python | mit | TensorPy/TensorPy,TensorPy/TensorPy | """
The setup package to install TensorPy dependencies
*> This does NOT include TensorFlow installation
*> To install TensorFlow, use "./install_tensorflow.sh"
"""
from setuptools import setup, find_packages # noqa
setup(
name='tensorpy',
version='1.0.1',
url='http://tensorpy.com',
author='Michael Mi... | Update the "six" to force version 1.10.0
"""
The setup package to install TensorPy dependencies
*> This does NOT include TensorFlow installation
*> To install TensorFlow, use "./install_tensorflow.sh"
"""
from setuptools import setup, find_packages # noqa
setup(
name='tensorpy',
version='1.0.1',
url='ht... |
490ce27b6e9213cd9200b6fb42e7676af58abd58 | zou/app/models/custom_action.py | zou/app/models/custom_action.py | from zou.app import db
from zou.app.models.serializer import SerializerMixin
from zou.app.models.base import BaseMixin
class CustomAction(db.Model, BaseMixin, SerializerMixin):
name = db.Column(db.String(80), nullable=False)
url = db.Column(db.String(400))
| from zou.app import db
from zou.app.models.serializer import SerializerMixin
from zou.app.models.base import BaseMixin
class CustomAction(db.Model, BaseMixin, SerializerMixin):
name = db.Column(db.String(80), nullable=False)
url = db.Column(db.String(400))
entity_type = db.Column(db.String(40), default="a... | Add entity type column to actions | Add entity type column to actions
| Python | agpl-3.0 | cgwire/zou | from zou.app import db
from zou.app.models.serializer import SerializerMixin
from zou.app.models.base import BaseMixin
class CustomAction(db.Model, BaseMixin, SerializerMixin):
name = db.Column(db.String(80), nullable=False)
url = db.Column(db.String(400))
entity_type = db.Column(db.String(40), default="a... | Add entity type column to actions
from zou.app import db
from zou.app.models.serializer import SerializerMixin
from zou.app.models.base import BaseMixin
class CustomAction(db.Model, BaseMixin, SerializerMixin):
name = db.Column(db.String(80), nullable=False)
url = db.Column(db.String(400))
|
254ef4c3a433bebd8a668f5516d2f2ac707e2943 | isUnique.py | isUnique.py | def verifyUnique(string):
if len(string) > 128:
return False
characterHash = [0] * 128
for character in string:
hashKey = ord(character)%128
if(characterHash[hashKey] > 0):
return False
else:
characterHash[hashKey] = characterHash[hashKey]+1
return... | Verify the given string has unique characters | Verify the given string has unique characters
| Python | mit | arunkumarpalaniappan/algorithm_tryouts | def verifyUnique(string):
if len(string) > 128:
return False
characterHash = [0] * 128
for character in string:
hashKey = ord(character)%128
if(characterHash[hashKey] > 0):
return False
else:
characterHash[hashKey] = characterHash[hashKey]+1
return... | Verify the given string has unique characters
| |
89d9a8a7d6eb5e982d1728433ea2a9dfbd9d1259 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
setup(name = 'i2py',
version = '0.2',
description = 'Tools to work with i2p.',
author = 'contributors.txt',
author_email = 'Anonymous',
classifiers = [
'Development Status :: 3 - Alpha',
#'Development Status :: 5 - Production/Stable',
'... | #!/usr/bin/env python
from setuptools import setup
setup(name = 'i2py',
version = '0.3',
description = 'Tools to work with i2p.',
author = 'See contributors.txt',
author_email = 'Anonymous',
classifiers = [
'Development Status :: 3 - Alpha',
#'Development Status :: 5 - Production/Stable',
... | Change version to 0.3 due to functions changing name. | Change version to 0.3 due to functions changing name.
| Python | mit | chris-barry/i2py | #!/usr/bin/env python
from setuptools import setup
setup(name = 'i2py',
version = '0.3',
description = 'Tools to work with i2p.',
author = 'See contributors.txt',
author_email = 'Anonymous',
classifiers = [
'Development Status :: 3 - Alpha',
#'Development Status :: 5 - Production/Stable',
... | Change version to 0.3 due to functions changing name.
#!/usr/bin/env python
from setuptools import setup
setup(name = 'i2py',
version = '0.2',
description = 'Tools to work with i2p.',
author = 'contributors.txt',
author_email = 'Anonymous',
classifiers = [
'Development Status :: 3 - Alpha',
... |
cdc40da26edfcb00a1da3125a925232fc947d143 | test_fractal.py | test_fractal.py | #!/usr/bin/env py.test
# -*- coding: utf-8 -*-
# Created on Fri Apr 25 02:33:04 2014
# License is MIT, see COPYING.txt for more details.
# @author: Danilo de Jesus da Silva Bellini
import os, re, pytest
from fractal import generate_fractal, call_kw, cli_parse_args
from io import BytesIO
from pylab import imread, imsav... | Test with each example image in the repository | Test with each example image in the repository
| Python | mit | danilobellini/fractals | #!/usr/bin/env py.test
# -*- coding: utf-8 -*-
# Created on Fri Apr 25 02:33:04 2014
# License is MIT, see COPYING.txt for more details.
# @author: Danilo de Jesus da Silva Bellini
import os, re, pytest
from fractal import generate_fractal, call_kw, cli_parse_args
from io import BytesIO
from pylab import imread, imsav... | Test with each example image in the repository
| |
05ba498867ff16c4221dcd758d5cdef9ee884b27 | modules/test_gitdata.py | modules/test_gitdata.py | from nose import with_setup
from nose.tools import *
import os
import sys
from gitdata import GitData
import simplejson as json
def test_fetch():
gd = GitData(repo="./treenexus")
study_id = 438
study_nexson = gd.fetch_study(study_id)
valid = 1
try:
json.loads(study_nexson)
except... | import unittest
import os
import sys
from gitdata import GitData
import simplejson as json
class TestGitData(unittest.TestCase):
def test_fetch(self):
gd = GitData(repo="./treenexus")
study_id = 438
study_nexson = gd.fetch_study(study_id)
valid = 1
try:
json.loa... | Convert GitData tests to a unittest suite | Convert GitData tests to a unittest suite
| Python | bsd-2-clause | OpenTreeOfLife/phylesystem-api,OpenTreeOfLife/phylesystem-api,OpenTreeOfLife/phylesystem-api | import unittest
import os
import sys
from gitdata import GitData
import simplejson as json
class TestGitData(unittest.TestCase):
def test_fetch(self):
gd = GitData(repo="./treenexus")
study_id = 438
study_nexson = gd.fetch_study(study_id)
valid = 1
try:
json.loa... | Convert GitData tests to a unittest suite
from nose import with_setup
from nose.tools import *
import os
import sys
from gitdata import GitData
import simplejson as json
def test_fetch():
gd = GitData(repo="./treenexus")
study_id = 438
study_nexson = gd.fetch_study(study_id)
valid = 1
try:
... |
c61b08475d82d57dae4349e1c4aa3e58fd7d8256 | src/sentry/api/serializers/models/grouptagvalue.py | src/sentry/api/serializers/models/grouptagvalue.py | from __future__ import absolute_import
from sentry.api.serializers import Serializer, register
from sentry.models import GroupTagValue
@register(GroupTagValue)
class GroupTagValueSerializer(Serializer):
def serialize(self, obj, attrs, user):
d = {
'key': obj.key,
'value': obj.valu... | from __future__ import absolute_import
from sentry.api.serializers import Serializer, register
from sentry.models import GroupTagValue, TagValue
@register(GroupTagValue)
class GroupTagValueSerializer(Serializer):
def get_attrs(self, item_list, user):
assert len(set(i.key for i in item_list)) < 2
... | Implement labels on group tag values | Implement labels on group tag values
| Python | bsd-3-clause | ngonzalvez/sentry,mvaled/sentry,daevaorn/sentry,kevinlondon/sentry,imankulov/sentry,gencer/sentry,korealerts1/sentry,Natim/sentry,felixbuenemann/sentry,JamesMura/sentry,JackDanger/sentry,fotinakis/sentry,JackDanger/sentry,jean/sentry,looker/sentry,gencer/sentry,looker/sentry,gencer/sentry,looker/sentry,ngonzalvez/sentr... | from __future__ import absolute_import
from sentry.api.serializers import Serializer, register
from sentry.models import GroupTagValue, TagValue
@register(GroupTagValue)
class GroupTagValueSerializer(Serializer):
def get_attrs(self, item_list, user):
assert len(set(i.key for i in item_list)) < 2
... | Implement labels on group tag values
from __future__ import absolute_import
from sentry.api.serializers import Serializer, register
from sentry.models import GroupTagValue
@register(GroupTagValue)
class GroupTagValueSerializer(Serializer):
def serialize(self, obj, attrs, user):
d = {
'key': ... |
6aa8f148b3b3975363d5d4a763f5abb45ea6cbd8 | databin/parsers/__init__.py | databin/parsers/__init__.py | from databin.parsers.util import ParseException
from databin.parsers.simple import parse_csv, parse_tsv
from databin.parsers.psql import parse_psql
PARSERS = [
('Comma-Separated Values', 'csv', parse_csv),
('Tab-Separated Values', 'tsv', parse_tsv),
('Excel copy & paste', 'excel', parse_tsv),
('psql Sh... | from databin.parsers.util import ParseException
from databin.parsers.simple import parse_csv, parse_tsv
from databin.parsers.psql import parse_psql
PARSERS = [
('Excel copy & paste', 'excel', parse_tsv),
('Comma-Separated Values', 'csv', parse_csv),
('Tab-Separated Values', 'tsv', parse_tsv),
('psql Sh... | Make excel format the default | Make excel format the default
| Python | mit | LeTristanB/Pastable,pudo/databin,LeTristanB/Pastable | from databin.parsers.util import ParseException
from databin.parsers.simple import parse_csv, parse_tsv
from databin.parsers.psql import parse_psql
PARSERS = [
('Excel copy & paste', 'excel', parse_tsv),
('Comma-Separated Values', 'csv', parse_csv),
('Tab-Separated Values', 'tsv', parse_tsv),
('psql Sh... | Make excel format the default
from databin.parsers.util import ParseException
from databin.parsers.simple import parse_csv, parse_tsv
from databin.parsers.psql import parse_psql
PARSERS = [
('Comma-Separated Values', 'csv', parse_csv),
('Tab-Separated Values', 'tsv', parse_tsv),
('Excel copy & paste', 'ex... |
8266b46f8710e48cf93778a90cc0c82f4f9dcbe8 | l10n_br_nfe/models/__init__.py | l10n_br_nfe/models/__init__.py | # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import res_country_state
from . import res_partner
from . import res_company
from . import product_product
from . import document_related
from . import document
from . import document_line
from . import res_city
from . import res_config_settings
f... | # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import res_country_state
from . import res_partner
from . import res_company
from . import product_product
from . import document_related
from . import document
from . import document_line
from . import res_city
from . import res_config_settings
f... | Disable import of document_cancel and document_correction | [REF] Disable import of document_cancel and document_correction
| Python | agpl-3.0 | OCA/l10n-brazil,OCA/l10n-brazil,OCA/l10n-brazil | # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import res_country_state
from . import res_partner
from . import res_company
from . import product_product
from . import document_related
from . import document
from . import document_line
from . import res_city
from . import res_config_settings
f... | [REF] Disable import of document_cancel and document_correction
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import res_country_state
from . import res_partner
from . import res_company
from . import product_product
from . import document_related
from . import document
from . import documen... |
5bc3e6a3fb112b529f738142850860dd98a9d428 | tests/runtests.py | tests/runtests.py | import glob
import os
import unittest
def build_test_suite():
suite = unittest.TestSuite()
for test_case in glob.glob('tests/test_*.py'):
modname = os.path.splitext(test_case)[0]
modname = modname.replace('/', '.')
module = __import__(modname, {}, {}, ['1'])
suite.addTest(unit... | import glob
import os
import unittest
import sys
def build_test_suite():
suite = unittest.TestSuite()
for test_case in glob.glob('tests/test_*.py'):
modname = os.path.splitext(test_case)[0]
modname = modname.replace('/', '.')
module = __import__(modname, {}, {}, ['1'])
suite.ad... | Make unittest return exit code 1 on failure | Make unittest return exit code 1 on failure
This is to allow travis to catch test failures
| Python | bsd-3-clause | jorgecarleitao/pyglet-gui | import glob
import os
import unittest
import sys
def build_test_suite():
suite = unittest.TestSuite()
for test_case in glob.glob('tests/test_*.py'):
modname = os.path.splitext(test_case)[0]
modname = modname.replace('/', '.')
module = __import__(modname, {}, {}, ['1'])
suite.ad... | Make unittest return exit code 1 on failure
This is to allow travis to catch test failures
import glob
import os
import unittest
def build_test_suite():
suite = unittest.TestSuite()
for test_case in glob.glob('tests/test_*.py'):
modname = os.path.splitext(test_case)[0]
modname = modname.rep... |
3af9e49d36aedd08d075c4aae027b7d7565d4579 | src/redisboard/views.py | src/redisboard/views.py | from django.shortcuts import render
def _get_key_details(conn, db):
conn.execute_command('SELECT', db)
keys = conn.keys()
key_details = {}
for key in keys:
details = conn.execute_command('DEBUG', 'OBJECT', key)
key_details[key] = {
'type': conn.type(key),
'detai... | from django.shortcuts import render
from django.utils.datastructures import SortedDict
def _get_key_details(conn, db):
conn.execute_command('SELECT', db)
keys = conn.keys()
key_details = {}
for key in keys:
details = conn.execute_command('DEBUG', 'OBJECT', key)
key_details[key] = {
... | Sort the database order in the inspect page. | Sort the database order in the inspect page.
| Python | bsd-2-clause | ionelmc/django-redisboard,jolks/django-redisboard,jolks/django-redisboard,artscoop/django-redisboard,artscoop/django-redisboard,ionelmc/django-redisboard,jolks/django-redisboard,artscoop/django-redisboard | from django.shortcuts import render
from django.utils.datastructures import SortedDict
def _get_key_details(conn, db):
conn.execute_command('SELECT', db)
keys = conn.keys()
key_details = {}
for key in keys:
details = conn.execute_command('DEBUG', 'OBJECT', key)
key_details[key] = {
... | Sort the database order in the inspect page.
from django.shortcuts import render
def _get_key_details(conn, db):
conn.execute_command('SELECT', db)
keys = conn.keys()
key_details = {}
for key in keys:
details = conn.execute_command('DEBUG', 'OBJECT', key)
key_details[key] = {
... |
e8506331cfa5e14029e3de4ccb16c5e0267e85b3 | manoseimas/votings/nodes.py | manoseimas/votings/nodes.py | from zope.component import adapts
from zope.component import provideAdapter
from sboard.nodes import CreateView
from sboard.nodes import DetailsView
from .forms import PolicyIssueForm
from .interfaces import IVoting
from .interfaces import IPolicyIssue
class VotingView(DetailsView):
adapts(IVoting)
templat... | from zope.component import adapts
from zope.component import provideAdapter
from sboard.nodes import CreateView
from sboard.nodes import DetailsView
from sboard.nodes import TagListView
from .forms import PolicyIssueForm
from .interfaces import IVoting
from .interfaces import IPolicyIssue
class VotingView(DetailsVi... | Use TagListView for IPolicyIssue as default view. | Use TagListView for IPolicyIssue as default view.
| Python | agpl-3.0 | ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt | from zope.component import adapts
from zope.component import provideAdapter
from sboard.nodes import CreateView
from sboard.nodes import DetailsView
from sboard.nodes import TagListView
from .forms import PolicyIssueForm
from .interfaces import IVoting
from .interfaces import IPolicyIssue
class VotingView(DetailsVi... | Use TagListView for IPolicyIssue as default view.
from zope.component import adapts
from zope.component import provideAdapter
from sboard.nodes import CreateView
from sboard.nodes import DetailsView
from .forms import PolicyIssueForm
from .interfaces import IVoting
from .interfaces import IPolicyIssue
class Voting... |
ec7bbe8ac8715ea22142680f0d880a7d0b71c687 | paws/request.py | paws/request.py | from urlparse import parse_qs
from utils import cached_property, MultiDict
class Request(object):
def __init__(self, event, context):
self.event = event
self.context = context
@property
def method(self):
return self.event['httpMethod']
@property
def query(self):
... | from Cookie import SimpleCookie
from urlparse import parse_qs
from utils import MultiDict, cached_property
class Request(object):
def __init__(self, event, context):
self.event = event
self.context = context
@property
def method(self):
return self.event['httpMethod']
@proper... | Add cookies property to Request | Add cookies property to Request
| Python | bsd-3-clause | funkybob/paws | from Cookie import SimpleCookie
from urlparse import parse_qs
from utils import MultiDict, cached_property
class Request(object):
def __init__(self, event, context):
self.event = event
self.context = context
@property
def method(self):
return self.event['httpMethod']
@proper... | Add cookies property to Request
from urlparse import parse_qs
from utils import cached_property, MultiDict
class Request(object):
def __init__(self, event, context):
self.event = event
self.context = context
@property
def method(self):
return self.event['httpMethod']
@prope... |
c31dea7bb9dc104c23cf6960f61d56af86c8dea6 | setup.py | setup.py | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
requirements = [
]
test_requirements = [
]
setup(
name='adb_android',
version='0.1.0',
description="Enables android adb in your python script",
long_description='This package can be us... | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
requirements = [
]
test_requirements = [
]
setup(
name='adb_android',
version='0.2.0',
description="Enables android adb in your python script",
long_description='This python package is... | Update package description and version | Update package description and version
| Python | bsd-3-clause | solarce/adb_android,vmalyi/adb_android | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
requirements = [
]
test_requirements = [
]
setup(
name='adb_android',
version='0.2.0',
description="Enables android adb in your python script",
long_description='This python package is... | Update package description and version
#!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
requirements = [
]
test_requirements = [
]
setup(
name='adb_android',
version='0.1.0',
description="Enables android adb in your python script",
... |
d5597911837967c1f34d1c904282f9464e38e767 | flask_controllers/GameModes.py | flask_controllers/GameModes.py | import logging
from flask import request
from flask.views import MethodView
from flask_helpers.build_response import build_response
# Import the Game Controller
from Game.GameController import GameController
class GameModes(MethodView):
def get(self):
logging.debug("GameModes: GET: Initializing GameObje... | import logging
from flask import request
from flask.views import MethodView
from flask_helpers.build_response import build_response
# Import the Game Controller
from Game.GameController import GameController
class GameModes(MethodView):
def get(self):
logging.debug("GameModes: GET: Initializing GameObje... | Update logging for message output and consistency. | Update logging for message output and consistency.
| Python | apache-2.0 | dsandersAzure/python_cowbull_server,dsandersAzure/python_cowbull_server | import logging
from flask import request
from flask.views import MethodView
from flask_helpers.build_response import build_response
# Import the Game Controller
from Game.GameController import GameController
class GameModes(MethodView):
def get(self):
logging.debug("GameModes: GET: Initializing GameObje... | Update logging for message output and consistency.
import logging
from flask import request
from flask.views import MethodView
from flask_helpers.build_response import build_response
# Import the Game Controller
from Game.GameController import GameController
class GameModes(MethodView):
def get(self):
... |
b97115679929dfe4f69618f756850617f265048f | service/pixelated/config/site.py | service/pixelated/config/site.py | from twisted.web.server import Site, Request
class AddCSPHeaderRequest(Request):
CSP_HEADER_VALUES = "default-src 'self'; style-src 'self' 'unsafe-inline'"
def process(self):
self.setHeader('Content-Security-Policy', self.CSP_HEADER_VALUES)
self.setHeader('X-Content-Security-Policy', self.CSP... | from twisted.web.server import Site, Request
class AddSecurityHeadersRequest(Request):
CSP_HEADER_VALUES = "default-src 'self'; style-src 'self' 'unsafe-inline'"
def process(self):
self.setHeader('Content-Security-Policy', self.CSP_HEADER_VALUES)
self.setHeader('X-Content-Security-Policy', se... | Rename class to match intent | Rename class to match intent
| Python | agpl-3.0 | pixelated-project/pixelated-user-agent,pixelated/pixelated-user-agent,pixelated-project/pixelated-user-agent,pixelated-project/pixelated-user-agent,pixelated-project/pixelated-user-agent,pixelated/pixelated-user-agent,pixelated-project/pixelated-user-agent,pixelated/pixelated-user-agent,pixelated/pixelated-user-agent,p... | from twisted.web.server import Site, Request
class AddSecurityHeadersRequest(Request):
CSP_HEADER_VALUES = "default-src 'self'; style-src 'self' 'unsafe-inline'"
def process(self):
self.setHeader('Content-Security-Policy', self.CSP_HEADER_VALUES)
self.setHeader('X-Content-Security-Policy', se... | Rename class to match intent
from twisted.web.server import Site, Request
class AddCSPHeaderRequest(Request):
CSP_HEADER_VALUES = "default-src 'self'; style-src 'self' 'unsafe-inline'"
def process(self):
self.setHeader('Content-Security-Policy', self.CSP_HEADER_VALUES)
self.setHeader('X-Cont... |
fd8caec8567178abe09abc810f1e96bfc4bb531b | calc.py | calc.py | import sys
def add_all(nums):
return sum(nums)
def multiply_all(nums):
return reduce(lambda a, b: a * b, nums)
if __name__== '__main__':
command = sys.argv[1]
nums = map(float, sys.argv[2:])
if command == 'add':
print(add_all(nums))
elif command == 'multiply':
print(multiply_all(sums))
| import sys
def add_all(nums):
return sum(nums)
def multiply_all(nums):
return reduce(lambda a, b: a * b, nums)
if __name__== '__main__':
command = sys.argv[1]
nums = map(float, sys.argv[2:])
if command == 'add':
print(add_all(nums))
elif command == 'multiply':
print(multiply_all(nums))
| Fix bug in 'multiply' support | Fix bug in 'multiply' support
| Python | bsd-3-clause | tanecious/calc | import sys
def add_all(nums):
return sum(nums)
def multiply_all(nums):
return reduce(lambda a, b: a * b, nums)
if __name__== '__main__':
command = sys.argv[1]
nums = map(float, sys.argv[2:])
if command == 'add':
print(add_all(nums))
elif command == 'multiply':
print(multiply_all(nums))
| Fix bug in 'multiply' support
import sys
def add_all(nums):
return sum(nums)
def multiply_all(nums):
return reduce(lambda a, b: a * b, nums)
if __name__== '__main__':
command = sys.argv[1]
nums = map(float, sys.argv[2:])
if command == 'add':
print(add_all(nums))
elif command == 'multiply':
print(multiply_... |
c15c4a663c257cad6763cf92c50b7ad706017c74 | evesrp/views/__init__.py | evesrp/views/__init__.py | from collections import OrderedDict
from urllib.parse import urlparse
import re
from flask import render_template, redirect, url_for, request, abort, jsonify,\
flash, Markup, session
from flask.views import View
from flask.ext.login import login_user, login_required, logout_user, \
current_user
from fl... | from flask import render_template
from flask.ext.login import login_required
from .. import app
@app.route('/')
@login_required
def index():
return render_template('base.html')
| Remove extraneous imports in the base view package | Remove extraneous imports in the base view package | Python | bsd-2-clause | eskwire/evesrp,eskwire/evesrp,paxswill/evesrp,eskwire/evesrp,paxswill/evesrp,paxswill/evesrp,eskwire/evesrp | from flask import render_template
from flask.ext.login import login_required
from .. import app
@app.route('/')
@login_required
def index():
return render_template('base.html')
| Remove extraneous imports in the base view package
from collections import OrderedDict
from urllib.parse import urlparse
import re
from flask import render_template, redirect, url_for, request, abort, jsonify,\
flash, Markup, session
from flask.views import View
from flask.ext.login import login_user, login_re... |
07d2742da2b75d1c23451b76447acf5ec03f41b0 | osf/management/commands/update_preprint_share_dates.py | osf/management/commands/update_preprint_share_dates.py | from __future__ import unicode_literals
import logging
from django.core.management.base import BaseCommand
from scripts import utils as script_utils
from osf.models import PreprintService
from website.preprints.tasks import on_preprint_updated
logger = logging.getLogger(__name__)
def update_share_preprint_modified_... | Add management command to update preprint share dates | Add management command to update preprint share dates
| Python | apache-2.0 | HalcyonChimera/osf.io,laurenrevere/osf.io,crcresearch/osf.io,icereval/osf.io,crcresearch/osf.io,Johnetordoff/osf.io,sloria/osf.io,HalcyonChimera/osf.io,TomBaxter/osf.io,CenterForOpenScience/osf.io,CenterForOpenScience/osf.io,binoculars/osf.io,sloria/osf.io,baylee-d/osf.io,TomBaxter/osf.io,chrisseto/osf.io,binoculars/os... | from __future__ import unicode_literals
import logging
from django.core.management.base import BaseCommand
from scripts import utils as script_utils
from osf.models import PreprintService
from website.preprints.tasks import on_preprint_updated
logger = logging.getLogger(__name__)
def update_share_preprint_modified_... | Add management command to update preprint share dates
| |
de0bbf978695d206189ee4effb124234968525cb | django_afip/views.py | django_afip/views.py | from django.http import HttpResponse
from django.utils.translation import ugettext as _
from django.views.generic import View
from .pdf import generate_receipt_pdf
class ReceiptHTMLView(View):
def get(self, request, pk):
return HttpResponse(
generate_receipt_pdf(pk, request, True),
)... | from django.http import HttpResponse
from django.utils.translation import ugettext as _
from django.views.generic import View
from .pdf import generate_receipt_pdf
class ReceiptHTMLView(View):
"""Renders a receipt as HTML."""
def get(self, request, pk):
return HttpResponse(
generate_recei... | Add a view to display PDF receipts | Add a view to display PDF receipts
Fixes #23
Closes !7
Closes !8
| Python | isc | hobarrera/django-afip,hobarrera/django-afip | from django.http import HttpResponse
from django.utils.translation import ugettext as _
from django.views.generic import View
from .pdf import generate_receipt_pdf
class ReceiptHTMLView(View):
"""Renders a receipt as HTML."""
def get(self, request, pk):
return HttpResponse(
generate_recei... | Add a view to display PDF receipts
Fixes #23
Closes !7
Closes !8
from django.http import HttpResponse
from django.utils.translation import ugettext as _
from django.views.generic import View
from .pdf import generate_receipt_pdf
class ReceiptHTMLView(View):
def get(self, request, pk):
return HttpRespo... |
6802be4498bb1143f4ce4c024a3fd82921eeb937 | setup.py | setup.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'calibre_books.settings')
setup(
name='calibre-books',
author='Adam Bogdał',
author_email='adam@bogdal.pl',
description="Calibre server in Django",
l... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'calibre_books.settings')
setup(
name='calibre-books',
author='Adam Bogdał',
author_email='adam@bogdal.pl',
description="Calibre server in Django",
l... | Use pillow instead of ordinary pil | Use pillow instead of ordinary pil
| Python | bsd-2-clause | bogdal/calibre-books,bogdal/calibre-books | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'calibre_books.settings')
setup(
name='calibre-books',
author='Adam Bogdał',
author_email='adam@bogdal.pl',
description="Calibre server in Django",
l... | Use pillow instead of ordinary pil
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'calibre_books.settings')
setup(
name='calibre-books',
author='Adam Bogdał',
author_email='adam@bogdal.pl',
descripti... |
fd32bdaa00c61d11edcf0ca60e4058e6d0b6b2d0 | backend/pycon/settings/prod.py | backend/pycon/settings/prod.py | import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from .base import * # noqa
from .base import env
SECRET_KEY = env("SECRET_KEY")
# CELERY_BROKER_URL = env("CELERY_BROKER_URL")
USE_SCHEDULER = False
# if FRONTEND_URL == "http://testfrontend.it/":
# raise ImproperlyConfigured("Please... | import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from .base import * # noqa
from .base import env
SECRET_KEY = env("SECRET_KEY")
# CELERY_BROKER_URL = env("CELERY_BROKER_URL")
USE_SCHEDULER = False
# if FRONTEND_URL == "http://testfrontend.it/":
# raise ImproperlyConfigured("Please... | Add better default for s3 region | Add better default for s3 region
| Python | mit | patrick91/pycon,patrick91/pycon | import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from .base import * # noqa
from .base import env
SECRET_KEY = env("SECRET_KEY")
# CELERY_BROKER_URL = env("CELERY_BROKER_URL")
USE_SCHEDULER = False
# if FRONTEND_URL == "http://testfrontend.it/":
# raise ImproperlyConfigured("Please... | Add better default for s3 region
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from .base import * # noqa
from .base import env
SECRET_KEY = env("SECRET_KEY")
# CELERY_BROKER_URL = env("CELERY_BROKER_URL")
USE_SCHEDULER = False
# if FRONTEND_URL == "http://testfrontend.it/":
# ... |
e78910c8b9ecf48f96a693dae3c15afa32a12da1 | casexml/apps/phone/views.py | casexml/apps/phone/views.py | from django_digest.decorators import *
from casexml.apps.phone import xml
from casexml.apps.case.models import CommCareCase
from casexml.apps.phone.restore import generate_restore_response
from casexml.apps.phone.models import User
from casexml.apps.case import const
@httpdigest
def restore(request):
user = User... | from django.http import HttpResponse
from django_digest.decorators import *
from casexml.apps.phone import xml
from casexml.apps.case.models import CommCareCase
from casexml.apps.phone.restore import generate_restore_response
from casexml.apps.phone.models import User
from casexml.apps.case import const
@httpdigest
... | Revert "moving httpresponse to view" | Revert "moving httpresponse to view"
This reverts commit a6f501bb9de6382e35372996851916adac067fa0.
| Python | bsd-3-clause | SEL-Columbia/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,di... | from django.http import HttpResponse
from django_digest.decorators import *
from casexml.apps.phone import xml
from casexml.apps.case.models import CommCareCase
from casexml.apps.phone.restore import generate_restore_response
from casexml.apps.phone.models import User
from casexml.apps.case import const
@httpdigest
... | Revert "moving httpresponse to view"
This reverts commit a6f501bb9de6382e35372996851916adac067fa0.
from django_digest.decorators import *
from casexml.apps.phone import xml
from casexml.apps.case.models import CommCareCase
from casexml.apps.phone.restore import generate_restore_response
from casexml.apps.phone.models... |
eb7ff9cec9360af0b5c18915164a54d4755e657b | mistraldashboard/dashboards/mistral/executions/tables.py | mistraldashboard/dashboards/mistral/executions/tables.py | # -*- coding: utf-8 -*-
#
# Copyright 2014 - StackStorm, 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 ... | # -*- coding: utf-8 -*-
#
# Copyright 2014 - StackStorm, 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 ... | Add Task's output and parameters columns | Add Task's output and parameters columns
Change-Id: I98f57a6a0178bb7258d82f3a165127f060f42f7b
Implements: blueprint mistral-ui
| Python | apache-2.0 | openstack/mistral-dashboard,openstack/mistral-dashboard,openstack/mistral-dashboard | # -*- coding: utf-8 -*-
#
# Copyright 2014 - StackStorm, 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 ... | Add Task's output and parameters columns
Change-Id: I98f57a6a0178bb7258d82f3a165127f060f42f7b
Implements: blueprint mistral-ui
# -*- coding: utf-8 -*-
#
# Copyright 2014 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lic... |
ee362795318507b757795e0be4c45d68c17cd28f | roll.py | roll.py | #!/usr/bin/env python
"""roll simulates rolling polyhedral dice."""
# roll.py
# Michael McMahon
from random import randrange
# Die roll function
# This function rolls polyhedral dice. Example: To roll a d8, use roll(8).
def roll(diefaces):
"""Simulate rolling polyhedral dice"""
return randrange(1, int(die... | #!/usr/bin/env python
"""roll simulates rolling polyhedral dice."""
# roll.py
# roll v1.0
# Michael McMahon
from random import randrange
# Die roll function
# This function rolls polyhedral dice. Example: To roll a d8, use roll(8).
def roll(diefaces):
"""Simulate rolling polyhedral dice"""
assert isinsta... | Add assert to prevent invalid input | Add assert to prevent invalid input
| Python | agpl-3.0 | TechnologyClassroom/dice-mechanic-sim,TechnologyClassroom/dice-mechanic-sim | #!/usr/bin/env python
"""roll simulates rolling polyhedral dice."""
# roll.py
# roll v1.0
# Michael McMahon
from random import randrange
# Die roll function
# This function rolls polyhedral dice. Example: To roll a d8, use roll(8).
def roll(diefaces):
"""Simulate rolling polyhedral dice"""
assert isinsta... | Add assert to prevent invalid input
#!/usr/bin/env python
"""roll simulates rolling polyhedral dice."""
# roll.py
# Michael McMahon
from random import randrange
# Die roll function
# This function rolls polyhedral dice. Example: To roll a d8, use roll(8).
def roll(diefaces):
"""Simulate rolling polyhedral di... |
67f3694254e08331152cd410dec128c11e965222 | daisyproducer/settings.py | daisyproducer/settings.py | from settings_common import *
PACKAGE_VERSION = "0.5"
DEBUG = TEMPLATE_DEBUG = True
DAISY_PIPELINE_PATH = os.path.join(PROJECT_DIR, '..', '..', 'tmp', 'pipeline')
EXTERNAL_PATH = os.path.join(PROJECT_DIR, '..', '..', 'tmp')
SERVE_STATIC_FILES = True
# the following is an idea from https://code.djangoproject.com/wi... | from settings_common import *
PACKAGE_VERSION = "0.5"
DEBUG = TEMPLATE_DEBUG = True
DAISY_PIPELINE_PATH = os.path.join(PROJECT_DIR, '..', '..', '..', 'tmp', 'pipeline')
EXTERNAL_PATH = os.path.join(PROJECT_DIR, '..', '..', '..', 'tmp')
SERVE_STATIC_FILES = True
# the following is an idea from https://code.djangopr... | Fix the path to external tools | Fix the path to external tools
| Python | agpl-3.0 | sbsdev/daisyproducer,sbsdev/daisyproducer,sbsdev/daisyproducer,sbsdev/daisyproducer | from settings_common import *
PACKAGE_VERSION = "0.5"
DEBUG = TEMPLATE_DEBUG = True
DAISY_PIPELINE_PATH = os.path.join(PROJECT_DIR, '..', '..', '..', 'tmp', 'pipeline')
EXTERNAL_PATH = os.path.join(PROJECT_DIR, '..', '..', '..', 'tmp')
SERVE_STATIC_FILES = True
# the following is an idea from https://code.djangopr... | Fix the path to external tools
from settings_common import *
PACKAGE_VERSION = "0.5"
DEBUG = TEMPLATE_DEBUG = True
DAISY_PIPELINE_PATH = os.path.join(PROJECT_DIR, '..', '..', 'tmp', 'pipeline')
EXTERNAL_PATH = os.path.join(PROJECT_DIR, '..', '..', 'tmp')
SERVE_STATIC_FILES = True
# the following is an idea from h... |
e7e37e9b1fd56d18711299065d6f421c1cb28bac | moksha/tests/test_feed.py | moksha/tests/test_feed.py | from tw.api import Widget
from moksha.feed import Feed
class TestFeed(object):
def test_feed_subclassing(self):
class MyFeed(Feed):
url = 'http://lewk.org/rss'
feed = MyFeed()
assert feed.url == 'http://lewk.org/rss'
assert feed.num_entries() > 0
for entry in fe... | Add some Feed test cases | Add some Feed test cases
| Python | apache-2.0 | pombredanne/moksha,lmacken/moksha,pombredanne/moksha,mokshaproject/moksha,lmacken/moksha,mokshaproject/moksha,ralphbean/moksha,pombredanne/moksha,pombredanne/moksha,ralphbean/moksha,mokshaproject/moksha,lmacken/moksha,mokshaproject/moksha,ralphbean/moksha | from tw.api import Widget
from moksha.feed import Feed
class TestFeed(object):
def test_feed_subclassing(self):
class MyFeed(Feed):
url = 'http://lewk.org/rss'
feed = MyFeed()
assert feed.url == 'http://lewk.org/rss'
assert feed.num_entries() > 0
for entry in fe... | Add some Feed test cases
| |
254403f507ea8ae075a791f24a031eaa79fc2447 | tools/dev/wc-format.py | tools/dev/wc-format.py | #!/usr/bin/env python
import os
import sqlite3
import sys
# helper
def usage():
sys.stderr.write("USAGE: %s [PATH]\n" + \
"\n" + \
"Prints to stdout the format of the working copy at PATH.\n")
# parse argv
wc = (sys.argv[1:] + ['.'])[0]
# main()
entries = os.path.join(wc, '.s... | Add a helper script, ported to Python. | Add a helper script, ported to Python.
* tools/dev/wc-format.py: New.
Prints the working copy format of a given directory.
| Python | apache-2.0 | jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion | #!/usr/bin/env python
import os
import sqlite3
import sys
# helper
def usage():
sys.stderr.write("USAGE: %s [PATH]\n" + \
"\n" + \
"Prints to stdout the format of the working copy at PATH.\n")
# parse argv
wc = (sys.argv[1:] + ['.'])[0]
# main()
entries = os.path.join(wc, '.s... | Add a helper script, ported to Python.
* tools/dev/wc-format.py: New.
Prints the working copy format of a given directory.
| |
d7ed79ec53279f0fea0881703079a1c5b82bf938 | _settings.py | _settings.py | # Configuration settings
# ID of HPO to validate (see resources/hpo.csv)
hpo_id = 'hpo_id'
# location of files to validate, evaluate
csv_dir = 'path/to/csv_files'
# sprint number being validated against
sprint_num = 0
# Submissions and logs stored here
# For more examples and requirements see http://docs.sqlalchemy... | # Configuration settings
# ID of HPO to validate (see resources/hpo.csv)
hpo_id = 'hpo_id'
# location of files to validate, evaluate
csv_dir = 'path/to/csv_files'
# sprint number being validated against
sprint_num = 0
# Submissions and logs stored here
# Note: Connecting to MSSQL from *nix may require FreeTDS confi... | Add comment regarding freetds config | Add comment regarding freetds config
| Python | mit | cumc-dbmi/pmi_sprint_reporter | # Configuration settings
# ID of HPO to validate (see resources/hpo.csv)
hpo_id = 'hpo_id'
# location of files to validate, evaluate
csv_dir = 'path/to/csv_files'
# sprint number being validated against
sprint_num = 0
# Submissions and logs stored here
# Note: Connecting to MSSQL from *nix may require FreeTDS confi... | Add comment regarding freetds config
# Configuration settings
# ID of HPO to validate (see resources/hpo.csv)
hpo_id = 'hpo_id'
# location of files to validate, evaluate
csv_dir = 'path/to/csv_files'
# sprint number being validated against
sprint_num = 0
# Submissions and logs stored here
# For more examples and r... |
6cfc94d8a03439c55808090aa5e3a4f35c288887 | menpodetect/tests/opencv_test.py | menpodetect/tests/opencv_test.py | from menpodetect.opencv import (load_opencv_frontal_face_detector,
load_opencv_eye_detector)
import menpo.io as mio
takeo = mio.import_builtin_asset.takeo_ppm()
def test_frontal_face_detector():
takeo_copy = takeo.copy()
opencv_detector = load_opencv_frontal_face_detector()
... | from numpy.testing import assert_allclose
from menpodetect.opencv import (load_opencv_frontal_face_detector,
load_opencv_eye_detector)
import menpo.io as mio
takeo = mio.import_builtin_asset.takeo_ppm()
def test_frontal_face_detector():
takeo_copy = takeo.copy()
opencv_detecto... | Use assert_allclose so we can see the appveyor failure | Use assert_allclose so we can see the appveyor failure
| Python | bsd-3-clause | yuxiang-zhou/menpodetect,jabooth/menpodetect,yuxiang-zhou/menpodetect,jabooth/menpodetect | from numpy.testing import assert_allclose
from menpodetect.opencv import (load_opencv_frontal_face_detector,
load_opencv_eye_detector)
import menpo.io as mio
takeo = mio.import_builtin_asset.takeo_ppm()
def test_frontal_face_detector():
takeo_copy = takeo.copy()
opencv_detecto... | Use assert_allclose so we can see the appveyor failure
from menpodetect.opencv import (load_opencv_frontal_face_detector,
load_opencv_eye_detector)
import menpo.io as mio
takeo = mio.import_builtin_asset.takeo_ppm()
def test_frontal_face_detector():
takeo_copy = takeo.copy()
... |
9144e6011df4aebd74db152dad2bb07a8eebf6ee | setup_egg.py | setup_egg.py | #!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Wrapper to run setup.py using setuptools."""
if __name__ == '__main__':
execfile('setup.py', dict(__name__='__main__',
__file__='setup.py', # need... | #!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Wrapper to run setup.py using setuptools."""
if __name__ == '__main__':
exec('setup.py', dict(__name__='__main__',
__file__='setup.py', # needed in se... | Use `exec` instead of `execfile`. | Use `exec` instead of `execfile`.
| Python | bsd-3-clause | FrancoisRheaultUS/dipy,FrancoisRheaultUS/dipy | #!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Wrapper to run setup.py using setuptools."""
if __name__ == '__main__':
exec('setup.py', dict(__name__='__main__',
__file__='setup.py', # needed in se... | Use `exec` instead of `execfile`.
#!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Wrapper to run setup.py using setuptools."""
if __name__ == '__main__':
execfile('setup.py', dict(__name__='__main__',
... |
d86144aa09ea0d6a679a661b0b2f887d6a2a725d | examples/python/values.py | examples/python/values.py | #! /usr/bin/env python
#
# values.py
#
"""
An example of using values via Python API
"""
from opencog.atomspace import AtomSpace, TruthValue
from opencog.type_constructors import *
a = AtomSpace()
set_type_ctor_atomspace(a)
a = FloatValue([1.0, 2.0, 3.0])
b = FloatValue([1.0, 2.0, 3.0])
c = FloatValue(1.0)
print('{}... | #! /usr/bin/env python
#
# values.py
#
"""
An example of using values via Python API
"""
from opencog.atomspace import AtomSpace, TruthValue
from opencog.type_constructors import *
a = AtomSpace()
set_type_ctor_atomspace(a)
a = FloatValue([1.0, 2.0, 3.0])
b = FloatValue([1.0, 2.0, 3.0])
c = FloatValue(1.0)
print('{}... | Add example of Value to Python list conversion | Add example of Value to Python list conversion
| Python | agpl-3.0 | rTreutlein/atomspace,AmeBel/atomspace,AmeBel/atomspace,rTreutlein/atomspace,AmeBel/atomspace,rTreutlein/atomspace,rTreutlein/atomspace,AmeBel/atomspace,AmeBel/atomspace,rTreutlein/atomspace | #! /usr/bin/env python
#
# values.py
#
"""
An example of using values via Python API
"""
from opencog.atomspace import AtomSpace, TruthValue
from opencog.type_constructors import *
a = AtomSpace()
set_type_ctor_atomspace(a)
a = FloatValue([1.0, 2.0, 3.0])
b = FloatValue([1.0, 2.0, 3.0])
c = FloatValue(1.0)
print('{}... | Add example of Value to Python list conversion
#! /usr/bin/env python
#
# values.py
#
"""
An example of using values via Python API
"""
from opencog.atomspace import AtomSpace, TruthValue
from opencog.type_constructors import *
a = AtomSpace()
set_type_ctor_atomspace(a)
a = FloatValue([1.0, 2.0, 3.0])
b = FloatValu... |
f76ccddca4864b2f2faf8dfadefa6ac15c930043 | examples/tour_examples/driverjs_maps_tour.py | examples/tour_examples/driverjs_maps_tour.py | from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_basic(self):
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
self.wait_for_element("#searchboxinput")
self.wait_for_element("#minimap")
self.wait_for_element("#zoom")
# Create a w... | Add an example tour for DriverJS | Add an example tour for DriverJS
| Python | mit | seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase | from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_basic(self):
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
self.wait_for_element("#searchboxinput")
self.wait_for_element("#minimap")
self.wait_for_element("#zoom")
# Create a w... | Add an example tour for DriverJS
| |
ad07405ca877d65f30c9acd19abb4e782d854eaa | workshops/views.py | workshops/views.py | from django.views.generic import ListView, DetailView
from config.utils import get_active_event
from workshops.models import Workshop
class WorkshopListView(ListView):
template_name = 'workshops/list_workshops.html'
model = Workshop
context_object_name = 'workshops'
def get_queryset(self):
ev... | from django.views.generic import ListView, DetailView
from config.utils import get_active_event
from workshops.models import Workshop
class WorkshopListView(ListView):
template_name = 'workshops/list_workshops.html'
model = Workshop
context_object_name = 'workshops'
def get_queryset(self):
ev... | Order workshops by start date before title | Order workshops by start date before title
| Python | bsd-3-clause | WebCampZg/conference-web,WebCampZg/conference-web,WebCampZg/conference-web | from django.views.generic import ListView, DetailView
from config.utils import get_active_event
from workshops.models import Workshop
class WorkshopListView(ListView):
template_name = 'workshops/list_workshops.html'
model = Workshop
context_object_name = 'workshops'
def get_queryset(self):
ev... | Order workshops by start date before title
from django.views.generic import ListView, DetailView
from config.utils import get_active_event
from workshops.models import Workshop
class WorkshopListView(ListView):
template_name = 'workshops/list_workshops.html'
model = Workshop
context_object_name = 'worksh... |
8f31a87ace324c519eac8d883cf0327d08f48df0 | lib/ansiblelint/rules/VariableHasSpacesRule.py | lib/ansiblelint/rules/VariableHasSpacesRule.py | # Copyright (c) 2016, Will Thames and contributors
# Copyright (c) 2018, Ansible Project
from ansiblelint import AnsibleLintRule
import re
class VariableHasSpacesRule(AnsibleLintRule):
id = '206'
shortdesc = 'Variables should have spaces before and after: {{ var_name }}'
description = 'Variables should h... | # Copyright (c) 2016, Will Thames and contributors
# Copyright (c) 2018, Ansible Project
from ansiblelint import AnsibleLintRule
import re
class VariableHasSpacesRule(AnsibleLintRule):
id = '206'
shortdesc = 'Variables should have spaces before and after: {{ var_name }}'
description = 'Variables should h... | Fix nested JSON obj false positive | var-space-rule: Fix nested JSON obj false positive
When using compact form nested JSON object within a
Jinja2 context as shown in the following example:
set_fact:"{{ {'test': {'subtest': variable}} }}"
'variable}}' will raise a false positive [206] error.
This commit adds an intermediate step within 206
(VariableH... | Python | mit | willthames/ansible-lint | # Copyright (c) 2016, Will Thames and contributors
# Copyright (c) 2018, Ansible Project
from ansiblelint import AnsibleLintRule
import re
class VariableHasSpacesRule(AnsibleLintRule):
id = '206'
shortdesc = 'Variables should have spaces before and after: {{ var_name }}'
description = 'Variables should h... | var-space-rule: Fix nested JSON obj false positive
When using compact form nested JSON object within a
Jinja2 context as shown in the following example:
set_fact:"{{ {'test': {'subtest': variable}} }}"
'variable}}' will raise a false positive [206] error.
This commit adds an intermediate step within 206
(VariableH... |
d0494a9475437e70f5f03576d9b8888aaadac458 | migrations/versions/1815829d365_.py | migrations/versions/1815829d365_.py | """empty message
Revision ID: 1815829d365
Revises: 3fcddd64a72
Create Date: 2016-02-09 17:58:47.362133
"""
# revision identifiers, used by Alembic.
revision = '1815829d365'
down_revision = '3fcddd64a72'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | Replace title_abr_idx with new unique index that includes geometry_application_reference | Replace title_abr_idx with new unique index that includes geometry_application_reference
| Python | mit | LandRegistry/system-of-record,LandRegistry/system-of-record | """empty message
Revision ID: 1815829d365
Revises: 3fcddd64a72
Create Date: 2016-02-09 17:58:47.362133
"""
# revision identifiers, used by Alembic.
revision = '1815829d365'
down_revision = '3fcddd64a72'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | Replace title_abr_idx with new unique index that includes geometry_application_reference
| |
fb08c6cfe6b6295a9aca9e579a067f34ee1c69c2 | test/get-gh-comment-info.py | test/get-gh-comment-info.py | import argparse
parser = argparse.ArgumentParser()
parser.add_argument('ghcomment', type=str) # this is for test-me-please phrases
parser.add_argument('--focus', type=str, default="")
parser.add_argument('--kernel_version', type=str, default="")
parser.add_argument('--k8s_version', type=str, default="")
parser.add_arg... | import argparse
parser = argparse.ArgumentParser()
parser.add_argument('ghcomment', type=str) # this is for test-me-please phrases
parser.add_argument('--focus', type=str, default="")
parser.add_argument('--kernel_version', type=str, default="")
parser.add_argument('--k8s_version', type=str, default="")
parser.add_arg... | Format test-only's kernel_version to avoid mistakes | test: Format test-only's kernel_version to avoid mistakes
I often try to start test-only builds with e.g.:
test-only --kernel_version=4.19 --focus="..."
That fails because our tests expect "419". We can extend the Python
script used to parse argument to recognize that and update
kernel_version to the expected fo... | Python | apache-2.0 | cilium/cilium,tklauser/cilium,tgraf/cilium,tklauser/cilium,michi-covalent/cilium,tklauser/cilium,cilium/cilium,tgraf/cilium,cilium/cilium,michi-covalent/cilium,tgraf/cilium,tgraf/cilium,michi-covalent/cilium,michi-covalent/cilium,tgraf/cilium,cilium/cilium,tklauser/cilium,michi-covalent/cilium,tklauser/cilium,cilium/ci... | import argparse
parser = argparse.ArgumentParser()
parser.add_argument('ghcomment', type=str) # this is for test-me-please phrases
parser.add_argument('--focus', type=str, default="")
parser.add_argument('--kernel_version', type=str, default="")
parser.add_argument('--k8s_version', type=str, default="")
parser.add_arg... | test: Format test-only's kernel_version to avoid mistakes
I often try to start test-only builds with e.g.:
test-only --kernel_version=4.19 --focus="..."
That fails because our tests expect "419". We can extend the Python
script used to parse argument to recognize that and update
kernel_version to the expected fo... |
a53fba0f648b3472834443fa3dc31c0611bcb6a3 | test/test_mcmc_serial.py | test/test_mcmc_serial.py | import time
import numpy as np
import yaml
import quantitation
# Set parameters
path_cfg = 'examples/basic.yml'
# Load config
cfg = yaml.load(open(path_cfg, 'rb'))
# Load data
mapping_peptides = np.loadtxt(cfg['data']['path_mapping_peptides'],
dtype=np.int)
mapping_states_obs, intensi... | Add basic test script for mcmc_serial. Code now passes with conditions on prior. | Add basic test script for mcmc_serial. Code now passes with conditions on prior.
Code runs with all prior inputs on ups2 and simulated data. However, variance
hyperparameters exhibit issues when used with improper priors on the rate
parameter. The shape and rate parameters diverge towards infinity as their ratio
(the ... | Python | bsd-3-clause | awblocker/quantitation,awblocker/quantitation,awblocker/quantitation | import time
import numpy as np
import yaml
import quantitation
# Set parameters
path_cfg = 'examples/basic.yml'
# Load config
cfg = yaml.load(open(path_cfg, 'rb'))
# Load data
mapping_peptides = np.loadtxt(cfg['data']['path_mapping_peptides'],
dtype=np.int)
mapping_states_obs, intensi... | Add basic test script for mcmc_serial. Code now passes with conditions on prior.
Code runs with all prior inputs on ups2 and simulated data. However, variance
hyperparameters exhibit issues when used with improper priors on the rate
parameter. The shape and rate parameters diverge towards infinity as their ratio
(the ... | |
d4cb09e9ffa645c97976c524a3d084172f091a16 | p560m/subarray_sum.py | p560m/subarray_sum.py | from typing import List
from collections import defaultdict
class Solution:
def subarraySum(self, nums: List[int], k: int) -> int:
sum_count = defaultdict(int)
sum_count[0] = 1
s, ans = 0, 0
for n in nums:
s += n
if s - k in sum_count:
ans +=... | from typing import List
from collections import defaultdict
class Solution:
def subarraySum(self, nums: List[int], k: int) -> int:
sum_count = defaultdict(int)
sum_count[0] = 1
s, ans = 0, 0
for n in nums:
s += n
ans += sum_count[s - k]
sum_count... | Update p560m subarray sum in Python | Update p560m subarray sum in Python
| Python | mit | l33tdaima/l33tdaima,l33tdaima/l33tdaima,l33tdaima/l33tdaima,l33tdaima/l33tdaima,l33tdaima/l33tdaima | from typing import List
from collections import defaultdict
class Solution:
def subarraySum(self, nums: List[int], k: int) -> int:
sum_count = defaultdict(int)
sum_count[0] = 1
s, ans = 0, 0
for n in nums:
s += n
ans += sum_count[s - k]
sum_count... | Update p560m subarray sum in Python
from typing import List
from collections import defaultdict
class Solution:
def subarraySum(self, nums: List[int], k: int) -> int:
sum_count = defaultdict(int)
sum_count[0] = 1
s, ans = 0, 0
for n in nums:
s += n
if s - k... |
c4f51fd3c030f3d88f8545a94698ed4e9f5ef9bc | timpani/webserver/webhelpers.py | timpani/webserver/webhelpers.py | import flask
from .. import auth
import urllib.parse
def checkForSession():
if "uid" in flask.session:
session = auth.validateSession(flask.session["uid"])
if session != None:
return session
return None
def redirectAndSave(path):
flask.session["donePage"] = urllib.parse.urlparse(flask.request.url).path
re... | import flask
from .. import auth
import urllib.parse
def checkForSession():
if "uid" in flask.session:
session = auth.validateSession(flask.session["uid"])
if session != None:
return session
return None
def redirectAndSave(path):
flask.session["donePage"] = urllib.parse.urlparse(flask.request.url).path
re... | Remove unneeded recoverFromRedirect and add markRedirectAsRecovered | Remove unneeded recoverFromRedirect and add markRedirectAsRecovered
| Python | mit | ollien/Timpani,ollien/Timpani,ollien/Timpani | import flask
from .. import auth
import urllib.parse
def checkForSession():
if "uid" in flask.session:
session = auth.validateSession(flask.session["uid"])
if session != None:
return session
return None
def redirectAndSave(path):
flask.session["donePage"] = urllib.parse.urlparse(flask.request.url).path
re... | Remove unneeded recoverFromRedirect and add markRedirectAsRecovered
import flask
from .. import auth
import urllib.parse
def checkForSession():
if "uid" in flask.session:
session = auth.validateSession(flask.session["uid"])
if session != None:
return session
return None
def redirectAndSave(path):
flask.se... |
a72a0674a6db3880ed699101be3c9c46671989f0 | xxdata_11.py | xxdata_11.py | import os
import _xxdata_11
parameters = {
'isdimd' : 200,
'iddimd' : 40,
'itdimd' : 50,
'ndptnl' : 4,
'ndptn' : 128,
'ndptnc' : 256,
'ndcnct' : 100
}
def read_scd(filename):
fd = open(filename, 'r')
fortran_filename = 'fort.%d' % fd.fileno()
os.symlink(filename, fortran_filen... | Add a primitive pythonic wrapper. | Add a primitive pythonic wrapper.
| Python | mit | cfe316/atomic,ezekial4/atomic_neu,ezekial4/atomic_neu | import os
import _xxdata_11
parameters = {
'isdimd' : 200,
'iddimd' : 40,
'itdimd' : 50,
'ndptnl' : 4,
'ndptn' : 128,
'ndptnc' : 256,
'ndcnct' : 100
}
def read_scd(filename):
fd = open(filename, 'r')
fortran_filename = 'fort.%d' % fd.fileno()
os.symlink(filename, fortran_filen... | Add a primitive pythonic wrapper.
| |
c3e2c6f77dffc2ff5874c1bb495e6de119800cf4 | rx/core/observable/merge.py | rx/core/observable/merge.py | import rx
from rx import operators as ops
from rx.core import Observable
def _merge(*args) -> Observable:
"""Merges all the observable sequences into a single observable
sequence.
1 - merged = rx.merge(xs, ys, zs)
2 - merged = rx.merge([xs, ys, zs])
Returns:
The observable sequence that... | from typing import Iterable, Union
import rx
from rx import operators as ops
from rx.core import Observable
def _merge(*args: Union[Observable, Iterable[Observable]]) -> Observable:
"""Merges all the observable sequences into a single observable
sequence.
1 - merged = rx.merge(xs, ys, zs)
2 - merge... | Fix typing and accept iterable instead of list | Fix typing and accept iterable instead of list
| Python | mit | ReactiveX/RxPY,ReactiveX/RxPY | from typing import Iterable, Union
import rx
from rx import operators as ops
from rx.core import Observable
def _merge(*args: Union[Observable, Iterable[Observable]]) -> Observable:
"""Merges all the observable sequences into a single observable
sequence.
1 - merged = rx.merge(xs, ys, zs)
2 - merge... | Fix typing and accept iterable instead of list
import rx
from rx import operators as ops
from rx.core import Observable
def _merge(*args) -> Observable:
"""Merges all the observable sequences into a single observable
sequence.
1 - merged = rx.merge(xs, ys, zs)
2 - merged = rx.merge([xs, ys, zs])
... |
037c2bc9857fc1feb59f7d4ad3cb81575177e675 | src/smsfly/versiontools.py | src/smsfly/versiontools.py | """Version tools set."""
import os
from setuptools_scm import get_version
def get_version_from_scm_tag(
*,
root='.',
relative_to=None,
local_scheme='node-and-date',
) -> str:
"""Retrieve the version from SCM tag in Git or Hg."""
try:
return get_version(
ro... | """Version tools set."""
import os
from setuptools_scm import get_version
def get_version_from_scm_tag(
*,
root='.',
relative_to=None,
local_scheme='node-and-date',
):
"""Retrieve the version from SCM tag in Git or Hg."""
try:
return get_version(
root=root... | Drop func annotations for the sake of Python 3.5 | Drop func annotations for the sake of Python 3.5
| Python | mit | wk-tech/python-smsfly | """Version tools set."""
import os
from setuptools_scm import get_version
def get_version_from_scm_tag(
*,
root='.',
relative_to=None,
local_scheme='node-and-date',
):
"""Retrieve the version from SCM tag in Git or Hg."""
try:
return get_version(
root=root... | Drop func annotations for the sake of Python 3.5
"""Version tools set."""
import os
from setuptools_scm import get_version
def get_version_from_scm_tag(
*,
root='.',
relative_to=None,
local_scheme='node-and-date',
) -> str:
"""Retrieve the version from SCM tag in Git or Hg."""
... |
16a36338fecb21fb3e9e6a15a7af1a438da48c79 | apps/jobs/migrations/0003_jobs_per_page.py | apps/jobs/migrations/0003_jobs_per_page.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('jobs', '0002_auto_20140925_1117'),
]
operations = [
migrations.AddField(
model_name='jobs',
name='pe... | Add missing `per_page` migration file. | Add missing `per_page` migration file.
| Python | mit | onespacemedia/cms-jobs,onespacemedia/cms-jobs | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('jobs', '0002_auto_20140925_1117'),
]
operations = [
migrations.AddField(
model_name='jobs',
name='pe... | Add missing `per_page` migration file.
| |
02b67810263ac5a39882a1e12a78ba28249dbc0a | webapp/config/settings/development.py | webapp/config/settings/development.py | from .base import *
DEBUG = True
# TEMPLATES[1]['DEBUG'] = True
DATABASES = {
'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, '..', 'tmp', 'db.sqlite3'),
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'compass_webapp_dev',
... | from .base import *
DEBUG = True
# TEMPLATES[1]['DEBUG'] = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'compass_webapp_dev',
'USER': 'compass_webapp',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '5432',
}... | Remove sql comments from settings file | Remove sql comments from settings file
| Python | apache-2.0 | patrickspencer/compass-python,patrickspencer/compass,patrickspencer/compass-python,patrickspencer/compass-python,patrickspencer/compass-python,patrickspencer/compass-python,patrickspencer/compass,patrickspencer/compass,patrickspencer/compass,patrickspencer/compass | from .base import *
DEBUG = True
# TEMPLATES[1]['DEBUG'] = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'compass_webapp_dev',
'USER': 'compass_webapp',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '5432',
}... | Remove sql comments from settings file
from .base import *
DEBUG = True
# TEMPLATES[1]['DEBUG'] = True
DATABASES = {
'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, '..', 'tmp', 'db.sqlite3'),
'ENGINE': 'django.db.backends.postgresql_psycopg2',
... |
ff476b33c26a9067e6ac64b2c161d29b0febea33 | py/capnptools/examples/tests/test_books.py | py/capnptools/examples/tests/test_books.py | import unittest
from examples import books
class BooksTest(unittest.TestCase):
def test_builder(self):
book = books.MallocMessageBuilder().init_root(books.Book)
book.title = 'Moby-Dick; or, The Whale'
book.authors = ['Herman Melville']
self.assertEqual(
{
... | import unittest
import os
import tempfile
from examples import books
class BooksTest(unittest.TestCase):
BOOK = {
'title': 'Moby-Dick; or, The Whale',
'authors': ['Herman Melville'],
}
def test_builder(self):
book = books.MallocMessageBuilder().init_root(books.Book)
bo... | Add unit tests for write_to and write_packed_to | Add unit tests for write_to and write_packed_to
| Python | mit | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | import unittest
import os
import tempfile
from examples import books
class BooksTest(unittest.TestCase):
BOOK = {
'title': 'Moby-Dick; or, The Whale',
'authors': ['Herman Melville'],
}
def test_builder(self):
book = books.MallocMessageBuilder().init_root(books.Book)
bo... | Add unit tests for write_to and write_packed_to
import unittest
from examples import books
class BooksTest(unittest.TestCase):
def test_builder(self):
book = books.MallocMessageBuilder().init_root(books.Book)
book.title = 'Moby-Dick; or, The Whale'
book.authors = ['Herman Melville']
... |
f9e1c2bd5976623bcebbb4b57fb011eb4d1737bc | support/appveyor-build.py | support/appveyor-build.py | #!/usr/bin/env python
# Build the project on AppVeyor.
import os
from download import Downloader
from subprocess import check_call
build = os.environ['BUILD']
cmake_command = ['cmake', '-DFMT_EXTRA_TESTS=ON', '-DCMAKE_BUILD_TYPE=' + os.environ['CONFIG']]
build_command = ['msbuild', '/m:4', '/p:Config=' + os.environ['... | #!/usr/bin/env python
# Build the project on AppVeyor.
import os
from subprocess import check_call
build = os.environ['BUILD']
config = os.environ['CONFIG']
cmake_command = ['cmake', '-DFMT_EXTRA_TESTS=ON', '-DCMAKE_BUILD_TYPE=' + config]
if build == 'mingw':
cmake_command.append('-GMinGW Makefiles')
build_comman... | Use preinstalled mingw on appveyor | Use preinstalled mingw on appveyor | Python | bsd-2-clause | lightslife/cppformat,blaquee/cppformat,mojoBrendan/fmt,alabuzhev/fmt,alabuzhev/fmt,wangshijin/cppformat,nelson4722/cppformat,cppformat/cppformat,cppformat/cppformat,alabuzhev/fmt,blaquee/cppformat,wangshijin/cppformat,Jopie64/cppformat,nelson4722/cppformat,lightslife/cppformat,cppformat/cppformat,seungrye/cppformat,Jop... | #!/usr/bin/env python
# Build the project on AppVeyor.
import os
from subprocess import check_call
build = os.environ['BUILD']
config = os.environ['CONFIG']
cmake_command = ['cmake', '-DFMT_EXTRA_TESTS=ON', '-DCMAKE_BUILD_TYPE=' + config]
if build == 'mingw':
cmake_command.append('-GMinGW Makefiles')
build_comman... | Use preinstalled mingw on appveyor
#!/usr/bin/env python
# Build the project on AppVeyor.
import os
from download import Downloader
from subprocess import check_call
build = os.environ['BUILD']
cmake_command = ['cmake', '-DFMT_EXTRA_TESTS=ON', '-DCMAKE_BUILD_TYPE=' + os.environ['CONFIG']]
build_command = ['msbuild', ... |
d190a376442dd5e9516b7bef802369a5fe318f03 | find_primes.py | find_primes.py | #!/usr/bin/env python2
def find_primes(limit):
primes = []
for candidate in range(2, limit + 1):
candidate_ok = True
for divisor in range(2, candidate):
if candidate % divisor == 0:
candidate_ok = False
break
if candidate_ok:
pr... | Implement the 'trial division' algorithm. | Implement the 'trial division' algorithm.
| Python | mit | ipqb/bootcamp-primes-activity | #!/usr/bin/env python2
def find_primes(limit):
primes = []
for candidate in range(2, limit + 1):
candidate_ok = True
for divisor in range(2, candidate):
if candidate % divisor == 0:
candidate_ok = False
break
if candidate_ok:
pr... | Implement the 'trial division' algorithm.
| |
a3638f641098b1e713492d1a5fd832c8f9c3da5d | resolwe/flow/migrations/0005_duplicate_data_dependency.py | resolwe/flow/migrations/0005_duplicate_data_dependency.py | # Generated by Django 3.1.7 on 2021-10-12 10:39
from django.db import migrations, models
def create_duplicate_dependencies(apps, schema_editor):
Data = apps.get_model("flow", "Data")
DataDependency = apps.get_model("flow", "DataDependency")
duplicates = Data.objects.filter(duplicated__isnull=False)
du... | Add missing DataDependency objects for duplicates | Add missing DataDependency objects for duplicates
| Python | apache-2.0 | genialis/resolwe,genialis/resolwe | # Generated by Django 3.1.7 on 2021-10-12 10:39
from django.db import migrations, models
def create_duplicate_dependencies(apps, schema_editor):
Data = apps.get_model("flow", "Data")
DataDependency = apps.get_model("flow", "DataDependency")
duplicates = Data.objects.filter(duplicated__isnull=False)
du... | Add missing DataDependency objects for duplicates
| |
60951f30d8b5e2a450c13aa2b146be14ceb53c4d | rolldembones.py | rolldembones.py | #!/usr/bin/python
import argparse
import dice
def main():
roller = dice.Roller(args)
for repeat in range(args.repeats):
roller.do_roll()
for result in roller:
if isinstance(result, list):
print(' '.join(map(str, result)))
else:
... | #!/usr/bin/python3
import argparse
import dice
def main():
roller = dice.Roller(args)
for repeat in range(args.repeats):
roller.do_roll()
for result in roller:
if isinstance(result, list):
print(' '.join(map(str, result)))
else:
... | Update shebang to request python 3 | Update shebang to request python 3
| Python | mit | aurule/rolldembones | #!/usr/bin/python3
import argparse
import dice
def main():
roller = dice.Roller(args)
for repeat in range(args.repeats):
roller.do_roll()
for result in roller:
if isinstance(result, list):
print(' '.join(map(str, result)))
else:
... | Update shebang to request python 3
#!/usr/bin/python
import argparse
import dice
def main():
roller = dice.Roller(args)
for repeat in range(args.repeats):
roller.do_roll()
for result in roller:
if isinstance(result, list):
print(' '.join(map(str, result)... |
8a2979ae72bcd691521e2694c974219edfe5dc3b | altair/examples/top_k_with_others.py | altair/examples/top_k_with_others.py | """
Top-K plot with Others
----------------------
This example shows how to use aggregate, window, and calculate transfromations
to display the top-k directors by average worldwide gross while grouping the
remaining directors as 'All Others'.
"""
# category: case studies
import altair as alt
from vega_datasets import ... | Add example for Top-K with Others. | DOC: Add example for Top-K with Others.
| Python | bsd-3-clause | altair-viz/altair,jakevdp/altair | """
Top-K plot with Others
----------------------
This example shows how to use aggregate, window, and calculate transfromations
to display the top-k directors by average worldwide gross while grouping the
remaining directors as 'All Others'.
"""
# category: case studies
import altair as alt
from vega_datasets import ... | DOC: Add example for Top-K with Others.
| |
ab14f4c86fca6daab9d67cc9b4c3581d76d5635a | foster/utils.py | foster/utils.py | import os.path
import shutil
from string import Template
PIKE_DIR = os.path.dirname(__file__)
SAMPLES_DIR = os.path.join(PIKE_DIR, 'samples')
def sample_path(sample):
path = os.path.join(SAMPLES_DIR, sample)
return os.path.realpath(path)
def copy_sample(sample, target):
source = os.path.join(SAMPLES_DIR... | import os.path
import shutil
from string import Template
PIKE_DIR = os.path.dirname(__file__)
SAMPLES_DIR = os.path.join(PIKE_DIR, 'samples')
def sample_path(sample):
path = os.path.join(SAMPLES_DIR, sample)
return os.path.realpath(path)
def copy_sample(sample, target):
source = os.path.join(SAMPLES_D... | Fix whitespace in foster/util.py to better comply with PEP8 | Fix whitespace in foster/util.py to better comply with PEP8
| Python | mit | hugollm/foster,hugollm/foster | import os.path
import shutil
from string import Template
PIKE_DIR = os.path.dirname(__file__)
SAMPLES_DIR = os.path.join(PIKE_DIR, 'samples')
def sample_path(sample):
path = os.path.join(SAMPLES_DIR, sample)
return os.path.realpath(path)
def copy_sample(sample, target):
source = os.path.join(SAMPLES_D... | Fix whitespace in foster/util.py to better comply with PEP8
import os.path
import shutil
from string import Template
PIKE_DIR = os.path.dirname(__file__)
SAMPLES_DIR = os.path.join(PIKE_DIR, 'samples')
def sample_path(sample):
path = os.path.join(SAMPLES_DIR, sample)
return os.path.realpath(path)
def copy_... |
84b31bb02746dec1667cc93a189c6e1c40ffac28 | studygroups/migrations/0015_auto_20150430_0126.py | studygroups/migrations/0015_auto_20150430_0126.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('studygroups', '0014_application_accepted_at'),
]
operations = [
migrations.AlterUniqueTogether(
name='studygroup... | Remove unique requirement for study group applications | Remove unique requirement for study group applications
| Python | mit | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('studygroups', '0014_application_accepted_at'),
]
operations = [
migrations.AlterUniqueTogether(
name='studygroup... | Remove unique requirement for study group applications
| |
5041862eafcd4b8799f8ab97c25df7d494d6c2ad | blockbuster/bb_logging.py | blockbuster/bb_logging.py | import config
import logging
import logging.handlers
# ######### Set up logging ##########
# log.basicConfig(format="%(asctime)s - %(levelname)s: %(message)s", level=log.DEBUG)
logger = logging.getLogger("blockbuster")
logger.setLevel(logging.DEBUG)
# create file handler which logs even debug messages
tfh = logging.... | import config
import logging
import logging.handlers
# ######### Set up logging ##########
# log.basicConfig(format="%(asctime)s - %(levelname)s: %(message)s", level=log.DEBUG)
logger = logging.getLogger("blockbuster")
logger.setLevel(logging.DEBUG)
# create file handler which logs even debug messages
tfh = logging.... | Change format of log lines | Change format of log lines
| Python | mit | mattstibbs/blockbuster-server,mattstibbs/blockbuster-server | import config
import logging
import logging.handlers
# ######### Set up logging ##########
# log.basicConfig(format="%(asctime)s - %(levelname)s: %(message)s", level=log.DEBUG)
logger = logging.getLogger("blockbuster")
logger.setLevel(logging.DEBUG)
# create file handler which logs even debug messages
tfh = logging.... | Change format of log lines
import config
import logging
import logging.handlers
# ######### Set up logging ##########
# log.basicConfig(format="%(asctime)s - %(levelname)s: %(message)s", level=log.DEBUG)
logger = logging.getLogger("blockbuster")
logger.setLevel(logging.DEBUG)
# create file handler which logs even d... |
34a3bf209c1bb09e2057eb4dd91ef426e3107c11 | monitor_temperature.py | monitor_temperature.py | import time
import serial
import matplotlib.pyplot as plt
import csv
import os
import brewkettle
reload(brewkettle)
filename = time.strftime("%Y-%m-%d %H:%M") + ".csv"
path = os.path.join("data", filename)
f = open(path, "w")
csv_writer = csv.writer(f)
kettle = brewkettle.BrewKettle()
kettle.turn_pump_on()
start = t... | import time
import serial
import matplotlib.pyplot as plt
import csv
import os
import brewkettle
reload(brewkettle)
filename = time.strftime("%Y-%m-%d %H:%M") + ".csv"
path = os.path.join("data", filename)
f = open(path, "w")
csv_writer = csv.writer(f)
csv_writer.writerow(["Time [s]", "Temperature [C]"])
kettle = bre... | Monitor temperature script as used for heating measurement | Monitor temperature script as used for heating measurement
| Python | mit | beercanlah/ardumashtun,beercanlah/ardumashtun | import time
import serial
import matplotlib.pyplot as plt
import csv
import os
import brewkettle
reload(brewkettle)
filename = time.strftime("%Y-%m-%d %H:%M") + ".csv"
path = os.path.join("data", filename)
f = open(path, "w")
csv_writer = csv.writer(f)
csv_writer.writerow(["Time [s]", "Temperature [C]"])
kettle = bre... | Monitor temperature script as used for heating measurement
import time
import serial
import matplotlib.pyplot as plt
import csv
import os
import brewkettle
reload(brewkettle)
filename = time.strftime("%Y-%m-%d %H:%M") + ".csv"
path = os.path.join("data", filename)
f = open(path, "w")
csv_writer = csv.writer(f)
kettl... |
2758c1086e06a77f9676d678a3d41a53a352ec01 | testfixtures/seating.py | testfixtures/seating.py | # -*- coding: utf-8 -*-
"""
testfixtures.seating
~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2016 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from byceps.services.seating.models.seat_group import SeatGroup
def create_seat_group(party_id, seat_category, title, *, seat_quantity=4):
return... | # -*- coding: utf-8 -*-
"""
testfixtures.seating
~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2016 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from byceps.services.seating.models.category import Category
from byceps.services.seating.models.seat_group import SeatGroup
def create_seat_category... | Add function to create a seat category test fixture | Add function to create a seat category test fixture
| Python | bsd-3-clause | m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps | # -*- coding: utf-8 -*-
"""
testfixtures.seating
~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2016 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from byceps.services.seating.models.category import Category
from byceps.services.seating.models.seat_group import SeatGroup
def create_seat_category... | Add function to create a seat category test fixture
# -*- coding: utf-8 -*-
"""
testfixtures.seating
~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2016 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from byceps.services.seating.models.seat_group import SeatGroup
def create_seat_group(party_id, ... |
55a8921f3634fe842eddf202d1237f53ca6d003b | kobo/settings/dev.py | kobo/settings/dev.py | # coding: utf-8
from .base import *
LOGGING['handlers']['console'] = {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
}
INSTALLED_APPS = INSTALLED_APPS + ('debug_toolbar',)
MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware')
# Comment out the line below to use... | # coding: utf-8
from .base import *
LOGGING['handlers']['console'] = {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
}
INSTALLED_APPS = INSTALLED_APPS + ('debug_toolbar',)
MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware')
def show_toolbar(request):
retu... | Enable django debug toolbar via env var | Enable django debug toolbar via env var
| Python | agpl-3.0 | kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi | # coding: utf-8
from .base import *
LOGGING['handlers']['console'] = {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
}
INSTALLED_APPS = INSTALLED_APPS + ('debug_toolbar',)
MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware')
def show_toolbar(request):
retu... | Enable django debug toolbar via env var
# coding: utf-8
from .base import *
LOGGING['handlers']['console'] = {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
}
INSTALLED_APPS = INSTALLED_APPS + ('debug_toolbar',)
MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddlewa... |
b000fc19657b80c46ca9c2d7e6dfdaa16e4d400f | scripts/slave/apply_svn_patch.py | scripts/slave/apply_svn_patch.py | #!/usr/bin/python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import optparse
import subprocess
import sys
def main():
parser = optparse.OptionParser()
parser.add_option('-p', '--patch-url',
... | Add a script which can apply a try job SVN patch via an annotated step. | Add a script which can apply a try job SVN patch via an annotated step.
Review URL: https://chromiumcodereview.appspot.com/24688002
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@225287 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build | #!/usr/bin/python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import optparse
import subprocess
import sys
def main():
parser = optparse.OptionParser()
parser.add_option('-p', '--patch-url',
... | Add a script which can apply a try job SVN patch via an annotated step.
Review URL: https://chromiumcodereview.appspot.com/24688002
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@225287 0039d316-1c4b-4281-b951-d872f2087c98
| |
3681b5a485662656d6419d95ad89f1fbdb7a2a50 | myuw/context_processors.py | myuw/context_processors.py | # Determins if the requesting device is a native hybrid app (android/ios)
def is_hybrid(request):
return {
'is_hybrid': 'HTTP_MYUW_HYBRID' in request.META
}
| # Determins if the requesting device is a native hybrid app (android/ios)
def is_hybrid(request):
return {
'is_hybrid': 'MyUW_Hybrid/1.0' in request.META['HTTP_USER_AGENT']
}
| Update context processer to check for custom hybrid user agent. | Update context processer to check for custom hybrid user agent.
| Python | apache-2.0 | uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw | # Determins if the requesting device is a native hybrid app (android/ios)
def is_hybrid(request):
return {
'is_hybrid': 'MyUW_Hybrid/1.0' in request.META['HTTP_USER_AGENT']
}
| Update context processer to check for custom hybrid user agent.
# Determins if the requesting device is a native hybrid app (android/ios)
def is_hybrid(request):
return {
'is_hybrid': 'HTTP_MYUW_HYBRID' in request.META
}
|
1a16d598c902218a8112841219f89044724155da | smatic/templatetags/smatic_tags.py | smatic/templatetags/smatic_tags.py | import os
from commands import getstatusoutput
from django import template
from django.conf import settings
from django.utils._os import safe_join
register = template.Library()
def scss(file_path):
"""
Converts an scss file into css and returns the output
"""
input_path = safe_join(settings.SMATIC... | import os
from commands import getstatusoutput
from django import template
from django.conf import settings
from django.utils._os import safe_join
register = template.Library()
@register.simple_tag
def scss(file_path):
"""
Convert an scss file into css and returns the output.
"""
input_path = safe_jo... | Tidy up the code, and don't make settings.SASS_BIN a requirement (default to 'sass') | Tidy up the code, and don't make settings.SASS_BIN a requirement (default to 'sass')
| Python | bsd-3-clause | lincolnloop/django-smatic | import os
from commands import getstatusoutput
from django import template
from django.conf import settings
from django.utils._os import safe_join
register = template.Library()
@register.simple_tag
def scss(file_path):
"""
Convert an scss file into css and returns the output.
"""
input_path = safe_jo... | Tidy up the code, and don't make settings.SASS_BIN a requirement (default to 'sass')
import os
from commands import getstatusoutput
from django import template
from django.conf import settings
from django.utils._os import safe_join
register = template.Library()
def scss(file_path):
"""
Converts an scss f... |
2306478f67a93e27dd9d7d397f97e3641df3516a | ipython_startup.py | ipython_startup.py | import scipy as sp
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
| from __future__ import division
from __future__ import absolute_import
import scipy as sp
import itertools as it
import functools as ft
import operator as op
import sys
import sympy
# Plotting
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.pyplot import subplots
from matplotl... | Add lots of useful default imports to ipython | Add lots of useful default imports to ipython
| Python | cc0-1.0 | davidshepherd7/dotfiles,davidshepherd7/dotfiles,davidshepherd7/dotfiles,davidshepherd7/dotfiles,davidshepherd7/dotfiles | from __future__ import division
from __future__ import absolute_import
import scipy as sp
import itertools as it
import functools as ft
import operator as op
import sys
import sympy
# Plotting
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.pyplot import subplots
from matplotl... | Add lots of useful default imports to ipython
import scipy as sp
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
|
5b2de46ac3c21278f1ab2c7620d3f31dc7d98530 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
version = '0.6.0.dev'
required = open('requirements.txt').read().split('\n')
extra = {'all': ['mist', 'rime']}
setup(
name='thunder-python',
version=version,
description='large-scale image and time series analysis',
author='freeman-lab',
author_... | #!/usr/bin/env python
from setuptools import setup
version = '0.6.0.dev'
required = open('requirements.txt').read().split('\n')
extra = {'all': ['mist', 'rime']}
setup(
name='thunder-python',
version=version,
description='large-scale image and time series analysis',
author='freeman-lab',
author_... | Fix name for extra arguments | Fix name for extra arguments
| Python | apache-2.0 | thunder-project/thunder,jwittenbach/thunder,j-friedrich/thunder,j-friedrich/thunder | #!/usr/bin/env python
from setuptools import setup
version = '0.6.0.dev'
required = open('requirements.txt').read().split('\n')
extra = {'all': ['mist', 'rime']}
setup(
name='thunder-python',
version=version,
description='large-scale image and time series analysis',
author='freeman-lab',
author_... | Fix name for extra arguments
#!/usr/bin/env python
from setuptools import setup
version = '0.6.0.dev'
required = open('requirements.txt').read().split('\n')
extra = {'all': ['mist', 'rime']}
setup(
name='thunder-python',
version=version,
description='large-scale image and time series analysis',
aut... |
5fb38bfb6eae77b7024bf4d9990472f60d576826 | setup.py | setup.py | import pathlib
from crc import LIBRARY_VERSION
from setuptools import setup
current = pathlib.Path(__file__).parent.resolve()
def readme():
return (current / 'README.md').read_text(encoding='utf-8')
if __name__ == '__main__':
setup(
name='crc',
version=LIBRARY_VERSION,
py_modules=['... | import pathlib
from crc import LIBRARY_VERSION
from setuptools import setup
current = pathlib.Path(__file__).parent.resolve()
def readme():
return (current / 'README.md').read_text(encoding='utf-8')
if __name__ == '__main__':
setup(
name='crc',
version=LIBRARY_VERSION,
py_modules=['... | Update package information about supported python versions | Update package information about supported python versions
| Python | bsd-2-clause | Nicoretti/crc | import pathlib
from crc import LIBRARY_VERSION
from setuptools import setup
current = pathlib.Path(__file__).parent.resolve()
def readme():
return (current / 'README.md').read_text(encoding='utf-8')
if __name__ == '__main__':
setup(
name='crc',
version=LIBRARY_VERSION,
py_modules=['... | Update package information about supported python versions
import pathlib
from crc import LIBRARY_VERSION
from setuptools import setup
current = pathlib.Path(__file__).parent.resolve()
def readme():
return (current / 'README.md').read_text(encoding='utf-8')
if __name__ == '__main__':
setup(
name='... |
058b484b997158219b9c0eda34ec6ac3d897f563 | setup.py | setup.py | import os
import json
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md'), encoding="utf-8") as f:
readme = f.read()
with open(os.path.join(os.path.dirname(__file__), 'package.json'), encoding="utf-8") as f:
package = json.loads(f.read())
setup(
name=package['name'... | import os
import io
import json
from setuptools import setup
with io.open(os.path.join(os.path.dirname(__file__), 'README.md'), encoding="utf-8") as f:
readme = f.read()
with io.open(os.path.join(os.path.dirname(__file__), 'package.json'), encoding="utf-8") as f:
package = json.loads(f.read())
setup(
nam... | Use io.open for py2/py3 compat | Use io.open for py2/py3 compat
| Python | mit | bradleyg/django-s3direct,bradleyg/django-s3direct,bradleyg/django-s3direct | import os
import io
import json
from setuptools import setup
with io.open(os.path.join(os.path.dirname(__file__), 'README.md'), encoding="utf-8") as f:
readme = f.read()
with io.open(os.path.join(os.path.dirname(__file__), 'package.json'), encoding="utf-8") as f:
package = json.loads(f.read())
setup(
nam... | Use io.open for py2/py3 compat
import os
import json
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md'), encoding="utf-8") as f:
readme = f.read()
with open(os.path.join(os.path.dirname(__file__), 'package.json'), encoding="utf-8") as f:
package = json.loads(f.read())... |
1869b79d49419799cecf1f5e19eb0aa3987e215b | tests/test_vector2_scalar_multiplication.py | tests/test_vector2_scalar_multiplication.py | import pytest # type: ignore
from ppb_vector import Vector2
@pytest.mark.parametrize("x, y, expected", [
(Vector2(6, 1), 0, Vector2(0, 0)),
(Vector2(6, 1), 2, Vector2(12, 2)),
(Vector2(0, 0), 3, Vector2(0, 0)),
(Vector2(-1.5, 2.4), -2, Vector2(3.0, -4.8)),
(Vector2(1, 2), 0.1, Vector2(0.1, 0.2))
... | import pytest # type: ignore
from hypothesis import given
from hypothesis.strategies import floats
from utils import vectors
from ppb_vector import Vector2
@pytest.mark.parametrize("x, y, expected", [
(Vector2(6, 1), 0, Vector2(0, 0)),
(Vector2(6, 1), 2, Vector2(12, 2)),
(Vector2(0, 0), 3, Vector2(0, 0))... | Add a test of the associativity of scalar multiplication | Add a test of the associativity of scalar multiplication
| Python | artistic-2.0 | ppb/ppb-vector,ppb/ppb-vector | import pytest # type: ignore
from hypothesis import given
from hypothesis.strategies import floats
from utils import vectors
from ppb_vector import Vector2
@pytest.mark.parametrize("x, y, expected", [
(Vector2(6, 1), 0, Vector2(0, 0)),
(Vector2(6, 1), 2, Vector2(12, 2)),
(Vector2(0, 0), 3, Vector2(0, 0))... | Add a test of the associativity of scalar multiplication
import pytest # type: ignore
from ppb_vector import Vector2
@pytest.mark.parametrize("x, y, expected", [
(Vector2(6, 1), 0, Vector2(0, 0)),
(Vector2(6, 1), 2, Vector2(12, 2)),
(Vector2(0, 0), 3, Vector2(0, 0)),
(Vector2(-1.5, 2.4), -2, Vector2... |
5b0f7412f88400e61a05e694d4883389d812f3d2 | tests/runtests.py | tests/runtests.py | #!/usr/bin/env python
import os
import sys
from unittest import defaultTestLoader, TextTestRunner, TestSuite
TESTS = ('form', 'fields', 'validators', 'widgets', 'webob_wrapper', 'translations', 'ext_csrf', 'ext_i18n')
def make_suite(prefix='', extra=()):
tests = TESTS + extra
test_names = list(prefix + x for ... | #!/usr/bin/env python
import os
import sys
from unittest import defaultTestLoader, TextTestRunner, TestSuite
TESTS = ('form', 'fields', 'validators', 'widgets', 'webob_wrapper', 'translations', 'ext_csrf', 'ext_i18n')
def make_suite(prefix='', extra=()):
tests = TESTS + extra
test_names = list(prefix + x for ... | Add back in running of extra tests | Add back in running of extra tests
| Python | bsd-3-clause | maxcountryman/wtforms | #!/usr/bin/env python
import os
import sys
from unittest import defaultTestLoader, TextTestRunner, TestSuite
TESTS = ('form', 'fields', 'validators', 'widgets', 'webob_wrapper', 'translations', 'ext_csrf', 'ext_i18n')
def make_suite(prefix='', extra=()):
tests = TESTS + extra
test_names = list(prefix + x for ... | Add back in running of extra tests
#!/usr/bin/env python
import os
import sys
from unittest import defaultTestLoader, TextTestRunner, TestSuite
TESTS = ('form', 'fields', 'validators', 'widgets', 'webob_wrapper', 'translations', 'ext_csrf', 'ext_i18n')
def make_suite(prefix='', extra=()):
tests = TESTS + extra
... |
15c7cc3cf1599efa65896e7138f3015e68ae5998 | setup.py | setup.py | #!/usr/bin/env python
import sys
from setuptools import setup, find_packages
requires = ['six']
if sys.version_info[0] == 2:
requires += ['python-dateutil>=1.0, <2.0, >=2.1']
else:
# Py3k
requires += ['python-dateutil>=2.0']
setup(
name='freezegun',
version='0.2.2',
description='Let your Pyt... | #!/usr/bin/env python
import sys
from setuptools import setup, find_packages
requires = ['six']
if sys.version_info[0] == 2:
requires += ['python-dateutil>=1.0, != 2.0']
else:
# Py3k
requires += ['python-dateutil>=2.0']
setup(
name='freezegun',
version='0.2.2',
description='Let your Python t... | Use a saner requirements for python-dateutil | Use a saner requirements for python-dateutil
The requirement >=1.0, <2.0, >=2.1 doesn't make a lot of logical sense and it
will break in the future. There is no version that is >= 1.0, and < 2.0, and
>= 2.1 becasue these versions are mutually exclusive. Even if you interpret
the , as OR it still doesn't make sense ... | Python | apache-2.0 | spulec/freezegun,Affirm/freezegun,adamchainz/freezegun,Sun77789/freezegun | #!/usr/bin/env python
import sys
from setuptools import setup, find_packages
requires = ['six']
if sys.version_info[0] == 2:
requires += ['python-dateutil>=1.0, != 2.0']
else:
# Py3k
requires += ['python-dateutil>=2.0']
setup(
name='freezegun',
version='0.2.2',
description='Let your Python t... | Use a saner requirements for python-dateutil
The requirement >=1.0, <2.0, >=2.1 doesn't make a lot of logical sense and it
will break in the future. There is no version that is >= 1.0, and < 2.0, and
>= 2.1 becasue these versions are mutually exclusive. Even if you interpret
the , as OR it still doesn't make sense ... |
0ef968528f31da5dd09f016134b4a1ffa6377f84 | scripts/slave/chromium/package_source.py | scripts/slave/chromium/package_source.py | #!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A tool to package a checkout's source and upload it to Google Storage."""
import sys
if '__main__' == __name__:
sys.exit(0)
| #!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A tool to package a checkout's source and upload it to Google Storage."""
import os
import sys
from common import chromium_utils
... | Create source snapshot and upload to GS. | Create source snapshot and upload to GS.
BUG=79198
Review URL: http://codereview.chromium.org/7129020
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@88372 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build | #!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A tool to package a checkout's source and upload it to Google Storage."""
import os
import sys
from common import chromium_utils
... | Create source snapshot and upload to GS.
BUG=79198
Review URL: http://codereview.chromium.org/7129020
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@88372 0039d316-1c4b-4281-b951-d872f2087c98
#!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governe... |
a42a6a54f732ca7eba700b867a3025739ad6a271 | list_all_users_in_group.py | list_all_users_in_group.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import grp
import pwd
import inspect
import argparse
def list_all_users_in_group(groupname):
"""Get list of all users of group.
Get sorted list of all users of group GROUP,
including users with main group GROUP.
Ori... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import grp
import pwd
import inspect
import argparse
def list_all_users_in_group(groupname):
"""Get list of all users of group.
Get sorted list of all users of group GROUP,
including users with main group GROUP.
Ori... | Move main code to function because of pylint warning 'Invalid constant name' | Move main code to function because of pylint warning 'Invalid constant name'
| Python | cc0-1.0 | vazhnov/list_all_users_in_group | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import grp
import pwd
import inspect
import argparse
def list_all_users_in_group(groupname):
"""Get list of all users of group.
Get sorted list of all users of group GROUP,
including users with main group GROUP.
Ori... | Move main code to function because of pylint warning 'Invalid constant name'
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import grp
import pwd
import inspect
import argparse
def list_all_users_in_group(groupname):
"""Get list of all users of group.
Get sorted list o... |
bb7741ade270458564ea7546d372e39bbbe0f97d | rds/delete_db_instance.py | rds/delete_db_instance.py | #!/usr/bin/env python
# a script to delete an rds instance
# import the sys and boto3 libraries
import sys
import boto3
# create an rds client
rds = boto3.client('rds')
# use the first argument to the script as the name
# of the instance to be deleted
db = sys.argv[1]
try:
# delete the instance and catch the re... | #!/usr/bin/env python
# a script to delete an rds instance
# import the sys and boto3 libraries
import sys
import boto3
# use the first argument to the script as the name
# of the instance to be deleted
db = sys.argv[1]
# create an rds client
rds = boto3.client('rds')
try:
# delete the instance and catch the re... | Swap db and rds set up | Swap db and rds set up
| Python | mit | managedkaos/AWS-Python-Boto3 | #!/usr/bin/env python
# a script to delete an rds instance
# import the sys and boto3 libraries
import sys
import boto3
# use the first argument to the script as the name
# of the instance to be deleted
db = sys.argv[1]
# create an rds client
rds = boto3.client('rds')
try:
# delete the instance and catch the re... | Swap db and rds set up
#!/usr/bin/env python
# a script to delete an rds instance
# import the sys and boto3 libraries
import sys
import boto3
# create an rds client
rds = boto3.client('rds')
# use the first argument to the script as the name
# of the instance to be deleted
db = sys.argv[1]
try:
# delete the i... |
1de254b56eba45ecdc88d26272ab1f123e734e25 | tests/test_dem.py | tests/test_dem.py | import unittest
import numpy as np
class CalculationMethodsTestCase(unittest.TestCase):
def setUp(self):
self.dem = DEMGrid()
def test_calculate_slope(self):
sx, sy = self.dem._calculate_slope()
def test_calculate_laplacian(self):
del2z = self.dem._calculate_lapalacian()
... | import unittest
import numpy as np
import filecmp
TESTDATA_FILENAME = os.path.join(os.path.dirname(__file__), 'data/big_basin.tif')
class CalculationMethodsTestCase(unittest.TestCase):
def setUp(self):
self.dem = DEMGrid(TESTDATA_FILENAME)
def test_calculate_slope(self):
... | Add test for writing spatial grid to file | Add test for writing spatial grid to file
| Python | mit | stgl/scarplet,rmsare/scarplet | import unittest
import numpy as np
import filecmp
TESTDATA_FILENAME = os.path.join(os.path.dirname(__file__), 'data/big_basin.tif')
class CalculationMethodsTestCase(unittest.TestCase):
def setUp(self):
self.dem = DEMGrid(TESTDATA_FILENAME)
def test_calculate_slope(self):
... | Add test for writing spatial grid to file
import unittest
import numpy as np
class CalculationMethodsTestCase(unittest.TestCase):
def setUp(self):
self.dem = DEMGrid()
def test_calculate_slope(self):
sx, sy = self.dem._calculate_slope()
def test_calculate_laplacian(self):
del2z =... |
bfd34a7aaf903c823d41068173c09bc5b1a251bc | test/sasdataloader/test/utest_sesans.py | test/sasdataloader/test/utest_sesans.py | """
Unit tests for the SESANS .ses reader
"""
import unittest
from sas.sascalc.dataloader.loader import Loader
import os.path
class sesans_reader(unittest.TestCase):
def setUp(self):
self.loader = Loader()
def test_sesans_load(self):
"""
Test .SES file loading
"""
... | """
Unit tests for the SESANS .ses reader
"""
import unittest
from sas.sascalc.dataloader.loader import Loader
import os.path
class sesans_reader(unittest.TestCase):
def setUp(self):
self.loader = Loader()
def test_sesans_load(self):
"""
Test .SES file loading
"""
... | Test that .SES files are tagged as Sesans | Test that .SES files are tagged as Sesans
| Python | bsd-3-clause | lewisodriscoll/sasview,lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,SasView/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,SasView/sasview,lewisodriscoll/sasview | """
Unit tests for the SESANS .ses reader
"""
import unittest
from sas.sascalc.dataloader.loader import Loader
import os.path
class sesans_reader(unittest.TestCase):
def setUp(self):
self.loader = Loader()
def test_sesans_load(self):
"""
Test .SES file loading
"""
... | Test that .SES files are tagged as Sesans
"""
Unit tests for the SESANS .ses reader
"""
import unittest
from sas.sascalc.dataloader.loader import Loader
import os.path
class sesans_reader(unittest.TestCase):
def setUp(self):
self.loader = Loader()
def test_sesans_load(self):
"""
... |
590de85fdb151e11079796c68f300d4fe7559995 | setup.py | setup.py | import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m', 'unittest', 'gis_metadata.tests.te... | import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m', 'unittest', 'gis_metadata.tests.te... | Increment version for mock test fix | Increment version for mock test fix | Python | bsd-3-clause | consbio/gis-metadata-parser | import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m', 'unittest', 'gis_metadata.tests.te... | Increment version for mock test fix
import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m'... |
effd1010abb7dbe920e11627fe555bacecced194 | rst2pdf/utils.py | rst2pdf/utils.py | #$HeadURL$
#$LastChangedDate$
#$LastChangedRevision$
import sys
from reportlab.platypus import PageBreak, Spacer
from flowables import *
import shlex
from log import log
def parseRaw (data):
'''Parse and process a simple DSL to handle creation of flowables.
Supported (can add others on request):
... | # -*- coding: utf-8 -*-
#$HeadURL$
#$LastChangedDate$
#$LastChangedRevision$
import sys
from reportlab.platypus import PageBreak, Spacer
from flowables import *
import shlex
from log import log
def parseRaw (data):
'''Parse and process a simple DSL to handle creation of flowables.
Supported (can... | Fix encoding (thanks to Yasushi Masuda) | Fix encoding (thanks to Yasushi Masuda)
git-svn-id: 305ad3fa995f01f9ce4b4f46c2a806ba00a97020@433 3777fadb-0f44-0410-9e7f-9d8fa6171d72
| Python | mit | aquavitae/rst2pdf-py3-dev,tonioo/rst2pdf,sychen/rst2pdf,tonioo/rst2pdf,aquavitae/rst2pdf,sychen/rst2pdf,openpolis/rst2pdf-patched-docutils-0.8,aquavitae/rst2pdf-py3-dev,aquavitae/rst2pdf,openpolis/rst2pdf-patched-docutils-0.8 | # -*- coding: utf-8 -*-
#$HeadURL$
#$LastChangedDate$
#$LastChangedRevision$
import sys
from reportlab.platypus import PageBreak, Spacer
from flowables import *
import shlex
from log import log
def parseRaw (data):
'''Parse and process a simple DSL to handle creation of flowables.
Supported (can... | Fix encoding (thanks to Yasushi Masuda)
git-svn-id: 305ad3fa995f01f9ce4b4f46c2a806ba00a97020@433 3777fadb-0f44-0410-9e7f-9d8fa6171d72
#$HeadURL$
#$LastChangedDate$
#$LastChangedRevision$
import sys
from reportlab.platypus import PageBreak, Spacer
from flowables import *
import shlex
from log import log
def... |
6775a5c58bd85dce644330dfd509d8f23135c5fe | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
README = readme_file.read()
install_requires = [
'click==6.6',
'botocore>=1.5.40,<2.0.0',
'typing==3.5.3.0',
'six>=1.10.0,<2.0.0',
'pip>=9,<10'
]
setup(
name='chalice',
version=... | #!/usr/bin/env python
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
README = readme_file.read()
install_requires = [
'click==6.6',
'botocore>=1.5.40,<2.0.0',
'typing==3.5.3.0',
'six>=1.10.0,<2.0.0',
'pip>=9,<10'
]
setup(
name='chalice',
version=... | Change dev status to beta, not pre-alpha | Change dev status to beta, not pre-alpha
There's no RC classifier, so beta looks like the closest
one we can use.
| Python | apache-2.0 | awslabs/chalice | #!/usr/bin/env python
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
README = readme_file.read()
install_requires = [
'click==6.6',
'botocore>=1.5.40,<2.0.0',
'typing==3.5.3.0',
'six>=1.10.0,<2.0.0',
'pip>=9,<10'
]
setup(
name='chalice',
version=... | Change dev status to beta, not pre-alpha
There's no RC classifier, so beta looks like the closest
one we can use.
#!/usr/bin/env python
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
README = readme_file.read()
install_requires = [
'click==6.6',
'botocore>=1.5.40,<... |
d48ae791364a0d29d60636adfde1f143858794cd | api/identifiers/serializers.py | api/identifiers/serializers.py | from rest_framework import serializers as ser
from api.base.utils import absolute_reverse
from api.base.serializers import JSONAPISerializer, RelationshipField, IDField, LinksField
class IdentifierSerializer(JSONAPISerializer):
category = ser.CharField(read_only=True)
filterable_fields = frozenset(['categor... | from rest_framework import serializers as ser
from api.base.utils import absolute_reverse
from api.base.serializers import JSONAPISerializer, RelationshipField, IDField, LinksField
class IdentifierSerializer(JSONAPISerializer):
category = ser.CharField(read_only=True)
filterable_fields = frozenset(['categor... | Remove rogue debugger how embarassing | Remove rogue debugger how embarassing
| Python | apache-2.0 | rdhyee/osf.io,alexschiller/osf.io,Johnetordoff/osf.io,caneruguz/osf.io,acshi/osf.io,abought/osf.io,amyshi188/osf.io,erinspace/osf.io,DanielSBrown/osf.io,chrisseto/osf.io,leb2dg/osf.io,mattclark/osf.io,samchrisinger/osf.io,alexschiller/osf.io,mluke93/osf.io,monikagrabowska/osf.io,mfraezz/osf.io,DanielSBrown/osf.io,crcre... | from rest_framework import serializers as ser
from api.base.utils import absolute_reverse
from api.base.serializers import JSONAPISerializer, RelationshipField, IDField, LinksField
class IdentifierSerializer(JSONAPISerializer):
category = ser.CharField(read_only=True)
filterable_fields = frozenset(['categor... | Remove rogue debugger how embarassing
from rest_framework import serializers as ser
from api.base.utils import absolute_reverse
from api.base.serializers import JSONAPISerializer, RelationshipField, IDField, LinksField
class IdentifierSerializer(JSONAPISerializer):
category = ser.CharField(read_only=True)
... |
c94f7e5f2c838c3fdd007229175da680de256b04 | tests/configurations/nginx/tests_file_size_limit.py | tests/configurations/nginx/tests_file_size_limit.py | #! coding: utf-8
import subprocess
import nose.tools as nt
from tests import TestPortalAndino
class TestFileSizeLimit(TestPortalAndino.TestPortalAndino):
@classmethod
def setUpClass(cls):
super(TestFileSizeLimit, cls).setUpClass()
def test_nginx_configuration_uses_1024_MB_as_file_size_limit(sel... | #! coding: utf-8
import subprocess
import nose.tools as nt
from tests import TestPortalAndino
class TestFileSizeLimit(TestPortalAndino.TestPortalAndino):
@classmethod
def setUpClass(cls):
super(TestFileSizeLimit, cls).setUpClass()
def test_nginx_configuration_uses_1024_MB_as_file_size_limit(sel... | Revert "Hago un strip del output de subprocess" | Revert "Hago un strip del output de subprocess"
This reverts commit f5f21d78d87be641617a7cb920d0869975175e58.
| Python | mit | datosgobar/portal-andino,datosgobar/portal-andino | #! coding: utf-8
import subprocess
import nose.tools as nt
from tests import TestPortalAndino
class TestFileSizeLimit(TestPortalAndino.TestPortalAndino):
@classmethod
def setUpClass(cls):
super(TestFileSizeLimit, cls).setUpClass()
def test_nginx_configuration_uses_1024_MB_as_file_size_limit(sel... | Revert "Hago un strip del output de subprocess"
This reverts commit f5f21d78d87be641617a7cb920d0869975175e58.
#! coding: utf-8
import subprocess
import nose.tools as nt
from tests import TestPortalAndino
class TestFileSizeLimit(TestPortalAndino.TestPortalAndino):
@classmethod
def setUpClass(cls):
... |
fe2bd7cf8b0139e1c7c1037d89929dd7c4093458 | setup.py | setup.py | import os
from setuptools import setup, find_packages
import glob
VERSION = "0.6.3"
src_dir = os.path.dirname(__file__)
install_requires = [
"troposphere>=1.2.2",
"boto3>=1.3.1",
"botocore>=1.4.38",
"PyYAML>=3.11",
"awacs>=0.5.3",
"colorama==0.3.7",
]
tests_require = [
"nose>=1.0",
"... | import os
from setuptools import setup, find_packages
import glob
VERSION = "0.6.3"
src_dir = os.path.dirname(__file__)
install_requires = [
"troposphere>=1.8.0",
"boto3>=1.3.1",
"botocore>=1.4.38",
"PyYAML>=3.11",
"awacs>=0.6.0",
"colorama==0.3.7",
]
tests_require = [
"nose>=1.0",
"... | Update troposphere & awacs to latest releases | Update troposphere & awacs to latest releases
| Python | bsd-2-clause | mhahn/stacker,mhahn/stacker,remind101/stacker,remind101/stacker | import os
from setuptools import setup, find_packages
import glob
VERSION = "0.6.3"
src_dir = os.path.dirname(__file__)
install_requires = [
"troposphere>=1.8.0",
"boto3>=1.3.1",
"botocore>=1.4.38",
"PyYAML>=3.11",
"awacs>=0.6.0",
"colorama==0.3.7",
]
tests_require = [
"nose>=1.0",
"... | Update troposphere & awacs to latest releases
import os
from setuptools import setup, find_packages
import glob
VERSION = "0.6.3"
src_dir = os.path.dirname(__file__)
install_requires = [
"troposphere>=1.2.2",
"boto3>=1.3.1",
"botocore>=1.4.38",
"PyYAML>=3.11",
"awacs>=0.5.3",
"colorama==0.3.... |
e66468faaf9c4885f13545329baa20fe4914f49c | historia.py | historia.py | from eve import Eve
from eve_swagger import swagger
from eve.auth import BasicAuth
from config import *
from hashlib import md5
class MyBasicAuth(BasicAuth):
def check_auth(self, username, password, allowed_roles, resource,
method):
accounts = app.data.driver.db['accounts']
accou... | from eve import Eve
from eve_swagger import swagger
from eve.auth import BasicAuth
from config import *
from hashlib import md5
class MyBasicAuth(BasicAuth):
def check_auth(self, username, password, allowed_roles, resource,
method):
accounts = app.data.driver.db['accounts']
accou... | Use MD5 to encode passwords | Use MD5 to encode passwords
| Python | mit | waoliveros/historia | from eve import Eve
from eve_swagger import swagger
from eve.auth import BasicAuth
from config import *
from hashlib import md5
class MyBasicAuth(BasicAuth):
def check_auth(self, username, password, allowed_roles, resource,
method):
accounts = app.data.driver.db['accounts']
accou... | Use MD5 to encode passwords
from eve import Eve
from eve_swagger import swagger
from eve.auth import BasicAuth
from config import *
from hashlib import md5
class MyBasicAuth(BasicAuth):
def check_auth(self, username, password, allowed_roles, resource,
method):
accounts = app.data.driver... |
6bdcda14c8bd5b66bc6fcb4bb6a520e326211f74 | poll/models.py | poll/models.py | from django.db import models
class QuestionGroup(models.Model):
heading = models.TextField()
text = models.TextField(blank=True)
date_added = models.DateTimeField(auto_now=True)
date_modified = models.DateTimeField(auto_now_add=True)
class Question(models.Model):
text = models.TextField()
qu... | from django.db import models
class QuestionGroup(models.Model):
heading = models.TextField()
text = models.TextField(blank=True)
date_added = models.DateTimeField(auto_now=True)
date_modified = models.DateTimeField(auto_now_add=True)
def __str__(self):
return str(self.id) + ". " + self.he... | Implement __str__ for proper printing in admin | Implement __str__ for proper printing in admin
| Python | mit | gabriel-v/psi,gabriel-v/psi,gabriel-v/psi | from django.db import models
class QuestionGroup(models.Model):
heading = models.TextField()
text = models.TextField(blank=True)
date_added = models.DateTimeField(auto_now=True)
date_modified = models.DateTimeField(auto_now_add=True)
def __str__(self):
return str(self.id) + ". " + self.he... | Implement __str__ for proper printing in admin
from django.db import models
class QuestionGroup(models.Model):
heading = models.TextField()
text = models.TextField(blank=True)
date_added = models.DateTimeField(auto_now=True)
date_modified = models.DateTimeField(auto_now_add=True)
class Question(mod... |
5cfbf23ff88a2d028fdd852adc735263c060f4eb | inet/inet.py | inet/inet.py | # -*- coding: utf-8 -*-
import csv
import os
from collections import namedtuple
class Inet():
"""Inet class"""
def __init__(self, data_file=None):
# Naive check for file type based on extension
# First check filepath is passed as a parameter
if data_file is not None:
# The... | Add read data file functionality to Inet class init | Add read data file functionality to Inet class init
| Python | mit | nestauk/inet | # -*- coding: utf-8 -*-
import csv
import os
from collections import namedtuple
class Inet():
"""Inet class"""
def __init__(self, data_file=None):
# Naive check for file type based on extension
# First check filepath is passed as a parameter
if data_file is not None:
# The... | Add read data file functionality to Inet class init
| |
20a801255ab505641e1ec0d449a4b36411c673bc | indra/tests/test_tas.py | indra/tests/test_tas.py | from nose.plugins.attrib import attr
from indra.sources.tas import process_from_web
@attr('slow')
def test_processor():
tp = process_from_web(affinity_class_limit=10)
assert tp
assert tp.statements
num_stmts = len(tp.statements)
# This is the total number of statements about human genes
assert... | from nose.plugins.attrib import attr
from indra.sources.tas import process_from_web
@attr('slow')
def test_processor():
tp = process_from_web(affinity_class_limit=10)
assert tp
assert tp.statements
num_stmts = len(tp.statements)
# This is the total number of statements about human genes
assert... | Update test for current evidence aggregation | Update test for current evidence aggregation
| Python | bsd-2-clause | sorgerlab/indra,sorgerlab/indra,sorgerlab/indra,sorgerlab/belpy,sorgerlab/belpy,bgyori/indra,bgyori/indra,johnbachman/belpy,johnbachman/indra,sorgerlab/belpy,johnbachman/belpy,johnbachman/belpy,johnbachman/indra,johnbachman/indra,bgyori/indra | from nose.plugins.attrib import attr
from indra.sources.tas import process_from_web
@attr('slow')
def test_processor():
tp = process_from_web(affinity_class_limit=10)
assert tp
assert tp.statements
num_stmts = len(tp.statements)
# This is the total number of statements about human genes
assert... | Update test for current evidence aggregation
from nose.plugins.attrib import attr
from indra.sources.tas import process_from_web
@attr('slow')
def test_processor():
tp = process_from_web(affinity_class_limit=10)
assert tp
assert tp.statements
num_stmts = len(tp.statements)
# This is the total num... |
480852bb1dd6796b7fb12e40edc924b9a4dbee60 | test/test_misc.py | test/test_misc.py | import unittest
from .helpers import run_module
class MiscTests(unittest.TestCase):
def setUp(self):
self.name = "benchmarker"
def test_no_framework(self):
with self.assertRaises(Exception):
run_module(self.name)
def test_no_problem(self):
with self.assertRaises(Exce... | Add tests to cover no framework, no problem | Add tests to cover no framework, no problem
| Python | mpl-2.0 | undertherain/benchmarker,undertherain/benchmarker,undertherain/benchmarker,undertherain/benchmarker | import unittest
from .helpers import run_module
class MiscTests(unittest.TestCase):
def setUp(self):
self.name = "benchmarker"
def test_no_framework(self):
with self.assertRaises(Exception):
run_module(self.name)
def test_no_problem(self):
with self.assertRaises(Exce... | Add tests to cover no framework, no problem
| |
a684564eace2185b40acf3413c8f75587195ff46 | unitary/examples/tictactoe/ascii_board.py | unitary/examples/tictactoe/ascii_board.py | # Copyright 2022 Google
#
# 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, soft... | Add ASCII board for Quantum TicTacToe board | Add ASCII board for Quantum TicTacToe board
- Add preliminary ASCII board for Quantum TicTacToe
- Displays probability for blank (.) and X and O.
| Python | apache-2.0 | quantumlib/unitary,quantumlib/unitary | # Copyright 2022 Google
#
# 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, soft... | Add ASCII board for Quantum TicTacToe board
- Add preliminary ASCII board for Quantum TicTacToe
- Displays probability for blank (.) and X and O.
| |
2bdadadbfc50aa1a99752705f96358a1076e1951 | openstack/tests/functional/telemetry/v2/test_resource.py | openstack/tests/functional/telemetry/v2/test_resource.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 t... | Add functional tests for telementry resource | Add functional tests for telementry resource
Change-Id: I8192452971a0f04fbd6a040c3c048f9284d58bb3
| Python | apache-2.0 | stackforge/python-openstacksdk,mtougeron/python-openstacksdk,briancurtin/python-openstacksdk,openstack/python-openstacksdk,briancurtin/python-openstacksdk,mtougeron/python-openstacksdk,openstack/python-openstacksdk,dudymas/python-openstacksdk,dudymas/python-openstacksdk,stackforge/python-openstacksdk,dtroyer/python-ope... | # 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 t... | Add functional tests for telementry resource
Change-Id: I8192452971a0f04fbd6a040c3c048f9284d58bb3
| |
caf9795cf0f775442bd0c3e06cd550a6e8d0206b | virtool/labels/db.py | virtool/labels/db.py | async def count_samples(db, label_id):
return await db.samples.count_documents({"labels": {"$in": [label_id]}})
| async def attach_sample_count(db, document, label_id):
document.update({"count": await db.samples.count_documents({"labels": {"$in": [label_id]}})})
| Rewrite function for sample count | Rewrite function for sample count
| Python | mit | virtool/virtool,igboyes/virtool,virtool/virtool,igboyes/virtool | async def attach_sample_count(db, document, label_id):
document.update({"count": await db.samples.count_documents({"labels": {"$in": [label_id]}})})
| Rewrite function for sample count
async def count_samples(db, label_id):
return await db.samples.count_documents({"labels": {"$in": [label_id]}})
|
2fb27cf8f4399ec6aba36b86d2993e6c3b81d0ee | coalib/bearlib/languages/__init__.py | coalib/bearlib/languages/__init__.py | """
This directory holds means to get generic information for specific languages.
"""
# Start ignoring PyUnusedCodeBear
from .Language import Language
from .Language import Languages
from .definitions.Unknown import Unknown
from .definitions.C import C
from .definitions.CPP import CPP
from .definitions.CSharp import ... | """
This directory holds means to get generic information for specific languages.
"""
# Start ignoring PyUnusedCodeBear
from .Language import Language
from .Language import Languages
from .definitions.Unknown import Unknown
from .definitions.C import C
from .definitions.CPP import CPP
from .definitions.CSharp import ... | Add definition into default import | Language: Add definition into default import
Fixes https://github.com/coala/coala/issues/4688 | Python | agpl-3.0 | coala/coala,SanketDG/coala,shreyans800755/coala,karansingh1559/coala,kartikeys98/coala,kartikeys98/coala,jayvdb/coala,CruiseDevice/coala,Nosferatul/coala,shreyans800755/coala,aptrishu/coala,nemaniarjun/coala,aptrishu/coala,karansingh1559/coala,jayvdb/coala,rimacone/testing2,Asalle/coala,CruiseDevice/coala,shreyans80075... | """
This directory holds means to get generic information for specific languages.
"""
# Start ignoring PyUnusedCodeBear
from .Language import Language
from .Language import Languages
from .definitions.Unknown import Unknown
from .definitions.C import C
from .definitions.CPP import CPP
from .definitions.CSharp import ... | Language: Add definition into default import
Fixes https://github.com/coala/coala/issues/4688
"""
This directory holds means to get generic information for specific languages.
"""
# Start ignoring PyUnusedCodeBear
from .Language import Language
from .Language import Languages
from .definitions.Unknown import Unknown... |
f3803452c669aa35ca71f00c18f613e276a70ca2 | scripts/add_users.py | scripts/add_users.py | #!/usr/bin/env python
"""
Add a series of users from a file of JSON objects, one per line.
The JSON user object lines can have the following fields:
{"name": "A. Non", "password": "pass12345", 'emailAddress': "email@email.com", "role": "supplier", "supplierId": 12345}
Usage:
add-users.py <data_api_endpoint> <dat... | #!/usr/bin/env python
"""
Add a series of users from a file of JSON objects, one per line.
The JSON user object lines can have the following fields:
{"name": "A. Non", "password": "pass12345", "emailAddress": "email@email.com", "role": "supplier", "supplierId": 12345}
Usage:
add-users.py <data_api_endpoint> <dat... | Fix example of how to run script, and make it executable | Fix example of how to run script, and make it executable
| Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | #!/usr/bin/env python
"""
Add a series of users from a file of JSON objects, one per line.
The JSON user object lines can have the following fields:
{"name": "A. Non", "password": "pass12345", "emailAddress": "email@email.com", "role": "supplier", "supplierId": 12345}
Usage:
add-users.py <data_api_endpoint> <dat... | Fix example of how to run script, and make it executable
#!/usr/bin/env python
"""
Add a series of users from a file of JSON objects, one per line.
The JSON user object lines can have the following fields:
{"name": "A. Non", "password": "pass12345", 'emailAddress': "email@email.com", "role": "supplier", "supplierId"... |
19d366141ffedbabc93de487d140333de30e4b7a | rcamp/lib/pam_backend.py | rcamp/lib/pam_backend.py | from django.conf import settings
from accounts.models import (
RcLdapUser,
User
)
import pam
import logging
logger = logging.getLogger('accounts')
class PamBackend():
def authenticate(self, request, username=None, password=None):
rc_user = RcLdapUser.objects.get_user_from_suffixed_username(usernam... | from django.conf import settings
from accounts.models import (
RcLdapUser,
User
)
import pam
import logging
logger = logging.getLogger('accounts')
class PamBackend():
def authenticate(self, request, username=None, password=None):
rc_user = RcLdapUser.objects.get_user_from_suffixed_username(usernam... | Add logging to debug hanging auth | Add logging to debug hanging auth
| Python | mit | ResearchComputing/RCAMP,ResearchComputing/RCAMP,ResearchComputing/RCAMP,ResearchComputing/RCAMP | from django.conf import settings
from accounts.models import (
RcLdapUser,
User
)
import pam
import logging
logger = logging.getLogger('accounts')
class PamBackend():
def authenticate(self, request, username=None, password=None):
rc_user = RcLdapUser.objects.get_user_from_suffixed_username(usernam... | Add logging to debug hanging auth
from django.conf import settings
from accounts.models import (
RcLdapUser,
User
)
import pam
import logging
logger = logging.getLogger('accounts')
class PamBackend():
def authenticate(self, request, username=None, password=None):
rc_user = RcLdapUser.objects.get_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.