commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
bf2cc432261394a2134c0fe889f28085e9679771
requests_cache/__init__.py
requests_cache/__init__.py
#!/usr/bin/env python # flake8: noqa: E402,F401 __version__ = '0.6.1' try: from .response import AnyResponse, CachedHTTPResponse, CachedResponse, ExpirationTime from .session import ALL_METHODS, CachedSession, CacheMixin from .patcher import ( clear, disabled, enabled, get_c...
# flake8: noqa: E402,F401 __version__ = '0.6.1' try: from .response import AnyResponse, CachedHTTPResponse, CachedResponse, ExpirationTime from .session import ALL_METHODS, CachedSession, CacheMixin from .patcher import ( clear, disabled, enabled, get_cache, install_...
Remove shebang from top-level init file
Remove shebang from top-level init file
Python
bsd-2-clause
reclosedev/requests-cache
dd31ff9372f587cf2fd7e634f3c6886fa9beedc0
examples/pywapi-example.py
examples/pywapi-example.py
#!/usr/bin/env python import pywapi weather_com_result = pywapi.get_weather_from_weather_com('10001') yahoo_result = pywapi.get_weather_from_yahoo('10001') noaa_result = pywapi.get_weather_from_noaa('KJFK') print "Weather.com says: It is " + string.lower(weather_com_result['current_conditions']['text']) + " and " + ...
#!/usr/bin/env python import pywapi weather_com_result = pywapi.get_weather_from_weather_com('10001') yahoo_result = pywapi.get_weather_from_yahoo('10001') noaa_result = pywapi.get_weather_from_noaa('KJFK') print "Weather.com says: It is " + weather_com_result['current_conditions']['text'].lower() + " and " + weathe...
Fix error in example script
Fix error in example script
Python
mit
kheuton/python-weather-api
54ee71dbc3526886f0fd44fa182c18c1fb1e3ffb
mysite/missions/irc/ircmissionbot.py
mysite/missions/irc/ircmissionbot.py
from django.conf import settings from ircbot import SingleServerIRCBot class IrcMissionBot(SingleServerIRCBot): def __init__(self): SingleServerIRCBot.__init__(self, [settings.IRC_MISSION_SERVER], settings.IRC_MISSIONBOT_NICK, settings.IRC_MISSIONBOT_REALNAME) self.channel = settings....
from django.conf import settings from mysite.missions.models import IrcMissionSession from mysite.missions.base import controllers from ircbot import SingleServerIRCBot class IrcMissionBot(SingleServerIRCBot): def __init__(self): SingleServerIRCBot.__init__(self, [settings.IRC_MISSION_SERVER], ...
Make the bot track nicks in the channel and maintain exactly one IrcMissionSession per nick.
Make the bot track nicks in the channel and maintain exactly one IrcMissionSession per nick.
Python
agpl-3.0
sudheesh001/oh-mainline,willingc/oh-mainline,moijes12/oh-mainline,waseem18/oh-mainline,nirmeshk/oh-mainline,openhatch/oh-mainline,openhatch/oh-mainline,vipul-sharma20/oh-mainline,sudheesh001/oh-mainline,willingc/oh-mainline,openhatch/oh-mainline,nirmeshk/oh-mainline,ojengwa/oh-mainline,Changaco/oh-mainline,SnappleCap/o...
796d74c5b666ee237afa95a18e1dc91a51b0cc7c
django_cron/management/commands/cronjobs.py
django_cron/management/commands/cronjobs.py
# # run the cron service (intended to be executed from a cron job) # # usage: manage.py cronjobs from django.conf import settings from django.core.management.base import NoArgsCommand import django_cron class Command(NoArgsCommand): help = "run the cron services (intended to be executed from a cron job)" def...
# # run the cron service (intended to be executed from a cron job) # # usage: manage.py cronjobs from datetime import datetime from django.conf import settings from django.core.management.base import NoArgsCommand import django_cron class Command(NoArgsCommand): help = "run the cron services (intended to be exec...
Change crontab finished message to include the current time.
Change crontab finished message to include the current time.
Python
mit
Ixxy-Open-Source/django-cron,peterbe/django-cron
a1f9399657c3b874e53d2c7e54df8960350c83f1
lib/reinteract/custom_result.py
lib/reinteract/custom_result.py
# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk class CustomResult(object): def creat...
# Copyright 2007 Owen Taylor # # This file is part of Reinteract and distributed under the terms # of the BSD license. See the file COPYING in the Reinteract # distribution for full details. # ######################################################################## import gtk class CustomResult(object): def creat...
Attach custom result popup menu to widget
Attach custom result popup menu to widget Call gtk.Menu.attach_to_widget() on the popup menu for custom results. This should have little practical result one way or the other, though it is theoretically "right", but it has the useful side-effect of getting the menu into the right GtkWindowGroup. Again that should have...
Python
bsd-2-clause
alexey4petrov/reinteract,rschroll/reinteract,johnrizzo1/reinteract,jbaayen/reinteract,johnrizzo1/reinteract,alexey4petrov/reinteract,jbaayen/reinteract,jbaayen/reinteract,rschroll/reinteract,rschroll/reinteract,johnrizzo1/reinteract,alexey4petrov/reinteract
ee4ebc441927a4060d38d702891c1a171bd3932c
pytask/urls.py
pytask/urls.py
from django.conf.urls.defaults import * from registration.views import register from registration.backends.default import DefaultBackend import pytask.profile.regbackend from pytask.profile.forms import CustomRegistrationForm from pytask.views import home_page from django.shortcuts import redirect # Uncomment the n...
from django.conf import settings from django.conf.urls.defaults import * from registration.views import register from pytask.profile.forms import CustomRegistrationForm from pytask.views import home_page from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^pytas...
Add a DEVELOPMENT settings for URL mapping for static and media files.
Add a DEVELOPMENT settings for URL mapping for static and media files.
Python
agpl-3.0
madhusudancs/pytask,madhusudancs/pytask,madhusudancs/pytask
a9176b1fc9116601a98c53a84cff57d9692e1fa4
query/forms.py
query/forms.py
""" Forms for the rdap_explorer project, query app. """ from django import forms class QueryForm(forms.Form): query = forms.CharField(max_length=100)
""" Forms for the rdap_explorer project, query app. """ from django import forms class QueryForm(forms.Form): query = forms.CharField( label='', max_length=100, widget=forms.TextInput(attrs={'placeholder': 'IPv4/6 address'}) )
Remove label and add placeholder to Query field.
Remove label and add placeholder to Query field.
Python
mit
cdubz/rdap-explorer,cdubz/rdap-explorer
b9dfbb17512b270103444d972af17c43ddbba26b
ibmcnx/doc/DataSources.py
ibmcnx/doc/DataSources.py
###### # Check ExId (GUID) by Email through JDBC # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # # Check ExId of a User in all Connections Appli...
###### # Check ExId (GUID) by Email through JDBC # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # # Check ExId of a User in all Connections Appli...
Create documentation of DataSource Settings
8: Create documentation of DataSource Settings Task-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/8
Python
apache-2.0
stoeps13/ibmcnx2,stoeps13/ibmcnx2
134bc5f48fd8a80f84ae91531b40263fcbaedfe1
serrano/urls.py
serrano/urls.py
import time from django.conf.urls import patterns, url, include urlpatterns = patterns('', url(r'', include(patterns('', url(r'^$', include('serrano.resources')), url(r'^fields/', include('serrano.resources.field')), url(r'^concepts/', include('serrano.resources.concept')), url(r'^...
from django.conf.urls import patterns, url, include urlpatterns = patterns('', url(r'', include(patterns('', url(r'^$', include('serrano.resources')), url(r'^fields/', include('serrano.resources.field')), url(r'^concepts/', include('serrano.resources.concept')), url(r'^contexts/', ...
Remove intentional unused import to clean branch
Remove intentional unused import to clean branch
Python
bsd-2-clause
chop-dbhi/serrano,rv816/serrano_night,chop-dbhi/serrano,rv816/serrano_night
2c0b25a4d978999617a22f33c8109fd35cfe657a
natasha/data/__init__.py
natasha/data/__init__.py
# coding: utf-8 from __future__ import unicode_literals import os def get_path(filename): return os.path.join(os.path.dirname(__file__), filename) def maybe_strip_comment(line): if '#' in line: line = line[:line.index('#')] line = line.rstrip() return line def load_lines(filename): ...
# coding: utf-8 from __future__ import unicode_literals from yargy.compat import RUNNING_ON_PYTHON_2_VERSION import os def get_path(filename): return os.path.join(os.path.dirname(__file__), filename) def maybe_strip_comment(line): if '#' in line: line = line[:line.index('#')] line = line.rs...
Fix encoding problems with py2
Fix encoding problems with py2
Python
mit
natasha/natasha
1e601fb99259c346497db1b5392d3d79ad6dbd8e
gmt/utils.py
gmt/utils.py
""" Utilities and common tasks for wrapping the GMT modules. """ GMT_DOCS = 'http://gmt.soest.hawaii.edu/doc/latest' def gmt_docs_link(module_func): """ Add to a module docstring a link to the GMT docs for that module. The docstring must have the placeholder ``{gmt_mod}`` where you want the link to ...
""" Utilities and common tasks for wrapping the GMT modules. """ GMT_DOCS = 'http://gmt.soest.hawaii.edu/doc/latest' def gmt_docs_link(module_func): """ Add to a module docstring a link to the GMT docs for that module. The docstring must have the placeholder ``{gmt_module_docs}`` where you want the ...
Fix issue with spacing when inserting gmt link
Fix issue with spacing when inserting gmt link Make the entry a single line to avoid leading white space problems.
Python
bsd-3-clause
GenericMappingTools/gmt-python,GenericMappingTools/gmt-python
207af9278a6e1ee54d640e24eee8bd35ced0920e
byceps/services/newsletter/transfer/models.py
byceps/services/newsletter/transfer/models.py
""" byceps.services.newsletter.transfer.models ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from dataclasses import dataclass from datetime import datetime from typing import NewType from ....typing import UserID ListID =...
""" byceps.services.newsletter.transfer.models ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from dataclasses import dataclass from typing import NewType ListID = NewType('ListID', str) @dataclass(frozen=True) class List:...
Remove unused newsletter DTO `Subscription`
Remove unused newsletter DTO `Subscription`
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps
7a8b041ce9e0f115f3c5daad159a03c13c5cd72d
python/pycandela/pycandela/__init__.py
python/pycandela/pycandela/__init__.py
import IPython.core.displaypub as displaypub import json import DataFrame from pandas class DataFrameEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, DataFrame): return obj.to_records() return json.JSONEncoder.default(self, obj) def publish_display_data(data): ...
import IPython.core.displaypub as displaypub import json from pandas import DataFrame class DataFrameEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, DataFrame): return obj.to_records() return json.JSONEncoder.default(self, obj) def publish_display_data(data): ...
Fix import and call render() on vis
Fix import and call render() on vis
Python
apache-2.0
Kitware/candela,Kitware/candela,Kitware/candela,Kitware/candela,Kitware/candela
e37aa73f998e17c707d3c288ccc989f49aeeab3c
input_mask/contrib/localflavor/br/fields.py
input_mask/contrib/localflavor/br/fields.py
from ....fields import DecimalField from .widgets import BRDecimalInput from decimal import Decimal class BRDecimalField(DecimalField): widget = BRDecimalInput def to_python(self, value): value = value.replace(',', '.') value = value.replace('.', '', value.count('.')-1) return Decim...
from django.forms import ValidationError from ....fields import DecimalField from .widgets import BRDecimalInput from decimal import Decimal, DecimalException class BRDecimalField(DecimalField): widget = BRDecimalInput def to_python(self, value): value = value.replace(',', '.') value = valu...
Fix a bug while handling invalid values
Fix a bug while handling invalid values
Python
mit
caioariede/django-input-mask,luzfcb/django-input-mask,caioariede/django-input-mask,luzfcb/django-input-mask,caioariede/django-input-mask,luzfcb/django-input-mask
212ce8f67495be81d5ecdc97b6765d2759e56d8d
streamparse/storm/component.py
streamparse/storm/component.py
""" Module to add streamparse-specific extensions to pystorm Component classes """ import pystorm from pystorm.component import StormHandler # This is used by other code from ..dsl.component import ComponentSpec class Component(pystorm.component.Component): """pystorm Component with streamparse-specific additio...
""" Module to add streamparse-specific extensions to pystorm Component classes """ import pystorm from pystorm.component import StormHandler # This is used by other code class Component(pystorm.component.Component): """pystorm Component with streamparse-specific additions :ivar outputs: The outputs :iva...
Make Component.spec calls raise TypeError directly
Make Component.spec calls raise TypeError directly
Python
apache-2.0
codywilbourn/streamparse,Parsely/streamparse,codywilbourn/streamparse,Parsely/streamparse
8298f0b04380f7391e613a758576e4093fc9f09c
symposion/proposals/lookups.py
symposion/proposals/lookups.py
from django.contrib.auth.models import User from selectable.base import ModelLookup from selectable.registry import registry class UserLookup(ModelLookup): model = User search_fields = ( 'first_name__icontains', 'last_name__icontains', 'email__icontains', ) def get_item_value...
import operator from django.contrib.auth.models import User from django.db.models import Q from selectable.base import ModelLookup from selectable.registry import registry class UserLookup(ModelLookup): model = User search_fields = ( 'first_name__icontains', 'last_name__icontains', '...
Customize lookup get_query to account for looking up a portion of User.get_full_name
Customize lookup get_query to account for looking up a portion of User.get_full_name
Python
bsd-3-clause
smellman/sotmjp-website,smellman/sotmjp-website,pyconjp/pyconjp-website,osmfj/sotmjp-website,pyconjp/pyconjp-website,njl/pycon,osmfj/sotmjp-website,pyconjp/pyconjp-website,PyCon/pycon,smellman/sotmjp-website,Diwahars/pycon,njl/pycon,Diwahars/pycon,PyCon/pycon,osmfj/sotmjp-website,pyconjp/pyconjp-website,Diwahars/pycon,...
6bbafa2e9102840768ee875407be1878f2aa05ca
tests/pytests/unit/engines/test_script.py
tests/pytests/unit/engines/test_script.py
""" unit tests for the script engine """ import pytest import salt.config import salt.engines.script as script from salt.exceptions import CommandExecutionError from tests.support.mock import patch @pytest.fixture def configure_loader_modules(): opts = salt.config.DEFAULT_MASTER_OPTS return {script: {"__opts...
""" unit tests for the script engine """ import pytest import salt.config import salt.engines.script as script from salt.exceptions import CommandExecutionError from tests.support.mock import patch @pytest.fixture def configure_loader_modules(): opts = salt.config.DEFAULT_MASTER_OPTS return {script: {"__opts...
Test iteration stops at empty bytes
Test iteration stops at empty bytes
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
9658033dab279828975183f94f8c8641891f4ea9
froide/helper/api_utils.py
froide/helper/api_utils.py
from collections import OrderedDict from rest_framework.pagination import LimitOffsetPagination from rest_framework.response import Response from rest_framework.serializers import ListSerializer from rest_framework.utils.serializer_helpers import ReturnDict class CustomLimitOffsetPagination(LimitOffsetPagination): ...
from collections import OrderedDict from rest_framework.pagination import LimitOffsetPagination from rest_framework.response import Response from rest_framework.serializers import ListSerializer from rest_framework.utils.serializer_helpers import ReturnDict class CustomLimitOffsetPagination(LimitOffsetPagination): ...
Add max limit to api pagination
Add max limit to api pagination
Python
mit
fin/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide
592c6550255793772add694cb941a0db0883713b
kamboo/core.py
kamboo/core.py
# Copyright (c) 2014, Henry Huang # # 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 writ...
# Copyright (c) 2014, Henry Huang # # 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 writ...
Fix the issue: "session" shared in different connections
Fix the issue: "session" shared in different connections
Python
apache-2.0
henrysher/kamboo,henrysher/kamboo
b80607d0f5cff2d05bf607d4ff4847f14777130f
sieve/sieve.py
sieve/sieve.py
def sieve(n): if n < 2: return [] not_prime = set() prime = [2] for i in range(3, n+1, 2): if i not in not_prime: prime.append(i) not_prime.update(range(i*i, n+1, i)) return prime
def sieve(n): return list(primes(n)) def primes(n): if n < 2: raise StopIteration yield 2 not_prime = set() for i in range(3, n+1, 2): if i not in not_prime: not_prime.update(range(i*i, n+1, i)) yield i
Revert back to a generator - it's actually slight faster
Revert back to a generator - it's actually slight faster
Python
agpl-3.0
CubicComet/exercism-python-solutions
35a413ecdc83578a0ef63d0865a4fe7bae6f1e99
scipy/interpolate/generate_interpnd.py
scipy/interpolate/generate_interpnd.py
#!/usr/bin/env python import tempfile import subprocess import os import sys import re import shutil from mako.template import Template f = open('interpnd.pyx', 'r') template = f.read() f.close() tmp_dir = tempfile.mkdtemp() try: # Run templating engine fn = os.path.join(tmp_dir, 'interpnd.pyx') f = open...
#!/usr/bin/env python import tempfile import subprocess import os import sys import re import shutil from mako.template import Template dotnet = False if len(sys.argv) > 1 and sys.argv[1] == '--dotnet': dotnet = True f = open('interpnd.pyx', 'r') template = f.read() f.close() tmp_dir = tempfile.mkdtemp() try: ...
Modify the interpnd cython generator to allow .NET output
Modify the interpnd cython generator to allow .NET output
Python
bsd-3-clause
jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor
88cd50a331c20fb65c495e92cc93867f03cd3826
lib/exp/featx/__init__.py
lib/exp/featx/__init__.py
__all__ = [] from lib.exp.featx.base import Feats from lib.exp.tools.slider import Slider from lib.exp.tools.video import Video from lib.exp.pre import Reducer class Featx(Feats): def __init__(self, root, name): Feats.__init__(self, root, name) def get_slide_feats(self): ss = Slider(self.roo...
__all__ = [] from lib.exp.featx.base import Feats from lib.exp.tools.slider import Slider from lib.exp.tools.video import Video from lib.exp.pre import Reducer class Featx(Feats): def __init__(self, root, name): Feats.__init__(self, root, name) def get_slide_feats(self): ss = Slider(self.roo...
Load feats with zero length
Load feats with zero length
Python
agpl-3.0
speed-of-light/pyslider
f24d3bbd9bd5bdfdfaf939bf795f5c4ad490e8dd
src/waypoints_reader/scripts/yaml_reader.py
src/waypoints_reader/scripts/yaml_reader.py
#!/usr/bin/env python # coding UTF-8 import yaml import rospy from goal_sender_msgs.msg import GoalSequence from goal_sender_msgs.msg import Waypoint def read_yaml(path): f = open(path, 'r') waypoints = yaml.load(f) f.close() return waypoints def pub_data(): pub = rospy.Publisher('goal_sequence'...
#!/usr/bin/env python # coding UTF-8 import yaml import rospy from goal_sender_msgs.srv import ApplyGoals from goal_sender_msgs.msg import GoalSequence from goal_sender_msgs.msg import Waypoint def read_yaml(path): f = open(path, 'r') waypoints = yaml.load(f) f.close() return waypoints def get_waypo...
Change goals passage with service (from message)
Change goals passage with service (from message)
Python
bsd-3-clause
CIR-KIT/fifth_robot_pkg,CIR-KIT/fifth_robot_pkg,CIR-KIT/fifth_robot_pkg
a671952f498d9a355d15ec332d4e01e621bf1e6d
flask_admin/model/typefmt.py
flask_admin/model/typefmt.py
from jinja2 import Markup from flask.ext.admin._compat import text_type def null_formatter(view, value): """ Return `NULL` as the string for `None` value :param value: Value to check """ return Markup('<i>NULL</i>') def empty_formatter(view, value): """ Return em...
from jinja2 import Markup from flask.ext.admin._compat import text_type def null_formatter(view, value): """ Return `NULL` as the string for `None` value :param value: Value to check """ return Markup('<i>NULL</i>') def empty_formatter(view, value): """ Return em...
Change bool_formatter() to be backward compatible with bootstrap2
Change bool_formatter() to be backward compatible with bootstrap2
Python
bsd-3-clause
litnimax/flask-admin,flabe81/flask-admin,marrybird/flask-admin,marrybird/flask-admin,plaes/flask-admin,phantomxc/flask-admin,wangjun/flask-admin,jamesbeebop/flask-admin,jschneier/flask-admin,flask-admin/flask-admin,ibushong/test-repo,ondoheer/flask-admin,flask-admin/flask-admin,HermasT/flask-admin,quokkaproject/flask-a...
aa4db7a84f117b577f74a355c160889cf334f227
lingcod/bookmarks/forms.py
lingcod/bookmarks/forms.py
from lingcod.features.forms import FeatureForm from lingcod.bookmarks.models import Bookmark from django import forms class BookmarkForm(FeatureForm): name = forms.CharField(label='Bookmark Name') latitude = forms.FloatField(widget=forms.HiddenInput()) longitude = forms.FloatField(widget=forms.HiddenInput(...
from lingcod.features.forms import FeatureForm from lingcod.bookmarks.models import Bookmark from django import forms class BookmarkForm(FeatureForm): name = forms.CharField(label='Bookmark Name') latitude = forms.FloatField(widget=forms.HiddenInput()) longitude = forms.FloatField(widget=forms.HiddenInput(...
Hide IP from input form
Hide IP from input form
Python
bsd-3-clause
Ecotrust/madrona_addons,Ecotrust/madrona_addons
ceceada705d8e98329f67d9ca6c8cba6cebb01cc
lingcod/bookmarks/forms.py
lingcod/bookmarks/forms.py
from lingcod.features.forms import FeatureForm from lingcod.bookmarks.models import Bookmark from django import forms class BookmarkForm(FeatureForm): name = forms.CharField(label='Bookmark Name') latitude = forms.FloatField(widget=forms.HiddenInput()) longitude = forms.FloatField(widget=forms.HiddenInput(...
from lingcod.features.forms import FeatureForm from lingcod.bookmarks.models import Bookmark from django import forms class BookmarkForm(FeatureForm): name = forms.CharField(label='Bookmark Name') latitude = forms.FloatField(widget=forms.HiddenInput()) longitude = forms.FloatField(widget=forms.HiddenInput(...
Allow IP to be blank in form
Allow IP to be blank in form --HG-- branch : bookmarks
Python
bsd-3-clause
underbluewaters/marinemap,underbluewaters/marinemap,underbluewaters/marinemap
905a08bf59f6a7d51218aaa4559e7f4efa6244a9
thunderdome/tests/groovy/test_scanner.py
thunderdome/tests/groovy/test_scanner.py
import os from unittest import TestCase from thunderdome.gremlin import parse class GroovyScannerTest(TestCase): """ Test Groovy language scanner """ def test_parsing_complicated_function(self): groovy_file = os.path.join(os.path.dirname(__file__), 'test.groovy') result = parse(gr...
import os from unittest import TestCase from thunderdome.gremlin import parse class GroovyScannerTest(TestCase): """ Test Groovy language scanner """ def test_parsing_complicated_function(self): groovy_file = os.path.join(os.path.dirname(__file__), 'test.groovy') result = parse(gr...
Add Unit-Test For Scanner Problem
Add Unit-Test For Scanner Problem
Python
mit
StartTheShift/thunderdome,StartTheShift/thunderdome
35d207c6760404cfd8802227d4926aed2ac9a7ae
cards/bjcard.py
cards/bjcard.py
""" Created on Dec 24, 2016 @author: john papa Copyright 2016 John Papa. All rights reserved. This work is licensed under the MIT License. """ from .card import Card class BjCard(Card): def __init__(self, *args, **kwarg): super().__init__(*args, **kwarg) @property def value(self): """ ...
""" Created on Dec 24, 2016 @author: john papa Copyright 2016 John Papa. All rights reserved. This work is licensed under the MIT License. """ from .card import Card class BjCard(Card): def __init__(self, suit, rank): super().__init__(suit, rank) @property def value(self): """ Returns ...
Change params to suit and rank
Change params to suit and rank
Python
mit
johnpapa2/twenty-one,johnpapa2/twenty-one
a9e24dc8444f24ee9be0987f9dc5fbe96b5c3408
money_conversion/money.py
money_conversion/money.py
class Money(object): def __init__(self, amount, currency): self.amount = amount self.currency = currency.upper()
class Money(object): def __init__(self, amount, currency): self.amount = amount self.currency = currency.upper() def __repr__(self): return "%.2f %s" % (self.amount, self.currency)
Add reprensation method for Money class
Add reprensation method for Money class
Python
mit
mdsrosa/money-conversion-py
7fbcbaed02233eed41781adf665c0027d7b0e05f
src/geoserver/workspace.py
src/geoserver/workspace.py
from geoserver.support import atom_link, xml_property, write_bool, ResourceInfo import string def workspace_from_index(catalog, node): name = node.find("name") return Workspace(catalog, name.text) class Workspace(ResourceInfo): resource_type = "workspace" def __init__(self, catalog, name): a...
from geoserver.support import atom_link, xml_property, write_bool, ResourceInfo import string def workspace_from_index(catalog, node): name = node.find("name") return Workspace(catalog, name.text) class Workspace(ResourceInfo): resource_type = "workspace" def __init__(self, catalog, name): s...
Call superclass constructor for Workspace
Call superclass constructor for Workspace
Python
mit
cristianzamar/gsconfig,boundlessgeo/gsconfig,Geode/gsconfig,afabiani/gsconfig,garnertb/gsconfig.py,scottp-dpaw/gsconfig
43978f8c709d5f195229deb6ec7817a1815a4db6
sass_processor/storage.py
sass_processor/storage.py
# -*- coding: utf-8 -*- from django.conf import settings from django.contrib.staticfiles.finders import get_finders from django.core.files.storage import FileSystemStorage class SassFileStorage(FileSystemStorage): def __init__(self, location=None, base_url=None, *args, **kwargs): if location is None: ...
# -*- coding: utf-8 -*- from django.conf import settings from django.contrib.staticfiles.finders import get_finders from django.core.files.storage import FileSystemStorage class SassFileStorage(FileSystemStorage): def __init__(self, location=None, base_url=None, *args, **kwargs): if location is None: ...
Fix in case s3boto is not installed
Fix in case s3boto is not installed
Python
mit
jrief/django-sass-processor,jrief/django-sass-processor
142e361d2bcfbdc15939ad33c600bf943025f7b1
api/v1/serializers/no_project_serializer.py
api/v1/serializers/no_project_serializer.py
from core.models.user import AtmosphereUser from core.query import only_current, only_current_source from rest_framework import serializers from .application_serializer import ApplicationSerializer from .instance_serializer import InstanceSerializer from .volume_serializer import VolumeSerializer class NoProjectSeria...
from core.models.user import AtmosphereUser from core.query import only_current, only_current_source from rest_framework import serializers from .instance_serializer import InstanceSerializer from .volume_serializer import VolumeSerializer class NoProjectSerializer(serializers.ModelSerializer): instances = serial...
Remove final references to application
Remove final references to application
Python
apache-2.0
CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend
37da65953471b5dd0930e102b861878012938701
registration/__init__.py
registration/__init__.py
from django.utils.version import get_version as django_get_version VERSION = (0, 9, 0, 'beta', 1) def get_version(): return django_get_version(VERSION) # pragma: no cover
VERSION = (0, 9, 0, 'beta', 1) def get_version(): from django.utils.version import get_version as django_get_version return django_get_version(VERSION) # pragma: no cover
Move import of Django's get_version into django-registration's get_version, to avoid dependency-order problems.
Move import of Django's get_version into django-registration's get_version, to avoid dependency-order problems.
Python
bsd-3-clause
lubosz/django-registration,lubosz/django-registration
c02c3f4603c967c4e8df8314bfe0f4759cb0bca4
openprescribing/manage.py
openprescribing/manage.py
#!/usr/bin/env python import os import sys import dotenv if __name__ == "__main__": # We can't do read_dotenv('../environment') because that assumes that when # manage.py we are in its current directory, which isn't the case for cron # jobs. env_path = os.path.join( os.path.dirname(os.path.rea...
#!/usr/bin/env python import os import sys import dotenv if __name__ == "__main__": # We can't do read_dotenv('../environment') because that assumes that when # manage.py we are in its current directory, which isn't the case for cron # jobs. env_path = os.path.join( os.path.dirname(os.path.rea...
Set settings for e2e tests correctly
Set settings for e2e tests correctly
Python
mit
annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,ebmdatalab/openprescribing,ebmdatalab/openprescribing
13a25d26dc53f7a3c2f1a8706de26339035bea39
lib/bx/misc/bgzf_tests.py
lib/bx/misc/bgzf_tests.py
import bx.misc.bgzf def test_bgzf(): f = bx.misc.bgzf.BGZFFile( "../test_data/bgzf_tests/test.txt.gz" ) print f.read( 10 ) print f.seek( 0 ) print f.read( 10 ) test_bgzf()
import bx.misc.bgzf def test_bgzf(): f = bx.misc.bgzf.BGZFFile( "test_data/bgzf_tests/test.txt.gz" ) assert f.read( 10 ) == "begin 644 " print f.seek( 0 ) assert f.read( 10 ) == "begin 644 "
Make BGZF test a real unittest
Make BGZF test a real unittest
Python
mit
uhjish/bx-python,uhjish/bx-python,uhjish/bx-python
de1988304714b44e641a4c4ac50fa650887621d6
geoportail/geonames/views.py
geoportail/geonames/views.py
import unicodedata from django.http import HttpResponse from django.template.defaultfilters import slugify from django.utils.translation import ugettext as _ from .models import Town def autocomplete(request): if not 'q' in request.GET or len(request.GET['q']) < 3: response = HttpResponse() resp...
import json import unicodedata from django.http import HttpResponse from django.template.defaultfilters import slugify from django.utils.translation import ugettext as _ from .models import Town def autocomplete(request): if not 'q' in request.GET or len(request.GET['q']) < 3: response = HttpResponse() ...
Return JSON in the autocomplete view
Return JSON in the autocomplete view
Python
bsd-3-clause
brutasse/geoportail,brutasse/geoportail,brutasse/geoportail
44d1623e8b7c0922cb9138d5e589a7a9e51f7610
enactiveagents/model/perceptionhandler.py
enactiveagents/model/perceptionhandler.py
""" Module that holds classes that represent an agent's perception handler. """ import abc import world import structure class PerceptionHandler(object): """ Abstract perception handler class. """ @abc.abstractmethod def perceive(self, agent, world): """ Generates a percept given ...
""" Module that holds classes that represent an agent's perception handler. """ import abc import world import structure class PerceptionHandler(object): """ Abstract perception handler class. """ @abc.abstractmethod def perceive(self, agent, world): """ Generates a percept given ...
Add food to the perception handler
Add food to the perception handler
Python
mit
Beskhue/enactive-agents,Beskhue/enactive-agents,Beskhue/enactive-agents
c598306bd1f323f62167c6be33205019b53296b9
tests/test_vector2_negation.py
tests/test_vector2_negation.py
from hypothesis import given from ppb_vector import Vector2 from utils import vectors @given(vector=vectors()) def test_negation_scalar(vector: Vector2): assert - vector == (-1) * vector @given(vector=vectors()) def test_negation_involutive(vector: Vector2): assert vector == - (- vector)
from hypothesis import given from ppb_vector import Vector2 from utils import vectors @given(vector=vectors()) def test_negation_scalar(vector: Vector2): assert - vector == (-1) * vector @given(vector=vectors()) def test_negation_involutive(vector: Vector2): assert vector == - (- vector) @given(vector=vecto...
Test that negation is the additive inverse
tests/negation: Test that negation is the additive inverse
Python
artistic-2.0
ppb/ppb-vector,ppb/ppb-vector
dfb11ba136359e9624b05af2e065eac8d8cd5111
plankton/lcg/lcg.py
plankton/lcg/lcg.py
from collections import namedtuple from ..prng import PRNG class LCG(PRNG): LCGConstants = namedtuple('LCGConstants', ['a', # Multiplier 'c', # Increment 'm']) # Modulus def __init__(self): self._state ...
from collections import namedtuple from ..prng import PRNG class LCG(PRNG): LCGConstants = namedtuple('LCGConstants', ['a', # Multiplier 'c', # Increment 'm']) # Modulus def __init__(self): self._state ...
Use seed function in constructor since some LCGs might overwrite it.
Use seed function in constructor since some LCGs might overwrite it.
Python
mit
SpacePlant/Plankton
0bd82f80279348f101d09b8aa0955c8ab934533c
tests/window/WINDOW_CAPTION.py
tests/window/WINDOW_CAPTION.py
#!/usr/bin/env python '''Test that the window caption can be set. Expected behaviour: Two windows will be opened, one with the caption "Window caption 1" counting up every second; the other with a Unicode string including some non-ASCII characters. Press escape or close either window to finished the ...
#!/usr/bin/env python '''Test that the window caption can be set. Expected behaviour: Two windows will be opened, one with the caption "Window caption 1" counting up every second; the other with a Unicode string including some non-ASCII characters. Press escape or close either window to finished the ...
Make windows bigger in this test so the captions can be read.
Make windows bigger in this test so the captions can be read. Index: tests/window/WINDOW_CAPTION.py =================================================================== --- tests/window/WINDOW_CAPTION.py (revision 777) +++ tests/window/WINDOW_CAPTION.py (working copy) @@ -19,8 +19,8 @@ class WINDOW_CAPTION(unittest....
Python
bsd-3-clause
mpasternak/pyglet-fix-issue-552,kmonsoor/pyglet,odyaka341/pyglet,cledio66/pyglet,arifgursel/pyglet,cledio66/pyglet,shaileshgoogler/pyglet,gdkar/pyglet,arifgursel/pyglet,kmonsoor/pyglet,cledio66/pyglet,Austin503/pyglet,Austin503/pyglet,Alwnikrotikz/pyglet,mpasternak/michaldtz-fixes-518-522,arifgursel/pyglet,odyaka341/py...
d03250e1af17a40be3b9aa70fef67e50ab556a87
numba2/compiler/layout.py
numba2/compiler/layout.py
# -*- coding: utf-8 -*- """ Object layout. """ from __future__ import print_function, division, absolute_import from numba2 import conversion from pykit import types as ptypes from pykit.utils import ctypes_support #===------------------------------------------------------------------=== # Types #===--------------...
# -*- coding: utf-8 -*- """ Object layout. """ from __future__ import print_function, division, absolute_import from numba2 import conversion from pykit import types as ptypes from pykit.utils import ctypes_support #===------------------------------------------------------------------=== # Types #===--------------...
Remove some object representation clobbering code
Remove some object representation clobbering code
Python
bsd-2-clause
flypy/flypy,flypy/flypy
df25af8c12f824ee46a7bbf676f9adfcef5b1624
grazer/run.py
grazer/run.py
import click from dotenv import load_dotenv, find_dotenv from grazer.config import Config from grazer.core import crawler @click.command() @click.option("--env", default=find_dotenv()) @click.option("--config") def main(env, config): load_dotenv(env) cfg = Config(config) for record, link in crawler.creat...
import click import logging from dotenv import load_dotenv, find_dotenv from grazer.config import Config from grazer.core import crawler @click.command() @click.option("--env", default=find_dotenv()) @click.option("--config") @click.option("--log_level", default="INFO") def main(env, config, log_level): logging....
Allow to config log level
Allow to config log level
Python
mit
CodersOfTheNight/verata
b5fa5ed84b8427d052c0e1f494384e9fd06bfe6a
onadata/libs/mixins/mfa.py
onadata/libs/mixins/mfa.py
# coding: utf-8 from django.conf import settings from django.utils.translation import gettext as _ from rest_framework import exceptions from onadata.apps.main.models.user_profile import UserProfile class MFABlockerMixin: def validate_mfa_not_active(self, user: 'auth.User'): """ Raise an excepti...
# coding: utf-8 from django.conf import settings from django.utils.translation import gettext as _ from rest_framework import exceptions from onadata.apps.main.models.user_profile import UserProfile class MFABlockerMixin: def validate_mfa_not_active(self, user: 'auth.User'): """ Raise an excepti...
Use new translated string placeholder style
Use new translated string placeholder style
Python
bsd-2-clause
kobotoolbox/kobocat,kobotoolbox/kobocat,kobotoolbox/kobocat,kobotoolbox/kobocat
c6071093c35c2a83a683fe55788946ae99b38256
contacts/api.py
contacts/api.py
""" contacts.api ~~~~~~~~~~~~ This module implements the Contacts 📕 API. :copyright: (c) 2017 by David Heimann. :license: MIT, see LICENSE for more details. """ import vobject class ContactCard(object): """ A :class:`Contact Card <ContactCard>` object. :param name: Full Name (required). :param firs...
""" contacts.api ~~~~~~~~~~~~ This module implements the Contacts 📕 API. :copyright: (c) 2017 by David Heimann. :license: MIT, see LICENSE for more details. """ import vobject from .exceptions import ContactCreationException from .rules import ALLOWED_FIELDS class ContactCard(object): """ A :class:`Contact ...
Update CC Object to limit fields, use custom exception and rules
Update CC Object to limit fields, use custom exception and rules
Python
mit
heimann/contacts
f76015fdf37db44a54ce0e0038b4b85978c39839
tests/test_utils.py
tests/test_utils.py
# -*- coding: utf-8 -*- """Basic test suite. There are some 'noqa: F401' in this file to just test the isort import sorting. """ import __future__ # noqa: F401 import json # noqa: F401 from os import path # noqa: F401 from re import IGNORECASE, sub # noqa: F401 import my_module # noqa: F401 from my_module.util...
# -*- coding: utf-8 -*- """Basic test suite. There are some 'noqa: F401' in this file to just test the isort import sorting along with the code formatter. """ import __future__ # noqa: F401 import json # noqa: F401 from os import path # noqa: F401 from re import IGNORECASE, sub # noqa: F401 import click # noqa...
Add import statements breaking linter
Add import statements breaking linter
Python
apache-2.0
BastiTee/bastis-python-toolbox
6c9640cf0e9e8e187a61fc81f6c0eed0988601e1
apps/accounts/views.py
apps/accounts/views.py
from django.views.generic.list import ListView from django.views.generic.detail import DetailView from .models import UserProfile class UserProfileBase(object): model = UserProfile class UserProfileList(UserProfileBase, ListView): pass class UserProfileDetail(UserProfileBase, DetailView): pass
from django.views.generic.list import ListView from django.views.generic.detail import DetailView from .models import UserProfile class UserProfileBase(object): queryset = UserProfile.objects.all().select_related('user') class UserProfileList(UserProfileBase, ListView): pass class UserProfileDetail(UserP...
Make sure the 'user' object is available in the UserProfile queryset in the view.
Make sure the 'user' object is available in the UserProfile queryset in the view.
Python
bsd-3-clause
onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site
62705d28c826a213a42de504c041d56d72bd64df
examples/sparkfun_redbot/sparkfun_experiments/Exp2_DriveForward.py
examples/sparkfun_redbot/sparkfun_experiments/Exp2_DriveForward.py
#!/usr/bin/python3.4 """ Exp2_DriveForward -- RedBot Experiment 2 Drive forward and stop. Hardware setup: The Power switch must be on, the motors must be connected, and the board must be receiving power from the battery. The motor switch must also be switched to RUN. """ from pymata_aio.pymata3 import PyMa...
#!/usr/bin/python3.4 """ Exp2_DriveForward -- RedBot Experiment 2 Drive forward and stop. Hardware setup: The Power switch must be on, the motors must be connected, and the board must be receiving power from the battery. The motor switch must also be switched to RUN. """ from pymata_aio.pymata3 import PyMa...
Add a log to Exp2
Add a log to Exp2
Python
agpl-3.0
MrYsLab/pymata-aio
b9c3404550273e4b0af68ebe9da27c4bf405de9b
rohrpost/message.py
rohrpost/message.py
import json def _send_message(message, content: dict, close: bool): message.reply_channel.send({ 'text': json.dumps(content), 'close': close, }) def send_message(message, message_id, handler, close=False, error=None, **additional_data): content = dict() if message_id: content...
import json def _send_message(message, content: dict, close: bool): message.reply_channel.send({ 'text': json.dumps(content), 'close': close, }) def send_message(message, message_id, handler, close=False, error=None, **additional_data): content = dict() if message_id: content...
Remove superflous line, remove duplicate data
Remove superflous line, remove duplicate data
Python
mit
axsemantics/rohrpost,axsemantics/rohrpost
6cb0a6f35f4722f5e0b5e9b7c2028bbb6f278402
operation.py
operation.py
""" operation.py ~~~~~~~~~~~~~ This stores the information of each individual operation in the production line. - machine is the machine in which that operation will be executed - duration is the amount of time in which the operation will be completed - job is the set of operations needed to fully build a radiator ...
""" operation.py ~~~~~~~~~~~~~ This stores the information of each individual operation in the production line. - name improves readability when printing - machine is the machine in which that operation will be executed - duration is the amount of time in which the operation will be completed - job_model is the rad...
Update str() and add comments
Update str() and add comments
Python
mit
Irvel/JSSP-Genetic-Algorithm
6df115b41d18f7e74a0220550a04459d83d391d0
pox/lib/packet/__init__.py
pox/lib/packet/__init__.py
""" The POX packet library for packet parsing and creation. This is based heavily on NOX's packet library, though it has undergone some signficant change, particularly with regard to making packet assembly easier. Could still use more work. """ # None of this is probably that big, and almost all of it gets loaded # ...
""" The POX packet library for packet parsing and creation. This is based heavily on NOX's packet library, though it has undergone some signficant change, particularly with regard to making packet assembly easier. Could still use more work. """ # None of this is probably that big, and almost all of it gets loaded # ...
Add all submodules to import *
packet: Add all submodules to import * You can now access pox.lib.packet.icmp as pox.lib.packet.ICMP if you import the whole package (e.g., import pox.lib.packet as pkg). --HG-- extra : rebase_source : b48d05949977468a669bdd55caab7ac898689441
Python
apache-2.0
adusia/pox,diogommartins/pox,waltznetworks/pox,VamsikrishnaNallabothu/pox,PrincetonUniversity/pox,kulawczukmarcin/mypox,MurphyMc/pox,noxrepo/pox,carlye566/IoT-POX,kpengboy/pox-exercise,noxrepo/pox,chenyuntc/pox,denovogroup/pox,andiwundsam/_of_normalize,jacobq/csci5221-viro-project,carlye566/IoT-POX,kulawczukmarcin/mypo...
29a1c8f4eab13b5b17fffbd18a720b0ae5ab04b3
handoverservice/mail_draft/tests_ddsutil.py
handoverservice/mail_draft/tests_ddsutil.py
from django.test import TestCase from handover_api.models import User import mock import mail_draft from mail_draft.dds_util import DDSUtil class DDSUtilTestCase(TestCase): @mock.patch('ddsc.core.remotestore.RemoteStore') def testGetEmail(self, mockRemoteStore): user_id = 'abcd-1234-efgh-8876' ...
from django.test import TestCase from handover_api.models import User from django.core.exceptions import ObjectDoesNotExist import mock import mail_draft from mail_draft.dds_util import DDSUtil class DDSUtilTestCase(TestCase): @mock.patch('ddsc.core.remotestore.RemoteStore') def testGetEmail(self, mockRemoteS...
Add test for user does not exist
Add test for user does not exist
Python
mit
Duke-GCB/DukeDSHandoverService,Duke-GCB/DukeDSHandoverService,Duke-GCB/DukeDSHandoverService
60bf4d1457059b3cd53e5b37eab6d428ff4df511
src/artgraph/plugins/infobox.py
src/artgraph/plugins/infobox.py
from artgraph.plugins.plugin import Plugin from artgraph.node import Node, NodeTypes from artgraph.relationship import AssociatedActRelationship class InfoboxPlugin(Plugin): def __init__(self, node): self._node = node def get_nodes(self): wikicode = self.get_wikicode(self._node.get_tit...
from artgraph.plugins.plugin import Plugin class InfoboxPlugin(Plugin): def __init__(self, node): self._node = node def get_nodes(self): from artgraph.node import Node, NodeTypes from artgraph.relationship import AssociatedActRelationship wikicode = self.get_wi...
Fix imports to be able to import properly from the worker nodes
Fix imports to be able to import properly from the worker nodes
Python
mit
dMaggot/ArtistGraph
c544c0d2b8356125d1a5465b44617aaaaeab0ea1
scrapy/utils/ftp.py
scrapy/utils/ftp.py
import posixpath from ftplib import error_perm, FTP from posixpath import dirname def ftp_makedirs_cwd(ftp, path, first_call=True): """Set the current directory of the FTP connection given in the ``ftp`` argument (as a ftplib.FTP object), creating all parent directories if they don't exist. The ftplib.FTP...
import posixpath from ftplib import error_perm, FTP from posixpath import dirname def ftp_makedirs_cwd(ftp, path, first_call=True): """Set the current directory of the FTP connection given in the ``ftp`` argument (as a ftplib.FTP object), creating all parent directories if they don't exist. The ftplib.FTP...
Use context management with `FTP`
Use context management with `FTP`
Python
bsd-3-clause
eLRuLL/scrapy,scrapy/scrapy,dangra/scrapy,elacuesta/scrapy,pablohoffman/scrapy,pawelmhm/scrapy,pablohoffman/scrapy,eLRuLL/scrapy,starrify/scrapy,pawelmhm/scrapy,elacuesta/scrapy,scrapy/scrapy,elacuesta/scrapy,starrify/scrapy,scrapy/scrapy,dangra/scrapy,starrify/scrapy,pablohoffman/scrapy,pawelmhm/scrapy,eLRuLL/scrapy,d...
3483933b7e5709ef79a3f632bae09d24b22f4a44
pygp/likelihoods/__base.py
pygp/likelihoods/__base.py
""" Implementation of the squared-exponential kernels. """ # future imports from __future__ import division from __future__ import absolute_import from __future__ import print_function # global imports import abc # local imports from ..utils.models import Parameterized # exported symbols __all__ = ['Likelihood', 'R...
""" Implementation of the squared-exponential kernels. """ # future imports from __future__ import division from __future__ import absolute_import from __future__ import print_function # global imports import numpy as np import abc # local imports from ..utils.models import Parameterized # exported symbols __all__ ...
Fix bug in RealLikelihood due to not importing numpy.
Fix bug in RealLikelihood due to not importing numpy.
Python
bsd-2-clause
mwhoffman/pygp
e164a50432f4f133e07d864a1923852754924f34
byceps/services/authentication/service.py
byceps/services/authentication/service.py
""" byceps.services.authentication.service ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2018 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from ..user.models.user import User from ..user import service as user_service from .exceptions import AuthenticationFailed from .password ...
""" byceps.services.authentication.service ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2018 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from ..user.models.user import User from ..user import service as user_service from .exceptions import AuthenticationFailed from .password ...
Check for account activity before password verification
Check for account activity before password verification
Python
bsd-3-clause
m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps
c5fb6fc400e19cdeac3b2cf21ec94893b1c2e92d
srw/plotting.py
srw/plotting.py
import matplotlib.pyplot as plt def plot_transiting(lc, period, epoch, ax=None, unit='mjd', colour=None): if unit.lower() == 'jd': epoch -= 2400000.5 lc.compute_phase(period, epoch) if ax is None: ax = plt.gca() phase = lc.phase.copy() phase[phase > 0.8] -= 1.0 ax.errorbar(...
import matplotlib.pyplot as plt from astropy import units as u from .logs import get_logger logger = get_logger(__name__) try: import ds9 except ImportError: logger.warning('No ds9 package available. ' 'Related functions are not available') no_ds9 = True else: no_ds9 = False def p...
Add show on image function
Add show on image function
Python
mit
mindriot101/srw
92dc2888c52bf6f73c5a4924c7e10dcc450e3897
api/v2/serializers/details/boot_script.py
api/v2/serializers/details/boot_script.py
from core.models.boot_script import BootScript, ScriptType from core.models.user import AtmosphereUser from rest_framework import serializers class BootScriptSerializer(serializers.HyperlinkedModelSerializer): created_by = serializers.SlugRelatedField( slug_field='username', queryset=AtmosphereUser.object...
from core.models.boot_script import BootScript, ScriptType from core.models.user import AtmosphereUser from rest_framework import serializers class BootScriptSerializer(serializers.HyperlinkedModelSerializer): created_by = serializers.SlugRelatedField( slug_field='username', queryset=AtmosphereUser.object...
Fix 'boot script' serializer to allow 'created_by' to be inferred as the request.user
Fix 'boot script' serializer to allow 'created_by' to be inferred as the request.user
Python
apache-2.0
CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend
d18ae9c3e767e5b98db15731a03aad610aae4510
robber/matchers/contain.py
robber/matchers/contain.py
from robber import expect from robber.explanation import Explanation from robber.matchers.base import Base class Contain(Base): """ expect({'key': value}).to.contain('key 1', 'key 2', 'key n') expect([1, 2, 3]).to.contain(1, 2, 3) """ def matches(self): expected_list = list(self.args) ...
from robber import expect from robber.explanation import Explanation from robber.matchers.base import Base class Contain(Base): """ expect({'key': value}).to.contain('key 1', 'key 2', 'key n') expect([1, 2, 3]).to.contain(1, 2, 3) """ def matches(self): expected_list = list(self.args) ...
Use set's intersection and difference for better readability
[r] Use set's intersection and difference for better readability
Python
mit
vesln/robber.py
ad70c54f2cd5a66d62f61b26e12b18c3bbfba45d
cms/migrations/0012_auto_20150607_2207.py
cms/migrations/0012_auto_20150607_2207.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings import django.contrib.auth.models class Migration(migrations.Migration): dependencies = [ ('cms', '0011_auto_20150419_1006'), ] operations = [ migrat...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('cms', '0011_auto_20150419_1006'), ] operations = [ migrations.AlterField( model...
Format migration for Django 1.7
Format migration for Django 1.7
Python
bsd-3-clause
rryan/django-cms,mkoistinen/django-cms,netzkolchose/django-cms,jeffreylu9/django-cms,Vegasvikk/django-cms,youprofit/django-cms,saintbird/django-cms,memnonila/django-cms,irudayarajisawa/django-cms,cyberintruder/django-cms,czpython/django-cms,Jaccorot/django-cms,jeffreylu9/django-cms,qnub/django-cms,frnhr/django-cms,memn...
fe15498e745ce3a5f5e4c47f229ca6dbd5e921c5
tests/test_product_tags.py
tests/test_product_tags.py
from mock import Mock from django.contrib.staticfiles.templatetags.staticfiles import static from saleor.product.templatetags.product_images import ( get_thumbnail, product_first_image) def test_get_thumbnail(): instance = Mock() cropped_value = Mock(url='crop.jpg') thumbnail_value = Mock(url='thumb.j...
from mock import Mock from django.contrib.staticfiles.templatetags.staticfiles import static from saleor.product.templatetags.product_images import ( get_thumbnail, product_first_image) def test_get_thumbnail(): instance = Mock() cropped_value = Mock(url='crop.jpg') thumbnail_value = Mock(url='thumb.j...
Replace placeholder image in tests
Replace placeholder image in tests
Python
bsd-3-clause
KenMutemi/saleor,itbabu/saleor,HyperManTT/ECommerceSaleor,HyperManTT/ECommerceSaleor,maferelo/saleor,maferelo/saleor,tfroehlich82/saleor,KenMutemi/saleor,jreigel/saleor,itbabu/saleor,jreigel/saleor,UITools/saleor,HyperManTT/ECommerceSaleor,KenMutemi/saleor,itbabu/saleor,mociepka/saleor,mociepka/saleor,UITools/saleor,ma...
c28de968845f98c6590784df1fe5beff7b3d021e
workshops/templatetags/training_progress.py
workshops/templatetags/training_progress.py
from django import template from django.utils.safestring import mark_safe from workshops.models import TrainingProgress register = template.Library() @register.simple_tag def progress_label(progress): assert isinstance(progress, TrainingProgress) if progress.discarded: additional_label = 'default' ...
from django import template from django.template.defaultfilters import escape from django.utils.safestring import mark_safe from workshops.models import TrainingProgress register = template.Library() @register.simple_tag def progress_label(progress): assert isinstance(progress, TrainingProgress) if progres...
Fix unescaped content in training progress description templatetag
Fix unescaped content in training progress description templatetag This template tag was using content from entry notes directly. In cases of some users this messed up the display of label in the templates.
Python
mit
pbanaszkiewicz/amy,pbanaszkiewicz/amy,swcarpentry/amy,swcarpentry/amy,pbanaszkiewicz/amy,swcarpentry/amy
e85bfff982d14b556d2cab5d3b5535c37333cc3e
normandy/control/views.py
normandy/control/views.py
from django.views import generic from django.contrib.auth.mixins import LoginRequiredMixin from normandy.recipes.models import Recipe class IndexView(LoginRequiredMixin, generic.ListView): template_name = 'control/index.html' context_object_name = 'all_recipes_list' login_url = '/control/login/' def get_que...
from django.views import generic from django.contrib.auth.mixins import LoginRequiredMixin from normandy.recipes.models import Recipe class IndexView(LoginRequiredMixin, generic.ListView): template_name = 'control/index.html' context_object_name = 'all_recipes_list' login_url = '/control/login/' def get_que...
Remove limit on recipe list object
Remove limit on recipe list object
Python
mpl-2.0
Osmose/normandy,mozilla/normandy,mozilla/normandy,Osmose/normandy,Osmose/normandy,mozilla/normandy,mozilla/normandy,Osmose/normandy
8013e6b297ac79933a49760c7ba868a5419689b2
models/work_in_progress/src/train_ping.py
models/work_in_progress/src/train_ping.py
import graph # default data = ('iOS', 'iOS-wifi', 'AC', 'IC2012') models = ('constant', 'distance', 'countries', 'full') plot_dir = '../../report2/figures' show_plots = False oa_max_delay = [5000.] for d in data: print '#' * 70 print '#' * 3, d print '#' * 70 for m in models: print pr...
import graph # default data = ('iOS', 'iOS-wifi', 'AC', 'IC2012') models = ('constant', 'distance', 'countries', 'full') plot_dir = '../../report2/figures' show_plots = False oa_max_delay = [5000.] save = False ## save model #data = 'iOS', #models = 'full', #plot_dir = '' #save = True for d in data: print '#' ...
Add option to save model in script
Add option to save model in script
Python
bsd-3-clause
lisa-lab/pings,lisa-lab/pings,lisa-lab/pings,lisa-lab/pings
b0dbd7029f003538ddef9f3a5f8035f8691bf4d7
shuup/core/utils/shops.py
shuup/core/utils/shops.py
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. from shuup.core.models import Shop def get_shop_from_host(host):...
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. from shuup.core.models import Shop def get_shop_from_host(host):...
Make handle ports better when choosing shop
Make handle ports better when choosing shop Refs EE-235
Python
agpl-3.0
shoopio/shoop,shoopio/shoop,shoopio/shoop
864ca84558e9984399dd02fba611afdafd2d5015
silver/tests/factories.py
silver/tests/factories.py
import factory from silver.models import Provider class ProviderFactory(factory.django.DjangoModelFactory): class Meta: model = Provider
import factory from silver.models import Provider class ProviderFactory(factory.django.DjangoModelFactory): class Meta: model = Provider name = factory.Sequence(lambda n: 'Provider{cnt}'.format(cnt=n)) company = factory.Sequence(lambda n: 'Company{cnt}'.format(cnt=n)) address_1 = factory.Seq...
Update the factory for Provider
Update the factory for Provider
Python
apache-2.0
PressLabs/silver,PressLabs/silver,PressLabs/silver
55e8d525d7e06deeb6450eb5706f1f4ccbb11e66
index.py
index.py
def usage(): print("usage: " + sys.argv[0] + " -i directory-of-documents -d dictionary-file -p postings-file") if __name__ == '__main__': dir_doc = dict_file = postings_file = None try: opts, args = getopt.getopt(sys.argv[1:], 'i:d:p:') except getopt.GetoptError as err:i usage() sys.exit(2) fo...
from nltk.tokenize import word_tokenize, sent_tokenize import getopt import sys import os import io def usage(): print("usage: " + sys.argv[0] + " -i directory-of-documents -d dictionary-file -p postings-file") if __name__ == '__main__': dir_doc = dict_file = postings_file = None try: opts, args = getopt.getopt...
Add missing imports, correct indentation
Add missing imports, correct indentation
Python
mit
ikaruswill/boolean-retrieval,ikaruswill/vector-space-model
4416b7ce97ccf6d9b1abab59cd5a404cf5bfe3e9
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Jack Cherng # Copyright (c) 2015 jfcherng # https://github.com/jfcherng/SublimeLinter-contrib-iverilog # # License: MIT # import sublime from SublimeLinter.lint import Linter, util class Iverilog(Linter): # lin...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Jack Cherng # https://github.com/jfcherng/SublimeLinter-contrib-iverilog # Copyright (c) 2015 jfcherng # # License: MIT # import sublime from SublimeLinter.lint import Linter, util class Iverilog(Linter): # lin...
Add match error msg pattern like "<file>:<line>: syntax error"
Add match error msg pattern like "<file>:<line>: syntax error" This error msg is available in iverilog 0.10.0 (devel).
Python
mit
jfcherng/SublimeLinter-contrib-iverilog,jfcherng/SublimeLinter-contrib-iverilog
9d78bc8bbe8d0065debd8b4e5e72ed73f135ed63
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Ben Stoutenburgh # Copyright (c) 2016 Ben Stoutenburgh # # License: MIT # """This module exports the Bashate plugin class.""" from SublimeLinter.lint import Linter import os class Bashate(Linter): """Provides ...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Ben Stoutenburgh # Copyright (c) 2016 Ben Stoutenburgh # # License: MIT # """This module exports the Bashate plugin class.""" from SublimeLinter.lint import Linter import os class Bashate(Linter): """Provides ...
Remove deprecated attributes comment_re and check_version
Remove deprecated attributes comment_re and check_version
Python
mit
maristgeek/SublimeLinter-contrib-bashate
6cfd296a86c1b475101c179a45a7453b76dcbfd5
riak/util.py
riak/util.py
import collections def quacks_like_dict(object): """Check if object is dict-like""" return isinstance(object, collections.Mapping) def deep_merge(a, b): """Merge two deep dicts non-destructively Uses a stack to avoid maximum recursion depth exceptions >>> a = {'a': 1, 'b': {1: 1, 2: ...
try: from collections import Mapping except ImportError: # compatibility with Python 2.5 Mapping = dict def quacks_like_dict(object): """Check if object is dict-like""" return isinstance(object, Mapping) def deep_merge(a, b): """Merge two deep dicts non-destructively Uses a stack ...
Adjust for compatibility with Python 2.5
Adjust for compatibility with Python 2.5
Python
apache-2.0
basho/riak-python-client,GabrielNicolasAvellaneda/riak-python-client,GabrielNicolasAvellaneda/riak-python-client,bmess/riak-python-client,basho/riak-python-client,basho/riak-python-client,bmess/riak-python-client
05c31095ee828bfe455ad93befc5d189b9d0edc5
wallace/__init__.py
wallace/__init__.py
from . import models, information, agents, networks, processes __all__ = ['models', 'information', 'agents', 'sources', 'networks', 'processes']
from . import models, information, agents, networks, processes __all__ = ['models', 'information', 'agents', 'sources', 'networks', 'processes', 'transformations']
Add transformations to Wallace init
Add transformations to Wallace init
Python
mit
Dallinger/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,berkeley-cocosci/Wallace,berkeley-cocosci/Wallace,suchow/Wallace,Dallinger/Dallinger,Dallinger/Dallinger,suchow/Wallace,Dallinger/Dallinger,berkeley-cocosci/Wallace,jcpeterson/Dallinger,suchow/Wallace,Dallinger/Dalli...
1faaf698ca3fc33eb4bf8fc9e8ae87d4ec582486
spacy/fr/language_data.py
spacy/fr/language_data.py
# encoding: utf8 from __future__ import unicode_literals from .. import language_data as base from ..language_data import strings_to_exc, update_exc from .stop_words import STOP_WORDS STOP_WORDS = set(STOP_WORDS) TOKENIZER_EXCEPTIONS = strings_to_exc(base.EMOTICONS) update_exc(TOKENIZER_EXCEPTIONS, strings_to_exc...
# encoding: utf8 from __future__ import unicode_literals from .. import language_data as base from ..language_data import strings_to_exc, update_exc from .punctuation import ELISION from ..symbols import * from .stop_words import STOP_WORDS STOP_WORDS = set(STOP_WORDS) TOKENIZER_EXCEPTIONS = strings_to_exc(base....
Add infixes and abbreviation exceptions (fr)
Add infixes and abbreviation exceptions (fr)
Python
mit
recognai/spaCy,Gregory-Howard/spaCy,aikramer2/spaCy,recognai/spaCy,aikramer2/spaCy,recognai/spaCy,explosion/spaCy,explosion/spaCy,aikramer2/spaCy,explosion/spaCy,raphael0202/spaCy,recognai/spaCy,honnibal/spaCy,Gregory-Howard/spaCy,raphael0202/spaCy,explosion/spaCy,oroszgy/spaCy.hu,oroszgy/spaCy.hu,banglakit/spaCy,explo...
c69e74e229420161350eaf33e040dc00cd537b0b
tools/dev/wc-format.py
tools/dev/wc-format.py
#!/usr/bin/env python import os import sqlite3 import sys # helper def usage(): sys.stderr.write("USAGE: %s [PATH]\n" + \ "\n" + \ "Prints to stdout the format of the working copy at PATH.\n") # parse argv wc = (sys.argv[1:] + ['.'])[0] # main() entries = os.path.join(wc, '.s...
#!/usr/bin/env python import os import sqlite3 import sys def print_format(wc_path): entries = os.path.join(wc_path, '.svn', 'entries') wc_db = os.path.join(wc_path, '.svn', 'wc.db') if os.path.exists(entries): formatno = int(open(entries).readline()) elif os.path.exists(wc_db): conn = sqlite3.conne...
Allow script to take multiple paths, and adjust to standard __main__ idiom for cmdline scripts.
Allow script to take multiple paths, and adjust to standard __main__ idiom for cmdline scripts. * tools/dev/wc-format.py: (usage): remove. all paths are allowed. (print_format): move guts of format fetching and printing into this function. print 'not under version control' for such a path, rather than bail...
Python
apache-2.0
wbond/subversion,YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion,YueLinHo/Subversion,wbond/subversion,wbond/subversion,wbond/subversion,YueLinHo/Subversion,wbond/subversion,YueLinHo/Subversion,YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion,YueLinHo/Subversion
cb35c28ac04c4cfb6170d44b602403dc3cbf7205
avocado/management/base.py
avocado/management/base.py
from django.core.management.base import BaseCommand, CommandError from .utils import get_fields_by_label class DataFieldCommand(BaseCommand): args = '(app | app.model | app.model.field)*' def handle_fields(self, *args, **kwargs): raise NotImplemented('Subclasses must define this method.') def ha...
from django.core.management.base import BaseCommand, CommandError from .utils import get_fields_by_label class DataFieldCommand(BaseCommand): args = '[app | app.model | app.model.field]*' def handle_fields(self, *args, **kwargs): raise NotImplemented('Subclasses must define this method.') def ha...
Remove requirement in DataFieldCommand to pass labels
Remove requirement in DataFieldCommand to pass labels The behavior is now (naturally) defaults to all datafields
Python
bsd-2-clause
murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado
a06e6cc3c0b0440d3adedd1ccce78309d8fae9a9
feincms/module/page/extensions/navigationgroups.py
feincms/module/page/extensions/navigationgroups.py
""" Page navigation groups allow assigning pages to differing navigation lists such as header, footer and what else. """ from __future__ import absolute_import, unicode_literals from django.db import models from django.utils.translation import ugettext_lazy as _ from feincms import extensions class Extension(exten...
""" Page navigation groups allow assigning pages to differing navigation lists such as header, footer and what else. """ from __future__ import absolute_import, unicode_literals from django.db import models from django.utils.translation import ugettext_lazy as _ from feincms import extensions class Extension(exten...
Allow navigationgroup to be blank
Allow navigationgroup to be blank
Python
bsd-3-clause
joshuajonah/feincms,feincms/feincms,joshuajonah/feincms,joshuajonah/feincms,feincms/feincms,joshuajonah/feincms,feincms/feincms,mjl/feincms,mjl/feincms,mjl/feincms
3c1e90761bf6d046c3b462dcdddb75335c259433
rnacentral/portal/tests/rna_type_tests.py
rnacentral/portal/tests/rna_type_tests.py
from django.test import TestCase from portal.models import Rna class GenericRnaTypeTest(TestCase): def rna_type_of(self, upi, taxid=None): return Rna.objects.\ get(upi=upi).\ get_rna_type(taxid=taxid, recompute=True) def assertRnaTypeIs(self, description, upi, taxid=None): ...
from django.test import TestCase from portal.models import Rna class GenericRnaTypeTest(TestCase): def rna_type_of(self, upi, taxid=None): return Rna.objects.\ get(upi=upi).\ get_rna_type(taxid=taxid, recompute=True) def assertRnaTypeIs(self, description, upi, taxid=None): ...
Add test showing issue with rna_type
Add test showing issue with rna_type
Python
apache-2.0
RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode
bd22996e282328a72f3995a62078ce6867a158fc
tests/test_register.py
tests/test_register.py
import pytest from data import registers, fields, phases @pytest.mark.parametrize('register', registers) def test_register_key_matches_filename(register): assert registers[register].register == register @pytest.mark.parametrize('register', registers) def test_register_keys_are_known_fields(register): for f...
import pytest from data import registers, fields, phases @pytest.mark.parametrize('register', registers) def test_register_key_matches_filename(register): assert registers[register].register == register @pytest.mark.parametrize('register', registers) def test_register_primary_key_in_fields(register): asser...
Test primary key in register fields
Test primary key in register fields
Python
mit
openregister/registry-data
9305caf0bf2479b098703c8c7fb3b139f95576ec
vectorTiling.py
vectorTiling.py
import json import os from urlparse import urlparse import zipfile import click import adapters from filters import BasicFilterer import utils import subprocess @click.command() @click.argument('file', type=click.Path(exists=True), required=True) def vectorTiling(file): """ Function that creates vector tiles ...
import json import click import subprocess import utils import os import logging @click.command() @click.argument('sources', type=click.Path(exists=True), required=True) @click.argument('output', type=click.Path(exists=True), required=True) @click.argument('min_zoom', default=5) @click.argument('max_zoom', default...
Change of arguments, remove unused modules, source is now a directory
Change of arguments, remove unused modules, source is now a directory
Python
mit
OpenBounds/Processing
c6458e76c3c2323817ea32748e5ea6688986bede
zounds/persistence/util.py
zounds/persistence/util.py
import base64 import re import numpy as np TIMEDELTA_DTYPE_RE = re.compile(r'\[(?P<dtype>[^\]]+)\]') def encode_timedelta(td): dtype = TIMEDELTA_DTYPE_RE.search(str(td.dtype)).groupdict()['dtype'] return base64.b64encode(td.astype(np.uint64).tostring()), dtype def decode_timedelta(t): try: v = ...
import base64 import re import numpy as np TIMEDELTA_DTYPE_RE = re.compile(r'\[(?P<dtype>[^\]]+)\]') def encode_timedelta(td): dtype = TIMEDELTA_DTYPE_RE.search(str(td.dtype)).groupdict()['dtype'] return base64.b64encode(td.astype(np.uint64).tostring()), dtype def decode_timedelta(t): try: v = ...
Support the persistence of modules that accept arguments, provided that they have member variables that match the __init__ argument names
Support the persistence of modules that accept arguments, provided that they have member variables that match the __init__ argument names
Python
mit
JohnVinyard/zounds,JohnVinyard/zounds,JohnVinyard/zounds,JohnVinyard/zounds
1e393fb2bea443e98a591e781fb0827b33524fa0
mezzanine_editor/models.py
mezzanine_editor/models.py
from django.db import models from django.db.models.signals import post_syncdb from django.dispatch import receiver from django.contrib.auth.models import Group from mezzanine.conf import settings from mezzanine.blog.models import BlogPost @receiver(post_syncdb, sender=BlogPost) def create_default_editor_group(sender,...
from django.db import models from django.db.models.signals import post_syncdb from django.dispatch import receiver from django.contrib.auth.models import Group from mezzanine.conf import settings from mezzanine.blog.models import BlogPost @receiver(post_syncdb, sender=BlogPost) def create_default_editor_group(sender,...
Check for editor_mode before creating editor user.
Check for editor_mode before creating editor user.
Python
bsd-2-clause
renyi/mezzanine-editor
933e7b61f5d7c73924ea89a6ce17acf39e4f9c8d
packages/Python/lldbsuite/test/lang/c/unicode/TestUnicodeSymbols.py
packages/Python/lldbsuite/test/lang/c/unicode/TestUnicodeSymbols.py
# coding=utf8 import lldb from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil from lldbsuite.test.decorators import * class TestUnicodeSymbols(TestBase): mydir = TestBase.compute_mydir(__file__) @expectedFailureAll(compiler="clang", compiler_version=['<', '7.0']) def test_un...
# coding=utf8 import lldb from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil from lldbsuite.test.decorators import * class TestUnicodeSymbols(TestBase): mydir = TestBase.compute_mydir(__file__) @skipIf(compiler="clang", compiler_version=['<', '7.0']) def test_union_members(...
Change xfail to skipIf. The exact condition is really difficult to get right and doesn't add much signal.
Change xfail to skipIf. The exact condition is really difficult to get right and doesn't add much signal. git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@340574 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb
19bda5c7a2ebe38e856283423f64e1151eff4e80
parktain/tests/test_bot.py
parktain/tests/test_bot.py
"""Tests for the bot.""" def test_no_logger_crash_if_no_user(): # Given from parktain.main import logger user, channel, message = None, '#CTESTING', 'Hello!' # When # Then: Test fails if exception gets raised. logger(user, channel, message)
"""Tests for the bot.""" # Just setup db without any fixture magic. from parktain.main import Base, engine Base.metadata.create_all(engine) def test_no_logger_crash_if_no_user(): # Given from parktain.main import logger user, channel, message = None, '#CTESTING', 'Hello!' # When # Then: Test fai...
Create db before running tests.
Create db before running tests.
Python
bsd-3-clause
punchagan/parktain,punchagan/parktain,punchagan/parktain
95529efca6a2e3c3544aeb306aaf62a02f2f5408
primes.py
primes.py
import sys Max=int(sys.argv[1]) # get Max from command line args P = {x: True for x in range(2,Max)} # first assume numbers are prime for i in range(2, int(Max** (0.5))): # until square root of Max if P[i]: # for j in range(i*i, Max, i): # mark all multiples of a prime P[j]=False # as not beein...
import array import math import sys n = int(sys.argv[1]) nums = array.array('i', [False] * 2 + [True] * (n - 2)) upper_lim = int(math.sqrt(n)) i = 2 while i <= upper_lim: if nums[i]: m = i**2 while m < n: nums[m] = False m += i i += 1 print(len([x for x in nums if nums...
Make Python code equivalent to Ruby
Make Python code equivalent to Ruby Using a dictionary instead is really unfair. Small variation: m must not be equal to n. Not sure how the algorithm is meant is exactly...
Python
mit
oliworx/chartbench,oliworx/chartbench,oliworx/chartbench,oliworx/chartbench,oliworx/chartbench
c9d30e8873233adc84a6a7ed24423202e6538709
kindergarten-garden/kindergarten_garden.py
kindergarten-garden/kindergarten_garden.py
CHILDREN = ["Alice", "Bob", "Charlie", "David", "Eve", "Fred", "Ginny", "Harriet", "Ileana", "Joseph", "Kincaid", "Larry"] PLANTS = {"C": "Clover", "G": "Grass", "R": "Radishes", "V": "Violets"} class Garden(object): def __init__(self, garden, students=CHILDREN): self.students = sorted(student...
CHILDREN = ["Alice", "Bob", "Charlie", "David", "Eve", "Fred", "Ginny", "Harriet", "Ileana", "Joseph", "Kincaid", "Larry"] PLANTS = {"C": "Clover", "G": "Grass", "R": "Radishes", "V": "Violets"} class Garden(object): def __init__(self, garden, students=CHILDREN): self.students = sorted(student...
Use unpacking for simpler code
Use unpacking for simpler code
Python
agpl-3.0
CubicComet/exercism-python-solutions
acfc4ed37950f9bead0ffb1a66fc79851e3e93a1
Cython/CTypesBackend/CDefToDefTransform.py
Cython/CTypesBackend/CDefToDefTransform.py
from Cython.Compiler.Visitor import VisitorTransform from Cython.Compiler.Nodes import CSimpleBaseTypeNode class CDefToDefTransform(VisitorTransform): # Does not really turns cdefed function into defed function, it justs kills # the arguments and the return types of the functions, we rely on the # CodeWrit...
from Cython.Compiler.Visitor import VisitorTransform from Cython.Compiler.Nodes import CSimpleBaseTypeNode class CDefToDefTransform(VisitorTransform): # Does not really turns cdefed function into defed function, it justs kills # the arguments and the return types of the functions, we rely on the # CodeWrit...
Change the striping of parameters types (to be more robust)
Change the striping of parameters types (to be more robust)
Python
apache-2.0
rguillebert/CythonCTypesBackend,rguillebert/CythonCTypesBackend,rguillebert/CythonCTypesBackend,rguillebert/CythonCTypesBackend
07865610c4a44d827570949f06806cef3fbc4754
labs/05_conv_nets_2/solutions/geom_avg.py
labs/05_conv_nets_2/solutions/geom_avg.py
heatmap_1_r = resize(heatmap_1, (50,80), mode='reflect', preserve_range=True) heatmap_2_r = resize(heatmap_2, (50,80), mode='reflect', preserve_range=True) heatmap_3_r = resize(heatmap_3, (50,80), mode='reflect', preserve_range=True) heatmap_geom_avg = np.power(heatmap_1_r * heatmap_2_r * heatmap_3_r, 0.333) display_...
from skimage.transform import resize heatmap_1_r = resize(heatmap_1, (50,80), mode='reflect', preserve_range=True, anti_aliasing=True) heatmap_2_r = resize(heatmap_2, (50,80), mode='reflect', preserve_range=True, anti_aliasing=True) heatmap_3_r = resize(heatmap_3, (50,80), mode='reflect', preserve_range=True, anti_ali...
Fix missing import in solution
Fix missing import in solution
Python
mit
m2dsupsdlclass/lectures-labs,m2dsupsdlclass/lectures-labs
2134b43d2e071f7fa6a284d0c564c7990fb6be75
src/form_builder/admin.py
src/form_builder/admin.py
from form_builder.models import Form, Field, FormResponse, FieldResponse from django.contrib import admin class FieldInline(admin.StackedInline): model = Field extra = 1 class FormAdmin(admin.ModelAdmin): inlines = [FieldInline] class FieldResponseInline(admin.StackedInline): model = FieldResponse...
from form_builder.models import Form, Field, FormResponse, FieldResponse from django.contrib import admin class FieldInline(admin.StackedInline): model = Field extra = 1 class FormAdmin(admin.ModelAdmin): inlines = [FieldInline] list_display = ['title', 'date_created', 'end_date'] search_fields ...
Fix up the Django Admin a little bit
Fix up the Django Admin a little bit
Python
cc0-1.0
cfpb/collab-form-builder,cfpb/collab-form-builder,cfpb/collab-form-builder,cfpb/collab-form-builder
1a01f99014ead675ba7d043a204cd5f3c47d74b3
molecule/builder-trusty/tests/test_build_dependencies.py
molecule/builder-trusty/tests/test_build_dependencies.py
import pytest import os SECUREDROP_TARGET_PLATFORM = os.environ.get("SECUREDROP_TARGET_PLATFORM", "trusty") testinfra_hosts = [ "docker://{}-sd-app".format(SECUREDROP_TARGET_PLATFORM) ] def test_pip_wheel_installed(Command): """ Ensure `wheel` is installed via pip, for packaging Python dependenc...
import pytest import os SECUREDROP_TARGET_PLATFORM = os.environ.get("SECUREDROP_TARGET_PLATFORM", "trusty") testinfra_hosts = [ "docker://{}-sd-app".format(SECUREDROP_TARGET_PLATFORM) ] def test_pip_wheel_installed(Command): """ Ensure `wheel` is installed via pip, for packaging Python dependenc...
Fix test for wheel in Xenial and Trusty
Fix test for wheel in Xenial and Trusty
Python
agpl-3.0
conorsch/securedrop,heartsucker/securedrop,conorsch/securedrop,ehartsuyker/securedrop,conorsch/securedrop,ehartsuyker/securedrop,ehartsuyker/securedrop,heartsucker/securedrop,ehartsuyker/securedrop,conorsch/securedrop,heartsucker/securedrop,heartsucker/securedrop,ehartsuyker/securedrop,heartsucker/securedrop,conorsch/s...
48987cb9b5417232280482c681d3e055c1dee9a4
snap7/bin/snap7-server.py
snap7/bin/snap7-server.py
#!/usr/bin/env python """ This is an example snap7 server. It doesn't do much, but accepts connection. Usefull for running the python-snap7 test suite. """ import time import logging import snap7 def mainloop(): server = snap7.server.Server() size = 100 data = (snap7.types.wordlen_to_ctypes[snap7.types.S7...
#!/usr/bin/env python """ This is an example snap7 server. It doesn't do much, but accepts connection. Usefull for running the python-snap7 test suite. """ import time import logging import snap7 def mainloop(): server = snap7.server.Server() size = 100 data = (snap7.types.wordlen_to_ctypes[snap7.types.S7...
Add option to start server passing lib path
Add option to start server passing lib path
Python
mit
SimplyAutomationized/python-snap7,gijzelaerr/python-snap7,ellepdesk/python-snap7,SimplyAutomationized/python-snap7,ellepdesk/python-snap7
5abea2d21c62228eb9a7270a1e10f9f7ec4316af
source/services/rotten_tomatoes_service.py
source/services/rotten_tomatoes_service.py
import requests from bs4 import BeautifulSoup from source.models.rt_rating import RTRating class RottenTomatoesService: __URL = 'http://www.rottentomatoes.com/m/' __SEPERATOR = '_' def __init__(self, title): self.title = title def get_rt_rating(self): search_url = self.__URL + self...
import requests from bs4 import BeautifulSoup from source.models.rt_rating import RTRating class RottenTomatoesService: __URL = 'http://www.rottentomatoes.com/m/' __SEPERATOR = '_' def __init__(self, title): self.title = title def get_rt_rating(self): search_url = self.__URL + self...
Remove comma for RT search
Remove comma for RT search
Python
mit
jeremyrea/caterblu,jeremyrea/caterblu,jeremyrea/caterblu,jeremyrea/caterblu
25d39a7b78860102f7971033227ec157789a40b3
reporter/components/api_client.py
reporter/components/api_client.py
import json import os import requests class ApiClient: def __init__(self, host=None, timeout=5): self.host = host or self.__default_host() self.timeout = timeout def post(self, payload): print("Submitting payload to %s" % self.host) headers = {"Content-Type": "application/jso...
import json import os import requests class ApiClient: def __init__(self, host=None, timeout=5): self.host = host or self.__default_host().rstrip("/") self.timeout = timeout def post(self, payload): print("Submitting payload to %s" % self.host) headers = {"Content-Type": "app...
Update ApiClient host env var to CODECLIMATE_API_HOST
Update ApiClient host env var to CODECLIMATE_API_HOST This commit also strips trailing slashes from the host.
Python
mit
codeclimate/python-test-reporter,codeclimate/python-test-reporter
cad627a986f0d2ee897e9889e78473976cbeb69d
corehq/apps/app_manager/tests/test_suite.py
corehq/apps/app_manager/tests/test_suite.py
from django.utils.unittest.case import TestCase from corehq.apps.app_manager.models import Application from corehq.apps.app_manager.tests.util import TestFileMixin # snippet from http://stackoverflow.com/questions/321795/comparing-xml-in-a-unit-test-in-python/7060342#7060342 from doctest import Example from lxml.doct...
from django.utils.unittest.case import TestCase from casexml.apps.case.tests import check_xml_line_by_line from corehq.apps.app_manager.models import Application from corehq.apps.app_manager.tests.util import TestFileMixin # snippet from http://stackoverflow.com/questions/321795/comparing-xml-in-a-unit-test-in-python...
Revert "make test output a litte more intuitive"
Revert "make test output a litte more intuitive" This reverts commit e09fa453b1bb72f08053d13cc3050012a20ba724.
Python
bsd-3-clause
qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,SEL-Columbia/commcare-hq,gmimano/commcaretest,qedsoftware/commcare-hq,gmimano/commcaretest,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,qe...
84b4fc8fdc3808340293c076a1628bf0decd2d2c
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name="minishift-python", version="0.1.2", description="Python interface for the minishift", author="Nick Johnson", author_email="nick@arachnidlabs.com", url="https://github.com/arachnidlabs/minishift-python/", packages=["...
#!/usr/bin/env python from distutils.core import setup setup(name="minishift-python", version="0.1.3", description="Python interface for the minishift", author="Nick Johnson", author_email="nick@arachnidlabs.com", url="https://github.com/arachnidlabs/minishift-python/", packages=["...
Add python-daemon as a dep
Add python-daemon as a dep
Python
bsd-3-clause
arachnidlabs/minishift-python
dacff8c0006271fe020b915d0f51f4d23e86b00c
app/soc/modules/gsoc/logic/slot_transfer.py
app/soc/modules/gsoc/logic/slot_transfer.py
#!/usr/bin/env python2.5 # # Copyright 2011 the Melange authors. # # 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...
#!/usr/bin/env python2.5 # # Copyright 2011 the Melange authors. # # 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...
Modify the logic to get slot transfer entities to return all the entities per org.
Modify the logic to get slot transfer entities to return all the entities per org. The logic is now changed from having only one slot transfer entity per org to multiple slot transfer entities per org. --HG-- extra : rebase_source : d5526723d69356f4d076143f4dc537c7eeed74c0
Python
apache-2.0
rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son
f8aae767944cb6fe6163eb3eb99d08b12458060f
GoogleCalendarV3/setup.py
GoogleCalendarV3/setup.py
from distutils.core import setup setup( name='GoogleCalendarV3', version='0.1.1', author='Ashutosh Priyadarshy', author_email='static@siftcal.com', packages=['google_calendar_v3', 'google_calendar_v3.test'], scripts=['bin/example.py'], url='http://www.github.com/priyadarshy/google-calendar-...
from distutils.core import setup setup( name='GoogleCalendarV3', version='0.1.2', author='Ashutosh Priyadarshy', author_email='static@siftcal.com', packages=['google_calendar_v3', 'google_calendar_v3.test'], scripts=['bin/example.py'], url='http://www.github.com/priyadarshy/google-calendar-...
Update dependencies and update version.
Update dependencies and update version.
Python
apache-2.0
priyadarshy/google-calendar-v3,mbrondani/google-calendar-v3
613c01517288ef7d3170dd7ab4dc2d3541a77168
chainerrl/misc/is_return_code_zero.py
chainerrl/misc/is_return_code_zero.py
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() import os import subprocess def is_return_code_zero(args): """Return true iff the given comma...
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() import os import subprocess def is_return_code_zero(args): """Return true iff the given comma...
Fix ResourceWarning: unclosed file of devnull
Fix ResourceWarning: unclosed file of devnull
Python
mit
toslunar/chainerrl,toslunar/chainerrl
30917d894dd03af7a4f07230874921acf5bbfa08
dduplicated/fileManager.py
dduplicated/fileManager.py
import os def managerFiles(paths, link): first = True src = "" for path in paths: if first: first = False src = path print("PRESERVED: The file preserved is: \"" + path + "\"") else: os.remove(path) print("DELETE: File deleted: \"" + path + "\"") if link: os.symlink(src, path) print(...
import os from threading import Thread def _delete(path): os.remove(path) def _link(src, path): os.symlink(src, path) def manager_files(paths, link): # The first file is preserved to not delete all files in directories. first = True src = "" deleted_files = [] linked_files = [] errors = [] for path in pat...
Adjust spaces and names of variables. Add format of thread to delete and link files. Add to methods of link, delete results of files deleted, linked and with error to list and return for caller method.
Adjust spaces and names of variables. Add format of thread to delete and link files. Add to methods of link, delete results of files deleted, linked and with error to list and return for caller method. Signed-off-by: messiasthi <8562fc1efba9a3c99753c749fdfb1b6932b70fbf@gmail.com>
Python
mit
messiasthi/dduplicated-cli
6499c06d1f574b8593e3ede7529cfe6532a001c1
src/mailme/constants.py
src/mailme/constants.py
# Folder name mappings, based on http://tools.ietf.org/html/rfc6154 INBOX = 'inbox' DRAFTS = 'drafts' SPAM = 'spam' ARCHIVE = 'archive' SENT = 'sent' TRASH = 'trash' ALL = 'all' IMPORTANT = 'important' # Default mapping to unify various provider behaviors DEFAULT_FOLDER_MAPPING = { 'inbox': INBOX, 'drafts': D...
# Folder name mappings, based on http://tools.ietf.org/html/rfc6154 INBOX = 'inbox' DRAFTS = 'drafts' SPAM = 'spam' ARCHIVE = 'archive' SENT = 'sent' TRASH = 'trash' ALL = 'all' IMPORTANT = 'important' # Default mapping to unify various provider behaviors DEFAULT_FOLDER_MAPPING = { 'inbox': INBOX, 'drafts': D...
Add flag mapping to match folder roles
Add flag mapping to match folder roles
Python
bsd-3-clause
mailme/mailme,mailme/mailme
223aca4365e8fa3f5311ed15ede4cc30792bafca
scripts/cluster/craq/restart_craq_local.py
scripts/cluster/craq/restart_craq_local.py
#!/usr/bin/python import sys import subprocess import time def main(): print "Starting zookeeper" subprocess.Popen('./cluster/zookeeper/start_zookeeper.sh', shell=True) print "Finished starting zookeeper" time.sleep(45) print "Starting Craqs" subprocess.Popen(['python', './cluster/...
#!/usr/bin/python import sys import subprocess import time def main(): print "Starting zookeeper" subprocess.Popen('./cluster/zookeeper/start_zookeeper.sh', shell=True) print "Finished starting zookeeper" time.sleep(45) print "Starting Craqs" subprocess.Popen('./cluster/craq/start_...
Fix paths to start_craq scripts.
Fix paths to start_craq scripts.
Python
bsd-3-clause
sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata
b263ebe89eaf162540f0437a6a7a01848bffe587
kpi/deployment_backends/kc_access/storage.py
kpi/deployment_backends/kc_access/storage.py
# coding: utf-8 from django.conf import settings as django_settings from django.core.files.storage import FileSystemStorage from storages.backends.s3boto3 import S3Boto3Storage def get_kobocat_storage(): """ Return an instance of a storage object depending on the setting `KOBOCAT_DEFAULT_FILE_STORAGE` val...
# coding: utf-8 from django.conf import settings as django_settings from django.core.files.storage import FileSystemStorage from storages.backends.s3boto3 import S3Boto3Storage def get_kobocat_storage(): """ Return an instance of a storage object depending on the setting `KOBOCAT_DEFAULT_FILE_STORAGE` val...
Fix KoboS3Storage deprecated bucket and acl arguments
Fix KoboS3Storage deprecated bucket and acl arguments
Python
agpl-3.0
kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi
1af44acebd1d8571f6153df61946857e7cf32154
setup.py
setup.py
# setup.py file for texlib from distutils.core import setup setup(name = 'texlib', version = '0.01', description = ("A package of Python modules for dealing with " "various TeX-related file formats."), author = 'A.M. Kuchling', author_email = 'akuchlin@mems-exchange.org', ...
# setup.py file for texlib from distutils.core import setup setup(name = 'texlib', version = '0.01', description = ("A package of Python modules for dealing with " "various TeX-related file formats."), author = 'A.M. Kuchling', author_email = 'amk@amk.ca', packages = ['t...
Update e-mail address; remove obsolete web page
Update e-mail address; remove obsolete web page
Python
mit
akuchling/texlib