commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
7803004ba20208f1e755d9fbf4e9d858da7f98d6 | Move point_distance to non-class method | sagersmith8/ai_graph_coloring,sagersmith8/ai_graph_coloring | ai_graph_color/line.py | ai_graph_color/line.py | class Line:
def __init__(self, point_a, point_b):
"""
Make a new line from two points.
:param point_a: one of the points on the line
:type point_a: tuple(float, float)
:param point_b: one of the points on the line
:type point_b: tuple(float, float)
"""
... | class Line:
def __init__(self, point_a, point_b):
"""
Make a new line from two points.
:param point_a: one of the points on the line
:type point_a: tuple(float, float)
:param point_b: one of the points on the line
:type point_b: tuple(float, float)
"""
... | mit | Python |
2e330bc2ac9a6b62a68ea1a22be37ea4b5071852 | mark buildbot as being shutdown | eunchong/build,eunchong/build,eunchong/build,eunchong/build | scripts/master/autoreboot_buildslave.py | scripts/master/autoreboot_buildslave.py | # Copyright (c) 2009 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.
"""A slave that reboots after each job.
Yeah, we trust our unit tests *that* much.
"""
import os
from buildbot.buildslave import BuildSlave
class Au... | # Copyright (c) 2009 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.
"""A slave that reboots after each job.
Yeah, we trust our unit tests *that* much.
"""
from buildbot.buildslave import BuildSlave
class AutoRebootBui... | bsd-3-clause | Python |
910e9cbbb51f8d92cda5686a8012f0f29089bb80 | implement unit test cases for ConfigParser.{load_impl,dumps_impl,set_container} and mk_dump_dir_if_not_exist in anyconfig.backend.base to improve test coverage | ssato/python-anyconfig,pmquang/python-anyconfig,pmquang/python-anyconfig,ssato/python-anyconfig | anyconfig/backend/tests/base.py | anyconfig/backend/tests/base.py | #
# Copyright (C) 2012 - 2014 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
import anyconfig.tests.common as C
import anyconfig.backend.base as TT # stands for test target
import os
import os.path
import unittest
class Test_00_ConfigParser(unittest.TestCase):
def test_10_set_container(self):
TT.Con... | #
# Copyright (C) 2012 - 2014 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
import anyconfig.backend.base as TT # stands for test target
import os
import os.path
import unittest
class Test_00_ConfigParser(unittest.TestCase):
def test_10_type(self):
self.assertEquals(TT.ConfigParser.type(), TT.Confi... | mit | Python |
ab368b74db6a29628f52ec1c9a7b82f8ca6d5b55 | Remove else: pass | bowen0701/algorithms_data_structures | alg_knight_tour_dfs.py | alg_knight_tour_dfs.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from collections import defaultdict
from itertools import product
MOVE_OFFSETS = (
(-1, -2), (1, -2),
(-2, -1), (2, -1),
(-2, 1), (2, 1),
... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from collections import defaultdict
from itertools import product
MOVE_OFFSETS = (
(-1, -2), (1, -2),
(-2, -1), (2, -1),
(-2, 1), (2, 1),
... | bsd-2-clause | Python |
9a6b428feeecedf537ab73270c53ec93ddd913a5 | add msg when done reloading | ticapix/automated-tasks | reload_app.py | reload_app.py | #!/usr/bin/env python3
from robobrowser import RoboBrowser
import getpass
import os
url_login = 'https://www.pythonanywhere.com/login/'
url_web_app = 'https://www.pythonanywhere.com/user/ticapix/webapps/#tab_id_ticapix_pythonanywhere_com'
def reload_pyanywhr_app(username=None, password=None):
if username is None... | #!/usr/bin/env python3
from robobrowser import RoboBrowser
import getpass
import os
url_login = 'https://www.pythonanywhere.com/login/'
url_web_app = 'https://www.pythonanywhere.com/user/ticapix/webapps/#tab_id_ticapix_pythonanywhere_com'
def reload_pyanywhr_app(username=None, password=None):
if username is None... | unlicense | Python |
c5cd0e59f5ebf0048263e4ad6f6437af4841e9e5 | Correct typo. | minhtuancn/odoo,massot/odoo,colinnewell/odoo,waytai/odoo,grap/OpenUpgrade,cpyou/odoo,srsman/odoo,GauravSahu/odoo,Nick-OpusVL/odoo,cloud9UG/odoo,avoinsystems/odoo,VielSoft/odoo,joshuajan/odoo,poljeff/odoo,Antiun/odoo,Codefans-fan/odoo,NL66278/OCB,brijeshkesariya/odoo,papouso/odoo,credativUK/OCB,codekaki/odoo,oasiswork/o... | addons/point_of_sale/wizard/pos_details.py | addons/point_of_sale/wizard/pos_details.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 | Python |
e50cc264e22ac40a876d14caadfabe70e3a06817 | Use markdown example | miyakogi/wdom,miyakogi/wdom,miyakogi/wdom | wdom/__main__.py | wdom/__main__.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import logging
from pathlib import Path
logger = logging.getLogger('wdom')
_CURFILE = Path(__file__).resolve()
_CURDIR = _CURFILE.parent.resolve()
if __name__ == '__main__':
sys.path.insert(0, str(_CURDIR.parent.resolve()))
def main():
from wdom.opt... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import logging
from pathlib import Path
logger = logging.getLogger('wdom')
_CURFILE = Path(__file__).resolve()
_CURDIR = _CURFILE.parent.resolve()
if __name__ == '__main__':
sys.path.insert(0, str(_CURDIR.parent.resolve()))
def main():
from wdom.opt... | mit | Python |
3dc243835406836bf5a4c282c011df8cd6e93f29 | remove pass | antgonza/qiita,ElDeveloper/qiita,squirrelo/qiita,antgonza/qiita,biocore/qiita,squirrelo/qiita,josenavas/QiiTa,ElDeveloper/qiita,squirrelo/qiita,josenavas/QiiTa,antgonza/qiita,biocore/qiita,ElDeveloper/qiita,squirrelo/qiita,biocore/qiita,ElDeveloper/qiita,josenavas/QiiTa,josenavas/QiiTa,antgonza/qiita,biocore/qiita | qiita_pet/test/test_prep_template.py | qiita_pet/test/test_prep_template.py | # -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | # -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | bsd-3-clause | Python |
48b187118a8716947fda57ff1eccaa70637acf04 | use local utc time if update time is not available | offenesdresden/ParkAPI,offenesdresden/ParkAPI | park_api/cities/Zuerich.py | park_api/cities/Zuerich.py | import feedparser
from park_api.geodata import GeoData
from park_api.util import utc_now
# Falls das hier jemals einer von den Menschen
# hinter OpenDataZürich lesen sollte: Ihr seid so toll <3
geodata = GeoData(__file__)
def parse_html(xml_data):
feed = feedparser.parse(xml_data)
try:
last_updated... | import feedparser
from park_api.geodata import GeoData
# Falls das hier jemals einer von den Menschen
# hinter OpenDataZürich lesen sollte: Ihr seid so toll <3
geodata = GeoData(__file__)
def parse_html(xml_data):
feed = feedparser.parse(xml_data)
last_updated = feed["entries"][0]["updated"]
data = {
... | mit | Python |
e3d3b5f24876a6a3a90013739a27a41c672aab1c | Fix fab push_docs | uber/cassette | fabfile.py | fabfile.py | import sys
import urllib2
from fabric.api import local, task, lcd
from fabric.colors import magenta, green
from cassette.tests.test_cassette import TEST_URL
@task
def check_test_server():
"""Verify that test server is running."""
try:
urllib2.urlopen(TEST_URL)
except urllib2.URLError:
... | import sys
import urllib2
from fabric.api import local, task, lcd
from fabric.colors import magenta, green
from cassette.tests.test_cassette import TEST_URL
@task
def check_test_server():
"""Verify that test server is running."""
try:
urllib2.urlopen(TEST_URL)
except urllib2.URLError:
... | bsd-3-clause | Python |
968e4e1cdcc81bb972197d292607885915b478df | Patch update to publishing | alphagov/performanceplatform-collector,alphagov/performanceplatform-collector,alphagov/performanceplatform-collector | performanceplatform/collector/__init__.py | performanceplatform/collector/__init__.py | # Namespace package: https://docs.python.org/2/library/pkgutil.html
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
__version__ = "0.1.1"
__author__ = "GDS Developers"
__author_email__ = "performance@digital.cabinet-office.gov.uk"
| # Namespace package: https://docs.python.org/2/library/pkgutil.html
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
__version__ = "0.1.0"
__author__ = "GDS Developers"
__author_email__ = "performance@digital.cabinet-office.gov.uk"
| mit | Python |
c61c79ec9c38a09bd7a31a462308c3c2cc34cb5f | Add a task in fabfile to debug/test a sparks feature. | WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow | fabfile.py | fabfile.py | # -*- coding: utf-8 -*-
import os
import pwd
from fabric.api import env, task
from sparks.fabric import with_remote_configuration
import sparks.django.fabfile as sdf
# Make the main deployment tasks immediately accessible
runable, deploy, fast_deploy = sdf.runable, sdf.deploy, sdf.fast_deploy
# The Django project n... | # -*- coding: utf-8 -*-
import os
import pwd
from fabric.api import env, task
import sparks.django.fabfile as sdf
# Make the main deployment tasks immediately accessible
runable, deploy, fast_deploy = sdf.runable, sdf.deploy, sdf.fast_deploy
# The Django project name
env.project = 'oneflow'
env.virtualenv ... | agpl-3.0 | Python |
296c5f4e3247f192e3b97c0c94e682b61368dc2e | Update create_dataset.py | bgshih/crnn,bgshih/crnn,bgshih/crnn | tool/create_dataset.py | tool/create_dataset.py | import os
import lmdb # install lmdb by "pip install lmdb"
import cv2
import numpy as np
def checkImageIsValid(imageBin):
if imageBin is None:
return False
imageBuf = np.fromstring(imageBin, dtype=np.uint8)
img = cv2.imdecode(imageBuf, cv2.IMREAD_GRAYSCALE)
imgH, imgW = img.shape[0], img.shape... | import os
import lmdb
import cv2
def checkImageIsValid(imageBin):
if imageBin is None:
return False
imageBuf = np.fromstring(imageBin, dtype=np.uint8)
img = cv2.imdecode(imageBuf, cv2.IMREAD_GRAYSCALE)
imgH, imgW = img.shape[0], img.shape[1]
if imgH * imgW == 0:
return False
re... | mit | Python |
117704f19285b1af647156486bbfbbc68df6d498 | update fab | txchain/liskit-dashboard,txchain/liskit-dashboard,andreafspeziale/liskit-dashboard,andreafspeziale/liskit-dashboard | fabfile.py | fabfile.py | from __future__ import with_statement
from fabric.api import *
# Deploy branch
# Usage Example:
# fab deploy_branch:'BRANCH-NAME'
@hosts(['root@194.116.72.33'])
def deploy_branch(branch_name):
with cd('/var/www/html/'):
run('git checkout %s' % branch_name)
run('git pull')
run('grunt install... | from __future__ import with_statement
from fabric.api import *
# Deploy branch
# Usage Example:
# fab deploy_branch:'BRANCH-NAME'
@hosts(['root@194.116.72.33'])
def deploy_branch(branch_name):
with cd('/var/www/html/'):
run('git checkout %s' % branch_name)
run('git pull')
run('grunt install... | mit | Python |
45d822b1e7cb66e0fd74dfa5b5f2e95d05e8cba5 | upgrade the fabfile to use the new grunt options | Beit-Hatfutsot/dbs-front,Inna-r/dbs-front,Inna-r/dbs-front,Beit-Hatfutsot/dbs-front,Beit-Hatfutsot/dbs-front,Beit-Hatfutsot/dbs-front | fabfile.py | fabfile.py | from __future__ import with_statement
import os
from datetime import datetime
import logging
from fabric.api import *
DEFAULT_APISERVER = 'devapi.dbs.bh.org.il'
API_SERVERS = {
'bhs-dev': DEFAULT_APISERVER,
'104.155.5.184': DEFAULT_APISERVER,
'bhs-prod': 'api.dbs.bh.org.il'... | from __future__ import with_statement
import os
from datetime import datetime
import logging
from fabric.api import *
DEFAULT_APISERVER = 'devapi.dbs.bh.org.il'
API_SERVERS = {
'bhs-dev': DEFAULT_APISERVER,
'104.155.5.184': DEFAULT_APISERVER,
'bhs-prod': 'api.dbs.bh.org.il'... | agpl-3.0 | Python |
cfbb875025255060fa5ce2b7d5b30231cd6c79e2 | bump repo version | omry/omegaconf | omegaconf/version.py | omegaconf/version.py | import sys # pragma: no cover
__version__ = "2.0.1rc6"
msg = """OmegaConf 2.0 and above is compatible with Python 3.6 and newer.
You have the following options:
1. Upgrade to Python 3.6 or newer.
This is highly recommended. new features will not be added to OmegaConf 1.4.
2. Continue using OmegaConf 1.4:
You ... | import sys # pragma: no cover
__version__ = "2.0.1rc5"
msg = """OmegaConf 2.0 and above is compatible with Python 3.6 and newer.
You have the following options:
1. Upgrade to Python 3.6 or newer.
This is highly recommended. new features will not be added to OmegaConf 1.4.
2. Continue using OmegaConf 1.4:
You ... | bsd-3-clause | Python |
39bf214e6cd23d8f0791b7892226f5a44c704cd2 | Make horizontal boxplots, one per algo, grouped by task | chagaz/sfan,chagaz/sfan,chagaz/sfan,chagaz/sfan,chagaz/sfan | code/plot.py | code/plot.py | import matplotlib.pyplot as plt
import numpy as np
import random
algos_names = ('SConES', 'MSConESnp', 'MSConES')
num_tasks = 4
colors = ['darkkhaki', 'royalblue', 'white']
def vertical_boxplots(data) :
fig, axes = plt.subplots(ncols=num_tasks, sharey=True)
fig.subplots_adjust(wspace=0)
fig.canvas.se... | import matplotlib.pyplot as plt
import numpy as np
import random
algos_names = ('SConES', 'MSConESnp', 'MSConES')
num_tasks = 4
colors = ['darkkhaki', 'royalblue', 'white']
def vertical_boxplots(data) :
fig, axes = plt.subplots(ncols=num_tasks, sharey=True)
fig.subplots_adjust(wspace=0)
fig.canvas.se... | mit | Python |
e7db363c311896cd8246cc0910a42d4774e269fa | Simplify pep8_rwrtrack.py | david-wm-sanders/rwrtrack,david-wm-sanders/rwrtrack | pep8_rwrtrack.py | pep8_rwrtrack.py | import subprocess
from pathlib import Path
# Run pep8 --exclude=venv,offline --show-source .
p = Path(__file__).parent / Path(".")
subprocess.run(["pep8", "--exclude=venv,offline", "--show-source", str(p)])
| import subprocess
from pathlib import Path
# Run pep8 --exclude=venv --show-source .\source.py
files = ["stats.py", "get_stats.py", "sums.py", "analysis.py", "ranking.py"]
for f in files:
p = Path(__file__).parent / Path(f)
subprocess.run(["pep8", "--exclude=venv","--show-source", str(p)])
| mit | Python |
ad4be9a23ce0ac616c8778c0b019a87e7dc21490 | Update about | explosion/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,spacy-io/thinc | thinc/about.py | thinc/about.py | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__name__ = 'thinc'
__version__ = '6.0.0'
__summary__ = "spaCy's Machine Learning library for NLP in Python"
__uri__ = 'https://github.com/spacy... | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__name__ = 'thinc'
__version__ = '6.0.0'
__summary__ = 'Solve sparse structured learning problems'
__uri__ = 'https://github.com/spacy-io/thinc... | mit | Python |
0a34e477a3699b992b6919925ed7b73e8b5a663f | improve code documentation | eEcoLiDAR/eEcoLiDAR | laserchicken/select.py | laserchicken/select.py | import numpy as np
def select_above(pc, attribute, threshold):
"""
Return the selection of the input point cloud that contains only points with a given attribute above some value.
:param pc: Input point cloud
:param attribute: The attribute name used for selection
:param threshold: The threshold v... | import numpy as np
def select_above(pc, attribute, threshold):
"""
Return the selection of the input point cloud that contains only points with a given attribute above some value.
:param pc: Input point cloud
:param attribute: The attribute used for selection
:param threshold: The threshold value ... | apache-2.0 | Python |
fcc2d3adf267846241c329f4afe58227f11d3dc9 | set brightness to 80 | Jwely/pimopic | pimopic/PiCameraManager.py | pimopic/PiCameraManager.py | import picamera
from datetime import datetime
import os
class PiCameraManager(object):
""" This is a small camera manager object """
def __init__(self):
# configure the picamera
self.camera = picamera.PiCamera()
self.camera.brightness = 80
# make sure it isn't already recordi... | import picamera
from datetime import datetime
import os
class PiCameraManager(object):
""" This is a small camera manager object """
def __init__(self):
# configure the picamera
self.camera = picamera.PiCamera()
#self.camera.brightness = 80
# make sure it isn't already record... | mit | Python |
be9dd27488bd2078a2181ebc586f7cfe7c0a1c62 | Bump version | thombashi/pingparsing,thombashi/pingparsing | pingparsing/__version__.py | pingparsing/__version__.py | __author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016, {}".format(__author__)
__license__ = "MIT License"
__version__ = "1.0.2"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| __author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016, {}".format(__author__)
__license__ = "MIT License"
__version__ = "1.0.1"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| mit | Python |
aafee730d2b6b595602ea73a404eb32c7d5d1c2b | handle empty environment variable | FederatedAI/FATE,FederatedAI/FATE,FederatedAI/FATE | pipeline/backend/config.py | pipeline/backend/config.py | #
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | #
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | apache-2.0 | Python |
ccd664882540544a98639604b0f83ee1da30b743 | Add proxy fix as in lr this will run with reverse proxy | LandRegistry/casework-frontend-alpha,LandRegistry/casework-frontend-alpha,LandRegistry/casework-frontend-alpha,LandRegistry/casework-frontend-alpha | application/__init__.py | application/__init__.py | from flask.ext.basicauth import BasicAuth
from flask.ext.login import LoginManager
from flask.ext.security import SQLAlchemyUserDatastore, Security
from flask.ext.sqlalchemy import SQLAlchemy
from flask import Flask
from flask_wtf import CsrfProtect
from raven.contrib.flask import Sentry
import logging
import os
from a... | from flask.ext.basicauth import BasicAuth
from flask.ext.login import LoginManager
from flask.ext.security import SQLAlchemyUserDatastore, Security
from flask.ext.sqlalchemy import SQLAlchemy
from flask import Flask
from flask_wtf import CsrfProtect
from raven.contrib.flask import Sentry
import logging
import os
from a... | mit | Python |
1606445e137ecae5a1f5c50edcc5e851d399b313 | Solve 1000 digit fib number | daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various | project_euler/025.1000_digit_fibonacci_number.py | project_euler/025.1000_digit_fibonacci_number.py | '''
Problem 025
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 = 34
F10 = 55
F11 = 89
F12 = 144
The 12th term, F12, is the first term to contain three digits.
What... | '''
Problem 025
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 = 34
F10 = 55
F11 = 89
F12 = 144
The 12th term, F12, is the first term to contain three digits.
What... | mit | Python |
92743212f787e991164c672cf5491a56a8565f30 | Update applications/signals.py | hackupc/backend,hackupc/backend,hackupc/backend,hackupc/backend | applications/signals.py | applications/signals.py | from django.db.models.signals import post_save
from django.dispatch import receiver
from applications import models
# Delete DraftApplication when application submitted
@receiver(post_save, sender=models.Application)
def clean_draft_application(sender, instance, created, *args, **kwargs):
if not created:
... | from django.db.models.signals import post_save
from django.dispatch import receiver
from applications import models
# Delete DraftApplication when application submitted
@receiver(post_save, sender=models.Application)
def clean_draftapplication(sender, instance, created, *args, **kwargs):
if not created:
... | mit | Python |
b6b9e46cf7089e4f9912a7ace5c05f95b3cb3f23 | add Apache License header | heiths/allura,apache/allura,heiths/allura,heiths/allura,lym/allura-git,apache/allura,apache/allura,lym/allura-git,apache/allura,lym/allura-git,lym/allura-git,apache/allura,heiths/allura,heiths/allura,lym/allura-git | AlluraTest/alluratest/pylint_checkers.py | AlluraTest/alluratest/pylint_checkers.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (t... | import astroid
from pylint.checkers import BaseChecker, utils
from pylint.interfaces import IAstroidChecker
def register(linter):
linter.register_checker(ExposedAPIHasKwargs(linter))
# FIXME?
BASE_ID = 76 # taken from https://github.com/edx/edx-lint/tree/master/edx_lint/pylint
class ExposedAPIHasKwargs(BaseC... | apache-2.0 | Python |
45de1bf21bc2e44c86ebb40772dd938daf47a691 | Ajuste no nome do arquivo xml da plp | kmee/pySigepWeb | pysigepweb/resposta_fecha_plp_varios_servicos.py | pysigepweb/resposta_fecha_plp_varios_servicos.py | # -*- coding: utf-8 -*-
class ResposaFechaPLPVariosServicos(object):
def __init__(self, xml, id_plp_cliente):
self._xml = xml
self.id_plp_cliente = id_plp_cliente
def salvar_xml(self, path):
from xml.etree.ElementTree import ElementTree, fromstring
# tag raiz do xml
... | # -*- coding: utf-8 -*-
class ResposaFechaPLPVariosServicos(object):
def __init__(self, xml, id_plp_cliente):
self._xml = xml
self.id_plp_cliente = id_plp_cliente
def salvar_xml(self, path):
from xml.etree.ElementTree import ElementTree, fromstring
# tag raiz do xml
... | agpl-3.0 | Python |
accd91b9b180f88facd5a61bddbb073b5a35af63 | Fix order of migration in operations | cfpb/owning-a-home-api | ratechecker/migrations/0002_remove_fee_loader.py | ratechecker/migrations/0002_remove_fee_loader.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.22 on 2019-10-31 16:33
from __future__ import unicode_literals
from django.db import migrations, OperationalError, ProgrammingError
def fix_fee_product_index(apps, schema_editor):
try:
schema_editor.execute(
'DROP INDEX IF EXISTS idx_16977_pro... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.22 on 2019-10-31 16:33
from __future__ import unicode_literals
from django.db import migrations, OperationalError, ProgrammingError
def fix_fee_product_index(apps, schema_editor):
try:
schema_editor.execute(
'DROP INDEX IF EXISTS idx_16977_pro... | cc0-1.0 | Python |
9b4b18c92cf4513ee3e80b4365ddce60631c269d | Align encoding header with file content | serpis/pynik | plugins/aduno.py | plugins/aduno.py | # coding: latin-1
from __future__ import with_statement
import pickle
import sys
import re
import utility
from plugins import Plugin
from commands import Command
import command_catcher
class AdunoCommand(Command):
def trig_aduno(self, bot, source, target, trigger, argument):
return "\(o_)/"
| # coding: utf-8
from __future__ import with_statement
import pickle
import sys
import re
import utility
from plugins import Plugin
from commands import Command
import command_catcher
class AdunoCommand(Command):
def trig_aduno(self, bot, source, target, trigger, argument):
return "\(o_)/"
| mit | Python |
55d7866d2797ee3a06086fc7dc2398df882fb9eb | add sentinel_catalog tasks to celery schedule | ibamacsr/indicar-process,ibamacsr/indicar-process,ibamacsr/indicar_process,ibamacsr/indicar_process,ibamacsr/indicar_process | indicarprocess/indicarprocess/celery.py | indicarprocess/indicarprocess/celery.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
from celery import Celery
from celery.schedules import crontab, timedelta
from django.conf import settings
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'indicarprocess.settin... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
from celery import Celery
from celery.schedules import crontab
from django.conf import settings
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'indicarprocess.settings.producti... | agpl-3.0 | Python |
b937504bffe527694bd383f4c51b74d53df212a7 | test refact. cont. | kotarskg/PyWeatherServer,grzes71/PyWeatherServer | src/tests/test_model.py | src/tests/test_model.py | """Weather Model unit tests
.. moduleauthor:: grzes71
"""
import unittest
from configparser import SafeConfigParser
from weatherserver.config import (OPT_HUMIDITY,
OPT_PRESSURE,
OPT_TEMPERATURE,
OPT_WIN... | """Weather Model unit tests
.. moduleauthor:: grzes71
"""
import unittest
from configparser import SafeConfigParser
from weatherserver.config import OPT_HUMIDITY, OPT_PRESSURE, OPT_TEMPERATURE, OPT_WINDSPEED
from weatherserver.model.weathermodel import create_weather_model, WeatherModel
TEST_CONFIG = "... | mit | Python |
a36a8b699d263336dfd76b5b17a3dcd6a0601c87 | ADD new optional attribute in pydantic UserUpdate class | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/grid/backend/grid/api/users/models.py | packages/grid/backend/grid/api/users/models.py | # stdlib
from datetime import datetime
from typing import Optional
from typing import Union
# third party
from nacl.encoding import HexEncoder
from nacl.signing import SigningKey
from pydantic import BaseModel
from pydantic import EmailStr
class BaseUser(BaseModel):
email: Optional[EmailStr]
name: Optional[s... | # stdlib
from datetime import datetime
from typing import Optional
from typing import Union
# third party
from nacl.encoding import HexEncoder
from nacl.signing import SigningKey
from pydantic import BaseModel
from pydantic import EmailStr
class BaseUser(BaseModel):
email: Optional[EmailStr]
name: Optional[s... | apache-2.0 | Python |
2ceacdad2585f185dfb688667027785659418a58 | correct spelling and formatting | ckaus/EpiPy | src/utils/csvmanager.py | src/utils/csvmanager.py | # -*- coding: utf-8 -*-
import os.path
import csv
import logger
current_dir = os.path.abspath(os.path.dirname(__file__))
resources_dir = os.path.abspath(current_dir + "/../../resources/data")
def read(file_name='', seperator=";", column=[]):
"""
This function reads a csv file.
:param file_name: a file name
:p... | # -*- coding: utf-8 -*-
import os.path
import csv
import logger
current_dir = os.path.abspath(os.path.dirname(__file__))
resources_dir = os.path.abspath(current_dir + "/../../resources/data")
def read(file_name, seperator=";", col=[]):
"""
This function reads a csv file.
:param file_name: a file name
:param t... | mit | Python |
f9a9a55511812676b1edf372275e7453469a41af | Fix imports. | TESScience/SPyFFI,TESScience/SPyFFI,TESScience/SPyFFI | imports.py | imports.py | '''Things that will probably need to be imported into most of the TESS code chunks.'''
# some basics
import numpy as np, matplotlib.pyplot as plt
import os, copy, subprocess, glob
# some scipy tools for interpolation and image filtering
import scipy.ndimage, scipy.signal, scipy.interpolate
# lots from astropy
import... | '''Things that will probably need to be imported into most of the TESS code chunks.'''
# some basics
import numpy as np, matplotlib.pyplot as plt
import os, copy, subprocess, glob
# some scipy tools for interpolation and image filtering
import scipy.ndimage, scipy.signal, scipy.interpolate
# lots from astropy
import... | mit | Python |
85bf243bb2005a3a7442cf3977f1f263f2331fbc | Fix Device Selector | SummaLabs/DLS,SummaLabs/DLS,SummaLabs/DLS,SummaLabs/DLS | app/backend/env/api.py | app/backend/env/api.py | from flask import Response
import flask
import json
from app.backend.env import hardware, env
environment = flask.Blueprint(__name__, __name__)
@environment.route('/info', methods=["GET"])
def get_system_info():
return Response(hardware.get_system_info(), mimetype='application/json')
@environment.route('/devi... | from flask import Response
import flask
import json
from app.backend.env import hardware, env
environment = flask.Blueprint(__name__, __name__)
@environment.route('/info', methods=["GET"])
def get_system_info():
return Response(hardware.get_system_info(), mimetype='application/json')
@environment.route('/envi... | mit | Python |
f79a0c6c5b0fbba039005d7b4acc9b7ca13684cd | Fix global variable declaration | bob3000/thumbor_aws,abaldwin1/tc_aws,andrew-a-dev/aws,ScrunchEnterprises/thumbor_aws,aoqfonseca/aws,thumbor-community/aws,voxmedia/aws,guilhermef/aws,tsauzeau/aws,pgr0ss/aws | tc_aws/connection.py | tc_aws/connection.py | # coding: utf-8
from boto.s3.connection import S3Connection
connection = None
def get_connection(context):
global connection
if connection is None:
boto_opts = {}
if context.config.AWS_ROLE_BASED_CONNECTION==False:
boto_opts.update({
'aws_access_key_id' : cont... | # coding: utf-8
from boto.s3.connection import S3Connection
connection = None
def get_connection(context):
if connection is None:
boto_opts = {}
if context.config.AWS_ROLE_BASED_CONNECTION==False:
boto_opts.update({
'aws_access_key_id' : context.config.AWS_ACCESS_... | mit | Python |
a34fb23a92ea255a401563015605ba60e5cd0811 | Fix typo in module docstring | saqura/xmppwb | xmppwb/core.py | xmppwb/core.py | """
xmppwb.core
~~~~~~~~~~~
This module is mainly used as an entrypoint to set everything up.
:copyright: (c) 2016 by saqura.
:license: MIT, see LICENSE for more details.
"""
import argparse
import asyncio
import logging
import os
import sys
import yaml
from xmppwb.bridge import XMPPWebhookBridge, InvalidConfigError... | """
xmppwb.core
~~~~~~~~~~~
This module is mainly used an entrypoint to set everything up.
:copyright: (c) 2016 by saqura.
:license: MIT, see LICENSE for more details.
"""
import argparse
import asyncio
import logging
import os
import sys
import yaml
from xmppwb.bridge import XMPPWebhookBridge, InvalidConfigError
... | mit | Python |
0e487c3b4fdc2ee85768def4e570634608f5fb56 | Put description back | ox-it/talks.ox,ox-it/talks.ox,ox-it/talks.ox | talks/core/renderers.py | talks/core/renderers.py | from datetime import datetime
from rest_framework import renderers
from icalendar import Calendar, Event
class ICalRenderer(renderers.BaseRenderer):
media_type = 'text/calendar'
format = 'ics'
def render(self, data, media_type=None, renderer_context=None):
cal = Calendar()
cal.add('prodi... | from datetime import datetime
from rest_framework import renderers
from icalendar import Calendar, Event
class ICalRenderer(renderers.BaseRenderer):
media_type = 'text/calendar'
format = 'ics'
def render(self, data, media_type=None, renderer_context=None):
cal = Calendar()
cal.add('prodi... | apache-2.0 | Python |
95527382951a3a00233d78854c4f6a2fb3bf2dd3 | fix election.py | otrack/cloud-computing-hands-on,otrack/cloud-computing-hands-on,otrack/cloud-computing-hands-on | zk/election.py | zk/election.py | #!/usr/bin/env python2.7
import time, socket, os, uuid, sys, kazoo, logging, signal, inspect
from kazoo.client import KazooClient
from kazoo.client import KazooState
from kazoo.exceptions import KazooException
class Election:
def __init__(self, zk, path, func,args):
self.election_path = path
self.... | #!/usr/bin/env python2.7
import time, socket, os, uuid, sys, kazoo, logging, signal, inspect
from kazoo.client import KazooClient
from kazoo.client import KazooState
from kazoo.exceptions import KazooException
class Election:
def __init__(self, zk, path, func,args):
self.election_path = path
self.... | apache-2.0 | Python |
a0dcb62848993c05ab2874205b255b3b27bb17ef | add db initializer | bmwachajr/bucketlist | application/__init__.py | application/__init__.py | from flask import Flask
from sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config.from_object("config')
db = SQLAlchemy(app)
from application import views, models
| from flask import Flask
app = Flask(__name__)
app.config.from_object("config')
from application import views
| mit | Python |
9f5432c9c13b7b44d9f28d98807ff41311c6cce8 | hide pdf in book admin | fnp/wolnelektury,fnp/wolnelektury,fnp/wolnelektury,fnp/wolnelektury | apps/catalogue/admin.py | apps/catalogue/admin.py | # -*- coding: utf-8 -*-
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.contrib import admin
from django import forms
from newtagging.admin import TaggableModelAdmin, TaggableModelForm
from catalogue... | # -*- coding: utf-8 -*-
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.contrib import admin
from django import forms
from newtagging.admin import TaggableModelAdmin, TaggableModelForm
from catalogue... | agpl-3.0 | Python |
7d78c599d39ff19c981eb392c2a2b2e55a79a057 | Use more settings features from django-debian | Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server,OSSystems/lava-server | dashboard_server/settings/debian.py | dashboard_server/settings/debian.py | # Django settings for django_hello project used on Debian systems.
from django_debian.settings import Settings
from dashboard_server.settings.production import *
# Load application settings from django-debian integration package
debian_settings = Settings("launch-control")
# Debug mode
DEBUG = debian_settings.DEBUG
... | # Django settings for django_hello project used on Debian systems.
from django_debian.settings import Settings
from dashboard_server.settings.production import *
# Load application settings from django-debian integration package
debian_settings = Settings("launch-control")
# Load default database from Debian integra... | agpl-3.0 | Python |
0c96fb0de08a12ba54de594b7cb2a834fd772ff0 | fix wrongful removal of points in gpxwriter | Turan-no/Turan,Turan-no/Turan,Turan-no/Turan,Turan-no/Turan | apps/turan/gpxwriter.py | apps/turan/gpxwriter.py | #!/usr/bin/env python
# -*- coding: UTF-8
#
''' This file will need a list of object that have following properties:
* time
* lon
* lat
* altitude
Since the objects doesn't know about GPS signal quality the writer does not write information about it to the xml
It anonymizes timestamps by defa... | #!/usr/bin/env python
# -*- coding: UTF-8
#
''' This file will need a list of object that have following properties:
* time
* lon
* lat
* altitude
Since the objects doesn't know about GPS signal quality the writer does not write information about it to the xml
It anonymizes timestamps by defa... | agpl-3.0 | Python |
a212b15caaf0eb0d2a7a01b28d3edff31ef5d416 | save tags for each new command | DeepController/tellina,DeepController/tellina,DeepController/tellina | website/utils.py | website/utils.py | import socket
import ssl
import os, sys
import urllib
from django.core.exceptions import ObjectDoesNotExist
from website.models import NL, Command, Tag, URL
sys.path.append(os.path.join(
os.path.dirname(__file__), "..", "tellina_learning_module"))
from bashlex import data_tools
def get_nl(nl_str):
nl, _ = ... | import socket
import ssl
import os, sys
import urllib
from django.core.exceptions import ObjectDoesNotExist
from website.models import NL, Command, Tag, URL
sys.path.append(os.path.join(
os.path.dirname(__file__), "..", "tellina_learning_module"))
from bashlex import data_tools
def get_nl(nl_str):
nl, _ = ... | mit | Python |
0e5c7a95a0e41e008acd208d0cfb0177da4fe647 | Add new test : IK_optimization_method | Phylliade/ikpy | tests/ikpy/test_chain.py | tests/ikpy/test_chain.py | import unittest
import numpy as np
import sys
from ikpy import chain
from ikpy import plot_utils
import params
plot = params.interactive
class TestChain(unittest.TestCase):
def setUp(self):
if plot:
self.ax = plot_utils.init_3d_figure()
self.chain1 = chain.Chain.from_urdf_file(params.... | import unittest
import numpy as np
import sys
from ikpy import chain
from ikpy import plot_utils
import params
plot = params.interactive
class TestChain(unittest.TestCase):
def setUp(self):
if plot:
self.ax = plot_utils.init_3d_figure()
self.chain1 = chain.Chain.from_urdf_file(params.... | apache-2.0 | Python |
42f8489e151e646ef0f053d34db1158432ddfafa | update the comment | iamrajhans/FlaskBackend | drone/utility/nishu.py | drone/utility/nishu.py | from os import urandom
import bcrypt
from drone.main import db
from drone.models import AppAuthentication,UserModel
def get_application_model(api_key):
return db.session.query(AppAuthentication).filter_by(api_key=api_key).first()
def add_user_in_db(data):
add_user = UserModel(
id=data['id'],
... | from os import urandom
import bcrypt
from drone.main import db
from drone.models import AppAuthentication,UserModel
def get_application_model(api_key):
return db.session.query(AppAuthentication).filter_by(api_key=api_key).first()
def add_user_in_db(data):
add_user = UserModel(
id=data['id'],
... | mit | Python |
ed724ea8180a4bbfd1e97e06785e8073397fccdd | Add comment for set() | bowen0701/algorithms_data_structures | lc0202_happy_number.py | lc0202_happy_number.py | """Leetcode 202. Happy Number
Easy
URL: https://leetcode.com/problems/happy-number/
Write an algorithm to determine if a number is "happy".
A happy number is a number defined by the following process:
Starting with any positive integer,
replace the number by the sum of the squares of its digits,
and repeat the proce... | """Leetcode 202. Happy Number
Easy
URL: https://leetcode.com/problems/happy-number/
Write an algorithm to determine if a number is "happy".
A happy number is a number defined by the following process:
Starting with any positive integer,
replace the number by the sum of the squares of its digits,
and repeat the proce... | bsd-2-clause | Python |
2f174f623aa67a0d7f87d7983b5d460a9fe4b2e2 | Fix users_tags for gravatar | watchdogpolska/poradnia,watchdogpolska/poradnia.siecobywatelska.pl,rwakulszowa/poradnia,watchdogpolska/poradnia,rwakulszowa/poradnia,rwakulszowa/poradnia,watchdogpolska/poradnia.siecobywatelska.pl,watchdogpolska/poradnia,rwakulszowa/poradnia,watchdogpolska/poradnia,watchdogpolska/poradnia.siecobywatelska.pl | poradnia/users/templatetags/users_tags.py | poradnia/users/templatetags/users_tags.py | from django.conf import settings
from django import template
from gravatar import Gravatar
from sorl.thumbnail import get_thumbnail
register = template.Library()
AVATAR_DEFAULT = getattr(settings, 'USER_AVATAR_DEFAULT', 'retro')
AVATAR_SSL = getattr(settings, 'USER_AVATAR_SSL', True)
@register.simple_tag
def get_av... | from django.conf import settings
from django import template
from gravatar import Gravatar
from sorl.thumbnail import get_thumbnail
register = template.Library()
AVATAR_DEFAULT = getattr(settings, 'USER_AVATAR_DEFAULT', 'retro')
AVATAR_SSL = getattr(settings, 'USER_AVATAR_SSL', True)
@register.simple_tag
def get_av... | mit | Python |
9ed7649d98bc4b1d3412047d0d5c50c1a5c8116c | Fix check for accounts.py file in system tests. | Eagles2F/sync-engine,ErinCall/sync-engine,closeio/nylas,gale320/sync-engine,nylas/sync-engine,EthanBlackburn/sync-engine,wakermahmud/sync-engine,Eagles2F/sync-engine,jobscore/sync-engine,wakermahmud/sync-engine,gale320/sync-engine,ErinCall/sync-engine,gale320/sync-engine,PriviPK/privipk-sync-engine,nylas/sync-engine,ny... | tests/system/conftest.py | tests/system/conftest.py | # This file contains pytest fixtures as well as some config
API_BASE = "http://localhost:5555/n/"
TEST_MAX_DURATION_SECS = 240
TEST_GRANULARITY_CHECK_SECS = 0.1
# we don't want to commit passwords to the repo.
# load them from an external json file.
try:
from accounts import credentials
passwords = []
for... | # This file contains pytest fixtures as well as some config
API_BASE = "http://localhost:5555/n/"
TEST_MAX_DURATION_SECS = 240
TEST_GRANULARITY_CHECK_SECS = 0.1
# we don't want to commit passwords to the repo.
# load them from an external json file.
try:
from accounts import credentials
passwords = []
for... | agpl-3.0 | Python |
0912f6910ac436f8f09848b4485e39e5c308f70e | Fix the index dumper code | sorgerlab/indra,bgyori/indra,bgyori/indra,johnbachman/belpy,johnbachman/indra,sorgerlab/belpy,sorgerlab/belpy,johnbachman/belpy,sorgerlab/indra,johnbachman/indra,sorgerlab/belpy,johnbachman/indra,sorgerlab/indra,johnbachman/belpy,bgyori/indra | indra/tools/live_curation/dump_index.py | indra/tools/live_curation/dump_index.py | """This is a script to dump all the corpora on S3 into an index file."""
import boto3
if __name__ == '__main__':
s3 = boto3.session.Session(profile_name='wm').client('s3')
res = s3.list_objects(Bucket='world-modelers', Prefix='indra_models')
corpora = []
for entry in res['Content']:
if entry... | """This is a script to dump all the corpora on S3 into an index file."""
import boto3
res = s3.list_objects(Bucket='world-modelers', Prefix='indra_models')
s3 = boto3.session.Session(profile_name='wm').client('s3')
corpora = []
for entry in res['Content']:
if entry['Key'].endswith('/statements.json'):
co... | bsd-2-clause | Python |
231570adfcf166becdb8558e01c728bf2e9106b5 | Fix checker | Bryukh-Checkio-Tasks/checkio-mission-best-number-ever,Bryukh-Checkio-Tasks/checkio-mission-best-number-ever,Bryukh-Checkio-Tasks/checkio-mission-best-number-ever | verification/referee.py | verification/referee.py | """
CheckiOReferee is a base referee for checking you code.
arguments:
tests -- the dict contains tests in the specific structure.
You can find an example in tests.py.
cover_code -- is a wrapper for the user function and additional operations before give data
in the user func... | """
CheckiOReferee is a base referee for checking you code.
arguments:
tests -- the dict contains tests in the specific structure.
You can find an example in tests.py.
cover_code -- is a wrapper for the user function and additional operations before give data
in the user func... | mit | Python |
81c401daf5d418a917d6bda4b5cbf0eb3870ce15 | Update to version 1.2.0 - version needed for exoplanet data challenge | henry-ngo/VIP,vortex-exoplanet/VIP | vip_hci/__init__.py | vip_hci/__init__.py | __version__ = "1.2.0"
from . import preproc
from . import config
from . import fits
from . import invprob
from . import psfsub
from . import fm
from . import metrics
from . import stats
from . import var
from .hci_dataset import *
from .hci_postproc import *
from .vip_ds9 import * | __version__ = "1.1.3"
from . import preproc
from . import config
from . import fits
from . import invprob
from . import psfsub
from . import fm
from . import metrics
from . import stats
from . import var
from .hci_dataset import *
from .hci_postproc import *
from .vip_ds9 import * | mit | Python |
15eebe2c22abb8bd0dfdf5fa5bb2586d4e6797fe | Rewrite the Image URLs | robhudson/warehouse,mattrobenolt/warehouse,techtonik/warehouse,techtonik/warehouse,robhudson/warehouse,mattrobenolt/warehouse,mattrobenolt/warehouse | warehouse/assets.py | warehouse/assets.py | # Copyright 2013 Donald Stufft
#
# 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, so... | # Copyright 2013 Donald Stufft
#
# 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, so... | apache-2.0 | Python |
30a0944a47acab2fae787f1668d1b65b6508e5cf | Bump to version 0.5.2 | kmichel/po-localization | po_localization/version.py | po_localization/version.py | # coding=utf-8
__version__ = '0.5.2'
| # coding=utf-8
__version__ = '0.5.1'
| mit | Python |
9cba4a9cf2c671b15bb4e63da586e7700506a71a | change colors a bit | jogo/graphing-openstack | graph.py | graph.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 u... | # 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 u... | apache-2.0 | Python |
3a35f1f92b5cab7c951f7d93aa4cc5a25b77c73f | fix socket.close warnings | lincheney/ssh-forward-proxy,lincheney/ssh-forward-proxy | tests/test_run_server.py | tests/test_run_server.py | import unittest
try:
from unittest import mock
except ImportError:
import mock
patch = mock.patch
sentinel = mock.sentinel
import os
import signal
from ssh_forward_proxy import run_server
class RunServerTest(unittest.TestCase):
class Error(Exception):
pass
@patch('socket.socket.bind')
d... | import unittest
try:
from unittest import mock
except ImportError:
import mock
patch = mock.patch
sentinel = mock.sentinel
import os
import signal
from ssh_forward_proxy import run_server
class RunServerTest(unittest.TestCase):
class Error(Exception):
pass
@patch('socket.socket.bind')
d... | mit | Python |
72c5bddceb7ef335253fccee82d4e717f9a9e98e | Fix orientation and use new drawing function of base class | fjacob21/pycon2015 | elpiwear/tag_screen.py | elpiwear/tag_screen.py | import Image
import ImageDraw
import ImageFont
import screen
class tag_screen(screen.screen):
def __init__(self):
screen.screen.__init__(self)
self.me = Image.open('me.png')
self.me = self.me.resize((100,100))
self.display_tag()
self.update()
def display_tag(self):
... | import Image
import ImageDraw
import ImageFont
import screen
def draw_rotated_text(image, text, position, angle, font, fill=(255,255,255)):
# Get rendered font width and height.
draw = ImageDraw.Draw(image)
width, height = draw.textsize(text, font=font)
# Create a new image with transparent background ... | mit | Python |
c946bf57c061677102312a383eef53dea5af28d7 | add indexes | omerbartal/open-budget-data,OpenBudget/open-budget-data,OpenBudget/open-budget-data,omerbartal/open-budget-data | processors/dump_to_psql.py | processors/dump_to_psql.py | import sqlite3
import json
import logging
import time
import os
import sys
import hashlib
import gzip
import psycopg2
import datetime
def convert(val,typ):
if typ=="date" and val is not None:
if val.strip() != '':
val = [int(x) for x in val.split('/')]
val.reverse()
val ... | import sqlite3
import json
import logging
import time
import os
import sys
import hashlib
import gzip
import psycopg2
import datetime
def convert(val,typ):
if typ=="date" and val is not None:
if val.strip() != '':
val = [int(x) for x in val.split('/')]
val.reverse()
val ... | mit | Python |
c23abd41b4b721c647ce3c639c20fea1df4d0753 | Support kwargs style initialization and printing | drcloud/arx | arx/inner/schematics.py | arx/inner/schematics.py | from __future__ import absolute_import
from collections import Sequence
from contextlib import contextmanager
import threading
import schematics.models
from schematics.types import BaseType
import six
from ..sources import interpreter
class Model(schematics.models.Model):
def __init__(self, *args, **kwargs):
... | from __future__ import absolute_import
from collections import Sequence
from contextlib import contextmanager
import threading
import schematics.models
from schematics.types import BaseType
import six
from ..sources import interpreter
class Model(schematics.models.Model):
class Options:
serialize_when_n... | mit | Python |
1383ed156146f1656406a8aabc8c82eae4ab5aa3 | Fix compiled_scripts folder creation in buildRunScripts-SBT-13.13.py script | lift-project/lift,lift-project/lift,lift-project/lift,lift-project/lift,lift-project/lift | scripts/buildRunScripts-SBT-13.13.py | scripts/buildRunScripts-SBT-13.13.py | #!/usr/bin/env python
import os
import subprocess
import re
import sys
scriptRoot=os.path.dirname(os.path.realpath(__file__))
projectRoot=os.path.dirname(scriptRoot)
os.chdir(projectRoot)
# SBT now includes colour codes in the output. We need to strip them.
# This solution uses a regex to match and substitute them. ... | #!/usr/bin/env python
import os
import subprocess
import re
import sys
scriptRoot=os.path.dirname(os.path.realpath(__file__))
projectRoot=os.path.dirname(scriptRoot)
os.chdir(projectRoot)
# SBT now includes colour codes in the output. We need to strip them.
# This solution uses a regex to match and substitute them. ... | mit | Python |
e166f8651b03ddc2ed1c5471561c57c1297fee58 | Remove debug output | google/turbinia,google/turbinia,google/turbinia,google/turbinia,google/turbinia | turbinia/workers/plaso.py | turbinia/workers/plaso.py | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
7b32a2a173795f7c58117eef779e0244ad8d460b | Add initial solution | CubicComet/exercism-python-solutions | secret-handshake/secret_handshake.py | secret-handshake/secret_handshake.py | CODE = {"wink": 1, "double blink": 2, "close your eyes": 4, "jump": 8}
def handshake(n):
try:
n = int(n, 2)
except (ValueError, TypeError):
n = int(n)
if not 0 < n < 32:
return []
lst = []
for action, val in CODE.items():
if n & val:
lst.append(action)
... | def handshake():
pass
def code():
pass
| agpl-3.0 | Python |
de95a7df3dec791395746618b4e0141b6ab2b590 | remove extension | conikuvat/edegal,conikuvat/edegal,conikuvat/edegal,conikuvat/edegal | backend/edegal/admin.py | backend/edegal/admin.py | from os.path import splitext
from django.contrib import admin
from multiupload.admin import MultiUploadAdmin
from .utils import slugify
from .models import (
Album,
Media,
MediaSpec,
Picture,
TermsAndConditions,
)
class PictureInline(admin.TabularInline):
model = Picture
extra = 0
... | from django.contrib import admin
from multiupload.admin import MultiUploadAdmin
from .utils import slugify
from .models import (
Album,
Media,
MediaSpec,
Picture,
TermsAndConditions,
)
class PictureInline(admin.TabularInline):
model = Picture
extra = 0
max_num = 0
fields = ('or... | mit | Python |
db8b558652f46abc423b67d0ef5cbcf3c80af8a4 | Remove comment. | thinkopensolutions/account-fiscal-rule,akretion/account-fiscal-rule | account_fiscal_position_rule/models/account_invoice.py | account_fiscal_position_rule/models/account_invoice.py | # -*- coding: utf-8 -*-
# Copyright (C) 2009-TODAY Akretion <http://www.akretion.com>
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# @author Renato Lima <renato.lima@akretion.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, api
class AccountInvoice(model... | # -*- coding: utf-8 -*-
# Copyright (C) 2009-TODAY Akretion <http://www.akretion.com>
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# @author Renato Lima <renato.lima@akretion.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, api
class AccountInvoice(model... | agpl-3.0 | Python |
e3be458a28985a575e4d4abee7ed029e9c64b5ac | use xbmcgui.notification() part of #36 | mjrulesamrat/xbmcbackup,robweber/xbmcbackup | resources/lib/utils.py | resources/lib/utils.py | import xbmc
import xbmcgui
import xbmcaddon
__addon_id__= 'script.xbmcbackup'
__Addon = xbmcaddon.Addon(__addon_id__)
def data_dir():
return __Addon.getAddonInfo('profile')
def addon_dir():
return __Addon.getAddonInfo('path')
def openSettings():
__Addon.openSettings()
def log(message,loglevel=xbmc.LOGN... | import xbmc
import xbmcaddon
__addon_id__= 'script.xbmcbackup'
__Addon = xbmcaddon.Addon(__addon_id__)
def data_dir():
return __Addon.getAddonInfo('profile')
def addon_dir():
return __Addon.getAddonInfo('path')
def openSettings():
__Addon.openSettings()
def log(message,loglevel=xbmc.LOGNOTICE):
xbm... | mit | Python |
de66f699a9b0ae5dee900d7ed42640f15b2e7b65 | update internet_on with ssl && with host from config | BrightnessMonitor/BrightnessMonitorClient,BrightnessMonitor/BrightnessMonitorClient | src/brightnessmonitorclient/api_client/update.py | src/brightnessmonitorclient/api_client/update.py | import urllib2
import httplib
import requests
import json
from brightnessmonitorclient.config.read_config import read_config
def upload(value, time):
'''
Upload the value & time to the website
Args:
value: The value which should be uploaded
time: The datetime which should be uploaded... | import urllib2
from datetime import datetime
import requests
import json
from brightnessmonitorclient.config.read_config import read_config
def upload(value, time):
'''
Upload the value & time to the website
Args:
value: The value which should be uploaded
time: The datetime which sho... | mit | Python |
08823a33c55f68ddbdbbf4955a2f91dbaf13be5f | Add typing to interface | bcb/jsonrpcclient | jsonrpcclient/clients/aiohttp_client.py | jsonrpcclient/clients/aiohttp_client.py | """
aiohttp client.
Requires aiohttp >= 3.0.
http://aiohttp.readthedocs.io/
"""
from typing import Any, Optional
from ssl import SSLContext
import async_timeout # type: ignore
from aiohttp import ClientSession # type: ignore
from ..async_client import AsyncClient
from ..exceptions import ReceivedNon2xxResponseErr... | """
aiohttp client.
http://aiohttp.readthedocs.io/
"""
from typing import Any
import async_timeout # type: ignore
from aiohttp import ClientSession # type: ignore
from ..async_client import AsyncClient
from ..exceptions import ReceivedNon2xxResponseError
from ..response import Response
class AiohttpClient(AsyncC... | mit | Python |
6d93ba3eb05535e8978df7d1a1e570290ff324d1 | Format fix | daboross/dabo.guru,daboross/dabo.guru,daboross/dabo.guru,daboross/dabo.guru | content.wsgi | content.wsgi | #!/usr/bin/env python3
#
# Copyright 2014 Dabo Ross <http://www.daboross.net/>
#
# 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 re... | #!/usr/bin/env python3
#
# Copyright 2014 Dabo Ross <http://www.daboross.net/>
#
# 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 requir... | apache-2.0 | Python |
85aa29b95dcd195adab31c27a9cb7cb78fbc91e3 | Fix an older fmn downgrade script. | jeremycline/fmn,jeremycline/fmn,jeremycline/fmn | alembic/versions/38c9c18d342e_add_new_mdapi_rule.py | alembic/versions/38c9c18d342e_add_new_mdapi_rule.py | """Add new mdapi rule.
Revision ID: 38c9c18d342e
Revises: 362efe8fd524
Create Date: 2015-11-13 13:49:25.020563
"""
# revision identifiers, used by Alembic.
revision = '38c9c18d342e'
down_revision = '362efe8fd524'
from alembic import op
import sqlalchemy as sa
path = 'fmn.rules:mdapi_repo_update'
target = "Events o... | """Add new mdapi rule.
Revision ID: 38c9c18d342e
Revises: 362efe8fd524
Create Date: 2015-11-13 13:49:25.020563
"""
# revision identifiers, used by Alembic.
revision = '38c9c18d342e'
down_revision = '362efe8fd524'
from alembic import op
import sqlalchemy as sa
path = 'fmn.rules:mdapi_repo_update'
target = "Events o... | lgpl-2.1 | Python |
ea12c5ed494e272eff009a7768c701a1f027ca23 | test email path, title, attachments | hoover/snoop,hoover/snoop | testsuite/test_emails.py | testsuite/test_emails.py | from maldini import digest, models, emails
MAIL_PATH_MAPBOX = "eml-1-promotional/Introducing Mapbox Android Services - " \
"Mapbox Team <newsletter@mapbox.com> - 2016-04-20 1603.eml"
MAIL_PATH_CODINGAME = "eml-1-promotional/New on CodinGame: Check it out! - " \
"CodinGame <coders@codinga... | from maldini import digest, models, emails
MAIL_PATH_MAPBOX = "eml-1-promotional/Introducing Mapbox Android Services - " \
"Mapbox Team <newsletter@mapbox.com> - 2016-04-20 1603.eml"
MAIL_PATH_CODINGAME = "eml-1-promotional/New on CodinGame: Check it out! - " \
"CodinGame <coders@codinga... | mit | Python |
15f8781084c715da8c93d9faac3423968454a86d | Add search form to the Membership page in admin. | python/pythondotorg,Mariatta/pythondotorg,SujaySKumar/pythondotorg,lepture/pythondotorg,malemburg/pythondotorg,malemburg/pythondotorg,manhhomienbienthuy/pythondotorg,ahua/pythondotorg,malemburg/pythondotorg,berkerpeksag/pythondotorg,fe11x/pythondotorg,berkerpeksag/pythondotorg,berkerpeksag/pythondotorg,SujaySKumar/pyth... | users/admin.py | users/admin.py | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.forms import AdminPasswordChangeForm
from tastypie.admin import ApiKeyInline
from tastypie.models import ApiKey
from .forms import UserCreationForm, UserChangeForm
from .models import User, Membe... | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.forms import AdminPasswordChangeForm
from tastypie.admin import ApiKeyInline
from tastypie.models import ApiKey
from .forms import UserCreationForm, UserChangeForm
from .models import User, Membe... | apache-2.0 | Python |
86b5ca773c8d44e4e1454a0b60aecf87bb7c7fd1 | Allow argument override in play method | wqferr/AniMathors | core/anim.py | core/anim.py | import numpy
import matplotlib.pyplot as plt
import matplotlib.animation as anim
class Animation(object):
def __init__(self, *args, **kwargs):
self._fig, self._ax = plt.subplots()
self._fig.set_facecolor(kwargs.get('facecolor', 'black'))
self._ax.set_xlim(*kwargs.get('xlim', (-1, 1)))
... | import numpy
import matplotlib.pyplot as plt
import matplotlib.animation as anim
class Animation(object):
def __init__(self, *args, **kwargs):
self._fig, self._ax = plt.subplots()
self._fig.set_facecolor(kwargs.get('facecolor', 'black'))
self._ax.set_xlim(*kwargs.get('xlim', (-1, 1)))
... | mit | Python |
5df5fd09f058d78053a0acd43e79b6baa0f3bc2b | Test new examples in test_examples | cklb/pyinduct,riemarc/pyinduct,pyinduct/pyinduct | pyinduct/tests/test_examples.py | pyinduct/tests/test_examples.py | import unittest
from pyinduct.tests import test_all_examples
skip_msg = "Quick test of all examples, must be started manually."
class TestAllExamples(unittest.TestCase):
"""
Here you can check if all examples run fine again.
By unittest discover or setup this test case
will be skipped (see __init__.py... | import unittest
from pyinduct.tests import test_all_examples
skip_msg = "Quick test of all examples, must be started manually."
class TestAllExamples(unittest.TestCase):
"""
Here you can check if all examples run fine again.
By unittest discover or setup this test case
will be skipped (see __init__.py... | bsd-3-clause | Python |
e0959f8aae9615769d7529023cc51ead77217db1 | call in 10min | everpcpc/yubari,everpcpc/yubari | yubari/bots/qq_watch.py | yubari/bots/qq_watch.py | #!/usr/bin/env python
# coding: utf-8
import time
import logging
from yubari.config import QQ_GROUP, MENTION_NAME, QQ_ME
from yubari.lib.qq import qqbot
logger = logging.getLogger(__name__)
def check_mention_self(content):
for word in MENTION_NAME:
if word in content:
return True
retur... | #!/usr/bin/env python
# coding: utf-8
import time
import logging
from yubari.config import QQ_GROUP, MENTION_NAME, QQ_ME
from yubari.lib.qq import qqbot
logger = logging.getLogger(__name__)
def check_mention_self(content):
for word in MENTION_NAME:
if word in content:
return True
retur... | mit | Python |
28e9901b5a0feb8cb39a49b20bcb5aeeb2456ff6 | Tweak logging so it's clear it's replaying | mozilla/socorro,lonnen/socorro,mozilla/socorro,mozilla/socorro,mozilla/socorro,lonnen/socorro,lonnen/socorro,lonnen/socorro,mozilla/socorro,mozilla/socorro | socorro/scripts/replay_ftpscraper.py | socorro/scripts/replay_ftpscraper.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import os
import os.path
import psycopg2
from socorro.cron.buildutil import ins... | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import os
import os.path
import psycopg2
from socorro.cron.buildutil import ins... | mpl-2.0 | Python |
d20f787e0264e71d8d09f0d7b15fccaef3b1cf2c | call in group | everpcpc/yubari,everpcpc/yubari | yubari/bots/qq_watch.py | yubari/bots/qq_watch.py | #!/usr/bin/env python
# coding: utf-8
import time
import logging
from yubari.config import QQ_GROUP, MENTION_NAME
from yubari.lib.qq import qqbot
logger = logging.getLogger(__name__)
def run():
continue_count = 0
last_msg = ""
last_call = 0
for msg in qqbot.poll():
logger.info(msg)
... | #!/usr/bin/env python
# coding: utf-8
import logging
from yubari.config import QQ_GROUP, MENTION_NAME
from yubari.lib.qq import qqbot
logger = logging.getLogger(__name__)
def run():
continue_count = 0
last_msg = ""
for msg in qqbot.poll():
logger.info(msg)
content = msg.get('msg').stri... | mit | Python |
7d0691eae614da96f8fe14a5f5338659ef9638df | Add custom conv layer module | ronrest/convenience_py,ronrest/convenience_py | ml/pytorch/image_classification/architectures.py | ml/pytorch/image_classification/architectures.py | import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
################################################################################
# SUPPORT
################################################################################
class Flat... | import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
################################################################################
# SUPPORT
################################################################################
class Flat... | apache-2.0 | Python |
93870152b4afb04f1547378184e2cee0bd0dd45f | Return a dictionary for transcription/translation services (instead of list) | kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi | kobo/apps/languages/serializers/base.py | kobo/apps/languages/serializers/base.py | # coding: utf-8
from collections import defaultdict, OrderedDict
from django.db import models
from rest_framework import serializers
class BaseServiceSerializer(serializers.ModelSerializer):
class Meta:
fields = [
'name',
'code',
]
class BaseServiceLanguageM2MSerializer... | # coding: utf-8
from collections import defaultdict, OrderedDict
from django.db import models
from rest_framework import serializers
class BaseServiceSerializer(serializers.ModelSerializer):
class Meta:
fields = [
'name',
'code',
]
class BaseServiceLanguageM2MSerializer... | agpl-3.0 | Python |
bab9d6b28ca37ff5a34bf535d366ef81f10a5f90 | Refactor building command using join() | Fizzadar/pyinfra,Fizzadar/pyinfra | pyinfra/modules/virtualenv.py | pyinfra/modules/virtualenv.py | # pyinfra
# File: pyinfra/modules/pip.py
# Desc: manage virtualenvs
'''
Manage Python virtual environments
'''
from __future__ import unicode_literals
from pyinfra.api import operation
from pyinfra.modules import files
@operation
def virtualenv(
state, host,
path, python=None, site_packages=False, always_c... | # pyinfra
# File: pyinfra/modules/pip.py
# Desc: manage virtualenvs
'''
Manage Python virtual environments
'''
from __future__ import unicode_literals
from pyinfra.api import operation
from pyinfra.modules import files
@operation
def virtualenv(
state, host,
path, python=None, site_packages=False, always_c... | mit | Python |
7db06b1459ddc0608047cae0dabf886d237a7bf9 | add docstring. | jwilk/pydiatra,jwilk/pydiatra | pydiatra/tags.py | pydiatra/tags.py | # encoding=UTF-8
# Copyright © 2014-2016 Jakub Wilk <jwilk@jwilk.net>
#
# 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,... | # encoding=UTF-8
# Copyright © 2014-2016 Jakub Wilk <jwilk@jwilk.net>
#
# 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,... | mit | Python |
b097edc2fbef56290054296963697a22805c9968 | remove unecessary print | nschloe/python4gmsh | pygmsh/helper.py | pygmsh/helper.py | # -*- coding: utf-8 -*-
#
import numpy
import sys
if sys.platform == 'darwin':
# likely there.
gmsh_executable = '/Applications/Gmsh.app/Contents/MacOS/gmsh'
else:
gmsh_executable = 'gmsh'
def rotation_matrix(u, theta):
'''Return matrix that implements the rotation around the vector :math:`u`
by ... | # -*- coding: utf-8 -*-
#
import numpy
import sys
if sys.platform == 'darwin':
# likely there.
gmsh_executable = '/Applications/Gmsh.app/Contents/MacOS/gmsh'
else:
gmsh_executable = 'gmsh'
def rotation_matrix(u, theta):
'''Return matrix that implements the rotation around the vector :math:`u`
by ... | bsd-3-clause | Python |
c8dedb3d424d8b30f0f7f02754db79dc23c2fd36 | Remove test lines. | hande-qmc/hande,hande-qmc/hande,hande-qmc/hande,hande-qmc/hande,ruthfranklin/hande,hande-qmc/hande | tools/hamil_colourmap.py | tools/hamil_colourmap.py | #!/usr/bin/python
import numpy
import pylab
import sys
def colormap(filename, N):
# parallel output or serial?
f = open(filename)
parallel_output = 'hamil' in f.readline()
f.seek(0)
HMat = pylab.zeros((N,N))
if parallel_output:
for line in f:
i, j, hamil = line.split()[1... | #!/usr/bin/python
import numpy
import pylab
import sys
def colormap(filename, N):
# parallel output or serial?
f = open(filename)
parallel_output = 'hamil' in f.readline()
f.seek(0)
HMat = pylab.zeros((N,N))
if parallel_output:
for line in f:
i, j, hamil = line.split()[1... | lgpl-2.1 | Python |
0b1cdfac668b15ab9d48b1eb8a4ac4bff7b8c98e | Fix check for valid resolver_match | michaelmior/pylinks,michaelmior/pylinks,michaelmior/pylinks | pylinks/main/templatetags/menu_li.py | pylinks/main/templatetags/menu_li.py | from django.template import Library
from django.template.defaulttags import URLNode, url
from django.utils.html import escape, mark_safe
register = Library()
class MenuLINode(URLNode):
def render(self, context):
# Pull out the match and hijack asvar
# to be used for the link title
match =... | from django.template import Library
from django.template.defaulttags import URLNode, url
from django.utils.html import escape, mark_safe
register = Library()
class MenuLINode(URLNode):
def render(self, context):
# Pull out the match and hijack asvar
# to be used for the link title
request... | mit | Python |
7ce2ec9651b3befcb5c465d9d708595623140007 | Include displayname. | devilry/devilry-django,devilry/devilry-django,devilry/devilry-django,devilry/devilry-django | src/devilry/devilry/utils/restformat.py | src/devilry/devilry/utils/restformat.py | def format_datetime(datetime):
return datetime.strftime('%Y-%m-%d %H:%M:%S')
def format_timedelta(timedelta_obj):
total_seconds = abs(timedelta_obj.total_seconds())
days, remainder = divmod(total_seconds, 86400)
hours, remainder = divmod(remainder, 3600)
minutes, seconds = divmod(remainder, 60)
... | def format_datetime(datetime):
return datetime.strftime('%Y-%m-%d %H:%M:%S')
def format_timedelta(timedelta_obj):
total_seconds = abs(timedelta_obj.total_seconds())
days, remainder = divmod(total_seconds, 86400)
hours, remainder = divmod(remainder, 3600)
minutes, seconds = divmod(remainder, 60)
... | bsd-3-clause | Python |
796e2d79be6df46faf430650be47b0a11d00842a | add event_type filter field to events api | dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4 | apps/events/filters.py | apps/events/filters.py | import django_filters
from apps.events.models import Event
class EventDateFilter(django_filters.FilterSet):
event_start__gte = django_filters.DateTimeFilter(name='event_start', lookup_type='gte')
event_start__lte = django_filters.DateTimeFilter(name='event_start', lookup_type='lte')
event_end__gte = djan... | import django_filters
from apps.events.models import Event
class EventDateFilter(django_filters.FilterSet):
event_start__gte = django_filters.DateTimeFilter(name='event_start', lookup_type='gte')
event_start__lte = django_filters.DateTimeFilter(name='event_start', lookup_type='lte')
event_end__gte = djan... | mit | Python |
8cd2ad102129b9b44926fe157ac6aaecc04302c6 | Bring back files_changed signal | rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org | readthedocs/projects/signals.py | readthedocs/projects/signals.py | """Project signals."""
import django.dispatch
before_vcs = django.dispatch.Signal(providing_args=['version'])
after_vcs = django.dispatch.Signal(providing_args=['version'])
before_build = django.dispatch.Signal(providing_args=['version'])
after_build = django.dispatch.Signal(providing_args=['version'])
project_imp... | """Project signals."""
import django.dispatch
before_vcs = django.dispatch.Signal(providing_args=['version'])
after_vcs = django.dispatch.Signal(providing_args=['version'])
before_build = django.dispatch.Signal(providing_args=['version'])
after_build = django.dispatch.Signal(providing_args=['version'])
project_imp... | mit | Python |
689fb902a508379359922a86d707b93ddbb84c81 | Add gnt-network list to network QA | ganeti/ganeti,leshchevds/ganeti,apyrgio/ganeti,leshchevds/ganeti,andir/ganeti,andir/ganeti,ganeti-github-testing/ganeti-test-1,andir/ganeti,ganeti/ganeti,mbakke/ganeti,ganeti-github-testing/ganeti-test-1,yiannist/ganeti,ganeti/ganeti,yiannist/ganeti,grnet/snf-ganeti,onponomarev/ganeti,yiannist/ganeti,bitemyapp/ganeti,m... | qa/qa_network.py | qa/qa_network.py | #
#
# Copyright (C) 2013 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | #
#
# Copyright (C) 2013 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | bsd-2-clause | Python |
422e40e44f518c95373cd44a792337f99045aa48 | Change -l to libs and add extra links | philipdexter/rain,scizzorz/rain,philipdexter/rain,philipdexter/rain,scizzorz/rain,scizzorz/rain,philipdexter/rain,scizzorz/rain | rain/__main__.py | rain/__main__.py | from . import compiler as C
from . import error as Q
from . import module as M
from termcolor import colored as X
import argparse
import os.path
import sys
parser = argparse.ArgumentParser(description='Compile Rain code.')
parser.add_argument('-r', '--run', action='store_true',
help='Execute the co... | from . import compiler as C
from . import error as Q
from . import module as M
from termcolor import colored as X
import argparse
import os.path
import sys
parser = argparse.ArgumentParser(description='Compile Rain code.')
parser.add_argument('-r', '--run', action='store_true',
help='Execute the co... | mit | Python |
b8457759c34d76bc3faec02e7189c9342d9b9310 | document system.shutdown arg | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/system.py | salt/modules/system.py | # -*- coding: utf-8 -*-
'''
Support for reboot, shutdown, etc
'''
from __future__ import absolute_import
import salt.utils
def __virtual__():
'''
Only supported on POSIX-like systems
'''
if salt.utils.is_windows() or not salt.utils.which('shutdown'):
return False
return True
def halt():... | # -*- coding: utf-8 -*-
'''
Support for reboot, shutdown, etc
'''
from __future__ import absolute_import
import salt.utils
def __virtual__():
'''
Only supported on POSIX-like systems
'''
if salt.utils.is_windows() or not salt.utils.which('shutdown'):
return False
return True
def halt():... | apache-2.0 | Python |
60e33e265b6b13d87031ef3d9e191e42c311e537 | add stub of filepath2url function | gdhungana/desispec,timahutchinson/desispec,desihub/desispec,profxj/desispec,timahutchinson/desispec,gdhungana/desispec,desihub/desispec,profxj/desispec | py/desispec/io/download.py | py/desispec/io/download.py | """
desispec.io.download
====================
Download files from DESI repository.
"""
from __future__ import absolute_import, division, print_function
from os import environ, makedirs, stat, utime
from os.path import dirname, exists, join
from calendar import timegm
from datetime import datetime
from requests import ... | """
desispec.io.download
====================
Download files from DESI repository.
"""
from __future__ import absolute_import, division, print_function
from os import environ, makedirs, stat, utime
from os.path import dirname, exists, join
from calendar import timegm
from datetime import datetime
from requests import ... | bsd-3-clause | Python |
950ff48d6682451db1074cc0fb3ab054dd8495bb | make format | nschloe/meshio | test/test_tecplot.py | test/test_tecplot.py | import pathlib
from copy import deepcopy
import helpers
import numpy as np
import pytest
import meshio
@pytest.mark.parametrize(
"mesh",
[
helpers.tri_mesh,
helpers.quad_mesh,
# Those two tests suddenly started failing on gh-actions. No idea why.
# TODO reinstate
# he... | import pathlib
from copy import deepcopy
import helpers
import numpy as np
import pytest
import meshio
@pytest.mark.parametrize(
"mesh",
[
helpers.tri_mesh,
helpers.quad_mesh,
# Those two tests suddenly started failing on gh-actions. No idea why.
# TODO reinstate
# he... | mit | Python |
e1de7cec988fd40928cc8a8de688f3239fd65d06 | Complete tests for XZ class | SUSE/azurectl,SUSE/azurectl,SUSE/azurectl | test/unit/xz_test.py | test/unit/xz_test.py | from nose.tools import *
from mock import patch
import nose_helper
import mock
from azurectl.xz import XZ
from azurectl.azurectl_exceptions import *
class TestXZ:
def setup(self):
self.xz = XZ.open('../data/blob.xz')
def teardown(self):
self.xz.close()
def test_read(self):
asse... | from nose.tools import *
from mock import patch
import nose_helper
import mock
from azurectl.xz import XZ
from azurectl.azurectl_exceptions import *
class TestXZ:
def setup(self):
self.xz = XZ.open('../data/blob.xz')
def test_read(self):
assert self.xz.read(128) == 'foo'
def test_read_... | apache-2.0 | Python |
b4a4bf80420a62b40f55705f8f896f3e18ae3eeb | Bump version to 0.4.0. | pytest-dev/pytest-asyncio | pytest_asyncio/__init__.py | pytest_asyncio/__init__.py | __version__ = '0.4.0'
| __version__ = '0.3.0'
| apache-2.0 | Python |
3a8663e947a640fb0c0fec170f329ccf014523fa | Remove unused import | torotil/flask-fillin,jarus/flask-fillin,jarus/flask-fillin,torotil/flask-fillin | test_app/__init__.py | test_app/__init__.py | # -*- coding: utf-8 -*-
"""
flask-fillin-test-app
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by Christoph Heer.
:license: BSD, see LICENSE for more details.
"""
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/login-form", methods=["GET", "POST"])
def login_form():... | # -*- coding: utf-8 -*-
"""
flask-fillin-test-app
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by Christoph Heer.
:license: BSD, see LICENSE for more details.
"""
from flask import Flask, render_template, request, flash
app = Flask(__name__)
@app.route("/login-form", methods=["GET", "POST"])
def login_... | bsd-3-clause | Python |
323e982b3be826479131210ddbbd25f01a67f31f | Add additional tests | jwarren116/network-tools,jwarren116/network-tools | test_http2_server.py | test_http2_server.py | from echo_client import client
def test_ok():
response = client('GET a_web_page.html HTTP/1.1').split('\r\n')
first_line = response[0]
assert first_line == 'HTTP/1.1 200 OK'
def test_body():
response = client('GET sample.txt HTTP/1.1').split('\r\n')
body = response[4]
assert 'This is a very ... | from echo_client import client
def test_ok():
response = client('GET a_web_page.html HTTP/1.1').split('\r\n')
first_line = response[0]
assert first_line == 'HTTP/1.1 200 OK'
def test_body():
response = client('GET sample.txt HTTP/1.1').split('\r\n')
body = response[4]
assert 'This is a very ... | mit | Python |
c60deebc730d68c81d4491f215b49eb5f43fb202 | Add Utilities as a loaded plugin for the tests in order to fix some test failures. | ProgVal/Limnoria-test,jeffmahoney/supybot,kblin/supybot-gsoc,mazaclub/mazabot-core,frumiousbandersnatch/supybot-code,raboof/supybot,Ban3/Limnoria,Ban3/Limnoria,prashantpawar/supybot-rothbot,mazaclub/mazabot-core,ProgVal/Limnoria-test,haxwithaxe/supybot,buildbot/supybot | plugins/Time/test.py | plugins/Time/test.py | ###
# Copyright (c) 2004, Jeremiah Fincher
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditi... | ###
# Copyright (c) 2004, Jeremiah Fincher
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditi... | bsd-3-clause | Python |
36f9faf31bf7002d95aaa43b1427367a3a781ffa | Use the HTMLParser module instead of htmllib | mineo/lala,mineo/lala | plugins/httptitle.py | plugins/httptitle.py | import plugin
import urllib2
import logging
import re
from httplib import HTTPException
import HTMLParser
class Plugin(plugin.baseplugin):
def __init__(self, bot):
self._regex = re.compile("(https?://.+)\s?")
self._ua = "Mozilla/5.0 (X11; Linux x86_64; rv:2.0b8) Gecko/20100101 Firefox/4.0b8"
... | import plugin
import urllib2
import logging
import re
from httplib import HTTPException
from htmllib import HTMLParser
class Plugin(plugin.baseplugin):
def __init__(self, bot):
self._regex = re.compile("(https?://.+)\s?")
self._ua = "Mozilla/5.0 (X11; Linux x86_64; rv:2.0b8) Gecko/20100101 Firefox... | mit | Python |
4ff1ea9afaebee17617dfb011de361963ff97c67 | modify to use table_out | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/output/profile.py | salt/output/profile.py |
import table_out
__virtualname__ = 'profile'
def __virtual__():
return True
def _find_durations(data, name_max=60):
ret = []
ml = len('duration (ms)')
for host in data:
for sid in data[host]:
dat = data[host][sid]
ts = sid.split('_|-')
mod = ts[0]
... |
__virtualname__ = 'profile'
tabulate = None
def __virtual__():
try:
global tabulate
from tabulate import tabulate
return True
except:
return False
def _find_durations(data, name_max=60):
ret = []
for host in data:
for sid in data[host]:
dat = data[... | apache-2.0 | Python |
72403808c64ac7dd3123cf56b7e460a470c7d3f1 | Add -v output to ldml_tests.py | silnrsi/sldr,silnrsi/sldr,silnrsi/sldr,silnrsi/sldr | python/tests/ldml_tests.py | python/tests/ldml_tests.py | #!/usr/bin/python
import unittest, sys, os
from StringIO import StringIO
try:
from sldr.ldml import Ldml
except ImportError:
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'lib')))
from sldr.ldml import Ldml
class LDMLTests(unittest.TestCase):
def _init_exemplar_test(... | #!/usr/bin/python
import unittest, sys, os
from StringIO import StringIO
try:
from sldr.ldml import Ldml
except ImportError:
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'lib')))
from sldr.ldml import Ldml
class LDMLTests(unittest.TestCase):
def _init_exemplar_test(... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.