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 |
|---|---|---|---|---|---|---|---|---|
12d3f87dc06edfbb39ad378242f3c253ae256108 | Convert racket to new style executor, even if it doesn't work | DMOJ/judge,DMOJ/judge,DMOJ/judge | dmoj/executors/RKT.py | dmoj/executors/RKT.py | import errno
from dmoj.cptbox.syscalls import *
from dmoj.executors.base_executor import ScriptExecutor
from dmoj.judgeenv import env
class Executor(ScriptExecutor):
ext = '.rkt'
name = 'RKT'
fs = ['.*\.(?:so|rkt?$)', '/dev/tty$', '/proc/meminfo$', '.*racket.*', '/proc/stat$',
'/proc/self/maps$... | from subprocess import Popen
import errno
from dmoj.executors.resource_proxy import ResourceProxy
from .utils import test_executor
from dmoj.cptbox import SecurePopen, CHROOTSecurity, PIPE
from dmoj.cptbox.syscalls import *
from dmoj.judgeenv import env
RACKET_FS = ['.*\.(?:so|rkt?$)', '/dev/tty$', '/proc/meminfo$',... | agpl-3.0 | Python |
41c718c6cda0c85a68addcf9308d1ecd52bc8e34 | remove unnecessary wrapping of stateful, stateless function | paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,gautam1858/tensorflow,paolodedios/tensorflow,Intel-Corporation/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,yongtang/tensorflow,yongtang/tensorflow,tensorflow/... | tensorflow/python/ops/script_ops_test.py | tensorflow/python/ops/script_ops_test.py | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | Python |
4da8d8f227a85dfa89c52cfb5c496b5b40d5f07d | Update config.py | wildfishyu/BuildBot | BuildBot/config.py | BuildBot/config.py | # coding=utf-8
#
WORKSPACE = ''
SVN_PATH = '%WORKSPACE%' + '\\KBSS_WLFS\\'
SOLUTION_PATH = SVN_PATH + '\\solution\\'
SOLUTION = SOLUTION_PATH + '\\KBSS.sln'
VERSION_TAG = 'KBSS_WLFS_V1.0_SP4'
PUBLISH_PATH = '%WORKSPACE%' + '\\issue\\KBSS_WLFS\\'
KCBP_CONTROL_SERVICE = 'http://127.0.0.1:8001/restartkcbp'
# BUILDB... | # coding=utf-8
#
WORKSPACE = ''
SVN_PATH = '%WORKSPACE%' + '\\KBSS_WLFS\\'
SOLUTION_PATH = SVN_PATH + '\\solution\\'
SOLUTION = SOLUTION_PATH + '\\KBSS.sln'
VERSION_TAG = 'KBSS_WLFS_V1.0_SP4'
PUBLISH_PATH = '%WORKSPACE%' + '\\issue\\KBSS_WLFS\\'
KCBP_CONTROL_SERVICE = 'http://172.16.41.114:8001/restartkcbp'
# BU... | apache-2.0 | Python |
f13e232e451254dc150c80fd625354907a9a4713 | update unicel urls | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/messaging/smsbackends/unicel/urls.py | corehq/messaging/smsbackends/unicel/urls.py | from django.conf.urls import patterns, url
from corehq.messaging.smsbackends.unicel.views import incoming
urlpatterns = patterns('',
url(r'^in/$', incoming, name='incoming'),
)
| from django.conf.urls import *
urlpatterns = patterns('',
url(r'^in/$', 'corehq.messaging.smsbackends.unicel.views.incoming'),
)
| bsd-3-clause | Python |
066aefc6256d40087df0a1f30b07466e3701ba2a | remove one final bit of hstore | crateio/crate.io | crate_project/settings/production/gondor.py | crate_project/settings/production/gondor.py | from .base import *
from local_settings import *
from secret_settings import *
# Fix Email Settings
SERVER_EMAIL = "server@crate.io"
DEFAULT_FROM_EMAIL = "donald@crate.io"
DATABASES["default"]["ENGINE"] = "django.db.backends.postgresql_psycopg2"
# Configure Celery
BROKER_TRANSPORT = "redis"
BROKER_HOST = GONDOR_RED... | from .base import *
from local_settings import *
from secret_settings import *
# Fix Email Settings
SERVER_EMAIL = "server@crate.io"
DEFAULT_FROM_EMAIL = "donald@crate.io"
# Fix Database Engine for hstore
DATABASES["default"]["ENGINE"] = "django_hstore.postgresql_psycopg2"
# Configure Celery
BROKER_TRANSPORT = "red... | bsd-2-clause | Python |
f6759ae7b089bce8d10b8455d5157c0bf3cb8561 | Change the name of file | tarzan0820/odoo,NL66278/OCB,jiangzhixiao/odoo,ClearCorp-dev/odoo,dalegregory/odoo,nagyistoce/odoo-dev-odoo,juanalfonsopr/odoo,takis/odoo,funkring/fdoo,erkrishna9/odoo,avoinsystems/odoo,aviciimaxwell/odoo,alqfahad/odoo,wangjun/odoo,apanju/odoo,bakhtout/odoo-educ,thanhacun/odoo,osvalr/odoo,havt/odoo,Endika/odoo,feroda/od... | addons/base_report_designer/__terp__.py | addons/base_report_designer/__terp__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
#... | agpl-3.0 | Python |
4aa349715c3cca9ef7ed8463a484dc130d367c8e | Update test.py | inkenbrandt/WellApplication | test/test.py | test/test.py | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 23 13:03:00 2016
@author: p
"""
import wellapplication as wa
def test_getelev(self):
x = [-111.21,41.4]
g = wa.getelev(x)
assert g > 100.0
| # -*- coding: utf-8 -*-
"""
Created on Sat Jan 23 13:03:00 2016
@author: p
"""
import unittest
import wellapplication as wa
class TestMethods(unittest.TestCase):
def setUp(self):
pass
def test_getelev(self):
x = [-111.21,41.4]
g = wa.getelev(x)
self.assertTrue(g > 100.0... | mit | Python |
dd84635c1c990c23cb0c2d8f48c1bc226687f0c3 | Remove item | SG345/autopep8,vauxoo-dev/autopep8,Vauxoo/autopep8,Vauxoo/autopep8,vauxoo-dev/autopep8,hhatto/autopep8,MeteorAdminz/autopep8,SG345/autopep8,MeteorAdminz/autopep8,hhatto/autopep8 | test/todo.py | test/todo.py | """Incomplete fixes."""
| """Incomplete fixes."""
# E501: This should be wrapped similar to how pprint does it
{'2323k2323': 24232323, '2323323232323': 3434343434343434, '34434343434535535': 3434343434343434, '4334343434343': 3434343434}
# See below
{'2323323232323': 3434343434343434,
'2323k2323': 24232323,
'34434343434535535': 343434343434... | mit | Python |
1fd96248bbfd74a1938520b37cf136762559a23b | Update pylsy_test.py | bcho/Pylsy,bcho/Pylsy,gnithin/Pylsy,huiyi1990/Pylsy,muteness/Pylsy,gnithin/Pylsy,muteness/Pylsy,huiyi1990/Pylsy | pylsy/tests/pylsy_test.py | pylsy/tests/pylsy_test.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import unittest
import sys
sys.path.append('.')
from pylsy import pylsytable
class PylsyTableTests(unittest.TestCase):
def setUp(self):
attributes = ["name", "age"]
self.table = pylsytable(attributes)
def tearDown(self):
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import unittest
import sys
sys.path.append('..')
from pylsy import pylsytable
class PylsyTableTests(unittest.TestCase):
def setUp(self):
attributes = ["name", "age"]
self.table = pylsytable(attributes)
def tearDown(self):
... | mit | Python |
8eb5da4a5d2757ade473894d624303692a80bc67 | check Python version | cyberbeast/pympler,aigeano/pympler,tharunkalwa/pympler | pympler/sizer/__init__.py | pympler/sizer/__init__.py |
# check supported Python version
import sys
if getattr(sys, 'hexversion', 0) < 0x2020000:
raise NotImplementedError('sizer requires Python 2.2 or newer')
from asizeof import *
| from asizeof import *
| apache-2.0 | Python |
8c3fc2bafd0722e23c53b4edc054703cef167b89 | Remove ipdb.set_trace() debug statement. | AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter... | python_scripts/mc_solr.py | python_scripts/mc_solr.py | import requests
import ipdb
import mc_config
import psycopg2
import psycopg2.extras
import time
def get_solr_location():
##TODO -- get this from the yaml file
return 'http://localhost:8983'
def get_solr_collection_url_prefix():
return get_solr_location() + '/solr/collection1'
def solr_request( path, para... | import requests
import ipdb
import mc_config
import psycopg2
import psycopg2.extras
import time
def get_solr_location():
##TODO -- get this from the yaml file
return 'http://localhost:8983'
def get_solr_collection_url_prefix():
return get_solr_location() + '/solr/collection1'
def solr_request( path, para... | agpl-3.0 | Python |
006b645315190eb532ede9c36c77a7fbc4c27237 | Allow retrieval of a random quote | jessamynsmith/socialjusticebingo,jessamynsmith/underquoted,jessamynsmith/socialjusticebingo,jessamynsmith/underquoted,jessamynsmith/underquoted,jessamynsmith/socialjusticebingo,jessamynsmith/underquoted | quotations/apps/api/v1.py | quotations/apps/api/v1.py | from tastypie.authorization import DjangoAuthorization
from tastypie import fields
from tastypie.resources import ModelResource, ALL_WITH_RELATIONS
from quotations.apps.quotations import models as quotations_models
from quotations.libs.auth import MethodAuthentication
from quotations.libs.serializers import Serializer
... | from tastypie.authorization import DjangoAuthorization
from tastypie import fields
from tastypie.resources import ModelResource, ALL_WITH_RELATIONS
from quotations.apps.quotations import models as quotations_models
from quotations.libs.auth import MethodAuthentication
from quotations.libs.serializers import Serializer
... | mit | Python |
00dbe74fdea0bdb651131b7071f1c4f235db837c | Add properties for collections | McGillX/edx_data_research,McGillX/edx_data_research,McGillX/edx_data_research | reporting_scripts/base.py | reporting_scripts/base.py | import csv
from pymongo import MongoClient
class BaseEdX(object):
def __init__(self, args):
self.url = args.url
client = MongoClient(self.url)
self.db = client[args.db_name]
self._collections = None
self.output_directory = args.output_directory
self.row_limit = arg... | import csv
from pymongo import MongoClient
class BaseEdX(object):
def __init__(self, args):
self.url = args.url
client = MongoClient(self.url)
self.db = client[args.db_name]
self.collections = None
self.output_directory = args.output_directory
self.row_limit = args... | mit | Python |
602689fb7e5b348c83f18067aa5dbbcfd2d51262 | Correct import order | rickmak/chat,SkygearIO/chat,SkygearIO/chat | chat/pubsub.py | chat/pubsub.py | from skygear.models import Record
from skygear.options import options as skyoptions
from skygear.pubsub import Hub
from .encoding import serialize_record
from .utils import _get_channel_by_user_id
def _publish_event(user_id: str, event: str, data: dict = None) -> None:
channel_name = _get_channel_by_user_id(user... | from skygear.models import Record
from skygear.pubsub import Hub
from skygear.options import options as skyoptions
from .encoding import serialize_record
from .utils import _get_channel_by_user_id
def _publish_event(user_id: str, event: str, data: dict = None) -> None:
channel_name = _get_channel_by_user_id(user... | apache-2.0 | Python |
ac9352ca3ca7d18128fde3727738dddb25b8418f | Update urls.py | ikatson/django-chunks | chunks/urls.py | chunks/urls.py | from django.conf.urls import *
urlpatterns = patterns('chunks.views',
url(r'^(?P<slug>\w+)/edit/$', 'edit_link', name='edit_chunk'),
)
| from django.conf.urls.defaults import *
urlpatterns = patterns('chunks.views',
url(r'^(?P<slug>\w+)/edit/$', 'edit_link', name='edit_chunk'),
)
| bsd-3-clause | Python |
d7cc236de2056997660c2e01861b8d8f75e46bcc | Add documentation to the booking methods | andreagrandi/booking-example | booking/restaurants/booking.py | booking/restaurants/booking.py | from datetime import timedelta
from .models import Table, Booking
def book_restaurant_table(restaurant, booking_date_time, people, minutes_slot=90):
"""
This method uses get_first_table_available to get the first table available, then it
creates a Booking on the database.
"""
table = get_first_tabl... | from datetime import timedelta
from .models import Table, Booking
def book_restaurant_table(restaurant, booking_date_time, people, minutes_slot=90):
table = get_first_table_available(restaurant, booking_date_time, people, minutes_slot)
if table:
booking = Booking(table=table, people=people, booking_da... | mit | Python |
98c23a94152b31b047519df4e59c313f3a5e855f | Improve watermark functionality (1) | jiss-software/jiss-rendering-service,jiss-software/jiss-rendering-service | handler/Watermark.py | handler/Watermark.py | import core
import tornado
import uuid
import time
from utils import open_remote_image, add_watermark, open_image
class WatermarkHandler(core.BaseHandler):
@tornado.web.asynchronous
@tornado.gen.coroutine
def get(self):
self.logger.info('Request watermark generation for remote file')
name... | import core
import tornado
import uuid
from utils import open_remote_image, add_watermark, open_image
class WatermarkHandler(core.BaseHandler):
@tornado.web.asynchronous
@tornado.gen.coroutine
def get(self):
self.logger.info('Request watermark generation for remote file')
name = '/tmp/%s.... | apache-2.0 | Python |
01f643bee6f71f1af1a52ecd06170b8a1f0ef578 | Increase version to 0.3dev | tekton/happybase,rickysaltzer/happybase,wfxiang08/happybase,georgesuperman/happybase,TAKEALOT/happybase | happybase/version.py | happybase/version.py | """
HappyBase version module.
This module defines the package version for use in __init__.py and
setup.py.
"""
__version__ = '0.3dev'
| """
HappyBase version module.
This module defines the package version for use in __init__.py and
setup.py.
"""
__version__ = '0.2'
| apache-2.0 | Python |
bf46a771d6ca15da75110cee6ed4f9335e1c67f8 | Add test form ResultMonitor.get_logframe | daniell/kashana,aptivate/kashana,daniell/kashana,daniell/kashana,daniell/kashana,aptivate/alfie,aptivate/kashana,aptivate/alfie,aptivate/kashana,aptivate/kashana,aptivate/alfie,aptivate/alfie | django/website/logframe/tests/test_views.py | django/website/logframe/tests/test_views.py | import pytest
import json
from unittest import TestCase
from django_dynamic_fixture import G
from ..views import ResultEditor, ResultMonitor
from ..models import (
LogFrame,
Result,
Assumption,
Rating,
)
from ..api import ResultSerializer
class ResultEditorTests(TestCase):
def setUp(self):
... | import pytest
import json
from unittest import TestCase
from django_dynamic_fixture import G
from ..views import ResultEditor
from ..models import (
LogFrame,
Result,
Assumption,
Rating,
)
from ..api import ResultSerializer
class ResultEditorTests(TestCase):
def setUp(self):
self.view = R... | agpl-3.0 | Python |
2985e6b2dd918fa1770469a31e613ab6f43b40f9 | Stop using Python 2 | MichaelCurrin/twitterverse,MichaelCurrin/twitterverse | app/lib/db_query/schema/table_counts.py | app/lib/db_query/schema/table_counts.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Database stats report for all the tables and row counts.
Usage:
$ python -m lib.query.schema.table_counts
# => print results to console.
"""
from __future__ import absolute_import
from __future__ import print_function
from sqlobject.dberrors import OperationalE... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Database stats report for all the tables and row counts.
Usage:
$ python -m lib.query.schema.table_counts
# => print results to console.
"""
from __future__ import absolute_import
from __future__ import print_function
from sqlobject.dberrors import Operational... | mit | Python |
8be6b576007f89fad50ea1dfacad46614c0a97c5 | ADD new exception -> EnvironmentNotFound! | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | apps/domain/src/main/core/exceptions.py | apps/domain/src/main/core/exceptions.py | """Specific PyGrid exceptions."""
class PyGridError(Exception):
def __init__(self, message):
super().__init__(message)
class AuthorizationError(PyGridError):
def __init__(self, message=""):
if not message:
message = "User is not authorized for this operation!"
super().__i... | """Specific PyGrid exceptions."""
class PyGridError(Exception):
def __init__(self, message):
super().__init__(message)
class AuthorizationError(PyGridError):
def __init__(self, message=""):
if not message:
message = "User is not authorized for this operation!"
super().__i... | apache-2.0 | Python |
50616732244e76afa375e5aefcbd8625c0ba6503 | Test for parsing a list of integers + disambiguation. | igordejanovic/parglare,igordejanovic/parglare | tests/func/test_parse_list_of_objects.py | tests/func/test_parse_list_of_objects.py | import pytest # noqa
from parglare import Grammar, Parser
from parglare.exceptions import ParseError
from parglare.actions import pass_single, pass_nochange, collect
def test_parse_list_of_integers():
grammar = """
Numbers = all_less_than_five EOF;
all_less_than_five = all_less_than_five int_less_than_f... | import pytest # noqa
from parglare import Grammar, Parser
from parglare.exceptions import ParseError
from parglare.actions import pass_single, collect
def test_parse_list_of_integers():
grammar = """
Numbers = all_less_than_five EOF;
all_less_than_five = all_less_than_five int_less_than_five
... | mit | Python |
a24afe5e44a14d2f5971c122b373efa1d4052d19 | Index doesn't capture path | w0rm/todo,w0rm/todo | controllers/index.py | controllers/index.py | from template import render
class Index:
def GET(self):
return render.index()
| from template import render
class Index:
def GET(self, path=None):
return render.index()
| mit | Python |
a04aa71a1e097773c1c1966f3d872ddfd79c7253 | Allow usage of Cookiecutter as a library, not just a command. | michaeljoseph/cookiecutter,vincentbernat/cookiecutter,utek/cookiecutter,janusnic/cookiecutter,takeflight/cookiecutter,lgp171188/cookiecutter,kkujawinski/cookiecutter,moi65/cookiecutter,cichm/cookiecutter,lucius-feng/cookiecutter,jhermann/cookiecutter,cguardia/cookiecutter,nhomar/cookiecutter,pjbull/cookiecutter,atlassi... | cookiecutter/main.py | cookiecutter/main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.main
-----------------
Main entry point for the `cookiecutter` command.
The code in this module is also a good example of how to use Cookiecutter as a
library rather than a script.
"""
import argparse
import logging
import os
from .cleanup import remov... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.main
-----------------
Main entry point for the `cookiecutter` command.
The code in this module is also a good example of how to use Cookiecutter as a
library rather than a script.
"""
import argparse
import logging
import os
from .cleanup import remov... | bsd-3-clause | Python |
07404cabc5ea2cab65be063225a093362175e45f | Bump version number for release | html5lib/html5lib-python,html5lib/html5lib-python,html5lib/html5lib-python | html5lib/__init__.py | html5lib/__init__.py | """
HTML parsing library based on the `WHATWG HTML specification
<https://whatwg.org/html>`_. The parser is designed to be compatible with
existing HTML found in the wild and implements well-defined error recovery that
is largely compatible with modern desktop web browsers.
Example usage::
import html5lib
wit... | """
HTML parsing library based on the `WHATWG HTML specification
<https://whatwg.org/html>`_. The parser is designed to be compatible with
existing HTML found in the wild and implements well-defined error recovery that
is largely compatible with modern desktop web browsers.
Example usage::
import html5lib
wit... | mit | Python |
50454e4920798c41759d4d114f65c2c111b8aadb | Add CLI help test | jdgwartney/boundary-api-cli,boundary/pulse-api-cli,boundary/boundary-api-cli,jdgwartney/pulse-api-cli,jdgwartney/boundary-api-cli,boundary/boundary-api-cli,boundary/pulse-api-cli,jdgwartney/pulse-api-cli | tests/unit/boundary/event_create_test.py | tests/unit/boundary/event_create_test.py | #!/usr/bin/env python
#
# Copyright 2015 BMC Software, 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 applicab... | #!/usr/bin/env python
#
# Copyright 2015 BMC Software, 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 applicab... | apache-2.0 | Python |
11e6ddf33c3fea07ddb0a42b983da856a9ce2ae2 | Fix SMTP test | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/returners/smtp_return_test.py | tests/unit/returners/smtp_return_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Mike Place (mp@saltstack.com)`
tests.unit.returners.smtp_return_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'''
# Import Salt Testing libs
from salttesting import TestCase, skipIf
from salttesting.helpers import ensure_in_syspath
from salttesting.mock impor... | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Mike Place (mp@saltstack.com)`
tests.unit.returners.smtp_return_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'''
# Import Salt Testing libs
from salttesting import skipIf, TestCase
from salttesting.helpers import ensure_in_syspath
from salttesting.mock impor... | apache-2.0 | Python |
0fddb5d0556ca7bb612747e60a7051c939750b4e | Add SEE_MORE attribute | refeed/coala-bears,coala/coala-bears,refeed/coala-bears,coala-analyzer/coala-bears,coala/coala-bears,coala/coala-bears,refeed/coala-bears,coala-analyzer/coala-bears,coala-analyzer/coala-bears,refeed/coala-bears,coala-analyzer/coala-bears,coala-analyzer/coala-bears,coala/coala-bears,coala-analyzer/coala-bears,coala/coal... | bears/configfiles/DockerfileLintBear.py | bears/configfiles/DockerfileLintBear.py | import json
from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.NpmRequirement import NpmRequirement
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
from coalib.results.Result import Result
@linter(executable='dockerfile_lint')
class DockerfileLintBear:
"""
... | import json
from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.NpmRequirement import NpmRequirement
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
from coalib.results.Result import Result
@linter(executable='dockerfile_lint')
class DockerfileLintBear:
"""
... | agpl-3.0 | Python |
1c375984a0a6f0ff3e70c358d8a17dd88e71086f | Update doctest. | UI-DataScience/summer2014 | hw7/distributions.py | hw7/distributions.py | #!/usr/bin/python
# Week 7 problem 1. PMF, PDF, and CDF.
# Do not delete the comments.
# Do not chnage the functions names, do not change the input parameters.
# Do not change the return types of the functions.
# Your code goes to the part where it says your code goes here.
# Do not change anything else other than th... | #!/usr/bin/python
# Week 7 problem 1. PMF, PDF, and CDF.
# Do not delete the comments.
# Do not chnage the functions names, do not change the input parameters.
# Do not change the return types of the functions.
# Your code goes to the part where it says your code goes here.
# Do not change anything else other than th... | mit | Python |
1ceffc41f56e92c71760e6c347cfa90d09bb6472 | add 64 bit install | jtdressel/woodhouse | initialize_system.py | initialize_system.py | #!/usr/bin/python
#Currently unstable. Don't use.
#determine where config files are
import subprocess
import struct
import re
#if needed install dropbox
#if dropbox is set up
def install_dropbox():
if((struct.calcsize("P") *8) is 32):
#TODO: insert code to check if already installed
subprocess.... | #!/usr/bin/python
#Currently unstable. Don't use.
#determine where config files are
import subprocess
import struct
import re
#if needed install dropbox
#if dropbox is set up
def install_dropbox():
if((struct.calcsize("P") *8) is 32):
#TODO: insert code to check if already installed
subprocess.... | mit | Python |
c7c0148040cf53990bbc481fd96dc475855fcd99 | test using sys.stdin.readline() as input | fonorobert/mailforward | tofile.py | tofile.py | #!/usr/bin/env python3
#import argparse
import sys
from configparser import ConfigParser
#Parse config
config = ConfigParser()
config.read('config.cfg')
#create a list of mailing lists from the config file
# lists = []
# for k, v in config['LISTS'].items():
# #strip whitespaces from email addresses
# this_... | #!/usr/bin/env python3
import argparse
from configparser import ConfigParser
#Parse config
config = ConfigParser()
config.read('config.cfg')
#create a list of mailing lists from the config file
# lists = []
# for k, v in config['LISTS'].items():
# #strip whitespaces from email addresses
# this_list = v.spl... | mit | Python |
0dcc0116a344dd440c1f3536f36bdd399c0a7666 | Add missing name | benjolitz/powerscout,benjolitz/powerscout | powerscout/__main__.py | powerscout/__main__.py | import logging
import os.path
import time
import multiprocessing
from concurrent.futures import ProcessPoolExecutor
from japronto import Application
from .routes import REGISTRY
from .config import load_config, load_environment_variables, PREFIX
from .services.apc import update_apc_status
logger = logging.getLogger('... | import logging
import os.path
import time
import multiprocessing
from concurrent.futures import ProcessPoolExecutor
from japronto import Application
from .routes import REGISTRY
from .config import load_config, load_environment_variables, PREFIX
from .services.apc import update_apc_status
logging.basicConfig(level=lo... | bsd-3-clause | Python |
dd18adf0b4098e749493e97fea23149be16d1fc7 | tweak the tests | tsileo/blobstash,tsileo/blobstash,tsileo/blobstash | integration_tests.py | integration_tests.py | import logging
from tests.client import Blob
from tests.client import Client
from tests.server import BlobStash
MORE_BLOBS = 1000
logging.basicConfig(level=logging.DEBUG)
logging.info('Running integration tests...')
b = BlobStash()
b.cleanup()
c = Client()
logging.info('Start BlobStash')
b.run()
logging.info('[ST... | import logging
from tests.client import Blob
from tests.client import Client
from tests.server import BlobStash
MORE_BLOBS = 500
logging.basicConfig(level=logging.DEBUG)
logging.info('Running integration tests...')
b = BlobStash()
b.cleanup()
c = Client()
logging.info('Start BlobStash')
b.run()
logging.info('[STE... | mit | Python |
f80d43e0c044af0fe8792d652b8530aa1fd11366 | Add import | dbinetti/barberscore,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore-django,dbinetti/barberscore-django,dbinetti/barberscore,barberscore/barberscore-api,barberscore/barberscore-api | project/api/signals.py | project/api/signals.py | # Django
import django_rq
# Third-Party
from collections import defaultdict
from django.db.models.signals import post_save
from django.db.models.signals import pre_delete
from django.dispatch import receiver
from django.conf import settings
# Local
from .models import Person
from .models import User
from django.core.... | # Django
# Third-Party
from collections import defaultdict
from django.db.models.signals import post_save
from django.db.models.signals import pre_delete
from django.dispatch import receiver
from django.conf import settings
# Local
from .models import Person
from .models import User
from django.core.validators import ... | bsd-2-clause | Python |
a50e0d234bab6e0e8abc9751578abe1f19a08e09 | add class app, two buttons | brucelau-github/raspberry-pi-proj | window.py | window.py | from Tkinter import *
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.label = Label(frame, text="quit", fg="red")
self.label.pack(side=TOP)
self.button = Button(frame, text="quit", fg="red", command=frame.quit)
self.button.pack(side=L... | from Tkinter import *
root = Tk() #create basic window
thelabel = Label(root, text="this is very easy") #add a latbel
thelabel.pack()
root.mainloop() #keep the windows showing
| mit | Python |
5134a75065a8ac3b01e3f8bb18e10870efa6f3b7 | remove () | abraham/social-backup | worker.py | worker.py | """Backup personal social activities."""
import os
import time
from config import Config
from plus import Plus
from tweet import Tweet as Twitter
from github import GitHub
from terminal import Terminal
from disk import Disk
from mongo import Mongo
services = {}
storages = {}
config = Config(file_name=os.environ['CO... | """Backup personal social activities."""
import os
import time
from config import Config
from plus import Plus
from tweet import Tweet as Twitter
from github import GitHub
from terminal import Terminal
from disk import Disk
from mongo import Mongo
services = {}
storages = {}
config = Config(file_name=os.environ['CO... | mit | Python |
3c0489bdfa7f1cadb62899eddda182b0f602763c | Convert quilt.cli.unapplied into a Command class | bjoernricks/python-quilt,vadmium/python-quilt | quilt/cli/unapplied.py | quilt/cli/unapplied.py | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as ... | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as ... | mit | Python |
8c65f7e2e075bae468401a1eee799251c1d928df | Fix for Delay warnings when using USB audio (untested) | oksome/Home,oksome/Home,oksome/Home | raspberry_pi/config.py | raspberry_pi/config.py | #!/usr/bin/env python2
'''
More complex configuration, to run in addition to 'config.sh'.
'''
if raw_input('Set USB sound card as default ? [y][N]') in 'y', 'Y', 'yes':
original = open('/etc/modprobe.d/alsa-base.conf').read()
modified = original.replace('options snd-usb-audio index=-2', 'options snd-usb-a... | #!/usr/bin/env python2
'''
More complex configuration, to run in addition to 'config.sh'.
'''
if raw_input('Set USB sound card as default ? [y][N]') in 'y', 'Y', 'yes':
original = open('/etc/modprobe.d/alsa-base.conf').read()
modified = original.replace('options snd-usb-audio index=-2', 'options snd-usb-a... | agpl-3.0 | Python |
bd2979bf87142188eafac3981a11ccd0553735a0 | make i19conf spit out an error message when an n00b like me mis-uses it | johaness/i19,johaness/i19 | i19conf.py | i19conf.py | import sys
from os import path as osp
def main():
"""
Usage: i19conf FILENAME
Returns the absolute path to FILENAME inside the i19 module.
"""
assert len(sys.argv) > 1, main.__doc__
modpath = osp.abspath(osp.dirname(__file__))
fullpath = osp.join(modpath, sys.argv[1])
if not osp.ex... | import sys
from os import path as osp
def main():
print osp.join(osp.abspath(osp.dirname(__file__)), sys.argv[1])
| bsd-2-clause | Python |
e0b82cf9ed24870cb313328e5539acc5fe7f6508 | Add some (inefective) score maximizing attempts | ForeverWintr/stock_awesome | stock_awesome/levels/chock_a_block.py | stock_awesome/levels/chock_a_block.py | import time
from stock_awesome.obj import market
def main():
"""
Algorithm: Wait for an ask, then send a fill or kill for the quantity of the ask at the ask
price.
"""
m = market.StockAPI('RAJ40214463', 'SSMCEX', 'IPSO')
#collection of orders placed
orders = {}
filled = 0
upper... | import time
from stock_awesome.obj import market
def main():
"""
Algorithm: Wait for an ask, then send a fill or kill for the quantity of the ask at the ask
price.
"""
m = market.StockAPI('WEB29978261', 'NOWUEX', 'BBCM')
#collection of orders placed
orders = {}
filled = 0
upper... | mit | Python |
57ae768e5f4fd7c11a37a85cfb040b0b66379f2a | remove flake8 errors | ajaniv/django-core-models,ajaniv/django-core-models | create_super_user.py | create_super_user.py | #!/usr/bin/env python
"""
.. module:: create_super_user
:synopsis: crate default super user.
crate default super user
"""
# @TODO: provide the ability to pass parameters on the command line
# of settings file, user name, email, password
from __future__ import print_function
import os
from django.db.utils import ... | #!/usr/bin/env python
"""
.. module:: create_super_user
:synopsis: crate default super user.
crate default super user
"""
# @TODO: provide the ability to pass parameters on the command line
# of settings file, user name, email, password
from __future__ import print_function
import os
from django.db.utils import ... | mit | Python |
646f854ff226609e0620ffc46e17c5f2cf1b4dbc | fix path bug | imwithye/git-ignore,imwithye/git-ignore | ignores.py | ignores.py | #! /usr/bin/env python2
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 Ciel <imwithye@gmail.com>
#
# Distributed under terms of the MIT license.
import os, sys
userpath = os.path.expanduser('~') + '/.git-ignore-templates/'
syspath = sys.path[0] + "/system-templates/"
githubpath = sys.path[0] + "/github... | #! /usr/bin/env python2
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 Ciel <imwithye@gmail.com>
#
# Distributed under terms of the MIT license.
import os
userpath = os.path.expanduser('~') + '/.git-ignore-templates/'
syspath = os.getcwd() + "/system-templates/"
githubpath = os.getcwd() + "/github-temp... | mit | Python |
d2b6d8751f822237d7e6f380a22491ffade58439 | implement associativity lookup for operators | mbdriscoll/ctree,ucb-sejits/ctree,ucb-sejits/ctree | ctree/precendence.py | ctree/precendence.py | """
Utilities for determining precedence in C, with the goal of minimizing the
number of parentheses in the generated code.
"""
# ---------------------------------------------------------------------------
# dictionary of node class -> precedence ids, where 1 denotes the highest-
# precedence operator and 18 is the lo... | """
Utilities for determining precedence in C, with the goal of minimizing the
number of parentheses in the generated code.
"""
# ---------------------------------------------------------------------------
# dictionary of node class -> precedence ids, where 1 denotes the highest-
# precedence operator and 18 is the lo... | bsd-2-clause | Python |
36ee0c94a4e9812ef62b51097c9bf6a5ec181a9f | Bump version number. | ABcDexter/cython,ChristopherHogan/cython,acrispin/cython,hhsprings/cython,hickford/cython,fperez/cython,dahebolangkuan/cython,achernet/cython,scoder/cython,larsmans/cython,hpfem/cython,roxyboy/cython,fperez/cython,encukou/cython,slonik-az/cython,da-woods/cython,roxyboy/cython,hpfem/cython,hhsprings/cython,da-woods/cyth... | Cython/__init__.py | Cython/__init__.py | __version__ = "0.15rc0"
# Void cython.* directives (for case insensitive operating systems).
from Cython.Shadow import *
| __version__ = "0.14.1+"
# Void cython.* directives (for case insensitive operating systems).
from Cython.Shadow import *
| apache-2.0 | Python |
c11b5a0c88a574ecc57b278aa71fa66dd28bebb5 | Improve update on hstore | regardscitoyens/nosfinanceslocales,regardscitoyens/nosfinanceslocales,regardscitoyens/nosfinanceslocales | server/localfinance/scripts/compute_adminzonefinance_sql_variable.py | server/localfinance/scripts/compute_adminzonefinance_sql_variable.py | import os
import sys
import transaction
from sqlalchemy import engine_from_config, cast, String
from sqlalchemy.dialects.postgresql import hstore
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from ..models import (
DBSession,
AdminZoneFinance,
)
from ..maps import MAPS_CONFI... | import os
import sys
import transaction
from sqlalchemy import engine_from_config
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from ..models import (
DBSession,
AdminZoneFinance,
)
from ..maps import MAPS_CONFIG
def usage(argv):
cmd = os.path.basename(argv[0])
pri... | mit | Python |
c7de1e01b79637ba26dc79a9ff7191b2c0e6f1f4 | Fix deprecation warning | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/userreports/ui/widgets.py | corehq/apps/userreports/ui/widgets.py | from __future__ import absolute_import
import json
from django import forms
import six
class JsonWidget(forms.Textarea):
def render(self, name, value, attrs=None, renderer=None):
if isinstance(value, six.string_types):
# It's probably invalid JSON
return super(JsonWidget, self).re... | from __future__ import absolute_import
import json
from django import forms
import six
class JsonWidget(forms.Textarea):
def render(self, name, value, attrs=None):
if isinstance(value, six.string_types):
# It's probably invalid JSON
return super(JsonWidget, self).render(name, valu... | bsd-3-clause | Python |
58208c340a7dfe0619ca331583fafc361b0dd84b | Add a few master's haystack synonyms. | edx/course-discovery,edx/course-discovery,edx/course-discovery,edx/course-discovery | course_discovery/settings/synonyms.py | course_discovery/settings/synonyms.py | # Note: Do not use synonyms with punctuation, search and typeahead do not yet fully support punctuation
SYNONYMS = [
# Organizations
['ACCA', 'ACCA', 'ACCAx'],
['ACLU', 'American Civil Liberties Union'],
['ASU', 'ASUx', 'Arizona State', 'Arizona State University'],
['Berkeley', 'UC BerkeleyX', 'U... | # Note: Do not use synonyms with punctuation, search and typeahead do not yet fully support punctuation
SYNONYMS = [
# Organizations
['ACCA', 'ACCA', 'ACCAx'],
['ACLU', 'American Civil Liberties Union'],
['ASU', 'ASUx', 'Arizona State', 'Arizona State University'],
['Berkeley', 'UC BerkeleyX', 'U... | agpl-3.0 | Python |
39162536ba8f3cf02c15a482b19cbf9178d59958 | add a try..finally | Roguelazer/fakemtpd | fakemtpd/better_lockfile.py | fakemtpd/better_lockfile.py | import fcntl
import lockfile
import logging
import os
class BetterLockfile(object):
"""
A lockfile (matching the specification of the builtin lockfile class)
based off of lockf. Only uses a single lock file rather than one per process/thread.
"""
def __init__(self, path):
self.path = path
... | import fcntl
import lockfile
import logging
import os
class BetterLockfile(object):
"""
A lockfile (matching the specification of the builtin lockfile class)
based off of lockf. Only uses a single lock file rather than one per process/thread.
"""
def __init__(self, path):
self.path = path
... | isc | Python |
5984db9c3c4da1649719c8e7caa6f2ce4b43bc9a | fix condition for test submission check | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/enikshay/integrations/utils.py | custom/enikshay/integrations/utils.py | from corehq.apps.locations.models import SQLLocation
from custom.enikshay.exceptions import NikshayLocationNotFound, ENikshayCaseNotFound
from custom.enikshay.case_utils import (
get_person_case_from_episode,
get_lab_referral_from_test,
)
def _is_submission_from_test_location(person_case):
try:
ph... | from corehq.apps.locations.models import SQLLocation
from custom.enikshay.exceptions import NikshayLocationNotFound, ENikshayCaseNotFound
from custom.enikshay.case_utils import (
get_person_case_from_episode,
get_lab_referral_from_test,
)
def _is_submission_from_test_location(person_case):
try:
ph... | bsd-3-clause | Python |
b2fecb921e04f81544beaca47d150c2b60d0f8a9 | add option to hide a tag | mxm/wgmanager | core/models.py | core/models.py | from django.db import models
from myauth.models import MyUser
from datetime import datetime
from django.utils.translation import ugettext as _
class Bill(models.Model):
name = models.CharField(max_length=1023)
is_open = models.BooleanField(default=True)
def __str__(self):
return self.name
clas... | from django.db import models
from myauth.models import MyUser
from datetime import datetime
from django.utils.translation import ugettext as _
class Bill(models.Model):
name = models.CharField(max_length=1023)
is_open = models.BooleanField(default=True)
def __str__(self):
return self.name
clas... | agpl-3.0 | Python |
0b456b0544b75f690289559b5e0ec17f7e98c8d6 | bump version to 0.11.0 | ivelum/cub-python | cub/version.py | cub/version.py | version = '0.11.0'
| version = '0.10.0'
| mit | Python |
89193a6571dd74501533160b409cad8835c51625 | Handle a Django deprecation properly. | benspaulding/django-gcframe | gcframe/tests/urls.py | gcframe/tests/urls.py | # -*- coding: utf-8 -*-
""" Simple urls for use in testing the gcframe app. """
from __future__ import unicode_literals
try:
from django.conf.urls import patterns, url
except ImportError: # Django 1.3
from django.conf.urls.defaults import patterns, url
from .views import normal, framed, exempt
urlpattern... | # -*- coding: utf-8 -*-
""" Simple urls for use in testing the gcframe app. """
from __future__ import unicode_literals
# The defaults module is deprecated in Django 1.5, but necessary to
# support Django 1.3. drop ``.defaults`` when dropping 1.3 support.
from django.conf.urls.defaults import patterns, url
from .vi... | bsd-3-clause | Python |
56b761bac5b0d94632b698a1a08be10254b533e3 | Bump to Airflow 2.0.0a1 (#11507) | cfei18/incubator-airflow,nathanielvarona/airflow,mrkm4ntr/incubator-airflow,airbnb/airflow,bolkedebruin/airflow,cfei18/incubator-airflow,nathanielvarona/airflow,apache/airflow,nathanielvarona/airflow,sekikn/incubator-airflow,apache/airflow,Acehaidrey/incubator-airflow,nathanielvarona/airflow,airbnb/airflow,bolkedebruin... | airflow/version.py | airflow/version.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache-2.0 | Python |
ad4affa18aef40ed7c9551189d3de024c3af30b7 | Complete bubble_sort() & short_bubble_sort() | bowen0701/algorithms_data_structures | alg_bubble_sort.py | alg_bubble_sort.py | def bubble_sort(a_list):
"""Naive Bubble Sort algortihm."""
for pass_num in reversed(range(len(a_list))):
for i in range(pass_num):
if a_list[i] > a_list[i + 1]:
temp = a_list[i]
a_list[i] = a_list[i + 1]
a_list[i + 1] = temp
def short_bubbl... | def bubble_sort():
"""Bubble Sort algortihm."""
pass
def main():
pass
if __name__ == '__main__':
main()
| bsd-2-clause | Python |
2343ecec512aa31b0385b4783c00fb8dbb9060e4 | Complete make_change_recur() | bowen0701/algorithms_data_structures | alg_make_change.py | alg_make_change.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
"""Make Change.
Compute how many distinct ways you can make change that amount.
If that amount of money cannot be made up by any combination of the
coins, return -1.
Assume that you have an infinite number... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
"""Make Change.
Compute how many ways you can make up that amount.
If that amount of money cannot be made up by any combination of the
coins, return -1.
Assume that you have an infinite number of each kind... | bsd-2-clause | Python |
f9b4cd8b5d49168749e5fac470f0e04078b9a7c6 | fix flake8 | brianjgeiger/osf.io,mattclark/osf.io,mfraezz/osf.io,chrisseto/osf.io,chennan47/osf.io,cwisecarver/osf.io,cslzchen/osf.io,felliott/osf.io,laurenrevere/osf.io,aaxelb/osf.io,icereval/osf.io,erinspace/osf.io,brianjgeiger/osf.io,icereval/osf.io,mattclark/osf.io,cwisecarver/osf.io,laurenrevere/osf.io,erinspace/osf.io,crcrese... | api_tests/utils.py | api_tests/utils.py | from urlparse import urlparse
from addons.osfstorage import settings as osfstorage_settings
def create_test_file(node, user, filename='test_file', create_guid=True):
osfstorage = node.get_addon('osfstorage')
root_node = osfstorage.get_root()
test_file = root_node.append_file(filename)
if create_guid:... | from urlparse import urlparse
from addons.osfstorage import settings as osfstorage_settings
from framework.auth.core import Auth
def create_test_file(node, user, filename='test_file', create_guid=True):
osfstorage = node.get_addon('osfstorage')
root_node = osfstorage.get_root()
test_file = root_node.append... | apache-2.0 | Python |
8cdc7ce27f8445da96b13fc20d30da22bf62aa88 | fix unlinked cote-st-luc email | opencivicdata/scrapers-ca,opencivicdata/scrapers-ca | ca_qc_cote_saint_luc/people.py | ca_qc_cote_saint_luc/people.py | # coding: utf8
from pupa.scrape import Scraper
from utils import lxmlize, CanadianLegislator as Legislator
from urlparse import urljoin
import re
COUNCIL_PAGE = 'http://www.cotesaintluc.org/Administration'
class CoteSaintLucPersonScraper(Scraper):
def get_people(self):
page = lxmlize(COUNCIL_PAGE)
mayo... | # coding: utf8
from pupa.scrape import Scraper
from utils import lxmlize, CanadianLegislator as Legislator
from urlparse import urljoin
import re
COUNCIL_PAGE = 'http://www.cotesaintluc.org/Administration'
class CoteSaintLucPersonScraper(Scraper):
def get_people(self):
page = lxmlize(COUNCIL_PAGE)
mayo... | mit | Python |
37e88488fc8a4cf5e8ea7b63c7cd4b89ca17a60b | Add force_bytes to models | shermanng10/superathletebuilder,shermanng10/superathletebuilder,shermanng10/superathletebuilder,shermanng10/superathletebuilder | athletes/models.py | athletes/models.py | from django.db import models
from django.utils import timezone
from django.utils.encoding import force_bytes
class Sport(models.Model):
name = models.CharField(max_length=20)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return force_byt... | from django.db import models
from django.utils import timezone
from django.utils.encoding import force_bytes
class Sport(models.Model):
name = models.CharField(max_length=20)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return force_b... | mit | Python |
13834a2eb8c3669f7b58232a5d837147d612a93c | Fix module name. | AlpacaDB/chainer,jnishi/chainer,pfnet/chainer,AlpacaDB/chainer,hvy/chainer,ktnyt/chainer,tkerola/chainer,okuta/chainer,kiyukuta/chainer,ktnyt/chainer,keisuke-umezawa/chainer,okuta/chainer,wkentaro/chainer,cupy/cupy,cupy/cupy,niboshi/chainer,chainer/chainer,chainer/chainer,kikusu/chainer,hvy/chainer,jnishi/chainer,chain... | chainer/functions/math/clip.py | chainer/functions/math/clip.py | import numpy
from chainer import cuda
from chainer import function
from chainer import utils
from chainer.utils import type_check
class Clip(function.Function):
"""Clips (limits) elements of input variable."""
def __init__(self, x_min, x_max):
if not isinstance(x_min, float):
raise TypeE... | import numpy
from chainer import cuda
from chainer import function
from chainer import utils
from chainer.utils import type_check
class Clip(function.Function):
"""Clips (limits) elements of input variable."""
def __init__(self, x_min, x_max):
if not isinstance(x_min, float):
raise TypeE... | mit | Python |
51d7cb325110fe6f75211909df44319a80752484 | Update commit message | r0h4n/commons,rishubhjain/commons,Tendrl/commons | tendrl/common/tests/test_singleton.py | tendrl/common/tests/test_singleton.py | from tendrl.common.singleton import to_singleton
@to_singleton
class A(object):
def __init__(self):
pass
@to_singleton
class B(object):
def __init__(self):
pass
class TestSingleton(object):
def test_singleton(self, monkeypatch):
assert id(A()) == id(A())
def test_singleton... | from tendrl.common.singleton import to_singleton
@to_singleton
class A(object):
def __init__(self):
pass
class TestSingleton(object):
def test_singleton(self, monkeypatch):
assert id(A()) == id(A())
| lgpl-2.1 | Python |
242b3bfe70d90044d2496cbc8109cd703b3bccab | Make steps and out arguments optional and add defaults | MikeVasmer/GreenGraphCoursework | greengraph/command.py | greengraph/command.py | from argparse import ArgumentParser
from matplotlib import pyplot as plt
from graph import Greengraph
def process():
parser = ArgumentParser(
description="Produce graph quantifying the amount of green land between two locations")
parser.add_argument("--start", required=True,
he... | from argparse import ArgumentParser
from matplotlib import pyplot as plt
from graph import Greengraph
def process():
parser = ArgumentParser(
description="Produce graph of green land between two locations")
parser.add_argument("--start", required=True,
help="The starting locatio... | mit | Python |
6bfb23294c2cc445479f4c8098b8e62647cf01bd | Validate that we can translate a NEWOBJECT into a FETCHOBJECT | richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation | test/test_notification_integration.py | test/test_notification_integration.py | import os
import select
import groundstation.fs_watcher as fs_watcher
from groundstation.peer_socket import PeerSocket
from groundstation.utils import path2id
from integration_fixture import StationIntegrationFixture, \
TestListener, \
TestClient
class... | import os
import select
import groundstation.fs_watcher as fs_watcher
from groundstation.peer_socket import PeerSocket
from integration_fixture import StationIntegrationFixture, \
TestListener, \
TestClient
class StationFSWatcherIntegration(StationInteg... | mit | Python |
66a230ae07495dd6feca1647213ffcb25e7addcf | Add check for custom reason | Safihre/cherrypy,Safihre/cherrypy,cherrypy/cherrypy,cherrypy/cherrypy | cherrypy/test/test_httputil.py | cherrypy/test/test_httputil.py | """Tests for ``cherrypy.lib.httputil``."""
import pytest
from six.moves import http_client
from cherrypy.lib import httputil
@pytest.mark.parametrize(
'script_name,path_info,expected_url',
[
('/sn/', '/pi/', '/sn/pi/'),
('/sn/', '/pi', '/sn/pi'),
('/sn/', '/', '/sn/'),
('/sn/'... | """Tests for ``cherrypy.lib.httputil``."""
import pytest
from six.moves import http_client
from cherrypy.lib import httputil
@pytest.mark.parametrize(
'script_name,path_info,expected_url',
[
('/sn/', '/pi/', '/sn/pi/'),
('/sn/', '/pi', '/sn/pi'),
('/sn/', '/', '/sn/'),
('/sn/'... | bsd-3-clause | Python |
0b02e8bfb297cd5d2b172e0a728c068129f0c177 | Tweak assemble_oaipmh_records.py | libris/librisxl,libris/librisxl,libris/librisxl | scripts/assemble_oaipmh_records.py | scripts/assemble_oaipmh_records.py | import csv
import requests
from lxml import etree
from sys import argv, stdout, stderr
import os
baseurl = 'http://data.libris.kb.se/{rectype}/oaipmh/?verb=GetRecord&metadataPrefix=marcxml&identifier=http://libris.kb.se/resource/{record}'
args = argv[1:]
name, passwd = args.pop(0).split(':')
if args[0].endswith('.ts... | import csv
import requests
from lxml import etree
from sys import argv, stdout, stderr
import os
baseurl = 'http://data.libris.kb.se/{rectype}/oaipmh/?verb=GetRecord&metadataPrefix=marcxml&identifier=http://libris.kb.se/resource/{record}'
args = argv[1:]
auth = tuple(args.pop(0).split(':'))
if args[0].endswith('.tsv... | apache-2.0 | Python |
f8bf7b97965e2918721ef0956ff2f24716af7d0f | change data structure storing greetings from list to deque because list was being used inefficiently (with many `insert(0, x)`) | anl-mcampos/GuestBook,anl-mcampos/GuestBook | guestbook/__init__.py | guestbook/__init__.py | # coding: utf-8
import shelve
from contextlib import closing
from datetime import datetime
from collections import namedtuple, deque
from flask import Flask, request, render_template, redirect, escape, Markup
application = Flask(__name__)
DATA_FILE = 'guestbook.dat'
Post = namedtuple('Post', ['name', 'timestamp', '... | # coding: utf-8
import shelve
from contextlib import closing
from datetime import datetime
from collections import namedtuple
from flask import Flask, request, render_template, redirect, escape, Markup
application = Flask(__name__)
DATA_FILE = 'guestbook.dat'
Post = namedtuple('Post', ['name', 'timestamp', 'comment... | mit | Python |
f665f051b936d249a055e1bca28c8b3194324e81 | Add a module docstring for the null auth backend. | henn/haas,kylehogan/hil,henn/hil,henn/hil_sahil,SahilTikale/haas,henn/hil,CCI-MOC/haas,henn/hil_sahil,meng-sun/hil,kylehogan/haas,meng-sun/hil,kylehogan/hil | haas/ext/auth/null.py | haas/ext/auth/null.py | """'Null' auth backend
This backend requires no authentication and permits everything. Useful for
testing, do not use in production."""
from haas import auth
class NullAuthBackend(auth.AuthBackend):
def authenticate(self):
pass
def have_admin(self):
return True
def have_project_access(... | from haas import auth
class NullAuthBackend(auth.AuthBackend):
def authenticate(self):
pass
def have_admin(self):
return True
def have_project_access(self, project):
return True
def setup(*args, **kwargs):
auth.set_auth_backend(NullAuthBackend())
| apache-2.0 | Python |
50b14c25eed76a46cdb0c1a9478cb1bedea0f719 | Revise to _padding() and revise var names | bowen0701/algorithms_data_structures | lc0067_add_binary.py | lc0067_add_binary.py | """Leetcode 67. Add Binary
Easy
URL: https://leetcode.com/problems/add-binary/
Given two binary strings, return their sum (also a binary string).
The input strings are both non-empty and contains only characters 1 or 0.
Example 1:
Input: a = "11", b = "1"
Output: "100"
Example 2:
Input: a = "1010", b = "1011"
Outp... | """Leetcode 67. Add Binary
Easy
URL: https://leetcode.com/problems/add-binary/
Given two binary strings, return their sum (also a binary string).
The input strings are both non-empty and contains only characters 1 or 0.
Example 1:
Input: a = "11", b = "1"
Output: "100"
Example 2:
Input: a = "1010", b = "1011"
Outp... | bsd-2-clause | Python |
b20d515c24cdf1079505b0f38b17e4cea752a97b | Implement command.call in terms of call_get_out and skip output, trying to avoid problems with processes that hang | GoogleCloudPlatform/gke-managed-certs,GoogleCloudPlatform/gke-managed-certs | hack/utils/command.py | hack/utils/command.py | #!/usr/bin/env python
"""
Copyright 2018 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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to ... | #!/usr/bin/env python
"""
Copyright 2018 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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to ... | apache-2.0 | Python |
081e0eaf2f5767a2645b6b0b758cb9f3548a66eb | fix broken build | chfw/pyramid-excel,chfw/pyramid-excel | tests/test_upload_n_download_excel.py | tests/test_upload_n_download_excel.py | import pyexcel as pe
from _compact import BytesIO, PY2
FILE_TYPE_MIME_TABLE = {
"csv": "text/csv",
"tsv": "text/tab-separated-values",
"csvz": "application/zip",
"tsvz": "application/zip",
"ods": "application/vnd.oasis.opendocument.spreadsheet",
"xls": "application/vnd.ms-excel",
"xlsx": "a... | import pyexcel as pe
from _compact import BytesIO
FILE_TYPE_MIME_TABLE = {
"csv": "text/csv",
"tsv": "text/tab-separated-values",
"csvz": "application/zip",
"tsvz": "application/zip",
"ods": "application/vnd.oasis.opendocument.spreadsheet",
"xls": "application/vnd.ms-excel",
"xlsx": "applic... | bsd-3-clause | Python |
03e7fae11a7c5000452cd4154aa2824e8835342b | remove unneeded imports | sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary | updatecmd.py | updatecmd.py | #
# Copyright (c) 2004 Specifix, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/li... | #
# Copyright (c) 2004 Specifix, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/li... | apache-2.0 | Python |
45af812a203fdcd7a825e0d4a044b09230ae71e5 | change user profile url not to be on root to avoid conflicts | hasadna/open-shot,hasadna/open-shot,hasadna/open-shot | user/urls.py | user/urls.py | from django.conf.urls.defaults import patterns, include, url
from .views import *
from .feeds import *
urlpatterns = patterns('',
url(r'^profile/$', edit_profile, name='edit_profile'),
url(r'^candidate/$', edit_candidate, name='edit_candidate'),
url(r'^candidates/$', candidate_list, name="candidate_list"),... | from django.conf.urls.defaults import patterns, include, url
from .views import *
from .feeds import *
urlpatterns = patterns('',
url(r'^profile/$', edit_profile, name='edit_profile'),
url(r'^candidate/$', edit_candidate, name='edit_candidate'),
url(r'^candidates/$', candidate_list, name="candidate_list"),... | bsd-3-clause | Python |
715071aa0d6baffab19ee5f8c34a6d8341034737 | Update docstrings. | owtf/ptp,DoomTaper/ptp | libptp/exceptions.py | libptp/exceptions.py | """
:synopsis: Custom exceptions used across the :mod:`ptp` library.
.. moduleauthor:: Tao Sauvage
"""
class PTPError(Exception):
"""General :mod:`ptp` error."""
pass
class ReportNotFoundError(PTPError):
""":mod:`ptp` error raised when the report file(s) was not found."""
pass
class NotSupporte... | """
:synopsis: Custom exceptions used across the :mod:`ptp` library.
.. moduleauthor:: Tao Sauvage
"""
class PTPError(Exception):
"""General PTP error."""
pass
class ReportNotFoundError(PTPError):
"""PTP error raised when the report file(s) was not found."""
pass
class NotSupportedToolError(PTP... | bsd-3-clause | Python |
cc85995e96de7664648596713f127f5999859f00 | Remove unused variable | abawchen/leetcode | solutions/403.py | solutions/403.py | # -*- coding: utf-8 -*-
"""
https://leetcode.com/problems/frog-jump/description/
A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.
Given a list of stones' positions (in units) in sorted ... | # -*- coding: utf-8 -*-
"""
https://leetcode.com/problems/frog-jump/description/
A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.
Given a list of stones' positions (in units) in sorted ... | mit | Python |
1ac2360d2e5bf395607db130f52d7475bd15ad8c | Fix QuerySet -> QuerySet[Subscription]. | andersk/zulip,jackrzhang/zulip,kou/zulip,shubhamdhama/zulip,eeshangarg/zulip,showell/zulip,kou/zulip,punchagan/zulip,brockwhittaker/zulip,timabbott/zulip,punchagan/zulip,rishig/zulip,brainwane/zulip,brockwhittaker/zulip,rht/zulip,mahim97/zulip,mahim97/zulip,timabbott/zulip,synicalsyntax/zulip,rht/zulip,shubhamdhama/zul... | zerver/lib/stream_subscription.py | zerver/lib/stream_subscription.py | from typing import Dict, List, Tuple
from mypy_extensions import TypedDict
from django.db.models.query import QuerySet
from zerver.models import (
Recipient,
Stream,
Subscription,
UserProfile,
)
def get_active_subscriptions_for_stream_id(stream_id):
# type: (int) -> QuerySet[Subscription]
retu... | from typing import Dict, List, Tuple
from mypy_extensions import TypedDict
from django.db.models.query import QuerySet
from zerver.models import (
Recipient,
Stream,
Subscription,
UserProfile,
)
def get_active_subscriptions_for_stream_id(stream_id):
# type: (int) -> QuerySet
return Subscriptio... | apache-2.0 | Python |
f67c39c094bf196b09fd0c3de6b26dc61c3ca2d5 | Increment version for PyPI | mkoistinen/cmsplugin-sections,mkoistinen/cmsplugin-sections,helderco/cmsplugin-sections,helderco/cmsplugin-sections | cmsplugin_sections/__init__.py | cmsplugin_sections/__init__.py | # -*- coding: utf-8 -*-
__version__='0.1.1' | # -*- coding: utf-8 -*-
__version__='0.1.0' | mit | Python |
49f472e794cac2792a4f8b545331d78ccdaf64e2 | Add 1M to interval_to_milliseconds, simplify logic, add doctest. | sammchardy/python-binance | binance/helpers.py | binance/helpers.py | import dateparser
import pytz
from datetime import datetime
def date_to_milliseconds(date_str):
"""Convert UTC date to milliseconds
If using offset strings add "UTC" to date string e.g. "now UTC", "11 hours ago UTC"
See dateparse docs for formats http://dateparser.readthedocs.io/en/latest/
:param ... | import dateparser
import pytz
from datetime import datetime
def date_to_milliseconds(date_str):
"""Convert UTC date to milliseconds
If using offset strings add "UTC" to date string e.g. "now UTC", "11 hours ago UTC"
See dateparse docs for formats http://dateparser.readthedocs.io/en/latest/
:param ... | mit | Python |
40b4a4c54fe4111537d82de69fa115521ef4185b | Fix and add examples to programmatic diff inspection examples | grahamegee/diffr | examples/programmatic_diff_inspection.py | examples/programmatic_diff_inspection.py | from diffr import diff, Diff, unchanged, insert, remove, changed
a = 'change1 same change2'
b = 'modify1 same modify2'
d = diff(a, b)
print('---------------------------------------------------------')
print('The full diff\n')
# the displayed diff
print(d)
print('-------------------------------------------------------... | from diffr import diff, Diff, unchanged, insert, remove, changed
a = 'change1 same change2'
b = 'modify1 same modify2'
d = diff(a, b)
print('---------------------------------------------------------')
print('The full diff\n')
# the displayed diff
print(d)
print('-------------------------------------------------------... | mit | Python |
59e18de589f00d7cb3d24b8fcf05f4f43c0c90f9 | make example comput. easier | sorig/shogun,karlnapf/shogun,Saurabh7/shogun,Saurabh7/shogun,Saurabh7/shogun,shogun-toolbox/shogun,lambday/shogun,geektoni/shogun,besser82/shogun,Saurabh7/shogun,Saurabh7/shogun,lisitsyn/shogun,geektoni/shogun,geektoni/shogun,shogun-toolbox/shogun,besser82/shogun,lambday/shogun,lisitsyn/shogun,geektoni/shogun,sorig/sho... | examples/python_modular/custom_kernel.py | examples/python_modular/custom_kernel.py | from numpy import *
from numpy.random import rand
from shogun.Features import RealFeatures, Labels
from shogun.Kernel import CustomKernel
from shogun.Classifier import LibSVM
C=1
dim=7
lab=sign(2*rand(dim) - 1)
data=rand(dim, dim)
symdata=data*data.T
kernel=CustomKernel()
kernel.set_full_kernel_matrix_from_full(data... | from numpy import *
from numpy.random import rand
from shogun.Features import RealFeatures, Labels
from shogun.Kernel import CustomKernel
from shogun.Classifier import LibSVM
C=1
dim=7
lab=sign(2*rand(dim) - 1)
data=rand(dim, dim)
symdata=data+data.T
kernel=CustomKernel()
kernel.set_full_kernel_matrix_from_full(data... | bsd-3-clause | Python |
9a4983912f9f6130e91c0dd7e4f40165f41e42ba | Remove encoding line | mitmedialab/MediaCloud-Web-Tools,mitmedialab/MediaCloud-Web-Tools,mitmedialab/MediaCloud-Web-Tools,mitmedialab/MediaCloud-Web-Tools | server/views/topics/permissions.py | server/views/topics/permissions.py | import logging
from flask import jsonify, request
import flask_login
import json
from mediacloud.error import MCException
from server import app
from server.util.request import json_error_response, api_error_handler
from server.auth import user_admin_mediacloud_client
logger = logging.getLogger(__name__)
@app.route... | # -*- coding: utf-8 -*-
import logging
from flask import jsonify, request
import flask_login
import json
from mediacloud.error import MCException
from server import app
from server.util.request import json_error_response, api_error_handler
from server.auth import user_admin_mediacloud_client
logger = logging.getLogge... | apache-2.0 | Python |
bf67c53c5d2d41895bdb8896bb4b3e4cebeea403 | Bump to 0.4.7 | dinoperovic/djangocms-blogit,dinoperovic/djangocms-blogit,dinoperovic/djangocms-blogit | blogit/__init__.py | blogit/__init__.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
Release logic:
1. Remove ".devX" from __version__ (below)
2. git add blogit/__init__.py
3. git commit -m 'Bump to <version>'
4. git tag <version>
5. git push && git push --tags
6. python setup.py sdist upload
7. bump the __version__, append ".d... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
Release logic:
1. Remove ".devX" from __version__ (below)
2. git add blogit/__init__.py
3. git commit -m 'Bump to <version>'
4. git tag <version>
5. git push && git push --tags
6. python setup.py sdist upload
7. bump the __version__, append ".d... | bsd-3-clause | Python |
5b1459ed130ff3868f63d274b36a5d73c880ef9f | Create 'latest' reference to newest patch. | davidstrauss/branch-and-commit-to-bare-repo | branchandcommit.py | branchandcommit.py | import tempfile
import pygit2
def add_commit(repo, ref, msg, author, path=None, content=None, parent=None):
tb = repo.TreeBuilder()
if path is not None:
blob = repo.create_blob(file_content)
tb.insert(file_path, blob, pygit2.GIT_FILEMODE_BLOB)
parents = []
if parent is not None:
... | import tempfile
import pygit2
def add_commit(repo, ref, msg, author, path=None, content=None, parent=None):
tb = repo.TreeBuilder()
if path is not None:
blob = repo.create_blob(file_content)
tb.insert(file_path, blob, pygit2.GIT_FILEMODE_BLOB)
parents = []
if parent is not None:
... | mit | Python |
29a1828afee59a23fe07636cf99863d3dda1c3a4 | Update python test | enjin/contracts | solidity/python/FormulaTestSale.py | solidity/python/FormulaTestSale.py | from sys import argv
from decimal import Decimal
from random import randrange
from Formula import calculateSaleReturn
def formulaTest(supply,reserve,ratio,amount):
fixed = Decimal(calculateSaleReturn(supply,reserve,ratio,amount))
real = Decimal(reserve)*(1-(1-Decimal(amount)/Decimal(supply))**(100/Decim... | from sys import argv
from decimal import Decimal
from random import randrange
from Formula import calculateSaleReturn
def formulaTest(_supply, _reserveBalance, _reserveRatio, _amount):
fixed = calculateSaleReturn(_supply, _reserveBalance, _reserveRatio, _amount)
real = Decimal(_reserveBalance)*(1-(1-Dec... | apache-2.0 | Python |
6f6574d338fc1601e3504719ac303a4da8892e4f | Remove references to removed classes [#134476913] | janebeckman/gpdb,janebeckman/gpdb,ashwinstar/gpdb,rvs/gpdb,Chibin/gpdb,Chibin/gpdb,50wu/gpdb,kaknikhil/gpdb,greenplum-db/gpdb,yuanzhao/gpdb,yuanzhao/gpdb,ashwinstar/gpdb,Quikling/gpdb,lisakowen/gpdb,lisakowen/gpdb,Quikling/gpdb,xinzweb/gpdb,rvs/gpdb,Chibin/gpdb,50wu/gpdb,rvs/gpdb,Chibin/gpdb,Quikling/gpdb,lisakowen/gpd... | concourse/scripts/test_gpdb.py | concourse/scripts/test_gpdb.py | #!/usr/bin/python2
import optparse
import subprocess
import sys
import shutil
from builds.GpBuild import GpBuild
def install_gpdb(dependency_name):
status = subprocess.call("mkdir -p /usr/local/gpdb", shell=True)
if status:
return status
status = subprocess.call(
"tar -xzf " + dependency_n... | #!/usr/bin/python2
import optparse
import subprocess
import sys
import shutil
from builds import GpBuild, GpcodegenBuild, GporcacodegenBuild
def install_gpdb(dependency_name):
status = subprocess.call("mkdir -p /usr/local/gpdb", shell=True)
if status:
return status
status = subprocess.call(
... | apache-2.0 | Python |
39061f2ce81563d5a60f1d2359c9eb6f8b2a50e3 | Disable buggy recursion detection | sprymix/importkit | importkit/yaml/validator/types/choice.py | importkit/yaml/validator/types/choice.py | ##
# Copyright (c) 2008-2010 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##
import copy
from .composite import CompositeType
from ..error import SchemaValidationError
class ChoiceType(CompositeType):
__slots__ = ['choice', 'checked']
def __init__(self, schema):
super().__init__... | ##
# Copyright (c) 2008-2010 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##
import copy
from .composite import CompositeType
from ..error import SchemaValidationError
class ChoiceType(CompositeType):
__slots__ = ['choice', 'checked']
def __init__(self, schema):
super().__init__... | mit | Python |
c204b94927000f6124d3ddf66bd932be70ecd1fe | add version 0.14.0 to r-globals (#21026) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-globals/package.py | var/spack/repos/builtin/packages/r-globals/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 RGlobals(RPackage):
"""Identify Global Objects in R Expressions
Identifies global ("u... | # 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 RGlobals(RPackage):
"""Identifies global ("unknown" or "free") objects in R expressions by... | lgpl-2.1 | Python |
18c7dce57dd49d3ad1c5392f901ecce2c1ea4e8c | correct formatting | cwacek/python-jsonschema-objects | test/test_wrong_exception_protocolbase_getitem.py | test/test_wrong_exception_protocolbase_getitem.py | import pytest
import python_jsonschema_objects as pjo
@pytest.fixture
def base_schema():
return {
'title': 'example',
'type': 'object',
"additionalProperties": False,
"properties": {
"dictLike": {
"additionalProperties": {
"type": "integer"
... | import pytest
import python_jsonschema_objects as pjo
import json
@pytest.fixture
def base_schema():
return {
'title': 'example',
'type': 'object',
"additionalProperties": False,
"properties": {
"dictLike": {
"additionalProperties": {
"type": "... | mit | Python |
7955405a2377468804d4aacd5d476c0dc617f0e1 | improve unit tests for version() (#59626) | thaim/ansible,thaim/ansible | test/units/cli/arguments/test_optparse_helpers.py | test/units/cli/arguments/test_optparse_helpers.py | # -*- coding: utf-8 -*-
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import pytest
from ansible import constants as C
from ansible... | # -*- coding: utf-8 -*-
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.cli.arguments import option_helpers as opt_help
def test_ve... | mit | Python |
dc3eb4e077ffd61d6fea785d9aaeee4e3ce4b0b3 | add util for getting major/minor device numbers | cloudsigma/cgroupspy,islavov/cgroupspy | cgroupspy/utils.py | cgroupspy/utils.py | """
Copyright (c) 2014, CloudSigma AG
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the fo... | """
Copyright (c) 2014, CloudSigma AG
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the fo... | bsd-3-clause | Python |
8587c13f298714d68f26acf7e5a2beb457addf99 | Update message.py | tnstrssnr/telegram-chatter | chatter/message.py | chatter/message.py | #!usr/bin/python3
"""
Repräsentiert ein Nachrichten-Objekt.
Attribute:
id -- einmalige, zur Identifikation benötigte, Nachrichten-ID
sender -- der Sender der Nachricht (User-Objekt)
datum -- Datum/Uhrzeit an dem die NAchricht gesendet wurde (UNIX-Zeitformat)
chat -- Chat... | #!usr/bin/python3
"""
Repräsentiert ein Nachrichten-Objekt.
Attribute:
id -- einmalige, zur Identifikation benötigte, Nachrichten-ID
sender -- der Sender der Nachricht (User-Objekt)
datum -- Datum/Uhrzeit an dem die NAchricht gesendet wurde (UNIX-Zeitformat)
chat -- Chat... | mit | Python |
75279f2f19fd0efa338547442b9390ee542009e3 | Add a docstring. | brian-rose/climlab,cjcardinale/climlab,cjcardinale/climlab,brian-rose/climlab,cjcardinale/climlab | climlab/utils/data_source.py | climlab/utils/data_source.py | from __future__ import division, print_function
try:
from urllib.request import urlretrieve # Python 3
except ImportError:
from urllib import urlretrieve # Python 2
def load_data_source(local_path,
remote_source_list,
open_method,
open_method_kwargs=dict(),
... | from __future__ import division, print_function
try:
from urllib.request import urlretrieve # Python 3
except ImportError:
from urllib import urlretrieve # Python 2
def load_data_source(local_path,
remote_source_list,
open_method,
open_method_kwargs=dict(),
... | mit | Python |
c17f3f7867119d327f438ab74c8c779849927db4 | add new parameter code | cf-platform-eng/aws-pcf-quickstart,cf-platform-eng/aws-pcf-quickstart,cf-platform-eng/aws-pcf-quickstart | ci/create-stack.py | ci/create-stack.py | import jinja2
import os
import sys
from subprocess import call
pcfkeypairprivate = os.environ['AWS_CF_PCFKEYPAIRPRIVATE'],
password = os.environ['AWS_CF_PASSWORD'],
domain = os.environ['AWS_CF_DOMAIN'],
hostedzoneid = os.environ['AWS_CF_HOSTEDZONEID'],
sslcertificatearn = os.environ['AWS_CF_SSLCERTIFICATEARN'],
natkey... | import jinja2
import os
import sys
from subprocess import call
pcfkeypairprivate = os.environ['AWS_CF_PCFKEYPAIRPRIVATE'],
password = os.environ['AWS_CF_PASSWORD'],
domain = os.environ['AWS_CF_DOMAIN'],
hostedzoneid = os.environ['AWS_CF_HOSTEDZONEID'],
sslcertificatearn = os.environ['AWS_CF_SSLCERTIFICATEARN'],
natkey... | apache-2.0 | Python |
718c0008ce9766611fa27e43fa0f6c8c79ea8ba3 | bump to v1.6.3 | Cal-CS-61A-Staff/ok-client | client/__init__.py | client/__init__.py | __version__ = 'v1.6.3'
FILE_NAME = 'ok'
import os
import sys
sys.path.insert(0, '')
# Add directory in which the ok.zip is stored to sys.path.
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
| __version__ = 'v1.6.2'
FILE_NAME = 'ok'
import os
import sys
sys.path.insert(0, '')
# Add directory in which the ok.zip is stored to sys.path.
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
| apache-2.0 | Python |
9ed97ebbd9884971da0c069b49e3a698b337c9b6 | update cltk_dir path | coderbhupendra/cltk,eamonnbell/cltk,mbevila/cltk,cltk/cltk,LBenzahia/cltk,TylerKirby/cltk,diyclassics/cltk,LBenzahia/cltk,marpozzi/cltk,TylerKirby/cltk,D-K-E/cltk,kylepjohnson/cltk | cltk/stem/lemma.py | cltk/stem/lemma.py | """Lemmatize Latin words."""
__author__ = 'Kyle P. Johnson <kyle@kyle-p-johnson.com>'
__license__ = 'MIT License. See LICENSE.'
import importlib.machinery
import os
import re
AVAILABLE_LANGUAGES = ['latin']
class LemmaReplacer(object): # pylint: disable=R0903
"""Lemmatize Latin words by replacing input words ... | """Lemmatize Latin words."""
__author__ = 'Kyle P. Johnson <kyle@kyle-p-johnson.com>'
__license__ = 'MIT License. See LICENSE.'
import importlib.machinery
import os
import re
AVAILABLE_LANGUAGES = ['latin']
class LemmaReplacer(object): # pylint: disable=R0903
"""Lemmatize Latin words by replacing input words ... | mit | Python |
289d89bd92ef9c3b0a4d7683bc9c684a915e621d | Update version. | kmee/python-sped,sped-br/python-sped | sped/__init__.py | sped/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.3.4'
| # -*- coding: utf-8 -*-
__version__ = '0.3.2'
| mit | Python |
33913411433068cc358953f8c1211c8abe1c96a2 | implement separate key iterator | vmx/spring,mikewied/spring,mikewied/spring,couchbase/spring,couchbase/spring,vmx/spring | spring/docgen.py | spring/docgen.py | import math
import random
import string
class Iterator(object):
def __iter__(self):
return self
class RandKeyGen(Iterator):
def __init__(self, items):
self.items = items
def next(self):
return random.randint(1, self.items)
class DocGen(Iterator):
CHARS = list(string.let... | import math
import random
import string
class DocGen(object):
CHARS = list(string.letters + string.digits)
SIZE_VARIATION = 0.25 # 25%
KEY_LENGTH = 10
def __init__(self, avg_size):
self.avg_size = avg_size
def __iter__(self):
return self
@classmethod
def _get_variation... | apache-2.0 | Python |
3fbfb354bedd8a8806c5a8ff37e4c100fcdbf514 | fix 0010 | luoxufeiyan/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,haiyangd/python-show-me-the-code-,Jaccorot/python,renzongxian/Show-Me-the-Code,Jaccorot/python,Show-Me-the-Code/python,Jaccorot/python,renzongxian/Show-Me-the-Code,haiyangd/python-show-me-the-code-,renzongxian/Show-Me-the-Code,starlightme/python,l... | Jaccorot/0010/0010.py | Jaccorot/0010/0010.py | #!/usr/bin/python
#coding=utf-8
"""
第 0010 题:使用 Python 生成字母验证码图片
"""
from PIL import Image, ImageDraw, ImageFont, ImageFilter
import random
IMAGE_MODE = 'RGB'
IMAGE_BG_COLOR = (255,255,255)
Image_Font = 'arial.ttf'
text = ''.join(random.sample('abcdefghijklmnopqrstuvwxyz\
ABCDEFGHIJKLMNOPQRSTUVWXYZ',4))
def color... | #!/usr/bin/python
#coding=utf-8
from PIL import Image, ImageDraw, ImageFont, ImageFilter
import random
IMAGE_MODE = 'RGB'
IMAGE_BG_COLOR = (255,255,255)
Image_Font = 'arial.ttf'
text = ''.join(random.sample('abcdefghijklmnopqrstuvwxyz\
ABCDEFGHIJKLMNOPQRSTUVWXYZ',4))
def colorRandom():
return (random.randint(32,... | mit | Python |
5af3b9d31fc3af8f9781e4d63e52dbbcc622c311 | Update TrackingAdafruit16CServoDriver.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/Mats/TrackingAdafruit16CServoDriver.py | home/Mats/TrackingAdafruit16CServoDriver.py | port = "COM4"
xServoPin = 2
yServoPin = 3
mouthServoPin = 4
# Create the Tracker service to be able setup how it should connect before starting it
tracker = Runtime.create("tracker","Tracking")
sleep(1)
servoX = tracker.getX()
servoY = tracker.getY()
# Create the Adafruit16CServoDriver service to be able setup how ... | port = "COM4"
xServoPin = 2
yServoPin = 3
mouthServoPin = 4
# Create the Tracker service to be able setup how it should connect before starting it
tracker = Runtime.create("tracker","Tracking")
sleep(1)
servoX = tracker.getX()
servoY = tracker.getY()
# Create the Adafruit16CServoDriver service to be able setup how ... | apache-2.0 | Python |
2ce0c1eee73ee17b5bfe8befa24c2c8f1ace8225 | Fix typo. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/encodings/mbcs.py | Lib/encodings/mbcs.py | """ Python 'mbcs' Codec for Windows
Cloned by Mark Hammond (mhammond@skippinet.com.au) from ascii.py,
which was written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
import codecs
### Codec APIs
class Codec(codecs.Codec):
# Note: Binding these as C functio... | """ Python 'mbcs' Codec for Windows
Cloned by Mark Hammond (mhammond@skippinet.com.au) from ascii.py,
which was written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
import codecs
### Codec APIs
class Codec(codecs.Codec):
# Note: Binding these as C functio... | mit | Python |
a6d1326241bb43733ddccaef38713513d419282c | Add spacing for cache instance | vim-awesome/vim-awesome,starcraftman/vim-awesome,starcraftman/vim-awesome,divad12/vim-awesome,starcraftman/vim-awesome,vim-awesome/vim-awesome,jonafato/vim-awesome,starcraftman/vim-awesome,jonafato/vim-awesome,shaialon/vim-awesome,jonafato/vim-awesome,divad12/vim-awesome,divad12/vim-awesome,jonafato/vim-awesome,divad12... | web/cache.py | web/cache.py | """Module to hold the instance of the cache"""
from flask.ext.cache import Cache
cache = Cache()
| """Module to hold the instance of the cache"""
from flask.ext.cache import Cache
cache = Cache()
| mit | Python |
1cd908682f77d93d60f15b26f018eb956840b8f0 | Print scp destination. | Jarn/jarn.mkrelease | jarn/mkrelease/scp.py | jarn/mkrelease/scp.py | from process import Process
from exit import err_exit
class SCP(object):
"""Secure copy abstraction."""
def __init__(self, process=None):
self.process = process or Process()
def has_host(self, location):
colon = location.find(':')
slash = location.find('/')
return colon >... | from process import Process
from exit import err_exit
class SCP(object):
"""Secure copy abstraction."""
def __init__(self, process=None):
self.process = process or Process()
def has_host(self, location):
colon = location.find(':')
slash = location.find('/')
return colon >... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.