commit stringlengths 40 40 | old_file stringlengths 5 117 | new_file stringlengths 5 117 | old_contents stringlengths 0 1.93k | new_contents stringlengths 19 3.3k | subject stringlengths 17 320 | message stringlengths 18 3.28k | lang stringclasses 1
value | license stringclasses 13
values | repos stringlengths 7 42.4k | completion stringlengths 19 3.3k | prompt stringlengths 21 3.65k |
|---|---|---|---|---|---|---|---|---|---|---|---|
b32b047656abd28dd794ee16dfab682337a753b1 | accounts/tests.py | accounts/tests.py | from django.test import TestCase
# Create your tests here.
| """accounts app unittests
"""
from django.test import TestCase
class WelcomePageTest(TestCase):
def test_uses_welcome_template(self):
response = self.client.get('/')
self.assertTemplateUsed(response, 'accounts/welcome.html')
| Add first unit test for welcome page | Add first unit test for welcome page
| Python | mit | randomic/aniauth-tdd,randomic/aniauth-tdd | """accounts app unittests
"""
from django.test import TestCase
class WelcomePageTest(TestCase):
def test_uses_welcome_template(self):
response = self.client.get('/')
self.assertTemplateUsed(response, 'accounts/welcome.html')
| Add first unit test for welcome page
from django.test import TestCase
# Create your tests here.
|
5eced1c1cb9253d73e3246dccb4c33e5ba154fd3 | rcbi/rcbi/spiders/FlyduinoSpider.py | rcbi/rcbi/spiders/FlyduinoSpider.py | import scrapy
from scrapy import log
from scrapy.contrib.spiders import SitemapSpider, Rule
from scrapy.contrib.linkextractors import LinkExtractor
from rcbi.items import Part
MANUFACTURERS = ["Rctimer", "RCTimer", "BaseCam", "Elgae", "ELGAE", "ArduFlyer", "Boscam", "T-Motor", "HQProp", "Suppo", "Flyduino", "SLS", "Fr... | import scrapy
from scrapy import log
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from rcbi.items import Part
MANUFACTURERS = ["Rctimer", "RCTimer", "BaseCam", "Elgae", "ELGAE", "ArduFlyer", "Boscam", "T-Motor", "HQProp", "Suppo", "Flyduino", "SLS", "Frsky"]
CORRECT = {"... | Stop using the Flyduino sitemap. | Stop using the Flyduino sitemap.
| Python | apache-2.0 | rcbuild-info/scrape,rcbuild-info/scrape | import scrapy
from scrapy import log
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from rcbi.items import Part
MANUFACTURERS = ["Rctimer", "RCTimer", "BaseCam", "Elgae", "ELGAE", "ArduFlyer", "Boscam", "T-Motor", "HQProp", "Suppo", "Flyduino", "SLS", "Frsky"]
CORRECT = {"... | Stop using the Flyduino sitemap.
import scrapy
from scrapy import log
from scrapy.contrib.spiders import SitemapSpider, Rule
from scrapy.contrib.linkextractors import LinkExtractor
from rcbi.items import Part
MANUFACTURERS = ["Rctimer", "RCTimer", "BaseCam", "Elgae", "ELGAE", "ArduFlyer", "Boscam", "T-Motor", "HQProp... |
26a66b90f3e1a63ae91eb2eac08a580b4be6a3c4 | counting/mapper.py | counting/mapper.py | from contextlib import closing
import subprocess
import logging
import do
logger = logging.getLogger("Main")
def g37_map(out_fn):
url_map = "http://ftp.ncbi.nlm.nih.gov/genomes/Homo_sapiens/ARCHIVE/ANNOTATION_RELEASE.105/Assembled_chromosomes/chr_accessions_GRCh37.p13"
url_ann = "http://ftp.ncbi.nlm.nih.gov/... | Add smart functions to get the correct gene annotation | Add smart functions to get the correct gene annotation
| Python | cc0-1.0 | NCBI-Hackathons/rnaseqview,NCBI-Hackathons/rnaseqview,NCBI-Hackathons/rnaseqview,NCBI-Hackathons/rnaseqview,NCBI-Hackathons/rnaseqview | from contextlib import closing
import subprocess
import logging
import do
logger = logging.getLogger("Main")
def g37_map(out_fn):
url_map = "http://ftp.ncbi.nlm.nih.gov/genomes/Homo_sapiens/ARCHIVE/ANNOTATION_RELEASE.105/Assembled_chromosomes/chr_accessions_GRCh37.p13"
url_ann = "http://ftp.ncbi.nlm.nih.gov/... | Add smart functions to get the correct gene annotation
| |
15437c33fd25a1f10c3203037be3bfef17716fbb | setup.py | setup.py | import os
from setuptools import setup, find_packages
LONG_DESCRIPTION = """Django-Prometheus
This library contains code to expose some monitoring metrics relevant
to Django internals so they can be monitored by Prometheus.io.
See https://github.com/korfuri/django-prometheus for usage
instructions.
"""
setup(
n... | import os
from setuptools import setup, find_packages
LONG_DESCRIPTION = """Django-Prometheus
This library contains code to expose some monitoring metrics relevant
to Django internals so they can be monitored by Prometheus.io.
See https://github.com/korfuri/django-prometheus for usage
instructions.
"""
setup(
n... | Add trove classifiers for Python versions | Add trove classifiers for Python versions
These are set to the versions tested by Travis.
This fixes #39. | Python | apache-2.0 | korfuri/django-prometheus,obytes/django-prometheus,obytes/django-prometheus,korfuri/django-prometheus | import os
from setuptools import setup, find_packages
LONG_DESCRIPTION = """Django-Prometheus
This library contains code to expose some monitoring metrics relevant
to Django internals so they can be monitored by Prometheus.io.
See https://github.com/korfuri/django-prometheus for usage
instructions.
"""
setup(
n... | Add trove classifiers for Python versions
These are set to the versions tested by Travis.
This fixes #39.
import os
from setuptools import setup, find_packages
LONG_DESCRIPTION = """Django-Prometheus
This library contains code to expose some monitoring metrics relevant
to Django internals so they can be monitored... |
3e89c102e9a47de1288b268b04a11ff73a22cd2e | main.py | main.py | # coding: utf-8
from web import app
import db, config
import os.path
if __name__ == '__main__':
if not config.check():
print >>sys.stderr, "Couldn't find configuration file"
sys.exit(1)
if not os.path.exists(config.get('CACHE_DIR')):
os.makedirs(config.get('CACHE_DIR'))
db.init_db()
app.run(debug = True)
... | # coding: utf-8
import config
import os.path, sys
if __name__ == '__main__':
if not config.check():
print >>sys.stderr, "Couldn't find configuration file"
sys.exit(1)
if not os.path.exists(config.get('CACHE_DIR')):
os.makedirs(config.get('CACHE_DIR'))
import db
from web import app
db.init_db()
app.run(... | Fix handling of missing config file | Fix handling of missing config file
| Python | agpl-3.0 | hhm0/supysonic,nwokeo/supysonic,ezpuzz/supysonic,spl0k/supysonic,hhm0/supysonic,spl0k/supysonic,nwokeo/supysonic,nwokeo/supysonic,hhm0/supysonic,nwokeo/supysonic,spl0k/supysonic,nwokeo/supysonic,ezpuzz/supysonic | # coding: utf-8
import config
import os.path, sys
if __name__ == '__main__':
if not config.check():
print >>sys.stderr, "Couldn't find configuration file"
sys.exit(1)
if not os.path.exists(config.get('CACHE_DIR')):
os.makedirs(config.get('CACHE_DIR'))
import db
from web import app
db.init_db()
app.run(... | Fix handling of missing config file
# coding: utf-8
from web import app
import db, config
import os.path
if __name__ == '__main__':
if not config.check():
print >>sys.stderr, "Couldn't find configuration file"
sys.exit(1)
if not os.path.exists(config.get('CACHE_DIR')):
os.makedirs(config.get('CACHE_DIR'))
... |
315e6da0dc3d7424a14c65ac243af1faef36b710 | test/parse_dive.py | test/parse_dive.py | #! /bin/python
import argparse
from xml.dom import minidom
parser = argparse.ArgumentParser(description='Parse a dive in xml formt.')
parser.add_argument('-f', '--file', required=True,
dest='path', help='path to xml file')
args = parser.parse_args()
path = args.path
doc = minidom.parse(path)
nodes = doc.getElem... | #! /bin/python
import argparse
from xml.dom import minidom
parser = argparse.ArgumentParser(description='Parse a dive in xml formt.')
parser.add_argument('-f', '--file', required=True,
dest='path', help='path to xml file')
args = parser.parse_args()
path = args.path
doc = minidom.parse(path)
nodes = doc.getElem... | Add a correct parsing of the file | Add a correct parsing of the file
| Python | isc | AquaBSD/libbuhlmann,AquaBSD/libbuhlmann,AquaBSD/libbuhlmann | #! /bin/python
import argparse
from xml.dom import minidom
parser = argparse.ArgumentParser(description='Parse a dive in xml formt.')
parser.add_argument('-f', '--file', required=True,
dest='path', help='path to xml file')
args = parser.parse_args()
path = args.path
doc = minidom.parse(path)
nodes = doc.getElem... | Add a correct parsing of the file
#! /bin/python
import argparse
from xml.dom import minidom
parser = argparse.ArgumentParser(description='Parse a dive in xml formt.')
parser.add_argument('-f', '--file', required=True,
dest='path', help='path to xml file')
args = parser.parse_args()
path = args.path
doc = mini... |
ac02378dcc611fb2c3b8a98e7480e02f64ee716d | polling_stations/apps/data_collection/management/commands/import_shepway.py | polling_stations/apps/data_collection/management/commands/import_shepway.py | from data_collection.morph_importer import BaseMorphApiImporter
class Command(BaseMorphApiImporter):
srid = 4326
districts_srid = 4326
council_id = 'E07000112'
elections = ['parl.2017-06-08']
scraper_name = 'wdiv-scrapers/DC-PollingStations-Shepway'
geom_type = 'geojson'
def district_rec... | from data_collection.morph_importer import BaseMorphApiImporter
class Command(BaseMorphApiImporter):
srid = 4326
districts_srid = 4326
council_id = 'E07000112'
#elections = ['parl.2017-06-08']
scraper_name = 'wdiv-scrapers/DC-PollingStations-Shepway'
geom_type = 'geojson'
def district_re... | Remove Shepway election id (waiting on feedback) | Remove Shepway election id (waiting on feedback)
| Python | bsd-3-clause | chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | from data_collection.morph_importer import BaseMorphApiImporter
class Command(BaseMorphApiImporter):
srid = 4326
districts_srid = 4326
council_id = 'E07000112'
#elections = ['parl.2017-06-08']
scraper_name = 'wdiv-scrapers/DC-PollingStations-Shepway'
geom_type = 'geojson'
def district_re... | Remove Shepway election id (waiting on feedback)
from data_collection.morph_importer import BaseMorphApiImporter
class Command(BaseMorphApiImporter):
srid = 4326
districts_srid = 4326
council_id = 'E07000112'
elections = ['parl.2017-06-08']
scraper_name = 'wdiv-scrapers/DC-PollingStations-Shepwa... |
e6ce8e25ac819a874eb4e42087157f9cf780e0e4 | lib/rapidsms/contrib/messagelog/tests.py | lib/rapidsms/contrib/messagelog/tests.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from rapidsms.conf import settings
import rapidsms.contrib.messagelog.app
def test_messagelog():
app = rapidsms.contrib.messagelog.app.App()
# Invoke _log, make sure it doesn't blow up regardless of Django version
app._log('I', {}, "text")
| Add a test for contrib.messagelog's _log() method | Add a test for contrib.messagelog's _log() method
| Python | bsd-3-clause | ehealthafrica-ci/rapidsms,catalpainternational/rapidsms,eHealthAfrica/rapidsms,peterayeni/rapidsms,eHealthAfrica/rapidsms,ehealthafrica-ci/rapidsms,ehealthafrica-ci/rapidsms,lsgunth/rapidsms,lsgunth/rapidsms,peterayeni/rapidsms,caktus/rapidsms,lsgunth/rapidsms,lsgunth/rapidsms,eHealthAfrica/rapidsms,catalpainternationa... | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from rapidsms.conf import settings
import rapidsms.contrib.messagelog.app
def test_messagelog():
app = rapidsms.contrib.messagelog.app.App()
# Invoke _log, make sure it doesn't blow up regardless of Django version
app._log('I', {}, "text")
| Add a test for contrib.messagelog's _log() method
| |
a0c0499c3da95e53e99d6386f7970079a2669141 | app/twitter/views.py | app/twitter/views.py | from flask import Blueprint, request, render_template
from ..load import processing_results, api
import string
import tweepy
twitter_mod = Blueprint('twitter', __name__, template_folder='templates', static_folder='static')
ascii_chars = set(string.printable)
ascii_chars.remove(' ')
ascii_chars.add('...')
def takeo... | from flask import Blueprint, request, render_template
from ..load import processing_results, api
import string
import tweepy
twitter_mod = Blueprint('twitter', __name__, template_folder='templates', static_folder='static')
ascii_chars = set(string.printable)
ascii_chars.remove(' ')
ascii_chars.add('...')
def takeout... | Add exception handling in twitter view | Add exception handling in twitter view
| Python | mit | griimick/feature-mlsite,griimick/feature-mlsite,griimick/feature-mlsite | from flask import Blueprint, request, render_template
from ..load import processing_results, api
import string
import tweepy
twitter_mod = Blueprint('twitter', __name__, template_folder='templates', static_folder='static')
ascii_chars = set(string.printable)
ascii_chars.remove(' ')
ascii_chars.add('...')
def takeout... | Add exception handling in twitter view
from flask import Blueprint, request, render_template
from ..load import processing_results, api
import string
import tweepy
twitter_mod = Blueprint('twitter', __name__, template_folder='templates', static_folder='static')
ascii_chars = set(string.printable)
ascii_chars.remove... |
50d9601ea0fa35a9d5d831353f5a17b33dc7d8bf | panoptes_client/subject_set.py | panoptes_client/subject_set.py | from panoptes_client.panoptes import PanoptesObject, LinkResolver
from panoptes_client.subject import Subject
class SubjectSet(PanoptesObject):
_api_slug = 'subject_sets'
_link_slug = 'subject_sets'
_edit_attributes = (
'display_name',
{
'links': (
'project',
... | from panoptes_client.panoptes import PanoptesObject, LinkResolver
from panoptes_client.subject import Subject
class SubjectSet(PanoptesObject):
_api_slug = 'subject_sets'
_link_slug = 'subject_sets'
_edit_attributes = (
'display_name',
{
'links': (
'project',
... | Revert "Don't try to save SubjectSet.links.project on exiting objects" | Revert "Don't try to save SubjectSet.links.project on exiting objects"
This reverts commit b9a107b45cf2569f9effa1c8836a65255f2f3e64.
Superseded by 7d2fecab46f0ede85c00fba8335a8dd74fe16489
| Python | apache-2.0 | zooniverse/panoptes-python-client | from panoptes_client.panoptes import PanoptesObject, LinkResolver
from panoptes_client.subject import Subject
class SubjectSet(PanoptesObject):
_api_slug = 'subject_sets'
_link_slug = 'subject_sets'
_edit_attributes = (
'display_name',
{
'links': (
'project',
... | Revert "Don't try to save SubjectSet.links.project on exiting objects"
This reverts commit b9a107b45cf2569f9effa1c8836a65255f2f3e64.
Superseded by 7d2fecab46f0ede85c00fba8335a8dd74fe16489
from panoptes_client.panoptes import PanoptesObject, LinkResolver
from panoptes_client.subject import Subject
class SubjectSet(P... |
d37c1dca5ffe0508b0944b811a2a65daf8717bea | tests/test_garner_dates.py | tests/test_garner_dates.py | """Test garner.dates."""
from __future__ import absolute_import
from .check import Check
from proselint.checks.garner import dates
class TestCheck(Check):
"""Test class for garner.dates."""
__test__ = True
def test_50s_hyphenation(self):
"""Find uneeded hyphen in 50's."""
text = """The... | """Test garner.dates."""
from __future__ import absolute_import
from .check import Check
from proselint.checks.garner import dates
class TestCheck(Check):
"""Test class for garner.dates."""
__test__ = True
def test_50s_hyphenation(self):
"""Find uneeded hyphen in 50's."""
text = """The... | Fix bug in print statement | Fix bug in print statement
| Python | bsd-3-clause | jstewmon/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint | """Test garner.dates."""
from __future__ import absolute_import
from .check import Check
from proselint.checks.garner import dates
class TestCheck(Check):
"""Test class for garner.dates."""
__test__ = True
def test_50s_hyphenation(self):
"""Find uneeded hyphen in 50's."""
text = """The... | Fix bug in print statement
"""Test garner.dates."""
from __future__ import absolute_import
from .check import Check
from proselint.checks.garner import dates
class TestCheck(Check):
"""Test class for garner.dates."""
__test__ = True
def test_50s_hyphenation(self):
"""Find uneeded hyphen in 50... |
e17d8f9b8bd09b1b96cad3e61961f3833d2e486c | dataverse/file.py | dataverse/file.py | from __future__ import absolute_import
from dataverse.utils import sanitize
class DataverseFile(object):
def __init__(self, dataset, name, file_id=None):
self.dataset = dataset
self.name = sanitize(name)
self.id = file_id
self.download_url = '{0}/access/datafile/{1}'.format(
... | from __future__ import absolute_import
from dataverse.utils import sanitize
class DataverseFile(object):
def __init__(self, dataset, name, file_id=None):
self.dataset = dataset
self.name = sanitize(name)
self.id = file_id
self.download_url = '{0}/access/datafile/{1}'.format(
... | Fix 'class DataverseFile' to handle old and new response format Tests were failing after swith to new server/version | Fix 'class DataverseFile' to handle old and new response format
Tests were failing after swith to new server/version
| Python | apache-2.0 | CenterForOpenScience/dataverse-client-python,IQSS/dataverse-client-python | from __future__ import absolute_import
from dataverse.utils import sanitize
class DataverseFile(object):
def __init__(self, dataset, name, file_id=None):
self.dataset = dataset
self.name = sanitize(name)
self.id = file_id
self.download_url = '{0}/access/datafile/{1}'.format(
... | Fix 'class DataverseFile' to handle old and new response format
Tests were failing after swith to new server/version
from __future__ import absolute_import
from dataverse.utils import sanitize
class DataverseFile(object):
def __init__(self, dataset, name, file_id=None):
self.dataset = dataset
se... |
d7d1df44e39ad7af91046a61f40b357a9aa9943a | pox.py | pox.py | #!/usr/bin/python
# Set default log level
import logging
logging.basicConfig(level=logging.DEBUG)
from pox.core import core
import pox.openflow.openflow
import pox.topology.topology
import pox.openflow.of_01
import pox.dumb_l3_switch.dumb_l3_switch
import pox.messenger.messenger
# Turn on extra info for event except... | #!/usr/bin/python
# Set default log level
import logging
logging.basicConfig(level=logging.DEBUG)
from pox.core import core
import pox.openflow.openflow
import pox.topology.topology
import pox.openflow.of_01
import pox.dumb_l3_switch.dumb_l3_switch
import pox.messenger.messenger
# Turn on extra info for event except... | Add startup delay and change interpreter prompts | Add startup delay and change interpreter prompts
The delay is so that hopefully switch connections don't IMMEDIATELY print
all over the prompt. We'll do something better eventually.
| Python | apache-2.0 | adusia/pox,jacobq/csci5221-viro-project,jacobq/csci5221-viro-project,chenyuntc/pox,VamsikrishnaNallabothu/pox,andiwundsam/_of_normalize,andiwundsam/_of_normalize,jacobq/csci5221-viro-project,pthien92/sdn,MurphyMc/pox,denovogroup/pox,chenyuntc/pox,carlye566/IoT-POX,kulawczukmarcin/mypox,MurphyMc/pox,PrincetonUniversity/... | #!/usr/bin/python
# Set default log level
import logging
logging.basicConfig(level=logging.DEBUG)
from pox.core import core
import pox.openflow.openflow
import pox.topology.topology
import pox.openflow.of_01
import pox.dumb_l3_switch.dumb_l3_switch
import pox.messenger.messenger
# Turn on extra info for event except... | Add startup delay and change interpreter prompts
The delay is so that hopefully switch connections don't IMMEDIATELY print
all over the prompt. We'll do something better eventually.
#!/usr/bin/python
# Set default log level
import logging
logging.basicConfig(level=logging.DEBUG)
from pox.core import core
import po... |
43ad3b2d2e25b816d6d7b339d62e674541d76712 | setup.py | setup.py | from setuptools import setup, find_packages
from gdc_client.version import __version__
setup(
name="gdc_client",
version=__version__,
packages=find_packages(),
package_data={},
install_requires=[
'parcel',
'lxml==3.5.0b1',
'PyYAML==3.11',
'jsonschema==2.5.1',
... | from setuptools import setup, find_packages
from gdc_client.version import __version__
setup(
name="gdc_client",
version=__version__,
packages=find_packages(),
package_data={},
install_requires=[
'parcel',
'lxml==3.5.0b1',
'PyYAML==3.11',
'jsonschema==2.5.1',
... | Update dependency link for parcel and recent DTT-99 fix | Update dependency link for parcel and recent DTT-99 fix
| Python | apache-2.0 | NCI-GDC/gdc-client,NCI-GDC/gdc-client | from setuptools import setup, find_packages
from gdc_client.version import __version__
setup(
name="gdc_client",
version=__version__,
packages=find_packages(),
package_data={},
install_requires=[
'parcel',
'lxml==3.5.0b1',
'PyYAML==3.11',
'jsonschema==2.5.1',
... | Update dependency link for parcel and recent DTT-99 fix
from setuptools import setup, find_packages
from gdc_client.version import __version__
setup(
name="gdc_client",
version=__version__,
packages=find_packages(),
package_data={},
install_requires=[
'parcel',
'lxml==3.5.0b1',
... |
6dfa189bdab536ecfa2c14e4893017363923ee6a | bayes.py | bayes.py | import numpy as np
import cv2
# pos and neg are positive and negative instances
# each is a list of files of nparray dumps,
# nparray of BoW histograms; shape = (n, 101)
# of the class to be trained for
def build_trained_classifier(pos_files, neg_files):
total = len(pos_files) + len(neg_files)
samples = np.emp... | Implement Naive Bayes Classifier builder method | Implement Naive Bayes Classifier builder method
| Python | mit | ah450/ObjectRecognizer | import numpy as np
import cv2
# pos and neg are positive and negative instances
# each is a list of files of nparray dumps,
# nparray of BoW histograms; shape = (n, 101)
# of the class to be trained for
def build_trained_classifier(pos_files, neg_files):
total = len(pos_files) + len(neg_files)
samples = np.emp... | Implement Naive Bayes Classifier builder method
| |
7645d98247df22dbd4a5af19d89174d347d827e6 | python/challenges/plusMinus.py | python/challenges/plusMinus.py | """
Problem Statement:
Given an array of integers, calculate which fraction of the elements are positive, negative, and zeroes, respectively. Print the decimal value of each fraction.
Input Format:
The first line, N, is the size of the array.
The second line contains N space-separated integers describing the array of ... | Create main challenge file with proble statement and i/o expectations | Create main challenge file with proble statement and i/o expectations
| Python | mit | markthethomas/algorithms,markthethomas/algorithms,markthethomas/algorithms,markthethomas/algorithms | """
Problem Statement:
Given an array of integers, calculate which fraction of the elements are positive, negative, and zeroes, respectively. Print the decimal value of each fraction.
Input Format:
The first line, N, is the size of the array.
The second line contains N space-separated integers describing the array of ... | Create main challenge file with proble statement and i/o expectations
| |
b5672d55beb837f21d761f50740b93c5b1e0dc5d | napalm/exceptions.py | napalm/exceptions.py | # Copyright 2015 Spotify AB. All rights reserved.
#
# The contents of this file are 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 requi... | # Copyright 2015 Spotify AB. All rights reserved.
#
# The contents of this file are 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 requi... | Raise ConnectionException when device unusable | Raise ConnectionException when device unusable
| Python | apache-2.0 | napalm-automation/napalm-base,napalm-automation/napalm-base,Netflix-Skunkworks/napalm-base,napalm-automation/napalm,Netflix-Skunkworks/napalm-base,spotify/napalm,bewing/napalm-base,spotify/napalm,bewing/napalm-base | # Copyright 2015 Spotify AB. All rights reserved.
#
# The contents of this file are 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 requi... | Raise ConnectionException when device unusable
# Copyright 2015 Spotify AB. All rights reserved.
#
# The contents of this file are 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.... |
92e840aef7ac0d9aee629db58791a43a71cd578c | myhdl/test/conversion/numeric/test_numass.py | myhdl/test/conversion/numeric/test_numass.py | from __future__ import absolute_import, print_function
from random import randrange
from myhdl import Signal, uintba, sintba, instance, delay, conversion
def NumassBench():
p = Signal(uintba(1, 8))
q = Signal(uintba(1, 40))
r = Signal(sintba(1, 9))
s = Signal(sintba(1, 41))
PBIGINT = randrange(2... | Revert "Revert "Revert "Revert "Added the number assignment test for numeric."""" | Revert "Revert "Revert "Revert "Added the number assignment test for numeric.""""
This reverts commit 91151bc6fd2c48c83656452e7c8f8f7e8b7b4218.
| Python | lgpl-2.1 | jmgc/myhdl-numeric,jmgc/myhdl-numeric,jmgc/myhdl-numeric | from __future__ import absolute_import, print_function
from random import randrange
from myhdl import Signal, uintba, sintba, instance, delay, conversion
def NumassBench():
p = Signal(uintba(1, 8))
q = Signal(uintba(1, 40))
r = Signal(sintba(1, 9))
s = Signal(sintba(1, 41))
PBIGINT = randrange(2... | Revert "Revert "Revert "Revert "Added the number assignment test for numeric.""""
This reverts commit 91151bc6fd2c48c83656452e7c8f8f7e8b7b4218.
| |
a15701a49c1fffedc30f939c231be4936d3ab790 | setup.py | setup.py | import setuptools
from valohai_yaml import __version__
dev_dependencies = [
'flake8',
'isort',
'pydocstyle',
'pytest-cov',
]
if __name__ == '__main__':
setuptools.setup(
name='valohai-yaml',
description='Valohai.yaml validation and parsing',
version=__version__,
ur... | import ast
import os
import re
import setuptools
with open(os.path.join(os.path.dirname(__file__), 'valohai_yaml', '__init__.py')) as infp:
version = ast.literal_eval(re.search('__version__ = (.+?)$', infp.read(), re.M).group(1))
dev_dependencies = [
'flake8',
'isort',
'pydocstyle',
'pytest-cov',
... | Read version without importing package | Read version without importing package
| Python | mit | valohai/valohai-yaml | import ast
import os
import re
import setuptools
with open(os.path.join(os.path.dirname(__file__), 'valohai_yaml', '__init__.py')) as infp:
version = ast.literal_eval(re.search('__version__ = (.+?)$', infp.read(), re.M).group(1))
dev_dependencies = [
'flake8',
'isort',
'pydocstyle',
'pytest-cov',
... | Read version without importing package
import setuptools
from valohai_yaml import __version__
dev_dependencies = [
'flake8',
'isort',
'pydocstyle',
'pytest-cov',
]
if __name__ == '__main__':
setuptools.setup(
name='valohai-yaml',
description='Valohai.yaml validation and parsing',... |
da8b184267d04ae8c95772b4cbfaef7603d4ed67 | scripts/jenkins_console_log_search.py | scripts/jenkins_console_log_search.py | #!/usr/bin/env python3
"""
This short script uses curl requests to search the last 100 builds of
a jenkins job to find recurring errors, written in Python3.
It results in printing a list of links to builds that match the search
As the requests package is not included within kv, you will need to either
download this pa... | Add utility script for searching Jenkins console logs | Add utility script for searching Jenkins console logs
This small python script can be used to quickly check the last
100 (or more if you're willing to edit and wait) to see if a
string is present within the console log. This can help find
instances of errors to help determine intermittent failures from
one off problem... | Python | bsd-3-clause | daverigby/kv_engine,daverigby/kv_engine,daverigby/kv_engine,daverigby/kv_engine | #!/usr/bin/env python3
"""
This short script uses curl requests to search the last 100 builds of
a jenkins job to find recurring errors, written in Python3.
It results in printing a list of links to builds that match the search
As the requests package is not included within kv, you will need to either
download this pa... | Add utility script for searching Jenkins console logs
This small python script can be used to quickly check the last
100 (or more if you're willing to edit and wait) to see if a
string is present within the console log. This can help find
instances of errors to help determine intermittent failures from
one off problem... | |
6941d9048a8c630244bb48100864872b35a1a307 | tests/functional/test_layout_and_styling.py | tests/functional/test_layout_and_styling.py | import os
from .base import FunctionalTest
class LayoutStylingTest(FunctionalTest):
def test_bootstrap_links_loaded_successfully(self):
self.browser.get(self.live_server_url)
self.assertIn(
"//netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css",
self.browser.p... | from .base import FunctionalTest
class LayoutStylingTest(FunctionalTest):
def test_bootstrap_links_loaded_successfully(self):
self.browser.get(self.live_server_url)
links = [link.get_attribute("href")
for link in self.browser.find_elements_by_tag_name('link')]
scripts = ... | Fix bootstrap and jQuery link checking in homepage | Fix bootstrap and jQuery link checking in homepage
| Python | bsd-3-clause | andela-kndungu/compshop,andela-kndungu/compshop,kevgathuku/compshop,kevgathuku/compshop,kevgathuku/compshop,kevgathuku/compshop,andela-kndungu/compshop,andela-kndungu/compshop | from .base import FunctionalTest
class LayoutStylingTest(FunctionalTest):
def test_bootstrap_links_loaded_successfully(self):
self.browser.get(self.live_server_url)
links = [link.get_attribute("href")
for link in self.browser.find_elements_by_tag_name('link')]
scripts = ... | Fix bootstrap and jQuery link checking in homepage
import os
from .base import FunctionalTest
class LayoutStylingTest(FunctionalTest):
def test_bootstrap_links_loaded_successfully(self):
self.browser.get(self.live_server_url)
self.assertIn(
"//netdna.bootstrapcdn.com/bootstrap/3.3.... |
33e23230315f7a922e50264948c42b2c68116cc2 | numba/tests/issues/test_potential_gcc_error.py | numba/tests/issues/test_potential_gcc_error.py | # This tests a potential GCC 4.1.2 miscompile of LLVM.
# The problem is observed as a error in greedy register allocation pass,
# which resulted as a segfault.
# No such problem in GCC 4.4.6.
from numba import *
import numpy as np
@jit(uint8[:,:](f8, f8, f8, f8, uint8[:,:], int32))
def create_fractal(min_x, max_x, m... | Add tests for the possibly gcc miscompile error of LLVM in the mandel example. | Add tests for the possibly gcc miscompile error of LLVM in the mandel example.
| Python | bsd-2-clause | numba/numba,gmarkall/numba,pombredanne/numba,pitrou/numba,pitrou/numba,IntelLabs/numba,numba/numba,ssarangi/numba,gmarkall/numba,stuartarchibald/numba,jriehl/numba,stefanseefeld/numba,numba/numba,pitrou/numba,GaZ3ll3/numba,stonebig/numba,pitrou/numba,shiquanwang/numba,stefanseefeld/numba,stuartarchibald/numba,stonebig/... | # This tests a potential GCC 4.1.2 miscompile of LLVM.
# The problem is observed as a error in greedy register allocation pass,
# which resulted as a segfault.
# No such problem in GCC 4.4.6.
from numba import *
import numpy as np
@jit(uint8[:,:](f8, f8, f8, f8, uint8[:,:], int32))
def create_fractal(min_x, max_x, m... | Add tests for the possibly gcc miscompile error of LLVM in the mandel example.
| |
ff44e924a4f01bd39d4b26a39519bf55dd5e7560 | ann.py | ann.py |
class ANN:
def __init__(self):
pass
def train(self):
pass
def predict(self):
pass
def update_weights(self):
pass
class Layer:
def __init__(self):
pass
| Add top down design of ANN and Layer | Add top down design of ANN and Layer
| Python | apache-2.0 | Razvy000/ANN_Course |
class ANN:
def __init__(self):
pass
def train(self):
pass
def predict(self):
pass
def update_weights(self):
pass
class Layer:
def __init__(self):
pass
| Add top down design of ANN and Layer
| |
af599f0168096fa594773d3fac049869c31f8ecc | setup.py | setup.py | from setuptools import setup
import jasinja, sys
requires = ['Jinja2']
if sys.version_info < (2, 6):
requirements += ['simplejson']
setup(
name='jasinja',
version=jasinja.__version__,
url='http://bitbucket.org/djc/jasinja',
license='BSD',
author='Dirkjan Ochtman',
author_email='dirkjan@och... | from setuptools import setup
import jasinja, sys
requires = ['Jinja2']
if sys.version_info < (2, 6):
requires += ['simplejson']
setup(
name='jasinja',
version=jasinja.__version__,
url='http://bitbucket.org/djc/jasinja',
license='BSD',
author='Dirkjan Ochtman',
author_email='dirkjan@ochtman... | Fix stupid typo in requirements specification. | Fix stupid typo in requirements specification.
| Python | bsd-3-clause | djc/jasinja,djc/jasinja | from setuptools import setup
import jasinja, sys
requires = ['Jinja2']
if sys.version_info < (2, 6):
requires += ['simplejson']
setup(
name='jasinja',
version=jasinja.__version__,
url='http://bitbucket.org/djc/jasinja',
license='BSD',
author='Dirkjan Ochtman',
author_email='dirkjan@ochtman... | Fix stupid typo in requirements specification.
from setuptools import setup
import jasinja, sys
requires = ['Jinja2']
if sys.version_info < (2, 6):
requirements += ['simplejson']
setup(
name='jasinja',
version=jasinja.__version__,
url='http://bitbucket.org/djc/jasinja',
license='BSD',
author=... |
5e03af4b0f920e97507b3ada6b4b925136ddbf07 | froide/upload/serializers.py | froide/upload/serializers.py | from rest_framework import serializers
from .models import Upload
class UploadSerializer(serializers.ModelSerializer):
class Meta:
model = Upload
fields = '__all__'
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['guid'].required = True
| from rest_framework import serializers
from .models import Upload
class UploadSerializer(serializers.ModelSerializer):
class Meta:
model = Upload
fields = '__all__'
def __init__(self, *args, **kwargs):
'''
Add required marker, so OpenAPI schema generator can remove it again
... | Add some documentation for weird init | Add some documentation for weird init | Python | mit | fin/froide,stefanw/froide,stefanw/froide,fin/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide | from rest_framework import serializers
from .models import Upload
class UploadSerializer(serializers.ModelSerializer):
class Meta:
model = Upload
fields = '__all__'
def __init__(self, *args, **kwargs):
'''
Add required marker, so OpenAPI schema generator can remove it again
... | Add some documentation for weird init
from rest_framework import serializers
from .models import Upload
class UploadSerializer(serializers.ModelSerializer):
class Meta:
model = Upload
fields = '__all__'
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
se... |
f0e11b0743c2779f61970917da6eef859149f600 | taar/recommenders/utils.py | taar/recommenders/utils.py | import json
import os
from tempfile import gettempdir
import boto3
from botocore.exceptions import ClientError
import requests
def fetch_json(uri):
""" Perform an HTTP GET on the given uri, return the results as json.
Args:
uri: the string URI to fetch.
Returns:
A JSON object with the r... | import json
import os
from tempfile import gettempdir
import boto3
from botocore.exceptions import ClientError
import requests
def fetch_json(uri):
""" Perform an HTTP GET on the given uri, return the results as json.
Args:
uri: the string URI to fetch.
Returns:
A JSON object with the r... | Make sure to load the S3 cache file when available | Make sure to load the S3 cache file when available
| Python | mpl-2.0 | maurodoglio/taar | import json
import os
from tempfile import gettempdir
import boto3
from botocore.exceptions import ClientError
import requests
def fetch_json(uri):
""" Perform an HTTP GET on the given uri, return the results as json.
Args:
uri: the string URI to fetch.
Returns:
A JSON object with the r... | Make sure to load the S3 cache file when available
import json
import os
from tempfile import gettempdir
import boto3
from botocore.exceptions import ClientError
import requests
def fetch_json(uri):
""" Perform an HTTP GET on the given uri, return the results as json.
Args:
uri: the string URI to f... |
b9b5af6bc8da56caadf74e75b833338330305779 | setup.py | setup.py | from setuptools import setup, find_packages
import sys, os
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.rst')).read()
except IOError:
README = ''
version = "0.1.0"
test_requirements = [
'nose',
'webtest',
]
setup(name='tgext.mailer',
version=versi... | from setuptools import setup, find_packages
import sys, os
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.rst')).read()
except IOError:
README = ''
version = "0.1.0"
test_requirements = [
'nose',
'webtest',
]
setup(name='tgext.mailer',
version=versi... | Upgrade to sendmail 4.3, fixed old bug with transaction | Upgrade to sendmail 4.3, fixed old bug with transaction
| Python | mit | amol-/tgext.mailer | from setuptools import setup, find_packages
import sys, os
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.rst')).read()
except IOError:
README = ''
version = "0.1.0"
test_requirements = [
'nose',
'webtest',
]
setup(name='tgext.mailer',
version=versi... | Upgrade to sendmail 4.3, fixed old bug with transaction
from setuptools import setup, find_packages
import sys, os
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.rst')).read()
except IOError:
README = ''
version = "0.1.0"
test_requirements = [
'nose',
'we... |
ab42c5e8c3ac51c65ed7229dafb751c7baa667aa | examples/mnist-rica.py | examples/mnist-rica.py | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import theanets
from utils import load_mnist, plot_layers, plot_images
class RICA(theanets.Autoencoder):
def J(self, weight_inverse=0, **kwargs):
cost = super(RICA, self).J(**kwargs)
if weight_inverse > 0:
cost ... | Add an example for computing sparse codes using RICA. | Add an example for computing sparse codes using RICA.
| Python | mit | lmjohns3/theanets,chrinide/theanets,devdoer/theanets | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import theanets
from utils import load_mnist, plot_layers, plot_images
class RICA(theanets.Autoencoder):
def J(self, weight_inverse=0, **kwargs):
cost = super(RICA, self).J(**kwargs)
if weight_inverse > 0:
cost ... | Add an example for computing sparse codes using RICA.
| |
315ad5f2f31f82f8d42d2a65fe4f056b4e3fcfd7 | tests/test_quickstart.py | tests/test_quickstart.py | import pytest
from lektor.quickstart import get_default_author
from lektor.quickstart import get_default_author_email
from lektor.utils import locate_executable
def test_default_author(os_user):
assert get_default_author() == "Lektor Test"
@pytest.mark.skipif(locate_executable("git") is None, reason="git not i... | import os
import pytest
from lektor.quickstart import get_default_author
from lektor.quickstart import get_default_author_email
from lektor.utils import locate_executable
def test_default_author(os_user):
assert get_default_author() == "Lektor Test"
@pytest.mark.skipif(locate_executable("git") is None, reason... | Add test case for when git is not available | Add test case for when git is not available
| Python | bsd-3-clause | lektor/lektor,lektor/lektor,lektor/lektor,lektor/lektor | import os
import pytest
from lektor.quickstart import get_default_author
from lektor.quickstart import get_default_author_email
from lektor.utils import locate_executable
def test_default_author(os_user):
assert get_default_author() == "Lektor Test"
@pytest.mark.skipif(locate_executable("git") is None, reason... | Add test case for when git is not available
import pytest
from lektor.quickstart import get_default_author
from lektor.quickstart import get_default_author_email
from lektor.utils import locate_executable
def test_default_author(os_user):
assert get_default_author() == "Lektor Test"
@pytest.mark.skipif(locate... |
8b847215c2ae071a4a2e402167e20fdd641b222d | xenserver/destroy_cached_images.py | xenserver/destroy_cached_images.py | """
destroy_cached_images.py
This script is used to clean up Glance images that are cached in the SR. By
default, this script will only cleanup unused cached images.
Options:
--dry_run - Don't actually destroy the VDIs
--all_cached - Destroy all cached images instead of just unused cached
... | Add script to destroy cached images. | XenAPI: Add script to destroy cached images.
Operations will want the ability to clear out cached images when
disk-space becomes an issue.
This script allows ops to clear out all cached images or just cached
images that aren't in current use.
Change-Id: If87bd10ef3f893c416d2f0615358ba65aef17a2d
| Python | apache-2.0 | emonty/oslo-hacking,zancas/hacking,zancas/hacking,emonty/oslo-hacking,hyakuhei/cleantox,hyakuhei/cleantox,openstack-dev/hacking,openstack-dev/hacking | """
destroy_cached_images.py
This script is used to clean up Glance images that are cached in the SR. By
default, this script will only cleanup unused cached images.
Options:
--dry_run - Don't actually destroy the VDIs
--all_cached - Destroy all cached images instead of just unused cached
... | XenAPI: Add script to destroy cached images.
Operations will want the ability to clear out cached images when
disk-space becomes an issue.
This script allows ops to clear out all cached images or just cached
images that aren't in current use.
Change-Id: If87bd10ef3f893c416d2f0615358ba65aef17a2d
| |
fc89664fd75f787b03953d8eac3ec99b6fdf19de | lesson5/exceptions_except.py | lesson5/exceptions_except.py | def take_beer(fridge, number=1):
if "beer" not in fridge:
raise Exception("No beer at all:(")
if number > fridge["beer"]:
raise Exception("Not enough beer:(")
fridge["beer"] -= number
if __name__ == "__main__":
fridge = {
"beer": 2,
"milk": 1,
"meat": 3,
}... | Add y.a. script for showing except working | Add y.a. script for showing except working
| Python | bsd-2-clause | drednout/letspython,drednout/letspython | def take_beer(fridge, number=1):
if "beer" not in fridge:
raise Exception("No beer at all:(")
if number > fridge["beer"]:
raise Exception("Not enough beer:(")
fridge["beer"] -= number
if __name__ == "__main__":
fridge = {
"beer": 2,
"milk": 1,
"meat": 3,
}... | Add y.a. script for showing except working
| |
d7299fd931ae62cc661b48dbc84aa161a395f1fa | fermipy/__init__.py | fermipy/__init__.py | import os
__version__ = "unknown"
try:
from version import get_git_version
__version__ = get_git_version()
except Exception as message:
print(message)
__author__ = "Matthew Wood"
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
PACKAGE_DATA = os.path.join(PACKAGE_ROOT,'data')
os.environ['FERMIP... | from __future__ import absolute_import, division, print_function
import os
__version__ = "unknown"
try:
from .version import get_git_version
__version__ = get_git_version()
except Exception as message:
print(message)
__author__ = "Matthew Wood"
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
P... | Fix version module import for Python 3 | Fix version module import for Python 3
| Python | bsd-3-clause | jefemagril/fermipy,jefemagril/fermipy,jefemagril/fermipy,fermiPy/fermipy | from __future__ import absolute_import, division, print_function
import os
__version__ = "unknown"
try:
from .version import get_git_version
__version__ = get_git_version()
except Exception as message:
print(message)
__author__ = "Matthew Wood"
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
P... | Fix version module import for Python 3
import os
__version__ = "unknown"
try:
from version import get_git_version
__version__ = get_git_version()
except Exception as message:
print(message)
__author__ = "Matthew Wood"
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
PACKAGE_DATA = os.path.join... |
7d45fd15f9d2fa4e0d830e7f404fb77d531adc29 | examples/test-combo-box.py | examples/test-combo-box.py | """
This test is adopted form nbtk, but since it's summer it uses
Munich's most famous Beergarden instead of places in London ;)
"""
import clutter
import nbtk
def title_changed_cb(box, pspec):
print 'title now:', box.get_title()
def index_changed_cb(box, pspec):
print 'index now:', box.get_index()
def stage... | Add a simple test for ComboBox | Add a simple test for ComboBox
| Python | lgpl-2.1 | buztard/mxpy,buztard/mxpy,buztard/mxpy | """
This test is adopted form nbtk, but since it's summer it uses
Munich's most famous Beergarden instead of places in London ;)
"""
import clutter
import nbtk
def title_changed_cb(box, pspec):
print 'title now:', box.get_title()
def index_changed_cb(box, pspec):
print 'index now:', box.get_index()
def stage... | Add a simple test for ComboBox
| |
f3eee368e13ee37048d52bde0d067efea057fef8 | monkeylearn/extraction.py | monkeylearn/extraction.py | # -*- coding: utf-8 -*-
from __future__ import (
print_function, unicode_literals, division, absolute_import)
from six.moves import range
from monkeylearn.utils import SleepRequestsMixin, MonkeyLearnResponse, HandleErrorsMixin
from monkeylearn.settings import DEFAULT_BASE_ENDPOINT, DEFAULT_BATCH_SIZE
class Extra... | # -*- coding: utf-8 -*-
from __future__ import (
print_function, unicode_literals, division, absolute_import)
from six.moves import range
from monkeylearn.utils import SleepRequestsMixin, MonkeyLearnResponse, HandleErrorsMixin
from monkeylearn.settings import DEFAULT_BASE_ENDPOINT, DEFAULT_BATCH_SIZE
class Extra... | Support for extra parameters in extractors | Support for extra parameters in extractors
| Python | mit | monkeylearn/monkeylearn-python | # -*- coding: utf-8 -*-
from __future__ import (
print_function, unicode_literals, division, absolute_import)
from six.moves import range
from monkeylearn.utils import SleepRequestsMixin, MonkeyLearnResponse, HandleErrorsMixin
from monkeylearn.settings import DEFAULT_BASE_ENDPOINT, DEFAULT_BATCH_SIZE
class Extra... | Support for extra parameters in extractors
# -*- coding: utf-8 -*-
from __future__ import (
print_function, unicode_literals, division, absolute_import)
from six.moves import range
from monkeylearn.utils import SleepRequestsMixin, MonkeyLearnResponse, HandleErrorsMixin
from monkeylearn.settings import DEFAULT_BA... |
fc94d60066692e6e8dc496bb854039bb66af3311 | scout.py | scout.py |
# Python does not require explicit interfaces,
# but I believe that code which does is more
# maintainable. Thus I include this explicit
# interface for Problems.
class Problem:
def getStartState(self):
return None
def getEndState(self):
return None
def isValidState(self, state):
... |
# Python does not require explicit interfaces,
# but I believe that code which does is more
# maintainable. Thus I include this explicit
# interface for Problems.
class Problem:
def getStartState(self):
return None
def getEndState(self):
return None
def isValidState(self, state):
... | Add a simple problem for testing | Add a simple problem for testing
| Python | mit | SpexGuy/Scout |
# Python does not require explicit interfaces,
# but I believe that code which does is more
# maintainable. Thus I include this explicit
# interface for Problems.
class Problem:
def getStartState(self):
return None
def getEndState(self):
return None
def isValidState(self, state):
... | Add a simple problem for testing
# Python does not require explicit interfaces,
# but I believe that code which does is more
# maintainable. Thus I include this explicit
# interface for Problems.
class Problem:
def getStartState(self):
return None
def getEndState(self):
return None
def i... |
21eb7e06f175a08b4d90146d1bfb48670577e59b | bin/analysis/create_static_model.py | bin/analysis/create_static_model.py | # The old seed pipeline
import logging
import emission.analysis.classification.inference.mode.seed.pipeline as pipeline
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
seed_pipeline = pipeline.ModeInferencePipelineMovesFormat()
seed_pipeline.runPipeline()
| Check in a simple script to create and save a model based on old-style data | Check in a simple script to create and save a model based on old-style data
Since the analysis pipeline has already been defined, this was pretty easy.
And it is even tested.
Testing done: Ran it, there was a json file created.
| Python | bsd-3-clause | shankari/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server | # The old seed pipeline
import logging
import emission.analysis.classification.inference.mode.seed.pipeline as pipeline
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
seed_pipeline = pipeline.ModeInferencePipelineMovesFormat()
seed_pipeline.runPipeline()
| Check in a simple script to create and save a model based on old-style data
Since the analysis pipeline has already been defined, this was pretty easy.
And it is even tested.
Testing done: Ran it, there was a json file created.
| |
56ab983036bcb5c78eee91483c1e610da69216d1 | kubernetes/client/apis/__init__.py | kubernetes/client/apis/__init__.py | from __future__ import absolute_import
import warnings
# flake8: noqa
# alias kubernetes.client.api package and print deprecation warning
from kubernetes.client.api import *
warnings.filterwarnings('default', module='kubernetes.client.apis')
warnings.warn(
"The package kubernetes.client.apis is renamed and depre... | Add kubernetes.client.apis as an alias to kubernetes.client.api | Add kubernetes.client.apis as an alias to kubernetes.client.api
Reference: https://github.com/kubernetes-client/python/issues/974
Signed-off-by: Nabarun Pal <46a782cbd1e9f752958998187886c2b51fda054c@gmail.com>
| Python | apache-2.0 | kubernetes-client/python,kubernetes-client/python | from __future__ import absolute_import
import warnings
# flake8: noqa
# alias kubernetes.client.api package and print deprecation warning
from kubernetes.client.api import *
warnings.filterwarnings('default', module='kubernetes.client.apis')
warnings.warn(
"The package kubernetes.client.apis is renamed and depre... | Add kubernetes.client.apis as an alias to kubernetes.client.api
Reference: https://github.com/kubernetes-client/python/issues/974
Signed-off-by: Nabarun Pal <46a782cbd1e9f752958998187886c2b51fda054c@gmail.com>
| |
f2a6897aaa20d2c5a312b1a87d5a7f515f3cdd4b | lightware_parse.py | lightware_parse.py | #!/usr/bin/env python
import serial
s = serial.Serial('/dev/ttyUSB0', baudrate=115200)
while True:
line = s.readline()
dist = line.lstrip(' ').split(' ')[0]
print dist
| Add lightware LRF parsing code | Add lightware LRF parsing code
| Python | mit | UCSD-E4E/aerial_lidar,UCSD-E4E/aerial_lidar,UCSD-E4E/aerial_lidar,UCSD-E4E/aerial_lidar,UCSD-E4E/aerial_lidar,UCSD-E4E/aerial_lidar | #!/usr/bin/env python
import serial
s = serial.Serial('/dev/ttyUSB0', baudrate=115200)
while True:
line = s.readline()
dist = line.lstrip(' ').split(' ')[0]
print dist
| Add lightware LRF parsing code
| |
f80b9f42db599e0416bd4e28f69c81e0fda494d2 | todoist/managers/generic.py | todoist/managers/generic.py | # -*- coding: utf-8 -*-
class Manager(object):
# should be re-defined in a subclass
state_name = None
object_type = None
def __init__(self, api):
self.api = api
# shortcuts
@property
def state(self):
return self.api.state
@property
def queue(self):
return ... | # -*- coding: utf-8 -*-
class Manager(object):
# should be re-defined in a subclass
state_name = None
object_type = None
def __init__(self, api):
self.api = api
# shortcuts
@property
def state(self):
return self.api.state
@property
def queue(self):
return ... | Fix the case of using `get_by_id` when there's not state | Fix the case of using `get_by_id` when there's not state
Previous to this commit, if there's no state we would return raw data,
which would break object chaining. Now we check the state one last time
before giving up and returning the raw data because it may have been
populated by methods like `get_by_id` (instead of ... | Python | mit | Doist/todoist-python | # -*- coding: utf-8 -*-
class Manager(object):
# should be re-defined in a subclass
state_name = None
object_type = None
def __init__(self, api):
self.api = api
# shortcuts
@property
def state(self):
return self.api.state
@property
def queue(self):
return ... | Fix the case of using `get_by_id` when there's not state
Previous to this commit, if there's no state we would return raw data,
which would break object chaining. Now we check the state one last time
before giving up and returning the raw data because it may have been
populated by methods like `get_by_id` (instead of ... |
346a6b5cc5426ce38195dd5ce4507894710ee8a7 | fix-gpt-ubuntu.py | fix-gpt-ubuntu.py | #!/usr/bin/env python
#
# Copyright 2014 Microsoft Corporation
#
# 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 applic... | Add script to fix gpt mounting issue with ubuntu. | Add script to fix gpt mounting issue with ubuntu.
| Python | apache-2.0 | fieryorc/WALinuxAgent,lizzha/WALinuxAgent,jerickso/WALinuxAgent,SuperScottz/WALinuxAgent,yuezh/WALinuxAgent,thomas1206/WALinuxAgent,AbelHu/WALinuxAgent,thomas1206/WALinuxAgent,karataliu/WALinuxAgent,karataliu/WALinuxAgent,AbelHu/WALinuxAgent,ryanmiao/WALinuxAgent,ryanmiao/WALinuxAgent,SuperScottz/WALinuxAgent,yuezh/WAL... | #!/usr/bin/env python
#
# Copyright 2014 Microsoft Corporation
#
# 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 applic... | Add script to fix gpt mounting issue with ubuntu.
| |
6dc4cb5ec0f0e2373d364e93b7d342beaad6dc4b | setup.py | setup.py | # !/usr/bin/env python
from setuptools import setup, find_packages
setup(name='symbtrsynthesis',
version='1.0.1-dev',
description='An (adaptive) synthesizer for SymbTr-MusicXML scores',
author='Hasan Sercan Atli',
url='https://github.com/hsercanatli/symbtrsynthesis',
packages=find_packag... | # !/usr/bin/env python
from setuptools import setup, find_packages
setup(name='symbtrsynthesis',
version='1.0.1-dev',
description='An (adaptive) synthesizer for SymbTr-MusicXML scores',
author='Hasan Sercan Atli',
url='https://github.com/hsercanatli/symbtrsynthesis',
packages=find_packag... | Include data files in built package | Include data files in built package
| Python | agpl-3.0 | hsercanatli/adaptivetuning | # !/usr/bin/env python
from setuptools import setup, find_packages
setup(name='symbtrsynthesis',
version='1.0.1-dev',
description='An (adaptive) synthesizer for SymbTr-MusicXML scores',
author='Hasan Sercan Atli',
url='https://github.com/hsercanatli/symbtrsynthesis',
packages=find_packag... | Include data files in built package
# !/usr/bin/env python
from setuptools import setup, find_packages
setup(name='symbtrsynthesis',
version='1.0.1-dev',
description='An (adaptive) synthesizer for SymbTr-MusicXML scores',
author='Hasan Sercan Atli',
url='https://github.com/hsercanatli/symbtrs... |
2f308fbefad5f5cee8b6e160e9a89fda7f4e1ba9 | tests/test_renderers.py | tests/test_renderers.py | from flask import Flask
from flask_webapi import WebAPI, APIView, renderer, route
from flask_webapi.renderers import PickleRenderer
from unittest import TestCase
class TestRenderer(TestCase):
def setUp(self):
self.app = Flask(__name__)
self.api = WebAPI(self.app)
self.api.load_module('test... | Add unit tests for pickle renderer | Add unit tests for pickle renderer
| Python | mit | viniciuschiele/flask-webapi | from flask import Flask
from flask_webapi import WebAPI, APIView, renderer, route
from flask_webapi.renderers import PickleRenderer
from unittest import TestCase
class TestRenderer(TestCase):
def setUp(self):
self.app = Flask(__name__)
self.api = WebAPI(self.app)
self.api.load_module('test... | Add unit tests for pickle renderer
| |
56dc9af410907780faba79699d274bef96a18675 | functionaltests/common/base.py | functionaltests/common/base.py | """
Copyright 2015 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | """
Copyright 2015 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | Remove unnecessary __init__ from functionaltests | Remove unnecessary __init__ from functionaltests
The __init__ just passes the same arguments, so it is not necessary
to implement it. This patch removes it for the cleanup.
Change-Id: Ib465356c47d06bfc66bef69126b089be24d19474
| Python | apache-2.0 | openstack/designate,openstack/designate,openstack/designate | """
Copyright 2015 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | Remove unnecessary __init__ from functionaltests
The __init__ just passes the same arguments, so it is not necessary
to implement it. This patch removes it for the cleanup.
Change-Id: Ib465356c47d06bfc66bef69126b089be24d19474
"""
Copyright 2015 Rackspace
Licensed under the Apache License, Version 2.0 (the "License"... |
c19c69926e54e8268b7587a91264a976724a8801 | setup.py | setup.py | from distutils.core import setup
setup(
name='scrAPI Utils',
version='0.4.7',
author='Chris Seto',
author_email='Chris@seto.xyz',
packages=['scrapi.linter'],
package_data={'scrapi.linter': ['../__init__.py']},
url='http://www.github.com/chrisseto/scrapi',
license='LICENSE.txt',
desc... | from distutils.core import setup
setup(
name='scrAPI Utils',
version='0.4.8',
author='Chris Seto',
author_email='Chris@seto.xyz',
packages=['scrapi.linter'],
package_data={'scrapi.linter': ['../__init__.py']},
url='http://www.github.com/chrisseto/scrapi',
license='LICENSE.txt',
desc... | Increment version number for latest linter version | Increment version number for latest linter version
| Python | apache-2.0 | fabianvf/scrapi,mehanig/scrapi,fabianvf/scrapi,mehanig/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,ostwald/scrapi,jeffreyliu3230/scrapi,icereval/scrapi,felliott/scrapi,erinspace/scrapi,alexgarciac/scrapi,felliott/scrapi,CenterForOpenScience/scrapi | from distutils.core import setup
setup(
name='scrAPI Utils',
version='0.4.8',
author='Chris Seto',
author_email='Chris@seto.xyz',
packages=['scrapi.linter'],
package_data={'scrapi.linter': ['../__init__.py']},
url='http://www.github.com/chrisseto/scrapi',
license='LICENSE.txt',
desc... | Increment version number for latest linter version
from distutils.core import setup
setup(
name='scrAPI Utils',
version='0.4.7',
author='Chris Seto',
author_email='Chris@seto.xyz',
packages=['scrapi.linter'],
package_data={'scrapi.linter': ['../__init__.py']},
url='http://www.github.com/ch... |
f61b81e968384859eb51a2ff14ca7709e8322ae8 | yunity/walls/models.py | yunity/walls/models.py | from django.db.models import ForeignKey, TextField
from config import settings
from yunity.base.models import BaseModel
class Wall(BaseModel):
pass
class WallPost(BaseModel):
wall = ForeignKey(Wall)
author = ForeignKey(settings.AUTH_USER_MODEL)
class WallPostContent(BaseModel):
post = ForeignKey(... | from django.db.models import ForeignKey, TextField
from config import settings
from yunity.base.models import BaseModel
class Wall(BaseModel):
def resolve_permissions(self, collector):
h = self.hub
if h.target_content_type.model == 'group':
g = h.target
""":type : Group"""... | Implement basic permissions resolver for walls | Implement basic permissions resolver for walls
To be seen as a poc, collect all hub permissions for a basic permission
and settings/inheritance model for reading a wall.
with @nicksellen
| Python | agpl-3.0 | yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend | from django.db.models import ForeignKey, TextField
from config import settings
from yunity.base.models import BaseModel
class Wall(BaseModel):
def resolve_permissions(self, collector):
h = self.hub
if h.target_content_type.model == 'group':
g = h.target
""":type : Group"""... | Implement basic permissions resolver for walls
To be seen as a poc, collect all hub permissions for a basic permission
and settings/inheritance model for reading a wall.
with @nicksellen
from django.db.models import ForeignKey, TextField
from config import settings
from yunity.base.models import BaseModel
class W... |
95e61ccdebc33c1c610d0672558cd00798c3105f | packages/grid/backend/grid/api/users/models.py | packages/grid/backend/grid/api/users/models.py | # stdlib
from typing import Optional
from typing import Union
# third party
from nacl.encoding import HexEncoder
from nacl.signing import SigningKey
from pydantic import BaseModel
from pydantic import EmailStr
class BaseUser(BaseModel):
email: Optional[EmailStr]
name: Optional[str]
role: Union[Optional[i... | # stdlib
from typing import Optional
from typing import Union
# third party
from nacl.encoding import HexEncoder
from nacl.signing import SigningKey
from pydantic import BaseModel
from pydantic import EmailStr
class BaseUser(BaseModel):
email: Optional[EmailStr]
name: Optional[str]
role: Union[Optional[i... | ADD institution / website as optional fields during user creation | ADD institution / website as optional fields during user creation
| Python | apache-2.0 | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | # stdlib
from typing import Optional
from typing import Union
# third party
from nacl.encoding import HexEncoder
from nacl.signing import SigningKey
from pydantic import BaseModel
from pydantic import EmailStr
class BaseUser(BaseModel):
email: Optional[EmailStr]
name: Optional[str]
role: Union[Optional[i... | ADD institution / website as optional fields during user creation
# stdlib
from typing import Optional
from typing import Union
# third party
from nacl.encoding import HexEncoder
from nacl.signing import SigningKey
from pydantic import BaseModel
from pydantic import EmailStr
class BaseUser(BaseModel):
email: Op... |
19f09bb432a9e2232f0c23743d75315bb2ad2295 | cfgov/sheerlike/external_links.py | cfgov/sheerlike/external_links.py | import warnings
from bs4 import BeautifulSoup
from v1 import parse_links
def process_external_links(doc):
warnings.filterwarnings('ignore')
for key, value in doc.iteritems():
doc[key] = _process_data(value)
warnings.resetwarnings()
return doc
def _process_data(field):
if isinstance(field... | import warnings
from bs4 import BeautifulSoup
from v1 import parse_links
def process_external_links(doc):
warnings.filterwarnings('ignore')
for key, value in doc.iteritems():
doc[key] = _process_data(value)
warnings.resetwarnings()
return doc
def _process_data(field):
if isinstance(field... | Remove output formatting to get back what was put in | Remove output formatting to get back what was put in
| Python | cc0-1.0 | kave/cfgov-refresh,kave/cfgov-refresh,kave/cfgov-refresh,kave/cfgov-refresh | import warnings
from bs4 import BeautifulSoup
from v1 import parse_links
def process_external_links(doc):
warnings.filterwarnings('ignore')
for key, value in doc.iteritems():
doc[key] = _process_data(value)
warnings.resetwarnings()
return doc
def _process_data(field):
if isinstance(field... | Remove output formatting to get back what was put in
import warnings
from bs4 import BeautifulSoup
from v1 import parse_links
def process_external_links(doc):
warnings.filterwarnings('ignore')
for key, value in doc.iteritems():
doc[key] = _process_data(value)
warnings.resetwarnings()
return d... |
0137d5440f86a8f1424598beea4468ae8c68f985 | demos/dlgr/demos/iterated_drawing/models.py | demos/dlgr/demos/iterated_drawing/models.py | from dallinger.nodes import Source
import random
import base64
import os
import json
class DrawingSource(Source):
"""A Source that reads in a random image from a file and transmits it."""
__mapper_args__ = {
"polymorphic_identity": "drawing_source"
}
def _contents(self):
"""Define th... | from dallinger.nodes import Source
import random
import base64
import os
import json
class DrawingSource(Source):
"""A Source that reads in a random image from a file and transmits it."""
__mapper_args__ = {
"polymorphic_identity": "drawing_source"
}
def _contents(self):
"""Define th... | Comment explaining random.choice() on 1-item list | Comment explaining random.choice() on 1-item list
| Python | mit | Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger | from dallinger.nodes import Source
import random
import base64
import os
import json
class DrawingSource(Source):
"""A Source that reads in a random image from a file and transmits it."""
__mapper_args__ = {
"polymorphic_identity": "drawing_source"
}
def _contents(self):
"""Define th... | Comment explaining random.choice() on 1-item list
from dallinger.nodes import Source
import random
import base64
import os
import json
class DrawingSource(Source):
"""A Source that reads in a random image from a file and transmits it."""
__mapper_args__ = {
"polymorphic_identity": "drawing_source"
... |
3b6eaabe93a92782a1a5198ae4b03fa5e501a770 | agir/activity/serializers.py | agir/activity/serializers.py | from rest_framework import serializers
from agir.events.serializers import EventSerializer
from agir.groups.serializers import SupportGroupSerializer
from agir.lib.serializers import FlexibleFieldsMixin
from agir.people.serializers import PersonSerializer
class ActivitySerializer(FlexibleFieldsMixin, serializers.Ser... | from rest_framework import serializers
from agir.events.serializers import EventSerializer
from agir.groups.serializers import SupportGroupSerializer
from agir.lib.serializers import FlexibleFieldsMixin
from agir.people.serializers import PersonSerializer
class ActivitySerializer(FlexibleFieldsMixin, serializers.Ser... | Add individual email field to activity serializer | Add individual email field to activity serializer
| Python | agpl-3.0 | lafranceinsoumise/api-django,lafranceinsoumise/api-django,lafranceinsoumise/api-django,lafranceinsoumise/api-django | from rest_framework import serializers
from agir.events.serializers import EventSerializer
from agir.groups.serializers import SupportGroupSerializer
from agir.lib.serializers import FlexibleFieldsMixin
from agir.people.serializers import PersonSerializer
class ActivitySerializer(FlexibleFieldsMixin, serializers.Ser... | Add individual email field to activity serializer
from rest_framework import serializers
from agir.events.serializers import EventSerializer
from agir.groups.serializers import SupportGroupSerializer
from agir.lib.serializers import FlexibleFieldsMixin
from agir.people.serializers import PersonSerializer
class Acti... |
098044c80fff2ff639da088f87f7fc6952813fc1 | txircd/channel.py | txircd/channel.py | from txircd.utils import CaseInsensitiveDictionary, now()
class IRCChannel(object):
def __init__(self, ircd, name):
self.ircd = ircd
self.name = name
self.created = now()
self.topic = ""
self.topicSetter = ""
self.topicTime = now()
self.mode = {}
self.users = CaseInsensitiveDictionary()
self.metadat... | from txircd.utils import CaseInsensitiveDictionary, now()
class IRCChannel(object):
def __init__(self, ircd, name):
self.ircd = ircd
self.name = name
self.created = now()
self.topic = ""
self.topicSetter = ""
self.topicTime = now()
self.mode = {}
self.users = CaseInsensitiveDictionary()
self.metadat... | Change how mode strings are constructed | Change how mode strings are constructed
| Python | bsd-3-clause | DesertBus/txircd,Heufneutje/txircd,ElementalAlchemist/txircd | from txircd.utils import CaseInsensitiveDictionary, now()
class IRCChannel(object):
def __init__(self, ircd, name):
self.ircd = ircd
self.name = name
self.created = now()
self.topic = ""
self.topicSetter = ""
self.topicTime = now()
self.mode = {}
self.users = CaseInsensitiveDictionary()
self.metadat... | Change how mode strings are constructed
from txircd.utils import CaseInsensitiveDictionary, now()
class IRCChannel(object):
def __init__(self, ircd, name):
self.ircd = ircd
self.name = name
self.created = now()
self.topic = ""
self.topicSetter = ""
self.topicTime = now()
self.mode = {}
self.users = C... |
5e8218a2fb5b0c63df4394e299ad75fec2494b29 | setup.py | setup.py | import os
from setuptools import setup
from withtool import __version__
def read(fname):
path = os.path.join(os.path.dirname(__file__), fname)
with open(path, encoding='utf-8') as f:
return f.read()
setup(
name='with',
version=__version__,
description='A shell context manager',
lon... | import os
from setuptools import setup
from withtool import __version__
def read(fname):
path = os.path.join(os.path.dirname(__file__), fname)
with open(path, encoding='utf-8') as f:
return f.read()
setup(
name='with',
version=__version__,
description='A shell context manager',
lon... | Upgrade dependency python-slugify to ==1.2.2 | Upgrade dependency python-slugify to ==1.2.2
| Python | mit | renanivo/with | import os
from setuptools import setup
from withtool import __version__
def read(fname):
path = os.path.join(os.path.dirname(__file__), fname)
with open(path, encoding='utf-8') as f:
return f.read()
setup(
name='with',
version=__version__,
description='A shell context manager',
lon... | Upgrade dependency python-slugify to ==1.2.2
import os
from setuptools import setup
from withtool import __version__
def read(fname):
path = os.path.join(os.path.dirname(__file__), fname)
with open(path, encoding='utf-8') as f:
return f.read()
setup(
name='with',
version=__version__,
... |
99ab527550b91d17342ef3112e35f3cdb1be9867 | src/binsearch.py | src/binsearch.py | """
Binary search
"""
def binary_search0(xs, x):
"""
Perform binary search for a specific value in the given sorted list
:param xs: a sorted list
:param x: the target value
:return: an index if the value was found, or None if not
"""
lft, rgt = 0, len(xs) - 1
while lft <= rgt:
... | """
Binary search
"""
def binary_search0(xs, x):
"""
Perform binary search for a specific value in the given sorted list
:param xs: a sorted list
:param x: the target value
:return: an index if the value was found, or None if not
"""
lft, rgt = 0, len(xs) - 1
while lft <= rgt:
... | Fix the "no else after return" lint | Fix the "no else after return" lint
| Python | mit | all3fox/algos-py | """
Binary search
"""
def binary_search0(xs, x):
"""
Perform binary search for a specific value in the given sorted list
:param xs: a sorted list
:param x: the target value
:return: an index if the value was found, or None if not
"""
lft, rgt = 0, len(xs) - 1
while lft <= rgt:
... | Fix the "no else after return" lint
"""
Binary search
"""
def binary_search0(xs, x):
"""
Perform binary search for a specific value in the given sorted list
:param xs: a sorted list
:param x: the target value
:return: an index if the value was found, or None if not
"""
lft, rgt = 0, len(... |
effc09edd607d7975a01b3652b4932e40fb0f7f9 | bin/combine-examples.py | bin/combine-examples.py | #!/usr/bin/python
import re
import sys
def main(argv):
examples = {}
requires = set()
for filename in argv[1:]:
lines = open(filename).readlines()
if len(lines) > 0 and lines[0].startswith('// NOCOMPILE'):
continue
requires.update(line for line in lines if line.startsw... | Add script to combine examples | Add script to combine examples
| Python | bsd-2-clause | kkuunnddaannkk/ol3,landonb/ol3,pmlrsg/ol3,tamarmot/ol3,elemoine/ol3,alexbrault/ol3,Distem/ol3,t27/ol3,Andrey-Pavlov/ol3,bogdanvaduva/ol3,fblackburn/ol3,jacmendt/ol3,bogdanvaduva/ol3,ahocevar/ol3,Distem/ol3,thhomas/ol3,jmiller-boundless/ol3,klokantech/ol3raster,geekdenz/openlayers,stweil/openlayers,antonio83moura/ol3,al... | #!/usr/bin/python
import re
import sys
def main(argv):
examples = {}
requires = set()
for filename in argv[1:]:
lines = open(filename).readlines()
if len(lines) > 0 and lines[0].startswith('// NOCOMPILE'):
continue
requires.update(line for line in lines if line.startsw... | Add script to combine examples
| |
fa09d3b526bdf04dcabda603ef1e0adac8ae68bd | setup.py | setup.py | from setuptools import setup
setup(
name='python-binary-memcached',
version='0.24.6',
author='Jayson Reis',
author_email='santosdosreis@gmail.com',
description='A pure python module to access memcached via it\'s binary protocol with SASL auth support',
url='https://github.com/jaysonsantos/python... | from setuptools import setup
setup(
name='python-binary-memcached',
version='0.24.6',
author='Jayson Reis',
author_email='santosdosreis@gmail.com',
description='A pure python module to access memcached via its binary protocol with SASL auth support',
url='https://github.com/jaysonsantos/python-b... | Fix a typo in description: it's => its | Fix a typo in description: it's => its | Python | mit | jaysonsantos/python-binary-memcached,jaysonsantos/python-binary-memcached | from setuptools import setup
setup(
name='python-binary-memcached',
version='0.24.6',
author='Jayson Reis',
author_email='santosdosreis@gmail.com',
description='A pure python module to access memcached via its binary protocol with SASL auth support',
url='https://github.com/jaysonsantos/python-b... | Fix a typo in description: it's => its
from setuptools import setup
setup(
name='python-binary-memcached',
version='0.24.6',
author='Jayson Reis',
author_email='santosdosreis@gmail.com',
description='A pure python module to access memcached via it\'s binary protocol with SASL auth support',
url=... |
d0a2f82686158f6610ec5f57f586598be7569c6d | students/psbriant/final_project/clean_data.py | students/psbriant/final_project/clean_data.py | """
Name: Paul Briant
Date: 12/11/16
Class: Introduction to Python
Assignment: Final Project
Description:
Code for Final Project
"""
import pandas
from datetime import datetime
# Change source to smaller file.
data = pandas.read_csv("data/Residential_Water_Usage_Zip_Code_on_Top.csv")
print(data["Date Text"].head())... | """
Name: Paul Briant
Date: 12/11/16
Class: Introduction to Python
Assignment: Final Project
Description:
Code for Final Project
"""
import pandas
from datetime import datetime
# Change source to smaller file.
data = pandas.read_csv("data/Residential_Water_Usage_Zip_Code_on_Top.csv")
print(data["Date Text"].head())... | Comment out code to test first_date variable. | Comment out code to test first_date variable.
| Python | unlicense | UWPCE-PythonCert/IntroPython2016,weidnem/IntroPython2016,weidnem/IntroPython2016,UWPCE-PythonCert/IntroPython2016,UWPCE-PythonCert/IntroPython2016,weidnem/IntroPython2016 | """
Name: Paul Briant
Date: 12/11/16
Class: Introduction to Python
Assignment: Final Project
Description:
Code for Final Project
"""
import pandas
from datetime import datetime
# Change source to smaller file.
data = pandas.read_csv("data/Residential_Water_Usage_Zip_Code_on_Top.csv")
print(data["Date Text"].head())... | Comment out code to test first_date variable.
"""
Name: Paul Briant
Date: 12/11/16
Class: Introduction to Python
Assignment: Final Project
Description:
Code for Final Project
"""
import pandas
from datetime import datetime
# Change source to smaller file.
data = pandas.read_csv("data/Residential_Water_Usage_Zip_Cod... |
ff3e0eb9d38d2cbed1fab7b67a374915bf65b8f5 | engine/logger.py | engine/logger.py | #
# dp for Tornado
# YoungYong Park (youngyongpark@gmail.com)
# 2014.10.23
#
from .singleton import Singleton
class Logger(object, metaclass=Singleton):
def exception(self, e=None):
pass | #
# dp for Tornado
# YoungYong Park (youngyongpark@gmail.com)
# 2014.10.23
#
import logging
from .singleton import Singleton
class Logger(object, metaclass=Singleton):
def exception(self, msg, *args, **kwargs):
logging.exception(msg, *args, **kwargs)
def error(self, msg, *args, **kwargs):
... | Add logging helper. (exception, error, warning, info, debug) | Add logging helper. (exception, error, warning, info, debug)
| Python | mit | why2pac/dp-tornado,why2pac/dp-tornado,why2pac/dp-tornado,why2pac/dp-tornado | #
# dp for Tornado
# YoungYong Park (youngyongpark@gmail.com)
# 2014.10.23
#
import logging
from .singleton import Singleton
class Logger(object, metaclass=Singleton):
def exception(self, msg, *args, **kwargs):
logging.exception(msg, *args, **kwargs)
def error(self, msg, *args, **kwargs):
... | Add logging helper. (exception, error, warning, info, debug)
#
# dp for Tornado
# YoungYong Park (youngyongpark@gmail.com)
# 2014.10.23
#
from .singleton import Singleton
class Logger(object, metaclass=Singleton):
def exception(self, e=None):
pass |
f623775309c75cd0742b03df4ff4759efee4470d | Code/Python/Kamaelia/Test/Internet/test_MulticastTransceiverSystem.py | Code/Python/Kamaelia/Test/Internet/test_MulticastTransceiverSystem.py | #!/usr/bin/python
#
# Basic acceptance test harness for the Multicast_sender and receiver
# components.
#
import socket
import Axon
def tests():
from Axon.Scheduler import scheduler
from Kamaelia.Util.ConsoleEcho import consoleEchoer
from Kamaelia.Util.Chargen import Chargen
from Kamaelia.Internet.Multic... | Test harness for the multicast transceiver. | Test harness for the multicast transceiver.
Michael.
| Python | apache-2.0 | sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia | #!/usr/bin/python
#
# Basic acceptance test harness for the Multicast_sender and receiver
# components.
#
import socket
import Axon
def tests():
from Axon.Scheduler import scheduler
from Kamaelia.Util.ConsoleEcho import consoleEchoer
from Kamaelia.Util.Chargen import Chargen
from Kamaelia.Internet.Multic... | Test harness for the multicast transceiver.
Michael.
| |
532b0809b040318abbb8e62848f18ad0cdf72547 | src/workspace/workspace_managers.py | src/workspace/workspace_managers.py | from workspace.models import GroupPublishedWorkspace, PublishedWorkSpace, WorkSpace
def ref_from_workspace(workspace):
if isinstance(workspace, WorkSpace):
return 'group/' + str(workspace.id)
elif isinstance(workspace, PublishedWorkSpace):
return 'group_published/' + str(workspace.id)
class... | from workspace.models import GroupPublishedWorkspace, PublishedWorkSpace, WorkSpace
def ref_from_workspace(workspace):
if isinstance(workspace, WorkSpace):
return 'group/' + str(workspace.id)
elif isinstance(workspace, PublishedWorkSpace):
return 'group_published/' + str(workspace.id)
class... | Make OrganizationWorkspaceManager ignore the original workspace when sharing workspaces with groups | Make OrganizationWorkspaceManager ignore the original workspace when sharing workspaces with groups
| Python | agpl-3.0 | rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud | from workspace.models import GroupPublishedWorkspace, PublishedWorkSpace, WorkSpace
def ref_from_workspace(workspace):
if isinstance(workspace, WorkSpace):
return 'group/' + str(workspace.id)
elif isinstance(workspace, PublishedWorkSpace):
return 'group_published/' + str(workspace.id)
class... | Make OrganizationWorkspaceManager ignore the original workspace when sharing workspaces with groups
from workspace.models import GroupPublishedWorkspace, PublishedWorkSpace, WorkSpace
def ref_from_workspace(workspace):
if isinstance(workspace, WorkSpace):
return 'group/' + str(workspace.id)
elif isi... |
f3f363e8911d3a635d68c7dbe767ee2585ed4f36 | checkDuplicates.py | checkDuplicates.py | import pandas as pd
from astropy import coordinates as coord
from astropy import units as u
class Sweetcat:
"""Load SWEET-Cat database"""
def __init__(self):
self.fname_sc = 'WEBSITE_online_EU-NASA_full_database.rdb'
# Loading the SweetCat database
self.readSC()
def read... | Check for duplicates based on coordinates and select only one database (EU/NASA) | Check for duplicates based on coordinates and select only one database (EU/NASA)
| Python | mit | DanielAndreasen/SWEET-Cat | import pandas as pd
from astropy import coordinates as coord
from astropy import units as u
class Sweetcat:
"""Load SWEET-Cat database"""
def __init__(self):
self.fname_sc = 'WEBSITE_online_EU-NASA_full_database.rdb'
# Loading the SweetCat database
self.readSC()
def read... | Check for duplicates based on coordinates and select only one database (EU/NASA)
| |
b2c51babee88a53704219cb4c2a639c8e71ad621 | tests/functions_tests/test_copy.py | tests/functions_tests/test_copy.py | import unittest
import numpy
import chainer
from chainer import functions
from chainer import gradient_check
class Copy(unittest.TestCase):
def setUp(self):
self.x_data = numpy.random.uniform(
-1, 1, (10, 5)).astype(numpy.float32)
self.gy = numpy.random.uniform(-1, 1, (10, 5)).astyp... | Add unittest for Copy function | Add unittest for Copy function
| Python | mit | tscohen/chainer,okuta/chainer,tkerola/chainer,keisuke-umezawa/chainer,sou81821/chainer,ktnyt/chainer,aonotas/chainer,truongdq/chainer,jnishi/chainer,keisuke-umezawa/chainer,hvy/chainer,kiyukuta/chainer,keisuke-umezawa/chainer,1986ks/chainer,wkentaro/chainer,laysakura/chainer,niboshi/chainer,kuwa32/chainer,kikusu/chaine... | import unittest
import numpy
import chainer
from chainer import functions
from chainer import gradient_check
class Copy(unittest.TestCase):
def setUp(self):
self.x_data = numpy.random.uniform(
-1, 1, (10, 5)).astype(numpy.float32)
self.gy = numpy.random.uniform(-1, 1, (10, 5)).astyp... | Add unittest for Copy function
| |
33c518d34b7657549e5231aa5e5cd1a1206da1a5 | setup.py | setup.py | import os
from setuptools import setup
def get_version_from_git_most_recent_tag():
return os.popen("git tag -l v* | tail --lines=1").read().strip().lstrip("v")
def get_readme_content():
current_file_dir = os.path.dirname(__file__)
readme_file_path = os.path.join(current_file_dir, "README.md")
retur... | import os
from setuptools import setup, find_packages
def get_version_from_git_most_recent_tag():
return os.popen("git tag -l v* | tail --lines=1").read().strip().lstrip("v")
def get_readme_content():
current_file_dir = os.path.dirname(__file__)
readme_file_path = os.path.join(current_file_dir, "README... | Use find_packages() to export all packages automatically on install | Use find_packages() to export all packages automatically on install
| Python | agpl-3.0 | alvarogzp/telegram-bot,alvarogzp/telegram-bot | import os
from setuptools import setup, find_packages
def get_version_from_git_most_recent_tag():
return os.popen("git tag -l v* | tail --lines=1").read().strip().lstrip("v")
def get_readme_content():
current_file_dir = os.path.dirname(__file__)
readme_file_path = os.path.join(current_file_dir, "README... | Use find_packages() to export all packages automatically on install
import os
from setuptools import setup
def get_version_from_git_most_recent_tag():
return os.popen("git tag -l v* | tail --lines=1").read().strip().lstrip("v")
def get_readme_content():
current_file_dir = os.path.dirname(__file__)
rea... |
1be9c51d4029c0fa32f7071072c171db42d21c83 | doc-src/index.py | doc-src/index.py | import countershape
from countershape import Page, Directory, PythonModule
import countershape.grok
this.layout = countershape.Layout("_layout.html")
this.markdown = "rst"
ns.docTitle = "Countershape Manual"
ns.docMaintainer = "Aldo Cortesi"
ns.docMaintainerEmail = "dev@nullcube.com"
ns.copyright = "Copyright Nullcub... | import countershape
from countershape import Page, Directory, PythonModule
import countershape.grok
this.layout = countershape.Layout("_layout.html")
this.markdown = "rst"
ns.docTitle = "Countershape Manual"
ns.docMaintainer = "Aldo Cortesi"
ns.docMaintainerEmail = "dev@nullcube.com"
ns.copyright = "Copyright Nullcub... | Move structure to a separate directory | Move structure to a separate directory
| Python | mit | mhils/countershape,cortesi/countershape,samtaufa/countershape,mhils/countershape,cortesi/countershape,samtaufa/countershape | import countershape
from countershape import Page, Directory, PythonModule
import countershape.grok
this.layout = countershape.Layout("_layout.html")
this.markdown = "rst"
ns.docTitle = "Countershape Manual"
ns.docMaintainer = "Aldo Cortesi"
ns.docMaintainerEmail = "dev@nullcube.com"
ns.copyright = "Copyright Nullcub... | Move structure to a separate directory
import countershape
from countershape import Page, Directory, PythonModule
import countershape.grok
this.layout = countershape.Layout("_layout.html")
this.markdown = "rst"
ns.docTitle = "Countershape Manual"
ns.docMaintainer = "Aldo Cortesi"
ns.docMaintainerEmail = "dev@nullcub... |
b0edec6bc9a4d77a1f0ea0f803ea892f35cc2f4f | text_field.py | text_field.py | # Created On: 2012/01/23
# Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
class TextFi... | # Created On: 2012/01/23
# Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
class TextFi... | Make TextField also work with a QLabel view, which doesn't allow editing. | Make TextField also work with a QLabel view, which doesn't allow editing.
| Python | bsd-3-clause | hsoft/qtlib | # Created On: 2012/01/23
# Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
class TextFi... | Make TextField also work with a QLabel view, which doesn't allow editing.
# Created On: 2012/01/23
# Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also ... |
f4510b9b6402ddbe2412eb5524c7a44eb6bc966d | setup.py | setup.py | #!/usr/bin/env python
# coding: utf8
# Copyright 2014-2015 Vincent Jacques <vincent@vincent-jacques.net>
import contextlib
import os
import setuptools
import setuptools.command.test
version = "0.2.1"
setuptools.setup(
name="LowVoltage",
version=version,
description="Standalone DynamoDB client not hidi... | #!/usr/bin/env python
# coding: utf8
# Copyright 2014-2015 Vincent Jacques <vincent@vincent-jacques.net>
import contextlib
import os
import setuptools
import setuptools.command.test
version = "0.2.3"
setuptools.setup(
name="LowVoltage",
version=version,
description="Standalone DynamoDB client not hidi... | Fix version (0.2.2 never made it to PyPI) | Fix version (0.2.2 never made it to PyPI)
| Python | mit | jacquev6/LowVoltage,jacquev6/LowVoltage | #!/usr/bin/env python
# coding: utf8
# Copyright 2014-2015 Vincent Jacques <vincent@vincent-jacques.net>
import contextlib
import os
import setuptools
import setuptools.command.test
version = "0.2.3"
setuptools.setup(
name="LowVoltage",
version=version,
description="Standalone DynamoDB client not hidi... | Fix version (0.2.2 never made it to PyPI)
#!/usr/bin/env python
# coding: utf8
# Copyright 2014-2015 Vincent Jacques <vincent@vincent-jacques.net>
import contextlib
import os
import setuptools
import setuptools.command.test
version = "0.2.1"
setuptools.setup(
name="LowVoltage",
version=version,
descr... |
3aacfd7147836ef95133aa88d558a1d69bbcd0cd | mopidy/exceptions.py | mopidy/exceptions.py | from __future__ import absolute_import, unicode_literals
class MopidyException(Exception):
def __init__(self, message, *args, **kwargs):
super(MopidyException, self).__init__(message, *args, **kwargs)
self._message = message
@property
def message(self):
"""Reimplement message fie... | from __future__ import absolute_import, unicode_literals
class MopidyException(Exception):
def __init__(self, message, *args, **kwargs):
super(MopidyException, self).__init__(message, *args, **kwargs)
self._message = message
@property
def message(self):
"""Reimplement message fie... | Fix typo in new CoreErrors | exception: Fix typo in new CoreErrors
| Python | apache-2.0 | mopidy/mopidy,hkariti/mopidy,tkem/mopidy,bacontext/mopidy,swak/mopidy,mokieyue/mopidy,ZenithDK/mopidy,ali/mopidy,mokieyue/mopidy,bencevans/mopidy,jcass77/mopidy,bencevans/mopidy,bacontext/mopidy,diandiankan/mopidy,hkariti/mopidy,dbrgn/mopidy,ZenithDK/mopidy,bacontext/mopidy,mopidy/mopidy,pacificIT/mopidy,SuperStarPL/mo... | from __future__ import absolute_import, unicode_literals
class MopidyException(Exception):
def __init__(self, message, *args, **kwargs):
super(MopidyException, self).__init__(message, *args, **kwargs)
self._message = message
@property
def message(self):
"""Reimplement message fie... | exception: Fix typo in new CoreErrors
from __future__ import absolute_import, unicode_literals
class MopidyException(Exception):
def __init__(self, message, *args, **kwargs):
super(MopidyException, self).__init__(message, *args, **kwargs)
self._message = message
@property
def message(se... |
4ebdd73bab19e83d52e03ac4afb7e1b3f78004f5 | drftutorial/catalog/views.py | drftutorial/catalog/views.py | from django.http import HttpResponse
from django.http import Http404
from rest_framework import generics
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import status
from .permissions import IsAdminOrReadOnly
from .models import Product
from .serializers import... | from rest_framework import generics
from .permissions import IsAdminOrReadOnly
from .models import Product
from .serializers import ProductSerializer
class ProductList(generics.ListCreateAPIView):
queryset = Product.objects.all()
serializer_class = ProductSerializer
permission_classes = (IsAdminOrReadOnly... | Implement ProductDetail with a generic RetrieveUpdateDestroyAPIView class | Implement ProductDetail with a generic RetrieveUpdateDestroyAPIView class
| Python | mit | andreagrandi/drf-tutorial | from rest_framework import generics
from .permissions import IsAdminOrReadOnly
from .models import Product
from .serializers import ProductSerializer
class ProductList(generics.ListCreateAPIView):
queryset = Product.objects.all()
serializer_class = ProductSerializer
permission_classes = (IsAdminOrReadOnly... | Implement ProductDetail with a generic RetrieveUpdateDestroyAPIView class
from django.http import HttpResponse
from django.http import Http404
from rest_framework import generics
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import status
from .permissions im... |
1b0a5388c246dba1707f768e9be08b3a63503a31 | samples/python/topology/tweepy/app.py | samples/python/topology/tweepy/app.py | from streamsx.topology.topology import *
import streamsx.topology.context
import sys
import tweets
#
# Continually stream tweets that contain
# the terms passed on the command line.
#
# python3 app.py Food GlutenFree
#
def main():
terms = sys.argv[1:]
topo = Topology("TweetsUsingTweepy")
# Event based source st... | from streamsx.topology.topology import *
import streamsx.topology.context
import sys
import tweets
#
# Continually stream tweets that contain
# the terms passed on the command line.
#
# python3 app.py Food GlutenFree
#
#
# Requires tweepy to be installed
#
# pip3 install tweepy
#
# http://www.tweepy.org/
#
# You must ... | Add some info about tweepy | Add some info about tweepy
| Python | apache-2.0 | IBMStreams/streamsx.topology,ddebrunner/streamsx.topology,wmarshall484/streamsx.topology,wmarshall484/streamsx.topology,ddebrunner/streamsx.topology,wmarshall484/streamsx.topology,IBMStreams/streamsx.topology,IBMStreams/streamsx.topology,ibmkendrick/streamsx.topology,ddebrunner/streamsx.topology,ibmkendrick/streamsx.to... | from streamsx.topology.topology import *
import streamsx.topology.context
import sys
import tweets
#
# Continually stream tweets that contain
# the terms passed on the command line.
#
# python3 app.py Food GlutenFree
#
#
# Requires tweepy to be installed
#
# pip3 install tweepy
#
# http://www.tweepy.org/
#
# You must ... | Add some info about tweepy
from streamsx.topology.topology import *
import streamsx.topology.context
import sys
import tweets
#
# Continually stream tweets that contain
# the terms passed on the command line.
#
# python3 app.py Food GlutenFree
#
def main():
terms = sys.argv[1:]
topo = Topology("TweetsUsingTweepy"... |
50f3233a8560120cc0c55b02849f1b586cf1aa27 | languages_plus/utils.py | languages_plus/utils.py | from django.core.exceptions import ObjectDoesNotExist
from countries_plus.models import Country
from .models import Language, CultureCode
def associate_countries_and_languages():
for country in Country.objects.all():
langs = country.languages.strip(',')
if langs:
codes = langs.split("... | from django.core.exceptions import ObjectDoesNotExist
from countries_plus.models import Country
from .models import Language, CultureCode
def associate_countries_and_languages():
for country in Country.objects.all():
langs = ''
try:
langs = country.languages.strip(',')
if lang... | Fix a crash if a country has no languages spoken | Fix a crash if a country has no languages spoken
| Python | mit | cordery/django-languages-plus | from django.core.exceptions import ObjectDoesNotExist
from countries_plus.models import Country
from .models import Language, CultureCode
def associate_countries_and_languages():
for country in Country.objects.all():
langs = ''
try:
langs = country.languages.strip(',')
if lang... | Fix a crash if a country has no languages spoken
from django.core.exceptions import ObjectDoesNotExist
from countries_plus.models import Country
from .models import Language, CultureCode
def associate_countries_and_languages():
for country in Country.objects.all():
langs = country.languages.strip(',')
... |
0ac671d554f322524741a795f4a3250ef705f872 | server/ec2spotmanager/migrations/0010_extend_instance_types.py | server/ec2spotmanager/migrations/0010_extend_instance_types.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-08-24 14:55
from __future__ import unicode_literals
from django.db import migrations, models
import ec2spotmanager.models
class Migration(migrations.Migration):
dependencies = [
('ec2spotmanager', '0009_add_instance_size'),
]
operati... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-08-24 14:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ec2spotmanager', '0009_add_instance_size'),
]
operations = [
migrations.Al... | Fix Flake8 error in migration. | Fix Flake8 error in migration.
| Python | mpl-2.0 | MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-08-24 14:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ec2spotmanager', '0009_add_instance_size'),
]
operations = [
migrations.Al... | Fix Flake8 error in migration.
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-08-24 14:55
from __future__ import unicode_literals
from django.db import migrations, models
import ec2spotmanager.models
class Migration(migrations.Migration):
dependencies = [
('ec2spotmanager', '0009_add_ins... |
1d95063d1416f82115fa26d72d548ada0616e239 | gensabenchmarks/go_func_utils.py | gensabenchmarks/go_func_utils.py | import sys
import contextlib
import inspect
import gensabenchmarks.go_benchmark_functions as gbf
def goclass():
"""
Generator to get global optimization test classes/functions
defined in SciPy
"""
bench_members = inspect.getmembers(gbf, inspect.isclass)
benchmark_functions = [item for item in b... | Fix import with full path | Fix import with full path
| Python | bsd-2-clause | sgubianpm/gensabench,sgubianpm/gensabench,sgubianpm/pygensa,sgubianpm/HyGSA,sgubianpm/pygensa,sgubianpm/HyGSA | import sys
import contextlib
import inspect
import gensabenchmarks.go_benchmark_functions as gbf
def goclass():
"""
Generator to get global optimization test classes/functions
defined in SciPy
"""
bench_members = inspect.getmembers(gbf, inspect.isclass)
benchmark_functions = [item for item in b... | Fix import with full path
| |
0fd464dcd405faa356c18d69a0b7419c5cff0f21 | pmxbot/__init__.py | pmxbot/__init__.py | # -*- coding: utf-8 -*-
# vim:ts=4:sw=4:noexpandtab
import importlib
from .dictlib import ConfigDict
config = ConfigDict(
bot_nickname = 'pmxbot',
database = 'sqlite:pmxbot.sqlite',
server_host = 'irc.freenode.net',
server_port = 6667,
use_ssl = False,
password = None,
silent_bot = False,
log_channels = [],
... | # -*- coding: utf-8 -*-
# vim:ts=4:sw=4:noexpandtab
import importlib
from .dictlib import ConfigDict
config = ConfigDict(
bot_nickname = 'pmxbot',
database = 'sqlite:pmxbot.sqlite',
server_host = 'localhost',
server_port = 6667,
use_ssl = False,
password = None,
silent_bot = False,
log_channels = [],
other_... | Use IRC server on localhost by default | Use IRC server on localhost by default
| Python | bsd-3-clause | jamwt/diesel-pmxbot,jamwt/diesel-pmxbot | # -*- coding: utf-8 -*-
# vim:ts=4:sw=4:noexpandtab
import importlib
from .dictlib import ConfigDict
config = ConfigDict(
bot_nickname = 'pmxbot',
database = 'sqlite:pmxbot.sqlite',
server_host = 'localhost',
server_port = 6667,
use_ssl = False,
password = None,
silent_bot = False,
log_channels = [],
other_... | Use IRC server on localhost by default
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:noexpandtab
import importlib
from .dictlib import ConfigDict
config = ConfigDict(
bot_nickname = 'pmxbot',
database = 'sqlite:pmxbot.sqlite',
server_host = 'irc.freenode.net',
server_port = 6667,
use_ssl = False,
password = None,
... |
cc929731dbbf51e00d748aa6cc335d4cd8bb705b | soco/__init__.py | soco/__init__.py | """SoCo (Sonos Controller) is a simple library to control Sonos speakers."""
# There is no need for all strings here to be unicode, and Py2 cannot import
# modules with unicode names so do not use from __future__ import
# unicode_literals
# https://github.com/SoCo/SoCo/issues/98
#
import logging
from .core import S... | """SoCo (Sonos Controller) is a simple library to control Sonos speakers."""
# There is no need for all strings here to be unicode, and Py2 cannot import
# modules with unicode names so do not use from __future__ import
# unicode_literals
# https://github.com/SoCo/SoCo/issues/98
#
import logging
from .core import S... | Set up for v0.23 development | Set up for v0.23 development
| Python | mit | SoCo/SoCo,SoCo/SoCo | """SoCo (Sonos Controller) is a simple library to control Sonos speakers."""
# There is no need for all strings here to be unicode, and Py2 cannot import
# modules with unicode names so do not use from __future__ import
# unicode_literals
# https://github.com/SoCo/SoCo/issues/98
#
import logging
from .core import S... | Set up for v0.23 development
"""SoCo (Sonos Controller) is a simple library to control Sonos speakers."""
# There is no need for all strings here to be unicode, and Py2 cannot import
# modules with unicode names so do not use from __future__ import
# unicode_literals
# https://github.com/SoCo/SoCo/issues/98
#
impor... |
b0261ec4757167cb3d5bf8ab3ded0273eb9477de | txircd/modules/umode_s.py | txircd/modules/umode_s.py | from txircd.modbase import Mode
class ServerNoticeMode(Mode):
pass
class Spawner(object):
def __init__(self, ircd):
self.ircd = ircd
def spawn(self):
return {
"modes": {
"uns": ServerNoticeMode()
}
}
def cleanup(self):
self.ircd.removeMode("uns") | Implement usermode +s (currently doesn't do anything) | Implement usermode +s (currently doesn't do anything)
| Python | bsd-3-clause | ElementalAlchemist/txircd,DesertBus/txircd,Heufneutje/txircd | from txircd.modbase import Mode
class ServerNoticeMode(Mode):
pass
class Spawner(object):
def __init__(self, ircd):
self.ircd = ircd
def spawn(self):
return {
"modes": {
"uns": ServerNoticeMode()
}
}
def cleanup(self):
self.ircd.removeMode("uns") | Implement usermode +s (currently doesn't do anything)
| |
7e5d8eb0d6eabb427d7e9bd02bac3ee7b90d228d | src/config.py | src/config.py |
import urllib
import urllib.request
proxies = [
False,
False
] |
import urllib
import urllib.request
from pprint import pprint
proxies = [
'',
''
]
_tested_proxies = False
def test_proxies():
global _tested_proxies
if _tested_proxies:
return
_tested_proxies = {}
def _testproxy(proxyid):
if proxyid=='':
return True
if _tested_proxies.get(proxyid) is not No... | Test proxies before using them. | Test proxies before using them.
| Python | mit | koivunen/whoisabusetool |
import urllib
import urllib.request
from pprint import pprint
proxies = [
'',
''
]
_tested_proxies = False
def test_proxies():
global _tested_proxies
if _tested_proxies:
return
_tested_proxies = {}
def _testproxy(proxyid):
if proxyid=='':
return True
if _tested_proxies.get(proxyid) is not No... | Test proxies before using them.
import urllib
import urllib.request
proxies = [
False,
False
] |
41236c2be66b6f790308cba321cb482807814323 | ubersmith/calls/device.py | ubersmith/calls/device.py | """Device call classes.
These classes implement any response cleaning and validation needed. If a
call class isn't defined for a given method then one is created using
ubersmith.calls.BaseCall.
"""
from ubersmith.calls import BaseCall, GroupCall
from ubersmith.utils import prepend_base
__all__ = [
'GetCall',
... | """Device call classes.
These classes implement any response cleaning and validation needed. If a
call class isn't defined for a given method then one is created using
ubersmith.calls.BaseCall.
"""
from ubersmith.calls import BaseCall, GroupCall
from ubersmith.utils import prepend_base
__all__ = [
'GetCall',
... | Make module graph call return a file. | Make module graph call return a file.
| Python | mit | jasonkeene/python-ubersmith,jasonkeene/python-ubersmith,hivelocity/python-ubersmith,hivelocity/python-ubersmith | """Device call classes.
These classes implement any response cleaning and validation needed. If a
call class isn't defined for a given method then one is created using
ubersmith.calls.BaseCall.
"""
from ubersmith.calls import BaseCall, GroupCall
from ubersmith.utils import prepend_base
__all__ = [
'GetCall',
... | Make module graph call return a file.
"""Device call classes.
These classes implement any response cleaning and validation needed. If a
call class isn't defined for a given method then one is created using
ubersmith.calls.BaseCall.
"""
from ubersmith.calls import BaseCall, GroupCall
from ubersmith.utils import pre... |
4a5e798fe23d720315a7cab60824b70ce0983f8e | Kane1985/Chapter2/Ex4.1.py | Kane1985/Chapter2/Ex4.1.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 4.1 from Kane 1985"""
from sympy.physics.mechanics import dot, dynamicsymbols, MechanicsStrPrinter
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy import solve, symbols, pi
from sympy.simplify.simplify import trigsimp
def msprint(expr):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 4.1 from Kane 1985"""
from sympy.physics.mechanics import dot, dynamicsymbols, MechanicsStrPrinter
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy import solve, symbols, pi, sin, cos
from sympy.simplify.simplify import trigsimp
def msprint... | Simplify formulation and change from print() to assert() | Simplify formulation and change from print() to assert()
| Python | bsd-3-clause | jcrist/pydy,Shekharrajak/pydy,oliverlee/pydy,jcrist/pydy,jcrist/pydy,oliverlee/pydy,jcrist/pydy,Shekharrajak/pydy,oliverlee/pydy,jcrist/pydy,Shekharrajak/pydy,jcrist/pydy,skidzo/pydy,Shekharrajak/pydy,skidzo/pydy,skidzo/pydy,jcrist/pydy,skidzo/pydy | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 4.1 from Kane 1985"""
from sympy.physics.mechanics import dot, dynamicsymbols, MechanicsStrPrinter
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy import solve, symbols, pi, sin, cos
from sympy.simplify.simplify import trigsimp
def msprint... | Simplify formulation and change from print() to assert()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 4.1 from Kane 1985"""
from sympy.physics.mechanics import dot, dynamicsymbols, MechanicsStrPrinter
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy import solve, symbols, pi
from symp... |
d0fb38da0200c1b780e296d6c5767438e2f82dc8 | array/sudoku-check.py | array/sudoku-check.py | # Implement an algorithm that will check whether a given grid of numbers represents a valid Sudoku puzzle
def check_rows(grid):
i = 0
while i < len(grid):
j = 0
ref_check = {}
while j < len(grid[i]):
if grid[i][j] != '.' and grid[i][j] in ref_check:
return False
else:
ref_check[grid[i][j]] = 1
... | # Implement an algorithm that will check whether a given grid of numbers represents a valid Sudoku puzzle
def check_rows(grid):
i = 0
while i < len(grid):
j = 0
ref_check = {}
while j < len(grid[i]):
if grid[i][j] != '.' and grid[i][j] in ref_check:
return False
else:
ref_check[grid[i][j]] = 1
... | Add check sub grid method | Add check sub grid method
| Python | mit | derekmpham/interview-prep,derekmpham/interview-prep | # Implement an algorithm that will check whether a given grid of numbers represents a valid Sudoku puzzle
def check_rows(grid):
i = 0
while i < len(grid):
j = 0
ref_check = {}
while j < len(grid[i]):
if grid[i][j] != '.' and grid[i][j] in ref_check:
return False
else:
ref_check[grid[i][j]] = 1
... | Add check sub grid method
# Implement an algorithm that will check whether a given grid of numbers represents a valid Sudoku puzzle
def check_rows(grid):
i = 0
while i < len(grid):
j = 0
ref_check = {}
while j < len(grid[i]):
if grid[i][j] != '.' and grid[i][j] in ref_check:
return False
else:
r... |
353728aba17695396c6167543e74181f9f853fdc | examples/template_render.py | examples/template_render.py | import django.template.loader
import django.conf
import sys
sys.path.append('django_test')
django.conf.settings.configure(INSTALLED_APPS=(), TEMPLATE_DIRS=('.', 'examples',))
for x in range(0,100):
django.template.loader.render_to_string('template.html')
| import django.template.loader
import django.conf
import sys, os
os.chdir(os.path.dirname(__file__))
django.conf.settings.configure(
INSTALLED_APPS=(),
TEMPLATES=[{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": ['.']
}],
)
django.setup()
for x in range(0,100):
... | Update template render example for Django 1.8+ | Update template render example for Django 1.8+
| Python | bsd-3-clause | joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument | import django.template.loader
import django.conf
import sys, os
os.chdir(os.path.dirname(__file__))
django.conf.settings.configure(
INSTALLED_APPS=(),
TEMPLATES=[{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": ['.']
}],
)
django.setup()
for x in range(0,100):
... | Update template render example for Django 1.8+
import django.template.loader
import django.conf
import sys
sys.path.append('django_test')
django.conf.settings.configure(INSTALLED_APPS=(), TEMPLATE_DIRS=('.', 'examples',))
for x in range(0,100):
django.template.loader.render_to_string('template.html')
|
88da3432dc0676cbe74c0d9f170fbd6f18f97f8a | examples/tornado_server.py | examples/tornado_server.py | from tornado import ioloop, web
from jsonrpcserver import method, async_dispatch as dispatch
@method
async def ping():
return "pong"
class MainHandler(web.RequestHandler):
async def post(self):
request = self.request.body.decode()
response = await dispatch(request)
print(response)
... | from tornado import ioloop, web
from jsonrpcserver import method, async_dispatch as dispatch
@method
async def ping() -> str:
return "pong"
class MainHandler(web.RequestHandler):
async def post(self) -> None:
request = self.request.body.decode()
response = await dispatch(request)
if ... | Remove unwanted print statement from example | Remove unwanted print statement from example
| Python | mit | bcb/jsonrpcserver | from tornado import ioloop, web
from jsonrpcserver import method, async_dispatch as dispatch
@method
async def ping() -> str:
return "pong"
class MainHandler(web.RequestHandler):
async def post(self) -> None:
request = self.request.body.decode()
response = await dispatch(request)
if ... | Remove unwanted print statement from example
from tornado import ioloop, web
from jsonrpcserver import method, async_dispatch as dispatch
@method
async def ping():
return "pong"
class MainHandler(web.RequestHandler):
async def post(self):
request = self.request.body.decode()
response = awai... |
92e1803a4c9e38a8672e00afbcfe0807ea808565 | examples/reading/rtf15.py | examples/reading/rtf15.py | from pyth.plugins.rtf15.reader import Rtf15Reader
from pyth.plugins.xhtml.writer import XHTMLWriter
import sys
if len(sys.argv) > 1:
filename = sys.argv[1]
else:
filename = "sample.rtf"
doc = Rtf15Reader.read(open(filename))
print XHTMLWriter.write(doc, pretty=True).read()
| from pyth.plugins.rtf15.reader import Rtf15Reader
from pyth.plugins.xhtml.writer import XHTMLWriter
import sys
if len(sys.argv) > 1:
filename = sys.argv[1]
else:
filename = "sample.rtf"
doc = Rtf15Reader.read(open(filename, "rb"))
print XHTMLWriter.write(doc, pretty=True).read()
| Make RTF reader sample open in 'rb' mode explicitly | Make RTF reader sample open in 'rb' mode explicitly
| Python | mit | kippr/pyth,kippr/pyth,prechelt/pyth,eriol/pyth,brendonh/pyth,prechelt/pyth,sheepeatingtaz/pyth,pombredanne/pyth | from pyth.plugins.rtf15.reader import Rtf15Reader
from pyth.plugins.xhtml.writer import XHTMLWriter
import sys
if len(sys.argv) > 1:
filename = sys.argv[1]
else:
filename = "sample.rtf"
doc = Rtf15Reader.read(open(filename, "rb"))
print XHTMLWriter.write(doc, pretty=True).read()
| Make RTF reader sample open in 'rb' mode explicitly
from pyth.plugins.rtf15.reader import Rtf15Reader
from pyth.plugins.xhtml.writer import XHTMLWriter
import sys
if len(sys.argv) > 1:
filename = sys.argv[1]
else:
filename = "sample.rtf"
doc = Rtf15Reader.read(open(filename))
print XHTMLWriter.write(doc, p... |
7e7817fc5a90adf7b2fa4b8947dd46a75bc6e818 | pystereovisiontoolkit.py | pystereovisiontoolkit.py | #! /usr/bin/env python
# -*- coding:utf-8 -*-
#
# Application to capture, and calibrate stereo cameras
#
#
# External dependencies
#
import argparse
import Calibration
import CvViewer
#
# Command line argument parser
#
parser = argparse.ArgumentParser( description='Camera calibration toolkit.' )
parser.add_argum... | Introduce a single program to rule them all... | Introduce a single program to rule them all...
| Python | mit | microy/VisionToolkit,microy/VisionToolkit,microy/StereoVision,microy/PyStereoVisionToolkit,microy/StereoVision,microy/PyStereoVisionToolkit | #! /usr/bin/env python
# -*- coding:utf-8 -*-
#
# Application to capture, and calibrate stereo cameras
#
#
# External dependencies
#
import argparse
import Calibration
import CvViewer
#
# Command line argument parser
#
parser = argparse.ArgumentParser( description='Camera calibration toolkit.' )
parser.add_argum... | Introduce a single program to rule them all...
| |
be1e23f068fbc34587caa0a796e259e42ed6f7c6 | utils.py | utils.py | import re
import textwrap
import html2text
text_maker = html2text.HTML2Text()
text_maker.body_width = 0
def strip_html_tags(text):
return re.sub('<[^<]+?>', '', text)
def html_to_md(string, strip_html=True, markdown=False):
if strip_html:
string = strip_html_tags(string)
if markdown:
s... | import re
import textwrap
import html2text
text_maker = html2text.HTML2Text()
text_maker.body_width = 0
def strip_html_tags(text):
return re.sub('<[^<]+?>', '', text)
def html_to_md(string, strip_html=True, markdown=False):
if not string:
return 'No Description Found'
if strip_html:
st... | Handle Nonetype values in `html_to_md` | Handle Nonetype values in `html_to_md`
| Python | mit | avinassh/Laozi,avinassh/Laozi | import re
import textwrap
import html2text
text_maker = html2text.HTML2Text()
text_maker.body_width = 0
def strip_html_tags(text):
return re.sub('<[^<]+?>', '', text)
def html_to_md(string, strip_html=True, markdown=False):
if not string:
return 'No Description Found'
if strip_html:
st... | Handle Nonetype values in `html_to_md`
import re
import textwrap
import html2text
text_maker = html2text.HTML2Text()
text_maker.body_width = 0
def strip_html_tags(text):
return re.sub('<[^<]+?>', '', text)
def html_to_md(string, strip_html=True, markdown=False):
if strip_html:
string = strip_html... |
4cb674093c95ebbe3f7dc61d0b6a262995337100 | osf/migrations/0012_auto_20170411_1548.py | osf/migrations/0012_auto_20170411_1548.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-04-05 17:30
from __future__ import unicode_literals
from django.db import migrations, models
from django.contrib.auth.models import Permission, Group
from django.contrib.contenttypes.models import ContentType
from osf.models import OSFUser
def fix_osfuser_vi... | Add proper view_osfuser permission to read_only and admin groups | Add proper view_osfuser permission to read_only and admin groups
| Python | apache-2.0 | chennan47/osf.io,adlius/osf.io,leb2dg/osf.io,binoculars/osf.io,mattclark/osf.io,icereval/osf.io,Johnetordoff/osf.io,chrisseto/osf.io,caseyrollins/osf.io,sloria/osf.io,saradbowman/osf.io,brianjgeiger/osf.io,Johnetordoff/osf.io,chennan47/osf.io,leb2dg/osf.io,Johnetordoff/osf.io,Nesiehr/osf.io,mfraezz/osf.io,HalcyonChimer... | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-04-05 17:30
from __future__ import unicode_literals
from django.db import migrations, models
from django.contrib.auth.models import Permission, Group
from django.contrib.contenttypes.models import ContentType
from osf.models import OSFUser
def fix_osfuser_vi... | Add proper view_osfuser permission to read_only and admin groups
| |
78ca15758018d52f1353b29410f97bba215e0be2 | django_afip/views.py | django_afip/views.py | from django.http import HttpResponse
from django.utils.translation import ugettext as _
from django.views.generic import View
from .pdf import generate_receipt_pdf
class ReceiptHTMLView(View):
template_name = 'django_afip/invoice.html'
def get(self, request, pk):
return HttpResponse(
gen... | from django.http import HttpResponse
from django.utils.translation import ugettext as _
from django.views.generic import View
from .pdf import generate_receipt_pdf
class ReceiptHTMLView(View):
def get(self, request, pk):
return HttpResponse(
generate_receipt_pdf(pk, request, True),
)... | Remove unused (albeit confusing) variable | Remove unused (albeit confusing) variable
See #13
| Python | isc | hobarrera/django-afip,hobarrera/django-afip | from django.http import HttpResponse
from django.utils.translation import ugettext as _
from django.views.generic import View
from .pdf import generate_receipt_pdf
class ReceiptHTMLView(View):
def get(self, request, pk):
return HttpResponse(
generate_receipt_pdf(pk, request, True),
)... | Remove unused (albeit confusing) variable
See #13
from django.http import HttpResponse
from django.utils.translation import ugettext as _
from django.views.generic import View
from .pdf import generate_receipt_pdf
class ReceiptHTMLView(View):
template_name = 'django_afip/invoice.html'
def get(self, reques... |
fdf7daf8abc4f8e1bfb8b729fd9ffc4d0c95c509 | apps/xformmanager/management/commands/generate_xforms.py | apps/xformmanager/management/commands/generate_xforms.py | """ This script generates all the necessary data to
synchronize with a remote CommCareHQ server on that server.
This is only really useful if you intend to manually
scp/rsync data to your local server, which requires a
login to the remote server. So this is not the standard
synchronization workflow (but is necessary f... | Add a command to generate xform archives on the remote server (without downloading) | Add a command to generate xform archives on the remote server
(without downloading)
| Python | bsd-3-clause | SEL-Columbia/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,puttarajubr/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,gmimano/commcaretest,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,dimag... | """ This script generates all the necessary data to
synchronize with a remote CommCareHQ server on that server.
This is only really useful if you intend to manually
scp/rsync data to your local server, which requires a
login to the remote server. So this is not the standard
synchronization workflow (but is necessary f... | Add a command to generate xform archives on the remote server
(without downloading)
| |
23501afd09b13d1e5f33bdd60614fd9ac7210108 | oratioignoreparser.py | oratioignoreparser.py | import os
import re
class OratioIgnoreParser():
def __init__(self):
self.ignored_paths = ["oratiomodule.tar.gz"]
def load(self, oratio_ignore_path):
with open(oratio_ignore_path, "r") as f:
self.ignored_paths.extend([line.strip() for line in f])
def should_be_ignored(self, fi... | import os
import re
class OratioIgnoreParser():
def __init__(self):
self.ignored_paths = ["oratiomodule.tar.gz"]
def load(self, oratio_ignore_path):
with open(oratio_ignore_path, "r") as f:
self.ignored_paths.extend([line.strip() for line in f])
def extend_list(self, ignored_... | Add extend_list method to OratioIgnoreParser | Add extend_list method to OratioIgnoreParser
To make oratioignoreparser.py easily testable using unit tests.
| Python | mit | oratio-io/oratio-cli,oratio-io/oratio-cli | import os
import re
class OratioIgnoreParser():
def __init__(self):
self.ignored_paths = ["oratiomodule.tar.gz"]
def load(self, oratio_ignore_path):
with open(oratio_ignore_path, "r") as f:
self.ignored_paths.extend([line.strip() for line in f])
def extend_list(self, ignored_... | Add extend_list method to OratioIgnoreParser
To make oratioignoreparser.py easily testable using unit tests.
import os
import re
class OratioIgnoreParser():
def __init__(self):
self.ignored_paths = ["oratiomodule.tar.gz"]
def load(self, oratio_ignore_path):
with open(oratio_ignore_path, "r"... |
cb0f732545ea851af46a7c96525d6b5b418b8673 | chatterbot/__init__.py | chatterbot/__init__.py | """
ChatterBot is a machine learning, conversational dialog engine.
"""
from .chatterbot import ChatBot
__version__ = '0.7.1'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/ChatterBot'
__all__ = (
'ChatBot',
)
| """
ChatterBot is a machine learning, conversational dialog engine.
"""
from .chatterbot import ChatBot
__version__ = '0.7.2'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/ChatterBot'
__all__ = (
'ChatBot',
)
| Update release version to 0.7.2 | Update release version to 0.7.2 | Python | bsd-3-clause | vkosuri/ChatterBot,gunthercox/ChatterBot | """
ChatterBot is a machine learning, conversational dialog engine.
"""
from .chatterbot import ChatBot
__version__ = '0.7.2'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/ChatterBot'
__all__ = (
'ChatBot',
)
| Update release version to 0.7.2
"""
ChatterBot is a machine learning, conversational dialog engine.
"""
from .chatterbot import ChatBot
__version__ = '0.7.1'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/ChatterBot'
__all__ = (
'ChatBot',
)
|
bd07980d9545de5ae82d6bdc87eab23060b0e859 | sqflint.py | sqflint.py | import sys
import argparse
from sqf.parser import parse
import sqf.analyser
from sqf.exceptions import SQFParserError
def analyze(code, writer=sys.stdout):
try:
result = parse(code)
except SQFParserError as e:
writer.write('[%d,%d]:%s\n' % (e.position[0], e.position[1] - 1, e.message))
... | import sys
import argparse
from sqf.parser import parse
import sqf.analyser
from sqf.exceptions import SQFParserError
def analyze(code, writer=sys.stdout):
try:
result = parse(code)
except SQFParserError as e:
writer.write('[%d,%d]:%s\n' % (e.position[0], e.position[1] - 1, e.message))
... | Fix parsing file - FileType already read | Fix parsing file - FileType already read
| Python | bsd-3-clause | LordGolias/sqf | import sys
import argparse
from sqf.parser import parse
import sqf.analyser
from sqf.exceptions import SQFParserError
def analyze(code, writer=sys.stdout):
try:
result = parse(code)
except SQFParserError as e:
writer.write('[%d,%d]:%s\n' % (e.position[0], e.position[1] - 1, e.message))
... | Fix parsing file - FileType already read
import sys
import argparse
from sqf.parser import parse
import sqf.analyser
from sqf.exceptions import SQFParserError
def analyze(code, writer=sys.stdout):
try:
result = parse(code)
except SQFParserError as e:
writer.write('[%d,%d]:%s\n' % (e.position... |
d7e4bdc6979e3ada1e28ce01e3b3e12d4d197bcf | html_table_parser/__init__.py | html_table_parser/__init__.py | from .parser import HTMLTableParser
__author__ = 'Josua Schmid'
__version__ = '0.1.1'
__licence__ = 'GPLv3'
| from .parser import HTMLTableParser
__author__ = 'Josua Schmid'
__version__ = '0.1.1'
__licence__ = 'AGPLv3'
| Correct license in module meta information | Correct license in module meta information
| Python | agpl-3.0 | schmijos/html-table-parser-python3,schmijos/html-table-parser-python3 | from .parser import HTMLTableParser
__author__ = 'Josua Schmid'
__version__ = '0.1.1'
__licence__ = 'AGPLv3'
| Correct license in module meta information
from .parser import HTMLTableParser
__author__ = 'Josua Schmid'
__version__ = '0.1.1'
__licence__ = 'GPLv3'
|
c269315ec83a0cfc6ec6c5bd58945ba68d6f69f3 | analyzarr/ui/custom_tools.py | analyzarr/ui/custom_tools.py | from chaco.tools.api import ScatterInspector
from numpy import zeros
class PeakSelectionTool(ScatterInspector):
def _deselect(self, index=None):
super(PeakSelectionTool, self)._deselect(index)
self._update_mask()
# override this method so that we only select one peak at a time
def _sel... | Add missing custom tools file | Add missing custom tools file
| Python | bsd-2-clause | msarahan/analyzarr,msarahan/analyzarr | from chaco.tools.api import ScatterInspector
from numpy import zeros
class PeakSelectionTool(ScatterInspector):
def _deselect(self, index=None):
super(PeakSelectionTool, self)._deselect(index)
self._update_mask()
# override this method so that we only select one peak at a time
def _sel... | Add missing custom tools file
| |
21059428d95c27cf043ada2e299a4cf3982a4233 | python/printbag.py | python/printbag.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Convert a rosbag file to legacy lidar binary format.
"""
"""LIDAR datatype format is:
(
timestamp (long),
flag (bool saved as int),
accelerometer[3] (double),
gps[3] (double),
distance[LIDAR_NUM_ANGLES] (long),
)
'int... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Convert a rosbag file to legacy lidar binary format.
"""
"""LIDAR datatype format is:
(
timestamp (long),
flag (bool saved as int),
accelerometer[3] (double),
gps[3] (double),
distance[LIDAR_NUM_ANGLES] (long),
)
'int... | Print out bag contents for lidar and button topics | Print out bag contents for lidar and button topics
| Python | bsd-2-clause | oliverlee/antlia | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Convert a rosbag file to legacy lidar binary format.
"""
"""LIDAR datatype format is:
(
timestamp (long),
flag (bool saved as int),
accelerometer[3] (double),
gps[3] (double),
distance[LIDAR_NUM_ANGLES] (long),
)
'int... | Print out bag contents for lidar and button topics
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Convert a rosbag file to legacy lidar binary format.
"""
"""LIDAR datatype format is:
(
timestamp (long),
flag (bool saved as int),
accelerometer[3] (double),
gps[3] (double),
... |
0c22486320b064c078fe009faf41e2d0c7f5e272 | passwordless/views.py | passwordless/views.py | from django.shortcuts import render
from django.views.generic.edit import FormView
from . import forms
# Create your views here.
def logout(request):
return render(request, 'passwordless/logout.html')
def authn(request, token):
return render(request, 'passwordless/authn.html')
class LoginView(FormView):
... | from django.shortcuts import render
from django.views.generic.edit import FormView
from . import forms
# Create your views here.
def logout(request):
return render(request, 'passwordless/logout.html')
def authn(request, token):
return render(request, 'passwordless/authn.html')
class LoginView(FormView):
... | Refactor RegisterView as subclass of LoginView | Refactor RegisterView as subclass of LoginView
They share much of the work, they should share the code as well
| Python | mit | Kromey/fbxnano,Kromey/akwriters,Kromey/fbxnano,Kromey/akwriters,Kromey/akwriters,Kromey/fbxnano,Kromey/fbxnano,Kromey/akwriters | from django.shortcuts import render
from django.views.generic.edit import FormView
from . import forms
# Create your views here.
def logout(request):
return render(request, 'passwordless/logout.html')
def authn(request, token):
return render(request, 'passwordless/authn.html')
class LoginView(FormView):
... | Refactor RegisterView as subclass of LoginView
They share much of the work, they should share the code as well
from django.shortcuts import render
from django.views.generic.edit import FormView
from . import forms
# Create your views here.
def logout(request):
return render(request, 'passwordless/logout.html')... |
5dae59bc17f0f8a0ef97bbc461eb18c0ea725bc9 | config-example.py | config-example.py | # Copy this file to config.py and change the settings. Don't forget to specify your own SECRET_KEY.
# The app name will be used in several places.
APP_NAME = 'Yelp Love'
APP_BASE_URL = 'https://PROJECT_ID.appspot.com/'
LOVE_SENDER_EMAIL = 'Yelp Love <love@PROJECT_ID.appspot.com>'
# Flask's secret key, used to encry... | # Copy this file to config.py and change the settings. Don't forget to specify your own SECRET_KEY.
# The app name will be used in several places.
APP_NAME = 'Yelp Love'
APP_BASE_URL = 'https://PROJECT_ID.appspot.com/'
LOVE_SENDER_EMAIL = 'Yelp Love <love@PROJECT_ID.appspotmail.com>'
# Flask's secret key, used to e... | Use appspotmail.com instead of appspot.com for email sender | Use appspotmail.com instead of appspot.com for email sender
| Python | mit | Yelp/love,Yelp/love,Yelp/love | # Copy this file to config.py and change the settings. Don't forget to specify your own SECRET_KEY.
# The app name will be used in several places.
APP_NAME = 'Yelp Love'
APP_BASE_URL = 'https://PROJECT_ID.appspot.com/'
LOVE_SENDER_EMAIL = 'Yelp Love <love@PROJECT_ID.appspotmail.com>'
# Flask's secret key, used to e... | Use appspotmail.com instead of appspot.com for email sender
# Copy this file to config.py and change the settings. Don't forget to specify your own SECRET_KEY.
# The app name will be used in several places.
APP_NAME = 'Yelp Love'
APP_BASE_URL = 'https://PROJECT_ID.appspot.com/'
LOVE_SENDER_EMAIL = 'Yelp Love <love@... |
c9137bdaf551d0e1203120a9c00af60541e3597f | scikits/talkbox/lpc/lpc.py | scikits/talkbox/lpc/lpc.py | #! /usr/bin/env python
# Last Change: Sun Sep 14 03:00 PM 2008 J
import numpy as np
from c_lpc import levinson as c_levinson
def levinson(r, order, axis = -1):
"""Levinson-Durbin recursion, to efficiently solve symmetric linear systems
with toeplitz structure.
Arguments
---------
r : array-... | Add python interface around C implementation of levinson. | Add python interface around C implementation of levinson.
| Python | mit | cournape/talkbox,cournape/talkbox | #! /usr/bin/env python
# Last Change: Sun Sep 14 03:00 PM 2008 J
import numpy as np
from c_lpc import levinson as c_levinson
def levinson(r, order, axis = -1):
"""Levinson-Durbin recursion, to efficiently solve symmetric linear systems
with toeplitz structure.
Arguments
---------
r : array-... | Add python interface around C implementation of levinson.
| |
410b447f54838e4a28b28aa1a027bd058520d9b0 | Python/HARPS-e2ds-to-order.py | Python/HARPS-e2ds-to-order.py | #!/usr/bin/env python
# encoding: utf-8
"""
HARPS-e2ds-to-order.py
Created by Jonathan Whitmore on 2011-10-14.
Copyright (c) 2011. All rights reserved.
"""
import sys
import os
import argparse
import pyfits as pf
import numpy as np
help_message = '''
Takes reduced HARPS***e2ds_A.fits data and reads the header to out... | Order by order of HARPS data | Order by order of HARPS data
| Python | mit | jbwhit/CaliCompari | #!/usr/bin/env python
# encoding: utf-8
"""
HARPS-e2ds-to-order.py
Created by Jonathan Whitmore on 2011-10-14.
Copyright (c) 2011. All rights reserved.
"""
import sys
import os
import argparse
import pyfits as pf
import numpy as np
help_message = '''
Takes reduced HARPS***e2ds_A.fits data and reads the header to out... | Order by order of HARPS data
| |
f61b8cfcbf98da826a847981834763198db42867 | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='ckanext-archiver',
version='0.1',
packages=find_packages(),
install_requires=[
'celery==2.4.5',
'kombu==1.5.1',
'kombu-sqlalchemy==1.1.0',
'SQLAlchemy>=0.6.6',
'requests==0.6.4',
'messytables>=0.1.4... | from setuptools import setup, find_packages
setup(
name='ckanext-archiver',
version='0.1',
packages=find_packages(),
install_requires=[
'celery==2.4.2',
'kombu==2.1.3',
'kombu-sqlalchemy==1.1.0',
'SQLAlchemy>=0.6.6',
'requests==0.6.4',
'messytables>=0.1.4... | Change celery and kombu requirements to match ckanext-datastorer | Change celery and kombu requirements to match ckanext-datastorer
| Python | mit | datagovuk/ckanext-archiver,DanePubliczneGovPl/ckanext-archiver,ckan/ckanext-archiver,DanePubliczneGovPl/ckanext-archiver,DanePubliczneGovPl/ckanext-archiver,datagovuk/ckanext-archiver,ckan/ckanext-archiver,datagovuk/ckanext-archiver,ckan/ckanext-archiver | from setuptools import setup, find_packages
setup(
name='ckanext-archiver',
version='0.1',
packages=find_packages(),
install_requires=[
'celery==2.4.2',
'kombu==2.1.3',
'kombu-sqlalchemy==1.1.0',
'SQLAlchemy>=0.6.6',
'requests==0.6.4',
'messytables>=0.1.4... | Change celery and kombu requirements to match ckanext-datastorer
from setuptools import setup, find_packages
setup(
name='ckanext-archiver',
version='0.1',
packages=find_packages(),
install_requires=[
'celery==2.4.5',
'kombu==1.5.1',
'kombu-sqlalchemy==1.1.0',
'SQLAlche... |
6f6199240009ac91da7e663030125df439d8fe7e | tests/test_trust_list.py | tests/test_trust_list.py | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import unittest
import sys
from oscrypto import trust_list
from asn1crypto.x509 import Certificate
if sys.version_info < (3,):
byte_cls = str
else:
byte_cls = bytes
class TrustListTests(unittest.TestCase):
... | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import unittest
import sys
from oscrypto import trust_list
from asn1crypto.x509 import Certificate
if sys.version_info < (3,):
byte_cls = str
else:
byte_cls = bytes
class TrustListTests(unittest.TestCase):
... | Add more sanity checks to the trust list test | Add more sanity checks to the trust list test
| Python | mit | wbond/oscrypto | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import unittest
import sys
from oscrypto import trust_list
from asn1crypto.x509 import Certificate
if sys.version_info < (3,):
byte_cls = str
else:
byte_cls = bytes
class TrustListTests(unittest.TestCase):
... | Add more sanity checks to the trust list test
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import unittest
import sys
from oscrypto import trust_list
from asn1crypto.x509 import Certificate
if sys.version_info < (3,):
byte_cls = str
else:
byte_cls = byte... |
200f1727f16bcd903554346611afc976846f5896 | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(
name='django-payfast',
version='0.2.2',
author='Mikhail Korobov',
author_email='kmike84@gmail.com',
packages=['payfast', 'payfast.south_migrations'],
url='http://bitbucket.org/kmike/django-payfast/',
download_url = 'http://bitb... | #!/usr/bin/env python
from distutils.core import setup
setup(
name='django-payfast',
version='0.2.2',
author='Mikhail Korobov',
author_email='kmike84@gmail.com',
packages=['payfast', 'payfast.south_migrations'],
url='http://bitbucket.org/kmike/django-payfast/',
download_url = 'http://bitb... | Package classifiers: Explicitly target Python 2.7 | Package classifiers: Explicitly target Python 2.7
| Python | mit | reinbach/django-payfast | #!/usr/bin/env python
from distutils.core import setup
setup(
name='django-payfast',
version='0.2.2',
author='Mikhail Korobov',
author_email='kmike84@gmail.com',
packages=['payfast', 'payfast.south_migrations'],
url='http://bitbucket.org/kmike/django-payfast/',
download_url = 'http://bitb... | Package classifiers: Explicitly target Python 2.7
#!/usr/bin/env python
from distutils.core import setup
setup(
name='django-payfast',
version='0.2.2',
author='Mikhail Korobov',
author_email='kmike84@gmail.com',
packages=['payfast', 'payfast.south_migrations'],
url='http://bitbucket.org/kmik... |
501a52ae39a63f58e2de2f7f31c6eb82e49f2e0a | comics/comics/hagarthehorrible.py | comics/comics/hagarthehorrible.py | # encoding: utf-8
from comics.aggregator.crawler import ComicsKingdomCrawlerBase
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Hägar the Horrible'
language = 'en'
url = 'https://www.comicskingdom.com/hagar-the-horrible'
rights = 'Chris Browne'
class Crawler... | Add crawler for "Hägar the Horrible" | Add crawler for "Hägar the Horrible"
| Python | agpl-3.0 | datagutten/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,datagutten/comics,jodal/comics,jodal/comics | # encoding: utf-8
from comics.aggregator.crawler import ComicsKingdomCrawlerBase
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Hägar the Horrible'
language = 'en'
url = 'https://www.comicskingdom.com/hagar-the-horrible'
rights = 'Chris Browne'
class Crawler... | Add crawler for "Hägar the Horrible"
| |
fd5ebe9ae938cdf0d586bf3177730619b8b2025a | django_auto_filter/filter_for_models.py | django_auto_filter/filter_for_models.py | from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from django_auto_filter.views_django_auto_filter_new import DjangoAutoFilterNew
from djangoautoconf.model_utils.model_attr_utils import model_enumerator
from ufs_tools.string_tools import class_name_to_low_case
def a... | from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from django_auto_filter.views_django_auto_filter_new import DjangoAutoFilterNew
from djangoautoconf.model_utils.model_attr_utils import model_enumerator
from ufs_tools.string_tools import class_name_to_low_case
def a... | Fix attribute from model_class to model issue. | Fix attribute from model_class to model issue.
| Python | bsd-3-clause | weijia/django-auto-filter,weijia/django-auto-filter,weijia/django-auto-filter | from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from django_auto_filter.views_django_auto_filter_new import DjangoAutoFilterNew
from djangoautoconf.model_utils.model_attr_utils import model_enumerator
from ufs_tools.string_tools import class_name_to_low_case
def a... | Fix attribute from model_class to model issue.
from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from django_auto_filter.views_django_auto_filter_new import DjangoAutoFilterNew
from djangoautoconf.model_utils.model_attr_utils import model_enumerator
from ufs_tools.st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.