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 |
|---|---|---|---|---|---|---|---|---|---|
51b362ab66ed8a1a793dc9995a6f06067230085b | geomdl/__init__.py | geomdl/__init__.py | """ This package contains native Python implementations of several `The NURBS Book <http://www.springer.com/gp/book/9783642973857>`_ algorithms for generating B-spline / NURBS curves and surfaces. It also provides a data structure for storing elements required for evaluation these curves and surfaces.
Please follow the... | """ This package contains native Python implementations of several `The NURBS Book <http://www.springer.com/gp/book/9783642973857>`_ algorithms for generating B-spline / NURBS curves and surfaces. It also provides a data structure for storing elements required for evaluation these curves and surfaces.
Please follow the... | Disable import * as it seems to cause some unnecessary trouble | Disable import * as it seems to cause some unnecessary trouble
| Python | mit | orbingol/NURBS-Python,orbingol/NURBS-Python |
e71f23f0bef4307831b240ee162bd9e2cf84e212 | hoomd/pytest/dummy.py | hoomd/pytest/dummy.py | from hoomd.triggers import Trigger
from hoomd.meta import _Operation, _TriggeredOperation
class DummySimulation:
def __init__(self):
self.state = DummyState()
self.operations = DummyOperations()
self._cpp_sys = DummySystem()
class DummySystem:
def __init__(self):
self.dummy_l... | from hoomd.triggers import Trigger
from hoomd.meta import _Operation, _TriggeredOperation
class DummySimulation:
def __init__(self):
self.state = DummyState()
self.operations = DummyOperations()
self._cpp_sys = DummySystem()
class DummySystem:
def __init__(self):
self.dummy_l... | Include attach method in DummyOperation | Include attach method in DummyOperation
| Python | bsd-3-clause | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue |
c5ae3a8708023039b877a47bcfedec6997ec1583 | geokey_wegovnow/conversions.py | geokey_wegovnow/conversions.py | """Methods for converting data between systems or formats."""
def make_cm_url(url):
"""Turns a Geokey url into a Community Maps url."""
protocol, address = url.split('//')
address_parts = address.split('/')
new_address_parts = []
for i, part in enumerate(address_parts):
if part == 'api':
... | """Methods for converting data between systems or formats."""
def make_cm_url(url):
"""Turns a Geokey url into a Community Maps url."""
protocol, address = url.split('//')
address_parts = address.split('/')
new_address_parts = []
for i, part in enumerate(address_parts):
if part == 'api':
... | Fix get_link_title for non-string keys and values. Include heading and main as possible titles. | Fix get_link_title for non-string keys and values.
Include heading and main as possible titles.
| Python | mit | ExCiteS/geokey-wegovnow,ExCiteS/geokey-wegovnow |
892b1f04ba6f6dde0953c061409fb4eb05935634 | bot/action/internationalization.py | bot/action/internationalization.py | import gettext
from bot.action.core.action import IntermediateAction
LOCALE_DIR = "locales"
TRANSLATION_DOMAIN = "telegram-bot"
DEFAULT_LANGUAGE = "en"
class InternationalizationAction(IntermediateAction):
def __init__(self):
super().__init__()
self.cached_translations = {}
self.default... | import gettext
from bot.action.core.action import IntermediateAction
LOCALE_DIR = "locales"
TRANSLATION_DOMAIN = "telegram-bot"
DEFAULT_LANGUAGE = "en"
CACHED_TRANSLATIONS = {}
class InternationalizationAction(IntermediateAction):
def __init__(self):
super().__init__()
self.default_translation... | Make CACHED_TRANSLATIONS global, fix get_value typo | Make CACHED_TRANSLATIONS global, fix get_value typo
| Python | agpl-3.0 | alvarogzp/telegram-bot,alvarogzp/telegram-bot |
62549a211ff41e2b84a9b085e784649efc76c5d9 | apps/domain/tests/conftest.py | apps/domain/tests/conftest.py | import pytest
import sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.append(myPath + "/../src/")
from app import create_app
@pytest.fixture(scope="function", autouse=True)
def app():
return create_app()
@pytest.fixture
def client(app):
return app.test_client()
| import pytest
import sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.append(myPath + "/../src/")
from app import create_app
@pytest.fixture(scope="function", autouse=True)
def app():
db_path = "sqlite:///databasenetwork.db"
return create_app(test_config={"SQLALCHEMY_DATABASE_URI": db_pa... | Update unit test app() fixture | Update unit test app() fixture
| Python | apache-2.0 | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft |
7f53f8da79a41591498b73356770ff1cf417adf4 | byceps/services/country/service.py | byceps/services/country/service.py | """
byceps.services.country.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from __future__ import annotations
import codecs
from dataclasses import dataclass
import json
from flask import current_app
@dataclass(frozen=Tr... | """
byceps.services.country.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from __future__ import annotations
from dataclasses import dataclass
import json
from flask import current_app
@dataclass(frozen=True)
class Coun... | Remove unnecessary codec reader, fixes type issue | Remove unnecessary codec reader, fixes type issue
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps |
6b49db80a4508c3cba7f410db8ed3f23b5234e3b | src/behavior/features/terrain.py | src/behavior/features/terrain.py | from lettuce import *
import requests
import json
tenantList = [ "511", "615", "634", "515" ]
def initialize():
with open("properties.json") as config_file:
world.config = json.load(config_file)
@before.each_scenario
def cleanContext(feature):
for tenant in tenantList:
url = world.config['targetUrl'] + ... | from lettuce import *
import requests
import json
import os
tenantList = [ "511", "615", "634", "515" ]
def initialize():
if os.getenv("LETTUCE_CONFIG"):
filename = os.getenv("LETTUCE_CONFIG")
else:
filename = "properties.json"
with open(filename) as config_file:
world.config = json.load(config_fi... | ADD Name of the configuration file in a environment variable | ADD Name of the configuration file in a environment variable
| Python | apache-2.0 | telefonicaid/fiware-keypass,telefonicaid/fiware-keypass,telefonicaid/fiware-keypass |
b9e2ee470308231f4ea4d23297f7b07fab711dba | django_lightweight_queue/task.py | django_lightweight_queue/task.py | from .job import Job
from .utils import get_backend
from . import app_settings
class task(object):
def __init__(self, queue='default'):
self.queue = queue
app_settings.WORKERS.setdefault(self.queue, 1)
def __call__(self, fn):
return TaskWrapper(fn, self.queue)
class TaskWrapper(obje... | from .job import Job
from .utils import get_backend
from . import app_settings
class task(object):
def __init__(self, queue='default', timeout=None):
self.queue = queue
self.timeout = timeout
app_settings.WORKERS.setdefault(self.queue, 1)
def __call__(self, fn):
return TaskWr... | Store a timeout value on the TaskWrapper, defaulting to no timeout. | Store a timeout value on the TaskWrapper, defaulting to no timeout.
Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com>
| Python | bsd-3-clause | lamby/django-lightweight-queue,prophile/django-lightweight-queue,thread/django-lightweight-queue,thread/django-lightweight-queue,prophile/django-lightweight-queue |
cd3b92d75c331de13a25693822cac57dc82d8e81 | mla_game/apps/transcript/management/commands/fake_game_one_gameplay.py | mla_game/apps/transcript/management/commands/fake_game_one_gameplay.py | import random
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from ...models import (
Transcript, TranscriptPhraseVote
)
from ...tasks import update_transcript_stats
class Command(BaseCommand):
help = 'Creates random votes for 5 phrases in a random transcript'... | import random
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from ...models import (
Transcript, TranscriptPhraseVote
)
from ...tasks import update_transcript_stats
class Command(BaseCommand):
help = 'Creates random votes for 5 phrases in a random transcript'... | Use a smaller set of users in fake game two gameplay | Use a smaller set of users in fake game two gameplay
| Python | mit | WGBH/FixIt,WGBH/FixIt,WGBH/FixIt |
1b0fbe54406f22017bd5f40cee52333f31807272 | hardware/sense_hat/marble_maze.py | hardware/sense_hat/marble_maze.py | # based on https://www.raspberrypi.org/learning/sense-hat-marble-maze/worksheet/
from sense_hat import SenseHat
import time
sense = SenseHat()
sense.clear()
time.sleep(0.5)
r = (255, 0, 0 )
b = (0,0,0)
maze = [[r,r,r,r,r,r,r,r],
[r,b,b,b,b,b,b,r],
[r,r,r,b,r,b,b,r],
[r,b,r,b,r,r,r,r],
... | # based on https://www.raspberrypi.org/learning/sense-hat-marble-maze/worksheet/
from sense_hat import SenseHat
import time
sense = SenseHat()
sense.clear()
time.sleep(0.5)
r = (255, 0, 0 )
b = (0,0,0)
w = (255, 255, 255 )
x = 1
y = 1
maze = [[r,r,r,r,r,r,r,r],
[r,b,b,b,b,b,b,r],
[r,r,r,b,r,b,b,r]... | Add static white marble to sense hat maze | Add static white marble to sense hat maze
| Python | mit | claremacrae/raspi_code,claremacrae/raspi_code,claremacrae/raspi_code |
3d98b426b3eb9b1ddc42e4726f7b0c99c2e488e3 | scripts/generate_setup_builtin_functions.py | scripts/generate_setup_builtin_functions.py | # Copyright 2008 Paul Hodge
import os, string
def run(functionsDirectory, outputFilename):
print "dir is: " +functionsDirectory
files = os.listdir(functionsDirectory)
functionNames = []
for file in files:
if file.endswith('.cpp'):
function_name = os.path.split(file)[1][:-4]
... | # Copyright 2008 Paul Hodge
import os, string
def run(functionsDirectory, outputFilename):
print "dir is: " +functionsDirectory
files = os.listdir(functionsDirectory)
functionNames = []
for file in files:
if file.endswith('.cpp'):
function_name = os.path.split(file)[1][:-4]
... | Enforce consistent results for generated code | Enforce consistent results for generated code
| Python | mit | andyfischer/circa,andyfischer/circa,andyfischer/circa,andyfischer/circa |
20d355c52a73e38ae421aa3e4227c2c60d6ae2ff | ckanext/inventory/logic/schema.py | ckanext/inventory/logic/schema.py | from ckan.lib.navl.validators import ignore_empty, not_empty
from ckan.logic.validators import (
name_validator, boolean_validator, is_positive_integer, isodate,
group_id_exists)
def default_inventory_entry_schema():
schema = {
'id': [unicode, ignore_empty],
'title': [unicode, not_empty],
... | from ckan.lib.navl.validators import ignore_empty, not_empty
from ckan.logic.validators import (
name_validator, boolean_validator, natural_number_validator, isodate,
group_id_exists)
def default_inventory_entry_schema():
schema = {
'id': [unicode, ignore_empty],
'title': [unicode, not_emp... | Allow zeros for recurring interval | Allow zeros for recurring interval
| Python | apache-2.0 | govro/ckanext-inventory,govro/ckanext-inventory,govro/ckanext-inventory,govro/ckanext-inventory |
133a085f40f1536d5ebb26e912d15fa3bddcc82c | manager.py | manager.py | from cement.core.foundation import CementApp
import command
import util.config
util.config.Configuration()
class Manager(CementApp):
class Meta:
label = 'QLDS-Manager'
handlers = [
command.default.ManagerBaseController,
command.setup.SetupController
]
with Manage... | from cement.core.foundation import CementApp
import command
import util.config
class Manager(CementApp):
class Meta:
label = 'QLDS-Manager'
handlers = command.commands
with Manager() as app:
app.run()
| Use handlers defined in command package | Use handlers defined in command package
| Python | mit | rzeka/QLDS-Manager |
a8515cf56837ef3f32ea53003f88275a47c4d249 | src/pipeline.py | src/pipeline.py |
import os
import fnmatch
import re
import subprocess
import sys
import json
import imp
import time
class pipeline(object):
def __init__(self):
self.name = ''
self.taskId = ''
self.taskPath = ''
self.scriptPath = ''
self.inputPath = ''
self.outputPath = ''
se... |
import os
import fnmatch
import re
import subprocess
import sys
import json
import imp
import time
from pprint import pprint
class pipeline(object):
def __init__(self):
self.name = ''
self.taskId = ''
self.taskPath = ''
self.scriptPath = ''
self.inputPath = ''
self.... | Change the way to import package dynamically | Change the way to import package dynamically
| Python | mit | s4553711/HiScript |
1172bb29cca80486fffcfda0dea61a12f643a2e9 | start_server.py | start_server.py | #!/usr/bin/env python3
# tsuserver3, an Attorney Online server
#
# Copyright (C) 2016 argoneus <argoneuscze@gmail.com>
#
# 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 ... | #!/usr/bin/env python3
# tsuserver3, an Attorney Online server
#
# Copyright (C) 2016 argoneus <argoneuscze@gmail.com>
#
# 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 ... | Install PyYAML automatically before starting server | Install PyYAML automatically before starting server
| Python | agpl-3.0 | Attorney-Online-Engineering-Task-Force/tsuserver3,Mariomagistr/tsuserver3 |
c42393a99435278f577b508e204bdfe1a9a6ff68 | testproject/tablib_test/tests.py | testproject/tablib_test/tests.py | from django.test import TestCase
from django_tablib import ModelDataset, Field
from .models import TestModel
class DjangoTablibTestCase(TestCase):
def test_declarative_fields(self):
class TestModelDataset(ModelDataset):
field1 = Field()
field2 = Field(attribute='field1')
... | from django.test import TestCase
from django_tablib import ModelDataset, Field
from .models import TestModel
class DjangoTablibTestCase(TestCase):
def setUp(self):
TestModel.objects.create(field1='value')
def test_declarative_fields(self):
class TestModelDataset(ModelDataset):
f... | Test that declarative fields actually work. | Test that declarative fields actually work.
| Python | mit | ebrelsford/django-tablib,joshourisman/django-tablib,ebrelsford/django-tablib,joshourisman/django-tablib |
3c60fd42d7ce84b0f90d80d6e04b46c8affb5ff5 | maedchenbund/views.py | maedchenbund/views.py | from django.shortcuts import render
from .models import Document
def documents(request):
docs = Document.objects.all().order_by("title")
return render(request, 'home.html', {'documents': docs})
| from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from .models import Document
@login_required
def documents(request):
docs = Document.objects.all().order_by("title")
return render(request, 'home.html', {'documents': docs})
| Add required login to maedchenbund | Add required login to maedchenbund
| Python | mit | n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb |
e68dcc13d6152b15f2b7c5c151e03437d9cda314 | lib/python/mod_python/__init__.py | lib/python/mod_python/__init__.py | #
# Copyright 2004 Apache Software Foundation
#
# 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 applicabl... | #
# Copyright 2004 Apache Software Foundation
#
# 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 applicabl... | Fix for MODPYTHON-55 : added a version attribute to the mod_python package. | Fix for MODPYTHON-55 : added a version attribute to the mod_python package.
| Python | apache-2.0 | Distrotech/mod_python,Distrotech/mod_python,Distrotech/mod_python |
37f6d1a693134785dbfb2cb50b4b6e562be83f1e | collection_registry_client.py | collection_registry_client.py | import json
import sys, os
sys.path.insert(0, os.path.abspath('./python-tastypie-client'))
import tastypie_client
url_root = "http://vorol-dev.cdlib.org/"
path_collection_registry = "collection_registry/api/v1"
url_api = url_root+path_collection_registry
entrypoint_entrypoint_key = "list_entrypoint"
entrypoint_sch... | import sys, os
sys.path.insert(0, os.path.abspath('./python-tastypie-client'))
import tastypie_client
url_root = "http://vorol-dev.cdlib.org/"
path_collection_registry = "collection_registry/api/v1"
url_api = url_root+path_collection_registry
entrypoint_entrypoint_key = "list_entrypoint"
entrypoint_schema_key = "sc... | Remove json import, not needed yet | Remove json import, not needed yet
| Python | bsd-3-clause | mredar/ucldc_collection_registry_client |
9ce2faa950086f95f5a9c1f3e4f22e0a52622d8f | luminoso_api/wrappers/account.py | luminoso_api/wrappers/account.py |
from .base import BaseWrapper
from .database import Database
from ..constants import URL_BASE
class Account(BaseWrapper):
"""An object encapsulating a billing account on Luminoso's servers"""
def __init__(self, acct_name, session):
"""Construct a wrapper around a particular account name
NOT... |
from .base import BaseWrapper
from .database import Database
from ..constants import URL_BASE
class Account(BaseWrapper):
"""An object encapsulating a billing account on Luminoso's servers"""
def __init__(self, acct_name, session):
"""Construct a wrapper around a particular account name
NOT... | Adjust Account.databases() to new return format | Adjust Account.databases() to new return format
| Python | mit | LuminosoInsight/luminoso-api-client-python |
ce889047cd06714c1da86daf787583e84a59956a | api/azure.py | api/azure.py | import os
from azure.storage import *
def store(image, entity, entity_id):
blob_service = BlobService(account_name='shnergledata',
account_key=os.environ['BLOB_KEY'])
myblob = image.read()
name = '/' + entity + '/' + entity_id
blob_service.put_blob('images', name, myblo... | import os
from azure.storage import BlobService
def store(image, entity, entity_id):
blob_service = BlobService(account_name='shnergledata',
account_key=os.environ['BLOB_KEY'])
myblob = image.read()
name = '/' + entity + '/' + entity_id
blob_service.put_blob('images', n... | Revert "The same thing, but their way haha" | Revert "The same thing, but their way haha"
This reverts commit ab12f6cc4593e81bc426a54e8aebc1671ac34e2a.
| Python | mit | shnergle/ShnergleServer |
8898f23a429112cd80e6a2c8321b0de44aeaee7e | blanc_basic_pages/forms.py | blanc_basic_pages/forms.py | from django import forms
from django.conf import settings
from mptt.forms import MPTTAdminForm
from .models import Page
TEMPLATE_CHOICES = getattr(settings, 'PAGE_TEMPLATES', (
('', 'Default'),
))
class PageAdminForm(MPTTAdminForm):
class Meta:
model = Page
exclude = ()
def __init__(s... | from django import forms
from django.conf import settings
from mptt.forms import MPTTAdminForm
from .models import Page
TEMPLATE_CHOICES = getattr(settings, 'PAGE_TEMPLATES', (
('', 'Default'),
))
class PageAdminForm(MPTTAdminForm):
class Meta:
model = Page
exclude = ()
widgets = {... | Use custom widget for template choices instead | Use custom widget for template choices instead
A bit more Djangonic than tweaking self.fields
| Python | bsd-3-clause | blancltd/blanc-basic-pages |
c24dc7db961b03c947a98454fc3e8655c5f938ff | functional_tests/test_all_users.py | functional_tests/test_all_users.py | from datetime import date
from django.core.urlresolvers import reverse
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.utils import formats
from selenium import webdriver
class HomeNewVisitorTest(StaticLiveServerTestCase):
def setUp(self):
self.browser = webdriver.Fire... | from datetime import date
from django.core.urlresolvers import reverse
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.utils import formats
from selenium import webdriver
class HomeNewVisitorTest(StaticLiveServerTestCase):
def setUp(self):
self.browser = webdriver.Fire... | Fix css and heading test also removed localization test as no longer required | Fix css and heading test also removed localization test as no longer required
| Python | mit | iAmMrinal0/django_moviealert,iAmMrinal0/django_moviealert,iAmMrinal0/django_moviealert |
de6a32e4b9a94103c923188894da6455ca14956c | TopTenView.py | TopTenView.py | # coding: utf-8
# ui.View subclass for the top ten iTunes songs.
# Pull requests gladly accepted.
import feedparser, requests, ui
url = 'https://itunes.apple.com/us/rss/topsongs/limit=10/xml'
def get_image_urls(itunes_url):
for entry in feedparser.parse(itunes_url).entries:
yield entry['summary'].partit... | # coding: utf-8
# ui.View subclass for the top ten iTunes songs.
# Pull requests gladly accepted.
import feedparser, requests, ui
url = 'https://itunes.apple.com/us/rss/topsongs/limit=10/xml'
def get_image_urls(itunes_url):
for entry in feedparser.parse(itunes_url).entries:
yield entry['summary'].partit... | Move to buttons & remove hardcoding of image size | Move to buttons & remove hardcoding of image size | Python | apache-2.0 | cclauss/Pythonista_ui |
ceeb64c9e46a74f95178be88566fba3d7f080fa1 | mica/stats/tests/test_acq_stats.py | mica/stats/tests/test_acq_stats.py | from .. import acq_stats
def test_calc_stats():
acq_stats.calc_stats(17210)
| import tempfile
import os
from .. import acq_stats
def test_calc_stats():
acq_stats.calc_stats(17210)
def test_make_acq_stats():
"""
Save the acq stats for one obsid into a newly-created table
"""
# Get a temporary file, but then delete it, because _save_acq_stats will only
# make a new tab... | Add a test that makes a new acq stats database | Add a test that makes a new acq stats database
| Python | bsd-3-clause | sot/mica,sot/mica |
dd0d047829e65e613e4d2e9ccd9a6411fa9e301f | test.py | test.py | from interruptingcow import timeout
import time
while True:
# simulate waiting for laser A
print("Waiting for laser A")
time.sleep(2)
print("laser A tripped")
try:
with timeout(.25, exception=RuntimeError):
# perform a potentially very slow operation
print("Wait for ... | from interruptingcow import timeout
import time
# def bTripped():
# +1 to DB
# continue
while True:
# simulate waiting for laser A
print("Waiting for laser A")
time.sleep(2)
print("laser A tripped")
# Real code would be:
# laserA.wait_for_dark()
try:
with timeout(.25, excep... | Add real code in comments. | Add real code in comments.
| Python | apache-2.0 | pjcoleman73/UVaLibRoomCount |
8c8307ff5313b1f6c69d976853f763daf2aece0c | test.py | test.py | """ Functions to call the api and test it """
import sys
import fenix
api = fenix.FenixAPISingleton()
print('Testing Fenix API SDK Python')
auth_url = api.get_authentication_url()
print(auth_url)
api.set_code(sys.argv[1])
print('Access token: ' + api.get_access_token())
print('Refresh token: ' + api.get_refresh_token... | """ Functions to call the api and test it """
import sys
import fenix
api = fenix.FenixAPISingleton()
print('Testing Fenix API SDK Python')
auth_url = api.get_authentication_url()
print(api.get_space('2465311230082'))
print(auth_url)
api.set_code(sys.argv[1])
print('Access token: ' + api.get_access_token())
print('Re... | Test now calls a public endpoint first | Test now calls a public endpoint first
| Python | mit | samfcmc/fenixedu-python-sdk |
f74d57f4a05fa56b8668e371159affe37f4c38c3 | opentreemap/otm_comments/models.py | opentreemap/otm_comments/models.py | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from threadedcomments.models import ThreadedComment
from django.contrib.gis.db import models
from treemap.instance import Instance
class EnhancedThreadedComment(ThreadedComment):
... | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from threadedcomments.models import ThreadedComment
from django.contrib.gis.db import models
class EnhancedThreadedComment(ThreadedComment):
"""
This class wraps the Threade... | Fix circular dependency problem with django apps | Fix circular dependency problem with django apps
It looks like translation is importing *all other* django apps in the project
when it is used from treemap. This means that it will load apps that
depend on treemap when it is not finished import treemap. So while it
appears that treemap/otm1_migrator/otm_comments have ... | Python | agpl-3.0 | recklessromeo/otm-core,clever-crow-consulting/otm-core,maurizi/otm-core,recklessromeo/otm-core,maurizi/otm-core,RickMohr/otm-core,RickMohr/otm-core,recklessromeo/otm-core,RickMohr/otm-core,maurizi/otm-core,clever-crow-consulting/otm-core,recklessromeo/otm-core,RickMohr/otm-core,clever-crow-consulting/otm-core,maurizi/o... |
e3c660cc4b5e72af3f6155c2426555247a4699b5 | tests/test_ultrametric.py | tests/test_ultrametric.py | from viridis import tree
from six.moves import range
def test_split():
t = tree.Ultrametric(list(range(6)))
t.merge(0, 1, 0.1)
t.merge(6, 2, 0.2)
t.merge(3, 4, 0.3)
t.merge(8, 5, 0.4)
t.merge(7, 8, 0.5)
t.split(0, 2)
assert t.node[9]['num_leaves'] == 3
t.split(0, 4) # nothing to do
... | from viridis import tree
from six.moves import range
import pytest
@pytest.fixture
def base_tree():
t = tree.Ultrametric(list(range(6)))
t.merge(0, 1, 0.1)
t.merge(6, 2, 0.2)
t.merge(3, 4, 0.3)
t.merge(8, 5, 0.4)
t.merge(7, 8, 0.5)
return t
def test_split(base_tree):
t = base_tree
... | Update test to use pytest fixture | Update test to use pytest fixture
| Python | mit | jni/viridis |
7aa68e0f7c553a964725ddf63c8de44eff3b3f10 | lib/log_processor.py | lib/log_processor.py | import re
import snmpy
class log_processor(snmpy.plugin):
def create(self):
for k, v in sorted(self.conf['objects'].items()):
extra = {
'count': re.compile(v['count']),
'reset': re.compile(v['reset']) if 'reset' in v else None,
'start': int(v['sta... | import re
import snmpy
class log_processor(snmpy.plugin):
def create(self):
for k, v in sorted(self.conf['objects'].items()):
extra = {
'count': re.compile(v['count']),
'reset': re.compile(v['reset']) if 'reset' in v else None,
'start': int(v['... | Add reset on rotation support in log processor. | Add reset on rotation support in log processor.
| Python | mit | mk23/snmpy,mk23/snmpy |
af5ff98f150158e4f2e0bd2281229a6248a8fb52 | cdc/models.py | cdc/models.py | from django.db import models
from django.contrib.auth.models import User
class SiteUser(models.Model):
def __str__(self):
return self.user.username
# Using a OneToOneField so we can add the extra 'company' parameter to the user
# without extending or replacing Django's User model
user = models.OneToOneFiel... | from django.db import models
from django.contrib.auth.models import User
class SiteUser(models.Model):
def __str__(self):
return self.company + " | " + self.user.username
# Using a OneToOneField so we can add the extra 'company' parameter to the user
# without extending or replacing Django's User model
use... | Change siteuser string for clarity | Change siteuser string for clarity
| Python | mit | mgerst/cdc2-2015-www,ISEAGE-ISU/cdc2-2015-www,mg1065/cdc2-2015-www,mgerst/cdc2-2015-www,keaneokelley/Crippling-Debt-Corporation,keaneokelley/Crippling-Debt-Corporation,ISEAGE-ISU/cdc2-2015-www,mg1065/cdc2-2015-www |
782a4b028c45d3cc37e6679ccc3d482f0518b4b7 | txircd/modules/cmode_t.py | txircd/modules/cmode_t.py | from twisted.words.protocols import irc
from txircd.modbase import Mode
class TopiclockMode(Mode):
def checkPermission(self, user, cmd, data):
if cmd != "TOPIC":
return data
if "topic" not in data:
return data
targetChannel = data["targetchan"]
if "t" in targetChannel.mode and not user.hasAccess(self.ir... | from twisted.words.protocols import irc
from txircd.modbase import Mode
class TopiclockMode(Mode):
def checkPermission(self, user, cmd, data):
if cmd != "TOPIC":
return data
if "topic" not in data:
return data
targetChannel = data["targetchan"]
if "t" in targetChannel.mode and not user.hasAccess(targetC... | Fix the order of parameters to hasAccess, which broke all topic changing when +t was set | Fix the order of parameters to hasAccess, which broke all topic changing when +t was set
| Python | bsd-3-clause | ElementalAlchemist/txircd,Heufneutje/txircd,DesertBus/txircd |
8ad7b5546e0afd25b55411851feee61e5377a71d | PrinterApplication.py | PrinterApplication.py | from Cura.Wx.WxApplication import WxApplication
class PrinterApplication(WxApplication):
def __init__(self):
super(PrinterApplication, self).__init__()
def run(self):
super(PrinterApplication, self).run()
| from Cura.Wx.WxApplication import WxApplication
from Cura.Wx.MainWindow import MainWindow
class PrinterApplication(WxApplication):
def __init__(self):
super(PrinterApplication, self).__init__()
def run(self):
window = MainWindow("Cura Printer")
window.Show()
super(Print... | Add a MainWindow class to Wx and use it in printer and scanner | Add a MainWindow class to Wx and use it in printer and scanner
| Python | agpl-3.0 | quillford/Cura,Curahelper/Cura,senttech/Cura,bq/Ultimaker-Cura,fxtentacle/Cura,hmflash/Cura,fieldOfView/Cura,derekhe/Cura,lo0ol/Ultimaker-Cura,totalretribution/Cura,DeskboxBrazil/Cura,totalretribution/Cura,derekhe/Cura,DeskboxBrazil/Cura,quillford/Cura,ynotstartups/Wanhao,hmflash/Cura,Curahelper/Cura,ad1217/Cura,fxtent... |
5d5c944533d70c0c9c3385f3417b06d3d3060594 | MROCPdjangoForm/ocpipeline/mrpaths.py | MROCPdjangoForm/ocpipeline/mrpaths.py | #
# Code to load project paths
#
import os, sys
MR_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "/Users/dmhembere44/MR-connectome" ))
MR_CMAPPER_PATH = os.path.join(MR_BASE_PATH, "cmapper" )
MR_MRCAP_PATH = os.path.join(MR_BASE_PATH, "mrcap" )
sys.path += [ MR_BASE_PATH, MR_CMAPPER_PATH, MR_MR... | #
# Code to load project paths
#
import os, sys
MR_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.." ))
MR_CMAPPER_PATH = os.path.join(MR_BASE_PATH, "cmapper" )
MR_MRCAP_PATH = os.path.join(MR_BASE_PATH, "mrcap" )
sys.path += [ MR_BASE_PATH, MR_CMAPPER_PATH, MR_MRCAP_PATH ]
| Change to path, made relative | Change to path, made relative
Former-commit-id: f00bf782fad3f6ddc6d2c97a23ff4f087ad3a22f | Python | apache-2.0 | openconnectome/m2g,openconnectome/m2g,neurodata/ndgrutedb,openconnectome/m2g,neurodata/ndgrutedb,openconnectome/m2g,neurodata/ndgrutedb,neurodata/ndmg,openconnectome/m2g,neurodata/ndgrutedb,neurodata/ndgrutedb,neurodata/ndgrutedb,openconnectome/m2g,openconnectome/m2g,neurodata/ndgrutedb,neurodata/ndgrutedb,openconnecto... |
91519c542b2fac085dc6b785a41d2fbdba91386c | business_requirement_deliverable_report/__openerp__.py | business_requirement_deliverable_report/__openerp__.py | # -*- coding: utf-8 -*-
# © 2016 Elico Corp (https://www.elico-corp.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Business Requirement Document Printout',
'summary': 'Print the Business Requirement Document for your customers',
'version': '8.0.5.0.1',
'category': ... | # -*- coding: utf-8 -*-
# © 2016 Elico Corp (https://www.elico-corp.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Business Requirement Document Printout',
'summary': 'Print the Business Requirement Document for your customers',
'version': '8.0.5.0.1',
'category': ... | Fix manifest: add OCA in the authors | Fix manifest: add OCA in the authors
Added OCA in the authors | Python | agpl-3.0 | YogeshMahera-SerpentCS/business-requirement,sudhir-serpentcs/business-requirement |
23501afd09b13d1e5f33bdd60614fd9ac7210108 | oratioignoreparser.py | oratioignoreparser.py | import os
import re
class OratioIgnoreParser():
def __init__(self):
self.ignored_paths = ["oratiomodule.tar.gz"]
def load(self, oratio_ignore_path):
with open(oratio_ignore_path, "r") as f:
self.ignored_paths.extend([line.strip() for line in f])
def should_be_ignored(self, fi... | import os
import re
class OratioIgnoreParser():
def __init__(self):
self.ignored_paths = ["oratiomodule.tar.gz"]
def load(self, oratio_ignore_path):
with open(oratio_ignore_path, "r") as f:
self.ignored_paths.extend([line.strip() for line in f])
def extend_list(self, ignored_... | Add extend_list method to OratioIgnoreParser | Add extend_list method to OratioIgnoreParser
To make oratioignoreparser.py easily testable using unit tests.
| Python | mit | oratio-io/oratio-cli,oratio-io/oratio-cli |
efa5156a15d2fd945c406792065b3386aa61107e | package_deb_replace_version.py | package_deb_replace_version.py | import sys
def split(string, splitters):
final = [string]
for x in splitters:
for i,s in enumerate(final):
if x in s and x != s:
left, right = s.split(x, 1)
final[i] = left
final.insert(i + 1, x)
final.insert(i + 2, right)
return final
fullversion = sys.argv[1]
path = f"btsoot_{fullversion}/DE... | import sys
fullversion = sys.argv[1]
path = f"btsoot_{fullversion}/DEBIAN/control"
version = fullversion[1:]
version = version[1]
control_content = f"""Package: btsoot
Version: {version}
Section: base
Priority: optional
Architecture: i386
Depends: build-essential
Maintainer: Paul Kramme <pjkramme@gmail.com>
Descriptio... | Remove unecessary code Add first charakter remover | Remove unecessary code
Add first charakter remover
| Python | bsd-3-clause | paulkramme/btsoot |
1ce899d118b3d46a816c0fc5f2f1a6f0ca9670ed | addons/resource/models/res_company.py | addons/resource/models/res_company.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class ResCompany(models.Model):
_inherit = 'res.company'
resource_calendar_ids = fields.One2many(
'resource.calendar', 'company_id', 'Working Hours')
resourc... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class ResCompany(models.Model):
_inherit = 'res.company'
resource_calendar_ids = fields.One2many(
'resource.calendar', 'company_id', 'Working Hours')
resourc... | Set company_id on a resource.calendar on company creation | [IMP] resource: Set company_id on a resource.calendar on company creation
Purpose
=======
Currently, when creating a company, the resource calendar is created if not specified.
This lead to duplicated data. In Manufacturing > Configuration > Working Time, two same working time demo data('Standard 40 Hours/Week')
Sp... | Python | agpl-3.0 | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo |
d3d9d5a7f23bfd95ecfb6c9609c2c0d4be503ae7 | branches/extracting_oxford/molly/molly/providers/apps/search/application_search.py | branches/extracting_oxford/molly/molly/providers/apps/search/application_search.py | import logging
from molly.apps.search.providers import BaseSearchProvider
from molly.conf import applications
logger = logging.getLogger('molly.providers.apps.search.application_search')
class ApplicationSearchProvider(BaseSearchProvider):
def __init__(self, application_names=None):
self.application_nam... | import logging
from molly.apps.search.providers import BaseSearchProvider
from molly.conf import applications
logger = logging.getLogger('molly.providers.apps.search.application_search')
class ApplicationSearchProvider(BaseSearchProvider):
def __init__(self, local_names=None):
self.local_names = local_n... | Update ApplicationSearchProvider to reflect conf.settings.Application changes. | Update ApplicationSearchProvider to reflect conf.settings.Application changes.
| Python | apache-2.0 | mollyproject/mollyproject,mollyproject/mollyproject,mollyproject/mollyproject |
8b6eee19707a981fddfa2114be3d90353e049b33 | examples/undocumented/python/converter_stochasticproximityembedding.py | examples/undocumented/python/converter_stochasticproximityembedding.py | #!/usr/bin/env python
data = '../data/fm_train_real.dat'
parameter_list = [[data, 20]]
def converter_stochasticproximityembedding (data_fname, k):
try:
from shogun import RealFeatures,StochasticProximityEmbedding, SPE_GLOBAL, SPE_LOCAL, CSVFile
features = RealFeatures(CSVFile(data_fname))
converter = Stochast... | #!/usr/bin/env python
data = '../data/fm_train_real.dat'
parameter_list = [[data, 20]]
def converter_stochasticproximityembedding (data_fname, k):
try:
from shogun import RealFeatures,StochasticProximityEmbedding, SPE_GLOBAL, SPE_LOCAL, CSVFile
features = RealFeatures(CSVFile(data_fname))
converter = Stochast... | Use transform instead of embed | Use transform instead of embed
| Python | bsd-3-clause | karlnapf/shogun,lisitsyn/shogun,karlnapf/shogun,geektoni/shogun,geektoni/shogun,besser82/shogun,sorig/shogun,sorig/shogun,lisitsyn/shogun,besser82/shogun,lambday/shogun,geektoni/shogun,sorig/shogun,lambday/shogun,lambday/shogun,lambday/shogun,besser82/shogun,geektoni/shogun,lisitsyn/shogun,lisitsyn/shogun,geektoni/shog... |
49749403321d16f14ecf0f6f95d5511e5429d7a2 | actstream/__init__.py | actstream/__init__.py | try:
from actstream.signals import action
except:
pass
import django
__version__ = '1.4.0'
__author__ = 'Asif Saif Uddin, Justin Quick <justquick@gmail.com>'
if django.VERSION < (3, 2):
default_app_config = 'actstream.apps.ActstreamConfig'
| try:
from actstream.signals import action
except:
pass
import django
__version__ = '1.4.0'
__author__ = 'Asif Saif Uddin, Justin Quick <justquick@gmail.com>'
if django.VERSION >= (3, 2):
# The declaration is only needed for older Django versions
pass
else:
default_app_config = 'actstream.apps.Act... | Fix django app config default | Fix django app config default
| Python | bsd-3-clause | justquick/django-activity-stream,pombredanne/django-activity-stream,pombredanne/django-activity-stream,justquick/django-activity-stream |
edc773bfd5d25a42fa2759631500fc4861557e57 | fireplace/cards/tgt/priest.py | fireplace/cards/tgt/priest.py | from ..utils import *
##
# Minions
# Holy Champion
class AT_011:
events = Heal().on(Buff(SELF, "AT_011e"))
# Spawn of Shadows
class AT_012:
inspire = Hit(ALL_HEROES, 4)
##
# Spells
# Power Word: Glory
class AT_013:
play = Buff(TARGET, "AT_013e")
class AT_013e:
events = Attack(OWNER).on(Heal(FRIENDLY_HERO, ... | from ..utils import *
##
# Minions
# Holy Champion
class AT_011:
events = Heal().on(Buff(SELF, "AT_011e"))
# Spawn of Shadows
class AT_012:
inspire = Hit(ALL_HEROES, 4)
# Shadowfiend
class AT_014:
events = Draw(CONTROLLER).on(Buff(Draw.Args.CARD, "AT_014e"))
# Wyrmrest Agent
class AT_116:
play = HOLDING_DR... | Implement more TGT Priest cards | Implement more TGT Priest cards
| Python | agpl-3.0 | oftc-ftw/fireplace,beheh/fireplace,smallnamespace/fireplace,Meerkov/fireplace,Ragowit/fireplace,smallnamespace/fireplace,oftc-ftw/fireplace,amw2104/fireplace,liujimj/fireplace,NightKev/fireplace,jleclanche/fireplace,Ragowit/fireplace,amw2104/fireplace,liujimj/fireplace,Meerkov/fireplace |
10dea74d7f7946e9bab8c99b489793708845183c | fireplace/cards/wog/hunter.py | fireplace/cards/wog/hunter.py | from ..utils import *
##
# Minions
class OG_179:
"Fiery Bat"
deathrattle = Hit(RANDOM_ENEMY_CHARACTER, 1)
class OG_292:
"Forlorn Stalker"
play = Buff(FRIENDLY_HAND + MINION + DEATHRATTLE, "OG_292e")
OG_292e = buff(+1, +1)
| from ..utils import *
##
# Minions
class OG_179:
"Fiery Bat"
deathrattle = Hit(RANDOM_ENEMY_CHARACTER, 1)
class OG_292:
"Forlorn Stalker"
play = Buff(FRIENDLY_HAND + MINION + DEATHRATTLE, "OG_292e")
OG_292e = buff(+1, +1)
##
# Spells
class OG_045:
"Infest"
play = Buff(FRIENDLY_MINIONS, "OG_045a")
class ... | Implement Infest, On the Hunt, Call of the Wild | Implement Infest, On the Hunt, Call of the Wild
| Python | agpl-3.0 | jleclanche/fireplace,beheh/fireplace,NightKev/fireplace |
df52bf506fdb6754d51c2320108bcd832a0dfc02 | django_twilio_sms/admin.py | django_twilio_sms/admin.py | from django.contrib import admin
from .models import *
class MessageAdmin(admin.ModelAdmin):
list_display = ('to_phone_number', 'from_phone_number', 'status', 'date_sent')
list_display_links = list_display
list_filter = ('status', 'date_sent')
date_hierarchy = 'date_sent'
ordering = ('-date_sent',... | from django.contrib import admin
from .models import *
class MessageAdmin(admin.ModelAdmin):
list_display = ('to_phone_number', 'from_phone_number', 'status', 'direction', 'date_sent')
list_display_links = list_display
list_filter = ('status', 'direction', 'date_sent')
date_hierarchy = 'date_sent'
... | Add direction to Message listing | Add direction to Message listing
| Python | bsd-3-clause | cfc603/django-twilio-sms-models |
9ef1c87ec752df3fb32cfe8ee94216e5eb3326fe | alg_quick_sort.py | alg_quick_sort.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def quick_sort(a_list):
"""Quick sort algortihm with list comprehension recursion."""
if len(a_list) <= 1:
return a_list
pivot_value = a_list[len(a_list) // 2]
left_list = [x for x in a... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def quick_sort(a_list):
"""Quick sort algortihm with list comprehension recursion.
Time complexity: O(n*logn).
"""
if len(a_list) <= 1:
return a_list
pivot_value = a_list[len(a... | Add to doc string: time complexity | Add to doc string: time complexity
| Python | bsd-2-clause | bowen0701/algorithms_data_structures |
a71b60363a39414eac712210086ce51abeed41d0 | api/feedback/admin.py | api/feedback/admin.py | from django import forms
from django.contrib import admin
from feedback.models import Feedback
class FeedbackAdminForm(forms.ModelForm):
class Meta:
model = Feedback
fields = '__all__'
widgets = {
'comments': forms.Textarea(attrs={'cols': 80, 'rows': 5}),
'user_age... | from django import forms
from django.contrib import admin
from feedback.models import Feedback
class FeedbackAdminForm(forms.ModelForm):
class Meta:
model = Feedback
fields = '__all__'
widgets = {
'comments': forms.Textarea(attrs={'cols': 80, 'rows': 5}),
'user_age... | Order feedback by most recent | Order feedback by most recent
| Python | apache-2.0 | prattl/teamfinder,prattl/teamfinder,prattl/teamfinder,prattl/teamfinder |
13f857978378df38a4d52cc92aec750c3804f069 | build.py | build.py | # OSU SPS Website Build Script
def loadFile( src, prefx ):
out = ""
for line in open( src, 'r' ):
out += prefx + line
return out
def outputFile( name, content ):
file = open( name, 'w' )
file.write( content )
file.close()
out_folder = "output/"
src_folder = "src/"
includes_folder ... | # OSU SPS Website Build Script
import os
def loadFile( src, prefx ):
out = ""
for line in open( src, 'r' ):
out += prefx + line
return out
def outputFile( name, content ):
file = open( name, 'w' )
file.write( content )
file.close()
out_folder = "output/"
src_folder = "src/"
inclu... | Remove need for static pages | Remove need for static pages
| Python | mit | GeekLogan/OSU-SPS-Website,GeekLogan/OSU-SPS-Website |
037fcccebae10f608f5a2711fbbc659411d6879b | okdataset/context.py | okdataset/context.py | """
DataSet context
"""
class DsContext(object):
def __init__(self, config="okdataset.yml"):
self.workers = 8
| import yaml
import os
"""
DataSet context
"""
class Context(object):
def __init__(self, config=os.path.dirname(os.path.realpath(__file__)) + "/../okdataset.yml"):
self.workers = 8
self.config = yaml.load(open(config).read())
| Put yaml config in Context. | Put yaml config in Context.
| Python | mit | anthonyserious/okdataset,anthonyserious/okdataset |
1697d267633f981b7a6e1a14b5e5b9b05f3b8179 | imagersite/imager_images/tests.py | imagersite/imager_images/tests.py | from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.test import TestCase
import factory
from faker import Faker
from imager_profile.models import ImagerProfile
from .models import Album, Photo
# Create your tests here.
fake = Faker()
class UserFactory(factory.django.Djang... | from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.test import TestCase
import factory
from faker import Faker
from .models import Album, Photo
# Create your tests here.
fake = Faker()
class UserFactory(factory.django.DjangoModelFactory):
"""Create a fake user."""
... | Fix user, album factories; add setup for photo test case | Fix user, album factories; add setup for photo test case
| Python | mit | jesseklein406/django-imager,jesseklein406/django-imager,jesseklein406/django-imager |
a0a4ba94cc76d5c4395d869fe5ea70caae14fa36 | pyroSAR/tests/test_snap_exe.py | pyroSAR/tests/test_snap_exe.py | import pytest
from contextlib import contextmanager
from pyroSAR._dev_config import ExamineExe
from pyroSAR.snap.auxil import ExamineSnap
@contextmanager
def not_raises(ExpectedException):
try:
yield
except ExpectedException:
raise AssertionError(
"Did raise exception {0} when it s... | from contextlib import contextmanager
import pytest
from pyroSAR._dev_config import ExamineExe
from pyroSAR.snap.auxil import ExamineSnap
@contextmanager
def not_raises(ExpectedException):
try:
yield
except ExpectedException:
raise AssertionError(
"Did raise exception {0} when i... | Add unit test to determine if the classes ExamineExe and ExamineSnap will work properly. | Add unit test to determine if the classes ExamineExe and ExamineSnap will work properly.
| Python | mit | johntruckenbrodt/pyroSAR,johntruckenbrodt/pyroSAR |
584bfedf9c71bad0715b9d167c3e90ec588d5110 | pydarkstar/scrubbing/scrubber.py | pydarkstar/scrubbing/scrubber.py | from ..darkobject import DarkObject
from bs4 import BeautifulSoup
import requests
import logging
import time
class Scrubber(DarkObject):
def __init__(self):
super(Scrubber, self).__init__()
def scrub(self):
"""
Get item metadata.
"""
return {}
# noinspection PyBro... | from ..darkobject import DarkObject
from bs4 import BeautifulSoup
import requests
import logging
import time
import bs4
class Scrubber(DarkObject):
def __init__(self):
super(Scrubber, self).__init__()
def scrub(self):
"""
Get item metadata.
"""
return {}
# noinspe... | Add try accept block for bs4 features | Add try accept block for bs4 features
| Python | mit | AdamGagorik/pydarkstar |
3bceae5afd3158e98e76dd0e228efc4d1396a433 | marvin/__init__.py | marvin/__init__.py | """
marvin
~~~~~~
This is the main entry point to marvin, the API endpoints for streamr.
"""
# pylint: disable=invalid-name
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.restful import Api
from os import path
db = SQLAlchemy()
api = Api()
def create_app(config_file=... | """
marvin
~~~~~~
This is the main entry point to marvin, the API endpoints for streamr.
"""
# pylint: disable=invalid-name
from flask import Flask, make_response
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.restful import Api
from os import path
import ujson
db = SQLAlchemy()
api = Api()... | Use ujson for encoding responses. | Use ujson for encoding responses.
| Python | mit | streamr/marvin,streamr/marvin,streamr/marvin |
e096343aaaa916232633543d57431b7f3022215a | awscfncli/__main__.py | awscfncli/__main__.py | # -*- encoding: utf-8 -*-
__author__ = 'kotaimen'
__date__ = '28-Feb-2018'
"""Main cli entry point, called when awscfncli is run as a package,
imported in setuptools intergration.
cli package stucture:
Click main entry:
cli/main.py
Command groups:
cli/group_named/__init__.py
... | # -*- encoding: utf-8 -*-
__author__ = 'kotaimen'
__date__ = '28-Feb-2018'
"""Main cli entry point, called when awscfncli is run as a package,
imported in setuptools intergration.
cli package stucture:
Click main entry:
cli/main.py
Command groups:
cli/group_named/__init__.py
... | Add click automatic environment variable prefix. | Add click automatic environment variable prefix.
| Python | mit | Kotaimen/awscfncli,Kotaimen/awscfncli |
9684af3ecb0fd26deef87e2509a5de892a62e5f1 | cloudsizzle/studyplanner/courselist/views.py | cloudsizzle/studyplanner/courselist/views.py | # Create your views here.
from django.shortcuts import render_to_response
from studyplanner.courselist.models import Course
from studyplanner.courselist.models import Faculty
from studyplanner.courselist.models import Department
def list_courses(request, faculty, department):
department = Department.objects.get(sl... | # Create your views here.
from django.shortcuts import render_to_response
from studyplanner.courselist.models import Course
from studyplanner.courselist.models import Faculty
from studyplanner.courselist.models import Department
def list_courses(request, faculty, department):
department = Department.objects.get(sl... | Add user object to template context. | Add user object to template context.
| Python | mit | jpvanhal/cloudsizzle,jpvanhal/cloudsizzle |
c6c189ffe13f88d7310291c785ffe363f6c04423 | trayapp.py | trayapp.py |
# Github Tray App
import rumps
import config
import contribs
class GithubTrayApp(rumps.App):
def __init__(self):
super(GithubTrayApp, self).__init__('Github')
self.count = rumps.MenuItem('commits')
self.username = config.get_username()
self.menu = [
self.count,
... |
# Github Tray App
import rumps
import config
import contribs
class GithubTrayApp(rumps.App):
def __init__(self):
super(GithubTrayApp, self).__init__('Github')
self.count = rumps.MenuItem('commits')
self.username = config.get_username()
self.menu = [
self.count,
... | Update in the update function | Update in the update function
| Python | mit | chrisfosterelli/commitwatch |
fc67921095b85fc021482417415d935e8de55525 | chatexchange6/_logging26backport.py | chatexchange6/_logging26backport.py | import logging
from logging import *
class Logger26(logging.getLoggerClass()):
def getChild(self, suffix):
"""
(copied from module "logging" for Python 3.4)
Get a logger which is a descendant to this one.
This is a convenience method, such that
logging.getLogger('abc').... | import logging
from logging import *
class Logger(logging.Logger):
def getChild(self, suffix):
"""
(copied from module "logging" for Python 3.4)
Get a logger which is a descendant to this one.
This is a convenience method, such that
logging.getLogger('abc').getChild('de... | Implement backport of logging package for 2.6 | Implement backport of logging package for 2.6
debugging 3
| Python | apache-2.0 | Charcoal-SE/ChatExchange,Charcoal-SE/ChatExchange,ByteCommander/ChatExchange6,ByteCommander/ChatExchange6 |
1a2527afdc5cb9c948ac74a9925d90709d6150cc | seleniumbase/fixtures/constants.py | seleniumbase/fixtures/constants.py | """
This class containts some frequently-used constants
"""
class Environment:
QA = "qa"
STAGING = "staging"
PRODUCTION = "production"
MASTER = "master"
LOCAL = "local"
TEST = "test"
class Files:
DOWNLOADS_FOLDER = "downloaded_files"
ARCHIVED_DOWNLOADS_FOLDER = "archived_files"
cla... | """
This class containts some frequently-used constants
"""
class Environment:
QA = "qa"
STAGING = "staging"
PRODUCTION = "production"
MASTER = "master"
LOCAL = "local"
TEST = "test"
class Files:
DOWNLOADS_FOLDER = "downloaded_files"
ARCHIVED_DOWNLOADS_FOLDER = "archived_files"
cla... | Remove "htmlunit" from browser options | Remove "htmlunit" from browser options
| Python | mit | mdmintz/SeleniumBase,mdmintz/seleniumspot,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/seleniumspot,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase |
020c13f3b39d495d50704317fe12ee4a4e735bb4 | kylin/_injector.py | kylin/_injector.py | from functools import wraps
from typing import Callable
from ._scope import Scope
class Injector(Callable):
"""
class decorator to inject dependencies into a callable decorated function
"""
def __init__(self, dependencies: dict, fun: Callable):
self.dependencies = dependencies
se... | from functools import wraps
from typing import Callable
from ._scope import Scope
class Injector(Callable):
"""
class decorator to inject dependencies into a callable decorated function
"""
def __init__(self, dependencies: dict, fun: Callable):
self.dependencies = dependencies
se... | Fix bug of self injection into injector function | Fix bug of self injection into injector function
| Python | mit | WatanukiRasadar/kylin |
291da4afa9f359dc4cfda6a683afdcead39d557b | simiki/conf_templates/fabfile.py | simiki/conf_templates/fabfile.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import os.path
from fabric.api import env, local, run
from fabric.colors import blue
import fabric.contrib.project as project
# Remote host and username
env.hosts = []
env.user = ""
env.colorize_errors = True
# Local outp... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import os.path
from sys import exit
from fabric.api import env, local, run
from fabric.colors import blue, red
import fabric.contrib.project as project
# Remote host and username
env.hosts = []
env.user = ""
env.colorize_e... | Fix serious problem using rsync | Fix serious problem using rsync
If env.remote_output not set, use rsync --delete option will
empty the whole remote system, this is a very serious problem!
| Python | mit | tankywoo/simiki,tankywoo/simiki,9p0le/simiki,9p0le/simiki,9p0le/simiki,zhaochunqi/simiki,tankywoo/simiki,zhaochunqi/simiki,zhaochunqi/simiki |
bcabd0e0766e1d8f93c86ac8102e71bec446ef20 | ynr/apps/sopn_parsing/management/commands/sopn_tooling_write_baseline.py | ynr/apps/sopn_parsing/management/commands/sopn_tooling_write_baseline.py | import json
import os
from candidates.models import Ballot
from bulk_adding.models import RawPeople
from django.core.management.base import BaseCommand
class Command(BaseCommand):
"""This command uses the ballots endpoint to loop over each
ballot and store each sopn pdf (uploaded_file) locally"""
def ad... | import json
import os
from django.db.models import Q
from candidates.models import Ballot
from bulk_adding.models import RawPeople
from django.core.management.base import BaseCommand
class Command(BaseCommand):
"""
Creates a JSON file to represent ballots that have an Officialdocument.
Only include ball... | Update which objects are used to write baseline file | Update which objects are used to write baseline file
| Python | agpl-3.0 | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative |
92bbddc2901c5720042fcadbbceaa68642e7cf3d | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_tasks.py | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_tasks.py | import pytest
from celery.result import EagerResult
from {{ cookiecutter.project_slug }}.users.tasks import get_users_count
from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory
@pytest.mark.django_db
def test_user_count(settings):
"""A basic test to execute the get_users_count Celery tas... | import pytest
from celery.result import EagerResult
from {{ cookiecutter.project_slug }}.users.tasks import get_users_count
from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory
pytestmark = pytest.mark.django_db
def test_user_count(settings):
"""A basic test to execute the get_users_cou... | Change style for pytest marker | Change style for pytest marker
Update pytest.mark.django_db to be more consistent with rest of the project
| Python | bsd-3-clause | luzfcb/cookiecutter-django,pydanny/cookiecutter-django,trungdong/cookiecutter-django,ryankanno/cookiecutter-django,luzfcb/cookiecutter-django,pydanny/cookiecutter-django,luzfcb/cookiecutter-django,trungdong/cookiecutter-django,luzfcb/cookiecutter-django,ryankanno/cookiecutter-django,trungdong/cookiecutter-django,pydann... |
01551a1985064f319600732197afeb93cb64a377 | locust/__init__.py | locust/__init__.py | from .user.sequential_taskset import SequentialTaskSet
from .user.task import task, TaskSet
from .user.users import HttpUser, User
from .user.wait_time import between, constant, constant_pacing
from .event import Events
events = Events()
__version__ = "1.0b1"
| from .user.sequential_taskset import SequentialTaskSet
from .user import wait_time
from .user.task import task, TaskSet
from .user.users import HttpUser, User
from .user.wait_time import between, constant, constant_pacing
from .event import Events
events = Events()
__version__ = "1.0b1"
| Add wait_time to locust python package namespace (to not break `from locust.wait_time import ...` imports) | Add wait_time to locust python package namespace (to not break `from locust.wait_time import ...` imports) | Python | mit | mbeacom/locust,locustio/locust,mbeacom/locust,locustio/locust,locustio/locust,mbeacom/locust,mbeacom/locust,locustio/locust |
48be00323c57b6a61455d2591970e1380da8055c | libcloud/dns/providers.py | libcloud/dns/providers.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | Remove route54 provider because the driver is not finished yet. | Remove route54 provider because the driver is not finished yet.
git-svn-id: 9ad005ce451fa0ce30ad6352b03eb45b36893355@1340889 13f79535-47bb-0310-9956-ffa450edef68
| Python | apache-2.0 | sergiorua/libcloud,Cloud-Elasticity-Services/as-libcloud,Cloud-Elasticity-Services/as-libcloud,mbrukman/libcloud,iPlantCollaborativeOpenSource/libcloud,sfriesel/libcloud,ByteInternet/libcloud,curoverse/libcloud,cryptickp/libcloud,schaubl/libcloud,t-tran/libcloud,carletes/libcloud,MrBasset/libcloud,ninefold/libcloud,jim... |
bd8fdf1dccc3660be3b8e020a637f94d21dc2b3a | gaphas/tests/test_state.py | gaphas/tests/test_state.py | from builtins import object
import unittest
from gaphas.state import reversible_pair, observed, _reverse
class SList(object):
def __init__(self):
self.l = list()
def add(self, node, before=None):
if before: self.l.insert(self.l.index(before), node)
else: self.l.append(node)
add = o... | from builtins import object
import unittest
from gaphas.state import reversible_pair, observed, _reverse
class SList(object):
def __init__(self):
self.l = list()
def add(self, node, before=None):
if before: self.l.insert(self.l.index(before), node)
else: self.l.append(node)
add = o... | Fix function object has no attribute __func__ | Fix function object has no attribute __func__
Signed-off-by: Dan Yeaw <2591e5f46f28d303f9dc027d475a5c60d8dea17a@yeaw.me>
| Python | lgpl-2.1 | amolenaar/gaphas |
7cad00f02c2f86cbeb23755f47f9bf1d45be2f8e | logperfu.py | logperfu.py | import threading
import fresenius
import readline
import time
import sys
prompt = '> '
port = sys.argv[1]
fresbase = fresenius.FreseniusComm(port = port)
logfile = open('seringues.log', 'w')
def printrx():
while not logfile.closed:
origin, msg = fresbase.recvq.get()
logfile.write("{};{}\n".forma... | import threading
import fresenius
import readline
import time
import sys
from decimal import Decimal
prompt = '> '
port = sys.argv[1]
fresbase = fresenius.FreseniusComm(port = port)
logfile = open('seringues.log', 'w')
def printrx():
while not logfile.closed:
origin, msg = fresbase.recvq.get()
l... | Use decimal in the logger to get the most accurate time info | Use decimal in the logger to get the most accurate time info
| Python | isc | jaj42/infupy |
b66fc000a2d1328f557fb2c563f99b4748bf88b1 | py101/boilerplate/__init__.py | py101/boilerplate/__init__.py | """"
Boilerplate Adventure
Author: Ignacio Avas (iavas@sophilabs.com)
"""
import codecs
import io
import sys
import unittest
from story.adventures import AdventureVerificationError, BaseAdventure
from story.translation import gettext as _
class TestOutput(unittest.TestCase):
"""Variables Adventure test"""
de... | """"
Boilerplate Adventure
Author: Ignacio Avas (iavas@sophilabs.com)
"""
import codecs
import io
import sys
import unittest
from story.adventures import AdventureVerificationError, BaseAdventure
from story.translation import gettext as _
class TestOutput(unittest.TestCase):
"""Variables Adventure test"""
de... | Comment out some boilerplate code, to prevent failures | Comment out some boilerplate code, to prevent failures
| Python | mit | sophilabs/py101 |
f3299b3108c8fab7015541e9d9b1ef220a488f87 | onitu/escalator/server/__main__.py | onitu/escalator/server/__main__.py | import zmq
from .databases import Databases
from .worker import Worker
context = zmq.Context()
back_uri = 'inproc://workers'
proxy = zmq.devices.ThreadDevice(
device_type=zmq.QUEUE, in_type=zmq.DEALER, out_type=zmq.ROUTER
)
proxy.bind_out('tcp://*:4224')
proxy.bind_in(back_uri)
proxy.start()
databases = Databa... | import argparse
import zmq
from .databases import Databases
from .worker import Worker
parser = argparse.ArgumentParser("escalator")
parser.add_argument(
'--bind', default='tcp://*:4224',
help="Address to bind escalator server"
)
args = parser.parse_args()
context = zmq.Context()
back_uri = 'inproc://work... | Use command-line argument to bind server address | Use command-line argument to bind server address
| Python | mit | onitu/onitu,onitu/onitu,onitu/onitu |
f557c20678de706d9e714e1d903b482b7e886e3b | keras_contrib/backend/cntk_backend.py | keras_contrib/backend/cntk_backend.py | from keras.backend import cntk_backend as KCN
from keras.backend.cntk_backend import logsumexp
import cntk as C
import numpy as np
def clip(x, min_value, max_value):
"""Element-wise value clipping.
If min_value > max_value, clipping range is [min_value,min_value].
# Arguments
x: Tensor or variab... | from keras.backend import cntk_backend as KCN
from keras.backend.cntk_backend import logsumexp
import cntk as C
import numpy as np
def clip(x, min_value, max_value):
"""Element-wise value clipping.
If min_value > max_value, clipping range is [min_value,min_value].
# Arguments
x: Tensor or variab... | Add moments op to CNTK backend, and associated tests | Add moments op to CNTK backend, and associated tests
| Python | mit | keras-team/keras-contrib,keras-team/keras-contrib,farizrahman4u/keras-contrib,keras-team/keras-contrib |
52da8be7ffe6ea2ba09acf3ce44b9a79758b115b | glance/version.py | glance/version.py | # Copyright 2012 OpenStack Foundation
#
# 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 l... | # Copyright 2012 OpenStack Foundation
#
# 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 l... | Remove runtime dep on python pbr | Remove runtime dep on python pbr
| Python | apache-2.0 | redhat-openstack/glance,redhat-openstack/glance |
94b73811a4986dee5ac32fe1d91f377828a5bca5 | mnemosyne/app/__init__.py | mnemosyne/app/__init__.py | import aiohttp
import aiohttp.web
from mnemosyne.app import by_time, by_uuid
application = aiohttp.web.Application()
# by_uuid API
# app.router.add_route('GET', '/applications', mnemosyne.applications.index)
application.router.add_route('GET', '/trace/{traceUuid}', by_uuid.getTrace)
application.router.add_route('GET... |
import os
import aiohttp
import aiohttp.web
from mnemosyne.app import by_time, by_uuid
application = aiohttp.web.Application()
class DirectoryIndex(aiohttp.web.StaticRoute):
def handle(self, request):
filename = request.match_info['filename']
if not filename:
filename = 'index.html'... | Add static route serving files | Add static route serving files
Custom static file handler resolves `/` to `/index.html`.
| Python | agpl-3.0 | jgraichen/mnemosyne,jgraichen/mnemosyne,jgraichen/mnemosyne |
11d4059cf5c66e6de648c675bb049825901479cf | code/array_map.py | code/array_map.py | arr = [1, 5, 10, 20]
print(*map(lambda num: num * 2, arr))
| arr = [1, 5, 10, 20]
print([num * 2 for num in arr])
| Use more consistent example for map | Use more consistent example for map
There is a `map` function in pythin, but for simple single expression
calculations, list comprehensions are much better suited.
While map works well if there is a function, you can pass.
| Python | mit | Evmorov/ruby-coffeescript,evmorov/lang-compare,evmorov/lang-compare,evmorov/lang-compare,evmorov/lang-compare,Evmorov/ruby-coffeescript,evmorov/lang-compare,Evmorov/ruby-coffeescript,evmorov/lang-compare |
21ab1204c1cb35a5d9b95124040e160f4f5edabd | solitude/settings/__init__.py | solitude/settings/__init__.py | from local import *
| from .base import *
try:
from .local import *
except ImportError, exc:
exc.args = tuple(['%s (did you rename settings/local.py-dist?)' % exc.args[0]])
raise exc
| Revert "some random settings changes" | Revert "some random settings changes"
This reverts commit 640eb2be2e32413718e93c1b8c77279ab5152170.
| Python | bsd-3-clause | muffinresearch/solitude,muffinresearch/solitude |
481028f075bf46696b8adc5904663e97bc883c52 | notfound.py | notfound.py | from google.appengine.ext.webapp import template
import webapp2
import os
class NotFound(webapp2.RequestHandler):
def get(self):
path = os.path.join(os.path.dirname(__file__), 'templates/notfound.html')
self.response.out.write(template.render(path, {}))
app = webapp2.WSGIApplication([('/.*', NotFo... | from google.appengine.ext.webapp import template
import webapp2
import os
class NotFound(webapp2.RequestHandler):
def get(self):
self.error(404)
path = os.path.join(os.path.dirname(__file__), 'templates/notfound.html')
self.response.out.write(template.render(path, {}))
app = webapp2.WSGIA... | Return HTTP Status Code 404 for not found errors | Return HTTP Status Code 404 for not found errors
| Python | mit | mback2k/appengine-oauth-profile,mback2k/appengine-oauth-profile |
a136f7046b8df661713d3bcf6a7681894210def2 | ricker/__init__.py | ricker/__init__.py | """
Ricker wavelet generator for seismic simulation
===============================================
"""
from __future__ import division, print_function, absolute_import | """
Ricker wavelet generator for seismic simulation
===============================================
"""
from __future__ import division, print_function, absolute_import
from .ricker import ricker
| Make ricker funciton available in the top level. | Make ricker funciton available in the top level.
| Python | mit | gatechzhu/ricker |
5307e9d879a5432db5f54fd61ea0060b6526a1a6 | sundaytasks/example/test_plugin.py | sundaytasks/example/test_plugin.py | from tornado import gen, ioloop
from tornado.ioloop import IOLoop
import sys
from pkg_resources import iter_entry_points
import json
@gen.coroutine
def main(plugin):
#print("plugin:",plugin['receiver'])
response = yield plugin['receiver']("Prufa")
print("Results: \n%s" % json.dumps(response, sort_keys=True... | from tornado import gen, ioloop
from tornado.ioloop import IOLoop
import sys
from pkg_resources import iter_entry_points
import json
@gen.coroutine
def main(plugin):
response = yield plugin['receiver']("Prufa")
print("Results: \n%s" % json.dumps(response, sort_keys=True,
indent=4, separators=(',', ': ')))
... | Clear old method of calling plugins | Clear old method of calling plugins
| Python | apache-2.0 | olafura/sundaytasks-py |
f50ef6d331afa5a55467a104bc307edbdb2cd650 | tests/test_auth.py | tests/test_auth.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import json
from unittest import TestCase
import httpretty
from faker import Faker
from polyaxon_schemas.user import UserConfig
from polyaxon_client.auth import AuthClient
faker = Faker()
class TestAuthClient(TestCase):
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import json
import uuid
from unittest import TestCase
import httpretty
from faker import Faker
from polyaxon_schemas.authentication import CredentialsConfig
from polyaxon_schemas.user import UserConfig
from polyaxon_client.auth ... | Fix auth tests and add login test | Fix auth tests and add login test
| Python | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon |
89bec483ce88fb1a310d4dd06220ace412148257 | tests/test_auth.py | tests/test_auth.py | from __future__ import absolute_import
import random
import unittest
from .config import *
from tweepy import API, OAuthHandler
class TweepyAuthTests(unittest.TestCase):
def testoauth(self):
auth = OAuthHandler(oauth_consumer_key, oauth_consumer_secret)
# test getting access token
auth... | from __future__ import absolute_import
import random
import unittest
from six.moves import input
from .config import *
from tweepy import API, OAuthHandler
class TweepyAuthTests(unittest.TestCase):
def testoauth(self):
auth = OAuthHandler(oauth_consumer_key, oauth_consumer_secret)
# test gett... | Update auth tests to be compatible with Python 3 | Update auth tests to be compatible with Python 3
| Python | mit | svven/tweepy,tweepy/tweepy |
d604128015826444be4585c7204030840e9efc88 | tests/test_java.py | tests/test_java.py | def test_java_exists(Command):
version_result = Command("java -version")
assert version_result.rc == 0
| def test_java_exists(Command):
version_result = Command("java -version")
assert version_result.rc == 0
def test_java_certs_exist(File):
assert File("/etc/ssl/certs/java/cacerts").exists
| Add test to make sure SSL certs are installed. | Add test to make sure SSL certs are installed.
| Python | apache-2.0 | azavea/ansible-java,flibbertigibbet/ansible-java |
1db05fb528295456e2127be5ba5225d697655676 | metashare/accounts/urls.py | metashare/accounts/urls.py | from django.conf.urls.defaults import patterns
from metashare.settings import DJANGO_BASE
urlpatterns = patterns('metashare.accounts.views',
(r'create/$',
'create'),
(r'confirm/(?P<uuid>[0-9a-f]{32})/$',
'confirm'),
(r'contact/$',
'contact'),
(r'reset/(?:(?P<uuid>[0-9a-f]{32})/)?$',
'reset'),
... | from django.conf.urls.defaults import patterns
from metashare.settings import DJANGO_BASE
urlpatterns = patterns('metashare.accounts.views',
(r'create/$',
'create'),
(r'confirm/(?P<uuid>[0-9a-f]{32})/$',
'confirm'),
(r'contact/$',
'contact'),
(r'reset/(?:(?P<uuid>[0-9a-f]{32})/)?$',
'reset'),
... | Manage default editor group on a single page | Manage default editor group on a single page
| Python | bsd-3-clause | zeehio/META-SHARE,MiltosD/CEF-ELRC,zeehio/META-SHARE,MiltosD/CEFELRC,MiltosD/CEF-ELRC,zeehio/META-SHARE,MiltosD/CEFELRC,MiltosD/CEF-ELRC,MiltosD/CEF-ELRC,JuliBakagianni/CEF-ELRC,MiltosD/CEFELRC,MiltosD/CEFELRC,zeehio/META-SHARE,JuliBakagianni/META-SHARE,JuliBakagianni/CEF-ELRC,JuliBakagianni/META-SHARE,JuliBakagianni/C... |
722228a023aca35660bc493b812727f6c665b3cb | posts.py | posts.py | import json
import pprint
import requests
def sample_valid_reddit_response():
r = requests.get('http://www.reddit.com/r/cscareerquestions/top.json')
response_json = r.json()
if 'data' not in response_json:
print("Trying again")
response_json = sample_valid_reddit_response()
return response_json
def save_samp... | import json
import pprint
import requests
SAMPLE_REDDIT_URL = 'http://www.reddit.com/r/cscareerquestions/top.json'
def sample_valid_reddit_response():
r = requests.get(SAMPLE_REDDIT_URL)
response_json = r.json()
if 'data' not in response_json:
print("Trying again")
response_json = sample_valid_reddit_response... | Make reddit url a constant | Make reddit url a constant
| Python | mit | RossCarriga/repost-data |
d3d5c0c6d13b6cf84b8a7e12e40e9740ca960529 | spillway/mixins.py | spillway/mixins.py | from rest_framework.exceptions import ValidationError
class ModelSerializerMixin(object):
"""Provides generic model serializer classes to views."""
model_serializer_class = None
def get_serializer_class(self):
if self.serializer_class:
return self.serializer_class
class Defaul... | from rest_framework.exceptions import ValidationError
class ModelSerializerMixin(object):
"""Provides generic model serializer classes to views."""
model_serializer_class = None
def get_serializer_class(self):
if self.serializer_class:
return self.serializer_class
class Defaul... | Use request.data to access file uploads | Use request.data to access file uploads
| Python | bsd-3-clause | kuzmich/django-spillway,barseghyanartur/django-spillway,bkg/django-spillway |
7a5cb8ba82b79372226f9ac4ba3a71e4209cdd72 | sheldon/storage.py | sheldon/storage.py | # -*- coding: utf-8 -*-
"""
Interface to Redis-storage.
@author: Seva Zhidkov
@contact: zhidkovseva@gmail.com
@license: The MIT license
Copyright (C) 2015
"""
class Storage:
pass | # -*- coding: utf-8 -*-
"""
Interface to Redis-storage.
@author: Seva Zhidkov
@contact: zhidkovseva@gmail.com
@license: The MIT license
Copyright (C) 2015
"""
from .utils import logger
# We will catch all import exceptions in bot.py
from redis import StrictRedis
class Storage:
def __init__(self, bot):
... | Create init of Storage class | Create init of Storage class
| Python | mit | lises/sheldon |
7cc8699f7100cfc969b1b76efbcc47e1fafb2363 | paiji2_shoutbox/models.py | paiji2_shoutbox/models.py | from django.db import models
from django.utils.translation import ugettext as _
from django.utils.timezone import now
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except:
from django.contrib.auth.models import User
class Note(models.Model):
author = models.ForeignKey(
... | from django.db import models
from django.utils.translation import ugettext as _
from django.utils.timezone import now
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except:
from django.contrib.auth.models import User
class Note(models.Model):
author = models.ForeignKey(
... | Remove save method for auto_now_add=True | Remove save method for auto_now_add=True
| Python | agpl-3.0 | rezometz/django-paiji2-shoutbox,rezometz/django-paiji2-shoutbox |
f4a73fcc591d877003e9963f087d2473568bfa9d | python/ql/test/experimental/query-tests/Security/CWE-079/sendgrid_via_mail_send_post_request_body_bad.py | python/ql/test/experimental/query-tests/Security/CWE-079/sendgrid_via_mail_send_post_request_body_bad.py | # This tests that the developer doesn't pass tainted user data into the mail.send.post() method in the SendGrid library.
import sendgrid
import os
sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
data = {
"content": [
{
"type": "text/html",
"value": "<html><p>He... | import sendgrid
import os
from flask import request, Flask
app = Flask(__name__)
@app.route("/sendgrid")
def send():
sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
data = {
"content": [
{
"type": "text/html",
"value": "<html>{}</html>"... | Add RFS to `sendgrid` test | Add RFS to `sendgrid` test
| Python | mit | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql |
6fed8b08e280b88a491ca6c04e0a2c429e7f493f | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
from distutils.core import setup
setup(
name='django-banking',
version='0.1-dev',
description='Banking (SWIFT) classes for Python/Django',
long_description=open('README').read(),
author='Benjamin P. Jung',
author_em... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
from distutils.core import setup
setup(
name='django-banking',
version='0.1-dev',
description='Banking (SWIFT) classes for Python/Django',
long_description=open('README').read(),
author='Benjamin P. Jung',
author_em... | Include 'models' subdirectory in package | Include 'models' subdirectory in package
| Python | bsd-3-clause | headcr4sh/django-banking |
78a596ba34a3a8a7435dd6ca997e6b6cb79fbdd6 | setup.py | setup.py | #!/usr/bin/env python2.7
from __future__ import print_function
from distutils.core import setup
import os
version = '1.0.0b'
# Append TeamCity build number if it gives us one.
if 'TC_BUILD_NUMBER' in os.environ and version.endswith('b'):
version += '' + os.environ['TC_BUILD_NUMBER']
setup(name='fetch',
mai... | #!/usr/bin/env python2.7
from __future__ import print_function
from distutils.core import setup
import os
version = '1.0.0b'
# Append TeamCity build number if it gives us one.
if 'TC_BUILD_NUMBER' in os.environ and version.endswith('b'):
version += '' + os.environ['TC_BUILD_NUMBER']
setup(name='fetch',
mai... | Add croniter dependency. Sort deps. | Add croniter dependency. Sort deps.
| Python | apache-2.0 | GeoscienceAustralia/fetch,GeoscienceAustralia/fetch |
137d3c0394309dfb22a407eda5b80bc312482c1d | setup.py | setup.py | from distutils.core import setup
setup(name="zutil",
version='0.1.5',
description="Utilities used for generating zCFD control dictionaries",
author="Zenotech",
author_email="support@zenotech.com",
url="https://zcfd.zenotech.com/",
packages=["zutil", "zutil.post", "zutil.analysis", "... | from distutils.core import setup
setup(name="zutil",
version='0.1.5',
description="Utilities used for generating zCFD control dictionaries",
author="Zenotech",
author_email="support@zenotech.com",
license="MIT",
url="https://zcfd.zenotech.com/",
project_urls={
"Sourc... | Add license and Source Code url | Add license and Source Code url
| Python | mit | zCFD/zutil |
83f62bd5993ba253183f120567a2a42108c4b7b4 | setup.py | setup.py | from distutils.core import setup
description = """
A python module for calculating riichi mahjong hands: yaku, han and fu.
You can find usage examples here https://github.com/MahjongRepository/mahjong
"""
setup(
name='mahjong',
packages=['mahjong'],
version='1.0.1',
description='Mahjong hands calcula... | from distutils.core import setup
description = """
A python module for calculating riichi mahjong hands: yaku, han and fu.
Right now it supports only japanese version (riichi mahjong). MCR (chinese version) in plans
You can find usage examples here https://github.com/MahjongRepository/mahjong
"""
setup(
name='m... | Add missed packages tot he build script | Add missed packages tot he build script
| Python | mit | MahjongRepository/mahjong |
05bfc141b279dc8f30089e8b72502f9042a2ff3b | setup.py | setup.py | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011-2015 Genestack Limited
# All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF GENESTACK LIMITED
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
from distutils.core import ... | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011-2015 Genestack Limited
# All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF GENESTACK LIMITED
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
from distutils.core import ... | Use move version for sutup.py | Use move version for sutup.py
| Python | mit | genestack/python-client |
cc92b1770acdc5a34eb32c596c0b2ece6bf32b0f | qiprofile_rest/server/settings.py | qiprofile_rest/server/settings.py | # This file specifies the Eve configuration.
import os
# The run environment default is production.
# Modify this by setting the NODE_ENV environment variable.
env = os.getenv('NODE_ENV') or 'production'
# The MongoDB database.
if env == 'production':
MONGO_DBNAME = 'qiprofile'
else:
MONGO_DBNAME = 'qiprofile_test... | """This ``settings`` file specifies the Eve configuration."""
import os
# The run environment default is production.
# Modify this by setting the NODE_ENV environment variable.
env = os.getenv('NODE_ENV') or 'production'
# The MongoDB database.
if env == 'production':
MONGO_DBNAME = 'qiprofile'
else:
MONGO_DB... | Allow MONGO_HOST env var override. | Allow MONGO_HOST env var override.
| Python | bsd-2-clause | ohsu-qin/qirest,ohsu-qin/qiprofile-rest |
8cab1d360218f6d8075bad08fd38ef90c75e5549 | turbustat/tests/setup_package.py | turbustat/tests/setup_package.py |
def get_package_data():
return {
_ASTROPY_PACKAGE_NAME_ + '.tests': ['data/*.fits', 'data/*.npz']
}
|
def get_package_data():
return {
_ASTROPY_PACKAGE_NAME_ + '.tests': ['data/*.fits', 'data/*.npz',
'coveragerc']
}
| Add coveragerc to package data | Add coveragerc to package data
| Python | mit | e-koch/TurbuStat,Astroua/TurbuStat |
6d1626327f3577a86cdd3c54e5732b65e59a3402 | test2.py | test2.py | import json
import itertools
with open('products.json') as data_file:
data = json.load(data_file)
products = data['products']
products_temp = []
for index, item in enumerate(products):
products_temp.append(item)
products = products_temp
products_temp = [] # delete the variable
for index, item in enumer... | #notes: will do it using oop.
import json
import itertools
with open('products.json') as data_file:
data = json.load(data_file)
products = data['products']
products_temp = []
for index, item in enumerate(products):
products_temp.append(item)
products = products_temp
products_temp = [] # delete the varia... | Add an additional layer for the for loop | Add an additional layer for the for loop
| Python | mit | zhang96/JSONWithPython |
8c5007bd5a1f898ca0987e7b79b8dd8f0a2642c5 | pfamserver/api.py | pfamserver/api.py | from application import app
from flask.ext.restful import Api, Resource
import os
from subprocess import Popen as run, PIPE
api = Api(app)
class QueryAPI(Resource):
def get(self, query):
cmd = ['./hmmer/binaries/esl-afetch', 'Pfam-A.full', query]
output = run(cmd, stdout=PIPE).communicate()[0]
... | from application import app
from flask.ext.restful import Api, Resource
import os
from subprocess import Popen as run, PIPE
api = Api(app)
def db(query):
cmd = ['./hmmer/binaries/esl-afetch', 'Pfam-A.full', query]
return run(cmd, stdout=PIPE).communicate()[0]
class QueryAPI(Resource):
def get(self, q... | Check variations little variations if the query fails. | Check variations little variations if the query fails.
| Python | agpl-3.0 | ecolell/pfamserver,ecolell/pfamserver,ecolell/pfamserver |
f019cb2f0e3604b264aeb55a3a01641f998d27d7 | test/fuzz/gen-dict.py | test/fuzz/gen-dict.py | import json
import sys
def find_literals(literals, node):
'''Recursively find STRING literals in the grammar definition'''
if type(node) is dict:
if 'type' in node and node['type'] == 'STRING' and 'value' in node:
literals.add(node['value'])
for key, value in node.iteritems():
find_literals(l... | import json
import sys
def find_literals(literals, node):
'''Recursively find STRING literals in the grammar definition'''
if type(node) is dict:
if 'type' in node and node['type'] == 'STRING' and 'value' in node:
literals.add(node['value'])
for key, value in node.iteritems():
find_literals(l... | Handle non-ascii characters when generating fuzzing dictionary | Handle non-ascii characters when generating fuzzing dictionary
This caused a failure when generating the dictionary for `tree-sitter-agda`.
| Python | mit | tree-sitter/tree-sitter,tree-sitter/tree-sitter,tree-sitter/tree-sitter,tree-sitter/tree-sitter,tree-sitter/tree-sitter,tree-sitter/tree-sitter,tree-sitter/tree-sitter |
6dd5a006892b1ba51c7f4f338693bf780293b897 | dedupe/_typing.py | dedupe/_typing.py | import numpy
import sys
from typing import (Iterator,
Tuple,
Mapping,
Union,
Iterable,
List,
Any)
if sys.version_info >= (3, 8):
from typing import TypedDict, Protocol, Literal
else:
from ty... | import numpy
import sys
from typing import (Iterator,
Tuple,
Mapping,
Union,
Iterable,
List,
Any)
if sys.version_info >= (3, 8):
from typing import TypedDict, Protocol, Literal
else:
from ty... | Remove use of "unsure" from TrainingData type | Remove use of "unsure" from TrainingData type
The "unsure" key isn't used anywhere else
| Python | mit | dedupeio/dedupe,dedupeio/dedupe |
476338ba2edce4ff78f9451ae9cca6a2c91f787b | opps/core/admin/article.py | opps/core/admin/article.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from django import forms
from opps.core.models import Post, PostImage
from opps.core.models import Image
from redactor.widgets import RedactorEditor
class PostImageInline(admin.TabularInline):
model = PostImage
fk_name = 'post'
raw_id_fields = ['... | # -*- coding: utf-8 -*-
from django.contrib.sites.models import Site
from django.contrib import admin
from django import forms
from opps.core.models import Post, PostImage
from opps.core.models import Image
from redactor.widgets import RedactorEditor
class PostImageInline(admin.TabularInline):
model = PostImag... | Fix field set on post admin, opps core | Fix field set on post admin, opps core
| Python | mit | YACOWS/opps,jeanmask/opps,opps/opps,jeanmask/opps,opps/opps,opps/opps,williamroot/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,opps/opps,williamroot/opps |
c9ed6fe84b7f55ba2e9dc75d9ddf8cb0e7f9eb8c | pixelmap/pixel.py | pixelmap/pixel.py | """Pixel
A pixel data structure with it's own uid that makes a Pixelmap.
Last updated: March 7, 2017
"""
from itertools import count
class Pixel:
new_id = count(1)
def __init__(self):
"""Pixel constructor"""
self.id = next(self.new_id)
def __str__(self):
return str(self.id)
... | """Pixel
A pixel data structure with it's own uid that makes a Pixelmap.
Last updated: March 11, 2017
"""
from itertools import count
class Pixel:
new_id = count(1)
def __init__(self, data=None):
"""Pixel constructor"""
self.id = next(self.new_id)
self.data = data
def __str__(s... | Add data dict as Pixel member. | Add data dict as Pixel member.
| Python | mit | yebra06/pixelmap |
8a7b6be29b3a839ba8e5c2cb33322d90d51d5fc4 | karbor/tests/unit/conf_fixture.py | karbor/tests/unit/conf_fixture.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Fix loading 'provider_config_dir' opt error | Fix loading 'provider_config_dir' opt error
When run unit test using 'ostestr --pdb' command. it may get
an error that can not find the config opt 'provider_config_dir'.
Change-Id: Ibc1c693a1531c791ad434ff56ee349ba3afb3d63
Closes-Bug: #1649443
| Python | apache-2.0 | openstack/smaug,openstack/smaug |
117c3e6c1f301c4e5c07e22b3c76f330b18ea36e | bin/create_contour_data.py | bin/create_contour_data.py | #!/usr/bin/env python3
import sys
import os
sys.path.append('../nsmaps')
import nsmaps
DATA_DIR = './website/nsmaps-data'
def test():
stations = nsmaps.station.Stations(DATA_DIR)
departure_station_name = 'Utrecht Centraal'
departure_station = stations.find_station(departure_station_name)
filepat... | #!/usr/bin/env python3
import sys
import os
sys.path.append('../nsmaps')
import nsmaps
DATA_DIR = './website/nsmaps-data'
def test():
stations = nsmaps.station.Stations(DATA_DIR)
departure_station_name = 'Utrecht Centraal'
departure_station = stations.find_station(departure_station_name)
assert ... | Create tiles in create contour command | Create tiles in create contour command
| Python | mit | bartromgens/nsmaps,bartromgens/nsmaps,bartromgens/nsmaps |
e2541a9de3b4239f8f3cb7cc06dd9e7f48dd18a9 | objectTopGroup.py | objectTopGroup.py | #**********************************************************************************************#
#********* Return the top most group name of an object ****************************************#
#********* by Djordje Spasic ******************************************************************#
#********* issworld2000@yahoo... | #**********************************************************************************************#
#********* Return the top most group name of an object ****************************************#
#********* by Djordje Spasic ******************************************************************#
#********* issworld2000@yahoo... | Return the top most group name of an object | Return the top most group name of an object | Python | unlicense | stgeorges/pythonscripts |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.