commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
a65c8287e0d5e850173375a2e852b29a905ffbf1 | tools/telemetry/telemetry/core/possible_browser.py | tools/telemetry/telemetry/core/possible_browser.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.
class PossibleBrowser(object):
"""A browser that can be controlled.
Call Create() to launch the browser and begin manipulating it..
"""
def __in... | # 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.
class PossibleBrowser(object):
"""A browser that can be controlled.
Call Create() to launch the browser and begin manipulating it..
"""
def __in... | Make browser_type a property of PossibleBrowser. | Make browser_type a property of PossibleBrowser.
BUG=NONE
TEST=run_tests
NOTRY=true
Review URL: https://codereview.chromium.org/12479003
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@186537 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | patrickm/chromium.src,dednal/chromium.src,patrickm/chromium.src,ondra-novak/chromium.src,TheTypoMaster/chromium-crosswalk,fujunwei/chromium-crosswalk,anirudhSK/chromium,ChromiumWebApps/chromium,mogoweb/chromium-crosswalk,patrickm/chromium.src,axinging/chromium-crosswalk,dushu1203/chromium.src,Pluto-tv/chromium-crosswal... |
38f6cdfa85b5f5839f7f7c06ba416dc91b1e1317 | setup.py | setup.py | # ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=['rospilot', 'rospilot.assets', 'vlc_server'],
package_dir={'': 'src'},
... | # ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=['rospilot', 'rospilot.assets', 'vlc_server'],
package_dir={'': 'src'},
... | Use more standard compliant glob syntax | Use more standard compliant glob syntax
| Python | apache-2.0 | cberner/rospilot,rospilot/rospilot,cberner/rospilot,cberner/rospilot,rospilot/rospilot,cberner/rospilot,cberner/rospilot,rospilot/rospilot,cberner/rospilot,rospilot/rospilot,rospilot/rospilot,rospilot/rospilot |
3f298ed994506a54068ec8cec6fd028a0b0e8699 | setup.py | setup.py | from distutils.core import setup
setup(
name='django-robots',
version=__import__('robots').__version__,
description='Robots exclusion application for Django, complementing Sitemaps.',
long_description=open('docs/overview.txt').read(),
author='Jannis Leidel',
author_email='jannis@leidel.info',
... | from distutils.core import setup
setup(
name='django-robots',
version=__import__('robots').__version__,
description='Robots exclusion application for Django, complementing Sitemaps.',
long_description=open('docs/overview.txt').read(),
author='Jannis Leidel',
author_email='jannis@leidel.info',
... | Remove download URL since Github doesn't get his act together. Damnit | Remove download URL since Github doesn't get his act together. Damnit
git-svn-id: https://django-robots.googlecode.com/svn/trunk@36 12edf5ea-513a-0410-8a8c-37067077e60f
committer: leidel <leidel@12edf5ea-513a-0410-8a8c-37067077e60f>
--HG--
extra : convert_revision : aa256d6eb94fc5492608373969ed7c5826b2077a
| Python | bsd-3-clause | gbezyuk/django-robots,pbs/django-robots,jscott1971/django-robots,jezdez/django-robots,jazzband/django-robots,jezdez/django-robots,freakboy3742/django-robots,pbs/django-robots,philippeowagner/django-robots,philippeowagner/django-robots,amitu/django-robots,jazzband/django-robots,freakboy3742/django-robots,pbs/django-robo... |
adc79737e1932724fa38533ecf67a65bf77a6dc8 | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup, Extension
import numpy.distutils
setup(
name='Libact',
version='0.1.0',
description='Active learning package',
long_description='Active learning package',
author='LSC',
author_email='this@is.email',
url='http://www.csie.ntu.edu.tw/~ht... | #!/usr/bin/env python
from distutils.core import setup, Extension
import numpy.distutils
import sys
if sys.platform == 'darwin':
print("Platform Detection: Mac OS X. Link to openblas...")
extra_link_args = ['-L/usr/local/opt/openblas/lib -lopenblas']
include_dirs = (numpy.distutils.misc_util.get_numpy_inc... | Fix compiling flags for darwin. | Fix compiling flags for darwin.
The OpenBLAS formula is keg-only, which means it was not symlinked into
/usr/local. Thus, we need to add the build variables manually.
Also, the library is named as openblas, which means `-llapack` and `-llapacke`
will cause library not found error.
| Python | bsd-2-clause | ntucllab/libact,ntucllab/libact,ntucllab/libact |
19e7aa3269adacd6ff5f0974ddd957b468ebd0ca | slack.py | slack.py | import requests
import json
import time
import sys
_token = "xxxxxxx"
_domain = "xxxxxxx"
def del_time(Day):
Set_time = str(int(time.time())-Day*86400)
return Set_time
def files_list(Day):
Del_time = del_time(Day)
files_list_url = "https://slack.com/api/files.list"
data = {
"token": _toke... | import requests
import json
import time
import sys
file = open('token.txt', 'r')
_token = file.readline()
file.close()
file = open('domain.txt', 'r')
_domain = file.readline()
def del_time(Day):
Set_time = str(int(time.time())-Day*86400)
return Set_time
def files_list(Day):
Del_time = del_time(Day)
f... | Change about read "token" & "domain" | Change about read "token" & "domain"
| Python | mit | Rick-Kota/Slack_file_Delete |
e331f5cd1c921ca35c6184c00fbd36929cb92b90 | src/tenyksddate/main.py | src/tenyksddate/main.py | from tenyksservice import TenyksService, run_service
from ddate.base import DDate
class DiscordianDate(TenyksService):
direct_only = True
irc_message_filters = {
'today': [r'^(?i)(ddate|discordian)']
}
def __init__(self, *args, **kwargs):
super(DiscordianDate, self).__init__(*args, **k... | import datetime
from tenyksservice import TenyksService, run_service
from ddate.base import DDate
class DiscordianDate(TenyksService):
direct_only = True
irc_message_filters = {
'date': [r'^(?i)(ddate|discordian) (?P<month>(.*)) (?P<day>(.*)) (?P<year>(.*))'],
'today': [r'^(?i)(ddate|discordian... | Add lookup for an arbitrary date | Add lookup for an arbitrary date
In the form “mm dd yyyy”.
| Python | mit | kyleterry/tenyks-contrib,cblgh/tenyks-contrib,colby/tenyks-contrib |
9ad378244cf8ca8a28b01ae1c7e166dbeff9a3fb | odoo/addons/test_main_flows/__manifest__.py | odoo/addons/test_main_flows/__manifest__.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Test Main Flow',
'version': '1.0',
'category': 'Tools',
'description': """
This module will test the main workflow of Odoo.
It will install some main apps and will try to execute the most import... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Test Main Flow',
'version': '1.0',
'category': 'Tools',
'description': """
This module will test the main workflow of Odoo.
It will install some main apps and will try to execute the most import... | Revert "[FIX] test_main_flows: missing dependency to run it in a browser" | Revert "[FIX] test_main_flows: missing dependency to run it in a browser"
This reverts commit 58e914425033a9604885fb0cdd7de1a6a144c4da.
| Python | agpl-3.0 | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo |
91147e838348b576d760cb2f3966e2c64b930e2e | swift/dedupe/killall.py | swift/dedupe/killall.py | #!/usr/bin/python
__author__ = 'mjwtom'
import os
os.system('ps -aux | grep swift-proxy-server | grep -v grep | cut -c 9-15 | xargs kill -s 9')
os.system('ps -aux | grep swift-account-server | grep -v grep | cut -c 9-15 | xargs kill -s 9')
os.system('ps -aux | grep swift-container-server | grep -v grep | cut -c 9-15... | #!/usr/bin/python
__author__ = 'mjwtom'
import os
os.system('ps -aux | grep swift-proxy-server | grep -v grep | cut -c 9-15 | xargs kill -s 9')
os.system('ps -aux | grep swift-account-server | grep -v grep | cut -c 9-15 | xargs kill -s 9')
os.system('ps -aux | grep swift-container-server | grep -v grep | cut -c 9-15... | Change the position. use proxy-server to do dedupe instead of object-server | Change the position. use proxy-server to do dedupe instead of object-server
| Python | apache-2.0 | mjwtom/swift,mjwtom/swift |
ac854703ac8ae2e9ab1b9fb2475f9fcb11df8721 | pysc2/agents/base_agent.py | pysc2/agents/base_agent.py | # Copyright 2017 Google Inc. 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 applicable law or ... | # Copyright 2017 Google Inc. 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 applicable law or ... | Define instance attributes on __init__. | Define instance attributes on __init__.
PySC2: Import of refs/pull/48/head
PiperOrigin-RevId: 166837442
| Python | apache-2.0 | deepmind/pysc2 |
856bdb5219b233769dc2529772d8489c20fb1efc | reddit_adzerk/adzerkads.py | reddit_adzerk/adzerkads.py | from urllib import quote
from pylons import tmpl_context as c
from pylons import app_globals as g
from r2.lib.pages import Ads as BaseAds
from r2.models.subreddit import DefaultSR
FRONTPAGE_NAME = "-reddit.com"
class Ads(BaseAds):
def __init__(self):
BaseAds.__init__(self)
url_key = "adzerk_ht... | from urllib import quote
from pylons import tmpl_context as c
from pylons import app_globals as g
from r2.lib.pages import Ads as BaseAds
from r2.models.subreddit import DefaultSR
FRONTPAGE_NAME = "-reddit.com"
class Ads(BaseAds):
def __init__(self):
BaseAds.__init__(self)
site_name = getattr(... | Use protocol relative adzerk url | Use protocol relative adzerk url
| Python | bsd-3-clause | madbook/reddit-plugin-adzerk,madbook/reddit-plugin-adzerk,madbook/reddit-plugin-adzerk |
485f04f0e396444dbb5635b21202b2cd2e0612ff | src/webapp/admin/login.py | src/webapp/admin/login.py | from datetime import timedelta, datetime
from functools import wraps
import hmac
from hashlib import sha1
from flask import Blueprint, session, redirect, url_for, request, current_app
ADMIN = "valid_admin"
TIME_FORMAT = '%Y%m%d%H%M%S'
TIME_LIMIT = timedelta(hours=3)
def _create_hmac(payload):
key = current_app.... | from datetime import timedelta, datetime
from functools import wraps
import hmac
from hashlib import sha1
from flask import Blueprint, session, redirect, url_for, request, current_app
ADMIN = "valid_admin"
TIME_FORMAT = '%Y%m%d%H%M%S'
TIME_LIMIT = timedelta(hours=3)
def _create_hmac(payload):
key = current_app.... | Fix redirect generation for reverse proxied solutions | Fix redirect generation for reverse proxied solutions
| Python | bsd-3-clause | janLo/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system |
1ad3bf1093dd6b336dfc45c51dc608f04b355631 | wafer/talks/tests/test_wafer_basic_talks.py | wafer/talks/tests/test_wafer_basic_talks.py | # This tests the very basic talk stuff, to ensure some levels of sanity
def test_add_talk():
"""Create a user and add a talk to it"""
from django.contrib.auth.models import User
from wafer.talks.models import Talk
user = User.objects.create_user('john', 'best@wafer.test', 'johnpassword')
talk = T... | # This tests the very basic talk stuff, to ensure some levels of sanity
def test_add_talk():
"""Create a user and add a talk to it"""
from django.contrib.auth.models import User
from wafer.talks.models import Talk
user = User.objects.create_user('john', 'best@wafer.test', 'johnpassword')
Talk.obj... | Add some more simple tests | Add some more simple tests
| Python | isc | CTPUG/wafer,CTPUG/wafer,CarlFK/wafer,CTPUG/wafer,CarlFK/wafer,CarlFK/wafer,CarlFK/wafer,CTPUG/wafer |
1cf1da043ceab767d9d0dbdbed62c2f1c5ff36e9 | test_http.py | test_http.py | from http_server import HttpServer
import socket
def test_200_ok():
s = HttpServer()
assert s.ok() == "HTTP/1.1 200 OK"
def test_200_ok_byte():
s = HttpServer()
assert isinstance(s.ok(), bytes)
def test_socket_is_socket():
s = HttpServer()
s.open_socket()
assert isinstance(s._socket, s... | from http_server import HttpServer
import socket
def test_200_ok():
s = HttpServer()
assert s.ok() == "HTTP/1.1 200 OK"
def test_200_ok_byte():
s = HttpServer()
assert isinstance(s.ok(), bytes)
def test_socket_is_socket():
s = HttpServer()
s.open_socket()
assert isinstance(s._socket, s... | Add tests for closing a socket | Add tests for closing a socket
| Python | mit | jefrailey/network_tools |
5def645c7bceaca3da3e76fec136c82b4ae848e3 | UIP.py | UIP.py | import sys
from uiplib.scheduler import scheduler
if __name__ == "__main__":
print("Hey this is UIP! you can use it to download"
" images from reddit and also to schedule the setting of these"
" images as your desktop wallpaper.")
try:
offline = False
if len(sys.argv) > 1 an... | import sys, argparse, os, shutil
from uiplib.constants import CURR_DIR, PICS_FOLDER
from uiplib.scheduler import scheduler
if __name__ == "__main__":
print("Hey this is UIP! you can use it to download"
" images from reddit and also to schedule the setting of these"
" images as your desktop wall... | Add flag options for flush and offline modes | Add flag options for flush and offline modes
Fixes #65
| Python | agpl-3.0 | Aniq55/UIP,nemaniarjun/UIP,mohitshaw/UIP,akshatnitd/UIP,VK10/UIP,VK10/UIP,nemaniarjun/UIP,Aniq55/UIP,NIT-dgp/UIP,DarkSouL11/UIP,hackrush01/UIP,NIT-dgp/UIP,hassi2016/UIP |
a3c52c84da93c3e3007fa291213b97fd7d5b0e8f | tests.py | tests.py | """
Tests for TwitterSA
These tests might be overkill, it's my first time messing around
with unit tests.
Jesse Mu
"""
import TwitterSA
import unittest
class TwitterSATestCase(unittest.TestCase):
def setUp(self):
TwitterSA.app.config['TESTING'] = True
self.app = TwitterSA.app.test_client()
... | """
Tests for TwitterSA
These tests might be overkill, it's my first time messing around
with unit tests.
Jesse Mu
"""
import TwitterSA
import unittest
class TwitterSATestCase(unittest.TestCase):
def setUp(self):
TwitterSA.app.config['TESTING'] = True
self.app = TwitterSA.app.test_client()
... | Add twitter API functionality test | Add twitter API functionality test
| Python | mit | jayelm/twittersa,jayelm/twittersa |
5f16929b405ea12a430a22fdd02a547d6b7e28a5 | tests.py | tests.py | from django.test import TestCase
from django.contrib.auth.models import User
from mainstay.test_utils import MainstayTest
from .models import Page
class WikiTestCase(MainstayTest):
fixtures = MainstayTest.fixtures + ['wiki_pages']
def test_user_loaded(self):
user = User.objects.get()
self.as... | from django.test import TestCase
from django.contrib.auth.models import User
from mainstay.test_utils import MainstayTest
from .models import Page
class WikiTestCase(MainstayTest):
fixtures = MainstayTest.fixtures + ['wiki_pages']
def test_user_loaded(self):
user = User.objects.get()
self.as... | Add test for adding a page | Add test for adding a page
| Python | mit | plumdog/mainstay_wiki |
c7150bf227edf78d716fe4e09b3a073d9b0cfc1e | fmriprep/workflows/bold/tests/test_utils.py | fmriprep/workflows/bold/tests/test_utils.py | ''' Testing module for fmriprep.workflows.base '''
import pytest
import numpy as np
from nilearn.image import load_img
from ..utils import init_enhance_and_skullstrip_bold_wf
def symmetric_overlap(img1, img2):
mask1 = load_img(img1).get_data() > 0
mask2 = load_img(img2).get_data() > 0
total1 = np.sum(ma... | ''' Testing module for fmriprep.workflows.base '''
import pytest
import numpy as np
from nilearn.image import load_img
from ..utils import init_bold_reference_wf
def symmetric_overlap(img1, img2):
mask1 = load_img(img1).get_data() > 0
mask2 = load_img(img2).get_data() > 0
total1 = np.sum(mask1)
tota... | Use bold_reference_wf to generate reference before enhancing | TEST: Use bold_reference_wf to generate reference before enhancing
| Python | bsd-3-clause | poldracklab/preprocessing-workflow,poldracklab/fmriprep,poldracklab/preprocessing-workflow,oesteban/fmriprep,oesteban/fmriprep,oesteban/fmriprep,oesteban/preprocessing-workflow,poldracklab/fmriprep,poldracklab/fmriprep,oesteban/preprocessing-workflow |
d3a0c400e50d34b9829b05d26eef5eac878aa091 | enhanced_cbv/views/list.py | enhanced_cbv/views/list.py | from django.core.exceptions import ImproperlyConfigured
from django.views.generic import ListView
class ListFilteredMixin(object):
"""
Mixin that adds support for django-filter
"""
filter_set = None
def get_filter_set(self):
if self.filter_set:
return self.filter_set
... | from django.core.exceptions import ImproperlyConfigured
from django.views.generic import ListView
class ListFilteredMixin(object):
"""
Mixin that adds support for django-filter
"""
filter_set = None
def get_filter_set(self):
if self.filter_set:
return self.filter_set
... | Add get_filter_set_kwargs for instanciating FilterSet with additional arguments | Add get_filter_set_kwargs for instanciating FilterSet with additional arguments | Python | bsd-3-clause | rasca/django-enhanced-cbv,matuu/django-enhanced-cbv,matuu/django-enhanced-cbv,rasca/django-enhanced-cbv |
4a8c608c545b67f9dc1f436c82e0d83a55e168e9 | scripts/database/common.py | scripts/database/common.py | import sys
import psycopg2
import os
import yaml
if 'CATMAID_CONFIGURATION' in os.environ:
path = os.environ['CATMAID_CONFIGURATION']
else:
path = os.path.join(os.environ['HOME'], '.catmaid-db')
try:
conf = yaml.load(open(path))
except:
print >> sys.stderr, '''Your %s file should look like:
host: loc... | import sys
import psycopg2
import os
import yaml
if 'CATMAID_CONFIGURATION' in os.environ:
path = os.environ['CATMAID_CONFIGURATION']
else:
path = os.path.join(os.environ['HOME'], '.catmaid-db')
try:
conf = yaml.load(open(path))
except:
print >> sys.stderr, '''Your %s file should look like:
host: loc... | Add default port to database connection script | Add default port to database connection script
The default port is used if the ~/.catmaid-db file doesn't contain it. This
fixes #454.
| Python | agpl-3.0 | fzadow/CATMAID,htem/CATMAID,htem/CATMAID,htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID |
1431f45e6b605e54f1ec341114b53ae047e48be7 | token_names.py | token_names.py | INTEGER, PLUS, MINUS, MULTIPLY, DIVIDE, LPAREN, RPAREN, EOF, OPEN, CLOSE, BANG, ASSIGN, SEMI, ID = (
'INTEGER',
'PLUS',
'MINUS',
'MULTIPLY',
'DIVIDE',
'LPAREN',
'RPAREN',
'EOF',
'OPEN',
'CLOSE',
'BANG',
'ASSIGN',
'SEMI',
'ID'
)
| ASSIGN = 'ASSIGN'
BANG = 'BANG'
CLOSE = 'CLOSE'
DIVIDE = 'DIVIDE'
EOF = 'EOF'
ID = 'ID'
INTEGER = 'INTEGER'
LPAREN = 'LPAREN'
MINUS = 'MINUS'
MULTIPLY = 'MULTIPLY'
OPEN = 'OPEN'
PLUS = 'PLUS'
RPAREN = 'RPAREN'
SEMI = 'SEMI'
| Fix token names format for readability. | Fix token names format for readability.
| Python | mit | doubledherin/my_compiler |
9ce01dc752d62c62eb8b276698f7cf2d6bc5707f | transaction.py | transaction.py | import signature
class Transaction:
def __init__(self, data, signature):
self.data = data
self.signature = signature
def get_string(self):
return '%s (%s)' % (self.data, self.signature)
def sign_transaction(data, key):
return Transaction(data, signature.sign(key, data))
| import signature
class Transaction:
def __init__(self, data, author, signature):
self.data = data
self.author = author
self.signature = signature
def get_string(self):
return '%s (%s)' % (self.data, self.author)
def get_data(self):
return self.data
def get_au... | Add author public key info to Transaction class | Add author public key info to Transaction class
| Python | mit | jake-billings/research-blockchain |
b44dc164e6dd1e9a07f460c2be07829744029cea | server/tests/test_admin.py | server/tests/test_admin.py | """General functional tests for the Server admin."""
from sal.test_utils import AdminTestCase
class ServerAdminTest(AdminTestCase):
"""Test the admin site is configured to have all expected views."""
admin_endpoints = {
'apikey', 'businessunit', 'condition', 'fact', 'historicalfact',
'instal... | """General functional tests for the Server admin."""
from sal.test_utils import AdminTestCase
class ServerAdminTest(AdminTestCase):
"""Test the admin site is configured to have all expected views."""
admin_endpoints = {
'apikey', 'businessunit', 'condition', 'fact', 'historicalfact',
'instal... | Remove endpoint from test (it has been removed in lieu of User admin). | Remove endpoint from test (it has been removed in lieu of User admin).
| Python | apache-2.0 | sheagcraig/sal,salopensource/sal,sheagcraig/sal,sheagcraig/sal,sheagcraig/sal,salopensource/sal,salopensource/sal,salopensource/sal |
76bbaa5e0208e5c28747fff09388cd52ef63f6f5 | blackjax/__init__.py | blackjax/__init__.py | from .diagnostics import effective_sample_size as ess
from .diagnostics import potential_scale_reduction as rhat
from .kernels import (
adaptive_tempered_smc,
elliptical_slice,
ghmc,
hmc,
irmh,
mala,
meads,
mgrad_gaussian,
nuts,
orbital_hmc,
pathfinder_adaptation,
rmh,
... | from .diagnostics import effective_sample_size as ess
from .diagnostics import potential_scale_reduction as rhat
from .kernels import (
adaptive_tempered_smc,
elliptical_slice,
ghmc,
hmc,
irmh,
mala,
meads,
mgrad_gaussian,
nuts,
orbital_hmc,
pathfinder,
pathfinder_adaptat... | Add `pathfinder` to the library namespace | Add `pathfinder` to the library namespace
| Python | apache-2.0 | blackjax-devs/blackjax |
f48a9f088e383eb77c40b0196552590dc654cea7 | test/mbed_gt_cli.py | test/mbed_gt_cli.py | #!/usr/bin/env python
"""
mbed SDK
Copyright (c) 2011-2015 ARM Limited
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 ... | #!/usr/bin/env python
"""
mbed SDK
Copyright (c) 2011-2015 ARM Limited
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 ... | Add unit tests to mbed-greentea version printing API | Add unit tests to mbed-greentea version printing API
| Python | apache-2.0 | ARMmbed/greentea |
80a55580806f19e9e57d86a03768664caf35d54b | ci/generate_pipeline_yml.py | ci/generate_pipeline_yml.py | #!/usr/bin/env python
import os
from jinja2 import Template
clusters = ['1-12', '2-0', '2-1', '2-2']
tiles = [d for d in os.listdir('../examples') if os.path.isdir(os.path.join('../examples', d))]
with open('pipeline.yml.jinja2', 'r') as f:
t = Template(f.read());
with open('pipeline.yml', 'w') as f:
f.write(t.... | #!/usr/bin/env python
import os
from jinja2 import Template
clusters = ['1-12', '2-0', '2-1', '2-2']
# Commenting out this as we only have one example and it breaks
tiles = [] # [d for d in os.listdir('../examples') if os.path.isdir(os.path.join('../examples', d))]
with open('pipeline.yml.jinja2', 'r') as f:
t = T... | Comment out our one breaking example from pipeline | Comment out our one breaking example from pipeline
| Python | apache-2.0 | cf-platform-eng/tile-generator,cf-platform-eng/tile-generator,cf-platform-eng/tile-generator,cf-platform-eng/tile-generator |
f9c3e4b95cb38f5aff5bad6692ac4fe469f5444d | test/spambl_test.py | test/spambl_test.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
class DNSBLTest(unittest.TestCase):
pass
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testName']
unittest.main() | #!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
from spambl import DNSBL
class DNSBLTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
code_item_class = {1: 'Class #1', 2: 'Class #2'}
query_suffix = 'query.suffix'
cls.dnsbl = DNSBL('test.dnsbl', query_s... | Add setUpClass method to DNSBLTest | Add setUpClass method to DNSBLTest
This method is used to set up a common instance of DNSBL for testing
| Python | mit | piotr-rusin/spam-lists |
e4c5f68da949683232b520796b380e8b8f2163c7 | test/tiles/bigwig_test.py | test/tiles/bigwig_test.py | import clodius.tiles.bigwig as hgbi
import os.path as op
def test_bigwig_tiles():
filename = op.join('data', 'wgEncodeCaltechRnaSeqHuvecR1x75dTh1014IlnaPlusSignalRep2.bigWig')
meanval = hgbi.tiles(filename, ['x.0.0'])
minval = hgbi.tiles(filename, ['x.0.0.min'])
maxval = hgbi.tiles(filename, ['x.0.0.m... | import clodius.tiles.bigwig as hgbi
import os.path as op
def test_bigwig_tiles():
filename = op.join(
'data',
'wgEncodeCaltechRnaSeqHuvecR1x75dTh1014IlnaPlusSignalRep2.bigWig'
)
meanval = hgbi.tiles(filename, ['x.0.0'])
minval = hgbi.tiles(filename, ['x.0.0.min'])
maxval = hgbi.tiles(... | Test for bigWig aggregation modes | Test for bigWig aggregation modes
| Python | mit | hms-dbmi/clodius,hms-dbmi/clodius |
23de595bdf9d87dc4841138b6ae284faeda4b856 | banner/forms.py | banner/forms.py | from django import forms
from django.utils.translation import ugettext as _
class ImportForm(forms.Form):
csv_file = forms.FileField(
required=True,
label=_('CSV File'),
help_text=_('CSV File containing import data.')
)
def __init__(self, model, *args, **kwargs):
super(Imp... | from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from jmbo.admin import ModelBaseAdminForm
from banner.styles import BANNER_STYLE_CLASSES
class ImportForm(forms.Form):
csv_file = forms.FileField(
re... | Use custom form for Banner model because style is a special case | Use custom form for Banner model because style is a special case
| Python | bsd-3-clause | praekelt/jmbo-banner,praekelt/jmbo-banner |
65bfede8d8739699e57ddd4f66049ac0374d1a8d | ydf/instructions.py | ydf/instructions.py | """
ydf/instructions
~~~~~~~~~~~~~~~~
Convert objects parsed from YAML to those that represent Dockerfile instructions.
"""
__all__ = []
FROM = 'FROM'
RUN = 'RUN'
CMD = 'CMD'
LABEL = 'LABEL'
EXPOSE = 'EXPOSE'
ENV = 'ENV'
ADD = 'ADD'
COPY = 'COPY'
ENTRYPOINT = 'ENTRYPOINT'
VOLUME = 'VOLUME'
USER = 'USER'... | """
ydf/instructions
~~~~~~~~~~~~~~~~
Convert objects parsed from YAML to those that represent Dockerfile instructions.
"""
import collections
import functools
from ydf import meta
__all__ = []
FROM = 'FROM'
RUN = 'RUN'
CMD = 'CMD'
LABEL = 'LABEL'
EXPOSE = 'EXPOSE'
ENV = 'ENV'
ADD = 'ADD'
COPY = 'COP... | Add @instruction decorator to mark module level funcs as handlers. | Add @instruction decorator to mark module level funcs as handlers.
| Python | apache-2.0 | ahawker/ydf |
39bd25ffa9a90fb4dbbd63321eeee4acd84b8781 | tests/test_movingfiles.py | tests/test_movingfiles.py | #!/usr/bin/env python
#encoding:utf-8
#author:dbr/Ben
#project:tvnamer
#repository:http://github.com/dbr/tvnamer
#license:Creative Commons GNU GPL v2
# http://creativecommons.org/licenses/GPL/2.0/
"""Tests moving renamed files
"""
from functional_runner import run_tvnamer, verify_out_data
def test_simple_realtive_m... | #!/usr/bin/env python
#encoding:utf-8
#author:dbr/Ben
#project:tvnamer
#repository:http://github.com/dbr/tvnamer
#license:Creative Commons GNU GPL v2
# http://creativecommons.org/licenses/GPL/2.0/
"""Tests moving renamed files
"""
from functional_runner import run_tvnamer, verify_out_data
def test_simple_realtive_m... | Add more complex move_file test | Add more complex move_file test | Python | unlicense | lahwaacz/tvnamer,m42e/tvnamer,dbr/tvnamer |
a7c78d0abb2ce3b44c8db67b12d658bed960306f | tests/types/test_arrow.py | tests/types/test_arrow.py | from datetime import datetime
from pytest import mark
import sqlalchemy as sa
from sqlalchemy_utils.types import arrow
from tests import TestCase
@mark.skipif('arrow.arrow is None')
class TestArrowDateTimeType(TestCase):
def create_models(self):
class Article(self.Base):
__tablename__ = 'artic... | from datetime import datetime
from pytest import mark
import sqlalchemy as sa
from sqlalchemy_utils.types import arrow
from tests import TestCase
@mark.skipif('arrow.arrow is None')
class TestArrowDateTimeType(TestCase):
def create_models(self):
class Article(self.Base):
__tablename__ = 'artic... | Add tz tests for ArrowType | Add tz tests for ArrowType
| Python | bsd-3-clause | joshfriend/sqlalchemy-utils,tonyseek/sqlalchemy-utils,tonyseek/sqlalchemy-utils,rmoorman/sqlalchemy-utils,marrybird/sqlalchemy-utils,cheungpat/sqlalchemy-utils,joshfriend/sqlalchemy-utils,JackWink/sqlalchemy-utils,konstantinoskostis/sqlalchemy-utils,spoqa/sqlalchemy-utils |
a29d4c9ea531552886734b3217a18c2128ddc233 | byceps/util/money.py | byceps/util/money.py | """
byceps.util.money
~~~~~~~~~~~~~~~~~
Handle monetary amounts.
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from decimal import Decimal
import locale
TWO_PLACES = Decimal('.00')
def format_euro_amount(x: Decimal) -> str:
"""Return a textual representation ... | """
byceps.util.money
~~~~~~~~~~~~~~~~~
Handle monetary amounts.
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from decimal import Decimal
import locale
TWO_PLACES = Decimal('.00')
def format_euro_amount(x: Decimal) -> str:
"""Return a textual representation ... | Use `locale.format_string` to format monetary amounts | Use `locale.format_string` to format monetary amounts
Previously used `locale.format` is deprecated as of Python 3.7 and
suggests to use `format_string` instead.
| Python | bsd-3-clause | m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps |
eb78719ad6bd8d3d2d5f1160c9fe8d300d867ee3 | isthatanearthquake/urls.py | isthatanearthquake/urls.py | from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'isthatanearthquake.views.home', name='home'),
# url(r'^isthatanearthquake/', include('isthatanearthquake.foo.urls')),
url(r'^admin/doc... | from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'isthatanearthquake.views.home', name='home'),
# url(r'^isthatanearthquake/', include('isthatanearthquake.foo.urls')),
url(r'^admin/doc... | Include URLs from the quake project. | Include URLs from the quake project. | Python | bsd-3-clause | adamfast/isthatanearthquake |
b2b5b82632e1feee76ee9d4f6a9a070b350114b7 | vim_turing_machine/machines/merge_business_hours/encode_hours.py | vim_turing_machine/machines/merge_business_hours/encode_hours.py | """Encodes a json representation of the business's hours into the 5-bit binary
representation used by the merge business hours turing machine. It takes input
from stdin and outputs the initial tape."""
import json
import sys
from vim_turing_machine.constants import BITS_PER_NUMBER
from vim_turing_machine.constants imp... | """Encodes a json representation of the business's hours into the 5-bit binary
representation used by the merge business hours turing machine. It takes input
from stdin and outputs the initial tape."""
import json
import sys
from vim_turing_machine.constants import BITS_PER_NUMBER
def encode_hours(hours, num_bits=BI... | Remove blank space at beginning | Remove blank space at beginning
| Python | mit | ealter/vim_turing_machine,ealter/vim_turing_machine |
1bd287d3f6f7545e47364832a824e7380c6609e8 | web/core/api/resources.py | web/core/api/resources.py | import tastypie.resources
import tastypie.authentication
import django.db.models
import web.core.models
import web.core.api.authorization
class FileResource(tastypie.resources.ModelResource):
class Meta:
queryset = web.core.models.File.objects.all()
allowed_methods = ['get', 'post']
authe... | import tastypie.resources
import tastypie.authentication
import tastypie.fields
import django.contrib.auth.models
import web.core.models
import web.core.api.authorization
class FileResource(tastypie.resources.ModelResource):
class Meta:
queryset = web.core.models.File.objects.all()
allowed_method... | Allow files to be uploaded through the TastyPie API | Allow files to be uploaded through the TastyPie API
| Python | bsd-3-clause | ambientsound/rsync,ambientsound/rsync,ambientsound/rsync,ambientsound/rsync |
f90cd0883a9a9301f359c7a238aba223756c6765 | klustakwik2/numerics/cylib/compute_cluster_masks.py | klustakwik2/numerics/cylib/compute_cluster_masks.py | from .compute_cluster_masks_cy import doaccum
__all__ = ['accumulate_cluster_mask_sum']
def accumulate_cluster_mask_sum(kk, cluster_mask_sum):
data = kk.data
doaccum(kk.clusters, data.unmasked, data.unmasked_start, data.unmasked_end,
data.masks, data.values_start, data.values_end, cluster_mask_sum... | from .compute_cluster_masks_cy import doaccum
__all__ = ['accumulate_cluster_mask_sum']
def accumulate_cluster_mask_sum(kk, cluster_mask_sum):
data = kk.data
doaccum(kk.clusters, data.unmasked, data.unmasked_start, data.unmasked_end,
data.masks, data.values_start, data.values_end, cluster_mask_sum... | Fix for some version of py64 on win64 | Fix for some version of py64 on win64
| Python | bsd-3-clause | benvermaercke/klustakwik2,kwikteam/klustakwik2 |
cf3ff4d78a9a64c0c0e8d274ca36f68e9290b463 | tests/seattle_benchmark.py | tests/seattle_benchmark.py | ## Copyright (c) Cognitect, Inc.
## All rights reserved.
from transit.reader import JsonUnmarshaler
import json
import time
from StringIO import StringIO
def run_tests(data):
datas = StringIO(data)
t = time.time()
JsonUnmarshaler().load(datas)
et = time.time()
datas = StringIO(data)
tt = time.t... | ## Copyright (c) Cognitect, Inc.
## All rights reserved.
from transit.reader import JsonUnmarshaler
import json
import time
from StringIO import StringIO
def run_tests(data):
datas = StringIO(data)
t = time.time()
JsonUnmarshaler().load(datas)
et = time.time()
datas = StringIO(data)
tt = time.t... | Update Seattle to print the mean at the end | Update Seattle to print the mean at the end
| Python | apache-2.0 | cognitect/transit-python,cognitect/transit-python,dand-oss/transit-python,dand-oss/transit-python |
f5543f10208ed4eef9d0f1a0a208e03e72709f40 | windpowerlib/wind_farm.py | windpowerlib/wind_farm.py | """
The ``wind_farm`` module contains the class WindFarm that implements
a wind farm in the windpowerlib and functions needed for the modelling of a
wind farm.
"""
__copyright__ = "Copyright oemof developer group"
__license__ = "GPLv3"
import numpy as np
class WindFarm(object):
"""
"""
def __init_... | """
The ``wind_farm`` module contains the class WindFarm that implements
a wind farm in the windpowerlib and functions needed for the modelling of a
wind farm.
"""
__copyright__ = "Copyright oemof developer group"
__license__ = "GPLv3"
import numpy as np
class WindFarm(object):
"""
def __init__(self, ... | Change parameters power_curve and power_output to attributes | Change parameters power_curve and power_output to attributes
| Python | mit | wind-python/windpowerlib |
3b4af27a5e6a13e384852d31108449aa60f30fa2 | tools/gdb/gdb_chrome.py | tools/gdb/gdb_chrome.py | #!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""GDB support for Chrome types.
Add this to your gdb by amending your ~/.gdbinit as follows:
python
import sys
sys.path.insert(... | #!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""GDB support for Chrome types.
Add this to your gdb by amending your ~/.gdbinit as follows:
python
import sys
sys.path.insert(... | Add FilePath to the gdb pretty printers. | Add FilePath to the gdb pretty printers.
Review URL: http://codereview.chromium.org/6621017
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@76956 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | ropik/chromium,adobe/chromium,gavinp/chromium,yitian134/chromium,gavinp/chromium,ropik/chromium,ropik/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,ropik/chromium,ropik/chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,gavinp/chromium,yitian134/chromium,ropik/chromium,yitian134/chromium,ropik/ch... |
ece6799fce381c5047c510f3db0303ff62195cc6 | datapipe/targets/objects.py | datapipe/targets/objects.py | from ..target import Target
import hashlib
import dill
import joblib
class PyTarget(Target):
def __init__(self, name, obj=None):
self._name = name
self._obj = obj
super(PyTarget, self).__init__()
if not obj is None:
self.set(obj)
def identifier(self):
return... | from ..target import Target
import hashlib
import dill
import joblib
class PyTarget(Target):
def __init__(self, name, obj=None):
self._name = name
self._obj = obj
super(PyTarget, self).__init__()
if not obj is None:
self.set(obj)
def identifier(self):
return... | Fix up to date checks for PyTarget | Fix up to date checks for PyTarget
| Python | mit | ibab/datapipe |
13c0d58f1625c11f041a23ef442c86370cd41f1c | src/ros_sdp/sdp_publisher.py | src/ros_sdp/sdp_publisher.py | import os
import rospy
from std_msgs.msg import String
# Don't do this in your code, mkay? :)
fib = lambda n: n if n < 2 else fib(n-1) + fib(n-2)
class SDPPublisher(object):
def __init__(self):
self.pub = rospy.Publisher('sdp_ros_fib',
String,
... | import os
import rospy
from std_msgs.msg import String
# Don't do this in your code, mkay? :)
fib = lambda n: n if n < 2 else fib(n-1) + fib(n-2)
class SDPPublisher(object):
def __init__(self):
self.pub = rospy.Publisher('sdp_ros_fib',
String,
... | Remove tester code in publisher | Remove tester code in publisher
| Python | mit | edran/ros_sdp |
74fa1bf956952df4cddd7420610475725a473831 | userkit/__init__.py | userkit/__init__.py | from requestor import Requestor
from users import UserManager
from invites import InviteManager
from emails import EmailManager
from session import Session
from widget import WidgetManager
class UserKit(object):
_rq = None
api_version = 1.0
api_base_url = None
api_key = None
users = None
invit... | from requestor import Requestor
from users import UserManager
from invites import InviteManager
from emails import EmailManager
from session import Session
from widget import WidgetManager
from logs import LogsManager
class UserKit(object):
_rq = None
api_version = 1.0
api_base_url = None
api_key = No... | Add LogsManager to UserKit constructor | Add LogsManager to UserKit constructor
| Python | mit | workpail/userkit-python |
221cfd23efde8d0ccc096da57aa95ad44c3a83a0 | django/generate_fixtures.py | django/generate_fixtures.py | from django.core.management.base import BaseCommand, CommandError
from {{{ app_name }}} import model_factories
MAX_RECORDS = 10
class Command(BaseCommand):
help = 'Adds all fixture data.'
def handle(self, *args, **options):
for _ in xrange(MAX_RECORDS):{%% for model_name in all_models %%}{%% set mod... | from django.core.management.base import BaseCommand, CommandError
from {{{ project }}}.{{{ app_name }}} import model_factories
MAX_RECORDS = 10
class Command(BaseCommand):
help = 'Adds all fixture data.'
def handle(self, *args, **options):
for _ in xrange(MAX_RECORDS):{%% for model_name in all_model... | Use proper relative path in django commands file | Use proper relative path in django commands file
| Python | apache-2.0 | christabor/Skaffold,christabor/Skaffold |
b01a1c3b03c5d87c3fbf13d06c72849da2bab12e | web/django/emca/urls.py | web/django/emca/urls.py | from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('emca.views',
# test
url(r'^$', 'index'),
# catmaid
url(r'^catmaid/(?P<webargs>\w+/.*)$', 'catmaid'),
# fetch ids (with predic... | from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
#from django.contrib import admin
#admin.autodiscover()
urlpatterns = patterns('emca.views',
# test
url(r'^$', 'index'),
# catmaid
url(r'^catmaid/(?P<webargs>\w+/.*)$', 'catmaid'),
# fetch ids (with pred... | Remove admin interface from emca. | Remove admin interface from emca.
| Python | apache-2.0 | openconnectome/open-connectome,openconnectome/open-connectome,neurodata/ndstore,openconnectome/open-connectome,neurodata/ndstore,openconnectome/open-connectome,neurodata/ndstore,openconnectome/open-connectome,openconnectome/open-connectome,neurodata/ndstore |
d3de354717fdb15d6e883f38d87eba4806fd5cc7 | wafer/pages/urls.py | wafer/pages/urls.py | from django.conf.urls import patterns, url, include
from django.core.urlresolvers import get_script_prefix
from django.views.generic import RedirectView
from rest_framework import routers
from wafer.pages.views import PageViewSet
router = routers.DefaultRouter()
router.register(r'pages', PageViewSet)
urlpatterns = p... | from django.conf.urls import patterns, url, include
from rest_framework import routers
from wafer.pages.views import PageViewSet
router = routers.DefaultRouter()
router.register(r'pages', PageViewSet)
urlpatterns = patterns(
'wafer.pages.views',
url(r'^api/', include(router.urls)),
url(r'^(?:(.+)/)?$', '... | Drop index redirect, no longer needed | Drop index redirect, no longer needed
| Python | isc | CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer |
013154d359570d591f9315b10c738616d9cddb49 | loqusdb/build_models/profile_variant.py | loqusdb/build_models/profile_variant.py | import logging
import json
from loqusdb.models import ProfileVariant
from .variant import get_variant_id
LOG = logging.getLogger(__name__)
def get_maf(variant):
"""
if ID CAF exists in INFO column, return the allele frequency for
the alt allele. The CAF INFO tag from dbSNP is a Comma delimited li... | import logging
from loqusdb.models import ProfileVariant
from .variant import get_variant_id
LOG = logging.getLogger(__name__)
def get_maf(variant):
"""
Gets the MAF (minor allele frequency) tag from the info field for the
variant.
Args:
variant (cyvcf2.Variant)
Retu... | Change from CAF to MAF tag when looking for MAF in vcf file | Change from CAF to MAF tag when looking for MAF in vcf file
| Python | mit | moonso/loqusdb |
0ab4a593781dea4bf7c2f631a88f906f4aa7e329 | swift/obj/dedupe/fp_index.py | swift/obj/dedupe/fp_index.py | __author__ = 'mjwtom'
import sqlite3
import unittest
class fp_index:
def __init__(self, name):
if name.endswith('.db'):
self.name = name
else:
self.name = name + '.db'
self.conn = sqlite3.connect(name)
self.c = self.conn.cursor()
self.c.execute('''C... | __author__ = 'mjwtom'
import sqlite3
import unittest
class Fp_Index(object):
def __init__(self, name):
if name.endswith('.db'):
self.name = name
else:
self.name = name + '.db'
self.conn = sqlite3.connect(name)
self.c = self.conn.cursor()
self.c.exec... | Use database to detect the duplication. But the md5 value does not match. Need to add some code here | Use database to detect the duplication. But the md5 value does not match. Need to add some code here
| Python | apache-2.0 | mjwtom/swift,mjwtom/swift |
e951dde14f65e188118c2eb9e8825d317ada488a | yunity/groups/models.py | yunity/groups/models.py | from django.db.models import TextField, ManyToManyField
from yunity.base.base_models import BaseModel, LocationModel
from config import settings
class Group(BaseModel, LocationModel):
name = TextField()
description = TextField(null=True)
members = ManyToManyField(settings.AUTH_USER_MODEL)
| from django.db.models import TextField, ManyToManyField
from yunity.base.base_models import BaseModel, LocationModel
from config import settings
class Group(BaseModel, LocationModel):
name = TextField()
description = TextField(null=True)
members = ManyToManyField(settings.AUTH_USER_MODEL, related_name='gr... | Add related name for group member | Add related name for group member
| Python | agpl-3.0 | yunity/yunity-core,yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/foodsaving-backend |
b3525570929ba47c10d9d08696876c39487f7000 | test/mitmproxy/contentviews/test_xml_html.py | test/mitmproxy/contentviews/test_xml_html.py | import pytest
from mitmproxy.contentviews import xml_html
from mitmproxy.test import tutils
from . import full_eval
data = tutils.test_data.push("mitmproxy/contentviews/test_xml_html_data/")
def test_simple():
v = full_eval(xml_html.ViewXmlHtml())
assert v(b"foo") == ('XML', [[('text', 'foo')]])
assert ... | import pytest
from mitmproxy.contentviews import xml_html
from mitmproxy.test import tutils
from . import full_eval
data = tutils.test_data.push("mitmproxy/contentviews/test_xml_html_data/")
def test_simple():
v = full_eval(xml_html.ViewXmlHtml())
assert v(b"foo") == ('XML', [[('text', 'foo')]])
assert ... | Fix test_format_xml with dot in path | Fix test_format_xml with dot in path
When the path contains dot ".", replacing all dots will generate a non-exist result and raises a FileNotFoundError. Replacing only the last dot fixes this. | Python | mit | ujjwal96/mitmproxy,MatthewShao/mitmproxy,cortesi/mitmproxy,ddworken/mitmproxy,vhaupert/mitmproxy,cortesi/mitmproxy,mitmproxy/mitmproxy,Kriechi/mitmproxy,mhils/mitmproxy,mhils/mitmproxy,xaxa89/mitmproxy,zlorb/mitmproxy,mitmproxy/mitmproxy,ujjwal96/mitmproxy,zlorb/mitmproxy,cortesi/mitmproxy,mhils/mitmproxy,mitmproxy/mit... |
a12c61d5e86f10d0f0b310c9204d56d2defd8f8d | src/monitors/checks/http-get-statuscode/__init__.py | src/monitors/checks/http-get-statuscode/__init__.py | #!/usr/bin/python
######################################################################
# Cloud Routes Availability Manager: http-get-statuscode module
# ------------------------------------------------------------------
# This is a moduel for performing http get based health checks.
# This will return true if no erro... | #!/usr/bin/python
######################################################################
# Cloud Routes Availability Manager: http-get-statuscode module
# ------------------------------------------------------------------
# This is a moduel for performing http get based health checks.
# This will return true if no erro... | Add logging to http-get-statuscode monitor for docs example | Add logging to http-get-statuscode monitor for docs example
| Python | unknown | codecakes/cloudroutes-service,dethos/cloudroutes-service,rbramwell/runbook,rbramwell/runbook,dethos/cloudroutes-service,rbramwell/runbook,madflojo/cloudroutes-service,Runbook/runbook,asm-products/cloudroutes-service,codecakes/cloudroutes-service,madflojo/cloudroutes-service,Runbook/runbook,madflojo/cloudroutes-service,... |
c73d24259a6aa198d749fba097999ba2c18bd6da | website/addons/figshare/settings/defaults.py | website/addons/figshare/settings/defaults.py | API_URL = 'http://api.figshare.com/v1/'
API_OAUTH_URL = API_URL + 'my_data/'
MAX_RENDER_SIZE = 1000
| CLIENT_ID = None
CLIENT_SECRET = None
API_URL = 'http://api.figshare.com/v1/'
API_OAUTH_URL = API_URL + 'my_data/'
MAX_RENDER_SIZE = 1000
| Add figshare CLIENT_ID and CLIENT_SECRET back into default settings. | Add figshare CLIENT_ID and CLIENT_SECRET back into default settings.
[skip ci]
| Python | apache-2.0 | mattclark/osf.io,brandonPurvis/osf.io,TomBaxter/osf.io,jnayak1/osf.io,SSJohns/osf.io,revanthkolli/osf.io,kch8qx/osf.io,amyshi188/osf.io,GaryKriebel/osf.io,fabianvf/osf.io,revanthkolli/osf.io,jinluyuan/osf.io,cldershem/osf.io,KAsante95/osf.io,lamdnhan/osf.io,caseyrygt/osf.io,leb2dg/osf.io,HarryRybacki/osf.io,caneruguz/o... |
e81e25f1d97ef4f141e392bda736aaa6a37aadf5 | chatbot/botui.py | chatbot/botui.py | import numpy as np
import os
import sys
import tensorflow as tf
from settings import PROJECT_ROOT
from chatbot.tokenizeddata import TokenizedData
from chatbot.botpredictor import BotPredictor
def bot_ui():
data_file = os.path.join(PROJECT_ROOT, 'Data', 'Corpus', 'basic_conv.txt')
td = TokenizedData(seq_lengt... | import numpy as np
import os
import sys
import tensorflow as tf
from settings import PROJECT_ROOT
from chatbot.tokenizeddata import TokenizedData
from chatbot.botpredictor import BotPredictor
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
def bot_ui():
dict_file = os.path.join(PROJECT_ROOT, 'Data', 'Result', 'dicts.pi... | Optimize the UI and allow the user to exit the program smoothly. | Optimize the UI and allow the user to exit the program smoothly.
| Python | apache-2.0 | bshao001/ChatLearner,bshao001/ChatLearner,bshao001/ChatLearner,bshao001/ChatLearner |
d7bd0ff21a32806459dcb45cea9c1d1faacc0f51 | scraper/fedtext/spiders/tutorial_spider.py | scraper/fedtext/spiders/tutorial_spider.py | import scrapy
from bs4 import BeautifulSoup
from bs4.element import Comment
class TutorialSpider(scrapy.Spider):
name = "tutorialspider"
allowed_domains = ['*.gov']
start_urls = ['http://www.recreation.gov']
def visible(self, element):
""" Return True if the element text is visible (in the ren... | import scrapy
from bs4 import BeautifulSoup
from bs4.element import Comment
from fedtext.items import FedTextItem
class TutorialSpider(scrapy.Spider):
name = "tutorialspider"
allowed_domains = ['*.gov']
start_urls = ['http://www.recreation.gov']
def visible(self, element):
""" Return True if ... | Use a faster parser for bs4 | Use a faster parser for bs4
| Python | cc0-1.0 | khandelwal/fedtext |
fe2fdd17dcf05e7464e9b5cdeccbf7e884c0ee38 | cob/subsystems/models_subsystem.py | cob/subsystems/models_subsystem.py | import os
import logbook
from .base import SubsystemBase
from ..ctx import context
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
_logger = logbook.Logger(__name__)
class ModelsSubsystem(SubsystemBase):
NAME = 'models'
def activate(self, flask_app):
database_uri = os.... | import os
import logbook
from .base import SubsystemBase
from ..ctx import context
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
_logger = logbook.Logger(__name__)
class ModelsSubsystem(SubsystemBase):
NAME = 'models'
def activate(self, flask_app):
env_override = os.... | Make COB_DATABASE_URI environment variable override existing settings | Make COB_DATABASE_URI environment variable override existing settings
| Python | bsd-3-clause | getweber/weber-cli |
b4687eb7fda33323cad8d42f9819a3ee223d3822 | web/config/local_settings.py | web/config/local_settings.py | import os
from datetime import datetime
LOG_DIR = '/var/log/graphite'
if os.getenv("CARBONLINK_HOSTS"):
CARBONLINK_HOSTS = os.getenv("CARBONLINK_HOSTS").split(',')
if os.getenv("CLUSTER_SERVERS"):
CLUSTER_SERVERS = os.getenv("CLUSTER_SERVERS").split(',')
if os.getenv("MEMCACHE_HOSTS"):
CLUSTER_SERVERS = ... | import os
import json, requests
from datetime import datetime
LOG_DIR = '/var/log/graphite'
if os.getenv("CARBONLINK_HOSTS"):
CARBONLINK_HOSTS = os.getenv("CARBONLINK_HOSTS").split(',')
if os.getenv("CLUSTER_SERVERS"):
CLUSTER_SERVERS = os.getenv("CLUSTER_SERVERS").split(',')
elif os.getenv("RANCHER_GRAPHITE_... | Add graphite cluster discovery support using rancher | Add graphite cluster discovery support using rancher
| Python | apache-2.0 | Banno/graphite-setup,Banno/graphite-setup,Banno/graphite-setup |
1c482edbc29d008a8de9a0762c1a85027de083cc | src/spz/test/test_views.py | src/spz/test/test_views.py | # -*- coding: utf-8 -*-
"""Tests the application views.
"""
import pytest
from spz import app
from util.init_db import recreate_tables, insert_resources
from util.build_assets import build_assets
@pytest.fixture
def client():
client = app.test_client()
recreate_tables()
insert_resources()
build_as... | # -*- coding: utf-8 -*-
"""Tests the application views.
"""
import pytest
from spz import app
from util.init_db import recreate_tables, insert_resources
@pytest.fixture
def client():
client = app.test_client()
recreate_tables()
insert_resources()
yield client
def test_startpage(client):
asse... | Remove build_assets from test since test client will neither interprete css nor javascript | Remove build_assets from test since test client will neither interprete css nor javascript
| Python | mit | spz-signup/spz-signup |
0808e3f5897028a1f174e21200870e4be6fcad11 | apps/quotes/admin.py | apps/quotes/admin.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from .models import Quote
class QuoteAdmin(admin.ModelAdmin):
fieldsets = (
(None, {'fields': ('text', ('timestamp', 'subject'),)}),
('Metadata', {'fields': ('creator', 'broadcast', 'game')})
)
list_display = ['text', 'timestamp', '... | # -*- coding: utf-8 -*-
from django.contrib import admin
from .models import Quote
class QuoteAdmin(admin.ModelAdmin):
fieldsets = (
(None, {'fields': ('text', ('timestamp', 'subject'),)}),
('Metadata', {'fields': ('creator', 'broadcast', 'game')})
)
list_display = ['text', 'timestamp', '... | Make broadcast editable for now. | Make broadcast editable for now.
| Python | apache-2.0 | bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv |
4a6449b806dc755fe3f9d18966c0420da2a4d0fc | devito/dle/manipulation.py | devito/dle/manipulation.py | import cgen as c
from devito.codeprinter import ccode
from devito.nodes import Element, Iteration
from devito.visitors import MergeOuterIterations
__all__ = ['compose_nodes', 'copy_arrays']
def compose_nodes(nodes):
"""Build an Iteration/Expression tree by nesting the nodes in ``nodes``."""
l = list(nodes)
... | from sympy import Eq
from devito.codeprinter import ccode
from devito.nodes import Expression, Iteration
from devito.visitors import MergeOuterIterations
__all__ = ['compose_nodes', 'copy_arrays']
def compose_nodes(nodes):
"""Build an Iteration/Expression tree by nesting the nodes in ``nodes``."""
l = list(... | Use Expression, not Element, in copy_arrays | dle: Use Expression, not Element, in copy_arrays
| Python | mit | opesci/devito,opesci/devito |
ed0d2f78bee4c7082be99683d2905e308f526d0c | diapason/dub.py | diapason/dub.py | """
Dub module that can be used when ffmpeg is available to deal with different
audio formats.
"""
from io import BytesIO
from pydub import AudioSegment
def convert_wav(wav, coding_format='mpeg', **kwargs):
"""
Convert a WAV file to other formats.
"""
assert coding_format in ('mpeg',)
if coding_f... | """
Dub module that can be used when ffmpeg is available to deal with different
audio formats.
"""
from io import BytesIO
from pydub import AudioSegment
def convert_wav(wav, coding_format='mpeg', **kwargs):
"""
Convert a WAV file to other formats.
"""
assert coding_format in ('mpeg', 'vorbis')
if... | Allow converting WAV to vorbis as well | Allow converting WAV to vorbis as well
| Python | bsd-3-clause | Soundphy/diapason |
01daa7448260552113aa68f18c215c192e95324e | editorsnotes/auth/forms.py | editorsnotes/auth/forms.py | from django import forms
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from .models import User, Project
class ENUserCreationForm(UserCreationForm):
class Meta:
model = User
fields = ('email', 'display_name')
def clean_email(self):
# Since User.email is u... | from django import forms
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from rest_framework.authtoken.models import Token
from .models import User, Project
class ENUserCreationForm(UserCreationForm):
class Meta:
model = User
fields = ('email', 'display_name')
def... | Allow tokens to be created/changed on profile settings page | Allow tokens to be created/changed on profile settings page
| Python | agpl-3.0 | editorsnotes/editorsnotes,editorsnotes/editorsnotes |
8c1b2f1fc71be754898bf962306c325538a589bf | contentdensity/textifai/views.py | contentdensity/textifai/views.py | from django.shortcuts import render
from .models import User, Text, Insight, Comment
# Create your views here.
def index(request):
"""
View function for the homepage of the site
"""
return render(request, 'index.html', context={})
def textinput(request):
"""
View function for the text input p... | from django.shortcuts import render
from .models import User, Text, Insight, Comment
# Create your views here.
def index(request):
"""
View function for the homepage of the site
"""
return render(request, 'index.html', context={})
def textinput(request):
"""
View function for the text input p... | Add view definition for the general-insights page | Add view definition for the general-insights page
| Python | mit | CS326-important/space-deer,CS326-important/space-deer |
046ab8fc0f60b15ccdafcbb549c7de894ecd064e | putio_cli/commands/base.py | putio_cli/commands/base.py | """The base command."""
import ConfigParser
import os
import putiopy
class Base(object):
"""A base command."""
def __init__(self, options):
self.options = options
def run(self):
raise NotImplementedError(
'You must implement the run() method yourself!')
class BaseClient(B... | """The base command."""
import ConfigParser
import os
import putiopy
class Base(object):
"""A base command."""
def __init__(self, options):
self.options = options
class BaseClient(Base):
"""A base client command."""
def __init__(self, options):
# update options from config file
... | Remove run method (useless) in Base class | Remove run method (useless) in Base class
| Python | mit | jlejeune/putio-cli |
4e306441cbfab5f56eaedcd9af8f71f84e40467c | tests/pytests/unit/states/test_makeconf.py | tests/pytests/unit/states/test_makeconf.py | """
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import pytest
import salt.states.makeconf as makeconf
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {makeconf: {}}
def test_present():
"""
Test to verify that the variable is in the `... | """
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import pytest
import salt.states.makeconf as makeconf
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {makeconf: {}}
def test_present():
"""
Test to verify that the variable is in the `... | Move makeconf state tests to pytest | Move makeconf state tests to pytest
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt |
859722fea0ed205c1af37c43c211d2f2855d22fc | fonts/create.py | fonts/create.py | import fontforge
fontforge.open('input.otf').save('termu.sfd')
| import fontforge
font = fontforge.open('input.otf')
font.fontname = 'Termu-' + font.fontname
font.familyname = 'Termu: ' + font.familyname
font.fullname = 'Termu: ' + font.fullname
font.save('termu.sfd')
| Add "termu" to the name of the font | Add "termu" to the name of the font
| Python | mit | CoderPuppy/cc-emu,CoderPuppy/cc-emu,CoderPuppy/cc-emu |
53add68f6ceb1f326f8162a361cf442b741d7470 | app/__init__.py | app/__init__.py | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_oauthlib.client import OAuth
from config import config
db = SQLAlchemy()
lm = LoginManager()
oauth = OAuth()
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(config[config... | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_oauthlib.client import OAuth
from config import config
db = SQLAlchemy()
oauth = OAuth()
lm = LoginManager()
lm.login_view = "views.login"
from app.models import User
@lm.user_loader
def load_user(id):
... | Set user loader and login view | Set user loader and login view
| Python | mit | Encrylize/MyDictionary,Encrylize/MyDictionary,Encrylize/MyDictionary |
2ed812ddc50bd262aadd74e01f24c8346d7ec8f7 | scripts/fix_country_ids.py | scripts/fix_country_ids.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Fix some iso3 IDs that are wrong in ne_10m_admin_0_countries_lakes.shp,
# ne_10m_admin_1_states_provinces_lakes.shp seems ok though.
import json
import os
file_dest = os.path.abspath(
os.path.join(os.path.dirname(__file__), '../data/countries.json'))
replacements = ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Fix some iso3 IDs that are wrong in ne_10m_admin_0_countries_lakes.shp,
# ne_10m_admin_1_states_provinces_lakes.shp seems ok though.
#
# Not all the SU_A3 IDs match those used in the ISO_A3 standard. This script replaces non-matching IDs
# with corresponding ISO_A3 values... | Add more details about issue being fixed | Add more details about issue being fixed
| Python | mit | elaOnMars/d3-geomap,yaph/d3-geomap,elaOnMars/d3-geomap,elaOnMars/d3-geomap,yaph/d3-geomap |
b38a55302540507c43f56ed9c9c6c55d3ea7be8f | backend/websocket_server.py | backend/websocket_server.py | import thread
import json
from SimpleWebSocketServer import WebSocket, SimpleWebSocketServer
from game import Game
def client_thread(game, conn, data):
player = game.add_player(conn, data)
while True:
answer_data = game.wait_for_answer(player)
if answer_data:
conn.sendMessage(answ... | import thread
import json
import time
from SimpleWebSocketServer import WebSocket, SimpleWebSocketServer
from game import Game
def client_thread(game, conn, data):
player = game.add_player(conn, data)
while True:
answer_data = game.wait_for_answer(player)
if answer_data:
conn.send... | Fix high cpu usage through sleep | Fix high cpu usage through sleep
| Python | mit | HPI-Hackathon/cartets,HPI-Hackathon/cartets,HPI-Hackathon/cartets |
c00b673a03d1f52b0b92d0fec96a16ffc4985fd8 | go/apps/urls.py | go/apps/urls.py | from django.conf.urls.defaults import patterns, url, include
urlpatterns = patterns('',
url(r'^survey/',
include('go.apps.surveys.urls', namespace='survey')),
url(r'^multi_survey/',
include('go.apps.multi_surveys.urls', namespace='multi_survey')),
url(r'^bulk_message/',
include('go.... | from django.conf.urls.defaults import patterns, url, include
urlpatterns = patterns('',
url(r'^survey/',
include('go.apps.surveys.urls', namespace='survey')),
url(r'^multi_survey/',
include('go.apps.multi_surveys.urls', namespace='multi_survey')),
url(r'^bulk_message/',
include('go.... | Add template path and URLs. | Add template path and URLs.
| Python | bsd-3-clause | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go |
0137d5440f86a8f1424598beea4468ae8c68f985 | demos/dlgr/demos/iterated_drawing/models.py | demos/dlgr/demos/iterated_drawing/models.py | from dallinger.nodes import Source
import random
import base64
import os
import json
class DrawingSource(Source):
"""A Source that reads in a random image from a file and transmits it."""
__mapper_args__ = {
"polymorphic_identity": "drawing_source"
}
def _contents(self):
"""Define th... | from dallinger.nodes import Source
import random
import base64
import os
import json
class DrawingSource(Source):
"""A Source that reads in a random image from a file and transmits it."""
__mapper_args__ = {
"polymorphic_identity": "drawing_source"
}
def _contents(self):
"""Define th... | Comment explaining random.choice() on 1-item list | Comment explaining random.choice() on 1-item list
| Python | mit | Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger |
b5fc8db375e7273fb3b7cbb2318f57f141e25045 | src/commoner/profiles/models.py | src/commoner/profiles/models.py | import urlparse
from django.db import models
from django.db.models import permalink
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from commoner.util import getBaseURL
class CommonerProfile(models.Model):
user = models.ForeignKey(User, unique=True)
nickname = m... | import urlparse
from django.db import models
from django.db.models import permalink
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from commoner.util import getBaseURL
class CommonerProfile(models.Model):
user = models.ForeignKey(User, unique=True)
nickname = m... | Allow the photo to be blank. | Allow the photo to be blank.
| Python | agpl-3.0 | cc-archive/commoner,cc-archive/commoner |
fc94ac89d2f602c381f4c882ec963995f3ce3043 | cla_frontend/apps/core/context_processors.py | cla_frontend/apps/core/context_processors.py | from django.conf import settings
def globals(request):
context = {
'app_title': 'Civil Legal Advice',
'proposition_title': 'Civil Legal Advice',
'phase': 'alpha',
'product_type': 'service',
'feedback_url': '#',
'ga_id': '',
'raven_config_site': settings.RAVEN_CONFIG['site'] or ''
}
i... | from django.conf import settings
def globals(request):
context = {
'app_title': 'Civil Legal Advice',
'proposition_title': 'Civil Legal Advice',
'phase': 'alpha',
'product_type': 'service',
'feedback_url': '#',
'ga_id': '',
'raven_config_site': settings.RAVEN_CONFIG['site'] or '',
'so... | Make socketio server url a global context variable in Django | Make socketio server url a global context variable in Django
| Python | mit | ministryofjustice/cla_frontend,ministryofjustice/cla_frontend,ministryofjustice/cla_frontend,ministryofjustice/cla_frontend |
45e3a01380cd5c4487a241aad14d69c88649d96e | bcelldb_init.py | bcelldb_init.py | #!/usr/bin/env python-2.7
"""
Module for common processes in bcelldb computing:
get information from config file
"""
import re
def get_config():
"""
Look for config file in . and than ../
Return config key value pairs in dictionary conf[].
"""
# try to open config file in .
try:
config_file = open("config"... | #!/usr/bin/env python-2.7
"""
Module for common processes in bcelldb computing:
get information from config file
"""
import re
re_key_value = re.compile("^\s*([_A-Za-z][_0-9A-Za-z]+)=(.*?)\s*;?\s*$")
re_inline_comment = re.compile("^(.*?)(?<!\\\\)#.*")
def get_config():
"""
Look for config file in . and than ../
... | Fix handling of separator characters by Python modules | Fix handling of separator characters by Python modules
Currently the Python modules do not tolerate more than one equal
sign ("=") in each line of the config file. However REs with
look-ahead functionality require this character. Introduce new
RE-based line-splitting mechanism. Fix handling of in-line
comments.
| Python | agpl-3.0 | b-cell-immunology/sciReptor,b-cell-immunology/sciReptor,b-cell-immunology/sciReptor,b-cell-immunology/sciReptor |
5a66aaa7b7640ef616bf1817a9e2999e10d97404 | tests/test_wsgi_graphql.py | tests/test_wsgi_graphql.py | from webtest import TestApp as Client
from wsgi_graphql import wsgi_graphql
from graphql.core.type import (
GraphQLEnumType,
GraphQLEnumValue,
GraphQLInterfaceType,
GraphQLObjectType,
GraphQLField,
GraphQLArgument,
GraphQLList,
GraphQLNonNull,
GraphQLSchema,
GraphQLString,
)
d... | import json
from webtest import TestApp as Client
from wsgi_graphql import wsgi_graphql
from graphql.core.type import (
GraphQLObjectType,
GraphQLField,
GraphQLArgument,
GraphQLNonNull,
GraphQLSchema,
GraphQLString,
)
def raises(*_):
raise Exception("Raises!")
TestSchema = GraphQLSchema... | Expand test to cover variables. | Expand test to cover variables.
| Python | mit | ecreall/graphql-wsgi,faassen/graphql-wsgi,faassen/wsgi_graphql |
f3937c77366dc5df4a1eb3b62a2f3452c539dbc4 | cms/models/settingmodels.py | cms/models/settingmodels.py | # -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from cms.utils.compat.dj import force_unicode, python_2_unicode_compatible
@python_2_unicode_compatible
class UserSettings(models.Mo... | # -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from cms.utils.compat.dj import force_unicode, python_2_unicode_compatible
@python_2_unicode_compatible
class UserSettings(models.Mo... | Define a custom related_name in UserSettings->User relation | Define a custom related_name in UserSettings->User relation
| Python | bsd-3-clause | vxsx/django-cms,netzkolchose/django-cms,owers19856/django-cms,MagicSolutions/django-cms,intip/django-cms,czpython/django-cms,Vegasvikk/django-cms,farhaadila/django-cms,saintbird/django-cms,astagi/django-cms,SachaMPS/django-cms,cyberintruder/django-cms,qnub/django-cms,stefanfoulis/django-cms,bittner/django-cms,AlexProfi... |
2aef104da6bf6ce98619fe5bac5718533e2e7530 | yunity/utils/tests/misc.py | yunity/utils/tests/misc.py | from importlib import import_module
from json import dumps as dump_json
from json import loads as load_json
def json_stringify(data):
return dump_json(data, sort_keys=True, separators=(',', ':')).encode("utf-8") if data else None
def content_json(response):
return load_json(response.content.decode("utf-8"))... | from importlib import import_module
from json import dumps as dump_json
from json import loads as load_json
def json_stringify(data):
return dump_json(data, sort_keys=True, separators=(',', ':')).encode("utf-8") if data else None
def content_json(response):
try:
return load_json(response.content.dec... | Improve error on invalid JSON response content | Improve error on invalid JSON response content
with @NerdyProjects
| Python | agpl-3.0 | yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend |
d9d9270f0577a6969f7cb2ccf48a8c0aa859b44a | circular-buffer/circular_buffer.py | circular-buffer/circular_buffer.py | # File: circular_buffer.py
# Purpose: A data structure that uses a single, fixed-size buffer
# as if it were connected end-to-end.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Thursday 29 September 2016, 10:48 PM
class CircularBuffer(object):
def __init__(self, size_ma... | # File: circular_buffer.py
# Purpose: A data structure that uses a single, fixed-size buffer
# as if it were connected end-to-end.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Thursday 29 September 2016, 10:48 PM
class CircularBuffer(object):
def __init__(self, size_ma... | Add functions to insert and clear data | Add functions to insert and clear data
| Python | mit | amalshehu/exercism-python |
d850f4785340f73a417653f46c4de275a6eeeb8c | utilities/ticker-update.py | utilities/ticker-update.py | import requests
from bs4 import BeautifulSoup
URL = 'https://finance.yahoo.com/quote/'
securities = ['bgcp', 'cvx', 'f', 'ge', 'intc', 'lumn', 'src', 't']
for security in securities:
query = URL + security
page = requests.get(query)
soup = BeautifulSoup(page.content, 'html.parser')
span = soup.find('spa... | import requests
from bs4 import BeautifulSoup
URL = 'https://finance.yahoo.com/quote/'
secutities = []
with open("ticker-updates,cong", r) as conf_file:
securities = conf_file.readlines()
securities = [s.strip() for s in securities]
for security in securities:
query = URL + security
page = reques... | Read securities from conf file | Read securities from conf file | Python | mit | daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various |
4c5b6217015610fe7cf3064b59e1b8de1fa41575 | PyFloraBook/input_output/data_coordinator.py | PyFloraBook/input_output/data_coordinator.py | from pathlib import Path
import json
import inspect
import sys
import PyFloraBook
OBSERVATIONS_FOLDER = "observation_data"
RAW_DATA_FOLDER = "raw"
def locate_project_folder() -> Path:
"""Locate top-level project folder
Returns:
Path of the project folder
"""
source_path = Path(inspect.gets... | from pathlib import Path
import json
import inspect
import sys
import PyFloraBook
# Globals
OBSERVATIONS_FOLDER = "observation_data"
RAW_OBSERVATIONS_FOLDER = "raw_observations"
RAW_COUNTS_FOLDER = "raw_counts"
def locate_project_folder() -> Path:
"""Locate top-level project folder
Returns:
Path o... | Support separate folders for raw observations and raw counts | Support separate folders for raw observations and raw counts
| Python | mit | jnfrye/local_plants_book |
ff5cc4bc97999572dfb1db5731fca307d32fb1a3 | infi/pyutils/decorators.py | infi/pyutils/decorators.py | import functools
import inspect
def wraps(wrapped):
""" a convenience function on top of functools.wraps:
- adds the original function to the wrapped function as __wrapped__ attribute."""
def new_decorator(f):
returned = functools.wraps(wrapped)(f)
returned.__wrapped__ = wrapped
re... | import functools
import inspect
def wraps(wrapped):
""" a convenience function on top of functools.wraps:
- adds the original function to the wrapped function as __wrapped__ attribute."""
def new_decorator(f):
returned = functools.wraps(wrapped)(f)
returned.__wrapped__ = wrapped
re... | Support introspection hack for IPython | Support introspection hack for IPython
| Python | bsd-3-clause | Infinidat/infi.pyutils |
90ca5fdd66d11cb0d746fb4ab006445ded860d69 | modoboa_webmail/__init__.py | modoboa_webmail/__init__.py | # -*- coding: utf-8 -*-
"""DMARC related tools for Modoboa."""
from __future__ import unicode_literals
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
default_app_config ... | # -*- coding: utf-8 -*-
"""DMARC related tools for Modoboa."""
from __future__ import unicode_literals
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
__version__ = '9.9.9'
de... | Fix crash in development mode with python 3 | Fix crash in development mode with python 3
| Python | mit | modoboa/modoboa-webmail,modoboa/modoboa-webmail,modoboa/modoboa-webmail |
a0c63a21114cd0d42a18235e7d6c9249b05e571e | availsim/dht/__init__.py | availsim/dht/__init__.py | import chord, dhash, oracle, totalrecall
# For automatic use by availsim
known_types = {
'chord': chord,
'dhash': dhash.dhash,
'fragments': dhash.dhash_fragments,
'replica': dhash.dhash_replica,
'cates': dhash.dhash_cates,
'replica_durability_oracle': oracle.durability_oracle,
'replica_avai... | import chord, dhash, oracle, totalrecall
# For automatic use by availsim
known_types = {
'chord': chord,
'dhash': dhash.dhash,
'fragments': dhash.dhash_fragments,
'replica': dhash.dhash_replica,
'cates': dhash.dhash_cates,
'durability_oracle_replica': oracle.durability_oracle,
'availability... | Rename oracle command line names for consistency and prefixfreeness. | Rename oracle command line names for consistency and prefixfreeness.
| Python | mit | weidezhang/dht,sit/dht,sit/dht,sit/dht,weidezhang/dht,weidezhang/dht,sit/dht,weidezhang/dht,sit/dht,weidezhang/dht |
384d57efa59665f0dd47c07062a8177a2eedde9a | run_tests.py | run_tests.py | #!/usr/bin/python
import optparse
import sys
# Install the Python unittest2 package before you run this script.
import unittest2
USAGE = """%prog SDK_PATH
Run unit tests for App Engine apps.
The SDK Path is probably /usr/local/google_appengine on Mac OS
SDK_PATH Path to the SDK installation"""
def main(sdk_path,... | #!/usr/bin/python
import optparse
import sys
import warnings
# Install the Python unittest2 package before you run this script.
import unittest2
USAGE = """%prog SDK_PATH
Run unit tests for App Engine apps.
The SDK Path is probably /usr/local/google_appengine on Mac OS
SDK_PATH Path to the SDK installation"""
d... | Replace print statement with `warnings.warn`. | Replace print statement with `warnings.warn`.
Also so that it doesn't need to be converted for Python3 compat.
| Python | mit | verycumbersome/the-blue-alliance,the-blue-alliance/the-blue-alliance,1fish2/the-blue-alliance,phil-lopreiato/the-blue-alliance,tsteward/the-blue-alliance,verycumbersome/the-blue-alliance,bdaroz/the-blue-alliance,verycumbersome/the-blue-alliance,bdaroz/the-blue-alliance,nwalters512/the-blue-alliance,synth3tk/the-blue-al... |
04d7e76cf372802e99ff3108cccd836d7aada0df | games/views/installers.py | games/views/installers.py | from __future__ import absolute_import
from rest_framework import generics
from reversion.models import Version
from common.permissions import IsAdminOrReadOnly
from games import models, serializers
class InstallerListView(generics.ListAPIView):
serializer_class = serializers.InstallerSerializer
queryset = ... | from __future__ import absolute_import
from rest_framework import generics
from reversion.models import Version
from common.permissions import IsAdminOrReadOnly
from games import models, serializers
class InstallerListView(generics.ListAPIView):
serializer_class = serializers.InstallerSerializer
queryset = ... | Simplify Installer revision API views | Simplify Installer revision API views
| Python | agpl-3.0 | lutris/website,lutris/website,Turupawn/website,lutris/website,Turupawn/website,lutris/website,Turupawn/website,Turupawn/website |
3f4844c61c4bb8d2e578727ed220de07b0385a74 | speaker/appstore/review.py | speaker/appstore/review.py | import asyncio
import json
from helper.filter import remove_emoji
from helper.lang import find_out_language
from lxml import etree
from datetime import datetime
from helper.http_client import request
from speaker.appstore import NAMESPACE, REGIONS
@asyncio.coroutine
def latest_reviews(code, region, buffer_size):
... | import asyncio
import json
from helper.filter import remove_emoji
from helper.lang import find_out_language
from lxml import etree
from datetime import datetime
from helper.http_client import request
from speaker.appstore import NAMESPACE, REGIONS
@asyncio.coroutine
def latest_reviews(code, region, buffer_size):
... | Fix appstore json parsing process. | Fix appstore json parsing process.
| Python | mit | oldsup/clerk |
c9580f8d700308df2d3bf5710261314d402fc826 | democracy_club/settings/testing.py | democracy_club/settings/testing.py | from .base import * # noqa
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'dc_website_test',
'USER': 'postgres',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
| from .base import * # noqa
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'dc_website_test',
'USER': 'postgres',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
BACKLOG_TRELLO_BOARD_ID = "empty"
BACKLOG_TRELLO_DEFAULT_LIST_... | Add placeholder values for trello items in tests | Add placeholder values for trello items in tests
| Python | bsd-3-clause | DemocracyClub/Website,DemocracyClub/Website,DemocracyClub/Website,DemocracyClub/Website |
fea2cbcbc80d76a75f41fb81ea6ded93312bd11b | imhotep_rubocop/plugin.py | imhotep_rubocop/plugin.py | from imhotep.tools import Tool
from collections import defaultdict
import json
import os
class RubyLintLinter(Tool):
def invoke(self, dirname, filenames=set()):
retval = defaultdict(lambda: defaultdict(list))
if len(filenames) == 0:
cmd = "find %s -name '*.rb' | xargs rubocop -f j" %... | from imhotep.tools import Tool
from collections import defaultdict
import json
import os
class RubyLintLinter(Tool):
def invoke(self, dirname, filenames=set(), linter_configs=set()):
retval = defaultdict(lambda: defaultdict(list))
config = ''
for config_file in linter_configs:
... | Update to support config files that are passed to it. | Update to support config files that are passed to it.
| Python | mit | scottjab/imhotep_rubocop |
7dc734641c1bc7006c9d382afa00c3a8c0b16c50 | admin/common_auth/forms.py | admin/common_auth/forms.py | from __future__ import absolute_import
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.contrib.auth.models import Group
from admin.common_auth.models import MyUser
class LoginForm(forms.Form):
email = for... | from __future__ import absolute_import
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.contrib.auth.models import Group
from osf.models.user import OSFUser
from admin.common_auth.models import AdminProfile
cl... | Update desk form and add update form as well | Update desk form and add update form as well
| Python | apache-2.0 | aaxelb/osf.io,sloria/osf.io,erinspace/osf.io,baylee-d/osf.io,laurenrevere/osf.io,mattclark/osf.io,mfraezz/osf.io,CenterForOpenScience/osf.io,aaxelb/osf.io,mluo613/osf.io,aaxelb/osf.io,alexschiller/osf.io,binoculars/osf.io,alexschiller/osf.io,alexschiller/osf.io,icereval/osf.io,baylee-d/osf.io,saradbowman/osf.io,pattisd... |
5d8dafb9bd6a6c5c5964f7076b7d398d285aaf8d | zeus/artifacts/__init__.py | zeus/artifacts/__init__.py | from __future__ import absolute_import, print_function
from .manager import Manager
from .checkstyle import CheckstyleHandler
from .coverage import CoverageHandler
from .pycodestyle import PyCodeStyleHandler
from .xunit import XunitHandler
manager = Manager()
manager.register(CheckstyleHandler, [
'ch... | from __future__ import absolute_import, print_function
from .manager import Manager
from .checkstyle import CheckstyleHandler
from .coverage import CoverageHandler
from .pycodestyle import PyCodeStyleHandler
from .pylint import PyLintHandler
from .xunit import XunitHandler
manager = Manager()
manager.register(Checkst... | Add PyLintHandler to artifact manager | fix: Add PyLintHandler to artifact manager
| Python | apache-2.0 | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus |
511561918ad5f7620211341ebda373d5dd928377 | Rubik/event.py | Rubik/event.py | class Event:
source = None
event = None
data = None
def __init__(self, source, event, data=None):
self.source = source
self.event = event
self.data = data
SOURCE_OTHER = 0
SOURCE_GUI = 1
SOURCE_RUBIK = 2
SOURCE_SIMON = 3
SOURCE_GEARS = 4
EVENT_DEFAULT = 0
EVENT_BUTTON1 = 1
EV... | class Event:
def __init__(self, source, event, data=None):
self.source = source
self.event = event
self.data = data
SOURCE_OTHER = 0
SOURCE_GUI = 1
SOURCE_RUBIK = 2
SOURCE_SIMON = 3
SOURCE_GEARS = 4
EVENT_DEFAULT = 0
EVENT_BUTTON1 = 1
EVENT_BUTTON2 = 2
EVENT_BUTTON3 = 3
EVENT_BUTTON4 = 4
... | Fix Event class instance variables | Fix Event class instance variables
| Python | apache-2.0 | RoboErik/RUBIK,RoboErik/RUBIK,RoboErik/RUBIK |
37669b43ba35767d28494848e2f1d10d662ddf47 | joblib/test/test_logger.py | joblib/test/test_logger.py | """
Test the logger module.
"""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2009 Gael Varoquaux
# License: BSD Style, 3 clauses.
import shutil
import os
from tempfile import mkdtemp
import nose
from ..logger import PrintTime
#################################################... | """
Test the logger module.
"""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2009 Gael Varoquaux
# License: BSD Style, 3 clauses.
import shutil
import os
from tempfile import mkdtemp
import nose
from ..logger import PrintTime
#################################################... | Improve smoke test coverage for the logger. | Improve smoke test coverage for the logger.
| Python | bsd-3-clause | lesteve/joblib,lesteve/joblib,tomMoral/joblib,aabadie/joblib,karandesai-96/joblib,joblib/joblib,joblib/joblib,karandesai-96/joblib,tomMoral/joblib,aabadie/joblib |
e5d42af3e94869bb40225c808121b40ed8f94a29 | tools/misc/python/test-data-in-out.py | tools/misc/python/test-data-in-out.py | # TOOL test-data-in-out.py: "Test data input and output in Python" (Data input output test.)
# INPUT input TYPE GENERIC
# OUTPUT output
import shutil
shutil.copyfile('input', 'output')
| # TOOL test-data-in-out.py: "Test data input and output in Python" (Data input output test.)
# INPUT input TYPE GENERIC
# OUTPUT output
# OUTPUT OPTIONAL missing_output.txt
import shutil
shutil.copyfile('input', 'output')
| Test that missing optional outputs aren't created | Test that missing optional outputs aren't created | Python | mit | chipster/chipster-tools,chipster/chipster-tools,chipster/chipster-tools,chipster/chipster-tools |
e2cecaa99bae3635fcaa58ea57d67bce7dc83768 | src/psd2svg/rasterizer/batik_rasterizer.py | src/psd2svg/rasterizer/batik_rasterizer.py | # -*- coding: utf-8 -*-
"""
Chromium-based rasterizer module.
Prerequisite:
sudo apt-get install -y chromedriver chromium
"""
from __future__ import absolute_import, unicode_literals
from PIL import Image
import logging
import os
import subprocess
from psd2svg.utils import temporary_directory
logger = logging.... | # -*- coding: utf-8 -*-
"""
Chromium-based rasterizer module.
Prerequisite:
sudo apt-get install -y chromedriver chromium
"""
from __future__ import absolute_import, unicode_literals
from PIL import Image
import logging
import os
import subprocess
from psd2svg.utils import temporary_directory
logger = logging.... | Add bg option in batik rasterizer | Add bg option in batik rasterizer
| Python | mit | kyamagu/psd2svg |
11485f52c8c89fb402d859b3f15068255109a0f5 | website/user/middleware.py | website/user/middleware.py | import base64
from .models import Device
class BasicAuthRemote(object):
def __init__(self, get_response):
self.get_response = get_response
def get_user_token(self, email, token):
try:
device = Device.objects.get(token=token).select_related('user')
if device.user.email ... | import base64
from .models import Device
class BasicAuthRemote(object):
def __init__(self, get_response):
self.get_response = get_response
def get_user_token(self, email, token):
try:
device = Device.objects.get(token=token)
if device.user.email != email:
... | Fix 401 error for requests that require authentication | Fix 401 error for requests that require authentication
| Python | mit | ava-project/ava-website,ava-project/ava-website,ava-project/ava-website |
1a71fba6224a9757f19e702a3b9a1cebf496a754 | src/loop+blkback/plugin.py | src/loop+blkback/plugin.py | #!/usr/bin/env python
import os
import sys
import xapi
import xapi.plugin
from xapi.storage.datapath import log
class Implementation(xapi.plugin.Plugin_skeleton):
def query(self, dbg):
return {
"plugin": "loopdev+blkback",
"name": "The loopdev+blkback kernel-space datapath plugin... | #!/usr/bin/env python
import os
import sys
import xapi
import xapi.storage.api.plugin
from xapi.storage import log
class Implementation(xapi.storage.api.plugin.Plugin_skeleton):
def query(self, dbg):
return {
"plugin": "loopdev+blkback",
"name": "The loopdev+blkback kernel-space ... | Use the new xapi.storage package hierarchy | Use the new xapi.storage package hierarchy
Signed-off-by: David Scott <63c9eb0ea83039690fefa11afe17873ba8278a56@eu.citrix.com>
| Python | lgpl-2.1 | jjd27/xapi-storage-datapath-plugins,robertbreker/xapi-storage-datapath-plugins,djs55/xapi-storage-datapath-plugins,xapi-project/xapi-storage-datapath-plugins,stefanopanella/xapi-storage-plugins,stefanopanella/xapi-storage-plugins,stefanopanella/xapi-storage-plugins |
683257082b9e2d0aba27e6124cd419a4cf19d2a9 | docupload/htmlify.py | docupload/htmlify.py | '''
HTMLify: Convert any fileformat supported by pandoc to HTML5
'''
import pypandoc
def get_html(doc_file):
'''Uses pypandoc to convert uploaded file to HTML5'''
tmp_loc = '/tmp/uploaded_' + str(doc_file)
with open(tmp_loc, 'wb') as tmp_file:
for chunk in doc_file.chunks():
tmp_fil... | '''
HTMLify: Convert any fileformat supported by pandoc to HTML5
'''
import os
import pypandoc
def get_html(doc_file):
'''Uses pypandoc to convert uploaded file to HTML5'''
tmp_loc = '/tmp/uploaded_' + str(doc_file)
with open(tmp_loc, 'wb') as tmp_file:
for chunk in doc_file.chunks():
... | Remove tmp file after conversion | Remove tmp file after conversion
| Python | mit | vaibhawW/oksp,vaibhawW/oksp |
e9cb0bff470dc6bfc926f0b4ac6214ae8a028e61 | vcr/files.py | vcr/files.py | import os
import yaml
from .cassette import Cassette
def load_cassette(cassette_path):
try:
pc = yaml.load(open(cassette_path))
cassette = Cassette(pc)
return cassette
except IOError:
return None
def save_cassette(cassette_path, cassette):
dirname, filename = os.path.spli... | import os
import yaml
from .cassette import Cassette
# Use the libYAML versions if possible
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
def load_cassette(cassette_path):
try:
pc = yaml.load(open(cassette_path), Loader=Loader)
... | Use the libYAML version of yaml if it's available | Use the libYAML version of yaml if it's available
| Python | mit | ByteInternet/vcrpy,aclevy/vcrpy,ByteInternet/vcrpy,kevin1024/vcrpy,poussik/vcrpy,bcen/vcrpy,yarikoptic/vcrpy,agriffis/vcrpy,graingert/vcrpy,poussik/vcrpy,gwillem/vcrpy,mgeisler/vcrpy,kevin1024/vcrpy,IvanMalison/vcrpy,graingert/vcrpy |
525a624047fecce2acf4484c39bc244ad16e11c5 | src/state/objects/Learn.py | src/state/objects/Learn.py | import sys
import os
sys.path.append(os.path.dirname(__file__) + "/../../")
from state import state
from state.stateEnum import StateEnum
from helpers import configHelper
from helpers import processorHelper
class Learn:
current_word = 0
def __init__(self, level_number):
self.number = level_number
... | import sys
import os
sys.path.append(os.path.dirname(__file__) + "/../../")
from state import state
from state.stateEnum import StateEnum
from helpers import configHelper
from helpers import processorHelper
class Learn:
current_word = 0
def __init__(self, level_number):
self.number = level_number
... | Verify overflow in words array into the learn module | Verify overflow in words array into the learn module
| Python | mit | Blindle/Raspberry |
8e6670a554694e540c02c9528fc6b22d9f0d6e15 | django_cron/admin.py | django_cron/admin.py | from django.contrib import admin
from django_cron.models import CronJobLog
class CronJobLogAdmin(admin.ModelAdmin):
class Meta:
model = CronJobLog
search_fields = ('code', 'message')
ordering = ('-start_time',)
list_display = ('code', 'start_time', 'is_success')
admin.site.register(CronJo... | from django.contrib import admin
from django_cron.models import CronJobLog
class CronJobLogAdmin(admin.ModelAdmin):
class Meta:
model = CronJobLog
search_fields = ('code', 'message')
ordering = ('-start_time',)
list_display = ('code', 'start_time', 'is_success')
def get_readonly_field... | Make cron job logs readonly for non-superuser | Make cron job logs readonly for non-superuser
| Python | mit | mozillazg/django-cron,philippeowagner/django-cronium,eriktelepovsky/django-cron,Tivix/django-cron |
d57a1b223b46923bfe5211d4f189b65cfcbffcad | msoffcrypto/format/base.py | msoffcrypto/format/base.py | import abc
# For 2 and 3 compatibility
# https://stackoverflow.com/questions/35673474/
ABC = abc.ABCMeta('ABC', (object,), {'__slots__': ()})
class BaseOfficeFile(ABC):
def __init__(self):
pass
@abc.abstractmethod
def load_key(self):
pass
@abc.abstractmethod
def decrypt(self):
... | import abc
# For 2 and 3 compatibility
# https://stackoverflow.com/questions/35673474/
ABC = abc.ABCMeta('ABC', (object,), {'__slots__': ()})
class BaseOfficeFile(ABC):
def __init__(self):
pass
@abc.abstractmethod
def load_key(self):
pass
@abc.abstractmethod
def decrypt(self):
... | Add is_encrypted() to abstract methods | Add is_encrypted() to abstract methods
| Python | mit | nolze/ms-offcrypto-tool,nolze/ms-offcrypto-tool,nolze/msoffcrypto-tool,nolze/msoffcrypto-tool |
f7ff5e6278acaecff7583518cc97bd945fceddc3 | netmiko/aruba/aruba_ssh.py | netmiko/aruba/aruba_ssh.py | """Aruba OS support"""
from netmiko.cisco_base_connection import CiscoSSHConnection
class ArubaSSH(CiscoSSHConnection):
"""Aruba OS support"""
def session_preparation(self):
"""Aruba OS requires enable mode to disable paging."""
self.set_base_prompt()
self.enable()
self.disable... | """Aruba OS support"""
from netmiko.cisco_base_connection import CiscoSSHConnection
class ArubaSSH(CiscoSSHConnection):
"""Aruba OS support"""
def session_preparation(self):
"""Aruba OS requires enable mode to disable paging."""
delay_factor = self.select_delay_factor(delay_factor=0)
t... | Increase aruba delay post login | Increase aruba delay post login
| Python | mit | fooelisa/netmiko,ktbyers/netmiko,fooelisa/netmiko,isidroamv/netmiko,shamanu4/netmiko,isidroamv/netmiko,ktbyers/netmiko,shamanu4/netmiko |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.