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 |
|---|---|---|---|---|---|---|---|---|
e8e7d188b45b06967a6f7ec210f91b1bbe4e494c | use pathlib | abilian/abilian-core,abilian/abilian-core,abilian/abilian-core,abilian/abilian-core,abilian/abilian-core | abilian/web/admin/panels/sysinfo.py | abilian/web/admin/panels/sysinfo.py | # coding=utf-8
"""
"""
from __future__ import absolute_import, print_function, division
import os
import sys
import pkg_resources
from pip.vcs import vcs
from pathlib import Path
from flask import render_template
from ..panel import AdminPanel
class SysinfoPanel(AdminPanel):
id = 'sysinfo'
label = 'System info... | # coding=utf-8
"""
"""
from __future__ import absolute_import, print_function, division
import os
import sys
import pkg_resources
from pip.vcs import vcs
from flask import render_template
from ..panel import AdminPanel
class SysinfoPanel(AdminPanel):
id = 'sysinfo'
label = 'System information'
icon = 'hdd'
... | lgpl-2.1 | Python |
cb89d8f0dd5fad8b5fc935639fc59a7317679001 | Update master.chromium.webkit to use a dedicated mac builder. | eunchong/build,eunchong/build,eunchong/build,eunchong/build | masters/master.chromium.webkit/master_mac_latest_cfg.py | masters/master.chromium.webkit/master_mac_latest_cfg.py | # Copyright (c) 2012 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.
from master import master_config
from master.factory import chromium_factory
defaults = {}
helper = master_config.Helper(defaults)
B = helper.Builder
F... | # Copyright (c) 2012 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.
from master import master_config
from master.factory import chromium_factory
defaults = {}
helper = master_config.Helper(defaults)
B = helper.Builder
F... | bsd-3-clause | Python |
b195e909ce3d3903998a91de0b5763dd679b25e3 | fix version | opencollab/debile,tcc-unb-fga/debile,lucaskanashiro/debile,opencollab/debile,mdimjasevic/debile,tcc-unb-fga/debile,mdimjasevic/debile,lucaskanashiro/debile | debile/slave/runners/findbugs.py | debile/slave/runners/findbugs.py | # Copyright (c) 2012-2013 Paul Tagliamonte <paultag@debian.org>
# Copyright (c) 2013 Leo Cavaille <leo@cavaille.net>
# Copyright (c) 2013 Sylvestre Ledru <sylvestre@debian.org>
# Copyright (c) 2015 Lucas Kanashiro <kanashiro.duarte@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
#... | # Copyright (c) 2012-2013 Paul Tagliamonte <paultag@debian.org>
# Copyright (c) 2013 Leo Cavaille <leo@cavaille.net>
# 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 "So... | mit | Python |
2d3e2f796d6a839994c2708f31e60d52c6bf8c15 | Simplify main() | Necior/sjp.pl | sjp.py | sjp.py | #!/usr/bin/env python3
import urllib.request # to download HTML source
import sys # to access CLI arguments and to use exit codes
from bs4 import BeautifulSoup # to parse HTML source
version = 0.01
def printUsageInfo():
helpMsg = """Usage:
sjp.py <word>
sjp.py (-h | --help | /?)
sjp.py (-v | --ve... | #!/usr/bin/env python3
import urllib.request # to download HTML source
import sys # to access CLI arguments and to use exit codes
from bs4 import BeautifulSoup # to parse HTML source
version = 0.01
def printUsageInfo():
helpMsg = """Usage:
sjp.py <word>
sjp.py (-h | --help | /?)
sjp.py (-v | --ve... | mit | Python |
a78d1bcfdc3d979cd7be1f82345c29047993953d | Add more init logic to handle AWS HTTP API | MA3STR0/AsyncAWS | sqs.py | sqs.py | #!/usr/bin/env python
from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPClient
from tornado.httputil import url_concat
import datetime
import hashlib
import hmac
class SQSRequest(HTTPRequest):
"""SQS AWS Adapter for Tornado HTTP request"""
def __init__(self, *args, **kwargs):
t = datet... | #!/usr/bin/env python
from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPClient
from tornado.httputil import url_concat
import datetime
import hashlib
import hmac
class SQSRequest(HTTPRequest):
"""SQS AWS Adapter for Tornado HTTP request"""
def __init__(self, *args, **kwargs):
t = datet... | mit | Python |
2166f52ce5da81bf8f28a3dbbc92145b0913db07 | Update usage of layouts.get_layout | drufat/vispy,ghisvail/vispy,michaelaye/vispy,ghisvail/vispy,drufat/vispy,ghisvail/vispy,michaelaye/vispy,drufat/vispy,Eric89GXL/vispy,Eric89GXL/vispy,Eric89GXL/vispy,michaelaye/vispy | examples/basics/visuals/graph.py | examples/basics/visuals/graph.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
This example demonstrates how to visualise a NetworkX graph using the
GraphVisual.
"""
import sys
import numpy as np
import networkx as nx
from vi... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
This example demonstrates how to visualise a NetworkX graph using the
GraphVisual.
"""
import sys
import networkx as nx
from vispy import app, glo... | bsd-3-clause | Python |
e43aa23b3d4b7d3319e4b2766cdb4a9b9382954b | Fix typo | mariocesar/django-tricks | django_tricks/models/abstract.py | django_tricks/models/abstract.py | from uuid import uuid4
from django.db import models
from .mixins import MPAwareModel
treebeard = True
try:
from treebeard.mp_tree import MP_Node
except ImportError:
treebeard = False
class UniqueTokenModel(models.Model):
token = models.CharField(max_length=32, unique=True, blank=True)
class Meta:... | from uuid import uuid4
from django.db import models
from .mixins import MPAwareModel
treebeard = True
try:
from treebeard.mp_tree import MP_Node
except ImportError:
treebeard = False
class UniqueTokenModel(models.Model):
token = models.CharField(max_length=32, unique=True, blank=True)
class Meta:... | isc | Python |
0a70a700f450c3c22ee0e7a32ffb57c29b823fe1 | Exclude test/assembly on Windows | old8xp/gyp_from_google,old8xp/gyp_from_google,old8xp/gyp_from_google,old8xp/gyp_from_google,old8xp/gyp_from_google | test/assembly/gyptest-assembly.py | test/assembly/gyptest-assembly.py | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A basic test of compiling assembler files.
"""
import sys
import TestGyp
if sys.platform != 'win32':
# TODO(bradnelson): get this wo... | #!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that .hpp files are ignored when included in the source list on all
platforms.
"""
import sys
import TestGyp
# TODO(bradnelso... | bsd-3-clause | Python |
86c45216633a3a273d04a64bc54ca1026b3d5069 | Fix comment middleware | lpomfrey/django-debreach,lpomfrey/django-debreach | debreach/middleware.py | debreach/middleware.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import base64
import logging
import random
from Crypto.Cipher import AES
from django.core.exceptions import SuspiciousOperation
from debreach.compat import \
force_bytes, get_random_string, string_types, force_text
log = logging.getLogger(__name__... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import base64
import logging
import random
from Crypto.Cipher import AES
from django.core.exceptions import SuspiciousOperation
from debreach.compat import \
force_bytes, get_random_string, string_types, force_text
log = logging.getLogger(__name__... | bsd-2-clause | Python |
1e7bbd7b59abbe0bcb01fd98079a362f4f874d3b | Fix long waiting version number up | sergey-dryabzhinsky/dedupsqlfs,sergey-dryabzhinsky/dedupsqlfs,sergey-dryabzhinsky/dedupsqlfs,sergey-dryabzhinsky/dedupsqlfs | dedupsqlfs/__init__.py | dedupsqlfs/__init__.py | # -*- coding: utf8 -*-
# Documentation. {{{1
"""
This Python library implements a file system in user space using FUSE. It's
called DedupFS because the file system's primary feature is deduplication,
which enables it to store virtually unlimited copies of files because data
is only stored once.
In addition to dedupli... | # -*- coding: utf8 -*-
# Documentation. {{{1
"""
This Python library implements a file system in user space using FUSE. It's
called DedupFS because the file system's primary feature is deduplication,
which enables it to store virtually unlimited copies of files because data
is only stored once.
In addition to dedupli... | mit | Python |
dd7b10a89e3fd5e431b03e922fbbc0a49c3d8c5e | Fix failing wavelet example due to outdated code | kohr-h/odl,aringh/odl,aringh/odl,kohr-h/odl,odlgroup/odl,odlgroup/odl | examples/trafos/wavelet_trafo.py | examples/trafos/wavelet_trafo.py | # Copyright 2014-2016 The ODL development group
#
# This file is part of ODL.
#
# ODL 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 3 of the License, or
# (at your option) any later version.
#... | # Copyright 2014-2016 The ODL development group
#
# This file is part of ODL.
#
# ODL 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 3 of the License, or
# (at your option) any later version.
#... | mpl-2.0 | Python |
0d38b9592fbb63e25b080d2f17b690c478042455 | Add comments to Perfect Game solution | robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles | google-code-jam-2012/perfect-game/perfect-game.py | google-code-jam-2012/perfect-game/perfect-game.py | #!/usr/bin/env python
# expected time per attempt is given by equation
# time = L[0] + (1-P[0])*L[1] + (1-P[0])*(1-P[1])*L[2] + ...
# where L is the expected time and P is the probability of failure, per level
# swap two levels if L[i]*P[i+1] > L[i+1]*P[i]
import sys
if len(sys.argv) < 2:
sys.exit('Usage: %s file.... | #!/usr/bin/env python
import sys
if len(sys.argv) < 2:
sys.exit('Usage: %s file.in' % sys.argv[0])
file = open(sys.argv[1], 'r')
T = int(file.readline())
for i in xrange(1, T+1):
N = int(file.readline())
L = map(int, file.readline().split(' '))
P = map(int, file.readline().split(' '))
assert N == len(L)... | mit | Python |
9f9e2db5105eab1f46590a6b8d6a5b5eff4ccb51 | Use new BinarySensorDeviceClass enum in egardia (#61378) | nkgilley/home-assistant,nkgilley/home-assistant,rohitranjan1991/home-assistant,home-assistant/home-assistant,rohitranjan1991/home-assistant,GenericStudent/home-assistant,GenericStudent/home-assistant,toddeye/home-assistant,w1ll1am23/home-assistant,w1ll1am23/home-assistant,toddeye/home-assistant,mezz64/home-assistant,ro... | homeassistant/components/egardia/binary_sensor.py | homeassistant/components/egardia/binary_sensor.py | """Interfaces with Egardia/Woonveilig alarm control panel."""
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.const import STATE_OFF, STATE_ON
from . import ATTR_DISCOVER_DEVICES, EGARDIA_DEVICE
EGARDIA_TYPE_TO_DEVICE_CLASS = {
"IR Sen... | """Interfaces with Egardia/Woonveilig alarm control panel."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOTION,
DEVICE_CLASS_OPENING,
BinarySensorEntity,
)
from homeassistant.const import STATE_OFF, STATE_ON
from . import ATTR_DISCOVER_DEVICES, EGARDIA_DEVICE
EGARDIA_TYPE_TO_DEVICE... | apache-2.0 | Python |
ead5daf0e631a3482a8510abc36f48b227e862ee | Delete unused variable assignations. | AriMartti/ZhaltraucsLair | game.py | game.py | # -*- coding: utf-8 -*-
import functions.commands as command
import functions.database as db
f = open('ASCII/otsikko_unicode.asc', 'r')
print(f.read())
f.close()
while True:
'''
You can end loop by selecting 5 in main context or write
"quit" in game context.
'''
context = command.doMenu()
... | # -*- coding: utf-8 -*-
import functions.commands as command
import functions.database as db
prompt = ">>> "
view = {
'0.0' : "Tutorial. You see a rat attacking you, fight!",
'1.0' : "You stand in a start of dungeon. You see a torch."
}
position = '1.0'
f = open('ASCII/otsikko_unicode.asc', 'r')
print(f.rea... | mit | Python |
2d26d92956282be3f08cc3dcdb5fa16433822a1b | Change retry_if_fails to _retry_on_fail | Hamuko/nyaamagnet | Nyaa.py | Nyaa.py | from bs4 import BeautifulSoup
import re
import requests
import sys
def _retry_on_fail(req, *args, **kwargs):
try:
r = req(*args, **kwargs)
if r.status_code not in range(100, 399):
print('Connection error, retrying... (HTTP {})'.format(r.status_code), file=sys.stderr)
return _retry_on_fail(req, *args, **kwar... | from bs4 import BeautifulSoup
import re
import requests
import sys
def retry_if_fails(req, *args, **kwargs):
try:
r = req(*args, **kwargs)
if r.status_code not in range(100, 399):
print('Connection error, retrying... (HTTP {})'.format(r.status_code), file=sys.stderr)
return retry_if_fails(req, *args, **kwar... | mit | Python |
10ceb00e249635868fb55c1ae1668ddb35b03bc3 | Update demo | bameda/python-taiga,erikw/python-taiga,nephila/python-taiga,mlq/python-taiga,erikw/python-taiga,mlq/python-taiga,bameda/python-taiga | demo.py | demo.py | # -*- coding: utf-8 -*-
from taiga import TaigaAPI
from taiga.exceptions import TaigaException
api = TaigaAPI(
host='http://127.0.0.1:8000'
)
api.auth(
username='admin',
password='123123'
)
print (api.me())
new_project = api.projects.create('TEST PROJECT', 'TESTING API')
new_project.name = 'TEST PROJE... | # -*- coding: utf-8 -*-
from taiga import TaigaAPI
api = TaigaAPI(
host='http://127.0.0.1:8000'
)
api.auth(
username='admin',
password='123123'
)
print (api.me())
new_project = api.projects.create('TEST PROJECT', 'TESTING API')
new_project.name = 'TEST PROJECT 3'
new_project.update()
jan_feb_mileston... | mit | Python |
7692c4210289af68ad7952ddca89f70d250a26ed | Change base_directory location | great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations | great_expectations/data_context/datasource/pandas_source.py | great_expectations/data_context/datasource/pandas_source.py | import pandas as pd
import os
from .datasource import Datasource
from .filesystem_path_generator import FilesystemPathGenerator
from ...dataset.pandas_dataset import PandasDataset
class PandasCSVDatasource(Datasource):
"""
A PandasDataSource makes it easy to create, manage and validate expectations on
Pan... | import pandas as pd
import os
from .datasource import Datasource
from .filesystem_path_generator import FilesystemPathGenerator
from ...dataset.pandas_dataset import PandasDataset
class PandasCSVDatasource(Datasource):
"""
A PandasDataSource makes it easy to create, manage and validate expectations on
Pan... | apache-2.0 | Python |
b69289c62a5be3a523b4d32aec2b6d790dc95f0d | Add compare functions | abpolym/amit | amit.py | amit.py | import hashlib, ssdeep
def hash_ssdeep(inbytes):
return ssdeep.hash(inbytes)
def hash_md5(inbytes):
m = hashlib.md5()
m.update(inbytes)
return m.hexdigest()
def hash_sha1(inbytes):
m = hashlib.sha1()
m.update(inbytes)
return m.hexdigest()
def hash_sha256(inbytes):
m = hashlib.sha256()
m.update(inbytes)
re... | import hashlib, ssdeep
def hash_ssdeep(inbytes):
return ssdeep.hash(inbytes)
def hash_md5(inbytes):
m = hashlib.md5()
m.update(inbytes)
return m.hexdigest()
def hash_sha1(inbytes):
m = hashlib.sha1()
m.update(inbytes)
return m.hexdigest()
def hash_sha256(inbytes):
m = hashlib.sha256()
m.update(inbytes)
re... | mit | Python |
d5e41dfaff393a0649336ef92d7b7917a7e0122d | fix allowed_hosts settings bug | chenders/hours,chenders/hours,chenders/hours | hours/settings.py | hours/settings.py | # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# SECRET_KEY will be automatically generated an... | # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# SECRET_KEY will be automatically generated an... | mit | Python |
8c4590e19c7b39fe6562671f7d63651e736ffa49 | debug print | synth3tk/the-blue-alliance,tsteward/the-blue-alliance,nwalters512/the-blue-alliance,josephbisch/the-blue-alliance,fangeugene/the-blue-alliance,verycumbersome/the-blue-alliance,fangeugene/the-blue-alliance,tsteward/the-blue-alliance,bvisness/the-blue-alliance,verycumbersome/the-blue-alliance,tsteward/the-blue-alliance,p... | controllers/admin/admin_migration_controller.py | controllers/admin/admin_migration_controller.py | import os
from google.appengine.ext import ndb
from google.appengine.ext import deferred
from google.appengine.ext.webapp import template
from controllers.base_controller import LoggedInHandler
from models.event import Event
from helpers.match_manipulator import MatchManipulator
def add_year(event_key):
logging.inf... | import os
from google.appengine.ext import ndb
from google.appengine.ext import deferred
from google.appengine.ext.webapp import template
from controllers.base_controller import LoggedInHandler
from models.event import Event
from helpers.match_manipulator import MatchManipulator
def add_year(event_key):
matches = e... | mit | Python |
895dfda101665e0f70e96d549443f9fe777de1e7 | Add support for multiple urls per method, auto create method routers | shaunstanislaus/hug,janusnic/hug,timothycrosley/hug,yasoob/hug,timothycrosley/hug,MuhammadAlkarouri/hug,gbn972/hug,STANAPO/hug,gbn972/hug,jean/hug,alisaifee/hug,origingod/hug,janusnic/hug,MuhammadAlkarouri/hug,jean/hug,giserh/hug,STANAPO/hug,origingod/hug,philiptzou/hug,MuhammadAlkarouri/hug,shaunstanislaus/hug,philipt... | hug/decorators.py | hug/decorators.py | from functools import wraps, partial
from collections import OrderedDict
import sys
from hug.run import server
import hug.output_format
from falcon import HTTP_METHODS, HTTP_BAD_REQUEST
def call(urls, accept=HTTP_METHODS, output=hug.output_format.json, example=None):
if isinstance(urls, str):
urls = (url... | from functools import wraps
from collections import OrderedDict
import sys
from hug.run import server
import hug.output_format
from falcon import HTTP_METHODS, HTTP_BAD_REQUEST
def call(url, accept=HTTP_METHODS, output=hug.output_format.json):
def decorator(api_function):
module = sys.modules[api_functio... | mit | Python |
66dd418d481bfc5d3d910823856bdcea8d304a87 | allow to pass a different root-path | hwaf/hwaf,hwaf/hwaf | hwaf-cmtcompat.py | hwaf-cmtcompat.py | # -*- python -*-
# stdlib imports
import os
import os.path as osp
import sys
# waf imports ---
import waflib.Options
import waflib.Utils
import waflib.Logs as msg
from waflib.Configure import conf
_heptooldir = osp.dirname(osp.abspath(__file__))
# add this directory to sys.path to ease the loading of other hepwaf to... | # -*- python -*-
# stdlib imports
import os
import os.path as osp
import sys
# waf imports ---
import waflib.Options
import waflib.Utils
import waflib.Logs as msg
from waflib.Configure import conf
_heptooldir = osp.dirname(osp.abspath(__file__))
# add this directory to sys.path to ease the loading of other hepwaf to... | bsd-3-clause | Python |
70ea214d8e258e4e7c95b9ba7948dde13e28a878 | Make screengrab_torture_test test more functions | ludios/Desktopmagic | desktopmagic/scripts/screengrab_torture_test.py | desktopmagic/scripts/screengrab_torture_test.py | from desktopmagic.screengrab_win32 import GrabFailed, getScreenAsImage, getDisplaysAsImages, getRectAsImage
def main():
print """\
This program helps you test whether screengrab_win32 has memory leaks
and other problems. It takes a screenshot repeatedly and discards it.
Open Task Manager and make sure Physical Memo... | from desktopmagic.screengrab_win32 import GrabFailed, getScreenAsImage
def main():
print """\
This program helps you test whether screengrab_win32 has memory leaks
and other problems. It takes a screenshot repeatedly and discards it.
Open Task Manager and make sure Physical Memory % is not ballooning.
Memory leaks ... | mit | Python |
9d1dc9c2c649bd117c2cd38cf664e34820f387ea | update docstring in fwhm.py | bennomeier/pyNMR,kourk0am/pyNMR | fwhm.py | fwhm.py | import numpy as np
def fwhm(x,y, silence = False):
maxVal = np.max(y)
maxVal50 = 0.5*maxVal
if not silence:
print "Max: " + str(maxVal)
#this is to detect if there are multiple values
biggerCondition = [a > maxVal50 for a in y]
changePoints = []
freqPoints = []
for k in ... | import numpy as np
def fwhm(x,y, silence = False):
maxVal = np.max(y)
maxVal50 = 0.5*maxVal
if not silence:
print "Max: " + str(maxVal)
#this is to detect if there are multiple values
biggerCondition = [a > maxVal50 for a in y]
changePoints = []
freqPoints = []
for k in ... | mit | Python |
161a1cdddd79df7126d6adf1117d51e679d1746c | Change --command option in "docker" to a positional argument | mnieber/dodo_commands | dodo_commands/extra/standard_commands/docker.py | dodo_commands/extra/standard_commands/docker.py | """This command opens a bash shell in the docker container."""
from . import DodoCommand
class Command(DodoCommand): # noqa
decorators = ["docker", ]
def add_arguments_imp(self, parser): # noqa
parser.add_argument('command', nargs='?')
def handle_imp(self, command, **kwargs): # noqa
... | """This command opens a bash shell in the docker container."""
from . import DodoCommand
class Command(DodoCommand): # noqa
decorators = ["docker", ]
def add_arguments_imp(self, parser): # noqa
parser.add_argument('--command', default="")
def handle_imp(self, command, **kwargs): # noqa
... | mit | Python |
36063d227f7cd3ededdc99b23b0c7911f2233df2 | Add available params in metering labels client's comment | cisco-openstack/tempest,Tesora/tesora-tempest,Juniper/tempest,vedujoshi/tempest,sebrandon1/tempest,masayukig/tempest,sebrandon1/tempest,Tesora/tesora-tempest,masayukig/tempest,cisco-openstack/tempest,Juniper/tempest,openstack/tempest,vedujoshi/tempest,openstack/tempest | tempest/lib/services/network/metering_labels_client.py | tempest/lib/services/network/metering_labels_client.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | apache-2.0 | Python |
93870690f17a4baddeb33549a1f6c67eeee1abe0 | Increase cache tile duration from 6 hours to 1 week | alkadis/vcv,DanielNeugebauer/adhocracy,alkadis/vcv,phihag/adhocracy,DanielNeugebauer/adhocracy,phihag/adhocracy,alkadis/vcv,DanielNeugebauer/adhocracy,DanielNeugebauer/adhocracy,DanielNeugebauer/adhocracy,phihag/adhocracy,liqd/adhocracy,phihag/adhocracy,liqd/adhocracy,liqd/adhocracy,liqd/adhocracy,alkadis/vcv,alkadis/v... | src/adhocracy/lib/tiles/util.py | src/adhocracy/lib/tiles/util.py | import logging
from time import time
from pylons import tmpl_context as c
from adhocracy import config
from adhocracy.lib.cache import memoize
log = logging.getLogger(__name__)
class BaseTile(object):
'''
Base class for tiles
'''
def render_tile(template_name, def_name, tile, cached=False, **kwargs):... | import logging
from time import time
from pylons import tmpl_context as c
from adhocracy import config
from adhocracy.lib.cache import memoize
log = logging.getLogger(__name__)
class BaseTile(object):
'''
Base class for tiles
'''
def render_tile(template_name, def_name, tile, cached=False, **kwargs):... | agpl-3.0 | Python |
d5691c8031a32e0cfadc74e9fffad8a9e04bc63c | enable search navbar entry in production | MidAtlanticPortal/marco-portal2,MidAtlanticPortal/marco-portal2,MidAtlanticPortal/marco-portal2,Ecotrust/marineplanner-core,Ecotrust/marineplanner-core,Ecotrust/marineplanner-core,Ecotrust/marineplanner-core,MidAtlanticPortal/marco-portal2,Ecotrust/marineplanner-core | portal/base/context_processors.py | portal/base/context_processors.py | from django.conf import settings
def search_disabled(request):
"""Facility for disabling search functionality.
This may be used in the future to automatically disable search if the search
backend goes down.
"""
return dict(SEARCH_DISABLED=False)
# return dict(SEARCH_DISABLED=not settings.DEBUG... | from django.conf import settings
def search_disabled(request):
"""Facility for disabling search functionality.
This may be used in the future to automatically disable search if the search
backend goes down.
"""
return dict(SEARCH_DISABLED=not settings.DEBUG)
| isc | Python |
87b9910a30cb915f5b99a17b0b49570b0027e665 | load help module | shortdudey123/gbot | gbot.py | gbot.py | #!/usr/bin/env python
# =============================================================================
# file = gbot.py
# description = IRC bot
# author = GR <https://github.com/shortdudey123>
# create_date = 2014-07-09
# mod_date = 2014-07-09
# version = 0.1
# usage = called as a class
# notes =
# python_ver = 2.7.6
# ... | #!/usr/bin/env python
# =============================================================================
# file = gbot.py
# description = IRC bot
# author = GR <https://github.com/shortdudey123>
# create_date = 2014-07-09
# mod_date = 2014-07-09
# version = 0.1
# usage = called as a class
# notes =
# python_ver = 2.7.6
# ... | apache-2.0 | Python |
9f5afd72bf6dbb44ba764f6731c6313f0cb94bce | Use default outputs in shortcuts/utils.py | jonathanslenders/python-prompt-toolkit | prompt_toolkit/shortcuts/utils.py | prompt_toolkit/shortcuts/utils.py | from __future__ import unicode_literals
from prompt_toolkit.output.defaults import get_default_output
from prompt_toolkit.renderer import print_formatted_text as renderer_print_formatted_text
from prompt_toolkit.styles import default_style, BaseStyle
import six
__all__ = (
'print_formatted_text',
'clear',
... | from __future__ import unicode_literals
from prompt_toolkit.output.defaults import create_output
from prompt_toolkit.renderer import print_formatted_text as renderer_print_formatted_text
from prompt_toolkit.styles import default_style, BaseStyle
import six
__all__ = (
'print_formatted_text',
'clear',
'set_... | bsd-3-clause | Python |
2c350cbbd90afaab38223fdfe40737f72bf7974a | Set --device-type as required arg for harvest_tracking_email command. | ropable/resource_tracking,ropable/resource_tracking,ropable/resource_tracking | tracking/management/commands/harvest_tracking_email.py | tracking/management/commands/harvest_tracking_email.py | from django.core.management.base import BaseCommand
from tracking.harvest import harvest_tracking_email
class Command(BaseCommand):
help = "Runs harvest_tracking_email to harvest points from emails"
def add_arguments(self, parser):
parser.add_argument(
'--device-type', action='store', des... | from django.core.management.base import BaseCommand
from tracking.harvest import harvest_tracking_email
class Command(BaseCommand):
help = "Runs harvest_tracking_email to harvest points from emails"
def add_arguments(self, parser):
parser.add_argument(
'--device-type', action='store', des... | bsd-3-clause | Python |
4d247da1ecd39bcd699a55b5387412a1ac9e1582 | Split Energy and Environment, change Civil Liberties to Social Justice | texastribune/txlege84,texastribune/txlege84,texastribune/txlege84,texastribune/txlege84 | txlege84/topics/management/commands/bootstraptopics.py | txlege84/topics/management/commands/bootstraptopics.py | from django.core.management.base import BaseCommand
from topics.models import Topic
class Command(BaseCommand):
help = u'Bootstrap the topic lists in the database.'
def handle(self, *args, **kwargs):
self.load_topics()
def load_topics(self):
self.stdout.write(u'Loading hot list topics..... | from django.core.management.base import BaseCommand
from topics.models import Topic
class Command(BaseCommand):
help = u'Bootstrap the topic lists in the database.'
def handle(self, *args, **kwargs):
self.load_topics()
def load_topics(self):
self.stdout.write(u'Loading hot list topics..... | mit | Python |
2bf756404700f4c38e2f3895dfa8aba2d8dc13be | Refactor and remove char2int | jonathanstallings/data-structures | hash.py | hash.py |
class HashTable(object):
"""docstring for HashTable"""
table_size = 0
entries_count = 0
alphabet_size = 52
def __init__(self, size=1024):
self.table_size = size
self.hashtable = [[] for i in range(size)]
def __repr__(self):
return "<HashTable: {}>".format(self.hashtab... |
class HashTable(object):
"""docstring for HashTable"""
table_size = 0
entries_count = 0
alphabet_size = 52
def __init__(self, size=1024):
self.table_size = size
self.hashtable = [[] for i in range(size)]
def __repr__(self):
return "<HashTable: {}>".format(self.hashtab... | mit | Python |
3039149ca20e9c472340495e4130e331d9c546b3 | Fix nums assignment properly | prmcadam/calc | calc.py | calc.py | import sys
def add_all(nums):
return sum(nums)
def multiply_all(nums):
return reduce(lambda a, b: a*b, nums)
if __name__ == '__main__':
command =sys.argv[1]
nums=map(float, sys.argv[2:])
if command=='add':
print add_all(nums)
if command=='multiply':
print multiply_all(nums)
| import sys
def add_all(nums):
return sum(nums)
def multiply_all(nums):
return reduce(lambda a, b: a*b, nums)
if __name__ == '__main__':
command =sys.argv[1]
nums=map(float(sys.argv[2:]))
if command=='add':
print add_all(nums)
if command=='multiply':
print multiply_all(nums)
| bsd-3-clause | Python |
fd8caec8567178abe09abc810f1e96bfc4bb531b | Fix bug in 'multiply' support | tanecious/calc | calc.py | calc.py | import sys
def add_all(nums):
return sum(nums)
def multiply_all(nums):
return reduce(lambda a, b: a * b, nums)
if __name__== '__main__':
command = sys.argv[1]
nums = map(float, sys.argv[2:])
if command == 'add':
print(add_all(nums))
elif command == 'multiply':
print(multiply_all(nums))
| import sys
def add_all(nums):
return sum(nums)
def multiply_all(nums):
return reduce(lambda a, b: a * b, nums)
if __name__== '__main__':
command = sys.argv[1]
nums = map(float, sys.argv[2:])
if command == 'add':
print(add_all(nums))
elif command == 'multiply':
print(multiply_all(sums))
| bsd-3-clause | Python |
183448b17cfd910444d3807da80ef8549622fce4 | test the urltopath | arwineap/yumoter | init.py | init.py | import yumoter
yumoter = yumoter.yumoter('config/repos.json', '/home/aarwine/git/yumoter/repos')
yumoter.loadRepos("6.4", "wildwest")
a = yumoter._returnNewestByNameArch(["openssl"])
a = a[0]
print a
print "name", a.name
print "arch", a.arch
print "epoch", a.epoch
print "version", a.version
print "release", a.release... | import yumoter
yumoter = yumoter.yumoter('config/repos.json', '/home/aarwine/git/yumoter/repos')
yumoter.loadRepos("6.4", "wildwest")
a = yumoter._returnNewestByNameArch(["openssl"])
a = a[0]
print a
print "name", a.name
print "arch", a.arch
print "epoch", a.epoch
print "version", a.version
print "release", a.release... | mit | Python |
27543f73244c7312ea511c7e00d9eecf7b7525e9 | store model in self.model | kastnerkyle/pylearn2,hyqneuron/pylearn2-maxsom,JesseLivezey/plankton,fulmicoton/pylearn2,theoryno3/pylearn2,kastnerkyle/pylearn2,mclaughlin6464/pylearn2,lancezlin/pylearn2,jeremyfix/pylearn2,kastnerkyle/pylearn2,jeremyfix/pylearn2,alexjc/pylearn2,KennethPierce/pylearnk,caidongyun/pylearn2,junbochen/pylearn2,abergeron/p... | cost.py | cost.py | """
Cost classes: classes that encapsulate the cost evaluation for the DAE
training criterion.
"""
# Standard library imports
from itertools import izip
# Third-party imports
from theano import tensor
class SupervisedCost(object):
"""
A cost object is allocated in the same fashion as other
objects in this... | """
Cost classes: classes that encapsulate the cost evaluation for the DAE
training criterion.
"""
# Standard library imports
from itertools import izip
# Third-party imports
from theano import tensor
class SupervisedCost(object):
"""
A cost object is allocated in the same fashion as other
objects in this... | bsd-3-clause | Python |
a04b18b8fbc8626b5592593a2b6ce635921a1e34 | Delete text after entered, but this time actually do it | AndrewKLeech/Pip-Boy | data.py | data.py | from twitter import *
from tkinter import *
def showTweets(x, num):
# display a number of new tweets and usernames
for i in range(0, num):
line1 = (x[i]['user']['screen_name'])
line2 = (x[i]['text'])
w = Label(master, text=line1 + "\n" + line2 + "\n\n")
w.pack()
def getTweets(... | from twitter import *
from tkinter import *
def showTweets(x, num):
# display a number of new tweets and usernames
for i in range(0, num):
line1 = (x[i]['user']['screen_name'])
line2 = (x[i]['text'])
w = Label(master, text=line1 + "\n" + line2 + "\n\n")
w.pack()
def getTweets(... | mit | Python |
5c5de666e86d6f2627df79762b0e3b0f188861d4 | Fix timestamp comparison on ciresources | CiscoSystems/project-config-third-party,CiscoSystems/project-config-third-party | scripts/claim_vlan.py | scripts/claim_vlan.py | import MySQLdb
from datetime import datetime, timedelta
db = MySQLdb.connect(host="10.0.196.2",
user="ciuser",
passwd="secret",
db="ciresources")
cur = db.cursor()
f = '%Y-%m-%d %H:%M:%S'
three_hours_ago_dt = datetime.utcnow() - timedelta(hours=3)
three_... | import MySQLdb
from datetime import datetime, timedelta
db = MySQLdb.connect(host="10.0.196.2",
user="ciuser",
passwd="secret",
db="ciresources")
cur = db.cursor()
f = '%Y-%m-%d %H:%M:%S'
three_hours_ago_dt = datetime.utcnow() - timedelta(hours=3)
three_... | apache-2.0 | Python |
efc3a2c31a00a2139f55ca5ce9f3cf4dac1dea1f | address comments | google/jax,google/jax,google/jax,google/jax,tensorflow/probability,tensorflow/probability | tests/debug_nans_test.py | tests/debug_nans_test.py | # Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
eee6dd8f6d7555f97452fb5734e299203b337ace | Fix fast_classifier | pombredanne/milk,luispedro/milk,pombredanne/milk,pombredanne/milk,luispedro/milk,luispedro/milk | tests/fast_classifier.py | tests/fast_classifier.py | import numpy as np
class fast_classifier(object):
def __init__(self):
pass
def train(self, features, labels):
examples = {}
for f,lab in zip(features, labels):
if lab not in examples:
examples[lab] = f
return fast_model(examples)
class fast_model(obj... | import numpy as np
class fast_classifier(object):
def __init__(self):
pass
def train(self, features, labels):
examples = {}
for f,lab in zip(features, labels):
if lab not in examples:
examples[lab] = f
return fast_model(examples)
class fast_model(obj... | mit | Python |
83a15b47ecac219c2fe4ca1e49cfa9055f9197d2 | Add some tests | aes/unleash-client-python,aes/unleash-client-python | tests/test_features.py | tests/test_features.py | from unittest import mock, TestCase
from unleash_client import features
class TestFactory(TestCase):
def test_simple_case(self):
strategies = {'Foo': mock.Mock(return_value='R')}
feature = {'strategies': [{'name': 'Foo', 'parameters': {'x': 0}}]}
result = features.feature_gates(strategie... | apache-2.0 | Python | |
2b8b32605c9d211154f47d228038464ff5df7b56 | fix import | opalmer/pywincffi,opalmer/pywincffi,opalmer/pywincffi,opalmer/pywincffi | tests/test_kernel32.py | tests/test_kernel32.py | import os
from pywincffi.core.ffi import ffi
from pywincffi.core.testutil import TestCase
from pywincffi.exceptions import WindowsAPIError
from pywincffi.kernel32.process import (
PROCESS_QUERY_LIMITED_INFORMATION, OpenProcess)
class TestOpenProcess(TestCase):
"""
Tests for :func:`pywincffi.kernel32.Open... | import os
from pywincffi.core.ffi import ffi
from pywincffi.core.testutil import TestCase
from pywincffi.exceptions import WindowsAPIError
from pywincffi.kernel32 import PROCESS_QUERY_LIMITED_INFORMATION, OpenProcess
class TestOpenProcess(TestCase):
"""
Tests for :func:`pywincffi.kernel32.OpenProcess`
""... | mit | Python |
224abc99becc1683605a6dc5c3460510efef3efb | Comment out the pyserial TestIsCorrectVariant test. | Jnesselr/s3g,makerbot/s3g,Jnesselr/s3g,makerbot/s3g,makerbot/s3g,makerbot/s3g | tests/test_pyserial.py | tests/test_pyserial.py | from __future__ import (absolute_import, print_function, unicode_literals)
import os
import sys
lib_path = os.path.abspath('../')
sys.path.append(lib_path)
import io
import struct
import unittest
import threading
import time
import serial
try:
import unittest2 as unittest
except ImportError:
import unittest
... | from __future__ import (absolute_import, print_function, unicode_literals)
import os
import sys
lib_path = os.path.abspath('../')
sys.path.append(lib_path)
import io
import struct
import unittest
import threading
import time
import serial
try:
import unittest2 as unittest
except ImportError:
import unittest
... | agpl-3.0 | Python |
bb89223a7fcc1f2562c55ca432a3c52eec6efd8a | Put everything in one method like we discussed. | erykoff/redmapper,erykoff/redmapper | tests/test_background.py | tests/test_background.py | import unittest
import numpy.testing as testing
import numpy as np
import fitsio
from redmapper.background import Background
class BackgroundTestCase(unittest.TestCase):
def runTest(self):
file_name, file_path = 'test_bkg.fit', 'data'
# test that we fail if we try a non-existent file
self... | import unittest
import numpy.testing as testing
import numpy as np
import fitsio
import redmapper
class BackgroundTestCase(unittest.TestCase):
def test_io(self): pass
def test_sigma_g(self):
inputs = [()]
idl_outputs = [0.32197464, 6.4165196, 0.0032830855, 1.4605126,
... | apache-2.0 | Python |
80c1275899045bfd50efa9b436ada7672c09e783 | use md5 password hasher to speed up the tests | byteweaver/django-polls,byteweaver/django-polls | tests/test_settings.py | tests/test_settings.py | SECRET_KEY = 'fake-key'
INSTALLED_APPS = [
'tests',
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.MD5PasswordHasher',
)
| SECRET_KEY = 'fake-key'
INSTALLED_APPS = [
'tests',
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
| bsd-3-clause | Python |
0d825461c5c28ce451092783937fe95171c243bd | Add full deprecated test | wind-python/windpowerlib | tests/test_deprecated.py | tests/test_deprecated.py | """
SPDX-FileCopyrightText: 2019 oemof developer group <contact@oemof.org>
SPDX-License-Identifier: MIT
"""
import warnings
import pytest
from windpowerlib.data import load_turbine_data_from_oedb
from windpowerlib.wind_turbine import get_turbine_types
def test_old_import():
msg = "Use >>from windpowerlib impor... | """
SPDX-FileCopyrightText: 2019 oemof developer group <contact@oemof.org>
SPDX-License-Identifier: MIT
"""
import warnings
import pytest
from windpowerlib.data import load_turbine_data_from_oedb
from windpowerlib.wind_turbine import get_turbine_types
def test_old_import():
msg = "Use >>from windpowerlib impor... | mit | Python |
ca40822d7898d02272cdf0a52fa5a8b75b983930 | Fix syntax errors in addpost test | ollien/Timpani,ollien/Timpani,ollien/Timpani | tests/tests/addpost.py | tests/tests/addpost.py | import binascii
import os
import sqlalchemy
import selenium
from selenium.webdriver.common import keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
from timpani import database
LOGIN_TITLE = "Login - Timpa... | import binascii
import os
import sqlalchemy
import selenium
from selenium.webdriver.common import keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
from timpani import database
LOGIN_TITLE = "Login - Timpa... | mit | Python |
1be562eb115f302bd7fe47c2a90c5d4796a0eb98 | make slider example more sophisticated | rhiever/bokeh,ptitjano/bokeh,jakirkham/bokeh,dennisobrien/bokeh,DuCorey/bokeh,timsnyder/bokeh,tacaswell/bokeh,phobson/bokeh,aiguofer/bokeh,timsnyder/bokeh,srinathv/bokeh,rs2/bokeh,DuCorey/bokeh,tacaswell/bokeh,percyfal/bokeh,akloster/bokeh,phobson/bokeh,justacec/bokeh,ChinaQuants/bokeh,bokeh/bokeh,alan-unravel/bokeh,ca... | examples/plotting/file/slider.py | examples/plotting/file/slider.py |
from bokeh.io import vform
from bokeh.plotting import figure, hplot, output_file, show, vplot, ColumnDataSource
from bokeh.models.actions import Callback
from bokeh.models.widgets import Slider
import numpy as np
x = np.linspace(0, 10, 500)
y = np.sin(x)
source = ColumnDataSource(data=dict(x=x, y=y))
plot = figur... |
from bokeh.plotting import figure, output_file, show, vplot, ColumnDataSource
from bokeh.models.actions import Callback
from bokeh.models.widgets import Slider
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
source = ColumnDataSource(data=dict(x=x, y=y, y_orig=y))
plot = figure(y_range=(-20, 20))
plot... | bsd-3-clause | Python |
feb095effbe4cd92f253e7d5b68baf5b215056ef | Update views.py | dpgaspar/Flask-AppBuilder,qpxu007/Flask-AppBuilder,qpxu007/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,rpiotti/Flask-AppBuilder,rpiotti/Flask-AppBuilder,qpxu007/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,qpxu007/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,rpiotti/... | examples/quickhowto/app/views.py | examples/quickhowto/app/views.py | from flask.ext.appbuilder.menu import Menu
from flask.ext.appbuilder.baseapp import BaseApp
from flask.ext.appbuilder.models.datamodel import SQLAModel
from flask.ext.appbuilder.views import GeneralView
from flask.ext.appbuilder.charts.views import ChartView, TimeChartView
from app import app, db
from models import Gr... | from flask.ext.appbuilder.menu import Menu
from flask.ext.appbuilder.baseapp import BaseApp
from flask.ext.appbuilder.models.datamodel import SQLAModel
from flask.ext.appbuilder.views import GeneralView
from flask.ext.appbuilder.charts.views import ChartView, TimeChartView
from app import app, db
from models import Gr... | bsd-3-clause | Python |
08c29fcae3c622b0f47a0b73338b372ddcee42eb | support py2 | hugovk/twarc,edsu/twarc,DocNow/twarc,remagio/twarc,remagio/twarc | utils/search.py | utils/search.py | #!/usr/bin/env python
"""
Filter tweet JSON based on a regular expression to apply to the text of the
tweet.
search.py <regex> file1
Or if you want a case insensitive match:
search.py -i <regex> file1
"""
from __future__ import print_function
import re
import sys
import json
import argparse
import filei... | #!/usr/bin/env python
"""
Filter tweet JSON based on a regular expression to apply to the text of the
tweet.
search.py <regex> file1
Or if you want a case insensitive match:
search.py -i <regex> file1
"""
import re
import sys
import json
import argparse
import fileinput
from twarc import json2csv
if le... | mit | Python |
4dc1552bbbdbfb060eb4559c5cded6a5c8e8fd02 | Migrate kythe for Bazel 0.27 (#3769) | kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe | kythe/cxx/tools/fyi/testdata/compile_commands.bzl | kythe/cxx/tools/fyi/testdata/compile_commands.bzl | """Rule for generating compile_commands.json.in with appropriate inlcude directories."""
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
_TEMPLATE = """ {{
"directory": "OUT_DIR",
"command": "clang++ -c {filename} -std=c++11 -Wall -Werror -I. -IBASE_DIR {system_includes}",
"file... | """Rule for generating compile_commands.json.in with appropriate inlcude directories."""
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
_TEMPLATE = """ {{
"directory": "OUT_DIR",
"command": "clang++ -c {filename} -std=c++11 -Wall -Werror -I. -IBASE_DIR {system_includes}",
"file... | apache-2.0 | Python |
cabae8d7732cca922e3fb56db205e41a20186aa3 | Remove markdown | salman-jpg/maya,ausiddiqui/maya | DataCleaning/data_cleaning.py | DataCleaning/data_cleaning.py | # -*- coding: utf-8 -*-
"""
Script for Importing data from MySQL database and cleaning
"""
import os
import pymysql
import pandas as pd
from bs4 import BeautifulSoup
from ftfy import fix_text
## Getting Data
# Changing directory
os.chdir("")
# Running the file containing MySQL information
execfile("connection_config... | # -*- coding: utf-8 -*-
"""
Script for Importing data from MySQL database and cleaning
"""
import os
import pymysql
import pandas as pd
from bs4 import BeautifulSoup
from ftfy import fix_text
## Getting Data
# Changing directory
os.chdir("")
# Running the file containing MySQL information
execfile("connection_config... | mit | Python |
abcae974229dc28a60f78b706f7cd4070bc530fa | update doc | thaim/ansible,thaim/ansible | lib/ansible/modules/windows/win_feature.py | lib/ansible/modules/windows/win_feature.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Paul Durivage <paul.durivage@rackspace.com>, Trond Hindenes <trond@hindenes.com> and others
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Paul Durivage <paul.durivage@rackspace.com>, Trond Hindenes <trond@hindenes.com> and others
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#... | mit | Python |
23b56303d3afa4764d7fa4f4d82eafbaf57d0341 | Update the version number | jeremiedecock/pyai,jeremiedecock/pyai | ailib/__init__.py | ailib/__init__.py | # PyAI
# The MIT License
#
# Copyright (c) 2014,2015,2016,2017 Jeremie DECOCK (http://www.jdhp.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 l... | # PyAI
# The MIT License
#
# Copyright (c) 2014,2015,2016,2017 Jeremie DECOCK (http://www.jdhp.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 l... | mit | Python |
d2cfc7f2fefcb9a317ab3cd18ebc8785fb764d9f | remove last bang | chrisy/exabgp,blablacar/exabgp,benagricola/exabgp,fugitifduck/exabgp,lochiiconnectivity/exabgp,earies/exabgp,fugitifduck/exabgp,blablacar/exabgp,benagricola/exabgp,lochiiconnectivity/exabgp,earies/exabgp,dneiter/exabgp,fugitifduck/exabgp,lochiiconnectivity/exabgp,PowerDNS/exabgp,benagricola/exabgp,chrisy/exabgp,chrisy/... | lib/exabgp/bgp/message/open/capability/refresh.py | lib/exabgp/bgp/message/open/capability/refresh.py | # encoding: utf-8
"""
refresh.py
Created by Thomas Mangin on 2012-07-17.
Copyright (c) 2012 Exa Networks. All rights reserved.
"""
# =================================================================== RouteRefresh
class RouteRefresh (list):
def __str__ (self):
return "Route Refresh (unparsed)"
def extract (self... | #!/usr/bin/env python
# encoding: utf-8
"""
refresh.py
Created by Thomas Mangin on 2012-07-17.
Copyright (c) 2012 Exa Networks. All rights reserved.
"""
# =================================================================== RouteRefresh
class RouteRefresh (list):
def __str__ (self):
return "Route Refresh (unparsed... | bsd-3-clause | Python |
4fa4fb3f583e787da9594ac8a714a22981842c71 | remove now-bogus test | chevah/pydoctor,jelmer/pydoctor,chevah/pydoctor,jelmer/pydoctor,hawkowl/pydoctor,hawkowl/pydoctor,jelmer/pydoctor | pydoctor/test/test_commandline.py | pydoctor/test/test_commandline.py | from pydoctor import driver
import sys, cStringIO
def geterrtext(*options):
options = list(options)
se = sys.stderr
f = cStringIO.StringIO()
print options
sys.stderr = f
try:
try:
driver.main(options)
except SystemExit:
pass
else:
asse... | from pydoctor import driver
import sys, cStringIO
def geterrtext(*options):
options = list(options)
se = sys.stderr
f = cStringIO.StringIO()
print options
sys.stderr = f
try:
try:
driver.main(options)
except SystemExit:
pass
else:
asse... | isc | Python |
579904c318031ed049f697f89109bd6909b68eba | Revise docstring | bowen0701/algorithms_data_structures | alg_merge_sort.py | alg_merge_sort.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def _merge_recur(x_list, y_list):
"""Merge two sorted lists by Recusions."""
if len(x_list) == 0:
return y_list
if len(y_list) == 0:
return x_list
if x_list[0] <= y_list[0]:
... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def _merge_recur(x_list, y_list):
"""Merge two sorted lists by recusions."""
if len(x_list) == 0:
return y_list
if len(y_list) == 0:
return x_list
if x_list[0] <= y_list[0]:
... | bsd-2-clause | Python |
2c5a345aa7e21045d6a76225dc192f14b62db4f6 | fix review permission manage command | pyohio/symposion,pyohio/symposion | symposion/reviews/management/commands/create_review_permissions.py | symposion/reviews/management/commands/create_review_permissions.py | from django.core.management.base import BaseCommand
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from symposion.proposals.models import ProposalSection
class Command(BaseCommand):
def handle(self, *args, **options):
ct = ContentType.object... | from django.core.management.base import BaseCommand
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from symposion.proposals.models import ProposalSection
class Command(BaseCommand):
def handle(self, *args, **options):
ct, created = ContentTy... | bsd-3-clause | Python |
c8398415bf82a1f68c7654c8d4992661587fccf7 | Update pathlib-recursive-rmdir.py | jabocg/scraps | python/pathlib-recursive-rmdir.py | python/pathlib-recursive-rmdir.py | import pathlib
# path: pathlib.Path - directory to remove
def removeDirectory(path):
for i in path.glob('*'):
if i.is_dir():
removeDirectory(i)
else:
i.unlink()
# NOTE: can replace above lines with `removeConents(path)` scrap form pathlib-recursive-remove-contents
path.rmdir()
| import pathlib
# path: pathlib.Path - directory to remove
def removeDirectory(path):
for i in path.glob('*'):
if i.is_dir():
removeDirectory(i)
else:
i.unlink()
path.rmdir()
| mit | Python |
7668331e7cc4f5e2a310fcddcb3f90af4c18bb30 | add Python 3 compatibility imports to capabilities.py | nodakai/watchman,dhruvsinghal/watchman,kwlzn/watchman,wez/watchman,nodakai/watchman,nodakai/watchman,wez/watchman,nodakai/watchman,kwlzn/watchman,kwlzn/watchman,wez/watchman,nodakai/watchman,dhruvsinghal/watchman,dhruvsinghal/watchman,facebook/watchman,dhruvsinghal/watchman,wez/watchman,nodakai/watchman,facebook/watchm... | python/pywatchman/capabilities.py | python/pywatchman/capabilities.py | # Copyright 2015 Facebook, Inc.
# 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 conditions and the f... | # Copyright 2015 Facebook, Inc.
# 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 conditions and the f... | mit | Python |
97545d3055a0e0044723e0cb4b7ffd7803d1dbd5 | Make class constants. | ohsu-qin/qipipe | qipipe/staging/airc_collection.py | qipipe/staging/airc_collection.py | import re
from .staging_error import StagingError
__all__ = ['with_name']
EXTENT = {}
"""A name => collection dictionary for all supported AIRC collections."""
def collection_with_name(name):
"""
@param name: the OHSU QIN collection name
@return: the corresponding AIRC collection
"""
return EXTEN... | import re
from .staging_error import StagingError
__all__ = ['with_name']
EXTENT = {}
"""A name => collection dictionary for all supported AIRC collections."""
def collection_with_name(name):
"""
@param name: the OHSU QIN collection name
@return: the corresponding AIRC collection
"""
return EXTEN... | bsd-2-clause | Python |
ed263e083dcb49bdd3f2d6cc707008cb5fe8ce1b | remove account.reconcile before deleting a account.move | hbrunn/bank-statement-reconcile,damdam-s/bank-statement-reconcile,BT-jmichaud/bank-statement-reconcile,damdam-s/bank-statement-reconcile,Antiun/bank-statement-reconcile,Antiun/bank-statement-reconcile,StefanRijnhart/bank-statement-reconcile,BT-ojossen/bank-statement-reconcile,OpenPymeMx/bank-statement-reconcile,acsone/... | account_statement_ext/account.py | account_statement_ext/account.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Joel Grand-Guillaume
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Joel Grand-Guillaume
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | agpl-3.0 | Python |
55373ddcf68641ec0654b58b8471c01e749366f9 | Use a single redis client object for the module | lucius-feng/tinman,lucius-feng/tinman,lucius-feng/tinman,gmr/tinman,gmr/tinman | tinman/handlers/redis.py | tinman/handlers/redis.py | """The RedisRequestHandler uses tornado-redis to support Redis. It will
auto-establish a single redis connection when initializing the connection.
"""
import logging
import tornadoredis
from tornado import web
LOGGER = logging.getLogger(__name__)
redis_client = None
class RedisRequestHandler(web.RequestHandler):
... | """The RedisRequestHandler uses tornado-redis to support Redis. It will
auto-establish a single redis connection when initializing the connection.
"""
import logging
import tornadoredis
from tornado import web
LOGGER = logging.getLogger(__name__)
class RedisRequestHandler(web.RequestHandler):
"""This request ha... | bsd-3-clause | Python |
65972062c03133a79ff77d90f8a11fd16f7d16ff | Correct column name | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | luigi/tasks/rfam/pgload_go_term_mapping.py | luigi/tasks/rfam/pgload_go_term_mapping.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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 |
a9aad224d6875e774cd0f7db7e30965ea6a3fbdc | Fix simple typo: taget -> target (#591) | keon/algorithms | algorithms/search/jump_search.py | algorithms/search/jump_search.py | import math
def jump_search(arr,target):
"""Jump Search
Worst-case Complexity: O(√n) (root(n))
All items in list must be sorted like binary search
Find block that contains target value and search it linearly in that block
It returns a first target value in array
reference:... | import math
def jump_search(arr,target):
"""Jump Search
Worst-case Complexity: O(√n) (root(n))
All items in list must be sorted like binary search
Find block that contains target value and search it linearly in that block
It returns a first target value in array
reference:... | mit | Python |
9c062d779fe7cb3fc439ff03f25ade58f6045ee5 | fix PythonActivity path | TangibleDisplay/twiz | androidhelpers.py | androidhelpers.py | from jnius import PythonJavaClass, java_method, autoclass
# SERVICE = Autoclass('org.renpy.PythonService').mService
SERVICE = autoclass('org.renpy.android.PythonActivity').mActivity
Intent = autoclass('android.content.Intent')
BluetoothManager = SERVICE.getSystemService(SERVICE.BLUETOOTH_SERVICE)
ADAPTER = Bluetoot... | from jnius import PythonJavaClass, java_method, autoclass
# SERVICE = Autoclass('org.renpy.PythonService').mService
SERVICE = autoclass('org.renpy.PythonActivity').mActivity
Intent = autoclass('android.content.Intent')
BluetoothManager = SERVICE.getSystemService(SERVICE.BLUETOOTH_SERVICE)
ADAPTER = BluetoothManager... | mit | Python |
9ff6f01f7319270f66e2cc32aa5201ad53228e8f | Add __init__ and __call_internal__ for isotropicHernquistdf | jobovy/galpy,jobovy/galpy,jobovy/galpy,jobovy/galpy | galpy/df/isotropicHernquistdf.py | galpy/df/isotropicHernquistdf.py | # Class that implements isotropic spherical Hernquist DF
# computed using the Eddington formula
from .sphericaldf import sphericaldf
from .Eddingtondf import Eddingtondf
class isotropicHernquistdf(Eddingtondf):
"""Class that implements isotropic spherical Hernquist DF computed using the Eddington formula"""
de... | # Class that implements isotropic spherical Hernquist DF
# computed using the Eddington formula
from .sphericaldf import sphericaldf
from .Eddingtondf import Eddingtondf
class isotropicHernquistdf(Eddingtondf):
"""Class that implements isotropic spherical Hernquist DF computed using the Eddington formula"""
de... | bsd-3-clause | Python |
c5c509ff9e2c4599fcf51044abc9e7cbe4a152e1 | remove redundant method [skip ci] | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/enikshay/management/commands/base_model_reconciliation.py | custom/enikshay/management/commands/base_model_reconciliation.py | import csv
from datetime import datetime
from django.core.management.base import BaseCommand, CommandError
from django.core.mail import EmailMessage
from django.conf import settings
from custom.enikshay.const import ENROLLED_IN_PRIVATE
class BaseModelReconciliationCommand(BaseCommand):
email_subject = None
... | import csv
from datetime import datetime
from django.core.management.base import BaseCommand, CommandError
from django.core.mail import EmailMessage
from django.conf import settings
from custom.enikshay.const import ENROLLED_IN_PRIVATE
class BaseModelReconciliationCommand(BaseCommand):
email_subject = None
... | bsd-3-clause | Python |
8f90b8cd67b6bca0c8c2123c229b18bd0ee078d8 | Implement FlatfileCommentProvider._load_one. | rescrv/firmant | firmant/plugins/datasource/flatfile/comments.py | firmant/plugins/datasource/flatfile/comments.py | import datetime
import pytz
import os
import re
from firmant.utils import not_implemented
from firmant.datasource.comments import Comment
comment_re = r'(?P<year>\d{4}),(?P<month>\d{2}),(?P<day>\d{2}),(?P<slug>.+)' +\
r',(?P<created>[1-9][0-9]*),(?P<id>[0-9a-f]{40})'
comment_re = re.compile(comment_re)
class F... | import datetime
import pytz
import os
import re
from firmant.utils import not_implemented
comment_re = r'(?P<year>\d{4}),(?P<month>\d{2}),(?P<day>\d{2}),(?P<slug>.+)' +\
r',(?P<created>[1-9][0-9]*),(?P<id>[0-9a-f]{40})'
comment_re = re.compile(comment_re)
class FlatfileCommentProvider(object):
def __init_... | bsd-3-clause | Python |
68ecbb59c856a20f8f00cae47f1075086da982c7 | Add bitmask imports to nddata.__init__.py | dhomeier/astropy,saimn/astropy,lpsinger/astropy,StuartLittlefair/astropy,bsipocz/astropy,lpsinger/astropy,dhomeier/astropy,larrybradley/astropy,astropy/astropy,dhomeier/astropy,mhvk/astropy,aleksandr-bakanov/astropy,aleksandr-bakanov/astropy,bsipocz/astropy,larrybradley/astropy,pllim/astropy,stargaser/astropy,stargaser... | astropy/nddata/__init__.py | astropy/nddata/__init__.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The `astropy.nddata` subpackage provides the `~astropy.nddata.NDData`
class and related tools to manage n-dimensional array-based data (e.g.
CCD images, IFU Data, grid-based simulation data, ...). This is more than
just `numpy.ndarray` objects, becaus... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The `astropy.nddata` subpackage provides the `~astropy.nddata.NDData`
class and related tools to manage n-dimensional array-based data (e.g.
CCD images, IFU Data, grid-based simulation data, ...). This is more than
just `numpy.ndarray` objects, becaus... | bsd-3-clause | Python |
1156be60da01ee34230dcf5e9e993e72fbe7b635 | make linter happy | ivelum/djangoql,ivelum/djangoql,ivelum/djangoql | test_project/test_project/urls.py | test_project/test_project/urls.py | """test_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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')
Cla... | """test_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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')
Cla... | mit | Python |
e716a71bad4e02410e2a0908d630abbee1d4c691 | Revert the removal of an unused import (in [14175]) that was referenced in documentation. Thanks for noticing, clong. | schinckel/django,DasIch/django,coldmind/django,rwillmer/django,jpic/django,techdragon/django,abomyi/django,EmadMokhtar/Django,koniiiik/django,auvipy/django,elkingtonmcb/django,Balachan27/django,jscn/django,darkryder/django,lunafeng/django,sergei-maertens/django,Leila20/django,chyeh727/django,huang4fstudio/django,saydul... | django/contrib/admin/__init__.py | django/contrib/admin/__init__.py | # ACTION_CHECKBOX_NAME is unused, but should stay since its import from here
# has been referenced in documentation.
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
from django.contrib.admin.options import StackedInline, TabularInli... | from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
from django.contrib.admin.options import StackedInline, TabularInline
from django.contrib.admin.sites import AdminSite, site
def autodiscover():
"""
Auto-discover INSTALLED_APPS admin.py modules and fail silently when
not present. T... | bsd-3-clause | Python |
74b3b60cfe6f12f119ac91f04177abc4c7427e5c | bump version | kmaehashi/sensorbee-python | sensorbee/_version.py | sensorbee/_version.py | # -*- coding: utf-8 -*-
__version__ = '0.1.2'
| # -*- coding: utf-8 -*-
__version__ = '0.1.1'
| mit | Python |
ff41218c0a63959a34969eefafd9951c48ef667f | convert `test/test_sparql/test_sparql_parser.py` to pytest (#2063) | RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib | test/test_sparql/test_sparql_parser.py | test/test_sparql/test_sparql_parser.py | import math
import sys
from typing import Set, Tuple
from rdflib import Graph, Literal
from rdflib.namespace import Namespace
from rdflib.plugins.sparql.processor import processUpdate
from rdflib.term import Node
def triple_set(graph: Graph) -> Set[Tuple[Node, Node, Node]]:
return set(graph.triples((None, None, ... | import math
import sys
import unittest
from typing import Set, Tuple
from rdflib import Graph, Literal
from rdflib.namespace import Namespace
from rdflib.plugins.sparql.processor import processUpdate
from rdflib.term import Node
def triple_set(graph: Graph) -> Set[Tuple[Node, Node, Node]]:
return set(graph.tripl... | bsd-3-clause | Python |
7e24165c828a64389d593c63299df4ff22dcb881 | disable swagger docs for tests | aexeagmbh/django-rest-auth,SakuradaJun/django-rest-auth,citizen-stig/django-rest-auth,ZachLiuGIS/django-rest-auth,SakuradaJun/django-rest-auth,alacritythief/django-rest-auth,philippeluickx/django-rest-auth,serxoz/django-rest-auth,bopo/django-rest-auth,bung87/django-rest-auth,julioeiras/django-rest-auth,flexpeace/django... | rest_auth/urls.py | rest_auth/urls.py | from django.conf import settings
from django.conf.urls import patterns, url, include
from rest_auth.views import Login, Logout, Register, UserDetails, \
PasswordChange, PasswordReset, VerifyEmail, PasswordResetConfirm
urlpatterns = patterns('rest_auth.views',
# URLs that do not require a s... | from django.conf import settings
from django.conf.urls import patterns, url, include
from rest_auth.views import Login, Logout, Register, UserDetails, \
PasswordChange, PasswordReset, VerifyEmail, PasswordResetConfirm
urlpatterns = patterns('rest_auth.views',
# URLs that do not require a s... | mit | Python |
33ef365bffb3aefa053409a72d44b069bdae8c77 | Make django middleware not crash if user isn't set. | rhettg/BlueOx | blueox/contrib/django/middleware.py | blueox/contrib/django/middleware.py | import sys
import traceback
import logging
import blueox
from django.conf import settings
class Middleware(object):
def __init__(self):
host = getattr(settings, 'BLUEOX_HOST', '127.0.0.1')
port = getattr(settings, 'BLUEOX_PORT', 3514)
blueox.configure(host, port)
def process_request(... | import sys
import traceback
import logging
import blueox
from django.conf import settings
class Middleware:
def __init__(self):
host = getattr(settings, 'BLUEOX_HOST', '127.0.0.1')
port = getattr(settings, 'BLUEOX_PORT', 3514)
blueox.configure(host, port)
def process_request(self, re... | isc | Python |
d1b1a6d845419b5c1b8bec3d7f3bded83cf6c9a1 | Fix ObjectNodeItem upperBound visibility | amolenaar/gaphor,amolenaar/gaphor | gaphor/UML/actions/objectnode.py | gaphor/UML/actions/objectnode.py | """Object node item."""
from gaphor import UML
from gaphor.core.modeling.properties import attribute
from gaphor.diagram.presentation import ElementPresentation, Named
from gaphor.diagram.shapes import Box, EditableText, IconBox, Text, draw_border
from gaphor.diagram.support import represents
from gaphor.UML.modelfact... | """Object node item."""
from gaphor import UML
from gaphor.core.modeling.properties import attribute
from gaphor.diagram.presentation import ElementPresentation, Named
from gaphor.diagram.shapes import Box, EditableText, IconBox, Text, draw_border
from gaphor.diagram.support import represents
from gaphor.UML.modelfact... | lgpl-2.1 | Python |
0d7add686605d9d86e688f9f65f617555282ab60 | Add debugging CLI hook for email sending | ascoderu/opwen-cloudserver,ascoderu/opwen-cloudserver | opwen_email_server/backend/email_sender.py | opwen_email_server/backend/email_sender.py | from typing import Tuple
from opwen_email_server import azure_constants as constants
from opwen_email_server import config
from opwen_email_server.services.queue import AzureQueue
from opwen_email_server.services.sendgrid import SendgridEmailSender
QUEUE = AzureQueue(account=config.QUEUES_ACCOUNT, key=config.QUEUES_K... | from typing import Tuple
from opwen_email_server import azure_constants as constants
from opwen_email_server import config
from opwen_email_server.services.queue import AzureQueue
from opwen_email_server.services.sendgrid import SendgridEmailSender
QUEUE = AzureQueue(account=config.QUEUES_ACCOUNT, key=config.QUEUES_K... | apache-2.0 | Python |
5875de6fb894a2903ec1f10c7dbc65c7071c7732 | Fix NullHandler logger addition | gmr/rabbitpy,gmr/rabbitpy,jonahbull/rabbitpy | rmqid/__init__.py | rmqid/__init__.py | __version__ = '0.4.0'
from rmqid.connection import Connection
from rmqid.exchange import Exchange
from rmqid.message import Message
from rmqid.queue import Queue
from rmqid.tx import Tx
from rmqid.simple import consumer
from rmqid.simple import get
from rmqid.simple import publish
import logging
try:
from loggi... | __version__ = '0.4.0'
from rmqid.connection import Connection
from rmqid.exchange import Exchange
from rmqid.message import Message
from rmqid.queue import Queue
from rmqid.tx import Tx
from rmqid.simple import consumer
from rmqid.simple import get
from rmqid.simple import publish
import logging
try:
from loggi... | bsd-3-clause | Python |
e3ac422da8a0c873a676b57ff796d15fac6fc532 | change haproxy config formatting | madcore-ai/core,madcore-ai/core | bin/haproxy_get_ssl.py | bin/haproxy_get_ssl.py | #!/usr/bin/env python
import redis, sys, os, json, jinja2
from jinja2 import Template
r_server = redis.StrictRedis('127.0.0.1', db=2)
check = r_server.get("need_CSR")
if check == "1":
i_key = "owner-info"
data=json.loads (r_server.get(i_key))
email = data['Email']
hostname = data['Hostname']
fron... | #!/usr/bin/env python
import redis, sys, os, json, jinja2
from jinja2 import Template
r_server = redis.StrictRedis('127.0.0.1', db=2)
check = r_server.get("need_CSR")
if check == "1":
i_key = "owner-info"
data=json.loads (r_server.get(i_key))
email = data['Email']
hostname = data['Hostname']
fron... | mit | Python |
cc6c80ad64fe7f4d4cb2b4e367c595f1b08f9d3b | Remove script crash when no sonos is found | Lilleengen/i3blocks-sonos | i3blocks-sonos.py | i3blocks-sonos.py | #!/usr/bin/env python3
#
# By Henrik Lilleengen (mail@ithenrik.com)
#
# Released under the MIT License: https://opensource.org/licenses/MIT
import soco, sys
speakers = list(soco.discover())
if len(speakers) > 0:
state = speakers[0].get_current_transport_info()['current_transport_state']
if state == 'PLAYING... | #!/usr/bin/env python3
#
# By Henrik Lilleengen (mail@ithenrik.com)
#
# Released under the MIT License: https://opensource.org/licenses/MIT
import soco, sys
speakers = list(soco.discover())
state = speakers[0].get_current_transport_info()['current_transport_state']
if state == 'PLAYING':
if len(sys.argv) > 1 a... | mit | Python |
74084defad8222ba69340d0d983acdf33ddef17c | Correct the test of assertEqual failing. | jwg4/qual,jwg4/calexicon | calexicon/dates/tests/test_dates.py | calexicon/dates/tests/test_dates.py | import unittest
from datetime import date, timedelta
from calexicon.dates import DateWithCalendar
class TestDateWithCalendar(unittest.TestCase):
def setUp(self):
date_dt = date(2010, 8, 1)
self.date_wc = DateWithCalendar(None, date_dt)
def test_equality(self):
self.assertTrue(self.d... | import unittest
from datetime import date, timedelta
from calexicon.dates import DateWithCalendar
class TestDateWithCalendar(unittest.TestCase):
def setUp(self):
date_dt = date(2010, 8, 1)
self.date_wc = DateWithCalendar(None, date_dt)
def test_equality(self):
self.assertTrue(self.d... | apache-2.0 | Python |
ce48ef985a8e79d0cd636abf2116917fde24d6d2 | Remove an unnecessary method override | DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextrepresentative,neavouli/yournextrepresentative,DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,neavouli/yournextr... | candidates/tests/test_posts_view.py | candidates/tests/test_posts_view.py | from __future__ import unicode_literals
from django_webtest import WebTest
from .uk_examples import UK2015ExamplesMixin
class TestPostsView(UK2015ExamplesMixin, WebTest):
def test_single_election_posts_page(self):
response = self.app.get('/posts')
self.assertTrue(
response.html.fi... | from __future__ import unicode_literals
from django_webtest import WebTest
from .uk_examples import UK2015ExamplesMixin
class TestPostsView(UK2015ExamplesMixin, WebTest):
def setUp(self):
super(TestPostsView, self).setUp()
def test_single_election_posts_page(self):
response = self.app.get... | agpl-3.0 | Python |
eb96a44e87bc29d24695ea881014d41b8fc793b1 | split cell search out of general search function | mozilla/ichnaea,therewillbecode/ichnaea,therewillbecode/ichnaea,mozilla/ichnaea,mozilla/ichnaea,mozilla/ichnaea,therewillbecode/ichnaea | ichnaea/search.py | ichnaea/search.py | from statsd import StatsdTimer
from ichnaea.db import Cell, RADIO_TYPE
from ichnaea.decimaljson import quantize
def search_cell(session, data):
radio = RADIO_TYPE.get(data['radio'], 0)
cell = data['cell'][0]
mcc = cell['mcc']
mnc = cell['mnc']
lac = cell['lac']
cid = cell['cid']
query = ... | from statsd import StatsdTimer
from ichnaea.db import Cell, RADIO_TYPE
from ichnaea.decimaljson import quantize
def search_request(request):
data = request.validated
if not data['cell']:
# we don't have any wifi entries yet
return {
'status': 'not_found',
}
radio = RA... | apache-2.0 | Python |
a64215f5b6b242893448478a2dfdd4c4b2f6ac46 | Add the actual content to test_cc_license.py | creativecommons/cc.license,creativecommons/cc.license | cc/license/tests/test_cc_license.py | cc/license/tests/test_cc_license.py | """Tests for functionality within the cc.license module.
This file is a catch-all for tests with no place else to go."""
import cc.license
def test_locales():
locales = cc.license.locales()
for l in locales:
assert type(l) == unicode
for c in ('en', 'de', 'he', 'ja', 'fr'):
assert c in ... | mit | Python | |
014925aa73e85fe3cb0d939a3d5d9c30424e32b4 | Add Numbers and Symbols Exception | MohamadKh75/Arthon | func.py | func.py | # PyArt by MohamadKh75
# 2017-10-05
# ********************
from pathlib import Path
# Set the Alphabet folder path
folder_path = Path("Alphabet").resolve()
# Read all Capital Letters - AA is Capital A
def letter_reader(letter):
# if it's Capital - AA is Capital A
if 65 <= ord(letter) <= 90:
letter_... | # PyArt by MohamadKh75
# 2017-10-05
# ********************
from pathlib import Path
# Set the Alphabet folder path
folder_path = Path("Alphabet").resolve()
# Read all Capital Letters - AA is Capital A
def letter_reader(letter):
# if it's Capital - AA is Capital A
if 65 <= ord(letter) <= 90:
letter_... | mit | Python |
262e60aa8da3430c860e574e8141495bc7043cab | Move hook render logic from app to hook | vtemian/git-to-trello,vtemian/git-to-trello | hook.py | hook.py | import json
from flask import Blueprint, render_template, request
import requests
import config
hook = Blueprint('hooks', __name__, 'templates')
@hook.route('/hook')
def home():
return render_template('new.html')
@hook.route('/hook/new', methods=['POST'])
def new():
data = {
"name": request.form['name'],
... | import json
from flask import Blueprint, render_template, request
import requests
import config
hook = Blueprint('hooks', __name__, 'templates')
@hook.route('/hook/new', methods=['POST'])
def new():
data = {
"name": request.form['name'],
"active": request.form['active'] if 'active' in request.form else 'f... | mit | Python |
b82b8d7af363b58902e1aa3920b26c47f5b34aa4 | Use python3 if available to run gen_git_source.py. | tensorflow/tensorflow-experimental_link_static_libraries_once,sarvex/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,Intel-tensorflow/tensorflow,karllessard/tensorflow,renyi533/tensorflow,gautam1858/tensorflow,cxxgtxy/tensorflow,petewarden/tensorflow,annarev/tensorflow,gunan/tensorflow,gautam... | third_party/git/git_configure.bzl | third_party/git/git_configure.bzl | """Repository rule for Git autoconfiguration.
`git_configure` depends on the following environment variables:
* `PYTHON_BIN_PATH`: location of python binary.
"""
_PYTHON_BIN_PATH = "PYTHON_BIN_PATH"
def _fail(msg):
"""Output failure message when auto configuration fails."""
red = "\033[0;31m"
no_color... | """Repository rule for Git autoconfiguration.
`git_configure` depends on the following environment variables:
* `PYTHON_BIN_PATH`: location of python binary.
"""
_PYTHON_BIN_PATH = "PYTHON_BIN_PATH"
def _fail(msg):
"""Output failure message when auto configuration fails."""
red = "\033[0;31m"
no_color... | apache-2.0 | Python |
6968792b38981616b7a00526d2ab24985dcd2ce3 | include host flags in cluster command | blaze/distributed,amosonn/distributed,amosonn/distributed,dask/distributed,dask/distributed,broxtronix/distributed,dask/distributed,amosonn/distributed,mrocklin/distributed,dask/distributed,broxtronix/distributed,blaze/distributed,broxtronix/distributed,mrocklin/distributed,mrocklin/distributed | distributed/cluster.py | distributed/cluster.py | import paramiko
from time import sleep
from toolz import assoc
def start_center(addr):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(addr)
channel = ssh.invoke_shell()
channel.settimeout(20)
sleep(0.1)
channel.send('dcenter --host %s\n' ... | import paramiko
from time import sleep
from toolz import assoc
def start_center(addr):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(addr)
channel = ssh.invoke_shell()
channel.settimeout(20)
sleep(0.1)
channel.send('dcenter\n')
chann... | bsd-3-clause | Python |
ed6d94d27d4274c5a1b282c6d092852ea0a5626d | Fix exception on User admin registration if not already registered. Closes #40 | kavdev/djangotoolbox,Knotis/djangotoolbox | djangotoolbox/admin.py | djangotoolbox/admin.py | from django import forms
from django.contrib import admin
from django.contrib.admin.sites import NotRegistered
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User, Group
class UserForm(forms.ModelForm):
class Meta:
model = User
fields = ('username', 'email'... | from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User, Group
class UserForm(forms.ModelForm):
class Meta:
model = User
fields = ('username', 'email', 'first_name', 'last_name', 'is_active',
... | bsd-3-clause | Python |
917013e2e5c02a4a263f13c1874736fca5ad2cf9 | combine import statement | RaymondKlass/entity-extract | entity_extract/examples/pos_extraction.py | entity_extract/examples/pos_extraction.py |
#from entity_extract.extractor.extractors import PosExtractor
from entity_extract.extractor.utilities import SentSplit, Tokenizer
from entity_extract.extractor.extractors import PosExtractor
from entity_extract.extractor.pos_tagger import PosTagger
#p = PosExtractor()
#data = p.extract_entities('This is a sentence ab... |
#from entity_extract.extractor.extractors import PosExtractor
from entity_extract.extractor.utilities import SentSplit
from entity_extract.extractor.utilities import Tokenizer
from entity_extract.extractor.extractors import PosExtractor
from entity_extract.extractor.pos_tagger import PosTagger
#p = PosExtractor()
#da... | mit | Python |
995209472d9a9a843d05f0649da38015f8e8a195 | update requirements for metadata extractor | usc-isi-i2/etk,usc-isi-i2/etk,usc-isi-i2/etk | etk/extractors/html_metadata_extractor.py | etk/extractors/html_metadata_extractor.py | from typing import List
from etk.extractor import Extractor
from etk.etk_extraction import Extraction, Extractable
class HTMLMetadataExtractor(Extractor):
"""
Extracts META, microdata, JSON-LD and RDFa from HTML pages.
Uses https://stackoverflow.com/questions/36768068/get-meta-tag-content-property-with-b... | from typing import List
from etk.extractor import Extractor
from etk.etk_extraction import Extraction, Extractable
class HTMLMetadataExtractor(Extractor):
"""
Extracts microdata, JSON-LD and RDFa from HTML pages
"""
def __init__(self):
"consider parameterizing as in extruct, to select only sp... | mit | Python |
fbe268300142a47d4923109bd7ee81689084dd7b | add z, objectIndex, compositing and alpha attribute to Options | CaptainDesAstres/Blender-Render-Manager,CaptainDesAstres/Simple-Blender-Render-Manager | settingMod/Options.py | settingMod/Options.py | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage Rendering Options'''
import xml.etree.ElementTree as xmlMod
import os
class Options:
'''class to manage Rendering Options'''
def __init__(self, xml= None):
'''initialize Rendering Options with default value or values extracted from an xml object'''
... | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage Rendering Options'''
import xml.etree.ElementTree as xmlMod
import os
class Options:
'''class to manage Rendering Options'''
def __init__(self, xml= None):
'''initialize Rendering Options with default value or values extracted from an xml object'''
... | mit | Python |
51b611fa8d1a8b2567aec21bd7aee8eeecb6d12a | Remove another comment from is_list_like docstring that's no longer relevant | prat0318/bravado-core | bravado_core/schema.py | bravado_core/schema.py | from collections import Mapping
from bravado_core.exception import SwaggerMappingError
# 'object' and 'array' are omitted since this should really be read as
# "Swagger types that map to python primitives"
SWAGGER_PRIMITIVES = (
'integer',
'number',
'string',
'boolean',
'null',
)
def has_defaul... | from collections import Mapping
from bravado_core.exception import SwaggerMappingError
# 'object' and 'array' are omitted since this should really be read as
# "Swagger types that map to python primitives"
SWAGGER_PRIMITIVES = (
'integer',
'number',
'string',
'boolean',
'null',
)
def has_defaul... | bsd-3-clause | Python |
f120be17e4b1d63bd98c2390cf4ec39b8e61e8fd | define _VersionTupleEnumMixin class | googlefonts/fonttools,fonttools/fonttools | Lib/fontTools/ufoLib/utils.py | Lib/fontTools/ufoLib/utils.py | """The module contains miscellaneous helpers.
It's not considered part of the public ufoLib API.
"""
import warnings
import functools
numberTypes = (int, float)
def deprecated(msg=""):
"""Decorator factory to mark functions as deprecated with given message.
>>> @deprecated("Enough!")
... def some_funct... | """The module contains miscellaneous helpers.
It's not considered part of the public ufoLib API.
"""
import warnings
import functools
numberTypes = (int, float)
def deprecated(msg=""):
"""Decorator factory to mark functions as deprecated with given message.
>>> @deprecated("Enough!")
... def some_funct... | mit | Python |
dff9df9463fd302665169dc68c17252a08a96739 | add HRK currency | nimbis/django-shop,divio/django-shop,jrief/django-shop,khchine5/django-shop,divio/django-shop,nimbis/django-shop,jrief/django-shop,jrief/django-shop,awesto/django-shop,awesto/django-shop,khchine5/django-shop,khchine5/django-shop,awesto/django-shop,nimbis/django-shop,khchine5/django-shop,jrief/django-shop,divio/django-s... | shop/money/iso4217.py | shop/money/iso4217.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
# Dictionary of currency representations:
# key: official ISO 4217 code
# value[0]: numeric representation
# value[1]: number of digits
# value[2]: currency symbol in UTF-8
# value[3]: textual descri... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
# Dictionary of currency representations:
# key: official ISO 4217 code
# value[0]: numeric representation
# value[1]: number of digits
# value[2]: currency symbol in UTF-8
# value[3]: textual descri... | bsd-3-clause | Python |
f9d29a5ba9bc196fdd669a1de01d8b8dde5ae8b8 | Corrige l'espacement | sgmap/openfisca-france,sgmap/openfisca-france | openfisca_france/model/caracteristiques/capacite_travail.py | openfisca_france/model/caracteristiques/capacite_travail.py | # -*- coding: utf-8 -*-
from openfisca_france.model.base import *
class taux_capacite_travail(Variable):
value_type = float
default_value = 1.0
entity = Individu
label = u"Taux de capacité de travail, appréciée par la commission des droits et de l'autonomie des personnes handicapées (CDAPH)"
defi... | # -*- coding: utf-8 -*-
from openfisca_france.model.base import *
class taux_capacite_travail(Variable):
value_type = float
default_value = 1.0
entity = Individu
label = u"Taux de capacité de travail, appréciée par la commission des droits et de l'autonomie des personnes handicapées (CDAPH)"
defi... | agpl-3.0 | Python |
03c7498dc8ba09a2135a7c214d7903f7509b956b | Use log-uniform distribution for learning-rate. | bsautermeister/machine-learning-examples | hyperparam_opt/tensorflow/hyperopt_dnn_mnist.py | hyperparam_opt/tensorflow/hyperopt_dnn_mnist.py | import sys
import argparse
import numpy as np
import tensorflow as tf
from hyperparam_opt.tensorflow.dnn_mnist import HyperParams, train
from hyperopt import fmin, hp, Trials, tpe, STATUS_OK
from tensorflow.examples.tutorials.mnist import input_data
MNIST = None
def optimizer(args):
hyper = HyperParams(**args)... | import sys
import argparse
import tensorflow as tf
from hyperparam_opt.tensorflow.dnn_mnist import HyperParams, train
from hyperopt import fmin, hp, Trials, tpe, STATUS_OK
from tensorflow.examples.tutorials.mnist import input_data
MNIST = None
def optimizer(args):
hyper = HyperParams(**args)
print(hyper.to_... | mit | Python |
ec3e08da9551e2a7e7e114c4d425871b2a915425 | fix leaked greenlet | ooici/coi-services,ooici/coi-services,ooici/coi-services,ooici/coi-services,ooici/coi-services | ion/agents/platform/rsn/test/test_oms_client.py | ion/agents/platform/rsn/test/test_oms_client.py | #!/usr/bin/env python
"""
@package ion.agents.platform.rsn.test.test_oms_client
@file ion/agents/platform/rsn/test/test_oms_client.py
@author Carlos Rueda
@brief Test cases for CIOMSClient.
"""
__author__ = 'Carlos Rueda'
__license__ = 'Apache 2.0'
from pyon.public import log
from ion.agents.platform.rsn.simul... | #!/usr/bin/env python
"""
@package ion.agents.platform.rsn.test.test_oms_simple
@file ion/agents/platform/rsn/test/test_oms_simple.py
@author Carlos Rueda
@brief Test cases for CIOMSClient.
"""
__author__ = 'Carlos Rueda'
__license__ = 'Apache 2.0'
from pyon.public import log
from ion.agents.platform.rsn.simul... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.