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
efb14d75d04d0200b37af1c4c3bb50b61f0b2a7e
km3pipe/__init__.py
km3pipe/__init__.py
# coding=utf-8 # Filename: __init__.py """ The extemporary KM3NeT analysis framework. """ from __future__ import division, absolute_import, print_function try: __KM3PIPE_SETUP__ except NameError: __KM3PIPE_SETUP__ = False from .__version__ import version, version_info # noqa if not __KM3PIPE_SETUP__: ...
# coding=utf-8 # Filename: __init__.py """ The extemporary KM3NeT analysis framework. """ from __future__ import division, absolute_import, print_function try: __KM3PIPE_SETUP__ except NameError: __KM3PIPE_SETUP__ = False from .__version__ import version, version_info # noqa if not __KM3PIPE_SETUP__: ...
FIX also drop genericpump/h5pump from init
FIX also drop genericpump/h5pump from init
Python
mit
tamasgal/km3pipe,tamasgal/km3pipe
46bcad1e20e57f66498e7a70b8f3be929115bde6
incunafein/module/page/extensions/prepared_date.py
incunafein/module/page/extensions/prepared_date.py
from django.db import models def get_prepared_date(cls): return cls.prepared_date or cls.parent.prepared_date def register(cls, admin_cls): cls.add_to_class('prepared_date', models.TextField('Date of Preparation', blank=True, null=True)) cls.add_to_class('get_prepared_date', get_prepared_date)
from django.db import models def register(cls, admin_cls): cls.add_to_class('_prepared_date', models.TextField('Date of Preparation', blank=True, null=True)) def getter(): if not cls._prepared_date: try: return cls.get_ancestors(ascending=True).filter(_prepared_date__isnull...
Return parent date if there isn't one on the current object
Return parent date if there isn't one on the current object Look for a prepared date in the ancestors of the current object and use that if it exists
Python
bsd-2-clause
incuna/incuna-feincms,incuna/incuna-feincms,incuna/incuna-feincms
83bf2da38eb67abab9005495289eb97b58c3856a
ec2_instance_change_type.py
ec2_instance_change_type.py
#!/usr/bin/env python import sys import click from aws_util import Ec2Util @click.command() @click.option('-p', '--profile', default='default', help='Profile name to use.') @click.argument('id_or_tag', required=True) @click.argument('new_instance_type', required=True) def cli(profile, id_or_tag, new_instance_type): ...
#!/usr/bin/env python import sys import click from aws_util import Ec2Util @click.command() @click.option('-p', '--profile', default='default', help='Profile name to use.') @click.argument('id_or_tag', required=True) @click.argument('new_instance_type', required=True) def cli(profile, id_or_tag, new_instance_type): ...
Change message that detects instance type
Change message that detects instance type
Python
mit
thinhpham/aws-tools
e867722e4369fca2df9a4e07218815c7611f35be
examples/timeflies/timeflies_tkinter.py
examples/timeflies/timeflies_tkinter.py
from tkinter import Tk, Label, Frame from rx import from_ from rx import operators as _ from rx.subjects import Subject from rx.concurrency import TkinterScheduler def main(): root = Tk() root.title("Rx for Python rocks") scheduler = TkinterScheduler(root) mousemove = Subject() frame = Frame(ro...
from tkinter import Tk, Label, Frame import rx from rx import operators as ops from rx.subjects import Subject from rx.concurrency import TkinterScheduler def main(): root = Tk() root.title("Rx for Python rocks") scheduler = TkinterScheduler(root) mousemove = Subject() frame = Frame(root, width...
Use ops instead of _
Use ops instead of _
Python
mit
ReactiveX/RxPY,ReactiveX/RxPY
2181d63c279965e4e694cae508a236f51d66d49b
data_structures/bitorrent/server/announce/torrent.py
data_structures/bitorrent/server/announce/torrent.py
import struct import socket import time from trackpy.vendors.redis import redis class Torrent(object): def __init__(self, info_hash): self.info = redis.hgetall(info_hash) self.info_hash = info_hash def can_announce(self, peer_id): timestamp = int(redis.get("%s_%s" % (self.info_hash, peer_id)) or 0) ...
import struct import socket import time from trackpy.vendors.redis import redis class Torrent(object): def __init__(self, info_hash): self.info = redis.hgetall(info_hash) self.info_hash = info_hash def can_announce(self, peer_id): timestamp = int(redis.get("%s_%s" % (self.info_hash, peer_id)) or 0) ...
Implement binary representation of peers
Implement binary representation of peers
Python
apache-2.0
vtemian/university_projects,vtemian/university_projects,vtemian/university_projects
8b3ad1ea09c1fd8f2d433e79497eb51d9f32f4c7
osversion.py
osversion.py
#!/usr/bin/env python3 # file: osversion.py # vim:fileencoding=utf-8:fdm=marker:ft=python # # Author: R.F. Smith <rsmith@xs4all.nl> # Created: 2018-04-06 22:34:00 +0200 # Last modified: 2018-07-06T22:54:44+0200 from ctypes import CDLL with open('/usr/include/osreldate.h') as h: lines = h.readlines() line = [ln fo...
#!/usr/bin/env python3 # file: osversion.py # vim:fileencoding=utf-8:fdm=marker:ft=python # # Author: R.F. Smith <rsmith@xs4all.nl> # Created: 2018-04-06 22:34:00 +0200 # Last modified: 2018-08-19T14:18:16+0200 """Print the __FreeBSD_version. This is also called OSVERSION in scripts.""" from ctypes import CDLL import ...
Print a warning and exit when not run on FreeBSD.
Print a warning and exit when not run on FreeBSD.
Python
mit
rsmith-nl/scripts,rsmith-nl/scripts
d17f14b693d770618de559bd71a277c3771ccc8e
src/events/views.py
src/events/views.py
from django.http import Http404 from django.views.generic import DetailView, ListView, RedirectView from proposals.models import TalkProposal from .models import SponsoredEvent class AcceptedTalkMixin: queryset = ( TalkProposal.objects .filter(accepted=True) .select_related('submitter') ...
from django.http import Http404 from django.views.generic import DetailView, ListView, RedirectView from proposals.models import TalkProposal from .models import SponsoredEvent class AcceptedTalkMixin: queryset = ( TalkProposal.objects .filter(accepted=True) .select_related('submitter') ...
Make sponsored event redirect permanent (HTTP 301)
Make sponsored event redirect permanent (HTTP 301)
Python
mit
pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016
8cbac87d73f361bd6d623cbe58d188dd9cc518ce
ext_pylib/input/__init__.py
ext_pylib/input/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ext_pylib.input ~~~~~~~~~~~~~~~~ Functions for displaying and handling input on the terminal. """ from __future__ import absolute_import # Use Python 3 input if possible try: INPUT = input except NameError: INPUT = raw_input # pylint: disable=wrong-import-p...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ext_pylib.input ~~~~~~~~~~~~~~~~ Functions for displaying and handling input on the terminal. """ from __future__ import absolute_import # Use Python 2 input unless raw_input doesn't exist try: INPUT = raw_input except NameError: INPUT = input # pylint: dis...
Use raw_input [py2] first, then resort to input [py3].
BUGFIX: Use raw_input [py2] first, then resort to input [py3].
Python
mit
hbradleyiii/ext_pylib
99354752661828451732fdf317c5f2742a86733e
api/base/exceptions.py
api/base/exceptions.py
from rest_framework import status from rest_framework.exceptions import APIException def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid errors when the OSF is loaded without Django from rest_framework.view...
from rest_framework import status from rest_framework.exceptions import APIException def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid errors when the OSF is loaded without Django from rest_framework.view...
Change source to point to which part of the request caused the error, and add the specific reason to detail
Change source to point to which part of the request caused the error, and add the specific reason to detail
Python
apache-2.0
aaxelb/osf.io,brianjgeiger/osf.io,felliott/osf.io,chennan47/osf.io,mluo613/osf.io,crcresearch/osf.io,billyhunt/osf.io,asanfilippo7/osf.io,ticklemepierce/osf.io,kwierman/osf.io,samchrisinger/osf.io,brianjgeiger/osf.io,icereval/osf.io,RomanZWang/osf.io,Johnetordoff/osf.io,erinspace/osf.io,arpitar/osf.io,arpitar/osf.io,ab...
0667b4b1c8660feb2c1bdf09562fe51700db620b
app/models/__init__.py
app/models/__init__.py
# Copyright (C) 2014 Linaro Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distribute...
# Copyright (C) 2014 Linaro Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distribute...
Add new status (unknown), and necessary build files.
Add new status (unknown), and necessary build files.
Python
lgpl-2.1
kernelci/kernelci-backend,joyxu/kernelci-backend,joyxu/kernelci-backend,kernelci/kernelci-backend,joyxu/kernelci-backend
624ded5833e25d6a51671255fd32208ff947b22f
sconsole/manager.py
sconsole/manager.py
# Import third party libs import urwid # Import sconsole libs import sconsole.cmdbar import sconsole.static FOOTER = [ ('title', 'Salt Console'), ' ', ('key', 'UP'), ' ', ('key', 'DOWN'), ' '] class Manager(object): def __init__(self, opts): self.opts = opts self.cmdba...
# Import third party libs import urwid # Import sconsole libs import sconsole.cmdbar import sconsole.static FOOTER = [ ('title', 'Salt Console'), ' ', ('key', 'UP'), ' ', ('key', 'DOWN'), ' '] class Manager(object): def __init__(self, opts): self.opts = opts self.cmdba...
Fix refs to body of sconsole
Fix refs to body of sconsole
Python
apache-2.0
saltstack/salt-console
5b0e750c70759f79e6ea5dce051f1c29726ac71c
scoreboard/tests.py
scoreboard/tests.py
from django.test import TestCase from django.utils import timezone as tz from scoreboard.models import * class GameUnitTests(TestCase): @classmethod def setUpClass(cls): super(GameUnitTests, cls).setUpClass() cls.home_team = Team.objects.create(name='Home') cls.visiting_team = Team.ob...
from django.test import TestCase from django.utils import timezone as tz from scoreboard.models import * class GameUnitTests(TestCase): @classmethod def setUpClass(cls): super(GameUnitTests, cls).setUpClass() cls.home_team = Team.objects.create(name='Home') cls.visiting_team = Team.ob...
Fix failing test and add 2 more
Fix failing test and add 2 more
Python
mit
jspitzen/lacrosse_scoreboard,jspitzen/lacrosse_scoreboard
9387dfd4cc39fa6fbbf66147ced880dffa6408bd
keystone/server/flask/__init__.py
keystone/server/flask/__init__.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Make keystone.server.flask more interesting for importing
Make keystone.server.flask more interesting for importing Importing keystone.server.flask now exposes all the relevant bits from the sub modules to develop APIs without needing to understand all the underlying modules. __all__ has also be setup in a meaningful way to allow for `from keystone.server.flask import *` and...
Python
apache-2.0
openstack/keystone,openstack/keystone,mahak/keystone,openstack/keystone,mahak/keystone,mahak/keystone
31ea614e783273ef14919d1628a7ada11e8850fd
apps/users/adapters.py
apps/users/adapters.py
import re from allauth.account.adapter import DefaultAccountAdapter from django.conf import settings from apps.contrib.emails import Email from apps.users import USERNAME_INVALID_MESSAGE from apps.users import USERNAME_REGEX class UserAccountEmail(Email): def get_receivers(self): return [self.object] ...
import re from allauth.account.adapter import DefaultAccountAdapter from django.conf import settings from adhocracy4.emails.mixins import SyncEmailMixin from apps.contrib.emails import Email from apps.users import USERNAME_INVALID_MESSAGE from apps.users import USERNAME_REGEX class UserAccountEmail(Email, SyncEmail...
Use SyncEmailMixin for account mails
Use SyncEmailMixin for account mails
Python
agpl-3.0
liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin
f22476a36f2096628dc336f9adf0caa9a827dc11
jfr_playoff/db.py
jfr_playoff/db.py
import sys class PlayoffDB(object): db_cursor = None DATABASE_NOT_CONFIGURED_WARNING = 'WARNING: database not configured' def __init__(self, settings): reload(sys) sys.setdefaultencoding("latin1") import mysql.connector self.database = mysql.connector.connect( ...
import sys class PlayoffDB(object): db_cursor = None DATABASE_NOT_CONFIGURED_WARNING = 'WARNING: database not configured' def __init__(self, settings): reload(sys) sys.setdefaultencoding("latin1") import mysql.connector self.database = mysql.connector.connect( ...
Fix for rethrowing mysql.connector.Error as IOError
Fix for rethrowing mysql.connector.Error as IOError
Python
bsd-2-clause
emkael/jfrteamy-playoff,emkael/jfrteamy-playoff
e3b0ccb529dca19bb3882f9caad82dbd965c9ae0
onnx/__init__.py
onnx/__init__.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from .onnx_pb2 import * import sys def load(obj): ''' Loads a binary protobuf that stores onnx graph @params Takes a file-like object (has to implement...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from .onnx_pb2 import * import sys def load(obj): ''' Loads a binary protobuf that stores onnx graph @params Takes a file-like object (has "read" funct...
Fix string/file-like object detection in onnx.load
Fix string/file-like object detection in onnx.load
Python
apache-2.0
onnx/onnx,onnx/onnx,onnx/onnx,onnx/onnx
371be140dfbecff72d72cda580cd299badc6bc15
aws_list_all/client.py
aws_list_all/client.py
import boto3 _CLIENTS = {} def get_regions_for_service(service, regions=()): """Given a service name, return a list of region names where this service can have resources, restricted by a possible set of regions.""" if service == "s3": return ['us-east-1'] # s3 ListBuckets is a global request, so...
import boto3 _CLIENTS = {} def get_regions_for_service(service, regions=()): """Given a service name, return a list of region names where this service can have resources, restricted by a possible set of regions.""" if service == "s3": return ['us-east-1'] # s3 ListBuckets is a global request, so...
Use us-east-1 to query route53
Use us-east-1 to query route53 Route53 is a global service so doesn't belong to a region, but the API endpoint is in us-east-1. This makes various listings now work, but not record sets. Updates #4.
Python
mit
JohannesEbke/aws_list_all
945aba9548b92f57fc25f9996bfa9c3811e64deb
server/resources.py
server/resources.py
from flask import request from flask_restful import Resource, Api, abort, reqparse from .models import db, Comment, Lecture api = Api() class CommentListResource(Resource): def get(self, lecture_id): db_lecture = Lecture.query.filter(Lecture.id == lecture_id).first() if not db_lecture: ...
from flask import request from flask_restful import Resource, Api, abort, reqparse from .models import db, Comment, Lecture api = Api() class CommentListResource(Resource): def get(self, lecture_id): db_lecture = Lecture.query.filter(Lecture.id == lecture_id).first() if not db_lecture: ...
Change single Lecture query to use first() in stead of all()
Change single Lecture query to use first() in stead of all()
Python
mit
MACSIFS/IFS,MACSIFS/IFS,MACSIFS/IFS,MACSIFS/IFS
8fb6f506bae11377ca3e3d040ce31d81eaa81d3e
localore/people/wagtail_hooks.py
localore/people/wagtail_hooks.py
from wagtailmodeladmin.options import ModelAdmin, wagtailmodeladmin_register from .models import Person class PeopleAdmin(ModelAdmin): model = Person menu_icon = 'group' menu_label = 'Team' menu_order = 300 list_display = ('full_name', 'production', 'role') list_filter = ('role', 'production')...
from django.utils.html import format_html from wagtailmodeladmin.options import ModelAdmin, wagtailmodeladmin_register from .models import Person class PeopleAdmin(ModelAdmin): model = Person menu_icon = 'group' menu_label = 'Team' menu_order = 300 list_display = ('profile_photo', 'full_name', '...
Add profile photos to list of people.
Add profile photos to list of people.
Python
mpl-2.0
ghostwords/localore,ghostwords/localore,ghostwords/localore
116735d900b9ad92ae8ad265e5478f232e1474be
cartesius/colors.py
cartesius/colors.py
# -*- coding: utf-8 -*- """ Utility functions folr colors """ def get_color(color): """ Can convert from integer to (r, g, b) """ if not color: return None if isinstance(color, int): temp = color blue = temp % 256 temp = temp / 256 green = temp % 256 temp...
# -*- coding: utf-8 -*- """ Utility functions folr colors """ def get_color(color): """ Can convert from integer to (r, g, b) """ if not color: return None if isinstance(color, int): temp = color blue = temp % 256 temp = int(temp / 256) green = temp % 256 ...
Fix for integer division error:
Fix for integer division error: $ python3 create_images_and_readme.py Processing <function test_circles at 0x10cda6400> written: graph-0-0.png written: graph-0-1.png Processing <function test_piechart_1 at 0x10d1d4a60> written: graph-1-0.png written: graph-1-1.png Processing <function test_piechart_2 at 0x10d1ed1e0> w...
Python
apache-2.0
tkrajina/cartesius,tkrajina/cartesius
06d6f8d70d09214dbdcff2af2637deeb025cd22e
radar/radar/validation/family_histories.py
radar/radar/validation/family_histories.py
from radar.validation.groups import CohortGroupValidationMixin from radar.validation.core import Field, Validation from radar.validation.meta import MetaValidationMixin from radar.validation.patients import PatientValidationMixin from radar.validation.validators import required, none_if_blank, optional, max_length, in_...
from radar.validation.groups import CohortGroupValidationMixin from radar.validation.core import Field, Validation from radar.validation.meta import MetaValidationMixin from radar.validation.patients import PatientValidationMixin from radar.validation.validators import required, none_if_blank, optional, max_length, in_...
Clear relatives if no family history
Clear relatives if no family history
Python
agpl-3.0
renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar
dbe5e67d2685083769e7d154926e6a1a234fa3c4
src/livestreamer/stream.py
src/livestreamer/stream.py
from livestreamer.utils import urlopen import pbs class StreamError(Exception): pass class Stream(object): def open(self): raise NotImplementedError class RTMPStream(Stream): def __init__(self, params): self.params = params or {} def open(self): try: rtmpdump = pb...
from livestreamer.utils import urlopen import os import pbs class StreamError(Exception): pass class Stream(object): def open(self): raise NotImplementedError class RTMPStream(Stream): def __init__(self, params): self.params = params or {} def open(self): try: rtm...
Fix rtmpdump locking up when stderr buffer is filled.
Fix rtmpdump locking up when stderr buffer is filled.
Python
bsd-2-clause
charmander/livestreamer,sbstp/streamlink,wolftankk/livestreamer,bastimeyer/streamlink,caorong/livestreamer,breunigs/livestreamer,lyhiving/livestreamer,breunigs/livestreamer,okaywit/livestreamer,derrod/livestreamer,fishscene/streamlink,back-to/streamlink,streamlink/streamlink,wlerin/streamlink,melmorabity/streamlink,sbs...
cf22defd6a705cab79bc24b82377e23b9d798dbf
nopassword/backends/base.py
nopassword/backends/base.py
# -*- coding: utf-8 -*- from datetime import datetime, timedelta from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth.backends import ModelBackend from nopassword.models import LoginCode class NoPasswordBackend(ModelBackend): def authenticate(self, request, u...
# -*- coding: utf-8 -*- from datetime import timedelta from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth.backends import ModelBackend from django.utils import timezone from nopassword.models import LoginCode class NoPasswordBackend(ModelBackend): def authe...
Use timezone.now() instead of datetime.now()
fix: Use timezone.now() instead of datetime.now()
Python
mit
relekang/django-nopassword,relekang/django-nopassword
a5befe542e857ec36717f7f8da53ff9f2c2af7e6
natasha/__init__.py
natasha/__init__.py
from copy import copy from collections import deque from yargy import FactParser from natasha.grammars import Person, Geo class Combinator(object): DEFAULT_GRAMMARS = [ Person, Geo, ] def __init__(self, grammars=None, cache_size=50000): self.grammars = grammars or self.DEFAULT_...
from copy import copy from collections import deque from yargy import FactParser from natasha.grammars import Person, Geo, Money, Date class Combinator(object): DEFAULT_GRAMMARS = [ Money, Person, Geo, Date, ] def __init__(self, grammars=None, cache_size=50000): ...
Add new grammars to Combinator.DEFAULT_GRAMMARS
Add new grammars to Combinator.DEFAULT_GRAMMARS
Python
mit
natasha/natasha
95bac0b68e271d7ad5a4f8fa22c441d18a65390c
client/serial_datagrams.py
client/serial_datagrams.py
import struct from zlib import crc32 class CRCMismatchError(RuntimeError): """ Error raised when a datagram has an invalid CRC. """ pass class FrameError(RuntimeError): """ Error raised when a datagram is too short to be valid. """ END = b'\xC0' ESC = b'\xDB' ESC_END = b'\xDC' ESC_ESC = b...
import struct from zlib import crc32 class CRCMismatchError(RuntimeError): """ Error raised when a datagram has an invalid CRC. """ pass class FrameError(RuntimeError): """ Error raised when a datagram is too short to be valid. """ END = b'\xC0' ESC = b'\xDB' ESC_END = b'\xDC' ESC_ESC = b...
Correct crc32 behaviour for all python versions.
Correct crc32 behaviour for all python versions. This fixes signedness issue with crc32 from different python versions. Was suggested in the documentation: https://docs.python.org/3.4/library/zlib.html
Python
bsd-2-clause
cvra/can-bootloader,cvra/can-bootloader,cvra/can-bootloader,cvra/can-bootloader
31c0863d088488da5dd85e2cbe3c01c6b01aa4a2
system_tests/test_default.py
system_tests/test_default.py
# Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
# Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
Fix system tests when running on GCE
Fix system tests when running on GCE The new project ID logic for Cloud SDK invokes Cloud SDK directly. Cloud SDK helpfully falls back to the GCE project ID if the project ID is unset in the configuration. This breaks one of our previous expectations.
Python
apache-2.0
googleapis/google-auth-library-python,googleapis/google-auth-library-python
f042f6c9799d70edb41ae9495adf8bb78ed23e13
elections/ar_elections_2015/settings.py
elections/ar_elections_2015/settings.py
# -*- coding: utf-8 -*- ELECTION_RE = '(?P<election>diputados-argentina-paso-2015|gobernadores-argentina-paso-2015|senadores-argentina-paso-2015|presidentes-argentina-paso-2015)' MAPIT_BASE_URL = 'http://argentina.mapit.staging.mysociety.org/' SITE_OWNER = 'YoQuieroSaber' COPYRIGHT_HOLDER = 'YoQuieroSaber'
# -*- coding: utf-8 -*- ELECTION_RE = '(?P<election>diputados-argentina-paso-2015|gobernadores-argentina-paso-2015|senadores-argentina-paso-2015|presidentes-argentina-paso-2015|parlamentarios-mercosur-regional-paso-2015|parlamentarios-mercosur-unico-paso-2015)' MAPIT_BASE_URL = 'http://argentina.mapit.staging.mysociet...
Add some missing election slugs to Argentina's ELECTION_RE
AR: Add some missing election slugs to Argentina's ELECTION_RE
Python
agpl-3.0
mysociety/yournextmp-popit,DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextmp-popit,neavouli/yournextrepresentative,neavouli/yournextrepresentative,neavouli/yournextrepresentative,DemocracyClub/yournextrepresentative,mysociety/yournextmp-popit,datamade/yournextmp-popit,neavouli/y...
cf6c18925c05a6f009573c204631a09ed1957227
mama_cas/utils.py
mama_cas/utils.py
import urllib import urlparse def add_query_params(url, params): """ Inject additional query parameters into an existing URL. If existing parameters already exist with the same name, they will be overwritten. Return the modified URL as a string. """ # If any of the additional parameters h...
import urllib import urlparse def add_query_params(url, params): """ Inject additional query parameters into an existing URL. If parameters already exist with the same name, they will be overwritten. Return the modified URL as a string. """ # If any of the additional parameters have empty valu...
Tweak comment text for clarity
Tweak comment text for clarity
Python
bsd-3-clause
harlov/django-mama-cas,harlov/django-mama-cas,jbittel/django-mama-cas,orbitvu/django-mama-cas,jbittel/django-mama-cas,orbitvu/django-mama-cas,forcityplatform/django-mama-cas,forcityplatform/django-mama-cas
81235c83c094e3dbca62f19d13c83a002d01da99
bokeh/mixins.py
bokeh/mixins.py
"""Classes that can be mixed-in to HasProps classes to get them the corresponding attributes. """ from .properties import HasProps, ColorSpec, DataSpec, Enum, DashPattern, Int, String from .enums import LineJoin, LineCap, FontStyle, TextAlign, TextBaseline class FillProps(HasProps): """ Mirrors the BokehJS proper...
"""Classes that can be mixed-in to HasProps classes to get them the corresponding attributes. """ from .properties import HasProps, ColorSpec, DataSpec, Enum, DashPattern, Int, String from .enums import LineJoin, LineCap, FontStyle, TextAlign, TextBaseline class FillProps(HasProps): """ Mirrors the BokehJS proper...
Unify bokeh's text properties' values with bokehjs
Unify bokeh's text properties' values with bokehjs
Python
bsd-3-clause
eteq/bokeh,jakirkham/bokeh,Karel-van-de-Plassche/bokeh,caseyclements/bokeh,bokeh/bokeh,xguse/bokeh,timothydmorton/bokeh,azjps/bokeh,ptitjano/bokeh,timothydmorton/bokeh,canavandl/bokeh,alan-unravel/bokeh,ahmadia/bokeh,eteq/bokeh,stuart-knock/bokeh,CrazyGuo/bokeh,ChristosChristofidis/bokeh,percyfal/bokeh,aavanian/bokeh,l...
e081646028e4f3283fb9c7278fed89c3e42cc4d3
server/tests/api/test_user_api.py
server/tests/api/test_user_api.py
import json from tests.helpers import FlaskTestCase, fixtures class TestUserAPI(FlaskTestCase): @fixtures('base.json') def test_get_empty_users(self): """Test GET /api/users endpoint with no data""" response = self.test_client.get('/api/users') assert response.status_code is 200 ...
import json from tests.helpers import FlaskTestCase, fixtures class TestUserAPI(FlaskTestCase): @fixtures('base.json') def test_get_empty_users(self): """Test GET /api/users endpoint with no data""" response, data = self.api_request('get', '/api/users') assert data['num_results'] is 0...
Implement tests for getting empty users list and single user list
Implement tests for getting empty users list and single user list
Python
mit
ganemone/ontheside,ganemone/ontheside,ganemone/ontheside
962f26299a7038879eb1efeb8f16b0801fd9a04a
glitter/assets/apps.py
glitter/assets/apps.py
# -*- coding: utf-8 -*- from django.apps import AppConfig class GlitterBasicAssetsConfig(AppConfig): name = 'glitter.assets' label = 'glitter_assets' def ready(self): super(GlitterBasicAssetsConfig, self).ready() from . import listeners # noqa
# -*- coding: utf-8 -*- from django.apps import AppConfig class GlitterBasicAssetsConfig(AppConfig): name = 'glitter.assets' label = 'glitter_assets' verbose_name = 'Assets' def ready(self): super(GlitterBasicAssetsConfig, self).ready() from . import listeners # noqa
Improve verbose name for assets
Improve verbose name for assets
Python
bsd-3-clause
blancltd/django-glitter,blancltd/django-glitter,developersociety/django-glitter,blancltd/django-glitter,developersociety/django-glitter,developersociety/django-glitter
28f504dccd02046604761e997f929015a285dffd
pyQuantuccia/tests/test_get_holiday_date.py
pyQuantuccia/tests/test_get_holiday_date.py
from datetime import date import calendar print(calendar.__dir__()) print(calendar.__dict__) def test_united_kingdom_is_business_day(): """ Check a single day to see that we can identify holidays. """ assert(calendar.united_kingdom_is_business_day(date(2017, 4, 17)) is False)
from datetime import date import calendar def test_foo(): assert(calendar.__dir__() == "") def test_dummy(): assert(calendar.__dict__ == "") def test_united_kingdom_is_business_day(): """ Check a single day to see that we can identify holidays. """ assert(calendar.united_kingdom_is_busine...
Add some bogus tests to try and get this info.
Add some bogus tests to try and get this info.
Python
bsd-3-clause
jwg4/pyQuantuccia,jwg4/pyQuantuccia
fea4f04abc18b8dcf4970a1f338a8d610f04260d
src/pytz/tests/test_docs.py
src/pytz/tests/test_docs.py
#!/usr/bin/env python # -*- coding: ascii -*- import unittest, os, os.path, sys from doctest import DocFileSuite sys.path.insert(0, os.path.join(os.pardir, os.pardir)) locs = [ 'README.txt', os.path.join(os.pardir, 'README.txt'), os.path.join(os.pardir, os.pardir, 'README.txt'), ] README = None for lo...
#!/usr/bin/env python # -*- coding: ascii -*- import unittest, os, os.path, sys from doctest import DocFileSuite sys.path.insert(0, os.path.join(os.pardir, os.pardir)) locs = [ 'README.txt', os.path.join(os.pardir, 'README.txt'), os.path.join(os.pardir, os.pardir, 'README.txt'), ] README = None for lo...
Add a test_suite method as used by the Zope3 test runner
Add a test_suite method as used by the Zope3 test runner
Python
mit
stub42/pytz,stub42/pytz,stub42/pytz,stub42/pytz
c3c0bf614e046f4640d123f801739fc7ea0d7cac
salt/states/salt_proxy.py
salt/states/salt_proxy.py
# -*- coding: utf-8 -*- ''' Salt proxy state .. versionadded:: 2015.8.2 State to deploy and run salt-proxy processes on a minion. Set up pillar data for your proxies per the documentation. Run the state as below ..code-block:: yaml salt-proxy-configure: salt_proxy.c...
# -*- coding: utf-8 -*- ''' Salt proxy state .. versionadded:: 2015.8.2 State to deploy and run salt-proxy processes on a minion. Set up pillar data for your proxies per the documentation. Run the state as below ..code-block:: yaml salt-proxy-configure: salt_proxy.c...
Add example to function docstring
Add example to function docstring
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
dd63ef92e14a3111fd0914e9994aaea9ebd4e668
hcalendar/hcalendar.py
hcalendar/hcalendar.py
import bs4 from vcalendar import vCalendar class hCalendar(object): def __init__(self, markup, value=None, key='id'): self._soup = bs4.BeautifulSoup(markup) if value: self._soup = self._soup.find(**{key: value}) self._cals = self._soup.findAll(attrs='vcalendar') ...
from vcalendar import vCalendar from bs4 import BeautifulSoup class hCalendar(object): def __init__(self, markup, value=None, key='id'): if isinstance(markup, BeautifulSoup): self._soup = markup else: self._soup = BeautifulSoup(markup) if value: ...
Allow BeautifulSoup object being passed into hCalendar
Allow BeautifulSoup object being passed into hCalendar
Python
mit
mback2k/python-hcalendar
a773b1aa98a96b6335b76fc587ea714e5cca7545
cle/relocations/mips.py
cle/relocations/mips.py
from . import generic arch = 'MIPS32' R_MIPS_32 = generic.GenericAbsoluteAddendReloc R_MIPS_REL32 = generic.GenericRelativeReloc R_MIPS_TLS_DTPMOD32 = generic.GenericTLSModIdReloc R_MIPS_TLS_TPREL32 = generic.GenericTLSOffsetReloc R_MIPS_TLS_DTPREL32 = generic.GenericTLSDoffsetReloc
from . import generic arch = 'MIPS32' R_MIPS_32 = generic.GenericAbsoluteAddendReloc R_MIPS_REL32 = generic.GenericRelativeReloc R_MIPS_TLS_DTPMOD32 = generic.GenericTLSModIdReloc R_MIPS_TLS_TPREL32 = generic.GenericTLSOffsetReloc R_MIPS_TLS_DTPREL32 = generic.GenericTLSDoffsetReloc R_MIPS_JUMP_SLOT = generic.Generic...
Add R_MIPS_JUMP_SLOT and R_MIPS_GLOB_DAT relocations
Add R_MIPS_JUMP_SLOT and R_MIPS_GLOB_DAT relocations
Python
bsd-2-clause
chubbymaggie/cle,angr/cle
5863cbf81156074df4e0a9abb7a823a7701933da
tlsenum/__init__.py
tlsenum/__init__.py
import click CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"]) @click.command(context_settings=CONTEXT_SETTINGS) @click.argument("host", type=click.STRING) @click.argument("port", type=click.INT) @click.option("--verify-cert", is_flag=True) def cli(host, port, verify_cert): """ A command line tool...
import socket import click from construct import UBInt16 from tlsenum.parse_hello import ( ClientHello, Extensions, HandshakeFailure, ServerHello ) from tlsenum.mappings import CipherSuites, ECCurves, ECPointFormat CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"]) def send_client_hello(host, port, d...
Add very basic logic to figure out supported cipher suites.
Add very basic logic to figure out supported cipher suites.
Python
mit
Ayrx/tlsenum,Ayrx/tlsenum
157d427646ccee414503089e7080b92335848803
floq/helpers.py
floq/helpers.py
def n_to_i(num, n): """ Translate num, ranging from -(n-1)/2 through (n-1)/2 into an index i from 0 to n-1 If num > (n-1)/2, map it into the interval This is necessary to translate from a physical Fourier mode number to an index in an array. """ cutoff = (n-1)/2 if num > cutoff...
def n_to_i(num, n): """ Translate num, ranging from -(n-1)/2 through (n-1)/2 into an index i from 0 to n-1 If num > (n-1)/2, map it into the interval This is necessary to translate from a physical Fourier mode number to an index in an array. """ cutoff = (n-1)/2 return (num+cut...
Implement rollover correctly and a lot more concisely
Implement rollover correctly and a lot more concisely
Python
mit
sirmarcel/floq
610ada5f26d7421c2b0dd16a8a14ac9c95e4ed8c
config/test/__init__.py
config/test/__init__.py
from SCons.Script import * def run_tests(env): import shlex import subprocess import sys sys.exit(subprocess.call(shlex.split(env.get('TEST_COMMAND')))) def generate(env): import os import distutils.spawn python = distutils.spawn.find_executable('python3') if not python: python = d...
from SCons.Script import * def run_tests(env): import shlex import subprocess import sys cmd = shlex.split(env.get('TEST_COMMAND')) print('Executing:', cmd) sys.exit(subprocess.call(cmd)) def generate(env): import os import distutils.spawn python = distutils.spawn.find_executab...
Fix "test" target in Windows
Fix "test" target in Windows
Python
lgpl-2.1
CauldronDevelopmentLLC/cbang,CauldronDevelopmentLLC/cbang,CauldronDevelopmentLLC/cbang,CauldronDevelopmentLLC/cbang
c38e64dc57ec2fd07d64c638dad81ce9b6079425
setup/fusion/scripts/Comp/avalon/publish.py
setup/fusion/scripts/Comp/avalon/publish.py
import os import sys import avalon.api import avalon.fusion import pyblish_qml def _install_fusion(): from pyblish_qml import settings import pyblish_qml.host as host sys.stdout.write("Setting up Pyblish QML in Fusion\n") if settings.ContextLabel == settings.ContextLabelDefault: settings....
import os import sys import avalon.api import avalon.fusion import pyblish_qml def _install_fusion(): from pyblish_qml import settings import pyblish_qml.host as host sys.stdout.write("Setting up Pyblish QML in Fusion\n") if settings.ContextLabel == settings.ContextLabelDefault: settings....
Remove reference to Deadline in window title
Remove reference to Deadline in window title
Python
mit
getavalon/core,MoonShineVFX/core,mindbender-studio/core,mindbender-studio/core,getavalon/core,MoonShineVFX/core
51c0ae7b647a9ea354928f80acbcabef778bedd5
icekit/page_types/articles/models.py
icekit/page_types/articles/models.py
from django.db import models from icekit.content_collections.abstract_models import \ AbstractCollectedContent, AbstractListingPage, TitleSlugMixin from icekit.publishing.models import PublishableFluentContents class ArticleCategoryPage(AbstractListingPage): def get_public_items(self): unpublished_pk ...
from django.db import models from icekit.content_collections.abstract_models import \ AbstractCollectedContent, AbstractListingPage, TitleSlugMixin from icekit.publishing.models import PublishableFluentContents class ArticleCategoryPage(AbstractListingPage): def get_public_items(self): unpublished_pk ...
Update `unique_together`. Order matters. Fields are scanned by PostgreSQL in order.
Update `unique_together`. Order matters. Fields are scanned by PostgreSQL in order. The first field should be the one most likely to uniquely identify an object.
Python
mit
ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit
e1aa1379eb9ac6c550537c95f6b949a2d456d7c4
demo/demo/models.py
demo/demo/models.py
from django.db import models from django.contrib.auth.models import User ABODE_TYPES = ( ('SH', 'Small house'), ('H', 'House'), ('SB', 'Small building'), ('B', 'Building') ) GENDERS = ( ('M', 'Male'), ('F', 'Female') ) class World(models.Model): god = models.ForeignKey(User, related_na...
from django.db import models ABODE_TYPES = ( ('SH', 'Small house'), ('H', 'House'), ('SB', 'Small building'), ('B', 'Building') ) GENDERS = ( ('M', 'Male'), ('F', 'Female') ) class World(models.Model): name = models.CharField(max_length=30) description = models.TextField() class...
Remove relation to user model in order to keep things simpler
Remove relation to user model in order to keep things simpler
Python
mit
novafloss/populous
cd9836a3147e13ac511b9c14a3d75e0c7a886eba
viper/interpreter/value.py
viper/interpreter/value.py
from .environment import Environment from viper.parser.ast.nodes import Expr class Value: pass class TupleVal(Value): def __init__(self, *vals: Value): self.vals = list(vals) def __repr__(self) -> str: return f"TupleVal({', '.join(self.vals)})" class NumVal(Value): def __init__(s...
from .environment import Environment from viper.parser.ast.nodes import Expr class Value: pass class TupleVal(Value): def __init__(self, *vals: Value): self.vals = list(vals) def __repr__(self) -> str: return f"TupleVal({', '.join(map(str, self.vals))})" class NumVal(Value): def ...
Fix __repl__ implementation for TupleVal
Fix __repl__ implementation for TupleVal
Python
apache-2.0
pdarragh/Viper
443874df07a3c3ed8d9e075b25e5f93c1de0128b
tests/devices_test/device_packages_test.py
tests/devices_test/device_packages_test.py
# vim:set fileencoding=utf-8 import unittest from blivet.devices import DiskDevice from blivet.devices import LUKSDevice from blivet.devices import MDRaidArrayDevice from blivet.formats import getFormat class DevicePackagesTestCase(unittest.TestCase): """Test device name validation""" def testPackages(self...
# vim:set fileencoding=utf-8 import unittest from blivet.devices import DiskDevice from blivet.devices import LUKSDevice from blivet.devices import MDRaidArrayDevice from blivet.formats import getFormat class DevicePackagesTestCase(unittest.TestCase): """Test device name validation""" def testPackages(self...
Use len of set to check for duplicates in list of packages.
Use len of set to check for duplicates in list of packages. Resolves: #154. Checking for equality of the two lists was a mistake, since the order of the list generated from the set is undefined.
Python
lgpl-2.1
rhinstaller/blivet,jkonecny12/blivet,AdamWill/blivet,vojtechtrefny/blivet,jkonecny12/blivet,rvykydal/blivet,vpodzime/blivet,rhinstaller/blivet,AdamWill/blivet,rvykydal/blivet,vojtechtrefny/blivet,vpodzime/blivet
13cad8b6fb7c484a492333e86a6e774ce4742a40
src/webassets/filter/uglifyjs.py
src/webassets/filter/uglifyjs.py
"""Minify Javascript using `UglifyJS <https://github.com/mishoo/UglifyJS/>`_. UglifyJS is an external tool written for NodeJS; this filter assumes that the ``uglifyjs`` executable is in the path. Otherwise, you may define a ``UGLIFYJS_BIN`` setting. Additional options may be passed to ``uglifyjs`` by setting ``UGLIFYJ...
import subprocess from webassets.exceptions import FilterError from webassets.filter import Filter __all__ = ('UglifyJSFilter',) class UglifyJSFilter(Filter): """ Minify Javascript using `UglifyJS <https://github.com/mishoo/UglifyJS/>`_. UglifyJS is an external tool written for NodeJS; this filter assu...
Make UglifyJSFilter docstring more consistent with other filters
Make UglifyJSFilter docstring more consistent with other filters
Python
bsd-2-clause
john2x/webassets,scorphus/webassets,aconrad/webassets,0x1997/webassets,heynemann/webassets,0x1997/webassets,glorpen/webassets,JDeuce/webassets,aconrad/webassets,john2x/webassets,JDeuce/webassets,glorpen/webassets,florianjacob/webassets,heynemann/webassets,aconrad/webassets,wijerasa/webassets,florianjacob/webassets,glor...
2ef671ca19f237ab0bf3fcc632048b34a2c5d3dc
tutorials/models.py
tutorials/models.py
from django.db import models from markdownx.models import MarkdownxField # Create your models here. class Tutorial(models.Model): # ToDo: Fields that are out-commented are missing according to the mockup -> datamodel ?? # Category = models.TextField() title = models.TextField() html = models.TextFie...
from django.db import models from django.urls import reverse from markdownx.models import MarkdownxField # add options if needed CATEGORY_OPTIONS = [('io', 'I/O'), ('intro', 'Introduction')] LEVEL_OPTIONS = [(1, '1'), (2, '2'), (3, '3')] # Create your models here. class Tutorial(models.Model): # ToDo: Fields th...
Add options for choices fields, Add new fields to Tutorial model
Add options for choices fields, Add new fields to Tutorial model
Python
agpl-3.0
openego/oeplatform,openego/oeplatform,openego/oeplatform,openego/oeplatform
0524817b152b4e3211d5d8101c661a54578e5888
dmoj/checkers/standard.py
dmoj/checkers/standard.py
def check(process_output, judge_output, **kwargs): from six.moves import zip process_lines = list(filter(None, process_output.split(b'\n'))) judge_lines = list(filter(None, judge_output.split(b'\n'))) if len(process_lines) != len(judge_lines): return False for process_line, judge_line in zip...
from ._checker import standard def check(process_output, judge_output, _checker=standard, **kwargs): return _checker(judge_output, process_output) del standard
Remove untested checker code path
Remove untested checker code path
Python
agpl-3.0
DMOJ/judge,DMOJ/judge,DMOJ/judge
e98a098ac6a21b0192771fd3a8d5c48468cd4340
pymatgen/phasediagram/__init__.py
pymatgen/phasediagram/__init__.py
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ The phasediagram package implements the analysis tools to perform phase stability analyses, including the constructing of phase diagrams, determination of decomposition products, etc. The package is designe...
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ The phasediagram package implements the analysis tools to perform phase stability analyses, including the constructing of phase diagrams, determination of decomposition products, etc. The package is designe...
Add quick aliases to PD.
Add quick aliases to PD. Former-commit-id: 6a0680d54cc1d391a351f4d5e8ff72f696d303db [formerly 5fe981c7ed92d45548d3f7ab6abb38d149d0ada2] Former-commit-id: f76e0dc538c182b4978eb54b51cbebafa257ce04
Python
mit
aykol/pymatgen,tschaume/pymatgen,Bismarrck/pymatgen,setten/pymatgen,fraricci/pymatgen,Bismarrck/pymatgen,gVallverdu/pymatgen,richardtran415/pymatgen,johnson1228/pymatgen,davidwaroquiers/pymatgen,gpetretto/pymatgen,tallakahath/pymatgen,gpetretto/pymatgen,gVallverdu/pymatgen,matk86/pymatgen,davidwaroquiers/pymatgen,sette...
4f7e991960c24fc9548f8f3d6d5f8967c2ece84a
numpy/array_api/_typing.py
numpy/array_api/_typing.py
""" This file defines the types for type annotations. These names aren't part of the module namespace, but they are used in the annotations in the function signatures. The functions in the module are only valid for inputs that match the given type annotations. """ __all__ = [ "Array", "Device", "Dtype", ...
""" This file defines the types for type annotations. These names aren't part of the module namespace, but they are used in the annotations in the function signatures. The functions in the module are only valid for inputs that match the given type annotations. """ __all__ = [ "Array", "Device", "Dtype", ...
Add a missing subscription slot to `NestedSequence`
MAINT: Add a missing subscription slot to `NestedSequence`
Python
bsd-3-clause
numpy/numpy,anntzer/numpy,numpy/numpy,pdebuyl/numpy,seberg/numpy,rgommers/numpy,anntzer/numpy,charris/numpy,charris/numpy,jakirkham/numpy,charris/numpy,jakirkham/numpy,pdebuyl/numpy,anntzer/numpy,mhvk/numpy,endolith/numpy,mattip/numpy,mattip/numpy,rgommers/numpy,numpy/numpy,mhvk/numpy,mhvk/numpy,rgommers/numpy,charris/...
226a4c1af180f0bf1924a84c76d1d2b300557e9b
instana/instrumentation/urllib3.py
instana/instrumentation/urllib3.py
from __future__ import absolute_import import opentracing.ext.tags as ext import instana import opentracing import wrapt @wrapt.patch_function_wrapper('urllib3', 'PoolManager.urlopen') def urlopen_with_instana(wrapped, instance, args, kwargs): try: span = instana.internal_tracer.start_span("urllib3") ...
from __future__ import absolute_import import opentracing.ext.tags as ext import instana import opentracing import wrapt @wrapt.patch_function_wrapper('urllib3', 'PoolManager.urlopen') def urlopen_with_instana(wrapped, instance, args, kwargs): try: span = instana.internal_tracer.start_span("urllib3") ...
Make sure to finish span when there is an exception
Make sure to finish span when there is an exception
Python
mit
instana/python-sensor,instana/python-sensor
9b8fb2d745af7bb8c69e504a97612727b7e9a2d8
storlets/gateway/gateways/base.py
storlets/gateway/gateways/base.py
# Copyright IBM Corp. 2015, 2015 All Rights Reserved # Copyright (c) 2010-2016 OpenStack Foundation # # 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/LICEN...
# Copyright IBM Corp. 2015, 2015 All Rights Reserved # Copyright (c) 2010-2016 OpenStack Foundation # # 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/LICEN...
Use consistent arguments for invocation_flow method
Use consistent arguments for invocation_flow method Trivial-Fix Change-Id: I6481147a722b2f366300f2ac7952ebd94f1a2ada
Python
apache-2.0
openstack/storlets,openstack/storlets,openstack/storlets,openstack/storlets
97d2b5b55a6cec3644a323662e52b9b256c18f33
mdx_linkify/mdx_linkify.py
mdx_linkify/mdx_linkify.py
from bleach.linkifier import Linker from markdown.postprocessors import Postprocessor from markdown.extensions import Extension class LinkifyExtension(Extension): def __init__(self, **kwargs): self.config = { 'linker_options': [{}, 'Options for bleach.linkifier.Linker'], } su...
from bleach.linkifier import Linker from markdown.postprocessors import Postprocessor from markdown.extensions import Extension class LinkifyExtension(Extension): def __init__(self, **kwargs): self.config = { 'linker_options': [{}, 'Options for bleach.linkifier.Linker'], } su...
Fix IndexError: pop from empty list
fix: Fix IndexError: pop from empty list Create Linker instance for each run, to bypass html5lib bugs Refs #15
Python
mit
daGrevis/mdx_linkify
04ac8f763277014a95c9b5559cab6abc11ad9390
test/integration/test_qt.py
test/integration/test_qt.py
from . import * # MSBuild backend doesn't support generated_source yet. @skip_if_backend('msbuild') class TestQt(IntegrationTest): def run_executable(self, exe): if env.host_platform.genus == 'linux': output = self.assertPopen([exe], extra_env={'DISPLAY': ''}, ...
from . import * # MSBuild backend doesn't support generated_source yet. @skip_if_backend('msbuild') class TestQt(IntegrationTest): def run_executable(self, exe): if env.host_platform.genus == 'linux': output = self.assertPopen([exe], extra_env={'DISPLAY': ''}, ...
Fix integration tests on Mint 20
Fix integration tests on Mint 20
Python
bsd-3-clause
jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000
b5676fde38b1d7c40bc5873a65e864c3bd3214d9
heufybot/utils/logutils.py
heufybot/utils/logutils.py
from twisted.python import log, util import logging class LevelLoggingObserver(log.FileLogObserver): def __init__(self, logfile, logLevel): log.FileLogObserver.__init__(self, logfile) self.logLevel = logLevel def __call__(self, eventDict): self.emit(eventDict) def emit(self, even...
from twisted.python import log, util import logging, sys, traceback def logExceptionTrace(error = None): if error: log.msg("A Python excecution error occurred:", error, level=logging.ERROR) log.msg(traceback.format_exc(sys.exc_info()[2]), level=logging.ERROR) class LevelLoggingObserver(log.FileLogObs...
Add a helper function for exception logging
Add a helper function for exception logging
Python
mit
Heufneutje/PyHeufyBot,Heufneutje/PyHeufyBot
7e2e1c45ea9f83f11dc5d3b828a36e13825bcd8b
tests/credentials.py
tests/credentials.py
import os import unittest import tweedr class TestCredentials(unittest.TestCase): def test_mysql(self): if 'TRAVIS' in os.environ: print 'For obvious reasons, Travis CI cannot run this test.' else: names = ['MYSQL_PASS', 'MYSQL_HOST'] values = [os.environ[name]...
import os import unittest import tweedr class TestCredentials(unittest.TestCase): def test_mysql(self): if os.environ.get('TRAVIS'): print 'For obvious reasons, Travis CI cannot run this test.' else: names = ['MYSQL_PASS', 'MYSQL_HOST'] values = [os.environ[nam...
Test for Travis CI variable a little less recklessly.
Test for Travis CI variable a little less recklessly.
Python
mit
dssg/tweedr,dssg/tweedr,dssg/tweedr,dssg/tweedr
3b97e2eafaf8e2cdc2b39024f125c284a5f9de23
tests/python-test-library/testcases/conf.py
tests/python-test-library/testcases/conf.py
#!/usr/bin/env python2.5 ## ## @file contextOrientationTCs.py ## ## Copyright (C) 2008 Nokia. All rights reserved. ## ## ## ## ## Requires python2.5-gobject and python2.5-dbus ## ## Implements also some testing API: ## ## contextSrcPath="." sessionConfigPath="tests/python-test-library/stubs" ctxBusName = "org.freed...
#!/usr/bin/env python2.5 ## ## @file contextOrientationTCs.py ## ## Copyright (C) 2008 Nokia. All rights reserved. ## ## ## ## ## Requires python2.5-gobject and python2.5-dbus ## ## Implements also some testing API: ## ## contextSrcPath="." sessionConfigPath="tests/python-test-library/stubs" ctxBusName = "org.freed...
Modify subscription handler interface name
Modify subscription handler interface name
Python
lgpl-2.1
rburchell/ck,rburchell/ck,rburchell/ck,rburchell/ck,rburchell/ck
2a779fedbb533eda7a8856e6a543f09faae9ac85
thinc/neural/tests/unit/Model/test_setup.py
thinc/neural/tests/unit/Model/test_setup.py
# encoding: utf8 from __future__ import unicode_literals import pytest from flexmock import flexmock from hypothesis import given, strategies import abc from .... import base @pytest.mark.parametrize('new_name', ['mymodel', 'layer', 'basic', '', '漢字']) def test_name_override(new_name): control = base.Model() ...
from .... import base
Remove tests or removed Model.setup method
Remove tests or removed Model.setup method
Python
mit
explosion/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,spacy-io/thinc
6b9120b5b12da3f32f2c6377905f7ecd103f164e
packages/grid/backend/grid/api/token.py
packages/grid/backend/grid/api/token.py
# stdlib from typing import Optional # third party from pydantic import BaseModel class Token(BaseModel): access_token: str token_type: str metadata: str class TokenPayload(BaseModel): sub: Optional[int] = None
# stdlib from typing import Optional # third party from pydantic import BaseModel class Token(BaseModel): access_token: str token_type: str metadata: str class TokenPayload(BaseModel): sub: Optional[int] = None guest: bool = False
UPDATE TokenPayload pydantic model to support guest flag
UPDATE TokenPayload pydantic model to support guest flag
Python
apache-2.0
OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
257addd4403ae17a79c955d9751d5f3072c2a020
nightreads/emails/views.py
nightreads/emails/views.py
from django.shortcuts import render, redirect from django.views.generic import View from django.core.urlresolvers import reverse from django.contrib import messages from .models import Email from .forms import EmailAdminForm from nightreads.user_manager.models import Subscription class SendEmailAdminView(View): ...
from django.shortcuts import render, redirect from django.views.generic import View from django.core.urlresolvers import reverse from django.contrib import messages from .models import Email from .forms import EmailAdminForm from nightreads.user_manager.models import Subscription class SendEmailAdminView(View): ...
Update target count to consider users who subded to `all`
Update target count to consider users who subded to `all`
Python
mit
avinassh/nightreads,avinassh/nightreads
a1318a5ced6efc4ae88abc0b23190daea5899704
open_humans/serializers.py
open_humans/serializers.py
from django.contrib.auth.models import User from django.core.urlresolvers import reverse from rest_framework import serializers class ProfileSerializer(serializers.ModelSerializer): url = serializers.SerializerMethodField('get_profile_url') class Meta: model = User fields = ('id', 'url', 'use...
from django.contrib.auth.models import User # from django.core.urlresolvers import reverse from rest_framework import serializers class ProfileSerializer(serializers.ModelSerializer): # url = serializers.SerializerMethodField('get_profile_url') message = serializers.SerializerMethodField('get_message') c...
Make /api/profile return no private data
Make /api/profile return no private data
Python
mit
OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans
ecdde0ef68a295910039c0a3a4a26f0580fd81f6
starbowmodweb/news/views.py
starbowmodweb/news/views.py
from django.http import HttpResponse from django.shortcuts import render from django.db import connections import bbcode def dictfetchall(cursor): "Returns all rows from a cursor as a dict" desc = cursor.description return [ dict(zip([col[0] for col in desc], row)) for row in cursor.fetch...
from django.http import HttpResponse from django.shortcuts import render from django.db import connections import bbcode def bbcode_img(tag_name, value, options, parent, context): if tag_name in options and 'x' in options[tag_name]: options['width'], options['height'] = options[tag_name].split('x', 1) ...
Add support for the [img] tag.
Add support for the [img] tag.
Python
mit
Starbow/StarbowWebSite,Starbow/StarbowWebSite,Starbow/StarbowWebSite
577fb4b24f681260cd49a3503566fe921e2d252f
compresstest.py
compresstest.py
#!/usr/bin/python import bz2 import gzip import optparse import os import sys import time if __name__ == '__main__': # Create the option parser, and give a small usage example. optionparser = optparse.OptionParser(usage='%prog [options] -f /some/file.bz2') optionparser.add_option('-f', '--file', default=...
#!/usr/bin/python import bz2 import gzip import optparse import os import sys import time if __name__ == '__main__': # Create the option parser, and give a small usage example. optionparser = optparse.OptionParser(usage='%prog [options] -f /some/file.bz2') optionparser.add_option('-f', '--file', default=...
Fix copy/paste error in Gzip open
Fix copy/paste error in Gzip open
Python
unlicense
tomc603/pycompresstest
ea67ca087b06347625f8116e1583fd046a75159a
providers/pt/rcaap/apps.py
providers/pt/rcaap/apps.py
from share.provider import OAIProviderAppConfig class AppConfig(OAIProviderAppConfig): name = 'providers.pt.rcaap' version = '0.0.1' title = 'rcaap' long_title = 'RCAAP - Repositório Científico de Acesso Aberto de Portugal' home_page = 'http://www.rcaap.pt' url = 'http://www.rcaap.pt/oai' ...
from share.provider import OAIProviderAppConfig class AppConfig(OAIProviderAppConfig): name = 'providers.pt.rcaap' version = '0.0.1' title = 'rcaap' long_title = 'RCAAP - Repositório Científico de Acesso Aberto de Portugal' home_page = 'http://www.rcaap.pt' url = 'http://www.rcaap.pt/oai' ...
Remove time granularity from rcaap
Remove time granularity from rcaap
Python
apache-2.0
laurenbarker/SHARE,CenterForOpenScience/SHARE,zamattiac/SHARE,aaxelb/SHARE,zamattiac/SHARE,aaxelb/SHARE,CenterForOpenScience/SHARE,CenterForOpenScience/SHARE,laurenbarker/SHARE,laurenbarker/SHARE,zamattiac/SHARE,aaxelb/SHARE
d0e95cf13290049a95ac3b92e16cfba80b770147
connector/views.py
connector/views.py
from django.conf import settings from django.template import RequestContext from django.http import HttpResponse, HttpResponseNotFound from django.template import Template from cancer_browser.core.http import HttpResponseSendFile from django.core.urlresolvers import reverse import os, re def client_vars(request, bas...
from django.conf import settings from django.template import RequestContext from django.http import HttpResponse, HttpResponseNotFound from django.template import Template from cancer_browser.core.http import HttpResponseSendFile from django.core.urlresolvers import reverse import os, re def client_vars(request, bas...
Add mime types for jpeg, gif.
Add mime types for jpeg, gif.
Python
apache-2.0
acthp/ucsc-xena-client,acthp/ucsc-xena-client,acthp/ucsc-xena-client,ucscXena/ucsc-xena-client,ucscXena/ucsc-xena-client,ucscXena/ucsc-xena-client,ucscXena/ucsc-xena-client,ucscXena/ucsc-xena-client
1e2822bb71c123993419479c2d4f5fc3e80e35bb
reddit_adzerk/adzerkads.py
reddit_adzerk/adzerkads.py
from urllib import quote from pylons import c, g from r2.lib.pages import Ads as BaseAds class Ads(BaseAds): def __init__(self): BaseAds.__init__(self) adzerk_all_the_things = g.live_config.get("adzerk_all_the_things") adzerk_srs = g.live_config.get("adzerk_srs") in_adzerk_sr = a...
from urllib import quote from pylons import c, g from r2.lib.pages import Ads as BaseAds class Ads(BaseAds): def __init__(self): BaseAds.__init__(self) adzerk_all_the_things = g.live_config.get("adzerk_all_the_things") adzerk_srs = g.live_config.get("adzerk_srs") in_adzerk_sr = a...
Use analytics name for subreddits if available.
Use analytics name for subreddits if available. This allows a catch-all for multis to be used.
Python
bsd-3-clause
madbook/reddit-plugin-adzerk,madbook/reddit-plugin-adzerk,madbook/reddit-plugin-adzerk
f0b30432d38cba43d534727b74644e9d29b7264f
Lib/defcon/errors.py
Lib/defcon/errors.py
class DefconError(Exception): pass
class DefconError(Exception): _report = None def _set_report(self, value): self._report = value def _get_report(self): return self._report report = property(_get_report, _set_report)
Allow DefconError to contain a report.
Allow DefconError to contain a report.
Python
mit
moyogo/defcon,adrientetar/defcon,anthrotype/defcon,typesupply/defcon
601a8d665a9bf84f8deea17153ffa9a94267abbf
tests/api_tests/base/test_middleware.py
tests/api_tests/base/test_middleware.py
# -*- coding: utf-8 -*- from tests.base import ApiTestCase, fake import mock from nose.tools import * # flake8: noqa from api.base.middleware import TokuTransactionsMiddleware from tests.base import ApiTestCase class TestMiddlewareRollback(ApiTestCase): @mock.patch('api.base.middleware.commands') def ...
# -*- coding: utf-8 -*- from tests.base import ApiTestCase, fake import mock from nose.tools import * # flake8: noqa from api.base.middleware import TokuTransactionsMiddleware from tests.base import ApiTestCase class TestMiddlewareRollback(ApiTestCase): def setUp(self): super(TestMiddlewareRollback, se...
Clean up assert statements and add test for successful commit
Clean up assert statements and add test for successful commit
Python
apache-2.0
emetsger/osf.io,kwierman/osf.io,abought/osf.io,caneruguz/osf.io,baylee-d/osf.io,GageGaskins/osf.io,mluo613/osf.io,jnayak1/osf.io,sloria/osf.io,TomBaxter/osf.io,caseyrollins/osf.io,kch8qx/osf.io,rdhyee/osf.io,emetsger/osf.io,zamattiac/osf.io,billyhunt/osf.io,mattclark/osf.io,danielneis/osf.io,kch8qx/osf.io,aaxelb/osf.io...
3c65881633daee8d5b19760e5c887dce25ab69c3
froide/helper/db_utils.py
froide/helper/db_utils.py
from django.db import IntegrityError from django.template.defaultfilters import slugify def save_obj_with_slug(obj, attribute='title', **kwargs): obj.slug = slugify(getattr(obj, attribute)) return save_obj_unique(obj, 'slug', **kwargs) def save_obj_unique(obj, attr, count=0, postfix_format='-{count}'): ...
from django.db import IntegrityError from django.template.defaultfilters import slugify def save_obj_with_slug(obj, attribute='title', **kwargs): obj.slug = slugify(getattr(obj, attribute)) return save_obj_unique(obj, 'slug', **kwargs) def save_obj_unique(obj, attr, count=0, postfix_format='-{count}'): ...
Fix bad initial count in slug creation helper
Fix bad initial count in slug creation helper
Python
mit
stefanw/froide,stefanw/froide,stefanw/froide,fin/froide,fin/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide
186b3846e5fe9298549b5a5c98e9ec9817f35203
twisted/plugins/specter_plugin.py
twisted/plugins/specter_plugin.py
from zope.interface import implements from twisted.python import usage from twisted.plugin import IPlugin from twisted.application.service import IServiceMaker from twisted.application import internet from twisted.web import server from twisted.internet import ssl import specter class Options(usage.Options): op...
import yaml from twisted.python import usage from twisted.plugin import IPlugin from twisted.application.service import IServiceMaker from twisted.application import internet from twisted.web import server from twisted.internet import ssl from zope.interface import implements import specter class Options(usage.Opt...
Move config parsing to plugin, use for SSL keys
Move config parsing to plugin, use for SSL keys
Python
mit
praekelt/specter,praekelt/specter
139346c72a09719eba3d444c67d1b54c1b68eae6
uni_form/templatetags/uni_form_field.py
uni_form/templatetags/uni_form_field.py
from django import template register = template.Library() class_converter = { "textinput":"textinput textInput", "fileinput":"fileinput fileUpload" } @register.filter def is_checkbox(field): return field.field.widget.__class__.__name__.lower() == "checkboxinput" @register.filter def with_class(field): ...
from django import template register = template.Library() class_converter = { "textinput":"textinput textInput", "fileinput":"fileinput fileUpload", "passwordinput":"passwordinput textInput" } @register.filter def is_checkbox(field): return field.field.widget.__class__.__name__.lower() == "checkboxin...
Add "passwordinput" to class_converter, because it needs the textInput class too.
Add "passwordinput" to class_converter, because it needs the textInput class too.
Python
mit
treyhunner/django-crispy-forms,uranusjr/django-crispy-forms-ng,alanwj/django-crispy-forms,iris-edu-int/django-crispy-forms,scuml/django-crispy-forms,RamezIssac/django-crispy-forms,PetrDlouhy/django-crispy-forms,zixan/django-crispy-forms,smirolo/django-crispy-forms,schrd/django-crispy-forms,CashStar/django-uni-form,pyda...
32fa0f4937aa9fc5545aed8d839618579a9b0be4
markdown_i18n/extension.py
markdown_i18n/extension.py
from markdown.extensions import Extension from markdown_i18n.parser import I18NTreeProcessor class I18NExtension(Extension): def __init__(self, **kwargs): self.config = { 'i18n_lang': ['en_US', 'Locale'], 'i18n_dir': ['', 'Path to get the translations and'] } self....
from markdown.extensions import Extension from markdown_i18n.parser import I18NTreeProcessor class I18NExtension(Extension): def __init__(self, **kwargs): self.config = { 'i18n_lang': ['en_US', 'Locale'], 'i18n_dir': ['', 'Path to get the translations and'] } self....
Fix link previous to TOC and Fix priority
Fix link previous to TOC and Fix priority
Python
mit
gisce/markdown-i18n
db334f19f66a4d842f206696a40ac2d351c774ac
Testing/test_Misc.py
Testing/test_Misc.py
import unittest import os import scipy from SloppyCell.ReactionNetworks import * from AlgTestNets import algebraic_net_assignment base_net = algebraic_net_assignment.copy() class test_Misc(unittest.TestCase): def test_AssignedVarBug(self): """ Test handling of assigned variables initialized to concentra...
import unittest import os import scipy from SloppyCell.ReactionNetworks import * from AlgTestNets import algebraic_net_assignment base_net = algebraic_net_assignment.copy() class test_Misc(unittest.TestCase): def test_AssignedVarBug(self): """ Test handling of assigned variables initialized to concentra...
Add test for bug involving function definitions that Jordan found.
Add test for bug involving function definitions that Jordan found.
Python
bsd-3-clause
GutenkunstLab/SloppyCell,GutenkunstLab/SloppyCell
f89c60e6ff2c846aacd39db8488de1300b156a71
src/membership/web/views.py
src/membership/web/views.py
""" """ from wheezy.core.collections import attrdict from wheezy.core.comp import u from wheezy.security import Principal from wheezy.web.authorization import authorize from shared.views import APIHandler from membership.validation import credential_validator class SignInHandler(APIHandler): def post(self): ...
""" """ from wheezy.core.collections import attrdict from wheezy.core.comp import u from wheezy.security import Principal from wheezy.web.authorization import authorize from shared.views import APIHandler from membership.validation import credential_validator class SignInHandler(APIHandler): def post(self): ...
Use try_update_model in sign in handler instead of dict update.
Use try_update_model in sign in handler instead of dict update.
Python
mit
akornatskyy/sample-blog-api,akornatskyy/sample-blog-api
7288badce0b2ccf78cf4fbd041b5cf909343cc46
profile_collection/startup/80-areadetector.py
profile_collection/startup/80-areadetector.py
from ophyd.controls.area_detector import (AreaDetectorFileStoreHDF5, AreaDetectorFileStoreTIFF, AreaDetectorFileStoreTIFFSquashing) # from shutter import sh1 shctl1 = EpicsSignal('XF:28IDC-ES:1{Det:PE1}cam1:ShutterMode', name='shctl1'...
from ophyd.controls.area_detector import (AreaDetectorFileStoreHDF5, AreaDetectorFileStoreTIFF, AreaDetectorFileStoreTIFFSquashing) # from shutter import sh1 #shctl1 = EpicsSignal('XF:28IDC-ES:1{Det:PE1}cam1:ShutterMode', name='shctl1...
Put shutter control entirely in the user's hands
[CFG] Put shutter control entirely in the user's hands
Python
bsd-2-clause
NSLS-II-XPD/ipython_ophyd,NSLS-II-XPD/ipython_ophyd
43cd20e94c01e9364d8b0b2e50c701810d68b491
adhocracy4/filters/views.py
adhocracy4/filters/views.py
from django.views import generic class FilteredListView(generic.ListView): """List view with support for filtering and sorting via django-filter. Usage: Set filter_set to your django_filters.FilterSet definition. Use view.filter.form in the template to access the filter form. Note: ...
from django.views import generic class FilteredListView(generic.ListView): """List view with support for filtering and sorting via django-filter. Usage: Set filter_set to your django_filters.FilterSet definition. Use view.filter.form in the template to access the filter form. Note: ...
Allow to override kwargs of filter
Allow to override kwargs of filter
Python
agpl-3.0
liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4
5d36b16fde863cccf404f658f53eac600ac9ddb1
foomodules/link_harvester/common_handlers.py
foomodules/link_harvester/common_handlers.py
import re import socket import urllib from bs4 import BeautifulSoup WURSTBALL_RE = re.compile("^http[s]://wurstball.de/[0-9]+/") def default_handler(metadata): return {key: getattr(metadata, key) for key in ["original_url", "url", "title", "description", "human_readable_type"]} def wu...
import logging import re import socket import urllib from bs4 import BeautifulSoup logger = logging.getLogger(__name__) WURSTBALL_RE = re.compile("^http[s]://wurstball.de/[0-9]+/") def default_handler(metadata): return {key: getattr(metadata, key) for key in ["original_url", "url", "title", "descript...
Print warning when wurstball downloads fail
Print warning when wurstball downloads fail
Python
mit
horazont/xmpp-crowd
5a8d7375b617bd5605bce5f09a4caedef170a85c
gbpservice/neutron/db/migration/cli.py
gbpservice/neutron/db/migration/cli.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Set project when doing neutron DB migrations
Set project when doing neutron DB migrations That way, the default configuration files/dirs from the neutron projects are read when doing the DB migrations. This is useful if eg. some configuration files are in /etc/neutron/neutron.conf.d/ . Theses files will then be automatically evaluated. Change-Id: I4997a86c4df5f...
Python
apache-2.0
noironetworks/group-based-policy,stackforge/group-based-policy,stackforge/group-based-policy,noironetworks/group-based-policy
a58e035027c732f519791fe587ddd509c7013344
mail/tests/handlers/react_tests.py
mail/tests/handlers/react_tests.py
from nose.tools import * from lamson.testing import * import os from lamson import server relay = relay(port=8823) client = RouterConversation("queuetester@localhost", "requests_tests") confirm_format = "testing-confirm-[0-9]+@" noreply_format = "testing-noreply@" host = "localhost" def test_react_for_existing_proje...
from nose.tools import * from lamson.testing import * import os from lamson import server relay = relay(port=8823) client = RouterConversation("queuetester@localhost", "requests_tests") confirm_format = "testing-confirm-[0-9]+@" noreply_format = "testing-noreply@" host = "localhost" def test_react_for_existing_proje...
Add tests for sending messages to "user" projects
Add tests for sending messages to "user" projects
Python
apache-2.0
heiths/allura,leotrubach/sourceforge-allura,lym/allura-git,lym/allura-git,apache/allura,leotrubach/sourceforge-allura,apache/incubator-allura,apache/allura,apache/incubator-allura,Bitergia/allura,Bitergia/allura,heiths/allura,lym/allura-git,apache/allura,lym/allura-git,leotrubach/sourceforge-allura,apache/incubator-all...
1ff4b0473c79150d5387ed2174b120128d465737
app.py
app.py
from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello, world!" if __name__ == "__main__": app.run();
from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello, world!" @app.route("/user/<username>") def show_user(username): return "User page for user " + username @app.route("/game/<gamename>") def show_game(gamename): return "Game page for game " + gamename @app.route("/g...
Add stub methods for expected paths
Add stub methods for expected paths
Python
mit
JamesLaverack/scoreboard,JamesLaverack/scoreboard,JamesLaverack/scoreboard
6cd1c7a95ca4162643b6d52f4bb82596178fde22
gaphor/UML/__init__.py
gaphor/UML/__init__.py
# Here, order matters from gaphor.UML.uml2 import * # noqa: isort:skip from gaphor.UML.presentation import Presentation # noqa: isort:skip import gaphor.UML.uml2overrides # noqa: isort:skip from gaphor.UML.elementfactory import ElementFactory # noqa: isort:skip from gaphor.UML import modelfactory as model # noqa: ...
# Here, order matters from gaphor.UML.uml2 import * # noqa: isort:skip from gaphor.UML.presentation import Presentation # noqa: isort:skip from gaphor.UML.elementfactory import ElementFactory # noqa: isort:skip from gaphor.UML import modelfactory as model # noqa: isort:skip from gaphor.UML.umlfmt import format fro...
Reorder imports in UML module
Reorder imports in UML module
Python
lgpl-2.1
amolenaar/gaphor,amolenaar/gaphor
65c3f9fa4e31bc2c1c448846faba4af58bfd5e61
src/download.py
src/download.py
import tarfile import os from six.moves.urllib import request url_dir = 'https://www.cs.toronto.edu/~kriz/' file_name = 'cifar-10-python.tar.gz' save_dir = 'dataset' tar_path = os.path.join(save_dir, file_name) if __name__ == '__main__': if os.path.exists(tar_path): print('{:s} already downloaded.'.format...
import tarfile import os from six.moves.urllib import request url_dir = 'https://www.cs.toronto.edu/~kriz/' file_name = 'cifar-10-python.tar.gz' save_dir = 'dataset' tar_path = os.path.join(save_dir, file_name) if __name__ == '__main__': if not os.path.exists(save_dir): os.makedirs(save_dir) if os.pat...
Make dataset directory if it does not exist.
[fix] Make dataset directory if it does not exist.
Python
mit
dsanno/chainer-cifar
8836c5a5274c2a3573d2e706b67a1288de6e59bd
utils/repl.py
utils/repl.py
from nex.state import GlobalState from nex.reader import Reader, EndOfFile from nex.lexer import Lexer from nex.instructioner import Instructioner from nex.banisher import Banisher from nex.parsing.command_parser import command_parser from nex.parsing.utils import ChunkGrabber from nex.box_writer import write_to_file f...
from nex.state import GlobalState from nex.reader import Reader from nex.lexer import Lexer from nex.instructioner import Instructioner from nex.banisher import Banisher from nex.parsing.command_parser import command_parser from nex.parsing.utils import ChunkGrabber from nex.box_writer import write_to_dvi_file from nex...
Insert plain.tex into REPL state
Insert plain.tex into REPL state
Python
mit
eddiejessup/nex
4324257e5fe1c49281e4844b07d222b68bd45287
avalon/fusion/lib.py
avalon/fusion/lib.py
import re import os import contextlib from . import pipeline @contextlib.contextmanager def maintained_selection(): comp = pipeline.get_current_comp() previous_selection = comp.GetToolList(True).values() try: yield finally: flow = comp.CurrentFrame.FlowView flow.Select() # No...
import re import os import contextlib from . import pipeline @contextlib.contextmanager def maintained_selection(): comp = pipeline.get_current_comp() previous_selection = comp.GetToolList(True).values() try: yield finally: flow = comp.CurrentFrame.FlowView flow.Select() # No...
Fix doctest - not sure why it was failing on the quotation marks
Fix doctest - not sure why it was failing on the quotation marks
Python
mit
getavalon/core,mindbender-studio/core,mindbender-studio/core,getavalon/core
7b08777d77d6cfd5a4eeeee81fb51f5fdedde987
bumblebee/modules/caffeine.py
bumblebee/modules/caffeine.py
# pylint: disable=C0111,R0903 """Enable/disable automatic screen locking. Requires the following executables: * xset * notify-send """ import bumblebee.input import bumblebee.output import bumblebee.engine class Module(bumblebee.engine.Module): def __init__(self, engine, config): super(Module, s...
# pylint: disable=C0111,R0903 """Enable/disable automatic screen locking. Requires the following executables: * xset * notify-send """ import bumblebee.input import bumblebee.output import bumblebee.engine class Module(bumblebee.engine.Module): def __init__(self, engine, config): super(Module, s...
Add support for switching dpms
Add support for switching dpms
Python
mit
tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status
03d62abc0f48e49e1bfd672ab6c7c60cd8f6fef5
users/models.py
users/models.py
from django.contrib.auth.models import AbstractUser from django.db import models class Person(AbstractUser): description = models.TextField(blank=True) def __str__(self): return "User(<{}>}".format(self.email)
from django.contrib.auth.models import AbstractUser from django.db import models class Person(AbstractUser): description = models.TextField(blank=True) def __str__(self): if self.email: return "User(<{}>)".format(self.email) return "User(<{}>)".format(self.username)
Fix return string from user model
Fix return string from user model Also return username if there is no email address set
Python
mit
Nikola-K/django-template,Nikola-K/django-template
38efa77f8831b2fcceb5f86f31a1ec7dc6aa5627
src/odometry.py
src/odometry.py
#!/usr/bin/env python import rospy from nav_msgs.msg import Odometry current_odometry = None def get_odometry(message): global current_odometry current_odometry = message if __name__ == '__main__': rospy.init_node('odometry') subscriber = rospy.Subscriber('odom', Odometry, get_odometry) publishe...
#!/usr/bin/env python import rospy from gazebo_msgs.msg import ModelStates from geometry_msgs.msg import Pose current_pose = None def get_pose(message): global current_pose current_pose = message.pose[0] if __name__ == '__main__': rospy.init_node('pose') subscriber = rospy.Subscriber('gazebo/mo...
Change subscribed topic and message type
Change subscribed topic and message type
Python
mit
bit0001/trajectory_tracking,bit0001/trajectory_tracking
440b8424f11dc1f665bb512d30795c2bb6eda96e
mapentity/tests/models.py
mapentity/tests/models.py
from django.db.models import loading from django.contrib.gis.db import models from django.contrib.gis.geos import GEOSGeometry from mapentity.models import MapEntityMixin class MushroomSpot(models.Model): serialized = models.CharField(max_length=200, null=True, default=None) """geom as python attribute""" ...
from django.db.models import loading from django.contrib.gis.db import models from django.contrib.gis.geos import GEOSGeometry from mapentity.models import MapEntityMixin class MushroomSpot(models.Model): name = models.CharField(max_length=100, default='Empty') serialized = models.CharField(max_length=200, n...
Add normal field to test model
Add normal field to test model
Python
bsd-3-clause
Anaethelion/django-mapentity,makinacorpus/django-mapentity,Anaethelion/django-mapentity,makinacorpus/django-mapentity,Anaethelion/django-mapentity,makinacorpus/django-mapentity
e34c9ede88524b64b3a84d579718af6766a5e483
bin/get_templates.py
bin/get_templates.py
#!/usr/bin/env python import json import os from engine import types, consts template_dir = os.path.join(os.environ['PORTER'], 'templates') structs = ( (types.new_unit, "Tank", (consts.RED,)), (types.new_attack, "RegularCannon", ()), (types.new_armor, "WeakMetal", ()), (types.new_movement, "Treads",...
#!/usr/bin/env python import json import os from lib.functional import multi_map from engine import types, consts template_dir = os.path.join(os.environ['PORTER'], 'templates') structs = ( (types.new_unit, "Tank", (consts.RED,)), (types.new_attack, "RegularCannon", ()), (types.new_armor, "WeakMetal", ()...
Rename print_struct to generate_template and use multi_map
Rename print_struct to generate_template and use multi_map
Python
mit
Tactique/game_engine,Tactique/game_engine
93abffd833498b4bae083bd70f3f154d9151c384
src/coordinators/models.py
src/coordinators/models.py
from __future__ import unicode_literals from django.db import models from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User from locations.models import District class Coordinator(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) is_manage...
from __future__ import unicode_literals from django.db import models from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User from locations.models import District class Coordinator(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) is_manage...
Fix OneToOneField instance check in filter_by_district
Fix OneToOneField instance check in filter_by_district
Python
mit
mrts/foodbank-campaign,mrts/foodbank-campaign,mrts/foodbank-campaign,mrts/foodbank-campaign
9af7c012c8ef2ca2999408abe98bdc3aa0ee1738
base_partner_merge/__openerp__.py
base_partner_merge/__openerp__.py
{ 'name': 'Base Partner Merge', 'author': 'OpenERP S.A.', 'category': 'Generic Modules/Base', 'version': '0.1', 'description': """ backport module, to be removed when we switch to saas2 on the private servers """, 'depends': [ 'base', ], 'data': [ 'security/ir.model.acces...
{ 'name': 'Base Partner Merge', 'author': "OpenERP S.A.,Odoo Community Association (OCA)", 'category': 'Generic Modules/Base', 'version': '0.1', 'description': """ backport module, to be removed when we switch to saas2 on the private servers """, 'depends': [ 'base', ], 'data': [...
Add OCA as author of OCA addons
Add OCA as author of OCA addons In order to get visibility on https://www.odoo.com/apps the OCA board has decided to add the OCA as author of all the addons maintained as part of the association.
Python
agpl-3.0
microcom/partner-contact,brain-tec/partner-contact,microcom/partner-contact,brain-tec/partner-contact
9dc6de1a97c18fa03787349ed64c1a4100b5d170
datapackage_pipelines_od4tj/processors/fix-numbers.py
datapackage_pipelines_od4tj/processors/fix-numbers.py
from datapackage_pipelines.wrapper import process def process_row(row, row_index, spec, resource_index, parameters, stats): for f in spec['schema']['fields']: if 'factor' in f: factor = { '1m': 1000000 }[f['factor']] v = row[f...
from datapackage_pipelines.wrapper import process def process_row(row, row_index, spec, resource_index, parameters, stats): for f in spec['schema']['fields']: if 'factor' in f: factor = { '1m': 1000000 }[f['factor']] v = r...
Fix bad indentation in processor
Fix bad indentation in processor
Python
mit
okfn/datapackage_pipelines_od4tj
6cb9b552f30cd25b9266677fd2c13140697e2f20
thinglang/foundation/templates.py
thinglang/foundation/templates.py
HEADER = """/** {file_name} Auto-generated code - do not modify. thinglang C++ transpiler, 0.0.0 **/ """ FOUNDATION_ENUM = HEADER + """ #pragma once #include <string> {imports} enum class {name} {{ {values} }}; """ FOUNDATION_SWITCH = """ inline auto {func_name}({name} val){{ switch (val){{ ...
HEADER = """/** {file_name} Auto-generated code - do not modify. thinglang C++ transpiler, 0.0.0 **/ """ FOUNDATION_ENUM = HEADER + """ #pragma once #include <string> {imports} enum class {name} {{ {values} }}; """ FOUNDATION_SWITCH = """ inline auto {func_name}({name} val){{ switch (val){{ ...
Fix capitalization method in class_names
Fix capitalization method in class_names
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
2752c9880934aed1f02ab5e9cc111b07cb449c46
async_messages/middleware.py
async_messages/middleware.py
from django.contrib import messages from async_messages import get_message class AsyncMiddleware(object): def process_request(self, request): # Check for message for this user and, if it exists, # call the messages API with it if not request.user.is_authenticated(): return ...
from django.contrib import messages from async_messages import get_message class AsyncMiddleware(object): def process_response(self, request, response): # Check for message for this user and, if it exists, # call the messages API with it if not request.user.is_authenticated(): ...
Add the message during the processing of the response.
Add the message during the processing of the response.
Python
mit
codeinthehole/django-async-messages
eb9b1cc747dc807a52ee7d0dec0992eb70005840
cacao_app/configuracion/models.py
cacao_app/configuracion/models.py
# -*- coding: utf-8 -*- from django.db import models from solo.models import SingletonModel from ckeditor.fields import RichTextField class Contacto(SingletonModel): """ This model store the Contacto object but this only have one instance """ informacion_contacto = RichTextField('Informacion de Co...
# -*- coding: utf-8 -*- from django.db import models from solo.models import SingletonModel from ckeditor.fields import RichTextField class Contacto(SingletonModel): """ This model store the Contacto object but this only have one instance """ informacion_contacto = RichTextField( 'Informa...
Set help text for app logo
Set help text for app logo
Python
bsd-3-clause
CacaoMovil/guia-de-cacao-django,CacaoMovil/guia-de-cacao-django,CacaoMovil/guia-de-cacao-django
12bcc60fff5119e95fb1de593cc0c5e6ab8294ea
changes/api/jobstep_deallocate.py
changes/api/jobstep_deallocate.py
from __future__ import absolute_import, division, unicode_literals from changes.api.base import APIView from changes.constants import Status from changes.config import db from changes.jobs.sync_job_step import sync_job_step from changes.models import JobStep class JobStepDeallocateAPIView(APIView): def post(sel...
from __future__ import absolute_import, division, unicode_literals from changes.api.base import APIView from changes.constants import Status from changes.config import db from changes.jobs.sync_job_step import sync_job_step from changes.models import JobStep class JobStepDeallocateAPIView(APIView): def post(sel...
Revert "Allow running jobsteps to be deallocated"
Revert "Allow running jobsteps to be deallocated" This reverts commit 9b720026722ce92a8c0e05aa041d6e861c5e4e82.
Python
apache-2.0
wfxiang08/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes,dropbox/changes,dropbox/changes,wfxiang08/changes,bowlofstew/changes,bowlofstew/changes
c3745e7017c1788f4633d09ef4d29a37018b53d3
populus/cli/main.py
populus/cli/main.py
import click @click.group() def main(): """ Populus """ pass
import click CONTEXT_SETTINGS = dict( # Support -h as a shortcut for --help help_option_names=['-h', '--help'], ) @click.group(context_settings=CONTEXT_SETTINGS) def main(): """ Populus """ pass
Support -h as a shortcut for --help
CLI: Support -h as a shortcut for --help
Python
mit
pipermerriam/populus,euri10/populus,euri10/populus,pipermerriam/populus,euri10/populus
35e54a2fa4408aff70989437554cfe1ee2318799
test_utils/views.py
test_utils/views.py
from django.http import HttpResponse import logging from test_utils.testmaker import Testmaker def set_logging(request, filename=None): if not filename: filename = request.REQUEST['filename'] log_file = '/tmp/testmaker/tests/%s_tests_custom.py' % filename serialize_file = '/tmp/testmaker/tests/%s_s...
from django.http import HttpResponse import logging from test_utils.testmaker.processors.base import slugify from test_utils.testmaker import Testmaker def set_logging(request, filename=None): if not filename: filename = request.REQUEST['filename'] filename = slugify(filename) log_file = '/tmp/te...
Use slugify to filenameify the strings passed in. This should probably live in a test_utils.utils. Too many utils!
Use slugify to filenameify the strings passed in. This should probably live in a test_utils.utils. Too many utils!
Python
mit
ericholscher/django-test-utils,frac/django-test-utils,acdha/django-test-utils,frac/django-test-utils,ericholscher/django-test-utils,acdha/django-test-utils
955cb0d27ab52348b753c3edea731223e2631f50
Climate_Police/tests/test_plot_pollutants.py
Climate_Police/tests/test_plot_pollutants.py
#run the test with default values of df, state and year import unittest from plot_pollutants import plot_pollutants import pandas as pd df = pd.read_csv("../data/pollution_us_2000_2016.csv") year="2010" state="Arizona" class TestPlot(unittest.TestCase): def testPlotPollutants(self): result...
#run the test with default values of df, state and year import unittest from plot_pollutants import plot_pollutants import pandas as pd df = pd.read_csv("../data/pollution_us_2000_2016.csv") year="2010" state="Arizona" class TestPlot(unittest.TestCase): def testPlotPollutants(self): fig, f...
Add flag to plot_pollutant unit test
Add flag to plot_pollutant unit test also change assertTrue to assertEqual
Python
mit
abhisheksugam/Climate_Police
b715a0fdc6db68f3c0ae30f1ff09e1aa8bb94524
Wrappers/Phenix/Xtriage.py
Wrappers/Phenix/Xtriage.py
#!/usr/bin/env python # Xtriage.py # Copyright (C) 2017 Diamond Light Source, Richard Gildea # # This code is distributed under the BSD license, a copy of which is # included in the root directory of this package. from __future__ import absolute_import, division, print_function from xia2.Driver.DriverFactory im...
#!/usr/bin/env python from __future__ import absolute_import, division, print_function from xia2.Driver.DriverFactory import DriverFactory def Xtriage(DriverType=None): """A factory for the Xtriage wrappers.""" DriverInstance = DriverFactory.Driver("simple") class XtriageWrapper(DriverInstance.__clas...
Clean __main__ + header boiler plate
Clean __main__ + header boiler plate Then flake8 warnings re: os / sys etc.
Python
bsd-3-clause
xia2/xia2,xia2/xia2
067c9be6c9e362a9a902f3233e1ae0b2643d405f
src/sequences/io/trend/price/macd/s_chunk.py
src/sequences/io/trend/price/macd/s_chunk.py
''' Sequential Price-Trend Models: MACD with Price-Bar-Chunk (MDC) ''' import numpy import json from techmodels.overlays.trend.price.chunk import sign_chunker from techmodels.indicators.trend.price.macd import MACDIndicator def macd_chunk(data, nfast=10, nslow=35, nema=5, getter=lambda x: x): prices = numpy.arra...
''' Sequential Price-Trend Models: MACD with Price-Bar-Chunk (MDC) ''' import numpy import json from techmodels.overlays.trend.price.chunk import sign_chunker from techmodels.indicators.trend.price.macd import MACDIndicator def macd_chunk(data, nfast=10, nslow=35, nema=5, getter=lambda x: x): prices = numpy.arra...
Handle two arguments while converting to JSON
Feature: Handle two arguments while converting to JSON
Python
mpl-2.0
Skalman/owl_analytics