commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
4e1ff55e0575e710648867ada8fe421df280fb6a | utils.py | utils.py | import vx
def _expose(f, name=None):
if name is None:
name = f.__name__.lstrip('_')
if getattr(vx, name, None) is not None:
raise AttributeError("Cannot expose duplicate name: '{}'".format(name))
setattr(vx, name, f)
return f
vx.expose = _expose
@vx.expose
def _repeat(c, times=4):
... | import vx
def _expose(f=None, name=None):
if name is None:
name = f.__name__.lstrip('_')
if getattr(vx, name, None) is not None:
raise AttributeError("Cannot expose duplicate name: '{}'".format(name))
if f is None:
def g(f):
setattr(vx, name, f)
return f
... | Fix vx.expose so it works when a name is passed | Fix vx.expose so it works when a name is passed
| Python | mit | philipdexter/vx,philipdexter/vx |
ec96c3173a770949c13e560b16272bc265a80da4 | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name='mass_api_client',
version=0.1,
install_required=['requests==2.13.0', 'marshmallow==2.12.2'])
| #!/usr/bin/env python
from distutils.core import setup
setup(name='mass_api_client',
version=0.1,
install_requires=['requests==2.13.0', 'marshmallow==2.12.2'],
packages=['mass_api_client', ],
)
| Add mass_api_client as Package; fix typo | Add mass_api_client as Package; fix typo
| Python | mit | mass-project/mass_api_client,mass-project/mass_api_client |
596613c964311104098e64eeb349216bc7cd0023 | saleor/demo/views.py | saleor/demo/views.py | from django.conf import settings
from django.shortcuts import render
from ..graphql.views import API_PATH, GraphQLView
EXAMPLE_QUERY = """# Welcome to Saleor GraphQL API!
#
# Type queries into this side of the screen, and you will see
# intelligent typeaheads aware of the current GraphQL type schema
# and live syntax... | from django.conf import settings
from django.shortcuts import render
from ..graphql.views import GraphQLView
EXAMPLE_QUERY = """# Welcome to Saleor GraphQL API!
#
# Type queries into this side of the screen, and you will see
# intelligent typeaheads aware of the current GraphQL type schema
# and live syntax and valid... | Fix playground CSP for demo if deployed under proxied domain | Fix playground CSP for demo if deployed under proxied domain
| Python | bsd-3-clause | mociepka/saleor,mociepka/saleor,mociepka/saleor |
53594f372a45e425076e5dbf36f399503df1972c | salt/output/yaml_out.py | salt/output/yaml_out.py | '''
YAML Outputter
'''
# Third Party libs
import yaml
def __virtual__():
return 'yaml'
def output(data):
'''
Print out YAML
'''
return yaml.dump(data)
| '''
Output data in YAML, this outputter defaults to printing in YAML block mode
for better readability.
'''
# Third Party libs
import yaml
def __virtual__():
return 'yaml'
def output(data):
'''
Print out YAML using the block mode
'''
return yaml.dump(data, default_flow_style=False)
| Change the YAML outputter to use block mode and add some docs | Change the YAML outputter to use block mode and add some docs
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt |
eb5bcf3130f5fdc0d6be68e7e81555def46a53af | setup.py | setup.py | from distutils.core import setup
setup(
name = 'mstranslator',
packages = ['mstranslator'],
version = '0.0.1',
description = 'Python wrapper to consume Microsoft translator API',
author = 'Ayush Goel',
author_email = 'ayushgoel111@gmail.com',
url = 'https://github.com/ayushgoel/mstranslator... | from distutils.core import setup
setup(
name = 'mstranslator-2016',
packages = ['mstranslator'],
version = '0.0.1',
description = 'Python wrapper to consume Microsoft translator API',
author = 'Ayush Goel',
author_email = 'ayushgoel111@gmail.com',
url = 'https://github.com/ayushgoel/mstrans... | Update nemae and download URL | Update nemae and download URL
| Python | mit | ayushgoel/mstranslator |
ccbe4a1c48765fdd9e785392dff949bcc49192a2 | setup.py | setup.py | from distutils.core import setup
setup(
name='Zinc',
version='0.1.7',
author='John Wang',
author_email='john@zinc.io',
packages=['zinc'],
package_dir={'zinc': ''},
package_data={'zinc': ['examples/*.py', 'examples/*.json', 'README', 'zinc/*']},
include_package_data=True,
url='https:... | from distutils.core import setup
setup(
name='Zinc',
version='0.1.8',
author='John Wang',
author_email='john@zinc.io',
packages=['zinc'],
package_dir={'zinc': ''},
package_data={'zinc': ['examples/*.py', 'examples/*.json', 'zinc/*']},
include_package_data=True,
url='https://github.c... | Remove readme from package data. | Remove readme from package data.
| Python | mit | wangjohn/zinc_cli |
2c03fec9a1afb22e2075fa537615d3802fef7ec6 | setup.py | setup.py | #!/usr/bin/env python3
import sys
from distutils.core import setup
setup(
name='pathlib',
version=open('VERSION.txt').read().strip(),
py_modules=['pathlib'],
license='MIT License',
description='Object-oriented filesystem paths',
long_description=open('README.txt').read(),
author='Antoine P... | #!/usr/bin/env python3
import sys
from distutils.core import setup
setup(
name='pathlib',
version=open('VERSION.txt').read().strip(),
py_modules=['pathlib'],
license='MIT License',
description='Object-oriented filesystem paths',
long_description=open('README.txt').read(),
author='Antoine P... | Add classifier for Python 3.3 | Add classifier for Python 3.3
| Python | mit | mcmtroffaes/pathlib2,saddingtonbaynes/pathlib2 |
949c8b8dc18d0732e6ada3a98cdf1a61028887dc | stagecraft/apps/datasets/admin/backdrop_user.py | stagecraft/apps/datasets/admin/backdrop_user.py | from __future__ import unicode_literals
from django.contrib import admin
from django.db import models
import reversion
from stagecraft.apps.datasets.models.backdrop_user import BackdropUser
from stagecraft.apps.datasets.models.data_set import DataSet
class DataSetInline(admin.StackedInline):
model = DataSet
f... | from __future__ import unicode_literals
from django.contrib import admin
from django.db import models
import reversion
from stagecraft.apps.datasets.models.backdrop_user import BackdropUser
from stagecraft.apps.datasets.models.data_set import DataSet
class DataSetInline(admin.StackedInline):
model = DataSet
f... | Remove data_sets from backdrop user search. Fixes | Remove data_sets from backdrop user search. Fixes
| Python | mit | alphagov/stagecraft,alphagov/stagecraft,alphagov/stagecraft,alphagov/stagecraft |
7e88739d91cd7db35ffb36804ae59d1878eb2da3 | setup.py | setup.py | import os
from distutils.core import setup
requirements = map(str.strip, open('requirements.txt').readlines())
setup(
name='py_eventsocket',
version='0.1.4',
author="Aaron Westendorf",
author_email="aaron@agoragames.com",
packages = ['eventsocket'],
url='https://github.com/agoragames/py-events... | import os
from distutils.core import setup
requirements = map(str.strip, open('requirements.txt').readlines())
setup(
name='py_eventsocket',
version='0.1.4',
author="Aaron Westendorf",
author_email="aaron@agoragames.com",
url='https://github.com/agoragames/py-eventsocket',
license='LICENSE.txt... | Use py_modules and not packages | Use py_modules and not packages
| Python | bsd-3-clause | agoragames/py-eventsocket |
c0b9c9712e464f304bee7c63bfd6b197a1c5fb0f | cmsplugin_bootstrap_carousel/cms_plugins.py | cmsplugin_bootstrap_carousel/cms_plugins.py | # coding: utf-8
import re
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cmsplugin_bootstrap_carousel.models import *
from django.utils.translation import ugettext as _
from django.contrib import admin
from django.forms import ModelForm, ValidationError
class CarouselForm(ModelF... | # coding: utf-8
import re
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cmsplugin_bootstrap_carousel.models import *
from django.utils.translation import ugettext as _
from django.contrib import admin
from django.forms import ModelForm, ValidationError
class CarouselForm(ModelF... | Change extra from 3 to 0. | Change extra from 3 to 0.
| Python | bsd-3-clause | 360youlun/cmsplugin-bootstrap-carousel,360youlun/cmsplugin-bootstrap-carousel |
554e79ada3f351ecb6287b08d0f7d1c4e5a5b5f6 | setup.py | setup.py | #!/usr/bin/env python
import sys
from distutils.core import setup
setup_args = {}
setup_args.update(dict(
name='param',
version='0.05',
description='Declarative Python programming using Parameters.',
long_description=open('README.txt').read(),
author= "IOAM",
author_email= "developers@topogr... | #!/usr/bin/env python
import sys
from distutils.core import setup
setup_args = {}
setup_args.update(dict(
name='param',
version='1.0',
description='Declarative Python programming using Parameters.',
long_description=open('README.txt').read(),
author= "IOAM",
author_email= "developers@topogra... | Update version number to 1.0. | Update version number to 1.0.
| Python | bsd-3-clause | ceball/param,ioam/param |
81b6a138c476084f9ddd6063f31d3efd0ba6e2cf | start.py | start.py | # -*- coding: utf-8 -*-
import argparse
import logging
import os
import sys
from twisted.internet import reactor
from desertbot.config import Config, ConfigError
from desertbot.factory import DesertBotFactory
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='An IRC bot written in Python.'... | # -*- coding: utf-8 -*-
import argparse
import logging
import os
import sys
from twisted.internet import reactor
from desertbot.config import Config, ConfigError
from desertbot.factory import DesertBotFactory
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='An IRC bot written in Python.'... | Make the logging level configurable | Make the logging level configurable
| Python | mit | DesertBot/DesertBot |
23341ce8a8ff44996c9b502ffe0524f5a1f69946 | test/interactive/test_exporter.py | test/interactive/test_exporter.py | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
import os
import sys
import time
from PySide import QtGui
from segue import discover_processors
from segue.backend.host.base import Host
from segue.frontend.exporter import ExporterWidget
class MockHost(Host):
... | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
import os
import sys
import time
from PySide import QtGui
from segue import discover_processors
from segue.backend.host.base import Host
from segue.frontend.exporter import ExporterWidget
class MockHost(Host):
... | Update mock host to match new interface. | Update mock host to match new interface.
| Python | apache-2.0 | 4degrees/segue |
f13fc280f25996ec7f4924647fdc879779f51737 | project/tools/normalize.py | project/tools/normalize.py | #!/usr/bin/env python
# mdstrip.py: makes new notebook from old, stripping md out
"""A tool to copy cell_type=("code") into a new file
without grabbing headers/markdown (most importantly the md)
NOTE: may want to grab the headers after all, or define new ones?"""
import os
import IPython.nbformat.current as nbf
from... | #!/usr/bin/env python
# mdstrip.py: makes new notebook from old, stripping md out
"""A tool to copy cell_type=("code") into a new file
without grabbing headers/markdown (most importantly the md)
NOTE: may want to grab the headers after all, or define new ones?"""
import os
import IPython.nbformat.current as nbf
from... | Allow two command arguments for in and out files, or none for standard filter operations | Allow two command arguments for in and out files, or none for standard filter operations
| Python | mit | holdenweb/nbtools,holdenweb/nbtools |
7e98a76ac455a8c69950104766719cde313bbb74 | tests/CrawlerProcess/asyncio_deferred_signal.py | tests/CrawlerProcess/asyncio_deferred_signal.py | import asyncio
import sys
import scrapy
from scrapy.crawler import CrawlerProcess
from twisted.internet.defer import Deferred
class UppercasePipeline:
async def _open_spider(self, spider):
spider.logger.info("async pipeline opened!")
await asyncio.sleep(0.1)
def open_spider(self, spider):
... | import asyncio
import sys
from scrapy import Spider
from scrapy.crawler import CrawlerProcess
from scrapy.utils.defer import deferred_from_coro
from twisted.internet.defer import Deferred
class UppercasePipeline:
async def _open_spider(self, spider):
spider.logger.info("async pipeline opened!")
a... | Use deferred_from_coro in asyncio test | Use deferred_from_coro in asyncio test
| Python | bsd-3-clause | elacuesta/scrapy,elacuesta/scrapy,scrapy/scrapy,pablohoffman/scrapy,dangra/scrapy,pawelmhm/scrapy,pablohoffman/scrapy,dangra/scrapy,scrapy/scrapy,pawelmhm/scrapy,dangra/scrapy,pawelmhm/scrapy,pablohoffman/scrapy,elacuesta/scrapy,scrapy/scrapy |
7119930b662a20d9e9bbca230f8a6485efcb7c44 | flask_appconfig/middleware.py | flask_appconfig/middleware.py | # from: http://flask.pocoo.org/snippets/35/
# written by Peter Hansen
class ReverseProxied(object):
'''Wrap the application in this middleware and configure the
front-end server to add these headers, to let you quietly bind
this to a URL other than / and to an HTTP scheme that is
different than what i... | # from: http://flask.pocoo.org/snippets/35/
# written by Peter Hansen
class ReverseProxied(object):
'''Wrap the application in this middleware and configure the
front-end server to add these headers, to let you quietly bind
this to a URL other than / and to an HTTP scheme that is
different than what i... | Add __getattr__ passthrough on ReverseProxied. | Add __getattr__ passthrough on ReverseProxied.
| Python | mit | mbr/flask-appconfig |
ba32a22cc0cb41c4548c658a7195fab56dab6dbf | atlas/prodtask/tasks.py | atlas/prodtask/tasks.py | from __future__ import absolute_import, unicode_literals
from atlas.celerybackend.celery import app
from atlas.prestage.views import find_action_to_execute, submit_all_tapes_processed
from atlas.prodtask.hashtag import hashtag_request_to_tasks
from atlas.prodtask.mcevgen import sync_cvmfs_db
from atlas.prodtask.open_e... | from __future__ import absolute_import, unicode_literals
from atlas.celerybackend.celery import app
from atlas.prestage.views import find_action_to_execute, submit_all_tapes_processed, delete_done_staging_rules
from atlas.prodtask.hashtag import hashtag_request_to_tasks
from atlas.prodtask.mcevgen import sync_cvmfs_db... | Add remove done staged rules | Add remove done staged rules
| Python | apache-2.0 | PanDAWMS/panda-bigmon-atlas,PanDAWMS/panda-bigmon-atlas,PanDAWMS/panda-bigmon-atlas,PanDAWMS/panda-bigmon-atlas |
eede55d9cd39c68ef03091614096e51d7df01336 | test_scraper.py | test_scraper.py | from scraper import search_CL
from scraper import read_search_results
from scraper import parse_source
from scraper import extract_listings
import bs4
def test_search_CL():
test_body, test_encoding = search_CL(minAsk=100, maxAsk=100)
assert "<span class=\"desktop\">craigslist</span>" in test_body
assert t... | from scraper import search_CL
from scraper import read_search_results
from scraper import parse_source
from scraper import extract_listings
import bs4
def test_search_CL():
test_body, test_encoding = search_CL(minAsk=100, maxAsk=100)
assert "<span class=\"desktop\">craigslist</span>" in test_body
assert t... | Modify test_extract_listings() to account for the change in output from extract_listings() | Modify test_extract_listings() to account for the change in output from extract_listings()
| Python | mit | jefrailey/basic-scraper |
b823233978f70d8e34a3653b309ee43b4b1e0c0d | fuel/transformers/defaults.py | fuel/transformers/defaults.py | """Commonly-used default transformers."""
from fuel.transformers import ScaleAndShift, Cast, SourcewiseTransformer
from fuel.transformers.image import ImagesFromBytes
def uint8_pixels_to_floatX(which_sources):
return (
(ScaleAndShift, [1 / 255.0, 0], {'which_sources': which_sources}),
(Cast, ['flo... | """Commonly-used default transformers."""
from fuel.transformers import ScaleAndShift, Cast, SourcewiseTransformer
from fuel.transformers.image import ImagesFromBytes
def uint8_pixels_to_floatX(which_sources):
return (
(ScaleAndShift, [1 / 255.0, 0], {'which_sources': which_sources}),
(Cast, ['flo... | Handle None axis_labels in ToBytes. | Handle None axis_labels in ToBytes.
| Python | mit | udibr/fuel,markusnagel/fuel,vdumoulin/fuel,mila-udem/fuel,dmitriy-serdyuk/fuel,udibr/fuel,markusnagel/fuel,aalmah/fuel,vdumoulin/fuel,aalmah/fuel,capybaralet/fuel,janchorowski/fuel,mila-udem/fuel,dribnet/fuel,capybaralet/fuel,dmitriy-serdyuk/fuel,janchorowski/fuel,dribnet/fuel |
65010bed4885223be3ed424b4189de368d28080f | sites/shared_conf.py | sites/shared_conf.py | from datetime import datetime
import alabaster
# Alabaster theme + mini-extension
html_theme_path = [alabaster.get_path()]
extensions = ['alabaster']
# Paths relative to invoking conf.py - not this shared file
html_static_path = ['../_shared_static']
html_theme = 'alabaster'
html_theme_options = {
'description':... | from os.path import join
from datetime import datetime
import alabaster
# Alabaster theme + mini-extension
html_theme_path = [alabaster.get_path()]
extensions = ['alabaster']
# Paths relative to invoking conf.py - not this shared file
html_static_path = [join('..', '_shared_static')]
html_theme = 'alabaster'
html_th... | Make shared static path OS-agnostic | Make shared static path OS-agnostic
| Python | bsd-2-clause | haridsv/fabric,cgvarela/fabric,ploxiln/fabric,tekapo/fabric,bitmonk/fabric,kmonsoor/fabric,amaniak/fabric,sdelements/fabric,likesxuqiang/fabric,TarasRudnyk/fabric,mathiasertl/fabric,tolbkni/fabric,pgroudas/fabric,SamuelMarks/fabric,jaraco/fabric,rbramwell/fabric,bspink/fabric,raimon49/fabric,kxxoling/fabric,qinrong/fab... |
beeae2daf35da275d5f9e1ad01516c917319bf00 | gapipy/resources/geo/state.py | gapipy/resources/geo/state.py | from __future__ import unicode_literals
from ..base import Resource
from ...utils import enforce_string_type
class State(Resource):
_resource_name = 'states'
_as_is_fields = ['id', 'href', 'name']
_resource_fields = [('country', 'Country')]
@enforce_string_type
def __repr__(self):
retu... | from __future__ import unicode_literals
from ..base import Resource
from ...utils import enforce_string_type
class State(Resource):
_resource_name = 'states'
_as_is_fields = ['id', 'href', 'name']
_resource_fields = [
('country', 'Country'),
('place', 'Place'),
]
@enforce_strin... | Add Place reference to State model | Add Place reference to State model
| Python | mit | gadventures/gapipy |
d2fc123454bdf0089043ef3926798f3f79904c60 | Lib/test/test_openpty.py | Lib/test/test_openpty.py | # Test to see if openpty works. (But don't worry if it isn't available.)
import os, unittest
from test.test_support import run_unittest, TestSkipped
class OpenptyTest(unittest.TestCase):
def test(self):
try:
master, slave = os.openpty()
except AttributeError:
raise TestSkip... | # Test to see if openpty works. (But don't worry if it isn't available.)
import os, unittest
from test.test_support import run_unittest, TestSkipped
if not hasattr(os, "openpty"):
raise TestSkipped, "No openpty() available."
class OpenptyTest(unittest.TestCase):
def test(self):
master, slave = os.op... | Move the check for openpty to the beginning. | Move the check for openpty to the beginning.
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator |
cedac36d38ff0bf70abc1c9193948a288e858a01 | kitsune/lib/pipeline_compilers.py | kitsune/lib/pipeline_compilers.py | import re
from django.conf import settings
from django.utils.encoding import smart_bytes
from pipeline.compilers import CompilerBase
from pipeline.exceptions import CompilerError
class BrowserifyCompiler(CompilerBase):
output_extension = 'browserified.js'
def match_file(self, path):
# Allow for cac... | import re
from django.conf import settings
from django.utils.encoding import smart_bytes
from pipeline.compilers import CompilerBase
from pipeline.exceptions import CompilerError
class BrowserifyCompiler(CompilerBase):
output_extension = 'browserified.js'
def match_file(self, path):
# Allow for cac... | Update BrowserifyCompiler for n Pipeline settings. | Update BrowserifyCompiler for n Pipeline settings.
| Python | bsd-3-clause | mythmon/kitsune,MikkCZ/kitsune,brittanystoroz/kitsune,anushbmx/kitsune,MikkCZ/kitsune,anushbmx/kitsune,safwanrahman/kitsune,brittanystoroz/kitsune,MikkCZ/kitsune,mozilla/kitsune,safwanrahman/kitsune,mythmon/kitsune,anushbmx/kitsune,mythmon/kitsune,safwanrahman/kitsune,mozilla/kitsune,brittanystoroz/kitsune,mythmon/kits... |
c1f8d5817b8c94b422c0d454dcc0fa3c00e751b6 | activelink/tests/urls.py | activelink/tests/urls.py | from django import VERSION as DJANGO_VERSION
from django.http import HttpResponse
if DJANGO_VERSION >= (1, 6):
from django.conf.urls import patterns, url
else:
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('',
url(r'^test-url/$', lambda r: HttpResponse('ok'), name='test'),
... | from django import VERSION as DJANGO_VERSION
from django.http import HttpResponse
if DJANGO_VERSION >= (1, 10):
from django.conf.urls import url
elif DJANGO_VERSION >= (1, 6):
from django.conf.urls import patterns, url
else:
from django.conf.urls.defaults import patterns, url
urlpatterns = [
url(r'^... | Add support for Django 1.11 | Add support for Django 1.11
| Python | unlicense | j4mie/django-activelink |
4b34f2afa13ef880b9832bc725c5f1b6ede4dc0e | back_office/models.py | back_office/models.py | from django.db import models
from django.utils.translation import ugettext as _
from Django.contrib.auth.models import User
FEMALE = 'F'
MALE = 'M'
class Teacher(models.Model):
"""
halaqat teachers informations
"""
GENDET_CHOICES = (
(MALE, _('Male')),
(FEMALE, _('Female')),
)
... | from django.db import models
from django.utils.translation import ugettext as _
from Django.contrib.auth.models import User
FEMALE = 'F'
MALE = 'M'
class Teacher(models.Model):
"""
halaqat teachers informations
"""
GENDET_CHOICES = (
(MALE, _('Male')),
(FEMALE, _('Female')),
)
... | Remove name field and use the User name fields | Remove name field and use the User name fields
| Python | mit | EmadMokhtar/halaqat,EmadMokhtar/halaqat,EmadMokhtar/halaqat |
c2ca03ba94349340447a316ff21bcb26631e308f | lms/djangoapps/discussion/settings/common.py | lms/djangoapps/discussion/settings/common.py | """Common environment variables unique to the discussion plugin."""
def plugin_settings(settings):
"""Settings for the discussions plugin. """
settings.FEATURES['ALLOW_HIDING_DISCUSSION_TAB'] = False
settings.DISCUSSION_SETTINGS = {
'MAX_COMMENT_DEPTH': 2,
'COURSE_PUBLISH_TASK_DELAY': 30,
... | """Common environment variables unique to the discussion plugin."""
def plugin_settings(settings):
"""Settings for the discussions plugin. """
# .. toggle_name: ALLOW_HIDING_DISCUSSION_TAB
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: If True, it add... | Add annotation for ALLOW_HIDING_DISCUSSION_TAB feature flag | Add annotation for ALLOW_HIDING_DISCUSSION_TAB feature flag
| Python | agpl-3.0 | EDUlib/edx-platform,eduNEXT/edx-platform,EDUlib/edx-platform,eduNEXT/edunext-platform,edx/edx-platform,eduNEXT/edx-platform,angelapper/edx-platform,eduNEXT/edx-platform,eduNEXT/edx-platform,arbrandes/edx-platform,arbrandes/edx-platform,eduNEXT/edunext-platform,EDUlib/edx-platform,edx/edx-platform,angelapper/edx-platfor... |
90ca340883077f57ba63127db058a8d244ec6f4c | molecule/ui/tests/conftest.py | molecule/ui/tests/conftest.py | import pytest
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
import time
from webdriver_manager.chrome import ChromeDri... | import pytest
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
import time
from webdriver_manager.chrome import ChromeDri... | Switch UI tests back to google chrome. | Switch UI tests back to google chrome.
| Python | apache-2.0 | Graylog2/graylog-ansible-role |
760506e88d22d86be818017fb6075abe7af2a068 | dactyl.py | dactyl.py | from slackbot.bot import respond_to
from slackbot.bot import listen_to
import re
import urllib
| from slackbot.bot import respond_to
from slackbot.bot import listen_to
import re
import urllib
def url_validator(url):
try:
code = urllib.urlopen(url).getcode()
if code == 200:
return True
except:
return False
def test_url(message, url):
if url_validator(url[1:len(url... | Add url_validator function and respond aciton to test url | Add url_validator function and respond aciton to test url
| Python | mit | KrzysztofSendor/dactyl |
01b67c00b6ab1eea98da9b54737f051a01a726fb | auslib/migrate/versions/009_add_rule_alias.py | auslib/migrate/versions/009_add_rule_alias.py | from sqlalchemy import Column, String, MetaData, Table
def upgrade(migrate_engine):
metadata = MetaData(bind=migrate_engine)
def add_alias(table):
alias = Column('alias', String(50))
alias.create(table)
add_alias(Table('rules', metadata, autoload=True))
add_alias(Table('rules_history'... | from sqlalchemy import Column, String, MetaData, Table
def upgrade(migrate_engine):
metadata = MetaData(bind=migrate_engine)
def add_alias(table):
alias = Column('alias', String(50), unique=True)
alias.create(table)
add_alias(Table('rules', metadata, autoload=True))
add_alias(Table('r... | Create alias column as unique. | Create alias column as unique.
| Python | mpl-2.0 | nurav/balrog,mozbhearsum/balrog,tieu/balrog,mozbhearsum/balrog,aksareen/balrog,aksareen/balrog,aksareen/balrog,mozbhearsum/balrog,tieu/balrog,nurav/balrog,testbhearsum/balrog,mozbhearsum/balrog,nurav/balrog,testbhearsum/balrog,aksareen/balrog,testbhearsum/balrog,tieu/balrog,nurav/balrog,testbhearsum/balrog,tieu/balrog |
1b8efb09ac512622ea3541d950ffc67b0a183178 | survey/signals.py | survey/signals.py | import django.dispatch
survey_completed = django.dispatch.Signal(providing_args=["instance", "data"])
| import django.dispatch
# providing_args=["instance", "data"]
survey_completed = django.dispatch.Signal()
| Remove puyrely documental providing-args argument | Remove puyrely documental providing-args argument
See https://docs.djangoproject.com/en/4.0/releases/3.1/#id2
| Python | agpl-3.0 | Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey |
231657e2bbc81b8299cc91fd24dcd7394f74b4ec | python/dpu_utils/codeutils/identifiersplitting.py | python/dpu_utils/codeutils/identifiersplitting.py | from functools import lru_cache
from typing import List
import sys
REGEX_TEXT = ("(?<=[a-z0-9])(?=[A-Z])|"
"(?<=[A-Z0-9])(?=[A-Z][a-z])|"
"(?<=[0-9])(?=[a-zA-Z])|"
"(?<=[A-Za-z])(?=[0-9])|"
"(?<=[@$])(?=[a-zA-Z0-9])|"
"(?<=[a-zA-Z0-9])(?=[@... | from functools import lru_cache
from typing import List
import sys
REGEX_TEXT = ("(?<=[a-z0-9])(?=[A-Z])|"
"(?<=[A-Z0-9])(?=[A-Z][a-z])|"
"(?<=[0-9])(?=[a-zA-Z])|"
"(?<=[A-Za-z])(?=[0-9])|"
"(?<=[@$.'\"])(?=[a-zA-Z0-9])|"
"(?<=[a-zA-Z0-9])(... | Revert to some of the previous behavior for characters that shouldn't appear in identifiers. | Revert to some of the previous behavior for characters that shouldn't appear in identifiers.
| Python | mit | microsoft/dpu-utils,microsoft/dpu-utils |
81460f88ee19fb736dfc3453df2905f0ba4b3974 | common/permissions.py | common/permissions.py | from rest_framework.permissions import BasePermission
class ObjectHasTokenUser(BasePermission):
"""
The object's user matches the token's user.
"""
def has_object_permission(self, request, view, obj):
token = request.auth
if not token:
return False
if not hasattr(... | from rest_framework.permissions import BasePermission
class ObjectHasTokenUser(BasePermission):
"""
The object's user matches the token's user.
"""
def has_object_permission(self, request, view, obj):
token = request.auth
if not token:
return False
if not hasattr(... | Remove debugging code, fix typo | Remove debugging code, fix typo
| Python | mit | PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans |
65336509829a42b91b000d2e423ed4581ac61c98 | app/mpv.py | app/mpv.py | #!/usr/bin/env python
# and add mpv.json to ~/.mozilla/native-messaging-hosts
import sys
import json
import struct
import subprocess
# Read a message from stdin and decode it.
def getMessage():
rawLength = sys.stdin.read(4)
if len(rawLength) == 0:
sys.exit(0)
messageLength = struct.unpack('@I... | #!/usr/bin/env python
import sys
import json
import struct
import subprocess
import shlex
# Read a message from stdin and decode it.
def getMessage():
rawLength = sys.stdin.read(4)
if len(rawLength) == 0:
sys.exit(0)
messageLength = struct.unpack('@I', rawLength)[0]
message = sys.stdin.read(m... | Handle shell args in python scripts | Handle shell args in python scripts
| Python | mit | vayan/external-video,vayan/external-video,vayan/external-video,vayan/external-video |
d7298374409912c6ace10e2bec323013cdd4d933 | scripts/poweron/DRAC.py | scripts/poweron/DRAC.py | import subprocess, sys, os.path
class DRAC_NO_SUPP_PACK(Exception):
"""Base Exception class for all transfer plugin errors."""
def __init__(self, *args):
Exception.__init__(self, *args)
class DRAC_POWERON_FAILED(Exception):
"""Base Exception class for all transfer plugin errors."""
def... | import subprocess, sys, os.path
class DRAC_NO_SUPP_PACK(Exception):
"""Base Exception class for all transfer plugin errors."""
def __init__(self, *args):
Exception.__init__(self, *args)
class DRAC_POWERON_FAILED(Exception):
"""Base Exception class for all transfer plugin errors."""
def... | Change path to the supplemental pack | CA-40618: Change path to the supplemental pack
Signed-off-by: Javier Alvarez-Valle <cf4c8668a0b4c5e013f594a6940d05b3d4d9ddcf@citrix.com>
| Python | lgpl-2.1 | simonjbeaumont/xcp-rrdd,koushikcgit/xcp-rrdd,djs55/squeezed,koushikcgit/xcp-rrdd,johnelse/xcp-rrdd,johnelse/xcp-rrdd,sharady/xcp-networkd,simonjbeaumont/xcp-rrdd,djs55/xcp-networkd,sharady/xcp-networkd,djs55/xcp-rrdd,djs55/xcp-rrdd,koushikcgit/xcp-rrdd,djs55/xcp-networkd,koushikcgit/xcp-networkd,robhoes/squeezed,koushi... |
83d5cc3b4ffb4759e8e073d04299a55802df09a8 | src/ansible/views.py | src/ansible/views.py | from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect, HttpResponse
from .models import Playbook
def index(request):
return "200"
| from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect, HttpResponse
from .models import Playbook
def index(request):
return HttpResponse("200")
| Fix return to use HttpResponse | Fix return to use HttpResponse
| Python | bsd-3-clause | lozadaOmr/ansible-admin,lozadaOmr/ansible-admin,lozadaOmr/ansible-admin |
88e5ecad9966057203a9cbecaeaecdca3e76b6da | tests/fake_filesystem.py | tests/fake_filesystem.py | import os
import stat
from StringIO import StringIO
from types import StringTypes
import paramiko as ssh
class FakeFile(StringIO):
def __init__(self, value=None, path=None):
init = lambda x: StringIO.__init__(self, x)
if value is None:
init("")
ftype = 'dir'
si... | import os
import stat
from StringIO import StringIO
from types import StringTypes
import paramiko as ssh
class FakeFile(StringIO):
def __init__(self, value=None, path=None):
init = lambda x: StringIO.__init__(self, x)
if value is None:
init("")
ftype = 'dir'
si... | Define noop close() for FakeFile | Define noop close() for FakeFile
| Python | bsd-2-clause | kxxoling/fabric,rodrigc/fabric,qinrong/fabric,elijah513/fabric,bspink/fabric,MjAbuz/fabric,cmattoon/fabric,hrubi/fabric,felix-d/fabric,askulkarni2/fabric,SamuelMarks/fabric,mathiasertl/fabric,tekapo/fabric,StackStorm/fabric,ploxiln/fabric,kmonsoor/fabric,raimon49/fabric,haridsv/fabric,bitprophet/fabric,fernandezcuesta/... |
f45b3e73b6258c99aed2bff2e7350f1c797ff849 | providers/provider.py | providers/provider.py | import copy
import json
import requests
import html5lib
from application import APPLICATION as APP
# Be compatible with python 2 and 3
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
class BaseProvider(object):
# ==== HELPER METHODS ====
def parse_html(self, ur... | import copy
import json
from urllib.parse import urlencode
import html5lib
import requests
from application import APPLICATION as APP
class BaseProvider(object):
# ==== HELPER METHODS ====
def parse_html(self, url, css_selector, timeout=60, cache=True):
html = self._http_get(url, timeout=timeout, cac... | Remove support for Python 2. | Remove support for Python 2.
| Python | mit | EmilStenstrom/nephele |
cdd32dd3e346f72f823cc5d3f59c79c027db65c8 | common.py | common.py | """Functions common to other modules."""
import json
import os
import re
import time
import urllib.request
from settings import net
def clean(name):
"""Strip all [^a-zA-Z0-9_] characters and convert to lowercase."""
return re.sub(r"\W", r"", name, flags=re.ASCII).lower()
def exists(path):
"""Check to s... | """Functions common to other modules."""
import json
import os
import re
import time
import urllib.request
from settings import net
def clean(name):
"""Strip all [^a-zA-Z0-9_] characters and convert to lowercase."""
return re.sub(r"\W", r"", name, flags=re.ASCII).lower()
def exists(path):
"""Check to s... | Make task an optional argument. | Make task an optional argument.
| Python | bsd-2-clause | chingc/DJRivals,chingc/DJRivals |
86080d1c06637e1d73784100657fc43bd7326e66 | tools/conan/conanfile.py | tools/conan/conanfile.py | from conans import ConanFile, CMake, tools
class LibWFUTConan(ConanFile):
name = "libwfut"
version = "0.2.4"
license = "GPL-2.0+"
author = "Erik Ogenvik <erik@ogenvik.org>"
homepage = "https://www.worldforge.org"
url = "https://github.com/worldforge/libwfut"
description = "A client side C+... | from conans import ConanFile, CMake, tools
class LibWFUTConan(ConanFile):
name = "libwfut"
version = "0.2.4"
license = "GPL-2.0+"
author = "Erik Ogenvik <erik@ogenvik.org>"
homepage = "https://www.worldforge.org"
url = "https://github.com/worldforge/libwfut"
description = "A client side C+... | Build with PIC by default. | Build with PIC by default.
| Python | lgpl-2.1 | worldforge/libwfut,worldforge/libwfut,worldforge/libwfut,worldforge/libwfut |
bbaf4aa6dbdbb41395b0859260962665b20230ad | __openerp__.py | __openerp__.py | # -*- coding: utf-8 -*-
{
'name': 'Chilean VAT Ledger',
'description': '''
Chilean VAT Ledger Management
=================================
Creates Sale and Purchase VAT report menus in
"accounting/period processing/VAT Ledger"
''',
'version': '0.1',
'author': u'Blanco Martín & Asociados',
'websi... | # -*- coding: utf-8 -*-
{
'name': 'Chilean VAT Ledger',
'license': 'AGPL-3',
'description': '''
Chilean VAT Ledger Management
=================================
Creates Sale and Purchase VAT report menus in
"accounting/period processing/VAT Ledger"
''',
'version': '0.1',
'author': u'Blanco Martín... | Set license to AGPL-3 in manifest | Set license to AGPL-3 in manifest
| Python | agpl-3.0 | odoo-chile/l10n_cl_account_vat_ledger,odoo-chile/l10n_cl_account_vat_ledger |
dcd9f381bc7eeaa0ffad72d286bb6dc26ebf37a4 | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Sergey Margaritov
# Copyright (c) 2013 Sergey Margaritov
#
# License: MIT
#
"""This module exports the scss-lint plugin linter class."""
import os
from SublimeLinter.lint import Linter, util
class Scss(Linter):
... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Sergey Margaritov
# Copyright (c) 2013 Sergey Margaritov
#
# License: MIT
#
"""This module exports the scss-lint plugin linter class."""
import os
from SublimeLinter.lint import RubyLinter, util
class Scss(RubyLin... | Use RubyLinter instead of Linter so rbenv and rvm are supported | Use RubyLinter instead of Linter so rbenv and rvm are supported
| Python | mit | attenzione/SublimeLinter-scss-lint |
150e338b7d2793c434d7e2f21aef061f35634476 | openspending/test/__init__.py | openspending/test/__init__.py | """\
OpenSpending test module
========================
Run the OpenSpending test suite by running
nosetests
in the root of the repository, while in an active virtualenv. See
doc/install.rst for more information.
"""
import os
import sys
from paste.deploy import appconfig
from openspending import mongo
from he... | """\
OpenSpending test module
========================
Run the OpenSpending test suite by running
nosetests
in the root of the repository, while in an active virtualenv. See
doc/install.rst for more information.
"""
import os
import sys
from pylons import config
from openspending import mongo
from .helpers im... | Use config given on command line | Use config given on command line
| Python | agpl-3.0 | pudo/spendb,openspending/spendb,openspending/spendb,nathanhilbert/FPA_Core,pudo/spendb,johnjohndoe/spendb,CivicVision/datahub,USStateDept/FPA_Core,johnjohndoe/spendb,USStateDept/FPA_Core,CivicVision/datahub,nathanhilbert/FPA_Core,johnjohndoe/spendb,openspending/spendb,USStateDept/FPA_Core,spendb/spendb,nathanhilbert/FP... |
37a0cb41a88114ab9edb514e29447756b0c3e92a | tests/test_cli.py | tests/test_cli.py | # -*- coding: utf-8 -*-
from click.testing import CliRunner
import pytest
from cibopath.cli import main
from cibopath import __version__
runner = CliRunner()
@pytest.fixture(params=['-V', '--version'])
def version_cli_flag(request):
return request.param
def test_cli_group_version_option(version_cli_flag):
... | # -*- coding: utf-8 -*-
import pytest
from cibopath import __version__
@pytest.fixture(params=['-V', '--version'])
def version_cli_flag(request):
return request.param
def test_cli_group_version_option(cli_runner, version_cli_flag):
result = cli_runner([version_cli_flag])
assert result.exit_code == 0
... | Use cli_runner fixture in test | Use cli_runner fixture in test
| Python | bsd-3-clause | hackebrot/cibopath |
f814e945d3e62c87c5f86ef5ac37c5feb733b83d | tests/test_ext.py | tests/test_ext.py | from __future__ import absolute_import, unicode_literals
import unittest
from mopidy import config, ext
class ExtensionTest(unittest.TestCase):
def setUp(self): # noqa: N802
self.ext = ext.Extension()
def test_dist_name_is_none(self):
self.assertIsNone(self.ext.dist_name)
def test_ex... | from __future__ import absolute_import, unicode_literals
import pytest
from mopidy import config, ext
@pytest.fixture
def extension():
return ext.Extension()
def test_dist_name_is_none(extension):
assert extension.dist_name is None
def test_ext_name_is_none(extension):
assert extension.ext_name is N... | Convert ext test to pytests | tests: Convert ext test to pytests
| Python | apache-2.0 | mokieyue/mopidy,bencevans/mopidy,ZenithDK/mopidy,jodal/mopidy,quartz55/mopidy,pacificIT/mopidy,pacificIT/mopidy,quartz55/mopidy,ali/mopidy,swak/mopidy,tkem/mopidy,bencevans/mopidy,mopidy/mopidy,SuperStarPL/mopidy,dbrgn/mopidy,hkariti/mopidy,glogiotatidis/mopidy,mokieyue/mopidy,ali/mopidy,bacontext/mopidy,glogiotatidis/... |
27ffcae96c5dce976517035b25a5c72f10e2ec99 | tool_spatialdb.py | tool_spatialdb.py | # SpatialDB scons tool
#
# It builds the library for the SpatialDB C++ class library,
# and provides CPP and linker specifications for the header
# and libraries.
#
# SpatialDB depends on SqliteDB, which provides the interface to
# sqlite3. It also depends on SpatiaLite. Since SpatiaLite is
# is also needed by SQLit... | # SpatialDB scons tool
#
# It builds the library for the SpatialDB C++ class library,
# and provides CPP and linker specifications for the header
# and libraries.
#
# SpatialDB depends on SqliteDB, which provides the interface to
# sqlite3. It also depends on SpatiaLite. Since SpatiaLite is
# is also needed by SQLit... | Use GLOBAL_TOOLs rather than Export/Import for project wide configuration. | Use GLOBAL_TOOLs rather than Export/Import for project wide configuration.
| Python | bsd-3-clause | ncareol/spatialdb,ncareol/spatialdb |
da59d7481668a7133eebcd12b4d5ecfb655296a6 | test/test_blob_filter.py | test/test_blob_filter.py | """Test the blob filter."""
from pathlib import Path
from typing import Sequence, Tuple
from unittest.mock import MagicMock
import pytest
from git.index.typ import BlobFilter, StageType
from git.objects import Blob
from git.types import PathLike
# fmt: off
@pytest.mark.parametrize('paths, stage_type, path, expected... | """Test the blob filter."""
from pathlib import Path
from typing import Sequence, Tuple
from unittest.mock import MagicMock
import pytest
from git.index.typ import BlobFilter, StageType
from git.objects import Blob
from git.types import PathLike
# fmt: off
@pytest.mark.parametrize('paths, path, expected_result', [
... | Remove stage type as parameter from blob filter test | Remove stage type as parameter from blob filter test
| Python | bsd-3-clause | gitpython-developers/GitPython,gitpython-developers/gitpython,gitpython-developers/GitPython,gitpython-developers/gitpython |
431ca4f2d44656ef9f97be50718712c6f3a0fa9b | qtawesome/tests/test_qtawesome.py | qtawesome/tests/test_qtawesome.py | r"""
Tests for QtAwesome.
"""
# Standard library imports
import subprocess
# Test Library imports
import pytest
# Local imports
import qtawesome as qta
from qtawesome.iconic_font import IconicFont
def test_segfault_import():
output_number = subprocess.call('python -c "import qtawesome '
... | r"""
Tests for QtAwesome.
"""
# Standard library imports
import subprocess
import collections
# Test Library imports
import pytest
# Local imports
import qtawesome as qta
from qtawesome.iconic_font import IconicFont
def test_segfault_import():
output_number = subprocess.call('python -c "import qtawesome '
... | Make the test more comprehensive. | Make the test more comprehensive.
| Python | mit | spyder-ide/qtawesome |
3d8ec94e61735b84c3b24b44d79fcd57611a93ee | mndeps.py | mndeps.py | #!/usr/bin/env python
# XXX: newer mininet version also has MinimalTopo
from mininet.topo import ( SingleSwitchTopo, LinearTopo,
SingleSwitchReversedTopo )
from mininet.topolib import TreeTopo
from mininet.util import buildTopo
import psycopg2
TOPOS = { 'linear': LinearTopo,
'reve... | #!/usr/bin/env python
# XXX: newer mininet version also has MinimalTopo
from mininet.topo import ( SingleSwitchTopo, LinearTopo,
SingleSwitchReversedTopo )
from mininet.topolib import TreeTopo
from mininet.util import buildTopo
import psycopg2
TOPOS = { 'linear': LinearTopo,
'reve... | Fix bug after removing torus | Fix bug after removing torus
| Python | apache-2.0 | ravel-net/ravel,ravel-net/ravel |
8ac492be603f958a29bbc6bb5215d79ec469d269 | tests/test_init.py | tests/test_init.py | """Test the checkers"""
from nose.tools import ok_, eq_
from preflyt import check
CHECKERS = [
{"checker": "env", "name": "USER"}
]
BAD_CHECKERS = [
{"checker": "env", "name": "USER1231342dhkfgjhk2394dv09324jk12039csdfg01231"}
]
def test_everything():
"""Test the check method."""
good, results = che... | """Test the checkers"""
from nose.tools import ok_, eq_
from preflyt import check
CHECKERS = [
{"checker": "env", "name": "PATH"}
]
BAD_CHECKERS = [
{"checker": "env", "name": "PATH1231342dhkfgjhk2394dv09324jk12039csdfg01231"}
]
def test_everything():
"""Test the check method."""
good, results = c... | Update environment test to have cross platform support | Update environment test to have cross platform support
| Python | mit | humangeo/preflyt |
131fb74b0f399ad3abff5dcc2b09621cac1226e7 | config/nox_routing.py | config/nox_routing.py | from experiment_config_lib import ControllerConfig
from sts.control_flow import Fuzzer
from sts.input_traces.input_logger import InputLogger
from sts.invariant_checker import InvariantChecker
from sts.simulation_state import SimulationConfig
# Use NOX as our controller
command_line = "./nox_core -i ptcp:6633 routing"
... | from experiment_config_lib import ControllerConfig
from sts.control_flow import Fuzzer
from sts.input_traces.input_logger import InputLogger
from sts.invariant_checker import InvariantChecker
from sts.simulation_state import SimulationConfig
from sts.topology import MeshTopology
# Use NOX as our controller
command_lin... | Update NOX config to use sample_routing | Update NOX config to use sample_routing
| Python | apache-2.0 | ucb-sts/sts,jmiserez/sts,jmiserez/sts,ucb-sts/sts |
96e86fb389d67d55bf6b4e0f3f0f318e75b532dd | kirppu/management/commands/accounting_data.py | kirppu/management/commands/accounting_data.py | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from django.utils.translation import activate
from kirppu.accounting import accounting_receipt
class Command(BaseCommand):
help = 'Dump accounting CSV to standard output'
def add_arguments(self, parser):
parser.add_argument(... | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from django.utils.translation import activate
from kirppu.accounting import accounting_receipt
class Command(BaseCommand):
help = 'Dump accounting CSV to standard output'
def add_arguments(self, parser):
parser.add_argument(... | Fix accounting data dump command. | Fix accounting data dump command.
| Python | mit | jlaunonen/kirppu,jlaunonen/kirppu,jlaunonen/kirppu,jlaunonen/kirppu |
fc076d4b390c8e28fceb9613b04423ad374930e5 | config/fuzz_pox_mesh.py | config/fuzz_pox_mesh.py | from experiment_config_lib import ControllerConfig
from sts.topology import MeshTopology
from sts.control_flow import Fuzzer, Interactive
from sts.input_traces.input_logger import InputLogger
from sts.invariant_checker import InvariantChecker
from sts.simulation_state import SimulationConfig
# Use POX as our controlle... | from experiment_config_lib import ControllerConfig
from sts.topology import MeshTopology
from sts.control_flow import Fuzzer, Interactive
from sts.input_traces.input_logger import InputLogger
from sts.invariant_checker import InvariantChecker
from sts.simulation_state import SimulationConfig
# Use POX as our controlle... | Switch to normal pox instead of betta | Switch to normal pox instead of betta
| Python | apache-2.0 | jmiserez/sts,jmiserez/sts,ucb-sts/sts,ucb-sts/sts |
ca75631f513c433c6024a2f00d045f304703a85d | webapp/tests/test_browser.py | webapp/tests/test_browser.py | import os
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.utils import override_settings
from . import DATA_DIR
class BrowserTest(TestCase):
def test_browser(self):
url = reverse('graphite.browser.views.browser')
response = self.client.get(url)
... | import os
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.utils import override_settings
from . import DATA_DIR
class BrowserTest(TestCase):
def test_browser(self):
url = reverse('graphite.browser.views.browser')
... | Add tests for making sure a user is dynamically created | Add tests for making sure a user is dynamically created
| Python | apache-2.0 | EinsamHauer/graphite-web-iow,bpaquet/graphite-web,Skyscanner/graphite-web,disqus/graphite-web,synedge/graphite-web,gwaldo/graphite-web,blacked/graphite-web,cosm0s/graphite-web,brutasse/graphite-web,blacked/graphite-web,bbc/graphite-web,gwaldo/graphite-web,Invoca/graphite-web,atnak/graphite-web,deniszh/graphite-web,dhte... |
20bd5c16d5850f988e92c39db3ff041c37c83b73 | contract_sale_generation/models/abstract_contract.py | contract_sale_generation/models/abstract_contract.py | # Copyright 2017 Pesol (<http://pesol.es>)
# Copyright 2017 Angel Moya <angel.moya@pesol.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class ContractAbstractContract(models.AbstractModel):
_inherit = "contract.abstract.contract"
sale_autoconfirm = f... | # Copyright 2017 Pesol (<http://pesol.es>)
# Copyright 2017 Angel Moya <angel.moya@pesol.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class ContractAbstractContract(models.AbstractModel):
_inherit = "contract.abstract.contract"
sale_autoconfirm = f... | Align method on Odoo conventions | [14.0][IMP] contract_sale_generation: Align method on Odoo conventions
| Python | agpl-3.0 | OCA/contract,OCA/contract,OCA/contract |
6422f6057d43dfb5259028291991f39c5b81b446 | spreadflow_core/flow.py | spreadflow_core/flow.py | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from collections import defaultdict
class Flowmap(dict):
def __init__(self):
super(Flowmap, self).__init__()
self.decorators = []
self.annotations = {}
def graph(self):
... | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from collections import defaultdict, MutableMapping
class Flowmap(MutableMapping):
def __init__(self):
super(Flowmap, self).__init__()
self.annotations = {}
self.connections = {}... | Refactor Flowmap into a MutableMapping | Refactor Flowmap into a MutableMapping
| Python | mit | spreadflow/spreadflow-core,znerol/spreadflow-core |
45810cb89a26a305df0724b0f27f6136744b207f | bookshop/bookshop/urls.py | bookshop/bookshop/urls.py | """bookshop URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | """bookshop URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | Add a URL to urlpatterns for home page | Add a URL to urlpatterns for home page
| Python | mit | djangogirlstaipei/eshop,djangogirlstaipei/eshop,djangogirlstaipei/eshop,djangogirlstaipei/eshop |
5beb443d4c9cf834be03ff33a2fb01605f8feb80 | pyof/v0x01/symmetric/hello.py | pyof/v0x01/symmetric/hello.py | """Defines Hello message."""
# System imports
# Third-party imports
from pyof.foundation.base import GenericMessage
from pyof.v0x01.common.header import Header, Type
__all__ = ('Hello',)
# Classes
class Hello(GenericMessage):
"""OpenFlow Hello Message.
This message does not contain a body beyond the Ope... | """Defines Hello message."""
# System imports
# Third-party imports
from pyof.foundation.base import GenericMessage
from pyof.foundation.basic_types import BinaryData
from pyof.v0x01.common.header import Header, Type
__all__ = ('Hello',)
# Classes
class Hello(GenericMessage):
"""OpenFlow Hello Message.
... | Add optional elements in v0x01 Hello | Add optional elements in v0x01 Hello
For spec compliance. Ignore the elements as they're not used.
Fix #379
| Python | mit | kytos/python-openflow |
015d536e591d5af7e93f299e84504fe8a17f76b3 | tests.py | tests.py | import logging
import unittest
from StringIO import StringIO
class TestArgParsing(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
from script import parseargs
self.parseargs = parseargs
def test_parseargs(self):
opts, args = self.parseargs(["foo"])
... | import logging
import unittest
from StringIO import StringIO
class TestArgParsing(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
from script import parseargs
self.parseargs = parseargs
def test_parseargs(self):
opts, args = self.parseargs(["foo"])
... | Test that log messages go to stderr. | Test that log messages go to stderr.
| Python | isc | whilp/python-script,whilp/python-script |
bc6001d6c25bdb5d83830e5a65fe5aea9fc1eb99 | ume/cmd.py | ume/cmd.py | # -*- coding: utf-8 -*-
import logging as l
import argparse
from ume.utils import (
save_mat,
dynamic_load,
)
def parse_args():
p = argparse.ArgumentParser(
description='CLI interface UME')
p.add_argument('--config', dest='inifile', default='config.ini')
subparsers = p.add_subparsers(
... | # -*- coding: utf-8 -*-
import logging as l
import argparse
import os
from ume.utils import (
save_mat,
dynamic_load,
)
def parse_args():
p = argparse.ArgumentParser(
description='CLI interface UME')
p.add_argument('--config', dest='inifile', default='config.ini')
subparsers = p.add_subp... | Add init function to create directories | Add init function to create directories
| Python | mit | smly/ume,smly/ume,smly/ume,smly/ume |
1b75fe13249eba8d951735ad422dc512b1e28caf | test/test_all_stores.py | test/test_all_stores.py | import store_fixture
import groundstation.store
class TestGitStore(store_fixture.StoreTestCase):
storeClass = groundstation.store.git_store.GitStore
| import os
import store_fixture
import groundstation.store
class TestGitStore(store_fixture.StoreTestCase):
storeClass = groundstation.store.git_store.GitStore
def test_creates_required_dirs(self):
for d in groundstation.store.git_store.GitStore.required_dirs:
path = os.path.join(self.pat... | Add testcase for database initialization | Add testcase for database initialization
| Python | mit | richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation |
2f9a4029e909f71539f3b7326b867e27386c3378 | tests/interface_test.py | tests/interface_test.py | import unittest
import aiozmq
class ZmqTransportTests(unittest.TestCase):
def test_interface(self):
tr = aiozmq.ZmqTransport()
self.assertRaises(NotImplementedError, tr.write, [b'data'])
self.assertRaises(NotImplementedError, tr.abort)
self.assertRaises(NotImplementedError, tr.get... | import unittest
import aiozmq
class ZmqTransportTests(unittest.TestCase):
def test_interface(self):
tr = aiozmq.ZmqTransport()
self.assertRaises(NotImplementedError, tr.write, [b'data'])
self.assertRaises(NotImplementedError, tr.abort)
self.assertRaises(NotImplementedError, tr.get... | Add missing tests for interfaces | Add missing tests for interfaces
| Python | bsd-2-clause | MetaMemoryT/aiozmq,claws/aiozmq,asteven/aiozmq,aio-libs/aiozmq |
5b3d26b6c9256f869d3bc08dfa00bf9b8de58f85 | tests/test_cli_parse.py | tests/test_cli_parse.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Dominik Gresch <greschd@gmx.ch>
import os
import pytest
import tempfile
from click.testing import CliRunner
import tbmodels
from tbmodels._cli import cli
from parameters import SAMPLES_DIR
@pytest.mark.parametrize('prefix', ['silicon', 'bi'])
def test_cli_p... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Dominik Gresch <greschd@gmx.ch>
import os
import pytest
import tempfile
from click.testing import CliRunner
import tbmodels
from tbmodels._cli import cli
from parameters import SAMPLES_DIR
@pytest.mark.parametrize('prefix', ['silicon', 'bi'])
def test_cli_p... | Change from TemporaryDirectory to NamedTemporaryFile | Change from TemporaryDirectory to NamedTemporaryFile
| Python | apache-2.0 | Z2PackDev/TBmodels,Z2PackDev/TBmodels |
62cee7d5a625bb3515eddaddbe940239a41ba31c | rest_framework_msgpack/parsers.py | rest_framework_msgpack/parsers.py | import decimal
import msgpack
from dateutil.parser import parse
from rest_framework.parsers import BaseParser
from rest_framework.exceptions import ParseError
class MessagePackDecoder(object):
def decode(self, obj):
if '__class__' in obj:
decode_func = getattr(self, 'decode_%s' % obj['__clas... | import decimal
import msgpack
from dateutil.parser import parse
from django.utils.six import text_type
from rest_framework.parsers import BaseParser
from rest_framework.exceptions import ParseError
class MessagePackDecoder(object):
def decode(self, obj):
if '__class__' in obj:
decode_func =... | Use six.text_type for python3 compat | Use six.text_type for python3 compat | Python | bsd-3-clause | juanriaza/django-rest-framework-msgpack |
19bae697bc6e017a97eef77d1425d1ccfbe27ff6 | vprof/__main__.py | vprof/__main__.py | """Visual profiler for Python."""
import argparse
import functools
import json
import profile
import stats_server
import subprocess
import sys
_MODULE_DESC = 'Python visual profiler.'
_HOST = 'localhost'
_PORT = 8000
def main():
parser = argparse.ArgumentParser(description=_MODULE_DESC)
parser.add_argument('... | """Visual profiler for Python."""
import argparse
import functools
import json
import profile
import stats_server
import subprocess
import sys
_MODULE_DESC = 'Python visual profiler.'
_HOST = 'localhost'
_PORT = 8000
_PROFILE_MAP = {
'c': profile.CProfile
}
def main():
parser = argparse.ArgumentParser(descri... | Add profilers selection as CLI option. | Add profilers selection as CLI option.
| Python | bsd-2-clause | nvdv/vprof,nvdv/vprof,nvdv/vprof |
5e7cce09a6e6a847dad1714973fddb53d60c4c3f | yawf_sample/simple/models.py | yawf_sample/simple/models.py | from django.db import models
import reversion
from yawf.revision import RevisionModelMixin
class WINDOW_OPEN_STATUS:
MINIMIZED = 'minimized'
MAXIMIZED = 'maximized'
NORMAL = 'normal'
types = (MINIMIZED, MAXIMIZED, NORMAL)
choices = zip(types, types)
@reversion.register
class Window(RevisionMo... | from django.db import models
import reversion
from yawf.revision import RevisionModelMixin
class WINDOW_OPEN_STATUS:
MINIMIZED = 'minimized'
MAXIMIZED = 'maximized'
NORMAL = 'normal'
types = (MINIMIZED, MAXIMIZED, NORMAL)
choices = zip(types, types)
class Window(RevisionModelMixin, models.Mod... | Fix reversion register in sample app | Fix reversion register in sample app
| Python | mit | freevoid/yawf |
d970f2e4dc1d040bd352a68f6ebe4d3df93d19f7 | web/celSearch/api/scripts/query_wikipedia.py | web/celSearch/api/scripts/query_wikipedia.py | '''
Script used to query Wikipedia for summary of object
'''
import sys
import wikipedia
def main():
# Check that we have the right number of arguments
if (len(sys.argv) != 2):
print 'Incorrect number of arguments; please pass in only one string that contains the subject'
return 'Banana'
print wikipedia... | '''
Script used to query Wikipedia for summary of object
'''
import sys
import wikipedia
import nltk
def main():
# Check that we have the right number of arguments
if (len(sys.argv) != 2):
print 'Incorrect number of arguments; please pass in only one string that contains the query'
return 'Banana'
# Ge... | Send query from android device to server | Send query from android device to server
| Python | apache-2.0 | christopher18/Celsearch,christopher18/Celsearch,christopher18/Celsearch |
d15f6df74b8fe188a7a80c3491aeec62c35ce415 | policy.py | policy.py | from __future__ import unicode_literals
class PolicyError(RuntimeError):
def __init__(self, message, url):
self.message = message
self.url = url
def __str__(self):
return "{}: {}".format(self.message, self.url)
class RedirectLimitPolicy(object):
def __init__(self, max_redirects):... | from __future__ import unicode_literals
class PolicyError(RuntimeError):
def __init__(self, message, url):
self.message = message
self.url = url
def __str__(self):
return "{}: {}".format(self.message, self.url)
class RedirectLimitPolicy(object):
def __init__(self, max_redirects):... | Check for the first part of the version string | Check for the first part of the version string
Older CentOS Linux images only used the xxxx part of the full xxxx.yy
version string from Atlas.
| Python | mit | lpancescu/atlas-lint |
c7ba0ecbbe263fbf7378edbc45fcbbefb150a8fb | tests/test_probabilistic_interleave_speed.py | tests/test_probabilistic_interleave_speed.py | import interleaving as il
import numpy as np
import pytest
np.random.seed(0)
from .test_methods import TestMethods
class TestProbabilisticInterleaveSpeed(TestMethods):
def test_interleave(self):
r1 = list(range(100))
r2 = list(range(100, 200))
for i in range(1000):
method = il.... | import interleaving as il
import numpy as np
import pytest
np.random.seed(0)
from .test_methods import TestMethods
class TestProbabilisticInterleaveSpeed(TestMethods):
def test_interleave(self):
r1 = list(range(100))
r2 = list(range(50, 150))
r3 = list(range(100, 200))
r4 = list(ra... | Add tests for measuring the speed of probabilistic interleaving | Add tests for measuring the speed of probabilistic interleaving
| Python | mit | mpkato/interleaving |
2965891b46e89e0d7222ec16a2327f2bdef86f52 | chemex/util.py | chemex/util.py | """The util module contains a variety of utility functions."""
import configparser
import sys
def read_cfg_file(filename):
"""Read and parse the experiment configuration file with configparser."""
config = configparser.ConfigParser(inline_comment_prefixes=("#", ";"))
config.optionxform = str
try:
... | """The util module contains a variety of utility functions."""
import configparser
import sys
def listfloat(text):
return [float(val) for val in text.strip("[]").split(",")]
def read_cfg_file(filename=None):
"""Read and parse the experiment configuration file with configparser."""
config = configparser... | Update settings for reading config files | Update settings for reading config files
Update the definition of comments, now only allowing the use of "#"
for comments. Add a converter function to parse list of floats,
such as:
list_of_floats = [1.0, 2.0, 3.0]
| Python | bsd-3-clause | gbouvignies/chemex |
b6e9e37350a4b435df00a54b2ccd9da70a4db788 | nogotofail/mitm/util/ip.py | nogotofail/mitm/util/ip.py | r'''
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | r'''
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | Fix local interface addr parsing | Fix local interface addr parsing
On Fedora 21 the format of ifconfig is a little different.
Fixes #17
| Python | apache-2.0 | google/nogotofail,leasual/nogotofail,mkenne11/nogotofail,joshcooper/nogotofail,digideskio/nogotofail,mkenne11/nogotofail-pii,joshcooper/nogotofail,google/nogotofail,mkenne11/nogotofail,digideskio/nogotofail,leasual/nogotofail,mkenne11/nogotofail-pii |
79b5227deaf830a9ce51d18387372fe6cf88e51d | monasca_setup/detection/plugins/neutron.py | monasca_setup/detection/plugins/neutron.py | import monasca_setup.detection
class Neutron(monasca_setup.detection.ServicePlugin):
"""Detect Neutron daemons and setup configuration to monitor them.
"""
def __init__(self, template_dir, overwrite=True, args=None):
service_params = {
'args': args,
'template_dir': templ... | import monasca_setup.detection
class Neutron(monasca_setup.detection.ServicePlugin):
"""Detect Neutron daemons and setup configuration to monitor them.
"""
def __init__(self, template_dir, overwrite=True, args=None):
service_params = {
'args': args,
'template_dir': templ... | Remove vendor-specific paths on LBaaS agent executables | Remove vendor-specific paths on LBaaS agent executables
The monasca agent uses simple string matching in the process detection
plugin. This can result in false positive matches in the case where a
process name appears elsehwere in the "ps" output. In particular,
"neutron-lbaas-agent" is used for both process and log... | Python | bsd-3-clause | sapcc/monasca-agent,sapcc/monasca-agent,sapcc/monasca-agent |
91f5db6ddf6e26cec27917109689c200498dc85f | statsmodels/formula/try_formula.py | statsmodels/formula/try_formula.py | import statsmodels.api as sm
import numpy as np
star98 = sm.datasets.star98.load_pandas().data
formula = 'SUCCESS ~ LOWINC + PERASIAN + PERBLACK + PERHISP + PCTCHRT '
formula += '+ PCTYRRND + PERMINTE*AVYRSEXP*AVSALK + PERSPENK*PTRATIO*PCTAF'
dta = star98[["NABOVE", "NBELOW", "LOWINC", "PERASIAN", "PERBLACK", "PERHI... | import statsmodels.api as sm
import numpy as np
star98 = sm.datasets.star98.load_pandas().data
formula = 'SUCCESS ~ LOWINC + PERASIAN + PERBLACK + PERHISP + PCTCHRT '
formula += '+ PCTYRRND + PERMINTE*AVYRSEXP*AVSALK + PERSPENK*PTRATIO*PCTAF'
dta = star98[["NABOVE", "NBELOW", "LOWINC", "PERASIAN", "PERBLACK", "PERHI... | Add example for injecting user transform | ENH: Add example for injecting user transform
| Python | bsd-3-clause | bert9bert/statsmodels,YihaoLu/statsmodels,cbmoore/statsmodels,hlin117/statsmodels,bavardage/statsmodels,detrout/debian-statsmodels,hainm/statsmodels,statsmodels/statsmodels,jstoxrocky/statsmodels,statsmodels/statsmodels,astocko/statsmodels,DonBeo/statsmodels,bzero/statsmodels,Averroes/statsmodels,gef756/statsmodels,jos... |
5e7c99844a0687125e34104cf2c7ee87ca69c0de | mopidy_soundcloud/__init__.py | mopidy_soundcloud/__init__.py | import os
from mopidy import config, ext
from mopidy.exceptions import ExtensionError
__version__ = "2.1.0"
class Extension(ext.Extension):
dist_name = "Mopidy-SoundCloud"
ext_name = "soundcloud"
version = __version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(_... | import pathlib
from mopidy import config, ext
from mopidy.exceptions import ExtensionError
__version__ = "2.1.0"
class Extension(ext.Extension):
dist_name = "Mopidy-SoundCloud"
ext_name = "soundcloud"
version = __version__
def get_default_config(self):
return config.read(pathlib.Path(__fil... | Use pathlib to read ext.conf | Use pathlib to read ext.conf
| Python | mit | mopidy/mopidy-soundcloud |
94ec7d4816d2a243b8a2b0a0f2dc8a55a7347122 | tests/saltunittest.py | tests/saltunittest.py | """
This file provides a single interface to unittest objects for our
tests while supporting python < 2.7 via unittest2.
If you need something from the unittest namespace it should be
imported here from the relevant module and then imported into your
test from here
"""
# Import python libs
import os
import sys
# sup... | """
This file provides a single interface to unittest objects for our
tests while supporting python < 2.7 via unittest2.
If you need something from the unittest namespace it should be
imported here from the relevant module and then imported into your
test from here
"""
# Import python libs
import os
import sys
# sup... | Make an error go to stderr and remove net 1 LOC | Make an error go to stderr and remove net 1 LOC
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt |
b6737b91938d527872eff1d645a205cacf94e15d | tests/test_gobject.py | tests/test_gobject.py | # -*- Mode: Python -*-
import unittest
import gobject
import testhelper
class TestGObjectAPI(unittest.TestCase):
def testGObjectModule(self):
obj = gobject.GObject()
self.assertEquals(obj.__module__,
'gobject._gobject')
self.assertEquals(obj.__grefcount__, 1)
... | # -*- Mode: Python -*-
import unittest
import gobject
import testhelper
class TestGObjectAPI(unittest.TestCase):
def testGObjectModule(self):
obj = gobject.GObject()
self.assertEquals(obj.__module__,
'gobject._gobject')
class TestReferenceCounting(unittest.TestCase):
... | Add a test to check for regular object reference count | Add a test to check for regular object reference count
https://bugzilla.gnome.org/show_bug.cgi?id=639949
| Python | lgpl-2.1 | alexef/pygobject,Distrotech/pygobject,davidmalcolm/pygobject,davibe/pygobject,jdahlin/pygobject,choeger/pygobject-cmake,MathieuDuponchelle/pygobject,choeger/pygobject-cmake,davidmalcolm/pygobject,davibe/pygobject,pexip/pygobject,Distrotech/pygobject,alexef/pygobject,sfeltman/pygobject,jdahlin/pygobject,GNOME/pygobject,... |
5cf0b19d67a667d4e0d48a12f0ee94f3387cfa37 | tests/test_helpers.py | tests/test_helpers.py | # -*- encoding: utf-8 -*-
#
# Copyright 2013 Jay Pipes
#
# 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 la... | # -*- encoding: utf-8 -*-
#
# Copyright 2013 Jay Pipes
#
# 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 la... | Add test to ensure talons.helpers.import_function returns a callable | Add test to ensure talons.helpers.import_function returns a callable
| Python | apache-2.0 | talons/talons,jaypipes/talons |
73dfb1fc4ff62705f37b1128e0684e88be416d8f | src/webmention/models.py | src/webmention/models.py | from django.db import models
class WebMentionResponse(models.Model):
response_body = models.TextField()
response_to = models.URLField()
source = models.URLField()
reviewed = models.BooleanField(default=False)
current = models.BooleanField(default=True)
date_created = models.DateTimeField(auto_... | from django.db import models
class WebMentionResponse(models.Model):
response_body = models.TextField()
response_to = models.URLField()
source = models.URLField()
reviewed = models.BooleanField(default=False)
current = models.BooleanField(default=True)
date_created = models.DateTimeField(auto_... | Update deprecated allow_tags to format_html | Update deprecated allow_tags to format_html
| Python | mit | easy-as-python/django-webmention |
e612a742caeedf5398522365c984a39c505e7872 | warehouse/exceptions.py | warehouse/exceptions.py | class FailedSynchronization(Exception):
pass
class SynchronizationTimeout(Exception):
"""
A synchronization for a particular project took longer than the timeout.
"""
| from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
class FailedSynchronization(Exception):
pass
class SynchronizationTimeout(Exception):
"""
A synchronization for a particular project took longer than the timeout.
"""
| Add the standard __future__ imports | Add the standard __future__ imports
| Python | bsd-2-clause | davidfischer/warehouse |
34c427200c6ab50fb64fa0d6116366a8fa9186a3 | netman/core/objects/bond.py | netman/core/objects/bond.py | # Copyright 2015 Internap.
#
# 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, so... | # Copyright 2015 Internap.
#
# 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, so... | Support deprecated use of the interface property of Bond. | Support deprecated use of the interface property of Bond.
| Python | apache-2.0 | idjaw/netman,internaphosting/netman,internap/netman,godp1301/netman,mat128/netman,lindycoder/netman |
ab06e871a6c820845da2d4d60bb6b1874350cf16 | circuits/web/__init__.py | circuits/web/__init__.py | # Module: __init__
# Date: 3rd October 2008
# Author: James Mills, prologic at shortcircuit dot net dot au
"""Circuits Library - Web
circuits.web contains the circuits full stack web server that is HTTP
and WSGI compliant.
"""
from loggers import Logger
from core import Controller
from sessions import Sessions
from... | # Module: __init__
# Date: 3rd October 2008
# Author: James Mills, prologic at shortcircuit dot net dot au
"""Circuits Library - Web
circuits.web contains the circuits full stack web server that is HTTP
and WSGI compliant.
"""
from utils import url
from loggers import Logger
from sessions import Sessions
from core ... | Add url and expose to this namesapce | circuits.web: Add url and expose to this namesapce
| Python | mit | eriol/circuits,eriol/circuits,nizox/circuits,treemo/circuits,treemo/circuits,eriol/circuits,treemo/circuits |
04c92e1fe7efa38f7d99d501286d3b7e627e73ca | scripts/slave/chromium/dart_buildbot_run.py | scripts/slave/chromium/dart_buildbot_run.py | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""Entry point for the dartium buildbots.
This script is called from buildbot and reports results using the buildbot
annotation sc... | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""Entry point for the dartium buildbots.
This script is called from buildbot and reports results using the buildbot
annotation sc... | Use exitcode of running the annotated steps script | Use exitcode of running the annotated steps script
If there is an error in the annotated steps we will still have a green bot!!!!
Example:
http://chromegw.corp.google.com/i/client.dart/builders/dartium-lucid64-full-be/builds/3566/steps/annotated_steps/logs/stdio
TBR=whesse
Review URL: https://codereview.chromium.or... | Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build |
fa7aecae90026037c9f5ce2ffef37184ee83f679 | nova/objects/__init__.py | nova/objects/__init__.py | # Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | # Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | Use Instance Objects for Start/Stop | Use Instance Objects for Start/Stop
This patch makes the start and stop operations use the Instance
object instead of passing SQLA-derived dicts over RPC. Until
something more sophisticated is needed (and developed), it also
adds a nova.object.register_all() function which just triggers
imports of all the object model... | Python | apache-2.0 | citrix-openstack-build/oslo.versionedobjects,openstack/oslo.versionedobjects |
186a2c3f235264c3c71396efcbb8a33924758db9 | scrape.py | scrape.py | import discord
import asyncio
from tqdm import tqdm
import argparse
parser = argparse.ArgumentParser(description='Discord channel scraper')
requiredNamed = parser.add_argument_group('Required arguments:')
requiredNamed.add_argument('-c', '--channel', type=str, help='Channel to scrape. Requires the channel ID.',... | import discord
import asyncio
from tqdm import tqdm
import argparse
parser = argparse.ArgumentParser(description='Discord channel scraper')
requiredNamed = parser.add_argument_group('Required arguments:')
requiredNamed.add_argument('-c', '--channel', type=str, help='Channel to scrape. Requires the channel ID.',... | Update to use token instead of email+pass | Update to use token instead of email+pass
| Python | mit | suclearnub/discordgrapher |
3ddad0538430499182c583a0a7f877884038c0a5 | Lib/test/test_symtable.py | Lib/test/test_symtable.py | from test.test_support import vereq, TestFailed
import symtable
symbols = symtable.symtable("def f(x): return x", "?", "exec")
## XXX
## Test disabled because symtable module needs to be rewritten for new compiler
##vereq(symbols[0].name, "global")
##vereq(len([ste for ste in symbols.values() if ste.name == "f"]), ... | from test import test_support
import symtable
import unittest
## XXX
## Test disabled because symtable module needs to be rewritten for new compiler
##vereq(symbols[0].name, "global")
##vereq(len([ste for ste in symbols.values() if ste.name == "f"]), 1)
### Bug tickler: SyntaxError file name correct whether error ... | Use unittest and make sure a few other cases don't crash | Use unittest and make sure a few other cases don't crash
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator |
f559001d2c46fade2d9b62f9cb7a3f8053e8b80f | OMDB_api_scrape.py | OMDB_api_scrape.py | #!/usr/bin/python3
# OMDB_api_scrape.py - parses a movie and year from the command line, grabs the
# JSON and saves a copy for later
import json, requests, sys, os
URL_BASE = 'http://www.omdbapi.com/?'
if len(sys.argv) > 1:
# Get address from command line.
mTitle = '+'.join(sys.argv[1:-1])
... | #!/usr/bin/python3
# OMDB_api_scrape.py - parses a movie and year from the command line, grabs the
# xml and saves a copy for later
import requests, sys, os
import lxml.etree
URL_BASE = 'http://www.omdbapi.com/?'
if len(sys.argv) > 1:
# Get address from command line.
mTitle = '+'.join(sys.a... | Convert OMDB scrapper to grab xml | Convert OMDB scrapper to grab xml
| Python | mit | samcheck/PyMedia,samcheck/PyMedia,samcheck/PyMedia |
8ac20f5bec2d94e71b92e48568d18fd74be4e5d4 | fabfile.py | fabfile.py | from fabric.api import task, local
@task
def up():
"""
Deploy new release to pypi. Using twine util
"""
local("rm -rf dist")
local("rm -rf pgup.egg-info")
local("python ./setup.py sdist")
local("twine upload dist/{}".format(local("ls dist", capture=True).strip()))
@task
def docs():
... | from fabric.api import task, local, execute
@task
def up():
"""
Deploy new release to pypi. Using twine util
"""
local("rm -rf dist")
local("rm -rf pgup.egg-info")
local("python ./setup.py sdist")
local("twine upload dist/{}".format(local("ls dist", capture=True).strip()))
execute(s... | Add fab task for syncing pgup with mezzo | Add fab task for syncing pgup with mezzo
| Python | mit | stepan-perlov/pgup |
c3c26c15895a192fba22482306182950c0ccd57c | python/simple-linked-list/simple_linked_list.py | python/simple-linked-list/simple_linked_list.py | class Node(object):
def __init__(self, value):
pass
def value(self):
pass
def next(self):
pass
class LinkedList(object):
def __init__(self, values=[]):
self.size = 0
for value in values:
self.push(value)
def __len__(self):
return self.... | class Node(object):
def __init__(self, value):
pass
def value(self):
pass
def next(self):
pass
class LinkedList(object):
def __init__(self, values=[]):
self._size = 0
self._head = None
for value in values:
self.push(value)
def __len__... | Mark instance variables private with leading _ | Mark instance variables private with leading _
| Python | mit | rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism |
fa609681c2732e655cde9075182af918983ccc1f | photutils/utils/_misc.py | photutils/utils/_misc.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module provides tools to return the installed astropy and photutils
versions.
"""
from datetime import datetime, timezone
def _get_version_info():
"""
Return a dictionary of the installed version numbers for photutils
and its depende... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module provides tools to return the installed astropy and photutils
versions.
"""
from datetime import datetime, timezone
import sys
def _get_version_info():
"""
Return a dictionary of the installed version numbers for photutils
and ... | Add all optional dependencies to version info dict | Add all optional dependencies to version info dict
| Python | bsd-3-clause | larrybradley/photutils,astropy/photutils |
a346eb2b19f3a0b72dc6565e9d0c4fabf3c5784a | migrations/versions/0014_add_template_version.py | migrations/versions/0014_add_template_version.py | """empty message
Revision ID: 0014_add_template_version
Revises: 0013_add_loadtest_client
Create Date: 2016-05-11 16:00:51.478012
"""
# revision identifiers, used by Alembic.
revision = '0014_add_template_version'
down_revision = '0013_add_loadtest_client'
from alembic import op
import sqlalchemy as sa
from sqlalch... | """empty message
Revision ID: 0014_add_template_version
Revises: 0013_add_loadtest_client
Create Date: 2016-05-11 16:00:51.478012
"""
# revision identifiers, used by Alembic.
revision = '0014_add_template_version'
down_revision = '0013_add_loadtest_client'
from alembic import op
import sqlalchemy as sa
from sqlalch... | Add a update query to fix templates_history where the created_by_id is missing. | Add a update query to fix templates_history where the created_by_id is missing.
| Python | mit | alphagov/notifications-api,alphagov/notifications-api |
df000e724ce1f307a478fcf4790404183df13610 | _setup_database.py | _setup_database.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setup.create_teams import migrate_teams
from setup.create_divisions import create_divisions
if __name__ == '__main__':
# migrating teams from json file to database
migrate_teams(simulation=True)
# creating divisions from division configuration file
c... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setup.create_teams import migrate_teams
from setup.create_divisions import create_divisions
from setup.create_players import migrate_players
if __name__ == '__main__':
# migrating teams from json file to database
migrate_teams(simulation=True)
# creating... | Include player data migration in setup | Include player data migration in setup
| Python | mit | leaffan/pynhldb |
c0d9a94899af84e8a075cfc7cfb054a934470e3a | static_precompiler/tests/test_templatetags.py | static_precompiler/tests/test_templatetags.py | import django.template
import django.template.loader
import pretend
def test_compile_filter(monkeypatch):
compile_static = pretend.call_recorder(lambda source_path: "compiled")
monkeypatch.setattr("static_precompiler.utils.compile_static", compile_static)
template = django.template.loader.get_template_fr... | import django.template
import pretend
def test_compile_filter(monkeypatch):
compile_static = pretend.call_recorder(lambda source_path: "compiled")
monkeypatch.setattr("static_precompiler.utils.compile_static", compile_static)
template = django.template.Template("""{% load compile_static %}{{ "source"|com... | Fix tests for Django 1.8 | Fix tests for Django 1.8
| Python | mit | liumengjun/django-static-precompiler,liumengjun/django-static-precompiler,liumengjun/django-static-precompiler,liumengjun/django-static-precompiler,jaheba/django-static-precompiler,liumengjun/django-static-precompiler,jaheba/django-static-precompiler,jaheba/django-static-precompiler,jaheba/django-static-precompiler |
eaa4de2ecbcf29c9e56ebf2fa69099055e469fbc | tests/test_conversion.py | tests/test_conversion.py | from asciisciit import conversions as conv
import numpy as np
def test_lookup_method_equivalency():
img = np.random.randint(0, 255, (300,300), dtype=np.uint8)
pil_ascii = conv.apply_lut_pil(img)
np_ascii = conv.apply_lut_numpy(img)
assert(pil_ascii == np_ascii)
pil_ascii = conv.apply_lut_pil(img... | import itertools
from asciisciit import conversions as conv
import numpy as np
import pytest
@pytest.mark.parametrize("invert,equalize,lut,lookup_func",
itertools.product((True, False),
(True, False),
("simp... | Add tests to minimally exercise basic conversion functionality | Add tests to minimally exercise basic conversion functionality
| Python | mit | derricw/asciisciit |
a0420b066e0a5064ebe0944a16348debf107a9a4 | speech.py | speech.py | """Export long monologues for Nao.
Functions:
introduction -- Make Nao introduce itself.
"""
import time
from say import say
def introduction(tts):
"""Make Nao introduce itself.
Keyword arguments:
tts - Nao proxy.
"""
say("Hello world!", tts)
say("Computer Science is one of the coolest subj... | """Export long monologues for Nao.
Functions:
introduction -- Make Nao introduce itself.
"""
import time
from say import say
def introduction(tts):
"""Make Nao introduce itself.
Keyword arguments:
tts - Nao proxy.
"""
say("Hello world!", tts)
say("I'm Leyva and I will teach you how to progr... | Make Nao say its name and the programming language | Make Nao say its name and the programming language
| Python | mit | AliGhahraei/nao-classroom |
40122e169e6a887caa6371a0ff3029c35ce265d5 | third_party/node/node.py | third_party/node/node.py | #!/usr/bin/env vpython
# Copyright 2017 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.
from os import path as os_path
import platform
import subprocess
import sys
import os
def GetBinaryPath():
return os_path.join(
... | #!/usr/bin/env vpython
# Copyright 2017 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.
from os import path as os_path
import platform
import subprocess
import sys
import os
def GetBinaryPath():
return os_path.join(
... | Fix line ending printing on Python 3 | Fix line ending printing on Python 3
To reflect the changes in
https://chromium-review.googlesource.com/c/chromium/src/+/2896248/8/third_party/node/node.py
R=993fcadce4d04090da2fefd557a0995e7966c8d5@chromium.org
Bug: none
Change-Id: I25ba29042f537bfef57fba93115be2c194649864
Reviewed-on: https://chromium-review.googl... | Python | bsd-3-clause | ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend |
91b0bcad27f12c29681235079960ee272275e0bd | src/main/python/dlfa/solvers/__init__.py | src/main/python/dlfa/solvers/__init__.py | from .nn_solver import NNSolver
from .lstm_solver import LSTMSolver
from .tree_lstm_solver import TreeLSTMSolver
from .memory_network import MemoryNetworkSolver
from .differentiable_search import DifferentiableSearchSolver
concrete_solvers = { # pylint: disable=invalid-name
'LSTMSolver': LSTMSolver,
'... | from .nn_solver import NNSolver
from .lstm_solver import LSTMSolver
from .tree_lstm_solver import TreeLSTMSolver
from .memory_network import MemoryNetworkSolver
from .differentiable_search import DifferentiableSearchSolver
from .multiple_choice_memory_network import MultipleChoiceMemoryNetworkSolver
concrete_solvers =... | Add MCMemoryNetwork as a usable solver | Add MCMemoryNetwork as a usable solver
| Python | apache-2.0 | allenai/deep_qa,matt-gardner/deep_qa,DeNeutoy/deep_qa,allenai/deep_qa,DeNeutoy/deep_qa,matt-gardner/deep_qa |
0fd6a6e3281bc49addd1131ae30b1985b9da30f9 | tests/benchmark/plugins/clear_buffer_cache.py | tests/benchmark/plugins/clear_buffer_cache.py | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | Update clear buffer cache plugin to only flush page cache. | Update clear buffer cache plugin to only flush page cache.
More detail: http://linux-mm.org/Drop_Caches
Change-Id: I7fa675ccdc81f375d88e9cfab330fca3bc983ec8
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1157
Reviewed-by: Alex Behm <fe1626037acfc2dc542d2aa723a6d14f2464a20c@cloudera.com>
Reviewed-by: Lenni Kuff <724... | Python | apache-2.0 | brightchen/Impala,rampage644/impala-cut,brightchen/Impala,XiaominZhang/Impala,caseyching/Impala,cgvarela/Impala,ImpalaToGo/ImpalaToGo,caseyching/Impala,tempbottle/Impala,cchanning/Impala,scalingdata/Impala,tempbottle/Impala,AtScaleInc/Impala,scalingdata/Impala,gistic/PublicSpatialImpala,rampage644/impala-cut,bowlofstew... |
b94458b5dc184798580ade159ace700a46ab5877 | enigma.py | enigma.py | import string
class Steckerbrett:
def __init__(self):
pass
class Umkehrwalze:
def __init__(self, wiring):
self.wiring = wiring
def encode(self, letter):
return self.wiring[string.ascii_uppercase.index(letter)]
class Walzen:
def __init__(self):
pass
class Enigma:
... | import string
class Steckerbrett:
def __init__(self):
pass
class Umkehrwalze:
def __init__(self, wiring):
self.wiring = wiring
def encode(self, letter):
return self.wiring[string.ascii_uppercase.index(letter)]
class Walzen:
def __init__(self, notch, wiring):
assert... | Initialize rotors with notches and wiring data | Initialize rotors with notches and wiring data
| Python | mit | ranisalt/enigma |
e650c319b109ca554c2d66f2d9446ef62440cc0f | anna/model/utils.py | anna/model/utils.py | import tensorflow as tf
def rnn_cell(num_units, dropout, mode, residual=False, name=None, reuse=None):
dropout = dropout if mode == tf.contrib.learn.ModeKeys.TRAIN else 0.0
cell = tf.nn.rnn_cell.GRUCell(num_units, name=name, reuse=reuse)
if dropout > 0.0:
keep_prop = (1.0 - dropout)
cell... | import tensorflow as tf
def rnn_cell(num_units, dropout, mode, residual=False, name=None, reuse=None):
dropout = dropout if mode == tf.estimator.ModeKeys.TRAIN else 0.0
cell = tf.nn.rnn_cell.GRUCell(num_units, name=name, reuse=reuse)
if dropout > 0.0:
keep_prop = (1.0 - dropout)
cell = t... | Fix bug in RNN dropout | Fix bug in RNN dropout
| Python | mit | jpbottaro/anna |
7add1c5a43c6bef29613167ca430ad7ff0e26670 | src/ocspdash/web/blueprints/ui.py | src/ocspdash/web/blueprints/ui.py | # -*- coding: utf-8 -*-
import base64
import json
from nacl.encoding import URLSafeBase64Encoder
import nacl.exceptions
import nacl.signing
from flask import Blueprint, abort, current_app, render_template, request
from nacl.signing import VerifyKey
__all__ = [
'ui',
]
ui = Blueprint('ui', __name__)
@ui.route(... | # -*- coding: utf-8 -*-
# import nacl.exceptions
# import nacl.signing
from flask import Blueprint, current_app, render_template
# from nacl.encoding import URLSafeBase64Encoder
# from nacl.signing import VerifyKey
__all__ = [
'ui',
]
ui = Blueprint('ui', __name__)
@ui.route('/')
def home():
"""Show the u... | Remove /submit endpoint from UI blueprint for now | Remove /submit endpoint from UI blueprint for now
| Python | mit | scolby33/OCSPdash,scolby33/OCSPdash,scolby33/OCSPdash |
d4356b7aa879a345939c1885742efc3deceeb08f | lib/aquilon/__init__.py | lib/aquilon/__init__.py | # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2013 Contributor
#
# 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 Li... | # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2013 Contributor
#
# 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 Li... | Make aquilon a namespace package | Make aquilon a namespace package
In the future we may want to import the protocols as "from
aquilon.protocols import blah", and that needs both the broker and the
protocols to be marked as namespace packages.
Change-Id: Ib3b712e727b0dd176c231a396bec4e7168a0039e
Reviewed-by: Dave Reeve <6a84ee3ae0690d4584b99406fb30763... | Python | apache-2.0 | guillaume-philippon/aquilon,quattor/aquilon,quattor/aquilon,guillaume-philippon/aquilon,guillaume-philippon/aquilon,quattor/aquilon |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.