commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
8211fdd427dce5ba4ae56a0a7447bac26d229a6c | Fix test | AccentDesign/wagtailstreamforms,AccentDesign/wagtailstreamforms,AccentDesign/wagtailstreamforms,AccentDesign/wagtailstreamforms | tests/models/test_form_submission_file.py | tests/models/test_form_submission_file.py | from django.db import models, transaction
from django.test import TransactionTestCase
from wagtailstreamforms.models import Form, FormSubmission, FormSubmissionFile
from ..test_case import AppTestCase
class ModelGenericTests(AppTestCase):
def test_str(self):
model = FormSubmissionFile(file=self.get_fil... | from django.db import models, transaction
from django.test import TransactionTestCase
from wagtailstreamforms.models import Form, FormSubmission, FormSubmissionFile
from ..test_case import AppTestCase
class ModelGenericTests(AppTestCase):
def test_str(self):
model = FormSubmissionFile(file=self.get_fil... | mit | Python |
797b42cfd752d4ce43fdce616280710478420197 | Fix flake8 errors: E302 expected 2 blank lines, found 1 | nvbn/thefuck,Clpsplug/thefuck,scorphus/thefuck,nvbn/thefuck,Clpsplug/thefuck,scorphus/thefuck,mlk/thefuck,SimenB/thefuck,SimenB/thefuck,mlk/thefuck | tests/rules/test_git_remote_seturl_add.py | tests/rules/test_git_remote_seturl_add.py | import pytest
from thefuck.rules.git_remote_seturl_add import match, get_new_command
from tests.utils import Command
@pytest.mark.parametrize('command', [
Command(script='git remote set-url origin url', stderr="fatal: No such remote")])
def test_match(command):
assert match(command)
@pytest.mark.parametrize... | import pytest
from thefuck.rules.git_remote_seturl_add import match, get_new_command
from tests.utils import Command
@pytest.mark.parametrize('command', [
Command(script='git remote set-url origin url', stderr="fatal: No such remote")])
def test_match(command):
assert match(command)
@pytest.mark.parametrize... | mit | Python |
612f85cf996caef6d80bdabf5aca96d2408f5528 | remove caching | abirafdirp/blog-wagtail,abirafdirp/blog-wagtail,abirafdirp/blog-wagtail,abirafdirp/blog-wagtail,abirafdirp/blog-wagtail | config/settings/production.py | config/settings/production.py | # -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use MEMCACHIER on Heroku
'''
from __future__ import absolute_import, unicode_literals
from django.utils import six
from .common import * # noqa
# SE... | # -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use MEMCACHIER on Heroku
'''
from __future__ import absolute_import, unicode_literals
from django.utils import six
from .common import * # noqa
# SE... | bsd-3-clause | Python |
64c37e74e63ed062afad72180f4e981866cdceb4 | Update simpleplot.py | jkomiyama/banditlib,jkomiyama/banditlib,jkomiyama/banditlib | simpleplot.py | simpleplot.py | #!/usr/env/python
#coding:utf-8
USE_DISPLAY = True
import matplotlib as mpl
if not USE_DISPLAY:
mpl.use('Agg')
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import sys, os, copy, math, re
def thin(anarray):
i = 1.0
retarray = []
while(i<=len(anarray)):
retarray.append(anar... | #!/usr/env/python
#coding:utf-8
USE_DISPLAY = True
import matplotlib as mpl
if not USE_DISPLAY:
mpl.use('Agg')
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import sys, os, copy, math, re
def thin(anarray):
i = 1.0
retarray = []
while(i<=len(anarray)):
retarray.append(anar... | mit | Python |
b00b325688effc75c82d6f478a77ef9c63d8411c | fix field list passed as string so append works | frappe/frappe,saurabh6790/frappe,mhbu50/frappe,mhbu50/frappe,almeidapaulopt/frappe,almeidapaulopt/frappe,almeidapaulopt/frappe,saurabh6790/frappe,yashodhank/frappe,yashodhank/frappe,frappe/frappe,StrellaGroup/frappe,mhbu50/frappe,almeidapaulopt/frappe,yashodhank/frappe,StrellaGroup/frappe,yashodhank/frappe,frappe/frapp... | frappe/desk/calendar.py | frappe/desk/calendar.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
import json
@frappe.whitelist()
def update_event(args, field_map):
"""Updates Event (called via calendar) based on passed `field_map`"""
arg... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
import json
@frappe.whitelist()
def update_event(args, field_map):
"""Updates Event (called via calendar) based on passed `field_map`"""
arg... | mit | Python |
7fda12897e2a54b2832c26a0dc1d09ed63737958 | fix error message | taijiji/ConfigCollector,mkouhei/ConfigCollector | get_router_config.py | get_router_config.py | #! /usr/bin/env python
import sys
import traceback
import json
from execute_router import Router
try:
# argument is routers' information with JSON formt.
file_input = open(sys.argv[1] ,'r')
except ( IOError, IndexError):
print 'Cannot open JSON file.'
print 'Please use bellow: " python get_router_conf... | #! /usr/bin/env python
import sys
import traceback
import json
from execute_router import Router
try:
# argument is routers' information with JSON formt.
file_input = open(sys.argv[1] ,'r')
except ( IOError, IndexError):
print 'Cannot open JSON file.'
print 'Please use bellow: " python get_router_conf... | mit | Python |
9007e2c7e999b64496331f52f4a0133b9ad1ba4a | Set columns attribute in __init__ | HearthSim/python-hearthstone | hearthstone/dbf.py | hearthstone/dbf.py | from collections import OrderedDict
from xml.etree import ElementTree
class Dbf:
@classmethod
def load(cls, filename):
ret = cls()
with open(filename, "r") as f:
ret.populate(f)
return ret
def __init__(self):
self.name = None
self.columns = OrderedDict()
self.source_fingerprint = None
def __repr_... | from collections import OrderedDict
from xml.etree import ElementTree
class Dbf:
@classmethod
def load(cls, filename):
ret = cls()
with open(filename, "r") as f:
ret.populate(f)
return ret
def __init__(self):
self.name = None
self.source_fingerprint = None
def __repr__(self):
return "<%s: %s>" % ... | mit | Python |
74d98be28804a65ab77b62a157f649cd6cb7f7a4 | Remove test. | nicksergeant/snipt,nicksergeant/snipt,nicksergeant/snipt | urls.py | urls.py | from views import (amazon_search, amazon_image, lexers, pro_signup,
sitemap, tags, pro_signup_complete, stats)
from django.conf.urls.defaults import include, patterns, url
from django.views.generic.simple import direct_to_template
from utils.forms import SniptRegistrationForm
from django.http import ... | from views import (amazon_search, amazon_image, lexers, pro_signup,
sitemap, tags, pro_signup_complete, stats, test)
from django.conf.urls.defaults import include, patterns, url
from django.views.generic.simple import direct_to_template
from utils.forms import SniptRegistrationForm
from django.http i... | mit | Python |
db5763deab0056fb9983470d80ea75dbccc9e26e | change about page from template to flatpage | bhaugen/localecon,bhaugen/localecon,bhaugen/localecon | urls.py | urls.py | from django.conf.urls.defaults import *
from django.conf import settings
from django.views.generic.simple import direct_to_template
from django.contrib import admin
import os.path
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'clusters.views.featured_cluster', name="featured_cluster"),
(r'^clust... | from django.conf.urls.defaults import *
from django.conf import settings
from django.views.generic.simple import direct_to_template
from django.contrib import admin
import os.path
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'clusters.views.featured_cluster', name="featured_cluster"),
(r'^clust... | mit | Python |
db6ccc99491fd71d0ab2b4f3c926e9823ff429ef | Update database.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | gateway/src/database.py | gateway/src/database.py | #!/usr/bin/env python
import sqlite3
#Using sqlite to store the data of devices.
#os.system('./db_init.sql') #create database and init the tables
#ID LIGHT PUMP ANGLE ALARM PHONE
#1 On/OFF Run/Stop 45/90 Open/Close 13880002222
def create_db():
con = sqlite3.connect('gw.db')
print(c... | #!/usr/bin/env python
import sqlite3
#Using sqlite to store the data of devices.
#os.system('./db_init.sql') #create database and init the tables
#ID LIGHT PUMP ANGLE ALARM PHONE
#1 On/OFF Run/Stop 45/90 Open/Close 13880002222
def create_db():
con = sqlite3.connect('gw.db')
print(con... | mit | Python |
972008d754862dd0b24269980c050c5b8a0bd16d | fix for python 2.6 | nyuvis/patient-viz,nyuvis/patient-viz,nyuvis/patient-viz,nyuvis/patient-viz | util.py | util.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on 2015-04-10
@author: joschi
"""
import sys
import os
from datetime import datetime, timedelta, tzinfo
import pytz
_compute_self = "total_seconds" in timedelta(seconds=1)
_tz = pytz.timezone('US/Eastern')
_epoch = datetime(year=1970, month=1, day=1, tzinfo=_t... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on 2015-04-10
@author: joschi
"""
import sys
import os
from datetime import datetime, timedelta, tzinfo
import pytz
_tz = pytz.timezone('US/Eastern')
_epoch = datetime(year=1970, month=1, day=1, tzinfo=_tz)
_day_seconds = 24 * 3600
def _mktime(dt):
res = (... | mit | Python |
082bda309416cb301055f0bebd7fef7e392c949d | Change to an address Amazon will accept | JamieMagee/reddit2kindle,JamieMagee/reddit2kindle | util.py | util.py | import praw
from markdown import markdown
import sendgrid
import os
from configparser import ConfigParser
def to_html(comment):
result = markdown(comment.body) + '<footer>' + comment.author.name + '</footer>'
children = ['<blockquote>' + to_html(reply) + '</blockquote>' for reply in comment.replies if
... | import praw
from markdown import markdown
import sendgrid
import os
from configparser import ConfigParser
def to_html(comment):
result = markdown(comment.body) + '<footer>' + comment.author.name + '</footer>'
children = ['<blockquote>' + to_html(reply) + '</blockquote>' for reply in comment.replies if
... | mit | Python |
cfe848c3aa7e2365ec93f04edb2edf7357068a9a | Create sksl_enums.inc with UNIX line endings (even on Windows) | aosp-mirror/platform_external_skia,HalCanary/skia-hc,rubenvb/skia,HalCanary/skia-hc,Hikari-no-Tenshi/android_external_skia,rubenvb/skia,Hikari-no-Tenshi/android_external_skia,HalCanary/skia-hc,aosp-mirror/platform_external_skia,HalCanary/skia-hc,Hikari-no-Tenshi/android_external_skia,HalCanary/skia-hc,rubenvb/skia,HalC... | gn/create_sksl_enums.py | gn/create_sksl_enums.py | #!/usr/bin/env python
#
# Copyright 2017 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
src = open(sys.argv[1], 'r')
dst = open(sys.argv[2], 'wb')
dst.write('R"(')
for line in src.readlines():
if not line.s... | #!/usr/bin/env python
#
# Copyright 2017 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
src = open(sys.argv[1], 'r')
dst = open(sys.argv[2], 'w')
dst.write('R"(')
for line in src.readlines():
if not line.st... | bsd-3-clause | Python |
db51cb32148a595f74eb4ed8cbcc5dc989db5786 | Rename image_pub to image_publisher; change docstring. | masasin/spirit,masasin/spirit | src/reduce_framerate.py | src/reduce_framerate.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (C) 2015 Jean Nassar
# Released under BSD version 4
"""
Reduce /ardrone/image_raw framerate from 30 Hz to 2 Hz.
"""
import rospy
from sensor_msgs.msg import Image
class ImageFeature(object):
"""
A ROS image Publisher/Subscriber.
"""
def __init__(self)... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (C) 2015 Jean Nassar
# Released under BSD version 4
"""
Reduce /ardrone/image_raw framerate from 30 Hz to 2 Hz.
"""
import rospy
from sensor_msgs.msg import Image
class ImageFeature(object):
"""
A ROS image Publisher/Subscriber.
"""
def __init__(self)... | mit | Python |
067732e0c97b66bd95013b7732989a89f349fc40 | Update auxiliary.py | grmToolbox/grmpy | grmpy/test/auxiliary.py | grmpy/test/auxiliary.py | """The module provides basic axiliary functions for the test modules."""
import glob
import os
def cleanup():
"""The function deletes package related output files."""
for f in glob.glob("*.grmpy.*"):
os.remove(f)
| """The module provides basic axiliary functions for the test modules."""
import glob
import os
def cleanup():
for f in glob.glob("*.grmpy.*"):
os.remove(f)
| mit | Python |
ea25fdf0c5ead789c1da0f4961d3382581ea07b7 | Update create_db.py | Relrin/Helenae,Relrin/Helenae,Relrin/Helenae | helenae/db/create_db.py | helenae/db/create_db.py | import sqlalchemy as sql
# Creating DB
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Users(Base):
__tablename__ = 'users'
id = sql.Column(sql.Integer, primary_key=True)
name = sql.Column(sql.String, unique=True)
fullname = sql.Column(sql.String)
password... | import sqlalchemy as sql
# Creating DB
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Users(Base):
__tablename__ = 'users'
id = sql.Column(sql.Integer, primary_key=True)
name = sql.Column(sql.String, unique=True)
fullname = sql.Column(sql.String)
password... | mit | Python |
03ffbda9725d7cf37b2fe8df2cfe13b2096c81c1 | Revert "x,y should be y,x" | benedicteb/outcast | src/Person.py | src/Person.py | #!/usr/bin/env python
"""
Contains player and NPC-classes.
"""
import logging
from Item import Item
class Person(object):
"""
Base class for all characters in game.
"""
DEFAULT_HEALTH = 100
def __init__(self, health=DEFAULT_HEALTH, position):
"""
Defaults to facing north. Facing c... | #!/usr/bin/env python
"""
Contains player and NPC-classes.
"""
import logging
from Item import Item
class Person(object):
"""
Base class for all characters in game.
"""
DEFAULT_HEALTH = 100
def __init__(self, health=DEFAULT_HEALTH, position):
"""
Defaults to facing north. Facing c... | apache-2.0 | Python |
e78910c8b9ecf48f96a693dae3c15afa32a12da1 | Revert "moving httpresponse to view" | SEL-Columbia/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,di... | casexml/apps/phone/views.py | casexml/apps/phone/views.py | from django.http import HttpResponse
from django_digest.decorators import *
from casexml.apps.phone import xml
from casexml.apps.case.models import CommCareCase
from casexml.apps.phone.restore import generate_restore_response
from casexml.apps.phone.models import User
from casexml.apps.case import const
@httpdigest
... | from django_digest.decorators import *
from casexml.apps.phone import xml
from casexml.apps.case.models import CommCareCase
from casexml.apps.phone.restore import generate_restore_response
from casexml.apps.phone.models import User
from casexml.apps.case import const
@httpdigest
def restore(request):
user = User... | bsd-3-clause | Python |
5ac26c7ec252778f58887279b76f22d15095b0df | Change development_status key to Beta | OCA/stock-logistics-warehouse,OCA/stock-logistics-warehouse,OCA/stock-logistics-warehouse,OCA/stock-logistics-warehouse | stock_packaging_calculator/__manifest__.py | stock_packaging_calculator/__manifest__.py | # Copyright 2020 Camptocamp SA
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl)
{
"name": "Stock packaging calculator",
"summary": "Compute product quantity to pick by packaging",
"version": "14.0.1.2.0",
"development_status": "Beta",
"category": "Warehouse Management",
"website":... | # Copyright 2020 Camptocamp SA
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl)
{
"name": "Stock packaging calculator",
"summary": "Compute product quantity to pick by packaging",
"version": "14.0.1.2.0",
"development_status": "Alpha",
"category": "Warehouse Management",
"website"... | agpl-3.0 | Python |
270f1c1190be1ab32aa4027dbaaea82334172e70 | Fix for Pytest raise for Py3 | jakelever/kindred,jakelever/kindred | tests/test_evaluate.py | tests/test_evaluate.py | import kindred
import pytest
def test_evaluate():
goldText = 'The <disease id="T1">colorectal cancer</disease> was caused by mutations in <gene id="T2">APC</gene>. We also studied <disease id="T3">glioblastoma</disease>.'
goldText += '<relation type="typeA" subj="T2" obj="T1" />'
goldText += '<relation type="typeB"... | import kindred
import pytest
def test_evaluate():
goldText = 'The <disease id="T1">colorectal cancer</disease> was caused by mutations in <gene id="T2">APC</gene>. We also studied <disease id="T3">glioblastoma</disease>.'
goldText += '<relation type="typeA" subj="T2" obj="T1" />'
goldText += '<relation type="typeB"... | mit | Python |
cb6ac73e667c5392c7b3448342d4a9652fa5eff5 | fix explorer so that it searches for binaries in the right place | GuardianRG/angr,lowks/angr,zhuyue1314/angr,f-prettyland/angr,angr/angr,axt/angr,mingderwang/angr,fjferrer/angr,chubbymaggie/angr,cureHsu/angr,xurantju/angr,axt/angr,iamahuman/angr,mingderwang/angr,schieb/angr,axt/angr,terry2012/angr,tyb0807/angr,lowks/angr,angr/angr,terry2012/angr,xurantju/angr,tyb0807/angr,avain/angr,... | tests/test_explorer.py | tests/test_explorer.py | import angr
import nose
import os
location = str(os.path.dirname(os.path.realpath(__file__)))
def test_xpl():
p = angr.Project(os.path.join(location, "blob/x86_64/all"))
pltaddr = p.main_binary.get_call_stub_addr("printf")
nose.tools.assert_equal(pltaddr, 0x400560)
a = angr.surveyors.Explorer(p, find... | import angr
import nose
def test_xpl():
p = angr.Project("blob/x86_64/all")
pltaddr = p.main_binary.get_call_stub_addr("printf")
nose.tools.assert_equal(pltaddr, 0x400560)
a = angr.surveyors.Explorer(p, find=(0x400560,), num_find=4)
a.run()
nose.tools.assert_equal(len(a.found), 4)
if __name_... | bsd-2-clause | Python |
95d6a501799749602a927c478603b0e496bfa53f | test for json_dumps | scopatz/regolith,scopatz/regolith | tests/test_fsclient.py | tests/test_fsclient.py | import pytest
import datetime
from testfixtures import TempDirectory
from pathlib import Path
from regolith.fsclient import date_encoder, dump_json
def test_date_encoder():
day = datetime.date(2021,1,1)
time = datetime.datetime(2021, 5, 18, 6, 28, 21, 504549)
assert date_encoder(day) == '2021-01-01'
... | import datetime
from regolith.fsclient import date_encoder
def test_date_encoder():
day = datetime.date(2021,1,1)
time = datetime.datetime(2021, 5, 18, 6, 28, 21, 504549)
assert date_encoder(day) == '2021-01-01'
assert date_encoder(time) == '2021-05-18T06:28:21.504549'
| cc0-1.0 | Python |
fdc27c889c1d95823d55b57d63d03b95dee4f423 | Add failing test re #649 | fernandezcuesta/fabric,pashinin/fabric,ploxiln/fabric,pgroudas/fabric,bspink/fabric,tolbkni/fabric,rodrigc/fabric,kmonsoor/fabric,mathiasertl/fabric,getsentry/fabric,itoed/fabric,opavader/fabric,amaniak/fabric,haridsv/fabric,cmattoon/fabric,bitprophet/fabric,jaraco/fabric,likesxuqiang/fabric,kxxoling/fabric,TarasRudnyk... | tests/test_parallel.py | tests/test_parallel.py | from __future__ import with_statement
from fabric.api import run, parallel, env, hide, execute
from utils import FabricTest, eq_, aborts
from server import server, RESPONSES
class OhNoesException(Exception): pass
class TestParallel(FabricTest):
@server()
@parallel
def test_parallel(self):
"""
... | from __future__ import with_statement
from fabric.api import run, parallel, env, hide
from utils import FabricTest, eq_
from server import server, RESPONSES
class TestParallel(FabricTest):
@server()
@parallel
def test_parallel(self):
"""
Want to do a simple call and respond
"""
... | bsd-2-clause | Python |
b650a1578c26aa956541e4c4483bbbcb35b55d5d | allow what's this for disabled buttons | gem/oq-svir-qgis,gem/oq-svir-qgis,gem/oq-svir-qgis,gem/oq-svir-qgis | svir/ui/tool_button_with_help_link.py | svir/ui/tool_button_with_help_link.py | """
button that when is clicked with whatsThis mode on opens an URL
Contact : marco@opengis.ch
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or... | """
button that when is clicked with whatsThis mode on opens an URL
Contact : marco@opengis.ch
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or... | agpl-3.0 | Python |
e5e19525049d201d14545a7ad882bb9a3aa787bd | Update available_teams templage tag. | pydata/symposion,pydata/symposion | symposion/teams/templatetags/teams_tags.py | symposion/teams/templatetags/teams_tags.py | from django import template
from symposion.teams.models import Team
register = template.Library()
class AvailableTeamsNode(template.Node):
@classmethod
def handle_token(cls, parser, token):
bits = token.split_contents()
if len(bits) == 3 and bits[1] == "as":
return cls(bits[2])
... | from django import template
from symposion.teams.models import Team
register = template.Library()
class AvailableTeamsNode(template.Node):
@classmethod
def handle_token(cls, parser, token):
bits = token.split_contents()
if len(bits) == 3 and bits[1] == "as":
return cls(bits[2])
... | bsd-3-clause | Python |
4b8a6bae3424480744a2b8abd1d73282ee752ff9 | fix bug: ObjectVizualizer::get_for_position must return something | buxx/synergine | synergine/core/display/ObjectVisualizer.py | synergine/core/display/ObjectVisualizer.py | from synergine.core.config.ConfigurationManager import ConfigurationManager
from synergine.synergy.object.SynergyObject import SynergyObject
from synergine.core.exception.NotFoundError import NotFoundError
class ObjectVisualizer():
def __init__(self, config: dict, context):
config_manager = Configuration... | from synergine.core.config.ConfigurationManager import ConfigurationManager
from synergine.synergy.object.SynergyObject import SynergyObject
from synergine.core.exception.NotFoundError import NotFoundError
class ObjectVisualizer():
def __init__(self, config: dict, context):
config_manager = Configuration... | apache-2.0 | Python |
7d8f3478e0f283052ff0a46f6a5c24323d3ff052 | handle a possible failure of kramdown in the site generation, include error messages into the page, report error on TeamCity (it may break the build if there are broken pages) | hltj/kotlin-web-site-cn,hltj/kotlin-web-site-cn,hltj/kotlin-web-site-cn,JetBrains/kotlin-web-site,hltj/kotlin-web-site-cn,JetBrains/kotlin-web-site,hltj/kotlin-web-site-cn,JetBrains/kotlin-web-site,JetBrains/kotlin-web-site,JetBrains/kotlin-web-site,JetBrains/kotlin-web-site,hltj/kotlin-web-site-cn | src/markdown/makrdown.py | src/markdown/makrdown.py | import subprocess
import hashlib
def customized_markdown(text):
# it is expected to have kramdown version 1.14.0
# the kramdown version 2.1.0 misses the --no-hard-wrap flag
kramdown = subprocess.Popen(
"kramdown --input GFM --no-hard-wrap --smart-quotes apos,apos,quot,quot --no-enable-coderay",
... | import subprocess
def customized_markdown(text):
kramdown = subprocess.Popen(
"kramdown --input GFM --no-hard-wrap --smart-quotes apos,apos,quot,quot --no-enable-coderay",
shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
stdout_data, stderr_data = kramdown.communicate(... | apache-2.0 | Python |
85fdb99b731e5c03a83b17d1a6ac238f51bc71da | fix for 404 bug | crlane/helga-xkcd | helga_xkcd/client.py | helga_xkcd/client.py | import random
import requests
from helga import log
logger = log.getLogger(__name__)
class XKCDClient(object):
BASE = 'https://xkcd.com'
EXT = 'info.0.json'
def __init__(self):
self._sess = requests.Session()
def _request(self, comic_number=None):
url_args = [str(a) for a in (self... | import random
import requests
from helga import log
logger = log.getLogger(__name__)
class XKCDClient(object):
BASE = 'https://xkcd.com'
EXT = 'info.0.json'
def __init__(self):
self._sess = requests.Session()
def _request(self, comic_number=None):
url_args = [str(a) for a in (self... | mit | Python |
c128fd4e4ff724fa308e78844ff604d6c9754915 | Update updatefeed.py | abhinavbom/Threat-Intelligence-Hunter | lib/updatefeed.py | lib/updatefeed.py | __author__ = '@abhinavbom a.k.a darkl0rd'
import urllib2
import urlparse
import re
import os
import time
from lib.feeds import *
from lib.parse import *
def gather():
if not os.path.exists('intel'):
os.mkdir('intel')
os.chdir('.\\intel')
#print os.getcwd()
print "Starting feed update process"
... | __author__ = '@abhinavbom a.k.a darkl0rd'
import urllib2
import urlparse
import re
import os
import time
from lib.feeds import *
from lib.parse import *
def gather():
if not os.path.exists('intel'):
os.mkdir('intel')
os.chdir('.\\intel')
#print os.getcwd()
print "Starting feed update process"
... | mit | Python |
cb2b2a20a8a7d82cc407cf9575d9d4ba88c737f4 | Add state to error message if the client passed state in the original authn request. | its-dirg/svs | src/svs/message_utils.py | src/svs/message_utils.py | import cherrypy
from oic.oic.message import AuthorizationErrorResponse
from svs.user_interaction import EndUserErrorResponse
from svs.log_utils import log_transaction_fail, log_negative_transaction_complete
from svs.utils import now, get_new_error_uid, get_timestamp
__author__ = 'regu0004'
def abort_with_enduser_e... | import cherrypy
from oic.oic.message import AuthorizationErrorResponse
from svs.user_interaction import EndUserErrorResponse
from svs.log_utils import log_transaction_fail, log_negative_transaction_complete
from svs.utils import now, get_new_error_uid, get_timestamp
__author__ = 'regu0004'
def abort_with_enduser_e... | apache-2.0 | Python |
4aa6987d3048d6de36ddc07b63a02a3ddf3ab410 | Adjust code to restore generality. | lemming52/white_knight | integration/integration.py | integration/integration.py | # Python Packages
import random
# External Packages
import numpy as np
def sin_theta_sum(variables):
theta = 0
for var in variables:
theta += var
return np.sin(theta)
def gen_random_variables(count, rmin, rmax):
variables = []
for i in range(count):
variables.ap... | # Python Packages
import random
# External Packages
import numpy as np
def sin_theta_sum(theta):
return np.sin(theta)
def gen_random_value(count, rmin, rmax):
value = 0
for i in range(count):
value += np.random.uniform(rmin, rmax)
# test_range(rmin, rmax, value)
retu... | mit | Python |
0b9eee182814746dc8858e2a2cf9d06eb1440b92 | Add a get_projects method, and clean up the feed url | fedora-infra/python-fedora | fedora/client/hosted.py | fedora/client/hosted.py | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied... | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied... | lgpl-2.1 | Python |
d058dfa49b81f3df24f957e7302f89a872a9e11b | Bump develop version to 1.9.0-dev | mprefer/findingaids,emory-libraries/findingaids,mprefer/findingaids,emory-libraries/findingaids | findingaids/__init__.py | findingaids/__init__.py | # file findingaids/__init__.py
#
# Copyright 2012 Emory University Library
#
# 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
#
# U... | # file findingaids/__init__.py
#
# Copyright 2012 Emory University Library
#
# 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
#
# U... | apache-2.0 | Python |
18e496469a5331a2944616de9da4afadb04f978b | set version to 1.4.0 final | emory-libraries/findingaids,mprefer/findingaids,mprefer/findingaids,emory-libraries/findingaids | findingaids/__init__.py | findingaids/__init__.py | # file findingaids/__init__.py
#
# Copyright 2012 Emory University Library
#
# 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
#
# U... | # file findingaids/__init__.py
#
# Copyright 2012 Emory University Library
#
# 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
#
# U... | apache-2.0 | Python |
8aa124540a08f96925188a5635a045e6076f3c95 | refactor to use definition decorator | rochacbruno/flasgger,talitarossari/flasgger,talitarossari/flasgger,flasgger/flasgger,rochacbruno/flasgger,flasgger/flasgger,flasgger/flasgger,rochacbruno/flasgger,flasgger/flasgger,talitarossari/flasgger | flasgger/simple_test.py | flasgger/simple_test.py | """
# create a virtualenv
mkvirtualenv test_api
# install dependencies
pip install flask
pip install flasgger
# run the following script
python simple_test.py
"""
from flask import Flask, jsonify, request
from flasgger import Swagger
from flask.views import View
app = Flask(__name__)
# Flasgger is initialized like ... | """
# create a virtualenv
mkvirtualenv test_api
# install dependencies
pip install flask
pip install flasgger
# run the following script
python simple_test.py
"""
from flask import Flask, jsonify, request
from base import Swagger
from flask.views import View
app = Flask(__name__)
Swagger(app)
@app.route("/recs", ... | mit | Python |
5dc7a9339f80103e0a5cdf0793e001419703b8bf | Disable buttons for unimplemented check types. | pombredanne/github2fedmsg,fedora-infra/github2fedmsg,fedora-infra/github2fedmsg,pombredanne/github2fedmsg | pep8bot/widgets/users.py | pep8bot/widgets/users.py | import tw2.core as twc
import pep8bot.models
from sqlalchemy import and_
import pyramid.threadlocal
from pygithub3 import Github
gh = Github()
class UserProfile(twc.Widget):
template = "mako:pep8bot.widgets.templates.profile"
user = twc.Param("An instance of the User SQLAlchemy model.")
resources = [
... | import tw2.core as twc
import pep8bot.models
from sqlalchemy import and_
import pyramid.threadlocal
from pygithub3 import Github
gh = Github()
class UserProfile(twc.Widget):
template = "mako:pep8bot.widgets.templates.profile"
user = twc.Param("An instance of the User SQLAlchemy model.")
resources = [
... | agpl-3.0 | Python |
43bf57604d7f090884366827bdd56e83d8428dd4 | Add missing docstrings | AndyHuu/flocker,hackday-profilers/flocker,moypray/flocker,beni55/flocker,agonzalezro/flocker,agonzalezro/flocker,lukemarsden/flocker,AndyHuu/flocker,achanda/flocker,wallnerryan/flocker-profiles,agonzalezro/flocker,adamtheturtle/flocker,jml/flocker,runcom/flocker,1d4Nf6/flocker,lukemarsden/flocker,wallnerryan/flocker-pr... | flocker/node/_deploy.py | flocker/node/_deploy.py | # Copyright Hybrid Logic Ltd. See LICENSE file for details.
# -*- test-case-name: flocker.node.test.test_deploy -*-
"""
Deploy applications on nodes.
"""
from .gear import GearClient
from ._model import Application
class Deployment(object):
"""
Start and stop containers.
"""
def __init__(self, gear... | # Copyright Hybrid Logic Ltd. See LICENSE file for details.
# -*- test-case-name: flocker.node.test.test_deploy -*-
"""
Deploy applications on nodes.
"""
from .gear import GearClient
from ._model import Application
class Deployment(object):
"""
Start and stop containers.
"""
def __init__(self, gear... | apache-2.0 | Python |
d71d47b910288fea06ff560005322be127c8e38a | Bump version | vmalloc/json_rest | json_rest/__version__.py | json_rest/__version__.py | __version__ = "0.0.5"
| __version__ = "0.0.4"
| bsd-3-clause | Python |
72617c63a9af63374702af67b3d6133ed1c1d3a5 | Add time/space complexity | bowen0701/algorithms_data_structures | lc026_remove_duplicates_from_sorted_array.py | lc026_remove_duplicates_from_sorted_array.py | """Leetcode 26. Remove Duplicates from Sorted Array
Easy
URL: https://leetcode.com/problems/remove-duplicates-from-sorted-array/
Given a sorted array nums, remove the duplicates in-place such that each element
appear only once and return the new length.
Do not allocate extra space for another array, you must do this... | """Leetcode 26. Remove Duplicates from Sorted Array
Easy
URL: https://leetcode.com/problems/remove-duplicates-from-sorted-array/
Given a sorted array nums, remove the duplicates in-place such that each element
appear only once and return the new length.
Do not allocate extra space for another array, you must do this... | bsd-2-clause | Python |
2c2f9d42b825ea122e0ae5b2f13a9eac43dfea46 | Make sure exceptions within with-statement is logged | frigg/frigg-worker | frigg_worker/fetcher.py | frigg_worker/fetcher.py | # -*- coding: utf8 -*-
import json
import logging
import random
import socket
import time
import requests
from docker.manager import Docker
from .jobs import Build
logger = logging.getLogger(__name__)
def fetcher(**options):
notify_of_upstart(options)
while options['dispatcher_url']:
task = fetch_t... | # -*- coding: utf8 -*-
import json
import logging
import random
import socket
import time
import requests
from docker.manager import Docker
from .jobs import Build
logger = logging.getLogger(__name__)
def fetcher(**options):
notify_of_upstart(options)
while options['dispatcher_url']:
task = fetch_t... | mit | Python |
2526fb73df5cc054da790c2d897668c7ecb49547 | Cut 0.12 | pyinvoke/invocations | invocations/_version.py | invocations/_version.py | __version_info__ = (0, 12, 0)
__version__ = '.'.join(map(str, __version_info__))
| __version_info__ = (0, 11, 0)
__version__ = '.'.join(map(str, __version_info__))
| bsd-2-clause | Python |
4b79b2536af54d8212aae3b090592132a545c7b4 | Fix misleading class name | inclement/kivy,inclement/kivy,bionoid/kivy,kivy/kivy,rnixx/kivy,LogicalDash/kivy,jegger/kivy,Cheaterman/kivy,bionoid/kivy,kivy/kivy,KeyWeeUsr/kivy,LogicalDash/kivy,akshayaurora/kivy,rnixx/kivy,bionoid/kivy,KeyWeeUsr/kivy,akshayaurora/kivy,Cheaterman/kivy,bionoid/kivy,inclement/kivy,Cheaterman/kivy,matham/kivy,rnixx/kiv... | kivy/tests/test_video.py | kivy/tests/test_video.py |
import unittest
class VideoTestCase(unittest.TestCase):
def test_video_unload(self):
# fix issue https://github.com/kivy/kivy/issues/2275
# AttributeError: 'NoneType' object has no attribute 'texture'
from kivy.uix.video import Video
from kivy.clock import Clock
from kivy... |
import unittest
class AnimationTestCase(unittest.TestCase):
def test_video_unload(self):
# fix issue https://github.com/kivy/kivy/issues/2275
# AttributeError: 'NoneType' object has no attribute 'texture'
from kivy.uix.video import Video
from kivy.clock import Clock
from ... | mit | Python |
e3185e22ecd79298cbb4f0d2680ad016e1d5df69 | Update show_artist_top_tracks.py | plamere/spotipy | examples/show_artist_top_tracks.py | examples/show_artist_top_tracks.py | # shows artist info for a URN or URL
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
import sys
import pprint
if len(sys.argv) > 1:
urn = sys.argv[1]
else:
urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'
client_credentials_manager = SpotifyClientCredentials()
sp = spotipy.Spotify(client_cred... | # shows artist info for a URN or URL
import spotipy
import sys
import pprint
if len(sys.argv) > 1:
urn = sys.argv[1]
else:
urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'
sp = spotipy.Spotify()
response = sp.artist_top_tracks(urn)
for track in response['tracks']:
print(track['name'])
| mit | Python |
25f818f5a41b2da2a615cd0882a84200ddad645a | Add person to elected endpoint | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative | ynr/apps/uk_results/api/next/serializers.py | ynr/apps/uk_results/api/next/serializers.py | from rest_framework import serializers
from rest_framework.reverse import reverse
from parties.api.next.serializers import MinimalPartySerializer
from popolo.api.next.serializers import (
BallotOnCandidacySerializer,
PersonOnBallotSerializer,
CandidacyOnBallotSerializer,
CANDIDACY_ON_PERSON_FIELDS,
)
f... | from rest_framework import serializers
from rest_framework.reverse import reverse
from parties.api.next.serializers import MinimalPartySerializer
from popolo.api.next.serializers import (
BallotOnCandidacySerializer,
PersonOnBallotSerializer,
CandidacyOnBallotSerializer,
CANDIDACY_ON_PERSON_FIELDS,
)
f... | agpl-3.0 | Python |
e962b0f4b7cd16c8c8142e0a3feb63d8a79ead2f | Convert tabs to spaces | kylemh/UO_CIS322,kylemh/UO_CIS322,kylemh/UO_CIS322 | src/config.py | src/config.py | import json
import os
import pathlib
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
APP_SECRET_KEY = str(os.urandom(32))
# SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
# Global Variables
basedir = pathlib.Path(os.path.realpath(__file__)).parent.joinpath('l... | import json
import os
import pathlib
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
APP_SECRET_KEY = str(os.urandom(32))
# SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
# Global Variables
basedir = pathlib.Path(os.path.realpath(__file__)).parent.joinpath('lost_config.json')
wi... | agpl-3.0 | Python |
0f9a7d8cff7a2f4160ee8a80d5072d70d6b4dd7b | Fix filehelper data path overwrite bug | githubutilities/gas,githubutilities/gas | gas/utils/filehelper.py | gas/utils/filehelper.py | import os
import codecs
from gas import config as settings
class DataPathException(Exception):
pass
class open_data(object):
"""
open data
# API Design Reference, https://docs.python.org/2/library/codecs.html
open_data(filename, mode[, encoding])
"""
def __init__(self, filename, mode, encoding="utf-8", path=N... | import os
import codecs
from gas import config as settings
class DataPathException(Exception):
pass
class open_data(object):
"""
open data
# API Design Reference, https://docs.python.org/2/library/codecs.html
open_data(filename, mode[, encoding])
"""
def __init__(self, filename, mode, encoding="utf-8", path=N... | apache-2.0 | Python |
73dffe67795c5ab9c9fdec02e23bec5bd94617e4 | handle merge conflicts if they arise | guillaume-philippon/aquilon,quattor/aquilon,guillaume-philippon/aquilon,quattor/aquilon,guillaume-philippon/aquilon,stdweird/aquilon,stdweird/aquilon,quattor/aquilon,stdweird/aquilon | lib/python2.5/aquilon/server/commands/put.py | lib/python2.5/aquilon/server/commands/put.py | # ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# Copyright (C) 2008 Morgan Stanley
#
# This module is part of Aquilon
"""Contains the logic for `aq put`."""
import os
from tempfile import mkstemp
from base64 import b64decode
from aquilon.server.broker import Broker... | # ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# Copyright (C) 2008 Morgan Stanley
#
# This module is part of Aquilon
"""Contains the logic for `aq put`."""
import os
from tempfile import mkstemp
from base64 import b64decode
from aquilon.server.broker import Broker... | apache-2.0 | Python |
79a35d6ba9214e0710a0167d159898ed4df854a2 | Test updated. | cidles/graf-python,cidles/graf-python,cidles/graf-python,stevecassidy/graf-python | src/tests/test_render.py | src/tests/test_render.py | # -*- coding: utf-8 -*-
#
# Poio Tools for Linguists
#
# Copyright (C) 2009-2012 Poio Project
# Author: António Lopes <alopes@cidles.eu>
# URL: <http://www.cidles.eu/ltll/poio>
# For license information, see LICENSE.TXT
"""This module contains the tests to the class
GrafRenderer.
This test serves to ensure ... | # -*- coding: utf-8 -*-
#
# Poio Tools for Linguists
#
# Copyright (C) 2009-2012 Poio Project
# Author: António Lopes <alopes@cidles.eu>
# URL: <http://www.cidles.eu/ltll/poio>
# For license information, see LICENSE.TXT
"""This module contains the tests to the class
GrafRenderer.
This test serves to ensure ... | apache-2.0 | Python |
34fbbc0d4a9eeccf3369afb4a78f852c6cda42ab | remove python_2_unicode_compatible | vicalloy/lbutils,vicalloy/lbutils | lbutils/tests/models.py | lbutils/tests/models.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=255)
class Book(models.Model):
name = models.CharField(max_length=255)
descn = models.TextField(blank=True)
price = models.FloatField(null=Tr... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Category(models.Model):
name = models.CharField(max_length=255)
@python_2_unicode_compatible
class Book(models.Model):
... | mit | Python |
3d0ecb4bfd92e96dd195142c3b31955d521dfaf1 | Correct the unit test in V5_5_0 | egafford/sahara,openstack/sahara,openstack/sahara,egafford/sahara,tellesnobrega/sahara,tellesnobrega/sahara | sahara/tests/unit/plugins/cdh/v5_5_0/test_plugin_utils_550.py | sahara/tests/unit/plugins/cdh/v5_5_0/test_plugin_utils_550.py | # Copyright (c) 2015 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | # Copyright (c) 2015 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | apache-2.0 | Python |
d8087689cb397f5ce2d2349d93e804f4376bbb3d | change br10 | fengkaicnic/traffic,fengkaicnic/traffic | traffic/tfilter/api.py | traffic/tfilter/api.py |
from traffic import rootwrap
from traffic import utils
from traffic import db
from traffic.db import base
import os
class API(base.Base):
def set_execute(self, execute):
self._execute = execute
def create(self, context, ip, class_id, prio=1):
ips = ip + '/32'... |
from traffic import rootwrap
from traffic import utils
from traffic import db
from traffic.db import base
import os
class API(base.Base):
def set_execute(self, execute):
self._execute = execute
def create(self, context, ip, class_id, prio=1):
ips = ip + '/32'... | apache-2.0 | Python |
0eec76d61a7e6511912136023b7c43ec6eaebde7 | Work with DBLP XML data | charanpald/APGL | exp/influence2/GenerateDBLPData.py | exp/influence2/GenerateDBLPData.py |
from exp.influence2.DBLPDataset import DBLPDataset
import logging
import sys
"""
Create some graphs from the DBLP data. Basically, we use a seed list of experts
and then find all the coauthors and their publications.
"""
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
#field = "Boosting"
field = "... | from apgl.util.PathDefaults import PathDefaults
from lxml import etree
import HTMLParser
import os
import logging
import sys
import difflib
import re
"""
Create some graphs from the DBLP data. Basically, we use a seed list of experts
and then find all the coauthors and their publications.
"""
logging.basicConfi... | bsd-3-clause | Python |
63f6e4d50116d5ca2bfc82c1c608e08040055b5e | Remove old exports from subdue.core | jdevera/subdue | subdue/core/__init__.py | subdue/core/__init__.py | __all__ = [
'BANNER',
'DEFAULT_DRIVER_CODE'
'die',
'verbose',
'set_color_policy',
]
import sys as _sys
from . import color as _color
BANNER = """\
_ _
___ _ _| |__ __| |_ _ ___
/ __| | | | '_ \ / _` | | | |/ _ \\
\__ \ |_| | |_) | (_| | |_| | __/
|___/\__,_|_.__/ \__,_|... | __all__ = [
'color',
'BANNER',
'DEFAULT_DRIVER_CODE'
'die',
'verbose',
'use_colors',
'set_color_policy',
]
import sys as _sys
from . import color as _color
BANNER = """\
_ _
___ _ _| |__ __| |_ _ ___
/ __| | | | '_ \ / _` | | | |/ _ \\
\__ \ |_| | |_) | (_| | |_|... | mit | Python |
8031e383869787f38fceb642c347212706d72a1c | Stop calling restart(), the caller should do it. | eunchong/build,eunchong/build,eunchong/build,eunchong/build | scripts/tools/swarm_bootstrap/start_slave.py | scripts/tools/swarm_bootstrap/start_slave.py | # Copyright 2013 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.
"""Returns a swarming bot dimensions and setups automatic startup if needed.
This file is uploaded the swarming server so the swarming bots can declare thei... | # Copyright 2013 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.
"""Returns a swarming bot dimensions and setups automatic startup if needed.
This file is uploaded the swarming server so the swarming bots can declare thei... | bsd-3-clause | Python |
2c23431c9c8e4b72d93144657706d43aab6e0119 | Remove unused import from poloniex.py | congruency/txpoloniex | txpoloniex/poloniex.py | txpoloniex/poloniex.py | from functools import partial
from txpoloniex import base, const, util
class Poloniex:
def __init__(self, api_key='', secret=''):
self.public = base.PoloniexPublic()
self.private = base.PoloniexPrivate(api_key, secret)
self.addHandlers(self.public, const.PUBLIC_COMMANDS)
self.ad... | from functools import partial
from txpoloniex import base, const, queue, util
class Poloniex:
def __init__(self, api_key='', secret=''):
self.public = base.PoloniexPublic()
self.private = base.PoloniexPrivate(api_key, secret)
self.addHandlers(self.public, const.PUBLIC_COMMANDS)
... | apache-2.0 | Python |
d554c74da69063d87d6f8b054f13adc0cd2da158 | Add 8ball. | sk89q/Plumeria,sk89q/Plumeria,sk89q/Plumeria | plumeria/plugins/roll.py | plumeria/plugins/roll.py | import random
import dice
from plumeria.command import commands, CommandError
EIGHT_BALL_RESPONSES = (
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes, definitely",
"You may rely on it",
"As I see it, yes",
"Most likely",
"Outlook good",
"Yes",
"Signs point to ye... | import random
import dice
from plumeria.command import commands, CommandError
@commands.register('roll', category='Utility')
async def roll(message):
"""
Rolls dice with support for NdM syntax.
"""
try:
result = dice.roll(message.content)
if isinstance(result, int):
return... | mit | Python |
e5d9e98fee0d77ed288f202bac15584b58885246 | Fix broken email/password login | datagutten/comics,jodal/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,datagutten/comics,jodal/comics | comics/accounts/backends.py | comics/accounts/backends.py | # Based on https://bitbucket.org/jokull/django-email-login/
import re
from uuid import uuid4
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from django.contrib.sites.models import RequestSite, Site
from registration import signals
from registration.models import Reg... | # Based on https://bitbucket.org/jokull/django-email-login/
import re
from uuid import uuid4
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from django.contrib.sites.models import RequestSite, Site
from registration import signals
from registration.models import Reg... | agpl-3.0 | Python |
830816f7c1b42af78421a01de41342134792f60c | Fix github_link behaviour | codex-bot/github | github/commands/link.py | github/commands/link.py | from classes.chat_controller import ChatController
from config import URL
from .base import CommandBase
class CommandLink(CommandBase):
async def __call__(self, payload):
self.sdk.log("/github_link handler fired with payload {}".format(payload))
self.set_bot(payload)
user_token = ChatCo... | from classes.chat_controller import ChatController
from config import URL
from .base import CommandBase
class CommandLink(CommandBase):
async def __call__(self, payload):
self.sdk.log("/github_link handler fired with payload {}".format(payload))
user_token = ChatController(self.sdk).register_cha... | mit | Python |
a6b5bb45be3532c7a152056c4911074b7e906863 | add cgit repobrowser | gvalkov/git-link,gvalkov/git-link | gitlink/repobrowsers.py | gitlink/repobrowsers.py | #!/usr/bin/env python
# encoding: utf-8
from os.path import join as pjoin
class RepoBrowser(object):
''' I represent a repository browser and my methods return links to the
various git objects that I am capable of showing '''
def tag(self, name):
''' Get url for tag name '''
raise No... | #!/usr/bin/env python
# encoding: utf-8
class RepoBrowser(object):
''' I represent a repository browser and my methods return links to the
various git objects that I am capable of showing '''
def tag(self, name):
''' Get url for tag name '''
raise NotImplementedError
def commit(s... | bsd-3-clause | Python |
63dbbbadd028445350f02f51f34789893ab8489c | Allow bit specification in PCF signal name | SymbiFlow/symbiflow-arch-defs,SymbiFlow/symbiflow-arch-defs | ice40/utils/pcf.py | ice40/utils/pcf.py | import re
def parse_pcf(f, pin_map, icecube2_hacks=False):
pcf_data = {}
for i, oline in enumerate(f):
line = oline
if icecube2_hacks and not re.search(" # ICE_(GB_)?IO", line):
continue
line = re.sub(r"#.*", "", line.strip()).split()
if "--warn-no-port" in line:
... | import re
def parse_pcf(f, pin_map, icecube2_hacks=False):
pcf_data = {}
for i, oline in enumerate(f):
line = oline
if icecube2_hacks and not re.search(" # ICE_(GB_)?IO", line):
continue
line = re.sub(r"#.*", "", line.strip()).split()
if "--warn-no-port" in line:
... | isc | Python |
70dd45f0cf93a69aea09ba78d0f3ec4b8f88ac95 | connect spans to api | varnish/varnish-microservice-monitor,varnish/zipnish,varnish/zipnish,varnish/varnish-microservice-monitor,varnish/zipnish,varnish/zipnish,varnish/zipnish,varnish/varnish-microservice-monitor,varnish/varnish-microservice-monitor,varnish/varnish-microservice-monitor | ui/app/api/__init__.py | ui/app/api/__init__.py | from flask import Blueprint
api = Blueprint('api', __name__)
#
# end-points to create
# query
from . import query
# services
from . import services
# spans
from . import spans
#
# traces
# services
# annotations
# dependencies
# pin
from . import pin
| from flask import Blueprint
api = Blueprint('api', __name__)
#
# end-points to create
# query
from . import query
# services
from . import services
#
# traces
# services
# spans
# annotations
# dependencies
# pin
from . import pin
| bsd-2-clause | Python |
313f6eb862b41892eb09c2cc64f69b1576c99afc | fix in aws_handler: AWS accepts json, but stringified dictionary passed | janbartnitsky/flespi_receiver | flespi_receiver/aws_iot_handler.py | flespi_receiver/aws_iot_handler.py | # -*- coding: utf-8 -*-
from .handler_class import handler_class
# A copy of the License is located at http://aws.amazon.com/apache2.0
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
import json
class aws_iot_handler_class(handler_class):
def __init__(self, *args, **kwargs):
# verify required input p... | # -*- coding: utf-8 -*-
from .handler_class import handler_class
# A copy of the License is located at http://aws.amazon.com/apache2.0
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
class aws_iot_handler_class(handler_class):
def __init__(self, *args, **kwargs):
# verify required input parameters
... | mit | Python |
fec3dec8c86eaf7a67dc78e8fd48703c31015aa6 | enable v.1.1 processes | bird-house/flyingpigeon | flyingpigeon/processes/__init__.py | flyingpigeon/processes/__init__.py | from .wps_subset_countries import ClippingProcess
from .wps_subset_continents import ClipcontinentProcess
from .wps_subset_regionseurope import ClipregionseuropeProcess
from .wps_pointinspection import PointinspectionProcess
from .wps_landseamask import LandseamaskProcess
# from .wps_climatefactsheet import FactsheetPr... | from .wps_subset_countries import ClippingProcess
from .wps_subset_continents import ClipcontinentProcess
from .wps_subset_regionseurope import ClipregionseuropeProcess
from .wps_pointinspection import PointinspectionProcess
from .wps_landseamask import LandseamaskProcess
# from .wps_climatefactsheet import FactsheetPr... | apache-2.0 | Python |
c53b7b3cb29ee640124e18f948fa7c6c2efafa4e | Improve Analysis -> Start Calculation | FRidh/Sea,FRidh/Sea,python-acoustics/Sea,python-acoustics/Sea | gui/analysis/actions.py | gui/analysis/actions.py | """
The following are some actions.
"""
from PyQt4 import QtCore, QtGui
import FreeCADGui as Gui
import FreeCAD as App
import logging
class RunAnalysis(object):
"""
Perform the SEA analysis. Solve the modal energies.
"""
def Activated(self):
import Sea
objects = Gui.S... | """
The following are some actions.
"""
from PyQt4 import QtCore, QtGui
import FreeCADGui as Gui
import FreeCAD as App
import logging
class RunAnalysis(object):
"""
Perform the SEA analysis. Solve the modal energies.
"""
def Activated(self):
import Sea
if App.ActiveDocument is... | bsd-3-clause | Python |
2651b36093566140180be60b89edb01ec470d959 | Fix assert_is_iterable_of() for non-iterable inputs | aleju/imgaug,aleju/imgaug,aleju/ImageAugmenter | imgaug/validation.py | imgaug/validation.py | """Helper functions to validate input data and produce error messages."""
import imgaug as ia
def convert_iterable_to_string_of_types(iterable_var):
"""Convert an iterable of values to a string of their types.
Parameters
----------
iterable_var : iterable
An iterable of variables, e.g. a list... | """Helper functions to validate input data and produce error messages."""
import imgaug as ia
def convert_iterable_to_string_of_types(iterable_var):
"""Convert an iterable of values to a string of their types.
Parameters
----------
iterable_var : iterable
An iterable of variables, e.g. a list... | mit | Python |
459bf08b9fe4ae5a879a138bd2497abb23bf5910 | Return a text attribute for an hover only module | VirusTotal/misp-modules,MISP/misp-modules,MISP/misp-modules,amuehlem/misp-modules,MISP/misp-modules,Rafiot/misp-modules,Rafiot/misp-modules,amuehlem/misp-modules,Rafiot/misp-modules,amuehlem/misp-modules,VirusTotal/misp-modules,VirusTotal/misp-modules | modules/expansion/cve.py | modules/expansion/cve.py | import json
import requests
misperrors = {'error': 'Error'}
mispattributes = {'input': ['vulnerability'], 'output': ['text']}
moduleinfo = {'version': '0.2', 'author': 'Alexandre Dulaunoy', 'description': 'An expansion hover module to expand information about CVE id.', 'module-type': ['hover']}
moduleconfig = []
cveap... | import json
import requests
misperrors = {'error': 'Error'}
mispattributes = {'input': ['vulnerability'], 'output': ['']}
moduleinfo = {'version': '0.1', 'author': 'Alexandre Dulaunoy', 'description': 'An expansion hover module to expand information about CVE id.', 'module-type': ['hover']}
moduleconfig = []
cveapi_ur... | agpl-3.0 | Python |
90df1a03ed703a8918702f324c2e313b4443a172 | convert to use fixtures to ensure pnc instance is not polluted | project-ncl/pnc-cli,janinko/pnc-cli,project-ncl/pnc-cli,janinko/pnc-cli,jianajavier/pnc-cli,jianajavier/pnc-cli,janinko/pnc-cli,jianajavier/pnc-cli,project-ncl/pnc-cli,thauser/pnc-cli,thauser/pnc-cli,thauser/pnc-cli | test/integration/test_projects_api.py | test/integration/test_projects_api.py | import pytest
from pnc_cli import projects
from pnc_cli.swagger_client.apis.projects_api import ProjectsApi
from pnc_cli import utils
from test import testutils
projects_api = ProjectsApi(utils.get_api_client())
@pytest.fixture(scope='function')
def new_project(request):
project = projects_api.create_new(body=pro... | from pnc_cli import projects
from pnc_cli.swagger_client.apis.projects_api import ProjectsApi
from pnc_cli import utils
from test import testutils
projects_api = ProjectsApi(utils.get_api_client())
def _create_project():
randname = testutils.gen_random_name()
return projects_api.create_new(body=projects._cre... | apache-2.0 | Python |
9e2466046681c64c2f4723609aa870f98b52d476 | Update more attrs in reconcile_message(). | Eagles2F/sync-engine,closeio/nylas,gale320/sync-engine,closeio/nylas,EthanBlackburn/sync-engine,EthanBlackburn/sync-engine,closeio/nylas,EthanBlackburn/sync-engine,jobscore/sync-engine,ErinCall/sync-engine,jobscore/sync-engine,jobscore/sync-engine,PriviPK/privipk-sync-engine,EthanBlackburn/sync-engine,wakermahmud/sync-... | inbox/models/util.py | inbox/models/util.py | from inbox.models.message import Message
from inbox.models.thread import Thread
from inbox.models.folder import Folder, FolderItem
from inbox.util.file import Lock
from inbox.log import get_logger
log = get_logger()
class NotFound(Exception):
pass
# Namespace Utils
def _db_write_lockfile_name(account_id):
... | from inbox.models.message import Message
from inbox.models.thread import Thread
from inbox.models.folder import Folder, FolderItem
from inbox.util.file import Lock
from inbox.log import get_logger
log = get_logger()
class NotFound(Exception):
pass
# Namespace Utils
def _db_write_lockfile_name(account_id):
... | agpl-3.0 | Python |
8f6a1e154daa497b0955bc0643af330955150d3e | fix name | Jafte/jasn.ru,Jafte/jasn.ru,Jafte/jasn.ru | user_profile/helper.py | user_profile/helper.py | def get_full_name_or_username(user):
result = []
if user.first_name or user.last_name:
if user.last_name:
result.append(user.last_name)
if user.first_name:
result.append(user.first_name)
else:
result.append(user.username)
return " ".join(result) | def get_full_name_or_username(user):
result = []
if user.first_name or user.last_name:
if user.first_name:
result.append(user.first_name)
if user.last_name:
result.append(user.last_name)
else:
result.append(user.username)
return " ".join(result) | mit | Python |
c0aaefe5785c4fa5e229de2f29913664f0e8dfa3 | Fix typo | brunosmmm/hdltools,brunosmmm/hdltools | hdltools/vcd/history.py | hdltools/vcd/history.py | """VCD value history."""
from hdltools.vcd import VCDObject, VCDScope
class VCDValueHistoryEntry(VCDObject):
"""Value history entry."""
def __init__(self, scope: VCDScope, signal: str, time):
"""Initialize."""
super().__init__()
self._scope = scope
self._signal = signal
... | """VCD value history."""
from hdltools.vcd import VCDObject, VCDScope
class VCDValueHistoryEntry(VCDObject):
"""Value history entry."""
def __init__(self, scope: VCDScope, signal: str, time):
"""Initialize."""
super().__init__()
self._scope = scope
self._signal = signal
... | mit | Python |
0341805c69411d1044490adf1b82fd92154094f4 | Remove redundant code | cyberkitsune/PSO2Proxy,cyberkitsune/PSO2Proxy,alama/PSO2Proxy,flyergo/PSO2Proxy,alama/PSO2Proxy,flyergo/PSO2Proxy,alama/PSO2Proxy,cyberkitsune/PSO2Proxy | proxy/plugins/redpill.py | proxy/plugins/redpill.py | # redpill.py PSO2Proxy plugin
# For use with redpill.py flask webapp and website for packet logging and management
import sqlite, plugins, os, glob
dbLocation = '/var/pso2-www/redpill/redpill.db'
enabled = False
if enabled:
@plugins.onStartHook
def redpillInit():
print("[Redpill] Redpill initilizing with database... | # redpill.py PSO2Proxy plugin
# For use with redpill.py flask webapp and website for packet logging and management
import sqlite, plugins, os, glob
dbLocation = '/var/pso2-www/redpill/redpill.db'
enabled = False
if enabled:
@plugins.onStartHook
def redpillInit():
print("[Redpill] Redpill initilizing with database... | agpl-3.0 | Python |
4730b11b070b040718f4e9b7224d9a6a63f87eb7 | Fix lint errors | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | lib/node_modules/@stdlib/math/base/special/erfc/benchmark/python/benchmark.py | lib/node_modules/@stdlib/math/base/special/erfc/benchmark/python/benchmark.py | #!/usr/bin/env python
"""Benchmark erfc."""
from __future__ import print_function
import timeit
NAME = "erfc"
REPEATS = 3
ITERATIONS = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
... | #!/usr/bin/env python
"""Benchmark erfc."""
import timeit
name = "erfc"
repeats = 3
iterations = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
* `total`: total number of tests
... | apache-2.0 | Python |
8786ce79f4d836348d95c5a8e4f9f4d7c4a95674 | Use parametrize | alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin | tests/app/main/test_request_header.py | tests/app/main/test_request_header.py | import pytest
from tests.conftest import set_config_values
@pytest.mark.parametrize('check_proxy_header,header_value,expected_code', [
(True, 'key_1', 200),
(True, 'wrong_key', 403),
(False, 'wrong_key', 200),
(False, 'key_1', 200),
])
def test_route_correct_secret_key(app_, check_proxy_header, heade... | from tests.conftest import set_config_values
def test_route_correct_secret_key(app_, client):
with set_config_values(app_, {
'ROUTE_SECRET_KEY_1': 'key_1',
'ROUTE_SECRET_KEY_2': '',
'DEBUG': False,
}):
response = client.get(
path='/_status',
headers=[
... | mit | Python |
6f0c43c202a4a304b4a07551abe82aeb2923213d | Change the name in setup.py | humblec/heketi,humblec/heketi,humblec/heketi,humblec/heketi | client/api/python/setup.py | client/api/python/setup.py | # Copyright (c) 2016 heketi authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | # Copyright (c) 2016 heketi authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | apache-2.0 | Python |
801d0f66f69172d84009a6a7585347a88346ace3 | Set snapshot dir to a known location in FuseSoC SweRV config generator | chipsalliance/Cores-SweRV,chipsalliance/Cores-SweRV,chipsalliance/Cores-SweRV,chipsalliance/Cores-SweRV | configs/swerv_config_gen.py | configs/swerv_config_gen.py | #!/usr/bin/env python
from fusesoc.capi2.generator import Generator
import os
import shutil
import subprocess
import sys
import tempfile
if sys.version[0] == '2':
devnull = open(os.devnull, 'w')
else:
from subprocess import DEVNULL as devnull
class SwervConfigGenerator(Generator):
def run(self):
bu... | #!/usr/bin/env python
from fusesoc.capi2.generator import Generator
import os
import shutil
import subprocess
import sys
import tempfile
if sys.version[0] == '2':
devnull = open(os.devnull, 'w')
else:
from subprocess import DEVNULL as devnull
class SwervConfigGenerator(Generator):
def run(self):
sc... | apache-2.0 | Python |
63ed2ae465f236c76b9f09b21e78196d3448560c | Support SPL toolkit version dependencies | ddebrunner/streamsx.topology,IBMStreams/streamsx.topology,ddebrunner/streamsx.topology,IBMStreams/streamsx.topology,IBMStreams/streamsx.topology,IBMStreams/streamsx.topology,ddebrunner/streamsx.topology,IBMStreams/streamsx.topology,ddebrunner/streamsx.topology,ddebrunner/streamsx.topology,ddebrunner/streamsx.topology,I... | com.ibm.streamsx.topology/opt/python/packages/streamsx/spl/toolkit.py | com.ibm.streamsx.topology/opt/python/packages/streamsx/spl/toolkit.py | # coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2017
"""
SPL toolkit integration.
********
Overview
********
SPL operators are defined by an SPL toolkit. When a ``Topology``
contains invocations of SPL operators, their defining toolkit must
be made known using :py:func:`add_toolkit`.
To... | # coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2017
"""
SPL toolkit integration.
********
Overview
********
SPL operators are defined by an SPL toolkit. When a ``Topology``
contains invocations of SPL operators, their defining toolkit must
be made known using :py:func:`add_toolkit`.
To... | apache-2.0 | Python |
fbec7b630528b29a1dd5e9729211679da9f3897c | Add require_settings | MariosPanag/coala,yland/coala,saurabhiiit/coala,SambitAcharya/coala,rresol/coala,FeodorFitsner/coala,sophiavanvalkenburg/coala,scottbelden/coala,sudheesh001/coala,Balaji2198/coala,impmihai/coala,ayushin78/coala,MariosPanag/coala,ManjiriBirajdar/coala,Asnelchristian/coala,lonewolf07/coala,sagark123/coala,jayvdb/coala,ja... | coalib/output/Outputter.py | coalib/output/Outputter.py | """
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT... | """
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT... | agpl-3.0 | Python |
0ef1fa8173b57bcbddfa5279a71b8351f959a0e6 | Remove stray ascontiguous in feed_forward | spacy-io/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc | thinc/neural/_classes/feed_forward.py | thinc/neural/_classes/feed_forward.py | from .model import Model
from ... import describe
def _run_child_hooks(model, X, y):
for layer in model._layers:
for hook in layer.on_data_hooks:
hook(layer, X, y)
X = layer(X)
@describe.on_data(_run_child_hooks)
class FeedForward(Model):
'''A feed-forward network, that chains mu... | from .model import Model
from ... import describe
def _run_child_hooks(model, X, y):
for layer in model._layers:
for hook in layer.on_data_hooks:
hook(layer, X, y)
X = layer(X)
if hasattr(X, 'shape'):
X = model.ops.xp.ascontiguousarray(X)
@describe.on_data(_run_ch... | mit | Python |
2bb2c2802fca00e513aa3879ce2a26a37c5a6ed3 | remove debug | LandRegistry/property-frontend-alpha,LandRegistry/property-frontend-alpha,LandRegistry/property-frontend-alpha,LandRegistry/property-frontend-alpha | viewproperty/server.py | viewproperty/server.py | from viewproperty import app
from flask import render_template
import requests
@app.route('/')
def index():
return render_template('index.html')
@app.route('/property/<title_number>')
def property(title_number):
titles_api_url = app.config['TITLE_API_URL']
title_url = "%s/titles/%s" % (titles_api_url, ti... | from viewproperty import app
from flask import render_template
import requests
@app.debug = true
@app.route('/')
def index():
return render_template('index.html')
@app.route('/property/<title_number>')
def property(title_number):
titles_api_url = app.config['TITLE_API_URL']
title_url = "%s/titles/%s" % (... | mit | Python |
934f2c05a0c9f1038c657740305585563a9bfec5 | Improve Django Admin site. | lizardsystem/lizard-auth-server,lizardsystem/lizard-auth-server | lizard_auth_server/admin.py | lizard_auth_server/admin.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from django.utils.translation import ugettext_lazy, ugettext as _
from django.core.urlresolvers import reverse
from django.contrib import messages
from lizard_auth_server import models
class InvitationAdmin(admin.ModelA... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from django.utils.translation import ugettext_lazy, ugettext as _
from django.core.urlresolvers import reverse
from django.contrib import messages
from lizard_auth_server import models
class InvitationAdmin(admin.ModelA... | mit | Python |
302bdb2dd0f9f46b437d1f1fd18af63111bb2e0d | Add files via upload | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/rubios.py | locations/spiders/rubios.py | # -*- coding: utf-8 -*-
import scrapy
import re
from locations.items import GeojsonPointItem
class RubiosSpider(scrapy.Spider):
name = "rubios"
allowed_domains = ['rubios.com']
start_urls = (
'https://www.rubios.com/sitemap.xml',
)
def parse(self, response):
response.selector.rem... | # -*- coding: utf-8 -*-
import scrapy
import re
from locations.items import GeojsonPointItem
class RubiosSpider(scrapy.Spider):
name = "rubios"
allowed_domains = ['rubios.com']
start_urls = (
'https://www.rubios.com/sitemap.xml',
)
def parse(self, response):
response.selector.rem... | mit | Python |
f03254ec92307ea20f49dfa01becfa381d96729e | Update dehydrate for tastypie 0.9.15 | paulcwatts/django-whippedcream | whippedcream/fields.py | whippedcream/fields.py | from tastypie.fields import DateTimeField as BaseDateTimeField, FileField as BaseFileField
class DateTimeField(BaseDateTimeField):
"""Normalizes a datetime field by removing the microseconds."""
def __init__(self, *args, **kwargs):
self.normalize = kwargs.pop('normalize', True)
super(DateTimeF... | from tastypie.fields import DateTimeField as BaseDateTimeField, FileField as BaseFileField
class DateTimeField(BaseDateTimeField):
"""Normalizes a datetime field by removing the microseconds."""
def __init__(self, *args, **kwargs):
self.normalize = kwargs.pop('normalize', True)
super(DateTimeF... | bsd-3-clause | Python |
7820c6177e34463458c90ac5284e177713a82721 | add modification to IVGTYP | woolf1988/wrf-tools | wrfinput_maskcnland.py | wrfinput_maskcnland.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# mask region out of china as sea
# Author: Hui Zheng
import os.path
import numpy as np
import matplotlib.path as mpath
import netCDF4 as nc
def inchina(lat, lon):
lat = np.asarray(lat)
lon = np.asarray(lon)
POLYGONDIR_CANDIDATE = [os.path.expandvars('$HOME/... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# mask region out of china as sea
# Author: Hui Zheng
import os.path
import numpy as np
import matplotlib.path as mpath
import netCDF4 as nc
def inchina(lat, lon):
lat = np.asarray(lat)
lon = np.asarray(lon)
POLYGONDIR_CANDIDATE = [os.path.expandvars('$HOME/... | mit | Python |
c0e57e2fc040b205d43b2c95abb4d5f2e04f6a00 | Fix version_re for maximum compatibility | SublimeLinter/SublimeLinter-pylint,zenlambda/SublimeLinter-pylint | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by NotSqrt
# Copyright (c) 2013 NotSqrt
#
# License: MIT
#
"""This module exports the Pylint plugin class."""
from SublimeLinter.lint import PythonLinter, util
class Pylint(PythonLinter):
"""Provides an interfa... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by NotSqrt
# Copyright (c) 2013 NotSqrt
#
# License: MIT
#
"""This module exports the Pylint plugin class."""
from SublimeLinter.lint import PythonLinter, util
class Pylint(PythonLinter):
"""Provides an interfa... | mit | Python |
43efd1f110daa8f2f16475e4e6edbdf18ff28286 | Update to catch up with Sublime-Linter API | benedfit/SublimeLinter-contrib-pug-lint,benedfit/SublimeLinter-contrib-jade-lint | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Ben Edwards
# Copyright (c) 2015 Ben Edwards
#
# License: MIT
#
"""This module exports the PugLint plugin class."""
from SublimeLinter.lint import NodeLinter, WARNING
class PugLint(NodeLinter):
"""Provides an ... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Ben Edwards
# Copyright (c) 2015 Ben Edwards
#
# License: MIT
#
"""This module exports the PugLint plugin class."""
from SublimeLinter.lint import NodeLinter, util, highlight
class PugLint(NodeLinter):
"""Prov... | mit | Python |
f1874e9af69b22fd3f17938ba673d955780b69a9 | Revert "Remove empty line before class docstring" | thebinarypenguin/SublimeLinter-contrib-raml-cop | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Ethan Zimmerman
# Copyright (c) 2014 Ethan Zimmerman
#
# License: MIT
#
"""This module exports the RamlCop plugin class."""
from SublimeLinter.lint import NodeLinter
class RamlCop(NodeLinter):
"""Provides an ... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Ethan Zimmerman
# Copyright (c) 2014 Ethan Zimmerman
#
# License: MIT
#
"""This module exports the RamlCop plugin class."""
from SublimeLinter.lint import NodeLinter
class RamlCop(NodeLinter):
"""Provides an i... | mit | Python |
ae08f80030951ed097f1b084f16fa2921b6b41fe | Work with NodeLinter | zekesonxx/SublimeLinter-contrib-spider | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Zeke Sonxx
# Copyright (c) 2014 Zeke Sonxx <github.com/zekesonxx>
#
# License: MIT
#
"""This module exports the Spider plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Spider(N... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Zeke Sonxx
# Copyright (c) 2014 Zeke Sonxx <github.com/zekesonxx>
#
# License: MIT
#
"""This module exports the Spider plugin class."""
from SublimeLinter.lint import Linter, util
class Spider(Linte... | mit | Python |
ebeb9281b4a486bae83b607973d65e04539dc030 | Fix typos | ivannieto/archer-t2u-ubuntu-installer,ivannieto/archer-t2u-ubuntu-installer,ivannieto/archer-t2u-ubuntu-installer,ivannieto/archer-t2u-ubuntu-installer | t2u-driver-installer.py | t2u-driver-installer.py | import os
PATH = os.getcwd()
HOME = os.getenv('HOME')
INSTALL_FILES = PATH+'/driver-files'
DEV_DIR = HOME+'/test-install'
PROD_DIR = '/etc'
BIN_DIR = '/usr/bin/'
print(('*'*25)+'\n')
def take_input():
i = input("Please, disconnect all devices you're trying to install and press [I]: ")
return i
while(take_in... | import os
PATH = os.getcwd()
HOME = os.getenv('HOME')
INSTALL_FILES = PATH+'/driver-files'
DEV_DIR = HOME+'/test-install'
PROD_DIR = '/etc'
BIN_DIR = '/usr/bin/'
print(('*'*25)+'\n')
print()
def take_input():
i = input("Please, disconnect all devices you're trying to install and press [I]: ")
return i
while... | mit | Python |
6b0b7ef25a99edfe62bf410106f828b1b7b89e1b | Add auditor notebook tests | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon/event_manager/events/notebook.py | polyaxon/event_manager/events/notebook.py | from event_manager import event_actions, event_subjects
from event_manager.event import Attribute, Event
NOTEBOOK_STARTED = '{}.{}'.format(event_subjects.NOTEBOOK, event_actions.STARTED)
NOTEBOOK_STOPPED = '{}.{}'.format(event_subjects.NOTEBOOK, event_actions.STOPPED)
NOTEBOOK_VIEWED = '{}.{}'.format(event_subjects.NO... | from event_manager import event_actions, event_subjects
from event_manager.event import Attribute, Event
NOTEBOOK_STARTED = '{}.{}'.format(event_subjects.NOTEBOOK, event_actions.STARTED)
NOTEBOOK_STOPPED = '{}.{}'.format(event_subjects.NOTEBOOK, event_actions.STOPPED)
NOTEBOOK_VIEWED = '{}.{}'.format(event_subjects.NO... | apache-2.0 | Python |
08698f6b2a362b9b3ec2ac80e58bb3cf17210c13 | Add test for boxing and unboxing of pandas.Timestamp as well as extraction from Timestamp in nopythong mode. | IntelLabs/hpat,IntelLabs/hpat,IntelLabs/hpat,IntelLabs/hpat | hpat/tests/test_date.py | hpat/tests/test_date.py | import unittest
import pandas as pd
import numpy as np
from math import sqrt
import numba
import hpat
from hpat.tests.test_utils import (count_array_REPs, count_parfor_REPs,
count_parfor_OneDs, count_array_OneDs,
count_parfor_OneD_Vars, count_array_OneD_Vars,
... | import unittest
import pandas as pd
import numpy as np
from math import sqrt
import numba
import hpat
from hpat.tests.test_utils import (count_array_REPs, count_parfor_REPs,
count_parfor_OneDs, count_array_OneDs,
count_parfor_OneD_Vars, count_array_OneD_Vars,
... | bsd-2-clause | Python |
d770c3aa4d8f7f00b97d6e772e8c6e3eb337adc0 | Fix use of deprecated function | gawel/irc3 | irc3/plugins/sasl.py | irc3/plugins/sasl.py | # -*- coding: utf-8 -*-
import irc3
import base64
__doc__ = '''
===================================================
:mod:`irc3.plugins.sasl` SASL authentification
===================================================
Allow to use sasl authentification
..
>>> from irc3.testing import IrcBot
>>> from irc3.testing... | # -*- coding: utf-8 -*-
import irc3
import base64
__doc__ = '''
===================================================
:mod:`irc3.plugins.sasl` SASL authentification
===================================================
Allow to use sasl authentification
..
>>> from irc3.testing import IrcBot
>>> from irc3.testing... | mit | Python |
6bf8e0a5781140b3a95a0e22f0a54069e74471d2 | Allow an errored record to not have a title. | GaretJax/irco,GaretJax/irco,GaretJax/irco,GaretJax/irco | irco/parsers/base.py | irco/parsers/base.py | import abc
class IgnoreRecord(Exception):
pass
class Tokenizer(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def tokenize(self, stream):
pass
class Parser(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def parse_record(self, record):
pass
class ... | import abc
class IgnoreRecord(Exception):
pass
class Tokenizer(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def tokenize(self, stream):
pass
class Parser(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def parse_record(self, record):
pass
class ... | mit | Python |
9e9a19e0f87806c75892f55b1d603bd47d552693 | FIX disable product supplier pricelist | csrocha/account_journal_payment_subtype,csrocha/account_voucher_payline | product_supplier_pricelist/__openerp__.py | product_supplier_pricelist/__openerp__.py | # -*- coding: utf-8 -*-
{
'name': 'Product Supplier Pricelist',
'version': '1.0',
'category': 'Product',
'sequence': 14,
'summary': '',
'description': """
Product Supplier Pricelist
==========================
Add sql constraint to restrict:
1. That you can only add one supplier to a product pe... | # -*- coding: utf-8 -*-
{
'name': 'Product Supplier Pricelist',
'version': '1.0',
'category': 'Product',
'sequence': 14,
'summary': '',
'description': """
Product Supplier Pricelist
==========================
Add sql constraint to restrict:
1. That you can only add one supplier to a product pe... | agpl-3.0 | Python |
6755fdbe1764f478443ad663d1d8b11d864a7274 | Fix bad import | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/syft/src/syft/core/tensor/autograd/backward_ops/transpose.py | packages/syft/src/syft/core/tensor/autograd/backward_ops/transpose.py | # stdlib
from typing import Tuple
from uuid import UUID
# third party
from numpy import ndarray
# relative
from ..tensor import AutogradTensor
from .op import Op
class TransposeOp(Op):
"""Repeat operation across a dimension"""
def forward(self, x: AutogradTensor, *dims: Tuple[int]) -> AutogradTensor: # ty... | # stdlib
from uuid import UUID
# third party
from numpy import ndarray
# syft absolute
from syft.lib.python import Tuple
# relative
from ..tensor import AutogradTensor
from .op import Op
class TransposeOp(Op):
"""Repeat operation across a dimension"""
def forward(self, x: AutogradTensor, *dims: Tuple[int]... | apache-2.0 | Python |
a8e852b6f87774d3cc8eb9c4acb9a2f511b06e03 | Update glowy to actually USE memglow. | PogiNate/Glowy | glowy.py | glowy.py | #! /usr/bin/env Python
"""
For now this just calls the three modules. Once I learn how to process command line arguments I'll augment this to handle those as well.
"""
__author__ = 'Nate Dickson'
#import sys
#import getopt
import cpuglow
import memglow
def main():
cpuglow.equalizer()
memglow.pulse()
if __name... | #! /usr/bin/env Python
"""
For now this just calls the three modules. Once I learn how to process command line arguments I'll augment this to handle those as well.
"""
__author__ = 'Nate Dickson'
#import sys
#import getopt
import cpuglow
def main():
cpuglow.equalizer()
if __name__ == '__main__':
main()
| mit | Python |
c3c5bf54dbaa6dd5279cd82f9886d0d83fd07bcd | Fix indention error - thought that was fixed before my last push | pombreda/seascope,eaglexmw/seascope,eaglexmw/seascope,pombreda/seascope,eaglexmw/seascope,pombreda/seascope | src/view/CtagsManager.py | src/view/CtagsManager.py | import subprocess
def _eintr_retry_call(func, *args):
while True:
try:
return func(*args)
except OSError, e:
if e.errno == errno.EINTR:
continue
raise
def ct_query(filename):
cmd = 'ctags -n -u --fields=+K -f -'
args = cmd.split()
args.append(filename)
proc = subprocess.Popen(args, stdout=subpro... | import subprocess
def _eintr_retry_call(func, *args):
while True:
try:
return func(*args)
except OSError, e:
if e.errno == errno.EINTR:
continue
raise
def ct_query(filename):
cmd = 'ctags -n -u --fields=+K -f -'
args = cmd.split()
args.append(filename)
proc = subprocess.Popen(args, stdout=subprocess... | bsd-3-clause | Python |
dc34715af78304abf84c789c0db01b7e8b81b82e | add models to dict | delitamakanda/socialite,delitamakanda/socialite,delitamakanda/socialite | manage.py | manage.py | #!/usr/bin/env python
import os
COV = None
if os.environ.get('COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='app/*')
COV.start()
from app import create_app, db
from app.models import User, Role, Post, Permission, Follow, Comment
from flask.ext.script import Manager, Shell
from fla... | #!/usr/bin/env python
import os
COV = None
if os.environ.get('COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='app/*')
COV.start()
from app import create_app, db
from app.models import User, Role, Post, Permission, Follow
from flask.ext.script import Manager, Shell
from flask.ext.mi... | mit | Python |
58e43c9f7c23d2b92abd23189c236733c1e819a7 | Fix import error | nerevu/prometheus-api,nerevu/prometheus-api,nerevu/prometheus-api | manage.py | manage.py | #!/usr/bin/env python
import os.path as p
from subprocess import call
from pprint import pprint
from app import create_app, db
from flask import current_app as app
from flask.ext.script import Manager
manager = Manager(create_app)
manager.add_option(
'-m', '--cfgmode', dest='config_mode', default='Development')
man... | #!/usr/bin/env python
import os.path as p
from subprocess import call
from pprint import pprint
from app import create_app, db
from flask.ext.script import Manager
manager = Manager(create_app)
manager.add_option(
'-m', '--cfgmode', dest='config_mode', default='Development')
manager.add_option('-f', '--cfgfile', de... | mit | Python |
03380a1042443465d6f1d74afb5fd120dbc3379b | Add parallelizing code to build | tanayseven/personal_website,tanayseven/personal_website,tanayseven/personal_website,tanayseven/personal_website | manage.py | manage.py | #!/usr/bin/env python3
from manager import Manager
from multiprocessing import Pool
manager = Manager()
def func(period):
from time import sleep
sleep(period)
@manager.command
def build(threads=1):
pool = Pool(threads)
print("Starting a build with %d threads ..." % threads)
pool.map(func, [1, 1... | #!/usr/bin/env python3
from manager import Manager
manager = Manager()
@manager.command
def build(threads=1):
print("Starting a build with %d threads ..." % threads)
@manager.command
def clean():
pass
if __name__ == '__main__':
manager.main()
| mit | Python |
f465cbe3435a44594084973f4da6caa344340d2e | Add shell context initialization | chetotam/randompeople,chetotam/randompeople,chetotam/randompeople | manage.py | manage.py | # TODO: migrate to Flask CLI instead of Flask-Script
'''This module enables command line interface for randompeople app.'''
from flask_script import Manager
from app import create_app, db
from app.models import Room, Member
manager = Manager(create_app)
@manager.shell
def make_shell_context():
''''''
return d... | # TODO: migrate to Flask CLI instead of Flask-Script
'''This module enables command line interface for randompeople app.'''
from flask_script import Manager
from app import create_app
manager = Manager(create_app)
if __name__ == '__main__':
manager.run()
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.