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
bf96bf9d71f432f2db75b0c62b49098235d75661
cryptography/bindings/openssl/pkcs12.py
cryptography/bindings/openssl/pkcs12.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 # distributed under the...
# 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 # distributed under the...
Move these to macros, the exact type of these functions changes by deifne
Move these to macros, the exact type of these functions changes by deifne
Python
bsd-3-clause
Lukasa/cryptography,kimvais/cryptography,skeuomorf/cryptography,sholsapp/cryptography,dstufft/cryptography,bwhmather/cryptography,glyph/cryptography,dstufft/cryptography,bwhmather/cryptography,kimvais/cryptography,dstufft/cryptography,Ayrx/cryptography,Lukasa/cryptography,skeuomorf/cryptography,sholsapp/cryptography,Ha...
bcaf887ccad40adf2cb09627c12f2a3e1b4b006d
redis_cache/client/__init__.py
redis_cache/client/__init__.py
# -*- coding: utf-8 -*- from .default import DefaultClient from .sharded import ShardClient from .herd import HerdClient from .experimental import SimpleFailoverClient from .sentinel import SentinelClient __all__ = ['DefaultClient', 'ShardClient', 'HerdClient', 'SimpleFailoverClient', 'SentinelC...
# -*- coding: utf-8 -*- import warnings from .default import DefaultClient from .sharded import ShardClient from .herd import HerdClient from .experimental import SimpleFailoverClient __all__ = ['DefaultClient', 'ShardClient', 'HerdClient', 'SimpleFailoverClient',] try: from .sentinel import Sentine...
Disable Sentinel client with redis-py < 2.9
Disable Sentinel client with redis-py < 2.9
Python
bsd-3-clause
zl352773277/django-redis,smahs/django-redis,yanheng/django-redis,lucius-feng/django-redis,GetAmbassador/django-redis
684ac5e6e6011581d5abcb42a7c0e54742f20606
Arduino/IMUstream_WifiUDP_iot33/read_UDP_JSON_IMU.py
Arduino/IMUstream_WifiUDP_iot33/read_UDP_JSON_IMU.py
# ------------------------------------------------------- import socket, traceback import time import json host = '' port = 2390 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) s.bind((host, port)) fi...
# ------------------------------------------------------- import socket, traceback import time import json import numpy as np from scipy.spatial.transform import Rotation as R host = '' port = 2390 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.setsocko...
Add computations of great roll, pitch and small yaw angle (kite angles)
Add computations of great roll, pitch and small yaw angle (kite angles)
Python
mit
baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite
0254ad22680d32a451d1faf4b21809394a399311
packages/pegasus-python/src/Pegasus/cli/startup-validation.py
packages/pegasus-python/src/Pegasus/cli/startup-validation.py
#!/usr/bin/python3 import sys if not sys.version_info >= (3, 5): sys.stderr.write("Pegasus requires Python 3.5 or above\n") sys.exit(1) try: pass except: sys.stderr.write("Pegasus requires the Python3 YAML module to be installed\n") sys.exit(1)
#!/usr/bin/python3 import sys if not sys.version_info >= (3, 5): sys.stderr.write("Pegasus requires Python 3.5 or above\n") sys.exit(1) try: import yaml # noqa except: sys.stderr.write("Pegasus requires the Python3 YAML module to be installed\n") sys.exit(1)
Add noqa comment so unused import does not get removed by code lint steps
Add noqa comment so unused import does not get removed by code lint steps
Python
apache-2.0
pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus
6d18ff715a5fa3059ddb609c1abdbbb06b15ad63
fuel/downloaders/celeba.py
fuel/downloaders/celeba.py
from fuel.downloaders.base import default_downloader def fill_subparser(subparser): """Sets up a subparser to download the CelebA dataset file. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `celeba` command. """ urls = ['https://www.dropbox...
from fuel.downloaders.base import default_downloader def fill_subparser(subparser): """Sets up a subparser to download the CelebA dataset file. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `celeba` command. """ urls = ['https://www.dropbox...
Update download links for CelebA files
Update download links for CelebA files
Python
mit
mila-udem/fuel,dmitriy-serdyuk/fuel,dmitriy-serdyuk/fuel,mila-udem/fuel,vdumoulin/fuel,vdumoulin/fuel
e818860af87cad796699e27f8dfb4ff6fc9354e8
h2o-py/h2o/model/autoencoder.py
h2o-py/h2o/model/autoencoder.py
""" AutoEncoder Models """ from model_base import * from metrics_base import * class H2OAutoEncoderModel(ModelBase): """ Class for AutoEncoder models. """ def __init__(self, dest_key, model_json): super(H2OAutoEncoderModel, self).__init__(dest_key, model_json,H2OAutoEncoderModelMetrics) def anomaly(se...
""" AutoEncoder Models """ from model_base import * from metrics_base import * class H2OAutoEncoderModel(ModelBase): """ Class for AutoEncoder models. """ def __init__(self, dest_key, model_json): super(H2OAutoEncoderModel, self).__init__(dest_key, model_json,H2OAutoEncoderModelMetrics) def anomaly(se...
Add extra argument to get per-feature reconstruction error for anomaly detection from Python.
PUBDEV-2078: Add extra argument to get per-feature reconstruction error for anomaly detection from Python.
Python
apache-2.0
kyoren/https-github.com-h2oai-h2o-3,h2oai/h2o-3,mathemage/h2o-3,h2oai/h2o-dev,mathemage/h2o-3,datachand/h2o-3,YzPaul3/h2o-3,h2oai/h2o-3,brightchen/h2o-3,mathemage/h2o-3,YzPaul3/h2o-3,h2oai/h2o-dev,datachand/h2o-3,kyoren/https-github.com-h2oai-h2o-3,printedheart/h2o-3,pchmieli/h2o-3,madmax983/h2o-3,YzPaul3/h2o-3,datacha...
ea1c095fb12c4062616ee0d38818ab1baaabd1eb
ipywidgets/widgets/tests/test_widget_upload.py
ipywidgets/widgets/tests/test_widget_upload.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from unittest import TestCase from traitlets import TraitError from ipywidgets import FileUpload class TestFileUpload(TestCase): def test_construction(self): uploader = FileUpload() # Default ...
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from unittest import TestCase from traitlets import TraitError from ipywidgets import FileUpload class TestFileUpload(TestCase): def test_construction(self): uploader = FileUpload() # Default ...
Test deserialization of comm message following upload
Test deserialization of comm message following upload
Python
bsd-3-clause
ipython/ipywidgets,ipython/ipywidgets,jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets
c5730d19d41f7221c4108f340d0ff8be26c24c74
auxiliary/tag_suggestions/__init__.py
auxiliary/tag_suggestions/__init__.py
from tagging.models import Tag, TaggedItem from django.contrib.contenttypes.models import ContentType from auxiliary.models import TagSuggestion from django.db import IntegrityError def approve(admin, request, tag_suggestions): for tag_suggestion in tag_suggestions: object = tag_suggestion.object t...
from tagging.models import Tag, TaggedItem from django.contrib.contenttypes.models import ContentType def approve(admin, request, tag_suggestions): for tag_suggestion in tag_suggestions: obj = tag_suggestion.object ct = ContentType.objects.get_for_model(obj) tag, t_created = Tag.objects....
Make tag_suggestions test less flaky
Make tag_suggestions test less flaky Failed on Python 2.7.6 as it was dependant on an error string returned
Python
bsd-3-clause
noamelf/Open-Knesset,otadmor/Open-Knesset,habeanf/Open-Knesset,habeanf/Open-Knesset,daonb/Open-Knesset,navotsil/Open-Knesset,noamelf/Open-Knesset,navotsil/Open-Knesset,navotsil/Open-Knesset,otadmor/Open-Knesset,noamelf/Open-Knesset,otadmor/Open-Knesset,ofri/Open-Knesset,Shrulik/Open-Knesset,jspan/Open-Knesset,jspan/Ope...
85b269bde76af2b8d15dc3b1e9f7cf882fc18dc2
labcalc/tests/test_functions.py
labcalc/tests/test_functions.py
#!/usr/bin/env python3 from labcalc.run import * from labcalc import gibson # labcalc.gibson def test_gibson_one_insert(): d = {'insert1': [300, 50], 'vector': [5000, 50]} assert gibson.gibson_calc(d) == {'insert1': 0.24, 'vector': 2.0}
#!/usr/bin/env python3 from labcalc.run import * from labcalc import gibson # labcalc.gibson def test_gibson_one_insert(): d = {'vector': [5000, 50], 'insert1': [300, 50]} assert gibson.gibson_calc(d) == {'vector': 2.0, 'insert1': 0.24} def test_gibson_two_inserts(): d = {'vector': [5000, 50], 'insert1':...
Add tests for multiple gibson inserts
Add tests for multiple gibson inserts
Python
bsd-3-clause
dtarnowski16/labcalc,mandel01/labcalc,mjmlab/labcalc
caaa807a4226bfdeb18681f8ccb6119bd2caa609
pombola/core/context_processors.py
pombola/core/context_processors.py
from django.conf import settings import logging def add_settings( request ): """Add some selected settings values to the context""" return { 'settings': { 'STAGING': settings.STAGING, 'STATIC_GENERATION_NUMBER': settings.STATIC_GENERATION_NUMBER, ...
from django.conf import settings import logging def add_settings( request ): """Add some selected settings values to the context""" return { 'settings': { 'STAGING': settings.STAGING, 'STATIC_GENERATION_NUMBER': settings.STATIC_GENERATION_NUMBER, ...
Add COUNTRY_APP to settings exposed to the templates
Add COUNTRY_APP to settings exposed to the templates
Python
agpl-3.0
hzj123/56th,mysociety/pombola,hzj123/56th,hzj123/56th,patricmutwiri/pombola,patricmutwiri/pombola,ken-muturi/pombola,patricmutwiri/pombola,patricmutwiri/pombola,mysociety/pombola,mysociety/pombola,patricmutwiri/pombola,geoffkilpin/pombola,hzj123/56th,geoffkilpin/pombola,mysociety/pombola,hzj123/56th,geoffkilpin/pombola...
47d9a8df136e235f49921d4782c5e392b0101107
migrations/versions/147_add_cleaned_subject.py
migrations/versions/147_add_cleaned_subject.py
"""add cleaned subject Revision ID: 486c7fa5b533 Revises: 1d7a72222b7c Create Date: 2015-03-10 16:33:41.740387 """ # revision identifiers, used by Alembic. revision = '486c7fa5b533' down_revision = 'c77a90d524' from alembic import op import sqlalchemy as sa from sqlalchemy.sql import text def upgrade(): conn ...
"""add cleaned subject Revision ID: 486c7fa5b533 Revises: 1d7a72222b7c Create Date: 2015-03-10 16:33:41.740387 """ # revision identifiers, used by Alembic. revision = '486c7fa5b533' down_revision = 'c77a90d524' from alembic import op import sqlalchemy as sa from sqlalchemy.sql import text def upgrade(): conn ...
Make _cleaned_subject migration match declared schema.
Make _cleaned_subject migration match declared schema. Test Plan: Upgrade old database to head. Reviewers: kav-ya Reviewed By: kav-ya Differential Revision: https://review.inboxapp.com/D1394
Python
agpl-3.0
Eagles2F/sync-engine,Eagles2F/sync-engine,EthanBlackburn/sync-engine,PriviPK/privipk-sync-engine,PriviPK/privipk-sync-engine,nylas/sync-engine,closeio/nylas,jobscore/sync-engine,jobscore/sync-engine,jobscore/sync-engine,wakermahmud/sync-engine,PriviPK/privipk-sync-engine,wakermahmud/sync-engine,gale320/sync-engine,Eagl...
8910a61025062a40a3129f7a4330964b20337ec2
insanity/core.py
insanity/core.py
import numpy as np import theano import theano.tensor as T
import numpy as np import theano import theano.tensor as T class NeuralNetwork(object): def __init__(self, layers, miniBatchSize): self.miniBatchSize = miniBatchSize #Initialize layers. self.layers = layers self.numLayers = len(self.layers) self.firstLayer = self.layers[0] self.lastLayer = self.layer...
Add first code for NeuralNetwork class.
Add first code for NeuralNetwork class.
Python
cc0-1.0
cn04/insanity
cdaeb29474df423e66cbc79fffa74d937fe2193c
justitie/just/pipelines.py
justitie/just/pipelines.py
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import requests import json from just.items import JustPublication import logging API_KEY = 'justitie-very-secret-key' API_PU...
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import requests import json import logging from just.items import JustPublication import logging API_KEY = 'justitie-very-sec...
Add logging for api calls.
Add logging for api calls.
Python
mpl-2.0
mgax/czl-scrape,margelatu/czl-scrape,costibleotu/czl-scrape,mgax/czl-scrape,code4romania/czl-scrape,lbogdan/czl-scrape,mgax/czl-scrape,lbogdan/czl-scrape,lbogdan/czl-scrape,mgax/czl-scrape,code4romania/czl-scrape,code4romania/czl-scrape,code4romania/czl-scrape,lbogdan/czl-scrape,margelatu/czl-scrape,margelatu/czl-scrap...
837efcddd6c111dabf14a6017d0ae2f6aacbddac
konstrukteur/HtmlParser.py
konstrukteur/HtmlParser.py
# # Konstrukteur - Static website generator # Copyright 2013 Sebastian Fastner # __all__ = ["parse"] from jasy.env.State import session from jasy.core import Console from bs4 import BeautifulSoup def parse(filename): """ HTML parser class for Konstrukteur """ page = {} parsedContent = BeautifulSoup(open(filenam...
# # Konstrukteur - Static website generator # Copyright 2013 Sebastian Fastner # __all__ = ["parse"] from jasy.env.State import session from jasy.core import Console from bs4 import BeautifulSoup def parse(filename): """ HTML parser class for Konstrukteur """ page = {} parsedContent = BeautifulSoup(open(filenam...
Add detection of wrong meta data
Add detection of wrong meta data
Python
mit
fastner/konstrukteur,fastner/konstrukteur,fastner/konstrukteur
a31db91800630520c5b516493bddef76ba8b7edd
flask_oauthlib/utils.py
flask_oauthlib/utils.py
# coding: utf-8 import logging import base64 from flask import request, Response from oauthlib.common import to_unicode, bytes_type log = logging.getLogger('flask_oauthlib') def extract_params(): """Extract request params.""" uri = request.url http_method = request.method headers = dict(request.head...
# coding: utf-8 import logging import base64 from flask import request, Response from oauthlib.common import to_unicode, bytes_type log = logging.getLogger('flask_oauthlib') def extract_params(): """Extract request params.""" uri = request.url http_method = request.method headers = dict(request.head...
Delete useless header transform in extract_params.
Delete useless header transform in extract_params.
Python
bsd-3-clause
auerj/flask-oauthlib,auerj/flask-oauthlib,kevin1024/flask-oauthlib,stianpr/flask-oauthlib,CoreyHyllested/flask-oauthlib,lepture/flask-oauthlib,Ryan-K/flask-oauthlib,tonyseek/flask-oauthlib,RealGeeks/flask-oauthlib,adambard/flask-oauthlib,huxuan/flask-oauthlib,PyBossa/flask-oauthlib,Fleurer/flask-oauthlib,CoreyHyllested...
a91a04af6b95fa600a0b3ce74b5fffc07ecf590e
polymorphic/__init__.py
polymorphic/__init__.py
# -*- coding: utf-8 -*- """ Seamless Polymorphic Inheritance for Django Models Copyright: This code and affiliated files are (C) by Bert Constantin and individual contributors. Please see LICENSE and AUTHORS for more information. """ # See PEP 440 (https://www.python.org/dev/peps/pep-0440/) __version__ = "1.3"
# -*- coding: utf-8 -*- """ Seamless Polymorphic Inheritance for Django Models Copyright: This code and affiliated files are (C) by Bert Constantin and individual contributors. Please see LICENSE and AUTHORS for more information. """ import pkg_resources __version__ = pkg_resources.require("django-polymorphic")[0]....
Set polymorphic.__version__ from setuptools metadata
Set polymorphic.__version__ from setuptools metadata
Python
bsd-3-clause
skirsdeda/django_polymorphic,skirsdeda/django_polymorphic,skirsdeda/django_polymorphic,chrisglass/django_polymorphic,chrisglass/django_polymorphic
8cb680c7fbadfe6cfc245fe1eb1261a00c5ffd6d
djmoney/forms/fields.py
djmoney/forms/fields.py
from __future__ import unicode_literals from warnings import warn from django.forms import MultiValueField, DecimalField, ChoiceField from moneyed.classes import Money from .widgets import MoneyWidget, CURRENCY_CHOICES __all__ = ('MoneyField',) class MoneyField(MultiValueField): def __init__(self, currency_wi...
from __future__ import unicode_literals from warnings import warn from django.forms import MultiValueField, DecimalField, ChoiceField from moneyed.classes import Money from .widgets import MoneyWidget, CURRENCY_CHOICES __all__ = ('MoneyField',) class MoneyField(MultiValueField): def __init__(self, currency_wi...
Support for value of None in MoneyField.compress. Leaving a MoneyField blank in the Django admin site caused an issue when attempting to save an exception was raised since Money was getting an argument list of None.
Support for value of None in MoneyField.compress. Leaving a MoneyField blank in the Django admin site caused an issue when attempting to save an exception was raised since Money was getting an argument list of None.
Python
bsd-3-clause
recklessromeo/django-money,rescale/django-money,iXioN/django-money,AlexRiina/django-money,tsouvarev/django-money,iXioN/django-money,tsouvarev/django-money,recklessromeo/django-money
98ca37ed174e281542df2f1026a298387845b524
rmgpy/tools/data/generate/input.py
rmgpy/tools/data/generate/input.py
# Data sources for kinetics database( thermoLibraries = ['primaryThermoLibrary'], reactionLibraries = [], seedMechanisms = [], kineticsDepositories = 'default', #this section lists possible reaction families to find reactioons with kineticsFamilies = ['!Intra_Disproportionation','!Substitutio...
# Data sources for kinetics database( thermoLibraries = ['primaryThermoLibrary'], reactionLibraries = [], seedMechanisms = [], kineticsDepositories = 'default', #this section lists possible reaction families to find reactioons with kineticsFamilies = ['R_Recombination'], kineticsEstimator...
Cut down on the loading of families in the normal GenerateReactionsTest
Cut down on the loading of families in the normal GenerateReactionsTest Change generateReactions input reactant to propyl
Python
mit
nickvandewiele/RMG-Py,nyee/RMG-Py,pierrelb/RMG-Py,chatelak/RMG-Py,pierrelb/RMG-Py,nickvandewiele/RMG-Py,chatelak/RMG-Py,nyee/RMG-Py
25695e927fbbf46df385b4c68fa4d80b81283ace
indico/migrations/versions/20200904_1543_f37d509e221c_add_user_profile_picture_source_column.py
indico/migrations/versions/20200904_1543_f37d509e221c_add_user_profile_picture_source_column.py
"""Add column for profile picture type to User Revision ID: f37d509e221c Revises: c997dc927fbc Create Date: 2020-09-04 15:43:18.413156 """ from enum import Enum import sqlalchemy as sa from alembic import op from indico.core.db.sqlalchemy import PyIntEnum # revision identifiers, used by Alembic. revision = 'f37d5...
"""Add column for profile picture type to User Revision ID: f37d509e221c Revises: c997dc927fbc Create Date: 2020-09-04 15:43:18.413156 """ from enum import Enum import sqlalchemy as sa from alembic import op from werkzeug.http import http_date from indico.core.db.sqlalchemy import PyIntEnum from indico.util.date_ti...
Add lastmod to existing profile picture metadata
Add lastmod to existing profile picture metadata
Python
mit
pferreir/indico,indico/indico,pferreir/indico,indico/indico,indico/indico,DirkHoffmann/indico,ThiefMaster/indico,ThiefMaster/indico,ThiefMaster/indico,pferreir/indico,pferreir/indico,DirkHoffmann/indico,ThiefMaster/indico,indico/indico,DirkHoffmann/indico,DirkHoffmann/indico
6384fd52a4d271f0f3403ae613dd66cbeb217ddf
indra/tests/test_biogrid.py
indra/tests/test_biogrid.py
from __future__ import absolute_import, print_function, unicode_literals from builtins import dict, str from indra.databases import biogrid_client from indra.util import unicode_strs from nose.plugins.attrib import attr from indra.sources.biogrid import process_file from indra.statements import Complex import os this_...
from __future__ import absolute_import, print_function, unicode_literals from builtins import dict, str import os from nose.plugins.attrib import attr from indra.statements import Complex from indra.databases import biogrid_client from indra.util import unicode_strs from indra.sources.biogrid import BiogridProcessor t...
Update test to use new API
Update test to use new API
Python
bsd-2-clause
johnbachman/indra,pvtodorov/indra,sorgerlab/belpy,sorgerlab/belpy,bgyori/indra,johnbachman/belpy,johnbachman/indra,bgyori/indra,johnbachman/indra,sorgerlab/indra,pvtodorov/indra,johnbachman/belpy,pvtodorov/indra,bgyori/indra,sorgerlab/indra,sorgerlab/belpy,sorgerlab/indra,pvtodorov/indra,johnbachman/belpy
79c8d40d8a47a4413540acac671345dd5faed46e
suorganizer/urls.py
suorganizer/urls.py
"""suorganizer URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class...
"""suorganizer URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class...
Add name parameter to Tag Detail URL.
Ch05: Add name parameter to Tag Detail URL.
Python
bsd-2-clause
jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8
75c48ecbac476fd751e55745cc2935c1dac1f138
longest_duplicated_substring.py
longest_duplicated_substring.py
#!/usr/bin/env python import sys # O(n^4) approach: generate all possible substrings and # compare each for equality. def longest_duplicated_substring(string): """Return the longest duplicated substring. Keyword Arguments: string -- the string to examine for duplicated substrings This approach exa...
#!/usr/bin/env python import sys def longest_duplicated_substring(string): """Return the longest duplicated substring. Keyword Arguments: string -- the string to examine for duplicated substrings This approach examines each possible pair of starting points for duplicated substrings. If the char...
Move todos into issues tracking on GitHub
Move todos into issues tracking on GitHub
Python
mit
taylor-peterson/longest-duplicated-substring
847a88c579118f8a0d528284ab3ea029ccca7215
git_pre_commit_hook/builtin_plugins/rst_check.py
git_pre_commit_hook/builtin_plugins/rst_check.py
import os import fnmatch import restructuredtext_lint DEFAULTS = { 'files': '*.rst', } def make_message(error): return '%s %s:%s %s\n' % ( error.type, error.source, error.line, error.message, ) def check(file_staged_for_commit, options): basename = os.path.basename(file_staged_for_commit.p...
"""Check that files contains valid ReStructuredText.""" import os import fnmatch import restructuredtext_lint DEFAULTS = { 'files': '*.rst', } def make_message(error): return '%s %s:%s %s\n' % ( error.type, error.source, error.line, error.message, ) def check(file_staged_for_commit, options): ...
Add description to rst plugin
Add description to rst plugin
Python
mit
evvers/git-pre-commit-hook
bc7b1fc053150728095ec5d0a41611aa4d4ede45
kerrokantasi/settings/__init__.py
kerrokantasi/settings/__init__.py
from .util import get_settings, load_local_settings, load_secret_key from . import base settings = get_settings(base) load_local_settings(settings, "local_settings") load_secret_key(settings) if not settings["DEBUG"] and settings["JWT_AUTH"]["JWT_SECRET_KEY"] == "kerrokantasi": raise ValueError("Refusing to run o...
from .util import get_settings, load_local_settings, load_secret_key from . import base settings = get_settings(base) load_local_settings(settings, "local_settings") load_secret_key(settings) settings['CKEDITOR_CONFIGS'] = { 'default': { 'stylesSet': [ { "name": 'Lead', ...
Remove JWT_AUTH check from settings
Remove JWT_AUTH check from settings JWT settings has been removed in OpenID change and currently there isn't use for this.
Python
mit
City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi
c0fc60aa5fd51ac9a5795017fdc57d5b89b300e7
tests/check_locale_format_consistency.py
tests/check_locale_format_consistency.py
import re import json import glob locale_folder = "../locales/" locale_files = glob.glob(locale_folder + "*.json") locale_files = [filename.split("/")[-1] for filename in locale_files] locale_files.remove("en.json") reference = json.loads(open(locale_folder + "en.json").read()) for locale_file in locale_files: ...
import re import json import glob # List all locale files (except en.json being the ref) locale_folder = "../locales/" locale_files = glob.glob(locale_folder + "*.json") locale_files = [filename.split("/")[-1] for filename in locale_files] locale_files.remove("en.json") reference = json.loads(open(locale_folder + "en...
Add comments + return 1 if inconsistencies found
Add comments + return 1 if inconsistencies found
Python
agpl-3.0
YunoHost/yunohost,YunoHost/yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost
423dcb102fc2b7a1108a0b0fe1e116e8a5d451c9
netsecus/korrekturtools.py
netsecus/korrekturtools.py
from __future__ import unicode_literals import os def readStatus(student): student = student.lower() if not os.path.exists("attachments"): return if not os.path.exists(os.path.join("attachments", student)): return "Student ohne Abgabe" if not os.path.exists(os.path.join("attachment...
from __future__ import unicode_literals import os from . import helper def readStatus(student): student = student.lower() if not os.path.exists("attachments"): return if not os.path.exists(os.path.join("attachments", student)): return "Student ohne Abgabe" if not os.path.exists(o...
Add error message for malformed request
Add error message for malformed request
Python
mit
hhucn/netsec-uebungssystem,hhucn/netsec-uebungssystem,hhucn/netsec-uebungssystem
3cbc3b96d3f91c940c5d762ce08da9814c29b04d
utils/gyb_syntax_support/protocolsMap.py
utils/gyb_syntax_support/protocolsMap.py
SYNTAX_BUILDABLE_EXPRESSIBLE_BY_CONFORMANCES = { 'ExpressibleByConditionElement': [ 'ExpressibleByConditionElementList' ], 'ExpressibleByDeclBuildable': [ 'ExpressibleByCodeBlockItem', 'ExpressibleByMemberDeclListItem', 'ExpressibleBySyntaxBuildable' ], 'ExpressibleBy...
SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES = { 'ExpressibleAsConditionElement': [ 'ExpressibleAsConditionElementList' ], 'ExpressibleAsDeclBuildable': [ 'ExpressibleAsCodeBlockItem', 'ExpressibleAsMemberDeclListItem', 'ExpressibleAsSyntaxBuildable' ], 'ExpressibleAs...
Revert "[SwiftSyntax] Replace ExpressibleAs protocols by ExpressibleBy protocols"
Revert "[SwiftSyntax] Replace ExpressibleAs protocols by ExpressibleBy protocols"
Python
apache-2.0
roambotics/swift,glessard/swift,ahoppen/swift,roambotics/swift,apple/swift,roambotics/swift,gregomni/swift,ahoppen/swift,JGiola/swift,JGiola/swift,apple/swift,gregomni/swift,benlangmuir/swift,gregomni/swift,glessard/swift,atrick/swift,benlangmuir/swift,ahoppen/swift,atrick/swift,benlangmuir/swift,gregomni/swift,atrick/...
1b3f97ff7bc219588b94a2346ac91f10203e44b9
matador/commands/deployment/__init__.py
matador/commands/deployment/__init__.py
from .deploy_sql_script import DeploySqlScript, DeployOraclePackage from .deploy_report import DeployExceleratorReport
from .deploy_sql_script import DeploySqlScript, DeployOraclePackage from .deploy_report import DeployExceleratorReport, DeployReportFile
Add report file deployment to init
Add report file deployment to init
Python
mit
Empiria/matador
7ea03c6ded823458d7159c05f89d99ee3c4a2e42
scripts/tools/botmap.py
scripts/tools/botmap.py
#!/usr/bin/env python import os import sys path = os.path.join(os.path.dirname(__file__), os.path.pardir, 'common') sys.path.append(path) import chromium_utils slaves = [] for master in chromium_utils.ListMasters(): masterbase = os.path.basename(master) master_slaves = {} execfile(os.path.join(master, 'slaves.c...
#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Dumps a list of known slaves, along with their OS and master.""" import os import sys path = os.path.join(os.path.dirname(__fil...
Tweak import statement to satisfy presubmit checks.
Tweak import statement to satisfy presubmit checks. Review URL: http://codereview.chromium.org/8292004 git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@105578 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
eunchong/build,eunchong/build,eunchong/build,eunchong/build
6fc5a47efbd4b760672b13292c5c4886842fbdbd
tests/local_test.py
tests/local_test.py
from nose.tools import istest, assert_equal from spur import LocalShell shell = LocalShell() @istest def output_of_run_is_stored(): result = shell.run(["echo", "hello"]) assert_equal("hello\n", result.output) @istest def cwd_of_run_can_be_set(): result = shell.run(["pwd"], cwd="/") assert_equal("/\n...
from nose.tools import istest, assert_equal from spur import LocalShell shell = LocalShell() @istest def output_of_run_is_stored(): result = shell.run(["echo", "hello"]) assert_equal("hello\n", result.output) @istest def cwd_of_run_can_be_set(): result = shell.run(["pwd"], cwd="/") assert_equal("/\n...
Add test for LocalShell.run with update_env
Add test for LocalShell.run with update_env
Python
bsd-2-clause
mwilliamson/spur.py
f55d590004874f9ec64c041b5630321e686bf6f9
mindbender/plugins/validate_id.py
mindbender/plugins/validate_id.py
import pyblish.api class ValidateMindbenderID(pyblish.api.InstancePlugin): """All models must have an ID attribute""" label = "Mindbender ID" order = pyblish.api.ValidatorOrder hosts = ["maya"] families = ["mindbender.model"] def process(self, instance): from maya import cmds ...
import pyblish.api class ValidateMindbenderID(pyblish.api.InstancePlugin): """All models must have an ID attribute""" label = "Mindbender ID" order = pyblish.api.ValidatorOrder hosts = ["maya"] families = ["mindbender.model", "mindbender.lookdev"] def process(self, instance): from ma...
Extend ID validator to lookdev
Extend ID validator to lookdev
Python
mit
mindbender-studio/core,MoonShineVFX/core,mindbender-studio/core,getavalon/core,MoonShineVFX/core,getavalon/core,pyblish/pyblish-mindbender
09be419960d208967771d93025c4f86b80ebe4e9
python/qibuild/__init__.py
python/qibuild/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2012-2018 SoftBank Robotics. All rights reserved. # Use of this source code is governed by a BSD-style license (see the COPYING file). """ This module contains a few functions for running CMake and building projects. """ from __future__ import absolute_impor...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2012-2018 SoftBank Robotics. All rights reserved. # Use of this source code is governed by a BSD-style license (see the COPYING file). """ This module contains a few functions for running CMake and building projects. """ from __future__ import absolute_impor...
Revert "use utf-8 by default"
Revert "use utf-8 by default" This reverts commit a986aac5e3b4f065d6c2ab70129bde105651d2ca.
Python
bsd-3-clause
aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild
c7cb6c1441bcfe359a9179858492044591e80007
osgtest/tests/test_10_condor.py
osgtest/tests/test_10_condor.py
from os.path import join import osgtest.library.core as core import osgtest.library.files as files import osgtest.library.condor as condor import osgtest.library.osgunittest as osgunittest import osgtest.library.service as service personal_condor_config = ''' DAEMON_LIST = COLLECTOR, MASTER, NEGOTIATOR, SCHEDD, START...
from os.path import join import osgtest.library.core as core import osgtest.library.files as files import osgtest.library.condor as condor import osgtest.library.osgunittest as osgunittest import osgtest.library.service as service personal_condor_config = ''' DAEMON_LIST = COLLECTOR, MASTER, NEGOTIATOR, SCHEDD, START...
Make the personal condor config world readable
Make the personal condor config world readable
Python
apache-2.0
efajardo/osg-test,efajardo/osg-test
d8b477083866a105947281ca34cb6e215417f44d
packs/salt/actions/lib/utils.py
packs/salt/actions/lib/utils.py
import yaml action_meta = { "name": "", "parameters": { "action": { "type": "string", "immutable": True, "default": "" }, "kwargs": { "type": "object", "required": False } }, "runner_type": "run-python", "de...
# pylint: disable=line-too-long import yaml from .meta import actions runner_action_meta = { "name": "", "parameters": { "action": { "type": "string", "immutable": True, "default": "" }, "kwargs": { "type": "object", "required...
Make distinction between local and runner action payload templates. Added small description for sanitizing the NetAPI payload for logging.
Make distinction between local and runner action payload templates. Added small description for sanitizing the NetAPI payload for logging.
Python
apache-2.0
pidah/st2contrib,StackStorm/st2contrib,psychopenguin/st2contrib,lmEshoo/st2contrib,armab/st2contrib,StackStorm/st2contrib,pearsontechnology/st2contrib,digideskio/st2contrib,digideskio/st2contrib,armab/st2contrib,tonybaloney/st2contrib,pearsontechnology/st2contrib,lmEshoo/st2contrib,tonybaloney/st2contrib,psychopenguin/...
60625877a23e26e66c2c97cbeb4f139ede717eda
B.py
B.py
#! /usr/bin/env python3 # coding: utf-8 from collections import namedtuple import matplotlib.pyplot as plt BCand = namedtuple('BCand', ['m', 'merr', 'pt', 'p']) bs = [] with open('B.txt') as f: for line in f.readlines()[1:]: bs.append(BCand(*[float(v) for v in line.strip().split(',')])) masses = [b.m f...
#! /usr/bin/env python3 # coding: utf-8 from collections import namedtuple import matplotlib.pyplot as plt import numpy as np BCand = namedtuple('BCand', ['m', 'merr', 'pt', 'p']) bs = [BCand(*b) for b in np.genfromtxt('B.txt', skip_header=1, delimiter=',')] masses = [b.m for b in bs] ns, bins, _ = plt.hist(masses...
Use numpy for readin and add errorbars.
Use numpy for readin and add errorbars.
Python
mit
bixel/python-introduction
2dcb159bdd826ceeb68658cc3760c97dae04289e
partner_firstname/exceptions.py
partner_firstname/exceptions.py
# -*- encoding: utf-8 -*- # Odoo, Open Source Management Solution # Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es> # # 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 versio...
# -*- encoding: utf-8 -*- # Odoo, Open Source Management Solution # Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es> # # 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 versio...
Add args to exception to display the correct message in the UI.
Add args to exception to display the correct message in the UI.
Python
agpl-3.0
BT-ojossen/partner-contact,Ehtaga/partner-contact,BT-fgarbely/partner-contact,acsone/partner-contact,BT-jmichaud/partner-contact,charbeljc/partner-contact,sergiocorato/partner-contact,Antiun/partner-contact,raycarnes/partner-contact,idncom/partner-contact,Endika/partner-contact,gurneyalex/partner-contact,QANSEE/partner...
7a17facf68a90d246b4bee55491c9495a8c5ca50
tg/dottednames/jinja_lookup.py
tg/dottednames/jinja_lookup.py
"""Genshi template loader that supports dotted names.""" from os.path import exists, getmtime from jinja2.exceptions import TemplateNotFound from jinja2.loaders import FileSystemLoader from tg import config class JinjaTemplateLoader(FileSystemLoader): """Jinja template loader supporting dotted filenames. Based on...
"""Genshi template loader that supports dotted names.""" from os.path import exists, getmtime from jinja2.exceptions import TemplateNotFound from jinja2.loaders import FileSystemLoader from tg import config class JinjaTemplateLoader(FileSystemLoader): """Jinja template loader supporting dotted filenames. Based...
Make JinjaTemplateLoader work with Python 2.4.
Make JinjaTemplateLoader work with Python 2.4.
Python
mit
lucius-feng/tg2,lucius-feng/tg2
ddb64a0b7a09203c8367c47d34ac29a82af012c0
produceEports.py
produceEports.py
#!/usr/bin/env python from app.views.export import write_all_measurements_csv import tempfile import os f = open("{0}/app/static/exports/AllMeasurements_inprogress.csv".format(os.path.dirname(os.path.realpath(__file__))), "w") try: write_all_measurements_csv(f) finally: f.close os.rename("app/static/exports...
#!/usr/bin/env python from app.views.export import write_all_measurements_csv import tempfile import os exportDirectory = "{0}/app/static/exports".format(os.path.dirname(os.path.realpath(__file__)) workingFile = "{0}/AllMeasurements_inprogress.csv".format(exportDirectory) finalFile = "{0}/AllMeasurements.csv".format(e...
Use directory for all interaction - duh!
Use directory for all interaction - duh!
Python
mit
rabramley/telomere,rabramley/telomere,rabramley/telomere
8a544ac2db71d4041c77fdb0ddfe27b84b565bb5
salt/utils/saltminionservice.py
salt/utils/saltminionservice.py
# Import salt libs from salt.utils.winservice import Service, instart import salt # Import third party libs import win32serviceutil import win32service import winerror import win32api # Import python libs import sys class MinionService(Service): def start(self): self.runflag = True self.log("St...
# Import salt libs from salt.utils.winservice import Service, instart import salt # Import third party libs import win32serviceutil import win32service import winerror # Import python libs import sys class MinionService(Service): def start(self): self.runflag = True self.log("Starting the Salt ...
Revert "Catch and ignore CTRL_LOGOFF_EVENT when run as a windows service"
Revert "Catch and ignore CTRL_LOGOFF_EVENT when run as a windows service" This reverts commit a7ddf81b37b578b1448f83b0efb4f7116de0c3fb.
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
eeb8057fb5ff65eb89e3b5a8ff94bf58adc511ee
utils/lit/tests/test-output.py
utils/lit/tests/test-output.py
# RUN: %{lit} -j 1 -v %{inputs}/test-data --output %t.results.out > %t.out # RUN: FileCheck < %t.results.out %s # CHECK: { # CHECK: "__version__" # CHECK: "elapsed" # CHECK-NEXT: "tests": [ # CHECK-NEXT: { # CHECK-NEXT: "code": "PASS", # CHECK-NEXT: "elapsed": {{[0-9.]+}}, # CHECK-NEXT: "metrics": { # CH...
# RUN: %{lit} -j 1 -v %{inputs}/test-data --output %t.results.out > %t.out # RUN: FileCheck < %t.results.out %s # CHECK: { # CHECK: "__version__" # CHECK: "elapsed" # CHECK-NEXT: "tests": [ # CHECK-NEXT: { # CHECK-NEXT: "code": "PASS", # CHECK-NEXT: "elapsed": {{[0-9.]+}}, # CHECK-NEXT: "metrics": { # CH...
Refactor test incase results are backwards
Refactor test incase results are backwards Looks like results can come in either way in this file. Loosen the ordering constraints. git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@331945 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,apple/swift-llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,llvm-mirror/llvm,apple/swift-llv...
b367e2919c0de02f3514dfac5c890ffd70603918
src/nodeconductor_assembly_waldur/experts/filters.py
src/nodeconductor_assembly_waldur/experts/filters.py
import django_filters from nodeconductor.core import filters as core_filters from . import models class ExpertProviderFilter(django_filters.FilterSet): customer = core_filters.URLFilter(view_name='customer-detail', name='customer__uuid') customer_uuid = django_filters.UUIDFilter(name='customer__uuid') ...
import django_filters from nodeconductor.core import filters as core_filters from . import models class ExpertProviderFilter(django_filters.FilterSet): customer = core_filters.URLFilter(view_name='customer-detail', name='customer__uuid') customer_uuid = django_filters.UUIDFilter(name='customer__uuid') ...
Fix expert request filter by customer and project name.
Fix expert request filter by customer and project name.
Python
mit
opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur
2f8c3ab7ecd0606069d524192c551e7be77ca461
zhihudaily/views/with_image.py
zhihudaily/views/with_image.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import datetime from flask import render_template, Blueprint from zhihudaily.utils import make_request from zhihudaily.cache import cache image_ui = Blueprint('image_ui', __name__, template_folder='templates') ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from flask import render_template, Blueprint, json from zhihudaily.cache import cache from zhihudaily.models import Zhihudaily from zhihudaily.utils import Date image_ui = Blueprint('image_ui', __name__, templat...
Switch to use database for image ui
Switch to use database for image ui
Python
mit
lord63/zhihudaily,lord63/zhihudaily,lord63/zhihudaily
5c405745c954c2aa6121ddd82fb13ffef11b3150
pyp2rpm/utils.py
pyp2rpm/utils.py
import functools from pyp2rpm import settings def memoize_by_args(func): """Memoizes return value of a func based on args.""" memory = {} @functools.wraps(func) def memoized(*args): if not args in memory.keys(): value = func(*args) memory[args] = value return ...
import functools from pyp2rpm import settings def memoize_by_args(func): """Memoizes return value of a func based on args.""" memory = {} @functools.wraps(func) def memoized(*args): if not args in memory.keys(): value = func(*args) memory[args] = value return ...
Revert the commit "bc85b4e" to keep the current solution
Revert the commit "bc85b4e" to keep the current solution
Python
mit
henrysher/spec4pypi
ab81837b707280b960ca02675a85da7918d17fec
setuptools/command/bdist_rpm.py
setuptools/command/bdist_rpm.py
# This is just a kludge so that bdist_rpm doesn't guess wrong about the # distribution name and version, if the egg_info command is going to alter # them, another kludge to allow you to build old-style non-egg RPMs. from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm class bdist_rpm(_bdist_rpm): def ...
# This is just a kludge so that bdist_rpm doesn't guess wrong about the # distribution name and version, if the egg_info command is going to alter # them, another kludge to allow you to build old-style non-egg RPMs. from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm class bdist_rpm(_bdist_rpm): def ...
Adjust to match modern style conventions.
Adjust to match modern style conventions.
Python
mit
pypa/setuptools,pypa/setuptools,pypa/setuptools
58eb4b2b034d90f45b3daa12900f24a390bb4782
setuptools/command/bdist_rpm.py
setuptools/command/bdist_rpm.py
# This is just a kludge so that bdist_rpm doesn't guess wrong about the # distribution name and version, if the egg_info command is going to alter # them, another kludge to allow you to build old-style non-egg RPMs. from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm class bdist_rpm(_bdist_rpm): def ...
from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm class bdist_rpm(_bdist_rpm): """ Override the default bdist_rpm behavior to do the following: 1. Run egg_info to ensure the name and version are properly calculated. 2. Always run 'install' using --single-version-externally-managed to ...
Replace outdated deprecating comments with a proper doc string.
Replace outdated deprecating comments with a proper doc string.
Python
mit
pypa/setuptools,pypa/setuptools,pypa/setuptools
678532961cbc676fb3b82fa58185b281a8a4a7b3
rex/preconstrained_file_stream.py
rex/preconstrained_file_stream.py
from angr.state_plugins.plugin import SimStatePlugin from angr.storage.file import SimFileStream class SimPreconstrainedFileStream(SimFileStream): def __init__(self, name, preconstraining_handler=None, **kwargs): super().__init__(name, **kwargs) self.preconstraining_handler = preconstraining_han...
from angr.state_plugins.plugin import SimStatePlugin from angr.storage.file import SimFileStream class SimPreconstrainedFileStream(SimFileStream): def __init__(self, name, preconstraining_handler=None, **kwargs): super().__init__(name, **kwargs) self.preconstraining_handler = preconstraining_han...
Fix a bug that leads to failures in pickling.
SimPreconstrainedFileStream: Fix a bug that leads to failures in pickling.
Python
bsd-2-clause
shellphish/rex,shellphish/rex
91f503cd99dfa6fc6562afc1b627b6f8b0f1d91b
addons/l10n_ar/models/res_partner_bank.py
addons/l10n_ar/models/res_partner_bank.py
# Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models, api, _ import stdnum.ar.cbu def validate_cbu(cbu): return stdnum.ar.cbu.validate(cbu) class ResPartnerBank(models.Model): _inherit = 'res.partner.bank' @api.model def _get_supported_account_types(se...
# Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models, api, _ from odoo.exceptions import ValidationError import stdnum.ar import logging _logger = logging.getLogger(__name__) def validate_cbu(cbu): try: return stdnum.ar.cbu.validate(cbu) except Exception a...
Fix ImportError: No module named 'stdnum.ar.cbu'
[FIX] l10n_ar: Fix ImportError: No module named 'stdnum.ar.cbu' Since stdnum.ar.cbu is not available in odoo saas enviroment because is using an old version of stdnum package, we add a try exept in order to catch this and manage the error properly which is raise an exception and leave a message in the log telling the ...
Python
agpl-3.0
ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo
5cd0507e99d8f78597d225266ec09f6588308396
tests/app/public_contracts/test_POST_notification.py
tests/app/public_contracts/test_POST_notification.py
from flask import json from . import return_json_from_response, validate_v0 from tests import create_authorization_header def _post_notification(client, template, url, to): data = { 'to': to, 'template': str(template.id) } auth_header = create_authorization_header(service_id=template.ser...
from flask import json from . import return_json_from_response, validate_v0 from tests import create_authorization_header def _post_notification(client, template, url, to): data = { 'to': to, 'template': str(template.id) } auth_header = create_authorization_header(service_id=template.ser...
Revert "Fixed faoiling jenkins tests. Mocked the required functions"
Revert "Fixed faoiling jenkins tests. Mocked the required functions" This reverts commit 4b60c8dadaa413581cd373c9059ff95ecf751159.
Python
mit
alphagov/notifications-api,alphagov/notifications-api
4467ffe669eec09bab16f4e5a3256ed333c5d3d5
rcamp/lib/ldap_utils.py
rcamp/lib/ldap_utils.py
from django.conf import settings from ldapdb import escape_ldap_filter import ldap def authenticate(dn,pwd,ldap_conf_key): # Setup connection ldap_conf = settings.LDAPCONFS[ldap_conf_key] server = ldap_conf['server'] ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW) conn = ldap.in...
from django.conf import settings from ldapdb import escape_ldap_filter import ldap def authenticate(dn,pwd,ldap_conf_key): # Setup connection ldap_conf = settings.LDAPCONFS[ldap_conf_key] server = ldap_conf['server'] ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW) conn = ldap.in...
Set bytes_mode=False for future compatability with Python3
Set bytes_mode=False for future compatability with Python3
Python
mit
ResearchComputing/RCAMP,ResearchComputing/RCAMP,ResearchComputing/RCAMP,ResearchComputing/RCAMP
c872b9991ec1a80d03906cebfb43e71335ba9c26
tests/run/generator_frame_cycle.py
tests/run/generator_frame_cycle.py
# mode: run # tag: generator import cython import sys def test_generator_frame_cycle(): """ >>> test_generator_frame_cycle() ("I'm done",) """ testit = [] def whoo(): try: yield except: yield finally: testit.append("I'm done") g ...
# mode: run # tag: generator import cython import sys def test_generator_frame_cycle(): """ >>> test_generator_frame_cycle() ("I'm done",) """ testit = [] def whoo(): try: yield except: yield finally: testit.append("I'm done") g ...
Fix a CPython comparison test in CPython 3.3 which was apparently fixed only in 3.4 and later.
Fix a CPython comparison test in CPython 3.3 which was apparently fixed only in 3.4 and later.
Python
apache-2.0
cython/cython,cython/cython,da-woods/cython,scoder/cython,cython/cython,scoder/cython,scoder/cython,cython/cython,da-woods/cython,da-woods/cython,scoder/cython,da-woods/cython
88f699690a48bc9e204c561443a53ca03dcf1ae6
test/python_api/default-constructor/sb_type.py
test/python_api/default-constructor/sb_type.py
""" Fuzz tests an object after the default construction to make sure it does not crash lldb. """ import sys import lldb def fuzz_obj(obj): obj.GetName() obj.GetByteSize() #obj.GetEncoding(5) obj.GetNumberChildren(True) member = lldb.SBTypeMember() obj.GetChildAtIndex(True, 0, member) obj.G...
""" Fuzz tests an object after the default construction to make sure it does not crash lldb. """ import sys import lldb def fuzz_obj(obj): obj.GetName() obj.GetByteSize() #obj.GetEncoding(5) obj.GetNumberChildren(True) member = lldb.SBTypeMember() obj.GetChildAtIndex(True, 0, member) obj.G...
Add fuzz calls for SBType::IsPointerType(void *opaque_type).
Add fuzz calls for SBType::IsPointerType(void *opaque_type). git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@134551 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb
4636c9394138534fc39cc5bdac373b97919ffd01
server/info/services.py
server/info/services.py
"""info services.""" from info.models import Article, News, Column def get_column_object(uid): """Get column object.""" try: obj = Column.objects.get(uid=uid) except Column.DoesNotExist: obj = None return obj def get_articles_by_column(uid): """Get_articles_by_column.""" quer...
"""info services.""" from info.models import Article, News, Column def get_column_object(uid): """Get column object.""" try: obj = Column.objects.get(uid=uid) except Column.DoesNotExist: obj = None return obj def get_articles_by_column(uid): """Get_articles_by_column.""" quer...
Modify django orm filter, add only
Modify django orm filter, add only
Python
mit
istommao/codingcatweb,istommao/codingcatweb,istommao/codingcatweb
b46727a6bf8c1d85e0f9f8828954440bc489f247
panoptes_client/user.py
panoptes_client/user.py
from __future__ import absolute_import, division, print_function from panoptes_client.panoptes import PanoptesObject, LinkResolver class User(PanoptesObject): _api_slug = 'users' _link_slug = 'users' _edit_attributes = () def avatar(self): return User.http_get('{}/avatar'.format(self.id))[0]...
from __future__ import absolute_import, division, print_function from panoptes_client.panoptes import PanoptesObject, LinkResolver class User(PanoptesObject): _api_slug = 'users' _link_slug = 'users' _edit_attributes = () @property def avatar(self): return User.http_get('{}/avatar'.forma...
Change User.avatar to be a property
Change User.avatar to be a property
Python
apache-2.0
zooniverse/panoptes-python-client
437ed5ee5e919186eabd1d71b0c1949adc1cf378
src/orca/gnome-terminal.py
src/orca/gnome-terminal.py
# gnome-terminal script import a11y import speech def onTextInserted (e): if e.source.role != "terminal": return speech.say ("default", e.any_data) def onTextDeleted (event): """Called whenever text is deleted from an object. Arguments: - event: the Event """ # Ignore t...
# gnome-terminal script import a11y import speech import default def onTextInserted (e): if e.source.role != "terminal": return speech.say ("default", e.any_data) def onTextDeleted (event): """Called whenever text is deleted from an object. Arguments: - event: the Event """ ...
Call default.brlUpdateText instead of brlUpdateText (which was undefined)
Call default.brlUpdateText instead of brlUpdateText (which was undefined)
Python
lgpl-2.1
GNOME/orca,h4ck3rm1k3/orca-sonar,pvagner/orca,h4ck3rm1k3/orca-sonar,GNOME/orca,pvagner/orca,h4ck3rm1k3/orca-sonar,chrys87/orca-beep,chrys87/orca-beep,pvagner/orca,pvagner/orca,chrys87/orca-beep,GNOME/orca,chrys87/orca-beep,GNOME/orca
45b3fc7babfbd922bdb174e5156f54c567a66de4
plotly/tests/test_core/test_graph_objs/test_graph_objs_tools.py
plotly/tests/test_core/test_graph_objs/test_graph_objs_tools.py
from __future__ import absolute_import from unittest import TestCase
from __future__ import absolute_import from unittest import TestCase from plotly.graph_objs import graph_objs as go from plotly.graph_objs import graph_objs_tools as got class TestGetRole(TestCase): def test_get_role_no_value(self): # this is a bit fragile, but we pick a few stable values # t...
Add some :tiger2:s for `graph_objs_tools.py`.
Add some :tiger2:s for `graph_objs_tools.py`.
Python
mit
plotly/plotly.py,plotly/python-api,plotly/plotly.py,plotly/python-api,plotly/plotly.py,plotly/python-api
770781d3ce55a91926b91579e11d79ebb3edf47e
lms/djangoapps/api_manager/management/commands/migrate_orgdata.py
lms/djangoapps/api_manager/management/commands/migrate_orgdata.py
import json from django.contrib.auth.models import Group from django.core.management.base import BaseCommand from api_manager.models import GroupProfile, Organization class Command(BaseCommand): """ Migrates legacy organization data and user relationships from older Group model approach to newer concrete Org...
import json from django.contrib.auth.models import Group from django.core.management.base import BaseCommand from api_manager.models import GroupProfile, Organization class Command(BaseCommand): """ Migrates legacy organization data and user relationships from older Group model approach to newer concrete Org...
Tweak to migration in order to accomodate old names for data fields and allow for if data fields were not present
Tweak to migration in order to accomodate old names for data fields and allow for if data fields were not present
Python
agpl-3.0
edx-solutions/edx-platform,edx-solutions/edx-platform,edx-solutions/edx-platform,edx-solutions/edx-platform
668a5240c29047d86fe9451f3078bb163bea0db9
skan/__init__.py
skan/__init__.py
from .csr import skeleton_to_csgraph, branch_statistics, summarise __all__ = ['skeleton_to_csgraph', 'branch_statistics', 'summarise']
from .csr import skeleton_to_csgraph, branch_statistics, summarise __version__ = '0.1-dev' __all__ = ['skeleton_to_csgraph', 'branch_statistics', 'summarise']
Add version info to package init
Add version info to package init
Python
bsd-3-clause
jni/skan
8ad4850941e299d9dad02cac0e300dc2021b81be
streak-podium/render.py
streak-podium/render.py
import pygal def horizontal_bar(sorted_streaks, sort_attrib): """ Render a horizontal bar chart of streaks. Values have already been sorted by sort_attrib. """ users = [user for user, _ in sorted_streaks][::-1] streaks = [getattr(streak, sort_attrib) for _, streak in sorted_streaks][::-1] ...
import pygal def horizontal_bar(sorted_streaks, sort): """ Render a horizontal bar chart of streaks. Values have already been sorted by sort. """ users = [user for user, _ in sorted_streaks][::-1] streaks = [getattr(streak, sort) for _, streak in sorted_streaks][::-1] chart = pygal.Horiz...
Rename svg output based on sort attribute
Rename svg output based on sort attribute
Python
mit
jollyra/hubot-streak-podium,jollyra/hubot-commit-streak,jollyra/hubot-commit-streak,supermitch/streak-podium,supermitch/streak-podium,jollyra/hubot-streak-podium
2d9fce5715b2d7d5b920d2e77212f076e9ebd1be
staticgen_demo/staticgen_views.py
staticgen_demo/staticgen_views.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from staticgen.staticgen_pool import staticgen_pool from staticgen.staticgen_views import StaticgenView class StaicgenDemoStaticViews(StaticgenView): def items(self): return ( 'sitemap.xml', 'robots.txt', ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf import settings from django.utils import translation from staticgen.staticgen_pool import staticgen_pool from staticgen.staticgen_views import StaticgenView class StaicgenDemoStaticViews(StaticgenView): def items(self): r...
Add CMS Pages to staticgen registry.
Add CMS Pages to staticgen registry.
Python
bsd-3-clause
mishbahr/staticgen-demo,mishbahr/staticgen-demo,mishbahr/staticgen-demo
4d73eb2a7e06e1e2607a2abfae1063b9969e70a0
strichliste/strichliste/models.py
strichliste/strichliste/models.py
from django.db import models from django.db.models import Sum class User(models.Model): name = models.CharField(max_length=254, unique=True) create_date = models.DateTimeField(auto_now_add=True) active = models.BooleanField(default=True) mail_address = models.EmailField(null=True) @property d...
from django.db import models from django.db.models import Sum class User(models.Model): name = models.CharField(max_length=254, unique=True) create_date = models.DateTimeField(auto_now_add=True) active = models.BooleanField(default=True) mail_address = models.EmailField(null=True) @property d...
Add user_id to returned transactions
Add user_id to returned transactions
Python
mit
Don42/strichliste-django,hackerspace-bootstrap/strichliste-django
0f1cb413503034cbc1e2deddd8327ad1946201fe
numba2/compiler/optimizations/throwing.py
numba2/compiler/optimizations/throwing.py
# -*- coding: utf-8 -*- """ Rewrite exceptions that are thrown and caught locally to jumps. """ from numba2.compiler import excmodel from pykit.optimizations import local_exceptions def rewrite_local_exceptions(func, env): local_exceptions.run(func, env, exc_model=excmodel.ExcModel(env)) def rewrite_exceptions(...
# -*- coding: utf-8 -*- """ Rewrite exceptions that are thrown and caught locally to jumps. """ from numba2.compiler import excmodel from pykit.analysis import cfa from pykit.optimizations import local_exceptions def rewrite_local_exceptions(func, env): local_exceptions.run(func, env, exc_model=excmodel.ExcMode...
Rewrite phis from outdated incoming exception blocks
Rewrite phis from outdated incoming exception blocks
Python
bsd-2-clause
flypy/flypy,flypy/flypy
211b7b28e2d8c7ed0e0f67bea1a1a68b520a53b1
pagerduty_events_api/pagerduty_service.py
pagerduty_events_api/pagerduty_service.py
from pagerduty_events_api.pagerduty_incident import PagerdutyIncident from pagerduty_events_api.pagerduty_rest_client import PagerdutyRestClient class PagerdutyService: def __init__(self, key): self.__service_key = key def get_service_key(self): return self.__service_key def trigger(self...
from pagerduty_events_api.pagerduty_incident import PagerdutyIncident from pagerduty_events_api.pagerduty_rest_client import PagerdutyRestClient class PagerdutyService: def __init__(self, key): self.__service_key = key def get_service_key(self): return self.__service_key def trigger(self...
Use "blank" PD incident instance for triggering through PD service.
Use "blank" PD incident instance for triggering through PD service.
Python
mit
BlasiusVonSzerencsi/pagerduty-events-api
f90fac30454537ec0727371ffc54bde4a1e2f78d
5_control_statements_and_exceptions_hierarchy/guess-a-number-ex.py
5_control_statements_and_exceptions_hierarchy/guess-a-number-ex.py
""" This is an example of the control structures. """ result = "" our_number = 21 def test_number(answer): answer = int(answer) if answer == our_number: return "got it right" elif answer > our_number: return "nope, lower" else: return "nope, higher" while result != "got i...
""" This is an example of the control structures. """ if __name__ == "__main__": result = "" our_number = 21 def test_number(answer): answer = int(answer) if answer == our_number: return "got it right" elif answer > our_number: return "nope, lower" ...
Put the code in __main__ for lesson 5 guess-a-number example.
Put the code in __main__ for lesson 5 guess-a-number example.
Python
mit
razzius/PyClassLessons,razzius/PyClassLessons,razzius/PyClassLessons,razzius/PyClassLessons,PyClass/PyClassLessons,noisebridge/PythonClass,noisebridge/PythonClass,noisebridge/PythonClass,PyClass/PyClassLessons,noisebridge/PythonClass,PyClass/PyClassLessons
524d5427d54342f26008a5b527140d4158f70edf
tests/test_extension.py
tests/test_extension.py
from __future__ import unicode_literals import json from test_helpers import MockTrack, get_websocket, make_frontend, patched_bot from mopidy_tachikoma import Extension def test_get_default_config(): ext = Extension() config = ext.get_default_config() assert '[tachikoma]' in config assert 'enabled = true' in ...
from __future__ import unicode_literals import json from test_helpers import MockTrack, get_websocket, make_frontend, patched_bot from mopidy_tachikoma import Extension def test_get_default_config(): ext = Extension() config = ext.get_default_config() assert '[tachikoma]' in config assert 'enabled = true' in ...
Clear websocket data to try and fix Travis
Clear websocket data to try and fix Travis
Python
agpl-3.0
palfrey/mopidy-tachikoma,palfrey/mopidy-tachikoma
87d2e511b0fedd2a09610c35337336d443a756a4
tests/unit/cli/filewatch/test_stat.py
tests/unit/cli/filewatch/test_stat.py
import os from chalice.cli.filewatch import stat class FakeOSUtils(object): def __init__(self): self.initial_scan = True def walk(self, rootdir): yield 'rootdir', [], ['bad-file', 'baz'] if self.initial_scan: self.initial_scan = False def joinpath(self, *parts): ...
import os import time from chalice.cli.filewatch import stat class FakeOSUtils(object): def __init__(self): self.initial_scan = True def walk(self, rootdir): yield 'rootdir', [], ['bad-file', 'baz'] if self.initial_scan: self.initial_scan = False def joinpath(self, *...
Add polling loop to allow time for callback to be invoked
Add polling loop to allow time for callback to be invoked
Python
apache-2.0
awslabs/chalice
ce12cd0f56997dc6d33a9e4e7c13df27d05a133b
Python/Tests/TestData/DebuggerProject/ThreadJoin.py
Python/Tests/TestData/DebuggerProject/ThreadJoin.py
from threading import Thread global exit_flag exit_flag = False def g(): i = 1 while not exit_flag: i = (i + 1) % 100000000 if i % 100000 == 0: print("f making progress: {0}".format(i)) def f(): g() from threading import Thread def n(): t1 = Thread(target=f,name="F_thread") t1.sta...
from threading import Thread global exit_flag exit_flag = False def g(): i = 1 while not exit_flag: i = (i + 1) % 100000000 if i % 100000 == 0: print("f making progress: {0}".format(i)) def f(): g() def n(): t1 = Thread(target=f,name="F_thread") t1.start() t1.join() def m(): ...
Remove redundant import from test script.
Remove redundant import from test script.
Python
apache-2.0
zooba/PTVS,zooba/PTVS,huguesv/PTVS,int19h/PTVS,huguesv/PTVS,huguesv/PTVS,Microsoft/PTVS,int19h/PTVS,zooba/PTVS,int19h/PTVS,int19h/PTVS,huguesv/PTVS,Microsoft/PTVS,int19h/PTVS,Microsoft/PTVS,zooba/PTVS,Microsoft/PTVS,int19h/PTVS,Microsoft/PTVS,zooba/PTVS,huguesv/PTVS,zooba/PTVS,Microsoft/PTVS,huguesv/PTVS
d40fa3554847a239f90a7f7edec8efbf30c753f0
scripts/lib/check_for_course_revisions.py
scripts/lib/check_for_course_revisions.py
import json from .load_data_from_file import load_data_from_file from .get_old_dict_values import get_old_dict_values from .log import log from .paths import make_course_path def load_previous(course_path): try: prior_data = load_data_from_file(course_path) prior = json.loads(prior_data) except FileNotFoundErr...
from collections import OrderedDict import json from .load_data_from_file import load_data_from_file from .get_old_dict_values import get_old_dict_values from .log import log from .paths import make_course_path def load_previous(course_path): try: prior_data = load_data_from_file(course_path) prior = json.loads...
Use an ordereddict for sorting revisions
Use an ordereddict for sorting revisions
Python
mit
StoDevX/course-data-tools,StoDevX/course-data-tools
e7942afdc1e93aec57e4e02d862a91eab9b5c0cb
trackingtermites/termite.py
trackingtermites/termite.py
from collections import namedtuple class Termite: def __init__(self, label, color): self.label = label self.color = color self.trail = [] self.tracker = None def to_csv(self): with open('data/{}-trail.csv'.format(self.label), mode='w') as trail_out: trail_o...
from collections import namedtuple class Termite: def __init__(self, label, color): self.label = label self.color = color self.trail = [] self.tracker = None def to_csv(self): with open('data/{}-trail.csv'.format(self.label), mode='w') as trail_out: trail_o...
Include missing columns in output
Include missing columns in output
Python
mit
dmrib/trackingtermites
b0814b95ea854f7b3f0b9db48ae9beee078c2a30
versions/software/openjdk.py
versions/software/openjdk.py
import re from versions.software.utils import get_command_stderr, get_soup, \ get_text_between def name(): """Return the precise name for the software.""" return 'Zulu OpenJDK' def installed_version(): """Return the installed version of the jdk, or None if not installed.""" try: version...
import re from versions.software.utils import get_command_stderr, get_soup, \ get_text_between def name(): """Return the precise name for the software.""" return 'Zulu OpenJDK' def installed_version(): """Return the installed version of the jdk, or None if not installed.""" try: version...
Update OpenJDK version to support both 8 and 9.
Update OpenJDK version to support both 8 and 9.
Python
mit
mchung94/latest-versions
3b4c645792c1a58cdce3dc25171723e7139d66da
workflows/api/permissions.py
workflows/api/permissions.py
from rest_framework import permissions from workflows.models import * class IsAdminOrSelf(permissions.BasePermission): def has_permission(self, request, view): if request.user and request.user.is_authenticated(): # Don't allow adding widgets to workflows not owned by the user if v...
from rest_framework import permissions from workflows.models import * class IsAdminOrSelf(permissions.BasePermission): def has_permission(self, request, view): if request.user and request.user.is_authenticated(): # Don't allow adding widgets to workflows not owned by the user if v...
Return True for preview if workflow public
Return True for preview if workflow public
Python
mit
xflows/clowdflows-backend,xflows/clowdflows-backend,xflows/clowdflows-backend,xflows/clowdflows-backend
452ad6f3de797285a50094a4a145714e75204d95
bake/cmdline.py
bake/cmdline.py
#!/usr/bin/env python # encoding: utf-8 # This is the command line interface for bake. For people who want to take # bake.py and extend it for their own circumstances, modifying the main routine # in this module is probably the best place to start. import api as bake import sys # This def main(args=sys.argv[1:]): ...
#!/usr/bin/env python # encoding: utf-8 # This is the command line interface for bake. For people who want to take # bake.py and extend it for their own circumstances, modifying the main routine # in this module is probably the best place to start. import api as bake import sys def main(args=sys.argv[1:]): # Set ...
Make pep8 run mostly cleanly
Make pep8 run mostly cleanly
Python
mit
AlexSzatmary/bake
d5cf661b2658d7f9a0f5436444373202e514bf37
src/psd_tools2/__init__.py
src/psd_tools2/__init__.py
from __future__ import absolute_import, unicode_literals from .api.psd_image import PSDImage
from __future__ import absolute_import, unicode_literals from .api.psd_image import PSDImage from .api.composer import compose
Include compose in the top level
Include compose in the top level
Python
mit
kmike/psd-tools,psd-tools/psd-tools,kmike/psd-tools
2fea7b008336e1960efb375c63a4cc14053bc590
src/wikicurses/__init__.py
src/wikicurses/__init__.py
import pkgutil from enum import IntEnum _data = pkgutil.get_data('wikicurses', 'interwiki.list').decode() wikis = dict([i.split('|')[0:2] for i in _data.splitlines() if i[0]!='#']) class formats(IntEnum): i, b, blockquote = (1<<i for i in range(3))
import pkgutil from enum import Enum _data = pkgutil.get_data('wikicurses', 'interwiki.list').decode() wikis = dict([i.split('|')[0:2] for i in _data.splitlines() if i[0]!='#']) class BitEnum(int, Enum): def __new__(cls, *args): value = 1 << len(cls.__members__) return int.__new__(cls, value) for...
Create BitEnum class for bitfields
Create BitEnum class for bitfields
Python
mit
ids1024/wikicurses
e3a1d4998494143491b49312673ceb84ea98b7f8
RatS/tmdb/tmdb_ratings_inserter.py
RatS/tmdb/tmdb_ratings_inserter.py
import time from RatS.base.base_ratings_uploader import RatingsUploader from RatS.tmdb.tmdb_site import TMDB class TMDBRatingsInserter(RatingsUploader): def __init__(self, args): super(TMDBRatingsInserter, self).__init__(TMDB(args), args) self.url_for_csv_file_upload = self._get_url_for_csv_uploa...
import time from RatS.base.base_ratings_uploader import RatingsUploader from RatS.tmdb.tmdb_site import TMDB class TMDBRatingsInserter(RatingsUploader): def __init__(self, args): super(TMDBRatingsInserter, self).__init__(TMDB(args), args) self.url_for_csv_file_upload = self._get_url_for_csv_uploa...
Adjust TMDB import page URL
Adjust TMDB import page URL
Python
agpl-3.0
StegSchreck/RatS,StegSchreck/RatS,StegSchreck/RatS
989966444e63336b59da04265dbeb901258f75c1
us_ignite/snippets/management/commands/snippets_load_fixtures.py
us_ignite/snippets/management/commands/snippets_load_fixtures.py
from django.core.management.base import BaseCommand from us_ignite.snippets.models import Snippet FIXTURES = [ { 'slug': 'home-box', 'name': 'UP NEXT: LOREM IPSUM', 'body': '', 'url_text': 'GET INVOLVED', 'url': '', }, { 'slug': 'featured', 'name': ...
from django.core.management.base import BaseCommand from us_ignite.snippets.models import Snippet FIXTURES = [ { 'slug': 'home-box', 'name': 'UP NEXT: LOREM IPSUM', 'body': '', 'url_text': 'GET INVOLVED', 'url': '', }, { 'slug': 'featured', 'name': ...
Update description of the blog sidebar snippet.
Update description of the blog sidebar snippet.
Python
bsd-3-clause
us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite
2afd2467c16969b10496ae96e17b9dce7911f232
db.py
db.py
import sqlite3 connection = sqlite3.connect('data.db') class SavedRoll: @staticmethod def save(user, name, args): pass @staticmethod def get(user, name): pass @staticmethod def delete(user, name): pass
class SavedRollManager: """ Class for managing saved rolls. Attributes: connection (sqlite3.Connection): Database connection used by manager """ def __init__(self, connection): """ Create a SavedRollManager instance. Args: connection (sqlite3.Connection...
Make SavedRollManager less static, also docstrings
Make SavedRollManager less static, also docstrings
Python
mit
foxscotch/foxrollbot
b54507e05475dfc11e04678ee358476f571323b2
plugins/Tools/PerObjectSettingsTool/__init__.py
plugins/Tools/PerObjectSettingsTool/__init__.py
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from . import PerObjectSettingsTool from UM.i18n import i18nCatalog i18n_catalog = i18nCatalog("uranium") def getMetaData(): return { "plugin": { "name": i18n_catalog.i18nc("@label", "Settings P...
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from . import PerObjectSettingsTool from UM.i18n import i18nCatalog i18n_catalog = i18nCatalog("uranium") def getMetaData(): return { "plugin": { "name": i18n_catalog.i18nc("@label", "Per Object...
Normalize strings for per object settings
Normalize strings for per object settings
Python
agpl-3.0
onitake/Uranium,onitake/Uranium
ec61fec1ae60a565110876101dabad352e3ea46b
core/management/commands/delete_old_sessions.py
core/management/commands/delete_old_sessions.py
from datetime import datetime from django.core.management.base import BaseCommand from django.contrib.sessions.models import Session class Command(BaseCommand): args = '<count count ...>' help = "Delete old sessions" def handle(self, *args, **options): old_sessions = Session.objects.filter(expi...
from datetime import datetime from django.core.management.base import NoArgsCommand from django.contrib.sessions.models import Session class Command(NoArgsCommand): help = "Delete old sessions" def handle_noargs(self, **options): old_sessions = Session.objects.filter(expire_date__lt=datetime.now())...
Add delete old sessions command
Add delete old sessions command
Python
mit
QLGu/djangopackages,pydanny/djangopackages,QLGu/djangopackages,nanuxbe/djangopackages,nanuxbe/djangopackages,QLGu/djangopackages,nanuxbe/djangopackages,pydanny/djangopackages,pydanny/djangopackages
648c7fb94f92e8ef722af8c9462c9ff65bf643fc
intelmq/bots/collectors/mail/collector_mail_body.py
intelmq/bots/collectors/mail/collector_mail_body.py
# -*- coding: utf-8 -*- """ Uses the common mail iteration method from the lib file. """ from .lib import MailCollectorBot class MailBodyCollectorBot(MailCollectorBot): def init(self): super().init() self.content_types = getattr(self.parameters, 'content_types', ('plain', 'html')) if isi...
# -*- coding: utf-8 -*- """ Uses the common mail iteration method from the lib file. """ from .lib import MailCollectorBot class MailBodyCollectorBot(MailCollectorBot): def init(self): super().init() self.content_types = getattr(self.parameters, 'content_types', ('plain', 'html')) if isi...
Insert date when email was received
Insert date when email was received Sometimes we receive email reports like "this is happening right now" and there is no date/time included. So if we process emails once per hour - we don't have info about event time. Additional field `extra.email_received` in the mail body collector would help.
Python
agpl-3.0
aaronkaplan/intelmq,aaronkaplan/intelmq,certtools/intelmq,certtools/intelmq,certtools/intelmq,aaronkaplan/intelmq
8286aee8eca008e2e469d49e7a426828e4f6c2bf
bin/s3imageresize.py
bin/s3imageresize.py
#!/usr/bin/env python import argparse from s3imageresize import resize_image_folder parser = argparse.ArgumentParser(description='Upload a file to Amazon S3 and rotate old backups.') parser.add_argument('bucket', help="Name of the Amazon S3 bucket to save the backup file to.") parser.add_argument('prefix', help="The...
#!/usr/bin/env python import argparse from s3imageresize import resize_image_folder parser = argparse.ArgumentParser(description='Resize all images stored in a folder on Amazon S3.') parser.add_argument('bucket', help="Name of the Amazon S3 bucket to save the backup file to.") parser.add_argument('prefix', help="The...
Fix parameter descriptions and change size to individual width and height parameters
Fix parameter descriptions and change size to individual width and height parameters
Python
mit
dirkcuys/s3imageresize
945e2def0a106541583907101060a234e6846d27
sources/bioformats/large_image_source_bioformats/girder_source.py
sources/bioformats/large_image_source_bioformats/girder_source.py
# -*- coding: utf-8 -*- ############################################################################## # Copyright Kitware 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 # # h...
# -*- coding: utf-8 -*- ############################################################################## # Copyright Kitware 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 # # h...
Fix reading from hashed file names.
Fix reading from hashed file names. Bioformats expects file extensions to exist, so flag that we should always appear as actual, fully-pathed files.
Python
apache-2.0
girder/large_image,DigitalSlideArchive/large_image,girder/large_image,girder/large_image,DigitalSlideArchive/large_image,DigitalSlideArchive/large_image
82f5a5cccb8a7a36adc6f880d3cc1e11b8e596ee
envelope/templatetags/envelope_tags.py
envelope/templatetags/envelope_tags.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals """ Template tags related to the contact form. """ from django import template try: import honeypot except ImportError: # pragma: no cover honeypot = None register = template.Library() @register.inclusion_tag('envelope/contact_form.html', ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals """ Template tags related to the contact form. """ from django import template try: import honeypot except ImportError: # pragma: no cover honeypot = None register = template.Library() @register.inclusion_tag('envelope/contact_form.html', ...
Raise a more specific error when form is not passed to the template.
Raise a more specific error when form is not passed to the template.
Python
mit
r4ts0n/django-envelope,r4ts0n/django-envelope,affan2/django-envelope,affan2/django-envelope,zsiciarz/django-envelope,zsiciarz/django-envelope
f1e2859f5535d7eddb13c10e71f9c0074c94c719
axes_login_actions/signals.py
axes_login_actions/signals.py
# -*- coding: utf-8 -*- from axes.models import AccessAttempt from django.conf import settings from django.db.models.signals import post_save from django.dispatch import receiver from importlib import import_module DEFAULT_ACTION = 'axes_login_actions.actions.email.notify' ACTIONS = getattr(settings, 'AXES_LOGIN_ACT...
# -*- coding: utf-8 -*- from axes.models import AccessAttempt from django.conf import settings from django.db.models.signals import post_save from django.dispatch import receiver from importlib import import_module DEFAULT_ACTION = 'axes_login_actions.actions.email.notify' ACTIONS = getattr(settings, 'AXES_LOGIN_ACT...
Add "dispatch_uid" to ensure we connect the signal only once
Add "dispatch_uid" to ensure we connect the signal only once
Python
bsd-3-clause
eht16/django-axes-login-actions
ea324a30823fbf18c72dd639b9c43d3ecb57b034
txircd/modules/extra/services/account_extban.py
txircd/modules/extra/services/account_extban.py
from twisted.plugin import IPlugin from txircd.module_interface import IModuleData, ModuleData from txircd.utils import ircLower from zope.interface import implements from fnmatch import fnmatchcase class AccountExtban(ModuleData): implements(IPlugin, IModuleData) name = "AccountExtban" def actions(self): ret...
from twisted.plugin import IPlugin from txircd.module_interface import IModuleData, ModuleData from txircd.utils import ircLower from zope.interface import implements from fnmatch import fnmatchcase class AccountExtban(ModuleData): implements(IPlugin, IModuleData) name = "AccountExtban" def actions(self): ret...
Fix matching users against R: extbans
Fix matching users against R: extbans
Python
bsd-3-clause
Heufneutje/txircd
d649e0ff501604d9b8b24bd69a7545528332c05c
polling_stations/apps/pollingstations/models.py
polling_stations/apps/pollingstations/models.py
from django.contrib.gis.db import models from councils.models import Council class PollingStation(models.Model): council = models.ForeignKey(Council, null=True) internal_council_id = models.CharField(blank=True, max_length=100) postcode = models.CharField(blank=True, null=True, max_length=100) addres...
from django.contrib.gis.db import models from councils.models import Council class PollingStation(models.Model): council = models.ForeignKey(Council, null=True) internal_council_id = models.CharField(blank=True, max_length=100) postcode = models.CharField(blank=True, null=True, max_length=100) addres...
Fix unicode for unknown names
Fix unicode for unknown names
Python
bsd-3-clause
andylolz/UK-Polling-Stations,andylolz/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,andylolz/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations
c5996b4a933f2d27251e8d85f3392b715e130759
mapentity/templatetags/convert_tags.py
mapentity/templatetags/convert_tags.py
import urllib from django import template from django.conf import settings register = template.Library() @register.simple_tag def convert_url(request, sourceurl, format='pdf'): fullurl = request.build_absolute_uri(sourceurl) conversion_url = "%s?url=%s&to=%s" % (settings.CONVERSION_SERVER, ...
import urllib from mimetypes import types_map from django import template from django.conf import settings register = template.Library() @register.simple_tag def convert_url(request, sourceurl, format='pdf'): if '/' not in format: extension = '.' + format if not format.startswith('.') else format ...
Support conversion format as extension, instead of mimetype
Support conversion format as extension, instead of mimetype
Python
bsd-3-clause
Anaethelion/django-mapentity,makinacorpus/django-mapentity,makinacorpus/django-mapentity,makinacorpus/django-mapentity,Anaethelion/django-mapentity,Anaethelion/django-mapentity
5885c053e9bf20c7b91ebc2c8aebd1dfb9c78a46
avalonstar/components/broadcasts/models.py
avalonstar/components/broadcasts/models.py
# -*- coding: utf-8 -*- from django.db import models from components.games.models import Game class Broadcast(models.Model): airdate = models.DateField() status = models.CharField(max_length=200) number = models.IntegerField(blank=True, null=True) # ... games = models.ManyToManyField(Game, relat...
# -*- coding: utf-8 -*- from django.db import models from components.games.models import Game class Series(models.Model): name = models.CharField(max_length=200) def __unicode__(self): return '%s' % self.name class Broadcast(models.Model): airdate = models.DateField() status = models.CharF...
Add the concept of series (like Whatever Wednesday).
Add the concept of series (like Whatever Wednesday).
Python
apache-2.0
bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv
c7f6e0c2e9c5be112a7576c3d2a1fc8a79eb9f18
brasilcomvc/settings/staticfiles.py
brasilcomvc/settings/staticfiles.py
import os import sys # Disable django-pipeline when in test mode PIPELINE_ENABLED = 'test' not in sys.argv # Main project directory BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) STATIC_BASE_DIR = os.path.join(BASE_DIR, '../webroot') # Static file dirs STATIC_ROOT = os.path.join(STATIC_BA...
import os import sys # Main project directory BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) STATIC_BASE_DIR = os.path.join(BASE_DIR, '../webroot') # Static file dirs STATIC_ROOT = os.path.join(STATIC_BASE_DIR, 'static') MEDIA_ROOT = os.path.join(STATIC_BASE_DIR, 'media') # Static file UR...
Fix django-pipeline configuration for development/test
fix(set): Fix django-pipeline configuration for development/test
Python
apache-2.0
brasilcomvc/brasilcomvc,brasilcomvc/brasilcomvc,brasilcomvc/brasilcomvc
a5274f0628bec7a77fc2722ced723c4f35f3fb4b
microcosm_flask/fields/query_string_list.py
microcosm_flask/fields/query_string_list.py
""" A list field field that supports query string parameter parsing. """ from marshmallow.fields import List, ValidationError class SelfSerializableList(list): def __str__(self): return ",".join(str(item) for item in self) class QueryStringList(List): def _deserialize(self, value, attr, obj): ...
""" A list field field that supports query string parameter parsing. """ from marshmallow.fields import List, ValidationError class PrintableList(list): def __str__(self): return ",".join(str(item) for item in self) class QueryStringList(List): def _deserialize(self, value, attr, obj): """ ...
Change the name of SelfSerializableList to PrintableList
Change the name of SelfSerializableList to PrintableList
Python
apache-2.0
globality-corp/microcosm-flask,globality-corp/microcosm-flask
faa74af66ff0542c5a08d85caf2e2b897506b1d0
custom/ewsghana/handlers/help.py
custom/ewsghana/handlers/help.py
from corehq.apps.products.models import SQLProduct from custom.ewsghana.handlers import HELP_TEXT from custom.ilsgateway.tanzania.handlers.keyword import KeywordHandler class HelpHandler(KeywordHandler): def help(self): self.respond(HELP_TEXT) def handle(self): topic = self.args[0].lower() ...
from corehq.apps.products.models import SQLProduct from custom.ewsghana.handlers import HELP_TEXT from custom.ilsgateway.tanzania.handlers.keyword import KeywordHandler class HelpHandler(KeywordHandler): def help(self): self.respond(HELP_TEXT) def handle(self): topic = self.args[0].lower() ...
Use values_list instead of iterating over
Use values_list instead of iterating over
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq
0a0d5e0c833c82a26697f049444bb6e3c359c3c7
django_lti_tool_provider/urls.py
django_lti_tool_provider/urls.py
from django.conf.urls import url from django_lti_tool_provider import views as lti_views urlpatterns = [ url(r'', lti_views.LTIView.as_view(), name='lti') ]
from django.conf.urls import url from django_lti_tool_provider import views as lti_views app_name = 'django_lti_tool_provider' urlpatterns = [ url(r'', lti_views.LTIView.as_view(), name='lti') ]
Adjust URL configuration based on changes introduced in Django 1.9:
Adjust URL configuration based on changes introduced in Django 1.9: - URL application namespace required if setting an instance namespace: https://docs.djangoproject.com/en/2.1/releases/1.9/#url-application-namespace-required-if-setting-an-instance-namespace
Python
agpl-3.0
open-craft/django-lti-tool-provider
b0bed22c3ccafe596cf715f2be56c3261b4a6853
reporting_scripts/course_completers.py
reporting_scripts/course_completers.py
''' This module extracts the student IDs from the collection certificates_generatedcertificate of the students who completed the course and achieved a certificate. The ids are then used to extract the usernames of the course completers Usage: python course_completers.py ''' from collections import defaultdict from...
''' This module extracts the student IDs from the collection certificates_generatedcertificate of the students who completed the course and achieved a certificate. The ids are then used to extract the usernames of the course completers Usage: python course_completers.py ''' from collections import defaultdict from...
Update to include User ID in result
Update to include User ID in result
Python
mit
McGillX/edx_data_research,andyzsf/edx_data_research,McGillX/edx_data_research,andyzsf/edx_data_research,McGillX/edx_data_research
fd9c73fc65a7234732ed55a7ae89365aec6cf123
behave_django/runner.py
behave_django/runner.py
from django.test.runner import DiscoverRunner from behave_django.environment import BehaveHooksMixin from behave_django.testcase import (BehaviorDrivenTestCase, ExistingDatabaseTestCase) class BehaviorDrivenTestRunner(DiscoverRunner, BehaveHooksMixin): """ Test runner that...
from django.test.runner import DiscoverRunner from behave_django.environment import BehaveHooksMixin from behave_django.testcase import (BehaviorDrivenTestCase, ExistingDatabaseTestCase) class BehaviorDrivenTestRunner(DiscoverRunner, BehaveHooksMixin): """ Test runner that...
Fix Landscape complaint "Method has no argument"
Fix Landscape complaint "Method has no argument"
Python
mit
bittner/behave-django,behave/behave-django,behave/behave-django,bittner/behave-django
dfc7c7ae72b91f3bc7724da6b0d8071b3e9253b7
altair/vegalite/v2/examples/us_state_capitals.py
altair/vegalite/v2/examples/us_state_capitals.py
""" U.S. state capitals overlayed on a map of the U.S ================================================- This is a geographic visualization that shows US capitals overlayed on a map. """ import altair as alt from vega_datasets import data states = alt.UrlData(data.us_10m.url, format=alt.TopoDataFo...
""" U.S. state capitals overlayed on a map of the U.S ================================================ This is a layered geographic visualization that shows US capitals overlayed on a map. """ import altair as alt from vega_datasets import data states = alt.UrlData(data.us_10m.url, format=alt.Top...
Add points for capital locations>
Add points for capital locations>
Python
bsd-3-clause
ellisonbg/altair,jakevdp/altair,altair-viz/altair
80a940305765a22f96b0c0af0b0b46f1e3f5c377
tests/unit/models/listing/test_generator.py
tests/unit/models/listing/test_generator.py
"""Test praw.models.front.""" from praw.models.listing.generator import ListingGenerator from ... import UnitTest class TestListingGenerator(UnitTest): def test_params_are_not_modified(self): params = {"prawtest": "yes"} generator = ListingGenerator(None, None, params=params) assert "limi...
"""Test praw.models.listing.generator.""" from praw.models.listing.generator import ListingGenerator from ... import UnitTest class TestListingGenerator(UnitTest): def test_params_are_not_modified(self): params = {"prawtest": "yes"} generator = ListingGenerator(None, None, params=params) ...
Fix docstring typo in ListingGenerator unit tests
Fix docstring typo in ListingGenerator unit tests
Python
bsd-2-clause
praw-dev/praw,praw-dev/praw
7416f2fc34bad2036024874ad6a0c9a5f57d0657
education/management/commands/fake_incoming_message.py
education/management/commands/fake_incoming_message.py
from django.core.management.base import BaseCommand from optparse import make_option from rapidsms_httprouter.router import get_router from rapidsms.models import Connection class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option("-p", "--phone", dest="phone"), make_optio...
from django.core.management.base import BaseCommand from optparse import make_option from rapidsms_httprouter.router import get_router from rapidsms.models import Connection class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option("-p", "--phone", dest="phone"), make_optio...
Simplify the requesting of parameters.
Simplify the requesting of parameters.
Python
bsd-3-clause
unicefuganda/edtrac,unicefuganda/edtrac,unicefuganda/edtrac
e5a94d2902a66d55be62b92e35ac90ac7aed7991
javascript/navigator/__init__.py
javascript/navigator/__init__.py
__author__ = 'katharine' import PyV8 as v8 from geolocation import Geolocation class Navigator(v8.JSClass): def __init__(self, runtime): # W3C spec says that if geolocation is disabled, navigator.geolocation should not exist. # if 'location' in runtime.manifest.get('capabilities', []): if...
__author__ = 'katharine' import PyV8 as v8 from geolocation import Geolocation from javascript.exceptions import JSRuntimeException class Navigator(v8.JSClass): def __init__(self, runtime): self._runtime = runtime # W3C spec says that if geolocation is disabled, navigator.geolocation should not ex...
Implement location restriction more thoroughly.
Implement location restriction more thoroughly.
Python
mit
youtux/pypkjs,pebble/pypkjs
70847e9d88f086d52e167629666aebe5137c7a2e
debileweb/blueprints/forms.py
debileweb/blueprints/forms.py
from wtforms import TextField, BooleanField, Form from wtforms.validators import Required class SearchPackageForm(Form): package = TextField('package', validators = [Required()]) maintainer = TextField('maintainer', validators = [Required()])
# Copyright (c) 2013 Sylvestre Ledru <sylvestre@debian.org> # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modi...
Add license + remove useless declaration
Add license + remove useless declaration
Python
mit
opencollab/debile-web,opencollab/debile-web,opencollab/debile-web
78ca15758018d52f1353b29410f97bba215e0be2
django_afip/views.py
django_afip/views.py
from django.http import HttpResponse from django.utils.translation import ugettext as _ from django.views.generic import View from .pdf import generate_receipt_pdf class ReceiptHTMLView(View): template_name = 'django_afip/invoice.html' def get(self, request, pk): return HttpResponse( gen...
from django.http import HttpResponse from django.utils.translation import ugettext as _ from django.views.generic import View from .pdf import generate_receipt_pdf class ReceiptHTMLView(View): def get(self, request, pk): return HttpResponse( generate_receipt_pdf(pk, request, True), )...
Remove unused (albeit confusing) variable
Remove unused (albeit confusing) variable See #13
Python
isc
hobarrera/django-afip,hobarrera/django-afip
13a2ea421b761b9009fb7e1328e54cf0ae5cc54f
gapipy/resources/booking/agency.py
gapipy/resources/booking/agency.py
from __future__ import unicode_literals from ...models import Address from ...models import AgencyDocument from .agency_chain import AgencyChain from ..base import Resource from ..tour import Promotion class Agency(Resource): _resource_name = 'agencies' _is_listable = False _is_parent_resource = True ...
from __future__ import unicode_literals from ...models import Address from ...models import AgencyDocument from ...models.base import BaseModel from .agency_chain import AgencyChain from ..base import Resource from ..tour import Promotion class AgencyEmail(BaseModel): _as_is_fields = ['type', 'address'] class...
Add new Agency resource fields
Add new Agency resource fields
Python
mit
gadventures/gapipy