commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
446d19e6e63e110b10cccbe3407cbd86205f2101 | bump version number | aureooms/sak,aureooms/sak | setup.py | setup.py |
try : from setuptools import setup
except ImportError : from distutils.core import setup
setup (
name = 'sak' , version = '0.5.0' ,
description = 'Swiss Army Knife',
long_description = 'sak is a module, submodule and function based tool' ,
author = 'aureooms' ,
author_email = 'aurelien.ooms@gmail.com' ,
url ... |
try : from setuptools import setup
except ImportError : from distutils.core import setup
setup (
name = 'sak' , version = '0.4.2' ,
description = 'Swiss Army Knife',
long_description = 'sak is a module, submodule and function based tool' ,
author = 'aureooms' ,
author_email = 'aurelien.ooms@gmail.com' ,
url ... | agpl-3.0 | Python |
047108836154ad9153ae009c8a0576329547a8bf | Update version from 0.4.1 to 0.4.2. | ABI-Software/MeshParser | setup.py | setup.py | from setuptools import setup, find_packages
dependencies = []
long_description = """A Python library that parses different mesh format files into a Python dict
ready for consumption by other libraries.
"""
setup(name=u'meshparser',
version='0.4.2',
description='A Small Python library for parsing files t... | from setuptools import setup, find_packages
dependencies = []
long_description = """A Python library that parses different mesh format files into a Python dict
ready for consumption by other libraries.
"""
setup(name=u'meshparser',
version='0.4.1',
description='A Small Python library for parsing files t... | apache-2.0 | Python |
99356f01c38fe09dc084ad3f54cfdf3beaca63b5 | change packages to py_modules | gmega/sparmap,gmega/parmap | setup.py | setup.py | from setuptools import setup
setup(name='parmap',
version='0.1',
description='Simple parallel map implementation for Python.',
author='Giuliano Mega',
author_email='mega@spaziodati.eu',
py_modules=['parmap'],
license="LICENSE",
install_requires=[
"multiprocessing >= ... | from setuptools import setup
setup(name='parmap',
version='0.1',
description='Simple parallel map implementation for Python.',
author='Giuliano Mega',
author_email='mega@spaziodati.eu',
packages=['parmap'],
license="LICENSE",
install_requires=[
"multiprocessing >= 2.... | apache-2.0 | Python |
09c5d6fd0def4fbd909565a5dffb61a04dc0ec86 | Update version to 0.1.25 | edx/edx-val | setup.py | setup.py | #!/usr/bin/env python
import os
import sys
from setuptools import setup
PACKAGES = [
'edxval',
'edxval.migrations',
'edxval.tests',
]
def is_requirement(line):
"""
Return True if the requirement line is a package requirement;
that is, it is not blank, a comment, or editable.
"""
# Re... | #!/usr/bin/env python
import os
import sys
from setuptools import setup
PACKAGES = [
'edxval',
'edxval.migrations',
'edxval.tests',
]
def is_requirement(line):
"""
Return True if the requirement line is a package requirement;
that is, it is not blank, a comment, or editable.
"""
# Re... | agpl-3.0 | Python |
0f0c42b0d61fb0a3693fc20cd0152128c097a905 | add missing demands requirements | westerncapelabs/uopbmoh-hub,westerncapelabs/uopbmoh-hub,westerncapelabs/uopboh-hub,westerncapelabs/uopbmoh-hub | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name="uopbmoh-hub",
version="0.1",
url='http://github.com/westerncapelabs/uopbmoh-hub',
license='BSD',
author='Western Cape Labs',
author_email='devops@westerncapelabs.com',
packages=find_packages(),
include_package_data=True,
insta... | from setuptools import setup, find_packages
setup(
name="uopbmoh-hub",
version="0.1",
url='http://github.com/westerncapelabs/uopbmoh-hub',
license='BSD',
author='Western Cape Labs',
author_email='devops@westerncapelabs.com',
packages=find_packages(),
include_package_data=True,
insta... | bsd-3-clause | Python |
f3838ac01face8bece084f551481ad4c3a23ac6a | Fix Configurable to look for kwargs in entire MRO | edgedb/edgedb,edgedb/edgedb,edgedb/edgedb | edgedb/lang/common/config/configurable.py | edgedb/lang/common/config/configurable.py | ##
# Copyright (c) 2011 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##
import inspect
from .cvalue import cvalue, _no_default
__all__ = 'ConfigurableMeta', 'Configurable'
class ConfigurableMeta(type):
def __new__(mcls, name, bases, dct):
dct['__sx_configurable__'] = True
... | ##
# Copyright (c) 2011 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##
from .cvalue import cvalue, _no_default
__all__ = 'ConfigurableMeta', 'Configurable'
class ConfigurableMeta(type):
def __new__(mcls, name, bases, dct):
dct['__sx_configurable__'] = True
return super()._... | apache-2.0 | Python |
3f850922436869a8fcff4d3acc9201831b55d49f | Improve readability. | shaurz/devo | new_project_dialog.py | new_project_dialog.py | import os
import wx
from file_picker import DirPicker
class NewProjectDialog(wx.Dialog):
def __init__(self, parent, path=""):
style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
wx.Dialog.__init__(self, parent, title="New Project", style=style)
self.text_name = wx.TextCtrl(self, size=(380, ... | import os
import wx
from file_picker import DirPicker
class NewProjectDialog(wx.Dialog):
def __init__(self, parent, path=""):
style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
wx.Dialog.__init__(self, parent, title="New Project", style=style)
self.text_name = wx.TextCtrl(self, size=(380, -... | mit | Python |
28b62491218c20303268187f3d65602ab20868a5 | Add detailed comments for methods | chetankrishna08/aws-health-tools,chetankrishna08/aws-health-tools,robperc/aws-health-tools,robperc/aws-health-tools | automated-actions/AWS_RISK_CREDENTIALS_EXPOSED/lambda_functions/lookup_cloudtrail_events.py | automated-actions/AWS_RISK_CREDENTIALS_EXPOSED/lambda_functions/lookup_cloudtrail_events.py | import datetime
import collections
import boto3
cloudtrail = boto3.client('cloudtrail')
def lambda_handler(event, context):
account_id = event['account_id']
time_discovered = event['time_discovered']
username = event['username']
deleted_key = event['deleted_key']
endtime = datetime.datetime.now()... | import datetime
import collections
import boto3
cloudtrail = boto3.client('cloudtrail')
def lambda_handler(event, context):
account_id = event['account_id']
time_discovered = event['time_discovered']
username = event['username']
deleted_key = event['deleted_key']
endtime = datetime.datetime.now()... | apache-2.0 | Python |
0cc7bc679edd0d82bcb7a841c577d49662a9349f | Change path of ee_test.py script | niksu/pax,niksu/pax,niksu/pax | examples/EthernetEcho/mn_ethernet_echo.py | examples/EthernetEcho/mn_ethernet_echo.py | #!/usr/bin/env python
# coding: latin-1
# Mininet testing script for EthernetEcho
# Nik Sultana, February 2017
#
# Use of this source code is governed by the Apache 2.0 license; see LICENSE.
from mininet.net import Mininet, CLI
from scapy.all import *
import os
host_mac = "02:00:00:00:00:02"
echoer_mac = "02:00:00:0... | #!/usr/bin/env python
# coding: latin-1
# Mininet testing script for EthernetEcho
# Nik Sultana, February 2017
#
# Use of this source code is governed by the Apache 2.0 license; see LICENSE.
from mininet.net import Mininet, CLI
from scapy.all import *
import os
host_mac = "02:00:00:00:00:02"
echoer_mac = "02:00:00:0... | apache-2.0 | Python |
ad761908537b63c2d262f69a75e7b221f84e8647 | Add stub for multiple posts in school boards | opencivicdata/scrapers-ca,opencivicdata/scrapers-ca | ca_on_school_boards_english_public/__init__.py | ca_on_school_boards_english_public/__init__.py | from utils import CanadianJurisdiction
from opencivicdata.divisions import Division
from pupa.scrape import Organization
class OntarioEnglishPublicSchoolBoards(CanadianJurisdiction):
classification = 'legislature' # just to avoid clash
division_id = 'ocd-division/country:ca/province:on'
division_name = '... | from utils import CanadianJurisdiction
from opencivicdata.divisions import Division
from pupa.scrape import Organization
class OntarioEnglishPublicSchoolBoards(CanadianJurisdiction):
classification = 'legislature' # just to avoid clash
division_id = 'ocd-division/country:ca/province:on'
division_name = '... | mit | Python |
e995b1b18cf274f7c90e6d72f345a4c0f0e78ac8 | Fix project name. (#267) | forseti-security/forseti-security,thenenadx/forseti-security,forseti-security/forseti-security,felixbb/forseti-security,thenenadx/forseti-security,forseti-security/forseti-security,felixbb/forseti-security,forseti-security/forseti-security,cschnei3/forseti-security,cschnei3/forseti-security,cschnei3/forseti-security,fe... | google/cloud/security/common/gcp_type/project.py | google/cloud/security/common/gcp_type/project.py | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 | Python |
06021b4e7f768a1a7d8b5809054883cb58e0d5b3 | hide sd browser notification pop up | liveblog/liveblog,hlmnrmr/liveblog,superdesk/liveblog,superdesk/liveblog,superdesk/liveblog,hlmnrmr/liveblog,liveblog/liveblog,hlmnrmr/liveblog,hlmnrmr/liveblog,liveblog/liveblog,liveblog/liveblog,superdesk/liveblog,liveblog/liveblog | server/liveblog/auth/db.py | server/liveblog/auth/db.py | from apps.auth.db import DbAuthService
from settings import SUBSCRIPTION_LEVEL, ACCESS_SUBSCRIPTIONS_MOBILE
from superdesk.errors import SuperdeskApiError
from superdesk import get_resource_service
from apps.auth.errors import CredentialsAuthError
class AccessAuthService(DbAuthService):
def authenticate(self, cr... | from apps.auth.db import DbAuthService
from settings import SUBSCRIPTION_LEVEL, ACCESS_SUBSCRIPTIONS_MOBILE
from superdesk.errors import SuperdeskApiError
class AccessAuthService(DbAuthService):
def authenticate(self, credentials):
self._check_subscription_level()
return super().authenticate(cred... | agpl-3.0 | Python |
aaed4427c82fa0af18a79fe51112fb4e5504dcf6 | Add argparse module usage | seleznev/firefox-complete-theme-build-system | src/make-xpi.py | src/make-xpi.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Usage:
./make-xpi.py
./make-xpi.py theme
./make-xpi.py extension
./m... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Usage:
./make-xpi.py
./make-xpi.py theme
./make-xpi.py extension
./m... | mpl-2.0 | Python |
63dabe19f30807ee3ed0c747360a63c634a29ae7 | Throw exception on failure | buzztroll/unix-agent,enStratus/unix-agent,buzztroll/unix-agent,enStratus/unix-agent,buzztroll/unix-agent,JPWKU/unix-agent,enStratus/unix-agent,JPWKU/unix-agent,buzztroll/unix-agent,enStratus/unix-agent,JPWKU/unix-agent,JPWKU/unix-agent | src/dcm/agent/plugins/builtin/remove_user.py | src/dcm/agent/plugins/builtin/remove_user.py | #
# Copyright (C) 2014 Dell, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | #
# Copyright (C) 2014 Dell, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | apache-2.0 | Python |
16ba95e246c8ebd75d8904705a429461ce0c561b | fix spaces | jubatus/jubatus-python-client,hirokiky/jubatus-python-client,hirokiky/jubatus-python-client,jubatus/jubatus-python-client | test/jubatus_test/common.py | test/jubatus_test/common.py | import os
import time
import signal
from threading import Timer
import msgpackrpc
from msgpackrpc.error import *
class CommonUtils:
@staticmethod
def start_server(name, port):
try:
pid = os.fork()
if pid < 0:
print 'fork error'
sys.exit(1)
elif pid == 0:
os.execvp(nam... | import os
import time
import signal
from threading import Timer
import msgpackrpc
from msgpackrpc.error import *
class CommonUtils:
@staticmethod
def start_server(name, port):
try:
pid = os.fork()
if pid < 0:
print 'fork error'
sys.exit(1)
elif pid == 0:
os.execvp(nam... | mit | Python |
6f0cead30aad0e21af8b9b46ee23a56280933e73 | Define `__all__` for `view_manipulation.py` | divmain/GitSavvy,divmain/GitSavvy,divmain/GitSavvy | common/commands/view_manipulation.py | common/commands/view_manipulation.py | from sublime_plugin import TextCommand
from ...core.git_command import GitCommand
__all__ = (
"gs_handle_vintageous",
"gs_handle_arrow_keys"
)
class gs_handle_vintageous(TextCommand, GitCommand):
"""
Set the vintageous_friendly view setting if needed.
Enter insert mode if vintageous_enter_inser... | from sublime_plugin import TextCommand
from ...core.git_command import GitCommand
class gs_handle_vintageous(TextCommand, GitCommand):
"""
Set the vintageous_friendly view setting if needed.
Enter insert mode if vintageous_enter_insert_mode option is enabled.
"""
def run(self, edit):
if ... | mit | Python |
f5ccc326fa9715422bf0029a3f334643e247a9e8 | Support CPython with patch from lunar https://trac.torproject.org/projects/tor/ticket/8507 | juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,0xP... | ooni/utils/geodata.py | ooni/utils/geodata.py | import re
import os
from twisted.web.client import Agent
from twisted.internet import reactor, defer, protocol
from ooni.utils import log, net
from ooni import config
try:
from pygeoip import GeoIP
except ImportError:
try:
import GeoIP as CGeoIP
def GeoIP(database_path, *args, **kwargs):
... | import re
import os
from twisted.web.client import Agent
from twisted.internet import reactor, defer, protocol
from ooni.utils import log, net
from ooni import config
try:
import pygeoip
except ImportError:
log.err("Unable to import pygeoip. We will not be able to run geo IP related measurements")
class Geo... | bsd-2-clause | Python |
891f30385b23dbb59d794603a909535dede7beae | Fix generator test | lmaurits/BEASTling | tests/distribution_tests.py | tests/distribution_tests.py | # -*- encoding: utf-8 -*-
"""Additional tests for the distribution module.
The beastling.distribution module contains doctests for core
functionality, but testing all bad paths would overload the docstring
with un-helpful examples, so they are delegated to here.
"""
import unittest
from nose.tools import raises
i... | # -*- encoding: utf-8 -*-
"""Additional tests for the distribution module.
The beastling.distribution module contains doctests for core
functionality, but testing all bad paths would overload the docstring
with un-helpful examples, so they are delegated to here.
"""
import unittest
from nose.tools import raises
i... | bsd-2-clause | Python |
4bf218a843c61886c910504a47cbc86c8a4982ae | Fix migrate to ia script | theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs | bulbs/content/management/commands/migrate_to_ia.py | bulbs/content/management/commands/migrate_to_ia.py | from django.core.management.base import BaseCommand
from bulbs.content.models import Content, FeatureType
from bulbs.content.tasks import post_to_instant_articles_api
import timezone
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('feature', nargs="+", type=str)
de... | from django.core.management.base import BaseCommand
from bulbs.content.models import Content, FeatureType
from bulbs.content.tasks import post_to_instant_articles_api
import timezone
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('feature', nargs="+", type=str)
de... | mit | Python |
229be108620149be8e48000fc3494a458d783910 | Enable --no-progress to disable the progress bar | davidfischer/warehouse | warehouse/synchronize/commands.py | warehouse/synchronize/commands.py | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import eventlet
from progress.bar import ShadyBar
from warehouse import create_app, db, script
from warehouse.packages import store
from warehouse.synchronize.fetchers import PyPIFetcher
eventlet.monkey_p... | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import eventlet
from progress.bar import ShadyBar
from warehouse import create_app, db, script
from warehouse.packages import store
from warehouse.synchronize.fetchers import PyPIFetcher
eventlet.monkey_p... | bsd-2-clause | Python |
1d53f4cc5766f68b919032bfc0980a017b66c443 | return direct url to gif | isislab/botbot | plugins/gif.py | plugins/gif.py | import random
from util import hook, http
@hook.api_key('giphy')
@hook.command('gif')
@hook.command
def giphy(inp, api_key="dc6zaTOxFJmzC"):
'''.gif/.giphy <query> -- returns first giphy search result'''
url = 'http://api.giphy.com/v1/gifs/search'
try:
response = http.get_json(url, q=inp, limit=1... | import random
from util import hook, http
@hook.api_key('giphy')
@hook.command('gif')
@hook.command
def giphy(inp, api_key="dc6zaTOxFJmzC"):
'''.gif/.giphy <query> -- returns first giphy search result'''
url = 'http://api.giphy.com/v1/gifs/search'
try:
response = http.get_json(url, q=inp, limit=1... | unlicense | Python |
6bb21fbf98106520b739b089a8b1a49f01a9cc9e | Fix UI bug. | 40323230/Pyslvs-PyQt5,KmolYuan/Pyslvs-PyQt5,KmolYuan/Pyslvs-PyQt5 | core/dialog/delete.py | core/dialog/delete.py | # -*- coding: utf-8 -*-
from ..QtModules import *
from .Ui_delete import Ui_Dialog as delete_Dialog
class deleteDlg(QDialog, delete_Dialog):
def __init__(self, deleteIcon, icon, table, pos, parent=None):
super(deleteDlg, self).__init__(parent)
self.setupUi(self)
self.setWindowIcon(deleteIco... | # -*- coding: utf-8 -*-
from ..QtModules import *
from .Ui_delete import Ui_Dialog as delete_Dialog
class deleteDlg(QDialog, delete_Dialog):
def __init__(self, deleteIcon, icon, table, pos, parent=None):
super(deleteDlg, self).__init__(parent)
self.setupUi(self)
self.setWindowIcon(deleteIco... | agpl-3.0 | Python |
9343dbfa0d822cdf2f00deab8b18cf4d2e809063 | Add id & category to routes list | LoveXanome/urbanbus-rest,LoveXanome/urbanbus-rest | services/display_routes.py | services/display_routes.py | # -*- coding: utf-8 -*-
from database.database_access import get_dao
from gtfslib.model import Route
from services.check_urban import check_urban_category
def get_routes(agency_id):
dao = get_dao(agency_id)
parsedRoutes = list()
for route in dao.routes(fltr=Route.route_type == Route.TYPE_BUS):
print(route)
pa... | # -*- coding: utf-8 -*-
from database.database_access import get_dao
from gtfslib.model import Route
from gtfsplugins import decret_2015_1610
from database.database_access import get_dao
def get_routes(agency_id):
dao = get_dao(agency_id)
parsedRoutes = list()
for route in dao.routes(fltr=Route.route_type == Rout... | mit | Python |
4a0fe826143a890365cd1215244346301ebba8df | Remove unused `command` from pluginmanager.register | fbs/fubot | core/pluginmanager.py | core/pluginmanager.py | from core.interface import *
from twisted.python import log
def filter_interface(plugins, interface):
return filter(lambda p: interface.providedBy(p), plugins)
def filter_command(plugins, cmd):
return filter(lambda p: p.accepts_command(cmd), plugins)
class PluginManager(object):
def __init__(self):
... | from core.interface import *
from twisted.python import log
def filter_interface(plugins, interface):
return filter(lambda p: interface.providedBy(p), plugins)
def filter_command(plugins, cmd):
return filter(lambda p: p.accepts_command(cmd), plugins)
class PluginManager(object):
def __init__(self):
... | mit | Python |
bafe5c6a098e5bfff6fa0160c57e7245eccd5188 | Remove stray `django.conf.urls.defaults` import | st8st8/django-organizations,st8st8/django-organizations,DESHRAJ/django-organizations,bennylope/django-organizations,bennylope/django-organizations,arteria/django-ar-organizations,arteria/django-ar-organizations,GauthamGoli/django-organizations,DESHRAJ/django-organizations,GauthamGoli/django-organizations | organizations/urls.py | organizations/urls.py | from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from organizations.views import (OrganizationList, OrganizationDetail,
OrganizationUpdate, OrganizationDelete, OrganizationCreate,
OrganizationUserList, OrganizationUserDetail, OrganizationUserUpdate,
... | from django.conf.urls.defaults import patterns, url
from django.contrib.auth.decorators import login_required
from organizations.views import (OrganizationList, OrganizationDetail,
OrganizationUpdate, OrganizationDelete, OrganizationCreate,
OrganizationUserList, OrganizationUserDetail, OrganizationUser... | bsd-2-clause | Python |
641f831ba97a247bc58596f8697e253c2ca98f9d | use java helper for templates (#53) | googleapis/java-logging-logback,googleapis/java-logging-logback,googleapis/java-logging-logback | synth.py | synth.py | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 | Python |
588a5ca768816a7052588c6a393288ef7b754434 | add tests task | hhatto/python-hoedown,hoedown/python-hoedown,hoedown/python-hoedown,hhatto/python-hoedown,hhatto/python-hoedown,hoedown/python-hoedown,hhatto/python-hoedown,hoedown/python-hoedown | tasks.py | tasks.py | from invoke import run, task
@task
def clean():
run("python setup.py clean")
@task
def compile_cython():
run("python setup.py compile_cython")
@task
def update_submodule():
run("git submodule init")
run("git submodule sync")
run("git submodule update")
@task
def update():
update_submodul... | from invoke import run, task
@task
def clean():
run("python setup.py clean")
@task
def compile_cython():
run("python setup.py compile_cython")
@task
def update_submodule():
run("git submodule init")
run("git submodule sync")
run("git submodule update")
@task
def update():
update_submodul... | mit | Python |
82b96a8acb9a43d90bfcfe9fd4d8b0dcf1fd06f5 | Make modules uninstallable | ingadhoc/sale,ingadhoc/sale,ingadhoc/sale,ingadhoc/sale | sale_require_ref/__manifest__.py | sale_require_ref/__manifest__.py | ##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | ##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | agpl-3.0 | Python |
d8794be78567ffc1265e487de8bcfa9933e5ba5d | Include output | BruceEckel/betools | tests/test_cmdline.py | tests/test_cmdline.py | # Test the local one, not the installed one:
import sys
sys.path.insert(0, "..")
# CmdLine appears to be global for all tests,
# so you can't use the same letter flag throughout
# the test suite (is this a py.test bug?)
from betools import CmdLine
@CmdLine("1", "option1")
def test_1():
"""
Description of optio... | # Test the local one, not the installed one:
import sys
sys.path.insert(0, "..")
from betools import CmdLine
# CmdLine appears to be global for all tests,
# so you can't use the same letter flag throughout
# the test suite (is this a py.test bug?)
@CmdLine("1", "option1")
def test_1():
"""
Description of optio... | mit | Python |
d46197d033958ffda7d434aaf9b95148c96138d7 | Kill SETTABLE_ENV_VARS allow list. (#11743) | pantsbuild/pants,benjyw/pants,pantsbuild/pants,benjyw/pants,pantsbuild/pants,benjyw/pants,pantsbuild/pants,benjyw/pants,benjyw/pants,pantsbuild/pants,pantsbuild/pants,benjyw/pants,pantsbuild/pants,benjyw/pants | src/python/pants/core/util_rules/subprocess_environment.py | src/python/pants/core/util_rules/subprocess_environment.py | # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from dataclasses import dataclass
from typing import Tuple
from pants.engine.environment import Environment, EnvironmentRequest
from pants.engine.rules import Get, collect_rules, rule
fro... | # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from dataclasses import dataclass
from typing import Tuple
from pants.engine.environment import Environment, EnvironmentRequest
from pants.engine.rules import Get, collect_rules, rule
fro... | apache-2.0 | Python |
36f2b9f52524a65d5327b2dd414e7ad874537ff1 | Add tests | tadashi-aikawa/owlmixin | tests/test_OwlObjectEnum.py | tests/test_OwlObjectEnum.py | # coding: utf-8
from __future__ import division, absolute_import, unicode_literals
from owlmixin import OwlMixin
from owlmixin.owlenum import OwlObjectEnum
class Sample(OwlMixin):
def __init__(self, color):
self.color = Color.from_symbol(color)
class Color(OwlObjectEnum):
RED = (
"red",
... | # coding: utf-8
from __future__ import division, absolute_import, unicode_literals
from owlmixin.owlenum import OwlObjectEnum
class Color(OwlObjectEnum):
RED = (
"red",
{"japanese": "赤", "coloring": lambda m: "Red: " + m}
)
GREEN = (
"green",
{"japanese": "緑", "coloring"... | mit | Python |
3b83b8715e03b9096f9ae5611019fec4e52ca937 | Add an initial test each for resolve and mk | gratipay/filesystem_tree.py,gratipay/filesystem_tree.py | tests.py | tests.py | import os
from os.path import isdir
import pytest
from filesystem_tree import FilesystemTree
@pytest.yield_fixture
def fs():
fs = FilesystemTree()
yield fs
fs.remove()
def test_it_can_be_instantiated():
assert FilesystemTree().__class__.__name__ == 'FilesystemTree'
def test_args_go_to_mk_not_root(... | from os.path import isdir
import pytest
from filesystem_tree import FilesystemTree
@pytest.yield_fixture
def fs():
fs = FilesystemTree()
yield fs
fs.remove()
def test_it_can_be_instantiated():
assert FilesystemTree().__class__.__name__ == 'FilesystemTree'
def test_args_go_to_mk_not_root():
fs ... | mit | Python |
f8034181c9dd9b880ee0805fe2c6566260e060e1 | test flask_admin connection | fayazkhan/secret-diary | tests/test_web_interface.py | tests/test_web_interface.py | from unittest.mock import patch, sentinel
from diary.web import application_factory
@patch('diary.web.Flask', return_value=sentinel.app)
def test_webapp_initialization(Flask):
app = application_factory()
Flask.assert_called_once_with('diary.web')
assert app == sentinel.app
@patch('diary.web.Admin')
def... | from unittest.mock import patch, sentinel
from diary.web import application_factory
@patch('diary.web.Flask', return_value=sentinel.app)
def test_webapp_initialization(Flask):
app = application_factory()
Flask.assert_called_once_with('diary.web')
assert app == sentinel.app
| agpl-3.0 | Python |
2c667a8a28ed67325d7335246e10dab0d01ffa2c | increase number of tests | inuitwallet/ALP-Server | tests/urls_functionality.py | tests/urls_functionality.py | import json
import logging
import os
from webtest import TestApp
import sys
sys.path.append('../')
os.remove('pool.db')
import pool_server
__author__ = 'sammoth'
log = logging.Logger('ALP_Test')
stream = logging.StreamHandler()
formatter = logging.Formatter(fmt='%(message)s')
stream.setFormatter(formatter)
log.addHan... | import logging
from webtest import TestApp
import sys
sys.path.append('../')
import pool_server
__author__ = 'sammoth'
log = logging.Logger('ALP_Test')
stream = logging.StreamHandler()
formatter = logging.Formatter(fmt='%(message)s')
stream.setFormatter(formatter)
log.addHandler(stream)
app = TestApp(pool_server.app... | mit | Python |
243cae812c1b5c41de8064e6fc46d0e018da2586 | Upgrade database version 20 should succeed even for environment not using the versioncontrol subsystem. Closes #5015. | pkdevbox/trac,pkdevbox/trac,pkdevbox/trac,pkdevbox/trac | trac/upgrades/db20.py | trac/upgrades/db20.py | from trac.db import Table, Column, Index, DatabaseManager
from trac.core import TracError
from trac.versioncontrol.cache import CACHE_YOUNGEST_REV
def do_upgrade(env, ver, cursor):
"""Modify the repository cache scheme (if needed)
Now we use the 'youngest_rev' entry in the system table
to explicit... | from trac.db import Table, Column, Index, DatabaseManager
from trac.versioncontrol.cache import CACHE_YOUNGEST_REV
def do_upgrade(env, ver, cursor):
"""Modify the repository cache scheme.
Now we use the 'youngest_rev' entry in the system table
to explicitly store the youngest rev in the cache.
... | bsd-3-clause | Python |
8e9e9a46c92198cb42f7e498da7dd94f3d23e7b8 | fix config file name | juergh/dwarf,juergh/dwarf,dtroyer/dwarf,dtroyer/dwarf | dwarf/common/config.py | dwarf/common/config.py | #!/usr/bin/python
from __future__ import print_function
import logging
import os
import yaml
LOG = logging.getLogger(__name__)
class Config(object):
def __init__(self):
# Get the config data from file
cfile = '/etc/dwarf.conf'
if not os.path.exists(cfile):
cfile = os.path.j... | #!/usr/bin/python
from __future__ import print_function
import logging
import os
import yaml
LOG = logging.getLogger(__name__)
class Config(object):
def __init__(self):
# Get the config data from file
cfile = '/etc/default/dwarf'
if not os.path.exists(cfile):
cfile = os.pat... | apache-2.0 | Python |
434b9beb73ecdd257c692ade18e083ba1294b9bd | change content | dresl/django_choice_and_question,dresl/django_choice_and_question | polls/views.py | polls/views.py | from django.shortcuts import render
from django.http import HttpResponse
from polls.models import Question
def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:5]
output = ', '.join([p.question_text for p in latest_question_list])
return HttpResponse(output)
def detail(reque... | from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
def detail(request, question_id):
return HttpResponse("You're looking at question %s." % question_id)
def results(request, question_id):
response =... | apache-2.0 | Python |
fbe1d8063774dc35765596c88d5cc7b197a8ec6d | fix for our browseable api renderer | izzyalonso/tndata_backend,tndatacommons/tndata_backend,tndatacommons/tndata_backend,izzyalonso/tndata_backend,tndatacommons/tndata_backend,izzyalonso/tndata_backend,tndatacommons/tndata_backend,izzyalonso/tndata_backend | tndata_backend/utils/api.py | tndata_backend/utils/api.py | from rest_framework import exceptions
from rest_framework.renderers import BrowsableAPIRenderer
from rest_framework.throttling import BaseThrottle
from rest_framework.versioning import QueryParameterVersioning
class DefaultQueryParamVersioning(QueryParameterVersioning):
"""This class includes the default version ... | from rest_framework import exceptions
from rest_framework.renderers import BrowsableAPIRenderer
from rest_framework.throttling import BaseThrottle
from rest_framework.versioning import QueryParameterVersioning
class DefaultQueryParamVersioning(QueryParameterVersioning):
"""This class includes the default version ... | mit | Python |
7d0fc8cf7043bfa9e7202932fccff9b629e8148a | Return by default error status code 500 | CulturePlex/pybossa,geotagx/geotagx-pybossa-archive,OpenNewsLabs/pybossa,inteligencia-coletiva-lsd/pybossa,geotagx/geotagx-pybossa-archive,OpenNewsLabs/pybossa,jean/pybossa,geotagx/pybossa,geotagx/geotagx-pybossa-archive,geotagx/pybossa,Scifabric/pybossa,proyectos-analizo-info/pybossa-analizo-info,jean/pybossa,proyecto... | pybossa/error/__init__.py | pybossa/error/__init__.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | agpl-3.0 | Python |
27d6832c6cb7aef33ff5946f018c79c243119ca9 | Fix typo in credits | usrlocalben/pydux | pydux/thunk_middleware.py | pydux/thunk_middleware.py | """
thunks for pydux
original from https://github.com/gaearon/redux-thunk
"""
def thunk_middleware(store):
dispatch, get_state = store['dispatch'], store['get_state']
def wrapper(next_):
def thunk_dispatch(action):
if hasattr(action, '__call__'):
return action(dispatch, ge... | """
thunks for pydux
original from https://github.com/aearon/redux-thunk
"""
def thunk_middleware(store):
dispatch, get_state = store['dispatch'], store['get_state']
def wrapper(next_):
def thunk_dispatch(action):
if hasattr(action, '__call__'):
return action(dispatch, get... | mit | Python |
cff9d1f299bad28adcab1e4f279d045a28e319d2 | Update pylsy_test.py | gnithin/Pylsy,gnithin/Pylsy,muteness/Pylsy,muteness/Pylsy,huiyi1990/Pylsy,huiyi1990/Pylsy | pylsy/tests/pylsy_test.py | pylsy/tests/pylsy_test.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import unittest
from pylsy import pylsytable
TEST_DIR = os.path.dirname(__file__)
class PylsyTableTests(unittest.TestCase):
def setUp(self):
attributes = ["name", "age"]
self.table = pylsytable(attributes)
def tearD... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import unittest
from pylsy import pylsytable
TEST_DIR = os.path.dirname(__file__)
class PylsyTableTests(unittest.TestCase):
def setUp(self):
attributes = ["name", "age"]
self.table = pylsytable(attributes)
def tearD... | mit | Python |
88633d0f7cbe8c41e17470ea2366acad6fbf91b5 | Add beeping | umbc-hackafe/sign-drivers,umbc-hackafe/sign-drivers,umbc-hackafe/sign-drivers | python/games/countdown.py | python/games/countdown.py | import graphics
import time
import datetime
import game
class Countdown(game.Game):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.timer = graphics.Rectangle(112, 7, x=0, y=8)
self.text = graphics.TextSprite("1:00:00.000 REMAIN", x=0, y=0, width=5, height=7)
... | import graphics
import time
import datetime
import game
class Countdown(game.Game):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.timer = graphics.Rectangle(112, 7, x=0, y=8)
self.text = graphics.TextSprite("1:00:00.000 REMAIN", x=0, y=0, width=5, height=7)
... | mit | Python |
c54a1b05f3d443efb1bc1267b772262c087c6bfa | remove debug | firemark/quizFactory,firemark/quizFactory | quizfactory/views/game.py | quizfactory/views/game.py | from quizfactory import app
from quizfactory.models import Game
from flask import session, jsonify, request
games = {}
def get_game_from_session(quiz_id):
global games
return games[session[quiz_id]]
@app.fine_route()
def get_game(quiz_id):
try:
game = get_game_from_session(quiz_id)
except K... | from quizfactory import app
from quizfactory.models import Game
from flask import session, jsonify, request
games = {}
def get_game_from_session(quiz_id):
global games
return games[session[quiz_id]]
@app.fine_route()
def get_game(quiz_id):
try:
game = get_game_from_session(quiz_id)
except K... | mit | Python |
afeba0c4c3ab49af092c7c85e026d5ee98ab5706 | work on progress | Phedorabot/phedorabot-python-sdk | phedorabot/webhook.py | phedorabot/webhook.py | #!/usr/bin/env python
#
# Copyright 2017 Phedorabot
#
# 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... | #!/usr/bin/env python
#
# Copyright 2017 Phedorabot
#
# 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... | apache-2.0 | Python |
2b7223196b59dc82649fb8a4218fb0772e39aef4 | add NullHandler in the case there is no top one specified | kratsg/optimization,kratsg/optimization,kratsg/optimization | utils.py | utils.py | import csv
import re
import logging
logger = logging.getLogger("optimize")
logger.addHandler(logging.NullHandler())
def load_mass_windows(filename):
with open(filename, 'r') as f:
return {l[0]: tuple(l[1:4]) for l in csv.reader(f, delimiter='\t')}
#@echo(write=logger.debug)
did_regex = re.compile('\.?(?:00)?(\... | import csv
import re
import logging
logger = logging.getLogger("optimize")
def load_mass_windows(filename):
with open(filename, 'r') as f:
return {l[0]: tuple(l[1:4]) for l in csv.reader(f, delimiter='\t')}
#@echo(write=logger.debug)
did_regex = re.compile('\.?(?:00)?(\d{6,8})\.?')
def get_did(filename):
glo... | mit | Python |
a7e757bc1aadcd09ea080b719bfd40edf13c05dd | Replace new-bootstrap with bootstrap | allevato/swift,gribozavr/swift,parkera/swift,jckarter/swift,roambotics/swift,aschwaighofer/swift,glessard/swift,rudkx/swift,harlanhaskins/swift,glessard/swift,gribozavr/swift,tkremenek/swift,apple/swift,parkera/swift,benlangmuir/swift,ahoppen/swift,rudkx/swift,xwu/swift,atrick/swift,nathawes/swift,ahoppen/swift,roambot... | utils/swift_build_support/swift_build_support/products/swiftpm.py | utils/swift_build_support/swift_build_support/products/swiftpm.py | # swift_build_support/products/swiftpm.py -----------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.tx... | # swift_build_support/products/swiftpm.py -----------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.tx... | apache-2.0 | Python |
3fc05761dde38927924ec0bbee637d3fa917538b | add method _to_str(value) --> string | rlowrance/python_lib,rlowrance/python_lib | HpSpec.py | HpSpec.py | from abc import ABCMeta, abstractmethod
import unittest
class HpSpec(object):
'specification of a model name and its associated hyperparamters'
__metaclass__ = ABCMeta
@abstractmethod
def __str__(self):
'return parsable string representation'
pass
@staticmethod
@abstractmetho... | from abc import ABCMeta, abstractmethod
import unittest
class HpSpec(object):
'specification of a model name and its associated hyperparamters'
__metaclass__ = ABCMeta
@abstractmethod
def __str__(self):
'return parsable string representation'
pass
@staticmethod
@abstractmetho... | apache-2.0 | Python |
e14e6fbbd2bc5c262f6f7df0df5732edff8d7de6 | add new version (#22836) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-importlib-metadata/package.py | var/spack/repos/builtin/packages/py-importlib-metadata/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyImportlibMetadata(PythonPackage):
"""Read metadata from Python packages."""
homepag... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyImportlibMetadata(PythonPackage):
"""Read metadata from Python packages."""
homepag... | lgpl-2.1 | Python |
d02ed340c275ccd008645b280716aa0d33067022 | Add cleanup for measurements that use tracing | SummerLW/Perf-Insight-Report,benschmaus/catapult,benschmaus/catapult,catapult-project/catapult,SummerLW/Perf-Insight-Report,catapult-project/catapult-csm,SummerLW/Perf-Insight-Report,sahiljain/catapult,SummerLW/Perf-Insight-Report,benschmaus/catapult,catapult-project/catapult-csm,SummerLW/Perf-Insight-Report,benschmaus... | telemetry/telemetry/page/page_measurement_unittest_base.py | telemetry/telemetry/page/page_measurement_unittest_base.py | # 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.
import unittest
from telemetry.core import util
from telemetry.page import page_runner
from telemetry.page import page as page_module
from telemetry.pag... | # 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.
import unittest
from telemetry.core import util
from telemetry.page import page_runner
from telemetry.page import page as page_module
from telemetry.pag... | bsd-3-clause | Python |
32a2a256eb792b3e7e5501e0f41e117cff8c1fdb | Fix ranks in CTFTime scoreboard feed | fausecteam/ctf-gameserver,fausecteam/ctf-gameserver,fausecteam/ctf-gameserver,fausecteam/ctf-gameserver,fausecteam/ctf-gameserver | web/ctf_gameserver/web/scoring/views.py | web/ctf_gameserver/web/scoring/views.py | from django.http import JsonResponse
from django.shortcuts import render
from . import models, calculations
from .decorators import competition_started_required
@competition_started_required
def scoreboard(request):
game_control = models.GameControl.objects.get()
if game_control.competition_over():
... | from django.http import JsonResponse
from django.shortcuts import render
from . import models, calculations
from .decorators import competition_started_required
@competition_started_required
def scoreboard(request):
game_control = models.GameControl.objects.get()
if game_control.competition_over():
... | isc | Python |
8450580b6d79979b015f8fd61cef71d909bc3db0 | correct url | edx/edx-notifications,edx/edx-notifications,edx/edx-notifications,edx/edx-notifications | testserver/test/acceptance/pages/__init__.py | testserver/test/acceptance/pages/__init__.py | base_url = 'http://127.0.0.1:8000/'
user_name = 'testuser1'
user_email = 'testuser1@edx.org'
password = 'ARbi12.,' | base_url = 'http://71c52982.ngrok.com'
user_name = 'testuser3'
user_email = 'testuser1@edx.org'
password = 'ARbi12.,' | agpl-3.0 | Python |
266aecd7e1cbca4a9add43fbaa53e0af5c6ab400 | Reformat score table | amalshehu/exercism-python | scrabble-score/scrabble_score.py | scrabble-score/scrabble_score.py | # File: scrabble_score.py
# Purpose: Write a program that, given a word, computes the scrabble score for that word.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Tuesday 27 September 2016, 01:27 PM
score_table = {
'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1,
'f': 4, 'g': 2, 'h': 4, 'i... | # File: sscrabble_score.py
# Purpose: Write a program that, given a word, computes the scrabble score for that word.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Tuesday 27 September 2016, 01:27 PM
score_table = {
1: "A, E, I, O, U, L, N, R, S, T",
2: "D, G",... | mit | Python |
8a75cc4626bd38faeec102aea894d4e7ac08646c | Update description of collection viewer example | almarklein/scikit-image,juliusbierk/scikit-image,paalge/scikit-image,Hiyorimi/scikit-image,chriscrosscutler/scikit-image,oew1v07/scikit-image,bennlich/scikit-image,paalge/scikit-image,warmspringwinds/scikit-image,chriscrosscutler/scikit-image,bennlich/scikit-image,warmspringwinds/scikit-image,rjeli/scikit-image,vighnes... | viewer_examples/viewers/collection_viewer.py | viewer_examples/viewers/collection_viewer.py | """
=====================
CollectionViewer demo
=====================
Demo of CollectionViewer for viewing collections of images. This demo uses
the different layers of the gaussian pyramid as image collection.
You can scroll through images with the slider, or you can interact with the
viewer using your keyboard:
le... | """
=====================
CollectionViewer demo
=====================
Demo of CollectionViewer for viewing collections of images. This demo uses
successively darker versions of the same image to fake an image collection.
You can scroll through images with the slider, or you can interact with the
viewer using your key... | bsd-3-clause | Python |
023e60ccca10fd7149a5af20aa14623dc0855fe2 | Remove comma | GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples | vision/snippets/face_detection/faces_test.py | vision/snippets/face_detection/faces_test.py | # Copyright 2016 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | # Copyright 2016, Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | apache-2.0 | Python |
f93fcd5cee878c201dd1be2102a2a9433a63c4b5 | Make streamable artist updates as they happen, rather than commiting at the end of all artists | foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm | scripts/set-artist-streamable.py | scripts/set-artist-streamable.py | #!/usr/bin/env python
import psycopg2 as ordbms
import urllib, urllib2
import xml.etree.cElementTree as ElementTree
class SetArtistStreamable:
def __init__(self):
self.conn = ordbms.connect ("dbname='librefm'")
self.cursor = self.conn.cursor()
def updateAll(self):
"""Sets artists streamable ... | #!/usr/bin/env python
import psycopg2 as ordbms
import urllib, urllib2
import xml.etree.cElementTree as ElementTree
class SetArtistStreamable:
def __init__(self):
self.conn = ordbms.connect ("dbname='librefm'")
self.cursor = self.conn.cursor()
def updateAll(self):
"""Sets artists streamable ... | agpl-3.0 | Python |
564d2eedf6e2b62152869c60bf1f3ba18287d8c0 | Add extra tag which displays the occurrence duration in a smart way | jonge-democraten/mezzanine-fullcalendar | fullcalendar/templatetags/fullcalendar.py | fullcalendar/templatetags/fullcalendar.py | from django import template
from django.utils import timezone
from fullcalendar.models import Occurrence
register = template.Library()
@register.inclusion_tag('events/agenda_tag.html')
def show_agenda(*args, **kwargs):
qs = Occurrence.objects.upcoming()
if 'limit' in kwargs:
qs = qs[:int(kwargs['lim... | from django import template
from fullcalendar.models import Occurrence
register = template.Library()
@register.inclusion_tag('events/agenda_tag.html')
def show_agenda(*args, **kwargs):
qs = Occurrence.objects.upcoming()
if 'limit' in kwargs:
qs = qs[:int(kwargs['limit'])]
return {
'occu... | mit | Python |
c0af8c4e598b4ae3a8c260048c8468186af42009 | switch back to lab.kmol.info | kmolab/kmolab.github.io,kmolab/kmolab.github.io,kmolab/kmolab.github.io,kmolab/kmolab.github.io | publishconf.py | publishconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
# 因為 publishconf.py 在 pelicanconf.py 之後, 因此若兩處有相同變數的設定, ... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
# 因為 publishconf.py 在 pelicanconf.py 之後, 因此若兩處有相同變數的設定, ... | agpl-3.0 | Python |
5af8b02d8603500481af03483a2a3debeb01e586 | Update models.py | sterlingbaldwin/acme_workbench,sterlingbaldwin/acme_workbench,sterlingbaldwin/acme_workbench,sterlingbaldwin/acme_workbench,sterlingbaldwin/acme_workbench | workbench-backend/index/models.py | workbench-backend/index/models.py | from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
from enum import Enum
class DataType(Enum):
"""
Enumeration of valid file types
"""
pass
# Leaving this blank until enum values are determined.
#NC=1
#DAT=2
#JSON=3
class ... | from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
from enum import Enum
class DataType(Enum):
"""
Enumeration of valid file types
"""
pass
# Leaving this blank until enum values are determined.
#NC=1
#DAT=2
#JSON=3
class ... | bsd-2-clause | Python |
52375daaced4df191b6c253458d47e13f76c00a4 | update comment in TableFileNameComposer | alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl | AlphaTwirl/Configure/TableFileNameComposer.py | AlphaTwirl/Configure/TableFileNameComposer.py | # Tai Sakuma <tai.sakuma@cern.ch>
##__________________________________________________________________||
class TableFileNameComposer(object):
"""Compose a name of a file to store the table from the column names and indices.
For example, if column names are 'var1', 'var2', and 'var3' and
indices are 1, No... | # Tai Sakuma <tai.sakuma@cern.ch>
##__________________________________________________________________||
class TableFileNameComposer(object):
"""Compose a name of a file to store the table from the column names and indices.
For example, if column names are 'var1', 'var2', and 'var3' and
indices are 1, No... | bsd-3-clause | Python |
c59ea54efef2fcd1763988a535f3a265935b3afe | Mask in float format. | openconnectome/m2g,neurodata/ndgrutedb,openconnectome/m2g,openconnectome/m2g,neurodata/ndgrutedb,neurodata/ndgrutedb,openconnectome/m2g,openconnectome/m2g,neurodata/ndgrutedb,neurodata/ndgrutedb,openconnectome/m2g,openconnectome/m2g,neurodata/ndgrutedb,neurodata/ndmg,neurodata/ndgrutedb,openconnectome/m2g,neurodata/ndg... | python/mask.py | python/mask.py | import sys
import os
import xml.dom.minidom
import numpy as np
#
# Makes a ton of assumptions about the XML data.
# Totally customize for MRCAP data. Needs to be checked with
# anything that's not the original 109 data files on braingraph1
#
class MaskXML:
""""Class to read the *.xml file and pull out import... | import sys
import os
import xml.dom.minidom
import numpy as np
#
# Makes a ton of assumptions about the XML data.
# Totally customize for MRCAP data. Needs to be checked with
# anything that's not the original 109 data files on braingraph1
#
class MaskXML:
""""Class to read the *.xml file and pull out import... | apache-2.0 | Python |
4ab814734454361c42560bae5d3331a26dcaad01 | Use correct matrix method | DarkAce65/rpi-led-matrix,DarkAce65/rpi-led-matrix | python/test.py | python/test.py | #!/usr/bin/env python
from rgbmatrix import RGBMatrix
from random import randint
import time
rows = 16
chains = 1
parallel = 1
ledMatrix = RGBMatrix(rows, chains, parallel)
height = ledMatrix.height
width = ledMatrix.width
for i in range(100):
ledMatrix.SetPixel(randint(0, width), randint(0, height), randint(0, 255),... | #!/usr/bin/env python
from rgbmatrix import RGBMatrix
from random import randint
import time
rows = 16
chains = 1
parallel = 1
ledMatrix = RGBMatrix(rows, chains, parallel)
height = ledMatrix.height
width = ledMatrix.width
for i in range(100):
ledMatrix.setPixel(randint(0, width), randint(0, height), randint(0, 255),... | mit | Python |
071efd48020467792a6b147b283edc9235f9b4d5 | indent error | danielfalck/FCparametric | python/vise.py | python/vise.py | import Draft,Part
import FreeCAD, FreeCADGui
import FreeCADGui as Gui
from FreeCAD import Base
from PySide import QtGui, QtCore
from math import fabs
import utils
class Vise:
def __init__ (self, obj):
'''create a milling machine vise '''
obj.addProperty("App::PropertyFloat", "JawOpening", "Paralle... | import Draft,Part
import FreeCAD, FreeCADGui
import FreeCADGui as Gui
from FreeCAD import Base
from PySide import QtGui, QtCore
from math import fabs
import utils
class Vise:
'''
how to use:
obj =FreeCAD.ActiveDocument.addObject("Part::FeaturePython",'Vise')
Vise(obj)
ViewProviderVise(obj.ViewObje... | lgpl-2.1 | Python |
8d391d0820e8e78cba504cfc447fbc2b1c48ecf4 | use a different shuffle algo | dylanaraps/pywal,dylanaraps/pywal,dylanaraps/pywal | pywal/image.py | pywal/image.py | """
Get the image file.
"""
import os
import random
import sys
from .settings import CACHE_DIR
from . import util
from . import wallpaper
def get_random_image(img_dir):
"""Pick a random image file from a directory."""
current_wall = wallpaper.get()
current_wall = os.path.basename(current_wall)
file_... | """
Get the image file.
"""
import os
import random
import sys
from .settings import CACHE_DIR
from . import util
from . import wallpaper
def get_random_image(img_dir):
"""Pick a random image file from a directory."""
current_wall = wallpaper.get()
current_wall = os.path.basename(current_wall)
file_... | mit | Python |
473ea77a54e0b85403ceb00cfd78bb540cd8e2e3 | Remove pyqtVariants | goanpeca/qtpy,davvid/qtpy,goanpeca/qtpy,davvid/qtpy,spyder-ide/qtpy | qtpy/QtCore.py | qtpy/QtCore.py | # -*- coding: utf-8 -*-
#
# Copyright © 2014-2015 Colin Duquesnoy
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
"""
Provides QtCore classes and functions.
"""
from qtpy import PYQT5, PYQT4, PYSIDE, PythonQtError
if PYQT5:
from PyQ... | # -*- coding: utf-8 -*-
#
# Copyright © 2014-2015 Colin Duquesnoy
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
"""
Provides QtCore classes and functions.
"""
from qtpy import PYQT5, PYQT4, PYSIDE, PythonQtError
if PYQT5:
from PyQ... | mit | Python |
74577faa2468a0b944cef3c88c9b8a82a4881ff1 | Change results page title to include query (or "Error" on error). | cdubz/rdap-explorer,cdubz/rdap-explorer | query/views.py | query/views.py | """
Views for the rdap_explorer project, query app.
"""
import ipwhois
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse
from django.views.decorators.cache import cache_page
from json import dumps
from .forms import QueryForm
def index(request):
if... | """
Views for the rdap_explorer project, query app.
"""
import ipwhois
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse
from django.views.decorators.cache import cache_page
from json import dumps
from .forms import QueryForm
def index(request):
if... | mit | Python |
27f47ef27654dfa9c68bb90d3b8fae2e3a281396 | Move out app setup to setup file to finish cleaning up the init file | rackerlabs/pitchfork,oldarmyc/pitchfork,oldarmyc/pitchfork,rackerlabs/pitchfork,rackerlabs/pitchfork,oldarmyc/pitchfork | pitchfork/__init__.py | pitchfork/__init__.py | # Copyright 2014 Dave Kludt
#
# 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, s... | # Copyright 2014 Dave Kludt
#
# 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, s... | apache-2.0 | Python |
9a98c6256a8e7c16f6b4194f5fa34447605022cd | Make `3_2_make_json_` really fast by using subprocess and `grep -v` | statgen/pheweb,statgen/pheweb,statgen/pheweb,statgen/pheweb,statgen/pheweb | data/3_2_make_json_for_each_pheno.py | data/3_2_make_json_for_each_pheno.py | #!/usr/bin/env python2
from __future__ import print_function, division, absolute_import
import glob
import heapq
import re
import os.path
import os
import json
import subprocess
def parse_marker_id(marker_id):
chr1, pos1, ref, alt, chr2, pos2 = re.match(r'([^:]+):([0-9]+)_([-ATCG]+)/([-ATCG]+)_([^:]+):([0-9]+)',... | #!/usr/bin/env python2
from __future__ import print_function, division, absolute_import
import gzip
import glob
import heapq
import re
import os.path
import json
def parse_marker_id(marker_id):
chr1, pos1, ref, alt, chr2, pos2 = re.match(r'([^:]+):([0-9]+)_([-ATCG]+)/([-ATCG]+)_([^:]+):([0-9]+)', marker_id).grou... | agpl-3.0 | Python |
42a76adff446b79fec589394e2e6dc289f048151 | Update __version__.py | cvium/irc_bot | irc_bot/__version__.py | irc_bot/__version__.py | __version__ = '1.0.35'
| __version__ = '1.0.34'
| mit | Python |
13a8a702722047d0db727b5fdb57a5506bf33179 | Update random_walk.py | sdelaughter/misc | random_walk.py | random_walk.py | """Author: Samuel DeLaughter
12/6/14
This program graphs the probability of landing on each integer in a given interval for a 1D random-walk simulation
If called with a -i flag, it will prompt for user input on the following variables:
Boundary numbers, starting position, number of steps per simulation, number of sim... | #Author: Samuel DeLaughter
#12/6/14
#This program graphs the probability of landing on each integer in a given interval for a 1D random-walk simulation
#If called with a -i flag, it will prompt for user input on the following variables:
#Boundary numbers, starting position, number of steps per simulation, number of s... | mit | Python |
63cb8dc1449f6cab87bd7910276d0e06dfd0b228 | Set up basic webhook for Messenger | jabagawee/playing-with-kubernetes | rasdoor/app.py | rasdoor/app.py | from flask import Flask, abort, request
app = Flask(__name__)
VERIFY_TOKEN = 'temp_token_to_replace_with_secret'
@app.route('/')
def hello_world():
return 'Hello World'
@app.route('/webhook/facebook_messenger', methods=['GET', 'POST'])
def facebook_webhook():
if request.method == 'POST':
body = reque... | from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World'
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')
| mit | Python |
a41dde152d0cecc9ee9ece77959f51536f9a9ec7 | make sure schema exists as part of database creation process | fedspendingtransparency/data-act-core,chambers-brian/SIG_Digital-Strategy_SI_ODP_Backend,fedspendingtransparency/data-act-broker-backend,chambers-brian/SIG_Digital-Strategy_SI_ODP_Backend,fedspendingtransparency/data-act-broker-backend,fedspendingtransparency/data-act-core | dataactcore/scripts/databaseSetup.py | dataactcore/scripts/databaseSetup.py | import sqlalchemy
from sqlalchemy.exc import OperationalError
from sqlalchemy.schema import CreateSchema
from sqlalchemy.exc import ProgrammingError
from dataactcore.config import CONFIG_DB
def createDatabase(dbName):
"""Create specified database if it doesn't exist."""
connectString = "postgresql://{}:{}@{}:... | import sqlalchemy
from sqlalchemy.exc import OperationalError
from dataactcore.config import CONFIG_DB
def createDatabase(dbName):
"""Create specified database if it doesn't exist."""
connectString = "postgresql://{}:{}@{}:{}/{}".format(CONFIG_DB["username"],
CONFIG_DB["password"], CONFIG_DB["host"], ... | cc0-1.0 | Python |
3db3d7b74080635a7475a9fc556e5c8577f58aa2 | Fix eta message slightly | nttks/edx-platform,xuxiao19910803/edx-platform,ZLLab-Mooc/edx-platform,louyihua/edx-platform,halvertoluke/edx-platform,waheedahmed/edx-platform,bigdatauniversity/edx-platform,ubc/edx-platform,UXE/local-edx,teltek/edx-platform,y12uc231/edx-platform,jazkarta/edx-platform-for-isc,jelugbo/tundex,dcosentino/edx-platform,lea... | lms/djangoapps/open_ended_grading/open_ended_grading_util.py | lms/djangoapps/open_ended_grading/open_ended_grading_util.py | def convert_seconds_to_human_readable(seconds):
if seconds < 60:
human_string = "{0} seconds".format(seconds)
elif seconds < 60 * 60:
human_string = "{0} minutes".format(round(seconds/60,1))
elif seconds < (24*60*60):
human_string = "{0} hours".format(round(seconds/(60*60),1))
el... | def convert_seconds_to_human_readable(seconds):
if seconds < 60:
human_string = "{0} seconds".format(seconds)
elif seconds < 60 * 60:
human_string = "{0} minutes".format(round(seconds/60,1))
elif seconds < (24*60*60):
human_string = "{0} hours".format(round(seconds/(60*60),1))
el... | agpl-3.0 | Python |
eed1e42e2a8b37621760b013c53af2a83d441a71 | Use the right model in migration (#190) | MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager | server/crashmanager/migrations/0013_init_cachedcrashinfo.py | server/crashmanager/migrations/0013_init_cachedcrashinfo.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from django.db import migrations
def create_migration_tool(apps, schema_editor):
CrashEntry = apps.get_model("crashmanager", "CrashEntry")
for entry in CrashEntry.objects.filter(cachedCrashInfo=None):
entry.save(update_fie... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from django.db import migrations
from crashmanager.models import CrashEntry
def create_migration_tool(apps, schema_editor):
for entry in CrashEntry.objects.filter(cachedCrashInfo=None):
entry.save(update_fields=['cachedCrashIn... | mpl-2.0 | Python |
44a290cb4c541c98179dcecd0053beffec5c394c | Disable slow test. | PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge | spec/puzzle/examples/msp/msp2017_06_21_pride_parade_spec.py | spec/puzzle/examples/msp/msp2017_06_21_pride_parade_spec.py | from data import warehouse
from puzzle.examples.msp import msp2017_06_21_pride_parade
from puzzle.problems import logic_problem
from puzzle.puzzlepedia import prod_config
from spec.mamba import *
with _description('msp2017_06_21_pride_parade'):
with before.all:
warehouse.save()
prod_config.init()
self.pu... | from data import warehouse
from puzzle.examples.msp import msp2017_06_21_pride_parade
from puzzle.problems import logic_problem
from puzzle.puzzlepedia import prod_config
from spec.mamba import *
with description('msp2017_06_21_pride_parade'):
with before.all:
warehouse.save()
prod_config.init()
self.puz... | mit | Python |
11bf9b0e286df595961d17b121d01237b69be85d | Use django.utils.six.iteritems in wagtail.utils.utils.deep_update. | rsalmaso/wagtail,mixxorz/wagtail,thenewguy/wagtail,nimasmi/wagtail,kaedroho/wagtail,nealtodd/wagtail,torchbox/wagtail,mixxorz/wagtail,mixxorz/wagtail,jnns/wagtail,timorieber/wagtail,torchbox/wagtail,zerolab/wagtail,kaedroho/wagtail,mikedingjan/wagtail,zerolab/wagtail,gasman/wagtail,kaedroho/wagtail,gasman/wagtail,thene... | wagtail/utils/utils.py | wagtail/utils/utils.py | from __future__ import absolute_import, unicode_literals
import collections
from django.utils import six
def deep_update(source, overrides):
"""Update a nested dictionary or similar mapping.
Modify ``source`` in place.
"""
items = six.iteritems(overrides)
for key, value in items:
if is... | from __future__ import absolute_import, unicode_literals
import collections
import sys
def deep_update(source, overrides):
"""Update a nested dictionary or similar mapping.
Modify ``source`` in place.
"""
if sys.version_info >= (3, 0):
items = overrides.items()
else:
items = over... | bsd-3-clause | Python |
ffc6e870672784d3514631d99d5c68c6ddd8556b | bump version to 0.2.3 | Kaggle/learntools,Kaggle/learntools | learntools/__init__.py | learntools/__init__.py | from . import advanced_pandas, core, deep_learning, gans, machine_learning, python, ml_insights
__version__ = '0.2.3'
| from . import advanced_pandas, core, deep_learning, gans, machine_learning, python
__version__ = '0.2.2'
| apache-2.0 | Python |
3591a4422a34b718cd3400266ac6f92c8421e82a | Bump to version 0.1.3 | 3YOURMIND/django-migration-linter | django_migration_linter/constants.py | django_migration_linter/constants.py | # Copyright 2019 3YOURMIND GmbH
# 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, soft... | # Copyright 2019 3YOURMIND GmbH
# 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, soft... | apache-2.0 | Python |
243056d9f6f61ceb84fca2ea2f578f7a4d9eae68 | add @parse_with flask-restful utility | fusic-com/flask-todo,fusic-com/flask-todo,paulvisen/flask-todo,paulvisen/flask-todo,paulvisen/flask-todo | utils/flaskutils/restful.py | utils/flaskutils/restful.py | from functools import wraps
from flask import request
from flask.ext.restful import Api
from flask.ext.restful.reqparse import RequestParser
def patched_to_marshallable_type(obj):
"""adds __marshallable__ support; see https://github.com/twilio/flask-restful/pull/32"""
if obj is None:
return None # m... | from flask import request
from flask.ext.restful import Api
def patched_to_marshallable_type(obj):
"""adds __marshallable__ support; see https://github.com/twilio/flask-restful/pull/32"""
if obj is None:
return None # make it idempotent for None
if hasattr(obj, '__getitem__'):
return obj ... | mit | Python |
bce6bc91779fe35d5194d224508294387c417b1b | Complete common prefix bit sol | bowen0701/algorithms_data_structures | lc0201_bitwise_and_of_numbers_range.py | lc0201_bitwise_and_of_numbers_range.py | """Leetcode 201. Bitwise AND of Numbers Range
Medium
URL: https://leetcode.com/problems/bitwise-and-of-numbers-range/
Given a range [m, n] where 0 <= m <= n <= 2147483647,
return the bitwise AND of all numbers in this range, inclusive.
Example 1:
Input: [5,7]
Output: 4
Example 2:
Input: [0,1]
Output: 0
"""
class ... | """Leetcode 201. Bitwise AND of Numbers Range
Medium
URL: https://leetcode.com/problems/bitwise-and-of-numbers-range/
Given a range [m, n] where 0 <= m <= n <= 2147483647,
return the bitwise AND of all numbers in this range, inclusive.
Example 1:
Input: [5,7]
Output: 4
Example 2:
Input: [0,1]
Output: 0
"""
class ... | bsd-2-clause | Python |
4ded6343e8c28a427af757e9dda2e6a10be40657 | enable custom envs for executed commands | dirk-thomas/vcstool,dirk-thomas/vcstool | vcstool/clients/vcs_base.py | vcstool/clients/vcs_base.py | import os
import subprocess
class VcsClientBase(object):
type = None
def __init__(self, path):
self.path = path
def __getattribute__(self, name):
if name == 'import':
try:
return self.import_
except AttributeError:
pass
ret... | import os
import subprocess
class VcsClientBase(object):
type = None
def __init__(self, path):
self.path = path
def __getattribute__(self, name):
if name == 'import':
try:
return self.import_
except AttributeError:
pass
ret... | apache-2.0 | Python |
ef5305a23b953765cc3b55bdb764487e4b5b180d | Allow for specifying not using the random module (#32763) | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/utils/pycrypto.py | salt/utils/pycrypto.py |
# -*- coding: utf-8 -*-
'''
Use pycrypto to generate random passwords on the fly.
'''
# Import python libraries
from __future__ import absolute_import
import re
import string
import random
# Import 3rd-party libs
try:
import Crypto.Random # pylint: disable=E0611
HAS_RANDOM = True
except ImportError:
HAS... |
# -*- coding: utf-8 -*-
'''
Use pycrypto to generate random passwords on the fly.
'''
# Import python libraries
from __future__ import absolute_import
import re
import string
import random
# Import 3rd-party libs
try:
import Crypto.Random # pylint: disable=E0611
HAS_RANDOM = True
except ImportError:
HAS... | apache-2.0 | Python |
5e21a1f8f1c1543faabe65fc9b7272ce53bc4e3c | Update withings endpoints | python-social-auth/social-core,python-social-auth/social-core | social_core/backends/withings.py | social_core/backends/withings.py | from .oauth import BaseOAuth1
class WithingsOAuth(BaseOAuth1):
name = 'withings'
AUTHORIZATION_URL = 'https://developer.health.nokia.com/account/authorize'
REQUEST_TOKEN_URL = 'https://developer.health.nokia.com/account/request_token'
ACCESS_TOKEN_URL = 'https://developer.health.nokia.com/account/acce... | from .oauth import BaseOAuth1
class WithingsOAuth(BaseOAuth1):
name = 'withings'
AUTHORIZATION_URL = 'https://oauth.withings.com/account/authorize'
REQUEST_TOKEN_URL = 'https://oauth.withings.com/account/request_token'
ACCESS_TOKEN_URL = 'https://oauth.withings.com/account/access_token'
ID_KEY = '... | bsd-3-clause | Python |
d5b09f5beb5162fcb7d9751abfe699da53009351 | rewrite plot2rst example. | matteoicardi/mpltools,tonysyu/mpltools | doc/examples/sphinx/plot_plot2rst.py | doc/examples/sphinx/plot_plot2rst.py | #!/usr/bin/env python
"""
====================
`plot2rst` extension
====================
`plot2rst` is a sphinx extension that converts a normal python file into
reStructuredText. All strings in the python file are converted into regular
reStructuredText, while all python code is converted into code blocks.
This exte... | #!/usr/bin/env python
"""
================
Tutorial example
================
Here's a line plot:
"""
import numpy as np
import matplotlib.pyplot as plt
'normal string'
x = np.linspace(0, 2*np.pi)
plt.plot(x, np.sin(x))
def dummy():
"""Dummy docstring"""
pass
"""
.. image:: PLOT2RST.current_figure
Here's a... | bsd-3-clause | Python |
ebd9ae7f0ed83a328555a330b6565343454d8e4f | Bump to final version 0.7.0 | learningequality/ricecooker,learningequality/ricecooker,learningequality/ricecooker,learningequality/ricecooker | ricecooker/__init__.py | ricecooker/__init__.py | # -*- coding: utf-8 -*-
__author__ = "Learning Equality"
__email__ = "info@learningequality.org"
__version__ = "0.7.0"
import sys
if sys.version_info < (3, 6, 0):
raise RuntimeError("Ricecooker only supports Python 3.6+")
| # -*- coding: utf-8 -*-
__author__ = "Learning Equality"
__email__ = "info@learningequality.org"
__version__ = "0.7.0b6"
import sys
if sys.version_info < (3, 6, 0):
raise RuntimeError("Ricecooker only supports Python 3.6+")
| mit | Python |
16d6dd0ba2b5218d211c25e3e197d65fe163b09a | Fix broken Helsinki OIDC provider links | City-of-Helsinki/django-helusers,City-of-Helsinki/django-helusers | helusers/providers/helsinki_oidc/views.py | helusers/providers/helsinki_oidc/views.py | import requests
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter, OAuth2LoginView, OAuth2CallbackView
)
from .provider import HelsinkiOIDCProvider
class HelsinkiOIDCOAuth2Adapter(OAuth2Adapter):
provider_id = HelsinkiOIDCProvider.id
access_token_url = 'https://api.hel.fi/sso/openi... | import requests
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter, OAuth2LoginView, OAuth2CallbackView
)
from .provider import HelsinkiOIDCProvider
class HelsinkiOIDCOAuth2Adapter(OAuth2Adapter):
provider_id = HelsinkiOIDCProvider.id
access_token_url = 'https://api.hel.fi/sso-test/... | bsd-2-clause | Python |
84db360ec3542daa63c93011215c341ba047ed62 | remove answers extension line | GEM-benchmark/NL-Augmenter | transformations/redundant_context_for_qa/transformation.py | transformations/redundant_context_for_qa/transformation.py | from typing import Tuple, List
from interfaces.QuestionAnswerOperation import QuestionAnswerOperation
from tasks.TaskTypes import TaskType
"""
Simple perturbation to demonstrate a question answering perturbation. This perturbation repeats the context blindly
and expects the answers still to be the same. Note that thi... | from typing import Tuple, List
from interfaces.QuestionAnswerOperation import QuestionAnswerOperation
from tasks.TaskTypes import TaskType
"""
Simple perturbation to demonstrate a question answering perturbation. This perturbation repeats the context blindly
and expects the answers still to be the same. Note that thi... | mit | Python |
efe8c878d2bf2d31c67427bbc040f58d142458e3 | Use popen method to add user vmmaster and fix copying of vmmaster/home files | sh0ked/vmmaster,2gis/vmmaster,2gis/vmmaster,sh0ked/vmmaster,2gis/vmmaster | vmmaster/core/utils/init.py | vmmaster/core/utils/init.py | import subprocess
import crypt
import os
from os.path import expanduser
from .print_utils import cin, cout, OKGREEN, WARNING, FAIL
from vmmaster import package_dir
from .system_utils import run_command
from .utils import change_user_vmmaster
def files(path):
for path, subdirs, filenames in os.walk(path):
... | import subprocess
import crypt
import os
from os.path import expanduser
from .print_utils import cin, cout, OKGREEN, WARNING, FAIL
from vmmaster import package_dir
from .system_utils import run_command
from .utils import change_user_vmmaster
def files(path):
for path, subdirs, filenames in os.walk(path):
... | mit | Python |
bbbeeb0099138730746ce539174d806ab172351f | remove wsgi service | vmthunder/virtman | vmthunder/cmd/vmthunderd.py | vmthunder/cmd/vmthunderd.py | #!/usr/bin/env python
import sys
import threading
import time
from oslo.config import cfg
from vmthunder import compute
from vmthunder.openstack.common import log as logging
#TODO: Auto determine host ip if not filled in conf file
host_opts = [
cfg.StrOpt('host_ip',
default='10.107.... | #!/usr/bin/env python
import sys
import threading
import time
from oslo.config import cfg
from vmthunder import compute
from vmthunder.common import wsgi
from vmthunder.openstack.common import log as logging
#TODO: Auto determine host ip if not filled in conf file
host_opts = [
cfg.StrOpt('host_ip... | apache-2.0 | Python |
cde2ef098ee5eb444c16ab96aa00d5ef6390d936 | rename test case | yngcan/patentprocessor,yngcan/patentprocessor,nikken1/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,funginstitute/patentprocessor,yngcan/patentprocessor | lib/new_xml_parsing/test_xml_driver.py | lib/new_xml_parsing/test_xml_driver.py | #!/usr/bin/env python
import os
import re
import unittest
from xml_driver import XMLElement, XMLHandler
from xml.sax import make_parser, handler
# Directory of test files
xml_files = [x for x in os.listdir('test_xml_files')
if re.match(r"2012_\d.xml", x) != None] # Match fixtures
parsed_xml = []
for xf ... | #!/usr/bin/env python
import os
import re
import unittest
from xml_driver import XMLElement, XMLHandler
from xml.sax import make_parser, handler
# Directory of test files
xml_files = [x for x in os.listdir('test_xml_files')
if re.match(r"2012_\d.xml", x) != None] # Match fixtures
parsed_xml = []
for xf ... | bsd-2-clause | Python |
5dc9f2f376b5ac918c1872e1270a782a9ef45ac9 | Make sure that auto-detected task only has one sub-task | CKrawczyk/python-reducers-for-caesar | panoptes_aggregation/extractors/workflow_extractor_config.py | panoptes_aggregation/extractors/workflow_extractor_config.py | def workflow_extractor_config(tasks):
extractor_config = {}
for task_key, task in tasks.items():
if task['type'] == 'drawing':
tools_config = {}
for tdx, tool in enumerate(task['tools']):
if ((tool['type'] == 'polygon') and
(len(tool['details'])... | def workflow_extractor_config(tasks):
extractor_config = {}
for task_key, task in tasks.items():
if task['type'] == 'drawing':
tools_config = {}
for tdx, tool in enumerate(task['tools']):
if ((tool['type'] == 'polygon') and
(len(tool['details'])... | apache-2.0 | Python |
401db4ee8c67d065b4383e36d7921f6614e4e2c4 | fix tabs blowing up unit tests that use a test client.. we agree not to have perfect tabs during testing | caktus/rapidsms,lsgunth/rapidsms,eHealthAfrica/rapidsms,dimagi/rapidsms,lsgunth/rapidsms,eHealthAfrica/rapidsms,eHealthAfrica/rapidsms,peterayeni/rapidsms,unicefuganda/edtrac,unicefuganda/edtrac,catalpainternational/rapidsms,catalpainternational/rapidsms,dimagi/rapidsms,ken-muturi/rapidsms,unicefuganda/edtrac,catalpain... | lib/rapidsms/templatetags/tabs_tags.py | lib/rapidsms/templatetags/tabs_tags.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import types
import threading
from functools import wraps
from django import template
from django.conf import settings
from django.core.urlresolvers import get_resolver, reverse, RegexURLPattern
from django.utils.importlib import import_module
from django.template im... | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import types
import threading
from functools import wraps
from django import template
from django.conf import settings
from django.core.urlresolvers import get_resolver, reverse, RegexURLPattern
from django.utils.importlib import import_module
from django.template im... | bsd-3-clause | Python |
78dea51cb04d6c5bd20dacd1eacae6d9e270dfb6 | allow create registration for Event Manager | it-projects-llc/website-addons,it-projects-llc/website-addons,it-projects-llc/website-addons | website_event_attendee_signup/models/event_registration.py | website_event_attendee_signup/models/event_registration.py | # -*- coding: utf-8 -*-
from odoo import api, models
class EventRegistration(models.Model):
_inherit = "event.registration"
@api.model
def create(self, vals):
res = super(EventRegistration, self).create(vals)
if res.event_id.attendee_signup and res.attendee_partner_id:
login ... | # -*- coding: utf-8 -*-
from odoo import api, models
class EventRegistration(models.Model):
_inherit = "event.registration"
@api.model
def create(self, vals):
res = super(EventRegistration, self).create(vals)
if res.event_id.attendee_signup and res.attendee_partner_id:
login ... | mit | Python |
9a7c51054f52ce845408b99680e8b169a38e5089 | handle struct columns with NA elements | cpcloud/ibis,ibis-project/ibis,cpcloud/ibis,ibis-project/ibis,ibis-project/ibis,cpcloud/ibis,ibis-project/ibis,cpcloud/ibis | ibis/backends/pandas/execution/structs.py | ibis/backends/pandas/execution/structs.py | """Pandas backend execution of struct fields and literals."""
import collections
import functools
import pandas as pd
from pandas.core.groupby import SeriesGroupBy
import ibis.expr.operations as ops
from ibis.backends.pandas.dispatch import execute_node
@execute_node.register(ops.StructField, collections.abc.Mappi... | """Pandas backend execution of struct fields and literals."""
import collections
import operator
import pandas as pd
from pandas.core.groupby import SeriesGroupBy
import ibis.expr.operations as ops
from ibis.backends.pandas.dispatch import execute_node
@execute_node.register(ops.StructField, collections.abc.Mappin... | apache-2.0 | Python |
f7cc06046786d6345cbaa7712eab5038f8fbe9f6 | Remove debug prints | waltermoreira/dockeransible,waltermoreira/dockeransible | app_builder/app_builder_image/concat_roles.py | app_builder/app_builder_image/concat_roles.py | import glob
import os
import shutil
import subprocess
import yaml
def create_role(role):
ret = subprocess.check_output(
'ansible-galaxy init {}'.format(role).split())
if not ret.strip().endswith('created successfully'):
raise Exception('could not create role "{}"'.format(role))
def get_meta... | import glob
import os
import shutil
import subprocess
import yaml
def create_role(role):
ret = subprocess.check_output(
'ansible-galaxy init {}'.format(role).split())
if not ret.strip().endswith('created successfully'):
raise Exception('could not create role "{}"'.format(role))
def get_meta... | mit | Python |
ec1698c9b9d4d6fe417d80b94ef2c5c88b036de2 | bump version to 0.2.1 for adding an RST readme | kratsg/optimization,kratsg/optimization,kratsg/optimization | root_optimize/__init__.py | root_optimize/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-,
from __future__ import absolute_import
from __future__ import print_function
__version__ = '0.2.1'
__all__ = ['json_encoder',
'utils']
| #!/usr/bin/env python
# -*- coding: utf-8 -*-,
from __future__ import absolute_import
from __future__ import print_function
__version__ = '0.2.0'
__all__ = ['json_encoder',
'utils']
| mit | Python |
e743f8003e5c876b0d9c71c201c1058b5bc02340 | update plotting example for new colorbar API | jdreaver/vispy,Eric89GXL/vispy,kkuunnddaannkk/vispy,inclement/vispy,kkuunnddaannkk/vispy,QuLogic/vispy,srinathv/vispy,RebeccaWPerry/vispy,michaelaye/vispy,bollu/vispy,bollu/vispy,Eric89GXL/vispy,kkuunnddaannkk/vispy,ghisvail/vispy,inclement/vispy,Eric89GXL/vispy,drufat/vispy,RebeccaWPerry/vispy,inclement/vispy,drufat/v... | examples/basics/plotting/colorbar.py | examples/basics/plotting/colorbar.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# vispy: gallery 1
"""
Plot different styles of ColorBar using vispy.plot
"""
from vispy import plot as vp
fig = vp.Fig(size=(800, 400), show=False)
plot = fig[0, 0]
# note:... | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# vispy: gallery 1
"""
Plot different styles of ColorBar using vispy.plot
"""
from vispy import plot as vp
fig = vp.Fig(size=(800, 400), show=False)
plot = fig[0, 0]
# note:... | bsd-3-clause | Python |
068c1a2111ec31acdc91e3ac85f5182fc738b4d6 | Add missing pandas import to plotting/server/elements.py | eteq/bokeh,ericdill/bokeh,ptitjano/bokeh,khkaminska/bokeh,maxalbert/bokeh,roxyboy/bokeh,mindriot101/bokeh,ericmjl/bokeh,rhiever/bokeh,birdsarah/bokeh,xguse/bokeh,justacec/bokeh,dennisobrien/bokeh,timsnyder/bokeh,htygithub/bokeh,deeplook/bokeh,muku42/bokeh,draperjames/bokeh,bokeh/bokeh,tacaswell/bokeh,draperjames/bokeh,... | examples/plotting/server/elements.py | examples/plotting/server/elements.py | import pandas as pd
from bokeh.plotting import *
from bokeh.sampledata import periodic_table
elements = periodic_table.elements
elements = elements[elements['atomic number'] <= 82]
elements = elements[~pd.isnull(elements['melting point'])]
mass = [float(x.strip('[]')) for x in elements['atomic mass']]
elements['atomi... | from bokeh.plotting import *
from bokeh.sampledata import periodic_table
elements = periodic_table.elements
elements = elements[elements['atomic number'] <= 82]
elements = elements[~pd.isnull(elements['melting point'])]
mass = [float(x.strip('[]')) for x in elements['atomic mass']]
elements['atomic mass'] = mass
pale... | bsd-3-clause | Python |
b71ee1ee1a4a2222bf3afcab8aa87f09dea7ef7c | Add data_src attr as URL source in image_extractor (#58) | googleinterns/stampify,googleinterns/stampify,googleinterns/stampify | extraction/content_extractors/image_extractor.py | extraction/content_extractors/image_extractor.py | """This script checks whether DOM has image tag or not and
creates and returns the Image object"""
import bs4
from data_models.image import Image
from extraction.content_extractors.interface_content_extractor import \
IContentExtractor
from extraction.utils import media_extraction_utils as utils
class ImageExtr... | """This script checks whether DOM has image tag or not and
creates and returns the Image object"""
import bs4
from data_models.image import Image
from extraction.content_extractors.interface_content_extractor import \
IContentExtractor
from extraction.utils import media_extraction_utils as utils
class ImageExtr... | apache-2.0 | Python |
9b5af6525c1ec2c187c43b10074709f7a93fcb5e | Save correctly transfer screen | alfredoavanzosc/odoomrp-wip-1,jobiols/odoomrp-wip,jorsea/odoomrp-wip,Daniel-CA/odoomrp-wip-public,windedge/odoomrp-wip,factorlibre/odoomrp-wip,alhashash/odoomrp-wip,xpansa/odoomrp-wip,sergiocorato/odoomrp-wip,odoomrp/odoomrp-wip,Eficent/odoomrp-wip,slevenhagen/odoomrp-wip-npg,odoocn/odoomrp-wip,michaeljohn32/odoomrp-wi... | stock_picking_package_info/wizard/stock_transfer_details.py | stock_picking_package_info/wizard/stock_transfer_details.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, api
from datetime import dateti... | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, api
from datetime import dateti... | agpl-3.0 | Python |
e8ae5f2c876426547f10a3d0628c7e6b3602826c | Remove mixin Select2FieldMixin | Polyconseil/django-select2-rocks,Polyconseil/django-select2-rocks,Polyconseil/django-select2-rocks,Polyconseil/django-select2-rocks | select2rocks/fields.py | select2rocks/fields.py | from django import forms
from select2rocks.widgets import AjaxSelect2Widget
def label_from_instance_with_pk(self, obj, val):
"""Add pk to label to associate label to input in multiple fields"""
return "{pk}:{val}".format(pk=obj.pk, val=val)
class Select2ModelChoiceField(forms.ModelChoiceField):
widget ... | from django import forms
from select2rocks.widgets import AjaxSelect2Widget
class Select2FieldMixin(object):
widget = AjaxSelect2Widget
def label_from_instance(self, obj):
if self._label_from_instance is not None:
val = self._label_from_instance(obj)
else:
val = super... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.