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 |
|---|---|---|---|---|---|---|---|---|---|
e7bc0b942ef3bdc85d6dbd360e3f012c1957d36f | src/aka.py | src/aka.py | #!/usr/bin/env python
import json
import os
import sys
def raw_aliases():
'''
Reads in the aliases file as a Python object
'''
with open(os.environ['AKA_ALIASES'], 'r') as f:
return json.loads(f.read())
def make_lookup(alias_object, current_path=[], current_command=[], result={}):
'''
... | #!/usr/bin/env python
import json
import os
import sys
def raw_aliases():
'''
Reads in the aliases file as a Python object
'''
with open(os.environ['AKA_ALIASES'], 'r') as f:
return json.loads(f.read())
def make_lookup(alias_object, current_path=[], current_command=[], result={}):
'''
... | Fix error, made command assume extras are params for now | Fix error, made command assume extras are params for now
| Python | mit | mjgpy3/aka,mjgpy3/aka |
123f6a34d9d423f380254b70a5013c0df592d4b6 | tests/run_coverage.py | tests/run_coverage.py | #!/usr/bin/env python
"""Script to collect coverage information on ofStateManager"""
import os
import sys
import inspect
import coverage
import subprocess
def main():
"""Main function"""
arguments = ''
if len(sys.argv) > 1:
arguments = ' '.join(sys.argv[1:])
testdir = os.path.abspath(os.path.dirname(
inspec... | #!/usr/bin/env python
"""Script to collect coverage information on ofStateManager"""
import os
import sys
import inspect
import coverage
import subprocess
def main():
"""Main function"""
arguments = ''
if len(sys.argv) > 1:
arguments = ' '.join(sys.argv[1:])
testdir = os.path.abspath(os.path.dirname(
inspec... | Replace coverage API calls by subprocess calls. | Replace coverage API calls by subprocess calls. | Python | mit | bilderbuchi/ofStateManager |
3e0c64d89b937659dac23cb78b148717b49735ca | tests/testapp/urls.py | tests/testapp/urls.py | from django.urls import path
from . import views
urlpatterns = [
path('', views.ExampleFormView.as_view(), name='upload'),
]
| try:
from django.urls import path
except ImportError:
from django.conf.urls import url as path
from . import views
urlpatterns = [
path('', views.ExampleFormView.as_view(), name='upload'),
]
| Fix test suite for Django 1.11 | Fix test suite for Django 1.11
| Python | mit | codingjoe/django-s3file,codingjoe/django-s3file,codingjoe/django-s3file |
2d57647d54e7a68f8a8139fc2b5a3168dde5195f | server.py | server.py | import recommender
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def index():
return render_template('template.html')
@app.route('/graph')
def my_link():
# here we want to get the value of user (i.e. ?user=some-value)
seed = request.args.get('seed')
nsfw = boo... | import recommender
import os
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def index():
return render_template('template.html')
@app.route('/graph')
def my_link():
# here we want to get the value of user (i.e. ?user=some-value)
seed = request.args.get('seed')
... | Set port by environment variable | Set port by environment variable
| Python | mit | cdated/subredditor,cdated/reddit-crawler,cdated/subredditor,cdated/subredditor,cdated/subreddit-crawler,cdated/reddit-crawler,cdated/subreddit-crawler,cdated/subreddit-crawler,cdated/subreddit-crawler,cdated/subredditor |
fa5d78df781143d7e0105ccb1a5da923b2ca0b60 | server.py | server.py | """This module runs the api server."""
import os
from app import flask_app, db
from app.models import User, BucketList, BucketListItem
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.restful import Resource, Api
from app.api_v1.resources import TestResour... | """This module runs the api server."""
import os
from app import flask_app, db
from app.models import User, BucketList, BucketListItem
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.restful import Resource, Api
from app.api_v1.resources import TestResour... | Add BucketListApi resource to api. | [Feature] Add BucketListApi resource to api.
| Python | mit | andela-akiura/bucketlist |
099a0b045548d5a93707a9ef99bece2578ed50ea | user_voting/models.py | user_voting/models.py | from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from django.db import models
from user_voting.managers import VoteManager
SCORES = (
(u'+1', +1),
(u'-1', -1),
(u'?', 0),
)
class Vote(models.Model):
... | from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from django.db import models
from user_voting.managers import VoteManager
SCORES = (
(u'+1', +1),
(u'-1', -1),
(u'?', 0),
)
class Vote(models.Model):
... | Add date field for timestamps | user_voting: Add date field for timestamps
| Python | agpl-3.0 | kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu |
d0f1114fdcee63d65c5dd74501b3e329a12f8e53 | indra/sources/eidos/eidos_reader.py | indra/sources/eidos/eidos_reader.py | from indra.java_vm import autoclass, JavaException
from .scala_utils import get_python_json
class EidosReader(object):
"""Reader object keeping an instance of the Eidos reader as a singleton.
This allows the Eidos reader to need initialization when the first piece of
text is read, the subsequent readings ... | from indra.java_vm import autoclass, JavaException
from .scala_utils import get_python_json
class EidosReader(object):
"""Reader object keeping an instance of the Eidos reader as a singleton.
This allows the Eidos reader to need initialization when the first piece of
text is read, the subsequent readings ... | Make Eidos reader instantiate when first reading | Make Eidos reader instantiate when first reading
| Python | bsd-2-clause | johnbachman/belpy,johnbachman/indra,sorgerlab/indra,johnbachman/indra,bgyori/indra,sorgerlab/belpy,bgyori/indra,sorgerlab/indra,sorgerlab/belpy,johnbachman/belpy,pvtodorov/indra,pvtodorov/indra,bgyori/indra,johnbachman/indra,johnbachman/belpy,sorgerlab/belpy,pvtodorov/indra,pvtodorov/indra,sorgerlab/indra |
ca042edc7f9709f2217b669fb5a68e9aac3ab61c | cbv/management/commands/cbv_dumpversion.py | cbv/management/commands/cbv_dumpversion.py | from django.core.management import call_command
from django.core.management.commands import LabelCommand
class Command(LabelCommand):
def handle_label(self, label, **options):
# Because django will use the default manager of each model, we
# monkeypatch the manager to filter by our label before ca... | import json
from django.db.models.query import QuerySet
from django.core.management import call_command
from django.core.management.base import LabelCommand
from django.core import serializers
from cbv import models
class Command(LabelCommand):
"""Dump the django cbv app data for a specific version."""
def h... | Allow dumpdata of specific version of cbv. | Allow dumpdata of specific version of cbv.
| Python | bsd-2-clause | abhijo89/django-cbv-inspector,refreshoxford/django-cbv-inspector,abhijo89/django-cbv-inspector,refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector,abhijo89/django-cbv-inspector,abhijo89/django-cbv-inspector,refreshoxford/django-cbv-inspector |
7d02bd555d7519d485d00e02136d26a6e4e7096e | nova/db/sqlalchemy/migrate_repo/versions/034_change_instance_id_in_migrations.py | nova/db/sqlalchemy/migrate_repo/versions/034_change_instance_id_in_migrations.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | Drop FK before dropping instance_id column. | Drop FK before dropping instance_id column. | Python | apache-2.0 | sacharya/nova,jianghuaw/nova,leilihh/novaha,eneabio/nova,vladikr/nova_drafts,KarimAllah/nova,sileht/deb-openstack-nova,Stavitsky/nova,DirectXMan12/nova-hacking,akash1808/nova_test_latest,raildo/nova,gspilio/nova,tangfeixiong/nova,jianghuaw/nova,Juniper/nova,JioCloud/nova,zhimin711/nova,usc-isi/nova,orbitfp7/nova,Jianyu... |
643f666468d3e378cc0b39e501c253e33c267f0f | tests/python/PyUnitTests.py | tests/python/PyUnitTests.py | #!/bin/sh
PYTHONPATH="%builddir%":"%srcdir%":$PYTHONPATH \
python "%srcdir%"/tests/python/UnitTests.py
| #!/bin/sh
PYTHONPATH="%builddir%":"%srcdir%":$PYTHONPATH \
DYLD_LIBRARY_PATH="%builddir%/.libs":"%builddir%/gdtoa/.libs":$DYLD_LIBRARY_PATH \
python "%srcdir%"/tests/python/UnitTests.py
| Set DYLD_LIBRARY_PATH to find locally built dynamic libraries. | Set DYLD_LIBRARY_PATH to find locally built dynamic libraries.
| Python | bsd-3-clause | duncanmortimer/ledger,paulbdavis/ledger,duncanmortimer/ledger,duncanmortimer/ledger,afh/ledger,paulbdavis/ledger,duncanmortimer/ledger,duncanmortimer/ledger,afh/ledger,ledger/ledger,jwakely/ledger,ledger/ledger,jwakely/ledger,ledger/ledger,ledger/ledger,paulbdavis/ledger,jwakely/ledger,afh/ledger,paulbdavis/ledger,ledg... |
358bdb98ba4a17c75773c7b09853580f5e7dd4e7 | tests/people_test.py | tests/people_test.py |
def test_team_has_members(fx_people, fx_teams):
assert fx_teams.clamp.members == {
fx_people.clamp_member_1,
fx_people.clamp_member_2,
fx_people.clamp_member_3,
fx_people.clamp_member_4
}
def test_person_has_awards(fx_people, fx_awards):
assert fx_people.peter_jackson.awa... |
def test_team_has_members(fx_people, fx_teams):
assert fx_teams.clamp.members == {
fx_people.clamp_member_1,
fx_people.clamp_member_2,
fx_people.clamp_member_3,
fx_people.clamp_member_4
}
def test_person_has_awards(fx_people, fx_awards):
assert fx_people.peter_jackson.awa... | Adjust test_person_made_works to keep consistency. | Adjust test_person_made_works to keep consistency.
| Python | mit | item4/cliche,item4/cliche,clicheio/cliche,clicheio/cliche,clicheio/cliche |
c87bbd461794c8d18c9b9811e44306f02e3309d3 | comics/comics/kalscartoon.py | comics/comics/kalscartoon.py | from dateutil.parser import parse
from comics.aggregator.crawler import CrawlerBase, CrawlerResult
from comics.meta.base import MetaBase
class Meta(MetaBase):
name = "KAL's Cartoon"
language = 'en'
url = 'http://www.economist.com'
start_date = '2006-01-05'
rights = 'Kevin Kallaugher'
class Crawle... | import re
from comics.aggregator.crawler import CrawlerBase, CrawlerResult
from comics.meta.base import MetaBase
class Meta(MetaBase):
name = "KAL's Cartoon"
language = 'en'
url = 'http://www.economist.com'
start_date = '2006-01-05'
rights = 'Kevin Kallaugher'
class Crawler(CrawlerBase):
hist... | Switch to regexp based matching of date instead of dateutil | Switch to regexp based matching of date instead of dateutil
| Python | agpl-3.0 | datagutten/comics,klette/comics,jodal/comics,jodal/comics,jodal/comics,datagutten/comics,klette/comics,klette/comics,datagutten/comics,datagutten/comics,jodal/comics |
73e4789517c8de480d1b5e8c05f3dbe9b31883e5 | bouncer/embed_detector.py | bouncer/embed_detector.py | import re
from urllib.parse import urlparse
"""
Hardcoded URL patterns where client is assumed to be embedded.
Only the hostname and path are included in the pattern. The path must be
specified.
These are regular expressions so periods must be escaped.
"""
PATTERNS = [
"h\.readthedocs\.io/.*",
"web\.hypothes... | import fnmatch
import re
from urllib.parse import urlparse
# Hardcoded URL patterns where client is assumed to be embedded.
#
# Only the hostname and path are included in the pattern. The path must be
# specified; use "example.com/*" to match all URLs on a particular domain.
#
# Patterns are shell-style wildcards ('*'... | Use fnmatch patterns instead of regexes for URL patterns | Use fnmatch patterns instead of regexes for URL patterns
fnmatch patterns have enough flexibility for this use case and this avoids the
need to remember to escape periods, which is easy to forget otherwise. The
resulting patterns are also easier to read.
| Python | bsd-2-clause | hypothesis/bouncer,hypothesis/bouncer,hypothesis/bouncer |
a64024959a36e1a03dbd3ecf27f08a56702ecec4 | eche/tests/test_step1_raed_print.py | eche/tests/test_step1_raed_print.py | import pytest
from eche.reader import read_str
from eche.printer import print_str
import math
@pytest.mark.parametrize("test_input", [
'1',
'-1',
'0',
str(math.pi),
str(math.e)
])
def test_numbers(test_input):
assert print_str(read_str(test_input)) == test_input
@pytest.mark.parametrize("t... | import pytest
from eche.reader import read_str
from eche.printer import print_str
import math
@pytest.mark.parametrize("test_input", [
'1',
'-1',
'0',
str(math.pi),
str(math.e)
])
def test_numbers(test_input):
assert print_str(read_str(test_input)) == test_input
@pytest.mark.parametrize("t... | Add list with list test. | Add list with list test.
| Python | mit | skk/eche |
e20aaffc908a762757b6b4cb73f6d607b15ac03a | tracker.py | tracker.py | #-*- coding: utf-8 -*-
import time
import sys
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
import tweepy
import json
#Get Hashtag to track
argTag = sys.argv[1]
#Class for listening to all tweets
class TweetListener(StreamListener):
def on_status(self, statu... | import sys
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
import tweepy
#Get Hashtag to track
argTag = sys.argv[1]
#Class for listening to all tweets
class TweetListener(StreamListener):
def on_status(self, status):
print status.created_at
#W... | Remove unnecessary code and libraries | Remove unnecessary code and libraries
| Python | mit | tim-thompson/TweetTimeTracker |
c2d9a7a276b4f0442663a62bafb3c70bd7373f7e | distarray/local/tests/paralleltest_io.py | distarray/local/tests/paralleltest_io.py | import tempfile
from numpy.testing import assert_allclose
from os import path
from distarray.local import LocalArray, save, load
from distarray.testing import comm_null_passes, MpiTestCase
class TestFlatFileIO(MpiTestCase):
@comm_null_passes
def test_flat_file_read_write(self):
larr0 = LocalArray((7,... | import tempfile
from numpy.testing import assert_allclose
from os import path
from distarray.local import LocalArray, save, load
from distarray.testing import comm_null_passes, MpiTestCase
class TestFlatFileIO(MpiTestCase):
@comm_null_passes
def test_flat_file_read_write(self):
larr0 = LocalArray((7,... | Add missing `comm` argument to LocalArray constructor. | Add missing `comm` argument to LocalArray constructor.
Segfaults otherwise... | Python | bsd-3-clause | RaoUmer/distarray,RaoUmer/distarray,enthought/distarray,enthought/distarray |
12fc9a49a0dd55836165d89df6bb59ffecdd03eb | bayespy/inference/vmp/nodes/__init__.py | bayespy/inference/vmp/nodes/__init__.py | ################################################################################
# Copyright (C) 2011-2012 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
# Import some most commonly used nodes
from . import *
from .b... | ################################################################################
# Copyright (C) 2011-2012 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
# Import some most commonly used nodes
from . import *
from .b... | Add Choose node to imported nodes | ENH: Add Choose node to imported nodes
| Python | mit | bayespy/bayespy,jluttine/bayespy |
53dc86ace10f73832c0cbca9fcbc0389999a0e1c | hyperion/util/convenience.py | hyperion/util/convenience.py | class OptThinRadius(object):
def __init__(self, temperature, value=1.):
self.temperature = temperature
self.value = value
def __mul__(self, value):
return OptThinRadius(self.temperature, value=self.value * value)
def __rmul__(self, value):
return OptThinRadius(self.tempera... | import numpy as np
class OptThinRadius(object):
def __init__(self, temperature, value=1.):
self.temperature = temperature
self.value = value
def __mul__(self, value):
return OptThinRadius(self.temperature, value=self.value * value)
def __rmul__(self, value):
return OptTh... | Deal with the case of large radii for optically thin temperature radius | Deal with the case of large radii for optically thin temperature radius
| Python | bsd-2-clause | hyperion-rt/hyperion,bluescarni/hyperion,hyperion-rt/hyperion,astrofrog/hyperion,astrofrog/hyperion,bluescarni/hyperion,hyperion-rt/hyperion |
d0b56003b2b508a5db43986064d2e01fecefe155 | virtool/indexes/models.py | virtool/indexes/models.py | from sqlalchemy import Column, Enum, Integer, String
from virtool.pg.utils import Base, SQLEnum
class IndexType(str, SQLEnum):
"""
Enumerated type for index file types
"""
json = "json"
fasta = "fasta"
bowtie2 = "bowtie2"
class IndexFile(Base):
"""
SQL model to store new index fil... | from sqlalchemy import Column, Enum, Integer, String, UniqueConstraint
from virtool.pg.utils import Base, SQLEnum
class IndexType(str, SQLEnum):
"""
Enumerated type for index file types
"""
json = "json"
fasta = "fasta"
bowtie2 = "bowtie2"
class IndexFile(Base):
"""
SQL model to s... | Add UniqueConstraint for IndexFile SQL model | Add UniqueConstraint for IndexFile SQL model
| Python | mit | virtool/virtool,igboyes/virtool,igboyes/virtool,virtool/virtool |
b415e265f6b725c7e1a99d2ee1dae77f0cd555a7 | config.py | config.py | # Paths to key files
FIREBASE_KEY_PATH="firebase.local.json"
# Firebase config for prox-server
# These are public-facing and can be found in the console under Auth > Web Setup (in the top-right corner)
FIREBASE_CONFIG = {
"apiKey": "AIzaSyCksV_AC0oB9OnJmj0YgXNOrmnJawNbFeE",
"authDomain": "prox-server-cf63e.fir... | # Paths to key files
FIREBASE_KEY_PATH="firebase.local.json"
# Firebase config for prox-server
# These are public-facing and can be found in the console under Auth > Web Setup (in the top-right corner)
FIREBASE_CONFIG = {
"apiKey": "AIzaSyCksV_AC0oB9OnJmj0YgXNOrmnJawNbFeE",
"authDomain": "prox-server-cf63e.fir... | Add category filtering on the server side to save client fetching. | Add category filtering on the server side to save client fetching.
| Python | mpl-2.0 | liuche/prox-server |
cd2ecd3bede2886c384e4761f7052cfacb7d24ae | modules/serialize.py | modules/serialize.py | import sublime
import json
import os
from ..json import encoder
from ..json import decoder
from . import settings
_DEFAULT_PATH = os.path.join('User', 'sessions')
_DEFAULT_EXTENSION = 'json'
def dump(name, session):
session_path = _generate_path(name)
with open(session_path, 'w') as f:
json.dump(s... | import sublime
import json
import os
from ..json import encoder
from ..json import decoder
from . import settings
_DEFAULT_PATH = os.path.join('User', 'sessions')
_DEFAULT_EXTENSION = '.sublime-session'
def dump(name, session):
session_path = _generate_path(name)
with open(session_path, 'w') as f:
... | Use "sublime-session" as file extension | Use "sublime-session" as file extension
Furthermore fix some bugs in serialize.py
| Python | mit | Zeeker/sublime-SessionManager |
17d66bad1fd2ad75294dde5cbf0c1b5c694ae54c | bin/get_templates.py | bin/get_templates.py | #!/usr/bin/env python
import json
import os
from lib.functional import multi_map
from engine import types, consts
template_dir = os.path.join(os.environ['PORTER'], 'templates')
structs = (
(types.new_unit, "Tank", (consts.RED,)),
(types.new_attack, "RegularCannon", ()),
(types.new_armor, "WeakMetal", ()... | #!/usr/bin/env python
import json
import os
from lib.functional import multi_map
from engine import types, consts
template_dir = os.path.join(os.environ['PORTER'], 'templates')
structs = (
(types.new_unit, "Tank", (consts.RED,)),
(types.new_attack, "RegularCannon", ()),
(types.new_armor, "WeakMetal", ()... | Add functionality to delete all templates | Add functionality to delete all templates
| Python | mit | Tactique/game_engine,Tactique/game_engine |
464e13cc9065b966eadd1413802c32c536c478fd | tests/optvis/param/test_cppn.py | tests/optvis/param/test_cppn.py | from __future__ import absolute_import, division, print_function
import pytest
import numpy as np
import tensorflow as tf
import logging
from lucid.optvis.param.cppn import cppn
log = logging.getLogger(__name__)
@pytest.mark.slow
def test_cppn_fits_xor():
with tf.Graph().as_default(), tf.Session() as sess:... | from __future__ import absolute_import, division, print_function
import pytest
import numpy as np
import tensorflow as tf
import logging
from lucid.optvis.param.cppn import cppn
log = logging.getLogger(__name__)
@pytest.mark.slow
def test_cppn_fits_xor():
with tf.Graph().as_default(), tf.Session() as sess:... | Add retries to cppn param test | Add retries to cppn param test
| Python | apache-2.0 | tensorflow/lucid,tensorflow/lucid,tensorflow/lucid,tensorflow/lucid |
9a6150ca2303bb1c682cdc037853e2cf182a1baa | halng/commands.py | halng/commands.py | import logging
import os
import brain
from cmdparse import Command
log = logging.getLogger("hal")
class InitCommand(Command):
def __init__(self):
Command.__init__(self, "init", summary="Initialize a new brain")
self.add_option("", "--force", action="store_true")
self.add_option("", "--... | import logging
import os
from brain import Brain
from cmdparse import Command
log = logging.getLogger("hal")
class InitCommand(Command):
def __init__(self):
Command.__init__(self, "init", summary="Initialize a new brain")
self.add_option("", "--force", action="store_true")
self.add_opt... | Update to use the static Brain.init() | Update to use the static Brain.init()
| Python | mit | DarkMio/cobe,tiagochiavericosta/cobe,wodim/cobe-ng,pteichman/cobe,tiagochiavericosta/cobe,meska/cobe,wodim/cobe-ng,DarkMio/cobe,meska/cobe,LeMagnesium/cobe,pteichman/cobe,LeMagnesium/cobe |
9c786c82671ade46e7af309fd597d5eac93a75b0 | pycah/db/__init__.py | pycah/db/__init__.py | import psycopg2
c = psycopg2.connect(user='postgres', password='password')
c.set_session(autocommit=True)
cur = c.cursor()
try:
cur.execute('CREATE DATABASE pycah;')
c.commit()
c.close()
c = psycopg2.connect(database='pycah', user='postgres', password='password')
c.set_session(autocommit=True)
cur = c.curs... | import psycopg2
c = psycopg2.connect(user='postgres', password='password', host='127.0.0.1')
c.set_session(autocommit=True)
cur = c.cursor()
try:
cur.execute('CREATE DATABASE pycah;')
c.commit()
c.close()
c = psycopg2.connect(database='pycah', user='postgres', password='password', host='127.0.0.1')
c.set_ses... | Fix database connectivity on Linux. | Fix database connectivity on Linux.
| Python | mit | nhardy/pyCAH,nhardy/pyCAH,nhardy/pyCAH |
a58a6b897370e82aa3625c36a00e2de74c16ab6c | cortex/__init__.py | cortex/__init__.py | from .dataset import Dataset, VolumeData, VertexData, DataView, View
from . import align, volume, quickflat, webgl, segment, options
from .database import db
from .utils import *
from .quickflat import make_figure as quickshow
openFile = Dataset.from_file
try:
from . import webgl
from .webgl import show as webshow
... | from .dataset import Dataset, VolumeData, VertexData, DataView, View
from . import align, volume, quickflat, webgl, segment, options
from .database import db
from .utils import *
from .quickflat import make_figure as quickshow
openFile = Dataset.from_file
try:
from . import webgl
from .webgl import show as webshow
... | Fix up the deprecate surfs object | Fix up the deprecate surfs object
| Python | bsd-2-clause | gallantlab/pycortex,gallantlab/pycortex,CVML/pycortex,CVML/pycortex,smerdis/pycortex,smerdis/pycortex,smerdis/pycortex,gallantlab/pycortex,gallantlab/pycortex,gallantlab/pycortex,CVML/pycortex,smerdis/pycortex,CVML/pycortex,CVML/pycortex,smerdis/pycortex |
cae7a57304e207f319e9bb2e52837ee207d0d96e | mcdowell/src/main/python/ch1/ch1.py | mcdowell/src/main/python/ch1/ch1.py | def unique(string):
counter = {}
for c in string:
if c in counter:
counter[c] += 1
else:
counter[c] = 1
print(counter)
for k in counter:
if counter[k] > 1:
return False
else:
return True
def reverse(string):
result = []
for... | def unique(string):
counter = {}
for c in string:
if c in counter:
return False
else:
counter[c] = 1
else:
return True
def reverse(string):
result = []
for i in range(len(string)):
result.append(string[-(i+1)])
return "".join(result)
def ... | Add is_permutation function. Simplifiy unique function. | Add is_permutation function. Simplifiy unique function.
| Python | mit | jamesewoo/tigeruppercut,jamesewoo/tigeruppercut |
eda5e7e2bb83f35e18cd0b5402636d4e930e02b9 | mamba/cli.py | mamba/cli.py | # -*- coding: utf-8 -*-
import sys
import argparse
from mamba import application_factory, __version__
from mamba.infrastructure import is_python3
def main():
arguments = _parse_arguments()
if arguments.version:
print(__version__)
return
factory = application_factory.ApplicationFactory(a... | # -*- coding: utf-8 -*-
import sys
import argparse
from mamba import application_factory, __version__
from mamba.infrastructure import is_python3
def main():
arguments = _parse_arguments()
if arguments.version:
print(__version__)
return
factory = application_factory.ApplicationFactory(a... | Use a choices for specifiying type of reporter | Use a choices for specifiying type of reporter
| Python | mit | dex4er/mamba,nestorsalceda/mamba,angelsanz/mamba,jaimegildesagredo/mamba,markng/mamba,eferro/mamba,alejandrodob/mamba |
6b72e0bbb09e8f8b6d8821252e34aeca89693441 | mt_core/backends/__init__.py | mt_core/backends/__init__.py | # coding=UTF-8
| # coding=UTF-8
class GuestInfo:
OS_WINDOWS = "windows"
OS_LINUX = "linux"
def __init__(self, username, password, os):
self.username = username
self.password = password
self.os = os
class Hypervisor:
# 完全克隆
CLONE_FULL = 0
# 链接克隆
CLONE_LINKED = 1
def clone(self... | Add Hypervisor base class for workstation and virtualbox | Add Hypervisor base class for workstation and virtualbox
| Python | mit | CADTS-Bachelor/mini-testbed |
e478a70549164bee7351f01c161a8b0ef6f8c1c8 | dashboard/src/api.py | dashboard/src/api.py | import requests
import os
class Api:
_API_ENDPOINT = 'api/v1'
def __init__(self, url, token=None):
self.url = Api.add_slash(url)
self.token = token
def is_api_running(self):
try:
res = requests.get(self.url)
if res.status_code in {200, 401}:
... | """Module with class representing common API."""
import requests
import os
class Api:
"""Class representing common API."""
_API_ENDPOINT = 'api/v1'
def __init__(self, url, token=None):
"""Set the API endpoint and store the authorization token if provided."""
self.url = Api.add_slash(url)... | Add staticmethod annotation + docstrings to module, class, and all public methods | Add staticmethod annotation + docstrings to module, class, and all public methods
| Python | apache-2.0 | jpopelka/fabric8-analytics-common,jpopelka/fabric8-analytics-common,jpopelka/fabric8-analytics-common,tisnik/fabric8-analytics-common,tisnik/fabric8-analytics-common,tisnik/fabric8-analytics-common |
c86b6390e46bac17c64e19010912c4cb165fa9dd | satnogsclient/settings.py | satnogsclient/settings.py | from os import environ
DEMODULATION_COMMAND = environ.get('DEMODULATION_COMMAND', None)
ENCODING_COMMAND = environ.get('ENCODING_COMMAND', None)
DECODING_COMMAND = environ.get('DECODING_COMMAND', None)
OUTPUT_PATH = environ.get('OUTPUT_PATH', None)
| from os import environ
DEMODULATION_COMMAND = environ.get('SATNOGS_DEMODULATION_COMMAND', None)
ENCODING_COMMAND = environ.get('SATNOGS_ENCODING_COMMAND', None)
DECODING_COMMAND = environ.get('SATNOGS_DECODING_COMMAND', None)
OUTPUT_PATH = environ.get('SATNOGS_OUTPUT_PATH', None)
| Add prefix to required environment variables. | Add prefix to required environment variables.
| Python | agpl-3.0 | cshields/satnogs-client,adamkalis/satnogs-client,adamkalis/satnogs-client,cshields/satnogs-client |
d7bb652118970c97dacd26f8aff60aa16804e21c | sqlalchemy_redshift/__init__.py | sqlalchemy_redshift/__init__.py | from pkg_resources import DistributionNotFound, get_distribution, parse_version
try:
import psycopg2 # noqa: F401
except ImportError:
raise ImportError(
'No module named psycopg2. Please install either '
'psycopg2 or psycopg2-binary package for CPython '
'or psycopg2cffi for Pypy.'
... | from pkg_resources import DistributionNotFound, get_distribution, parse_version
try:
import psycopg2 # noqa: F401
except ImportError:
raise ImportError(
'No module named psycopg2. Please install either '
'psycopg2 or psycopg2-binary package for CPython '
'or psycopg2cffi for Pypy.'
... | Remove clearing of exception context when raising a new exception | Remove clearing of exception context when raising a new exception
This syntax is only supported in Python 3.3 and up and is causing tests in
Python 2.7 to fail.
| Python | mit | sqlalchemy-redshift/sqlalchemy-redshift,graingert/redshift_sqlalchemy,sqlalchemy-redshift/sqlalchemy-redshift |
bf2ace8bd6cb0c492ff4347f9c2fe10a003abaff | sqlalchemy_redshift/__init__.py | sqlalchemy_redshift/__init__.py | from pkg_resources import get_distribution, parse_version
try:
import psycopg2 # noqa: F401
if get_distribution('psycopg2').parsed_version < parse_version('2.5'):
raise ImportError('Minimum required version for psycopg2 is 2.5')
except ImportError:
raise ImportError(
'No module named psyco... | from pkg_resources import DistributionNotFound, get_distribution, parse_version
try:
import psycopg2 # noqa: F401
except ImportError:
raise ImportError(
'No module named psycopg2. Please install either '
'psycopg2 or psycopg2-binary package for CPython '
'or psycopg2cffi for Pypy.'
... | Check the version of any of the supported Psycopg2 packages | Check the version of any of the supported Psycopg2 packages
A check was introduced in commit 8e0c4857a1c08f257b95d3b1ee5f6eb795d55cdc which
would check what version of the 'psycopg2' Python (pip) package was installed
as the dependency was removed from setup.py.
The check would however only check the 'psycopg2' packa... | Python | mit | sqlalchemy-redshift/sqlalchemy-redshift,graingert/redshift_sqlalchemy,sqlalchemy-redshift/sqlalchemy-redshift |
485d32e71996194fd5bf7bddb2535b5753b23572 | plasmapy/classes/tests/test_plasma_base.py | plasmapy/classes/tests/test_plasma_base.py | from plasmapy.classes import BasePlasma, GenericPlasma
class NoDataSource(BasePlasma):
pass
class IsDataSource(BasePlasma):
@classmethod
def is_datasource_for(cls, **kwargs):
return True
class IsNotDataSource(BasePlasma):
@classmethod
def is_datasource_for(cls, **kwargs):
return ... | from plasmapy.classes import BasePlasma, GenericPlasma
# Get rid of any previously registered classes.
BasePlasma._registry = {}
class NoDataSource(BasePlasma):
pass
class IsDataSource(BasePlasma):
@classmethod
def is_datasource_for(cls, **kwargs):
return True
class IsNotDataSource(BasePlasma):
... | Fix failing tests on setup.py test | Fix failing tests on setup.py test
| Python | bsd-3-clause | StanczakDominik/PlasmaPy |
2d9d3e5a0a904a52e8b97bdb64e59f455d15b6e8 | migrations/versions/1815829d365_.py | migrations/versions/1815829d365_.py | """empty message
Revision ID: 1815829d365
Revises: 3fcddd64a72
Create Date: 2016-02-09 17:58:47.362133
"""
# revision identifiers, used by Alembic.
revision = '1815829d365'
down_revision = '3fcddd64a72'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | """empty message
Revision ID: 1815829d365
Revises: 3fcddd64a72
Create Date: 2016-02-09 17:58:47.362133
"""
# revision identifiers, used by Alembic.
revision = '1815829d365'
down_revision = '3fcddd64a72'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | Add geometry_application_reference to new unique index. | Add geometry_application_reference to new unique index.
| Python | mit | LandRegistry/system-of-record,LandRegistry/system-of-record |
3ed14bcd364d1843e35cd4a6d1bd48e06379c223 | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Hardy Jones
# Copyright (c) 2013
#
# License: MIT
#
"""This module exports the Hlint plugin class."""
from SublimeLinter.lint import Linter
class Hlint(Linter):
"""Provides an interface to hlint."""
defau... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Hardy Jones
# Copyright (c) 2013
#
# License: MIT
#
"""This module exports the Hlint plugin class."""
import json
from SublimeLinter.lint import Linter, LintMatch
class Hlint(Linter):
"""Provides an interface ... | Use JSON to parse hlint output | Use JSON to parse hlint output
| Python | mit | SublimeLinter/SublimeLinter-hlint |
0683645a2fb2323a9534d985005d843aada66040 | anypytools/__init__.py | anypytools/__init__.py | # -*- coding: utf-8 -*-
"""AnyPyTools library."""
import sys
import platform
import logging
from anypytools.abcutils import AnyPyProcess
from anypytools.macroutils import AnyMacro
from anypytools import macro_commands
logger = logging.getLogger('abt.anypytools')
logger.addHandler(logging.NullHandler())
__all__ = ... | # -*- coding: utf-8 -*-
"""AnyPyTools library."""
import sys
import platform
import logging
from anypytools.abcutils import AnyPyProcess, execute_anybodycon
from anypytools.macroutils import AnyMacro
from anypytools import macro_commands
logger = logging.getLogger('abt.anypytools')
logger.addHandler(logging.NullHan... | Add execute_anybodycon to toplevel package | Add execute_anybodycon to toplevel package
| Python | mit | AnyBody-Research-Group/AnyPyTools |
818de1d8ef32ef853d37e753cc0dc701d76d04ea | app/apis/search_api.py | app/apis/search_api.py | from flask import Blueprint, jsonify, request
from importlib import import_module
import re
blueprint = Blueprint('search_api', __name__, url_prefix='/search')
@blueprint.route('/<string:model>')
def api(model):
global Model
class_name = model.title() + 'Search'
model_name = model + '_search'
Model =... | # -*- coding: utf-8 -*-
import sys
from flask import Blueprint, jsonify, request
from importlib import import_module
from unicodedata import normalize
reload(sys)
sys.setdefaultencoding('utf8')
def remove_accents(txt):
return normalize('NFKD', txt.decode('utf-8')).encode('ASCII','ignore')
blueprint = Blueprint(... | Add support to search for word in search api | Add support to search for word in search api
| Python | mit | daniel1409/dataviva-api,DataViva/dataviva-api |
2f7ead81f6820f0c4f47a3334ed6bf418c02fe9d | simpleseo/templatetags/seo.py | simpleseo/templatetags/seo.py | from django.template import Library
from simpleseo import settings
from simpleseo.models import SeoMetadata
register = Library()
@register.filter
def single_quotes(description):
return description.replace('\"', '\'')
@register.inclusion_tag('simpleseo/metadata.html', takes_context=True)
def get_seo(context):
... | from django.template import Library
from django.utils.translation import get_language
from simpleseo import settings
from simpleseo.models import SeoMetadata
register = Library()
@register.filter
def single_quotes(description):
return description.replace('\"', '\'')
@register.inclusion_tag('simpleseo/metadata... | Add simple tags for title and description | Add simple tags for title and description
| Python | bsd-3-clause | AMongeMoreno/django-painless-seo,AMongeMoreno/django-painless-seo,Glamping-Hub/django-painless-seo,Glamping-Hub/django-painless-seo |
64c9d2c53f0dc4c9ae92b5675248a8f11c2b4e9e | pyqode/python/managers/file.py | pyqode/python/managers/file.py | """
Contains the python specific FileManager.
"""
import ast
import re
from pyqode.core.managers import FileManager
class PyFileManager(FileManager):
"""
Extends file manager to override detect_encoding. With python, we can
detect encoding by reading the two first lines of a file and extracting its
en... | """
Contains the python specific FileManager.
"""
import ast
import re
from pyqode.core.managers import FileManager
class PyFileManager(FileManager):
"""
Extends file manager to override detect_encoding. With python, we can
detect encoding by reading the two first lines of a file and extracting its
en... | Fix encoding detection in python (shebang line was not parsed anymore) | Fix encoding detection in python (shebang line was not parsed anymore)
| Python | mit | pyQode/pyqode.python,mmolero/pyqode.python,pyQode/pyqode.python,zwadar/pyqode.python |
225abbf06472fe7afd15252ca446456c4caed0bb | contact/test_settings.py | contact/test_settings.py | # Only used for running the tests
import os
CONTACT_EMAILS = ['charlie@example.com']
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}
INSTALLED_APPS = ['contact', 'django.contrib.staticfiles']
MIDDLEWARE_CLASSES = []
ROOT_URLCONF = 'contact.test_urls'
SECRET_KEY = 'whatever'
STATIC_URL = '/stat... | # Only used for running the tests
import os
CONTACT_EMAILS = ['charlie@example.com']
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}
INSTALLED_APPS = ['contact', 'django.contrib.staticfiles']
ROOT_URLCONF = 'contact.test_urls'
SECRET_KEY = 'whatever'
STATIC_URL = '/static/'
TEMPLATES = [
{... | Update test settings for Django >= 1.8. | Update test settings for Django >= 1.8.
| Python | bsd-3-clause | aaugustin/myks-contact,aaugustin/myks-contact |
ed865984bb620fa13418bc5b45b12c63ddada21a | datafilters/views.py | datafilters/views.py | from django.views.generic.list import MultipleObjectMixin
__all__ = ('FilterFormMixin',)
class FilterFormMixin(MultipleObjectMixin):
"""
Mixin that adds filtering behaviour for Class Based Views.
Changed in a way that can play nicely with other CBV simply by overriding the get_queryset(self) and
get_... | from django.views.generic.list import MultipleObjectMixin
__all__ = ('FilterFormMixin',)
class FilterFormMixin(MultipleObjectMixin):
"""
Mixin that adds filtering behaviour for Class Based Views.
Changed in a way that can play nicely with other CBV simply by overriding the get_queryset(self) and
get_... | Check filterform validity before calling filter() | Check filterform validity before calling filter()
| Python | mit | zorainc/django-datafilters,zorainc/django-datafilters,freevoid/django-datafilters |
dc9070c14892114b9e05e84cc9195d0fb58f859d | api_bouncer/serializers.py | api_bouncer/serializers.py | import uuid
import jsonschema
from rest_framework import serializers
from .models import (
Api,
Consumer,
ConsumerKey,
Plugin,
)
from .schemas import plugins
class ApiSerializer(serializers.ModelSerializer):
class Meta:
model = Api
fields = '__all__'
class ConsumerSerializer(se... | import uuid
import jsonschema
from rest_framework import serializers
from .models import (
Api,
Consumer,
ConsumerKey,
Plugin,
)
from .schemas import plugins
class ConsumerSerializer(serializers.ModelSerializer):
class Meta:
model = Consumer
fields = '__all__'
class ConsumerKey... | Use SlugRelatedField for foreign keys for better readability | Use SlugRelatedField for foreign keys for better readability
| Python | apache-2.0 | menecio/django-api-bouncer |
8d217c9797f19d4276484fd070a4a5f3de623e84 | tapioca_toggl/__init__.py | tapioca_toggl/__init__.py | # -*- coding: utf-8 -*-
"""
tapioca_toggl
-------------
Python wrapper for Toggl API v8
"""
__version__ = '0.1.0'
| # -*- coding: utf-8 -*-
"""
tapioca_toggl
-------------
Python wrapper for Toggl API v8
"""
__version__ = '0.1.0'
from .tapioca_toggl import Toggl # noqa
| Make api accessible from python package | Make api accessible from python package
| Python | mit | hackebrot/tapioca-toggl |
d24e31dbebc776524e0a2cd4b971c726bfcbfda5 | py_nist_beacon/nist_randomness_beacon.py | py_nist_beacon/nist_randomness_beacon.py | import requests
from requests.exceptions import RequestException
from py_nist_beacon.nist_randomness_beacon_value import (
NistRandomnessBeaconValue
)
class NistRandomnessBeacon(object):
NIST_BASE_URL = "https://beacon.nist.gov/rest/record"
@classmethod
def get_last_record(cls):
try:
... | import requests
from requests.exceptions import RequestException
from py_nist_beacon.nist_randomness_beacon_value import (
NistRandomnessBeaconValue
)
class NistRandomnessBeacon(object):
NIST_BASE_URL = "https://beacon.nist.gov/rest/record"
@classmethod
def get_last_record(cls):
try:
... | Check status code before object | Check status code before object
| Python | apache-2.0 | urda/nistbeacon |
d6edbc05f1d6f06848b78f131c975b3373b1179a | cpgintegrate/__init__.py | cpgintegrate/__init__.py | import pandas
import traceback
import typing
def process_files(file_iterator: typing.Iterator[typing.IO], processor: typing.Callable) -> pandas.DataFrame:
def get_frames():
for file in file_iterator:
try:
df = processor(file)
except Exception:
df = ... | import pandas
import traceback
import typing
def process_files(file_iterator: typing.Iterator[typing.IO], processor: typing.Callable) -> pandas.DataFrame:
def get_frames():
for file in file_iterator:
df = processor(file)
yield (df
.assign(Source=getattr(file, 'n... | Raise exceptions rather than catching | Raise exceptions rather than catching
| Python | agpl-3.0 | PointyShinyBurning/cpgintegrate |
ad37b36b40b9e59b380049855012b30f1c5c1a28 | scripts/master/optional_arguments.py | scripts/master/optional_arguments.py | # Copyright (c) 2010 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.
"""Utility classes to enhance process.properties.Properties usefulness."""
from buildbot.process.properties import WithProperties
class ListPropertie... | # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility classes to enhance process.properties.Properties usefulness."""
from buildbot.process.properties import WithProperties
class ListPropertie... | Fix ListProperties to be compatible with buildbot 0.8.4p1. | Fix ListProperties to be compatible with buildbot 0.8.4p1.
The duplicated code will be removed once 0.7.12 is removed.
Review URL: http://codereview.chromium.org/7193037
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@91477 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build |
9df966ba388d05e66e64d7692ab971e51cd9762a | csv-to-json.py | csv-to-json.py | import simplejson as json
import zmq
import sys
import base64
import zlib
from jsonsig import *
fieldnames = "buyPrice,sellPrice,demand,demandLevel,stationStock,stationStockLevel,categoryName,itemName,stationName,timestamp".split(',')
(pk, sk) = pysodium.crypto_sign_keypair()
context = zmq.Context()
socket = contex... | import simplejson as json
import zmq
import sys
import base64
import zlib
from jsonsig import *
fieldnames = "buyPrice,sellPrice,demand,demandLevel,stationStock,stationStockLevel,categoryName,itemName,stationName,timestamp".split(',')
(pk, sk) = pysodium.crypto_sign_keypair()
context = zmq.Context()
socket = contex... | Use official URL for collector | Use official URL for collector
| Python | bsd-2-clause | andreas23/emdn |
391d5ef0d13c9f7401ee3576ff578515c07c5f77 | spacy/tests/regression/test_issue1434.py | spacy/tests/regression/test_issue1434.py | from __future__ import unicode_literals
from spacy.tokens import Doc
from spacy.vocab import Vocab
from spacy.matcher import Matcher
from spacy.lang.lex_attrs import LEX_ATTRS
def test_issue1434():
'''Test matches occur when optional element at end of short doc'''
vocab = Vocab(lex_attr_getters=LEX_ATTRS)
... | from __future__ import unicode_literals
from ...vocab import Vocab
from ...lang.lex_attrs import LEX_ATTRS
from ...tokens import Doc
from ...matcher import Matcher
def test_issue1434():
'''Test matches occur when optional element at end of short doc'''
vocab = Vocab(lex_attr_getters=LEX_ATTRS)
hello_worl... | Normalize imports in regression test | Normalize imports in regression test
| Python | mit | honnibal/spaCy,recognai/spaCy,recognai/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,aikramer2/spaCy,explosion/spaCy,aikramer2/spaCy,aikramer2/spaCy,spacy-io/spaCy,aikramer2/spaCy,spacy-io/spaCy,honnibal/spaCy,recognai/spaCy,explosion/spaCy,spacy-io/spaCy,aikramer2/spaCy,honnibal/spaCy,explosion/s... |
36b24c21124ce8756b122b197f1f930732caa61f | tornadowebapi/resource.py | tornadowebapi/resource.py | from tornadowebapi.traitlets import HasTraits
class Resource(HasTraits):
"""A model representing a resource in our system.
Must be reimplemented for the specific resource in our domain,
as well as specifying its properties with traitlets.
The following metadata in the specified traitlets are accepted... | from tornadowebapi.traitlets import HasTraits
class Resource(HasTraits):
"""A model representing a resource in our system.
Must be reimplemented for the specific resource in our domain,
as well as specifying its properties with traitlets.
The following metadata in the specified traitlets are accepted... | Allow back None as identifier | Allow back None as identifier
| Python | bsd-3-clause | simphony/tornado-webapi |
952ef8d596916b7e753c1179552a270430a21122 | tests/test_lattice.py | tests/test_lattice.py | import rml.lattice
import rml.element
DUMMY_NAME = 'dummy'
def test_create_lattice():
l = rml.lattice.Lattice(DUMMY_NAME)
assert(len(l)) == 0
assert l.name == DUMMY_NAME
def test_non_negative_lattice():
l = rml.lattice.Lattice()
assert(len(l)) >= 0
def test_lattice_with_one_element():
l ... | import pytest
import rml.lattice
import rml.element
DUMMY_NAME = 'dummy'
@pytest.fixture
def simple_element():
element_length = 1.5
e = rml.element.Element('dummy_element', element_length)
return e
@pytest.fixture
def simple_element_and_lattice(simple_element):
l = rml.lattice.Lattice(DUMMY_NAME)
... | Test getting elements with different family names. | Test getting elements with different family names.
| Python | apache-2.0 | razvanvasile/RML,willrogers/pml,willrogers/pml |
cde822bc87efa47cc3fae6fbb9462ae6a362afbc | fedmsg.d/endpoints.py | fedmsg.d/endpoints.py | # This file is part of fedmsg.
# Copyright (C) 2012 Red Hat, Inc.
#
# fedmsg is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#... | # This file is part of fedmsg.
# Copyright (C) 2012 Red Hat, Inc.
#
# fedmsg is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#... | Add debian endpoint as comment to file. | Add debian endpoint as comment to file.
| Python | lgpl-2.1 | fedora-infra/fedmsg,vivekanand1101/fedmsg,cicku/fedmsg,cicku/fedmsg,pombredanne/fedmsg,chaiku/fedmsg,vivekanand1101/fedmsg,cicku/fedmsg,mathstuf/fedmsg,vivekanand1101/fedmsg,chaiku/fedmsg,fedora-infra/fedmsg,pombredanne/fedmsg,mathstuf/fedmsg,maxamillion/fedmsg,maxamillion/fedmsg,mathstuf/fedmsg,chaiku/fedmsg,pombredan... |
45896c766f0bd34d00fa0c3d99b94f650b9f8cd7 | ddsc_api/views.py | ddsc_api/views.py | # (c) Nelen & Schuurmans. MIT licensed, see LICENSE.rst.
from __future__ import print_function, unicode_literals
from __future__ import absolute_import, division
from rest_framework.reverse import reverse
from rest_framework.views import APIView
from rest_framework.response import Response
class Root(APIView):
... | # (c) Nelen & Schuurmans. MIT licensed, see LICENSE.rst.
from __future__ import print_function, unicode_literals
from __future__ import absolute_import, division
from rest_framework.reverse import reverse
from rest_framework.views import APIView
from rest_framework.response import Response
class Root(APIView):
... | Fix and add ddsc-site urls. | Fix and add ddsc-site urls.
| Python | mit | ddsc/ddsc-api,ddsc/ddsc-api |
759e6b66ebd601fb1902f6bee2cbc980d61baab8 | unitTestUtils/parseXML.py | unitTestUtils/parseXML.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from xml.etree.ElementTree import ParseError
import xml.etree.ElementTree as ET
import glob
import sys
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def parse():
for infile in glob.glob('*.xml'):
tr... | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from xml.etree.ElementTree import ParseError
import xml.etree.ElementTree as ET
import glob
import sys
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def parse():
for infile in glob.glob('*.xml'):
tr... | Add a print with file where mistake is | Add a print with file where mistake is
| Python | apache-2.0 | alexkernphysiker/j-pet-framework,JPETTomography/j-pet-framework,JPETTomography/j-pet-framework,alexkernphysiker/j-pet-framework,alexkernphysiker/j-pet-framework,alexkernphysiker/j-pet-framework,alexkernphysiker/j-pet-framework,JPETTomography/j-pet-framework |
8d9b2bdbf47b51e3ada3b5e14fcc27bcaafce4fb | dbsync/logs.py | dbsync/logs.py | """
.. module:: dbsync.logs
:synopsis: Logging facilities for the library.
"""
import logging
#: All the library loggers
loggers = set()
log_handler = None
def get_logger(name):
logger = logging.getLogger(name)
logger.setLevel(logging.WARNING)
loggers.add(logger)
if log_handler is not None:
... | """
.. module:: dbsync.logs
:synopsis: Logging facilities for the library.
"""
import logging
#: All the library loggers
loggers = set()
log_handler = None
def get_logger(name):
logger = logging.getLogger(name)
logger.setLevel(logging.WARNING)
loggers.add(logger)
if log_handler is not None:
... | Allow file paths to be given to set_log_target. | Allow file paths to be given to set_log_target.
| Python | mit | bintlabs/python-sync-db |
55d10f77f963eb0cdbe29e04fe910f65c4edaec4 | erpnext/buying/doctype/supplier/supplier_dashboard.py | erpnext/buying/doctype/supplier/supplier_dashboard.py | from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'heatmap': True,
'heatmap_message': _('This is based on transactions against this Supplier. See timeline below for details'),
'fieldname': 'supplier',
'non_standard_fieldnames': {
'Payment Entry': 'party_name'
},
't... | from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'heatmap': True,
'heatmap_message': _('This is based on transactions against this Supplier. See timeline below for details'),
'fieldname': 'supplier',
'non_standard_fieldnames': {
'Payment Entry': 'party_name',
'Bank... | Add linked bank accounts to supplier dashboard | fix: Add linked bank accounts to supplier dashboard
| Python | agpl-3.0 | gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext |
2f2eff3374372cabc6962cd7332aefbaa67bd7ec | examples/facebook-cli.py | examples/facebook-cli.py | from rauth.service import OAuth2Service
import re
import webbrowser
# Get a real consumer key & secret from:
# https://developers.facebook.com/apps
facebook = OAuth2Service(
name='facebook',
authorize_url='https:/graph.facebook.com/oauth/authorize',
access_token_url='https:/graph.facebook.com/oauth/access... | from rauth.service import OAuth2Service
import re
import webbrowser
# Get a real consumer key & secret from:
# https://developers.facebook.com/apps
facebook = OAuth2Service(
name='facebook',
authorize_url='https:/graph.facebook.com/oauth/authorize',
access_token_url='https:/graph.facebook.com/oauth/access... | Update facebook.cli example to use short syntax | Update facebook.cli example to use short syntax
| Python | mit | maxcountryman/rauth,arifgursel/rauth,isouzasoares/rauth,litl/rauth,arifgursel/rauth,isouzasoares/rauth,litl/rauth,arifgursel/rauth,maxcountryman/rauth |
9c21cdf5fc94cf16079465559c58bbe69feec6e8 | fhir_io_hapi/__init__.py | fhir_io_hapi/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
"""
django-fhir
FILE: __init__.py
Created: 1/6/16 5:07 PM
"""
__author__ = 'Mark Scrimshire:@ekivemark'
# Hello World is here to test the loading of the module from fhir.settings
# from .settings import *
from .views.get import hello_world
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
"""
django-fhir
FILE: __init__.py
Created: 1/6/16 5:07 PM
"""
__author__ = 'Mark Scrimshire:@ekivemark'
# Hello World is here to test the loading of the module from fhir.settings
# from .settings import *
from .views.get import hello_world
... | Test post_save of AccessToken as step 1 in writing a fhir consent directive. | Test post_save of AccessToken as step 1 in writing a fhir consent directive.
| Python | apache-2.0 | ekivemark/BlueButtonFHIR_API,ekivemark/BlueButtonFHIR_API,ekivemark/BlueButtonFHIR_API,ekivemark/BlueButtonFHIR_API |
fea95164d03950f0255b1e6567f36040c67da173 | gnotty/bots/rss.py | gnotty/bots/rss.py |
try:
from feedparser import parse
except ImportError:
parse = None
from gnotty.bots import events
class RSSMixin(object):
"""
Mixin for bots that consume RSS feeds and post them to the
channel. Feeds are defined by the ``feeds`` keyword arg to
``__init__``, and should contain a sequence of R... |
try:
from feedparser import parse
except ImportError:
parse = None
from gnotty.bots import events
class RSSMixin(object):
"""
Mixin for bots that consume RSS feeds and post them to the
channel. Feeds are defined by the ``feeds`` keyword arg to
``__init__``, and should contain a sequence of R... | Allow overridable message formatting in the RSS bot. | Allow overridable message formatting in the RSS bot.
| Python | bsd-2-clause | spaceone/gnotty,stephenmcd/gnotty,spaceone/gnotty,stephenmcd/gnotty,spaceone/gnotty,stephenmcd/gnotty |
abadd7880d690cebfea865f8afd81c6fc585884c | scripts/bedpe2bed.py | scripts/bedpe2bed.py | import sys
import os
import argparse
import fileinput
import subprocess
parser = argparse.ArgumentParser(description = "Convert BEDPE into a BED file of fragments.", formatter_class = argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--maxFragmentLength", help = "Maximum fragment length between two pairs of... | import sys
import os
import argparse
import fileinput
import subprocess
parser = argparse.ArgumentParser(description = "Convert BEDPE into a BED file of fragments.", formatter_class = argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--maxFragmentLength", help = "Maximum fragment length between two pairs of... | Add minimum fragment length filtering. | Add minimum fragment length filtering.
| Python | apache-2.0 | kauralasoo/Blood_ATAC,kauralasoo/Blood_ATAC,kauralasoo/Blood_ATAC |
0f54780e142cb6bd15df2ed702bd4fa4b2d3fe79 | keys.py | keys.py | #!/usr/bin/env python
#keys.py
keys = dict(
consumer_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
access_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
access_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
) | #!/usr/bin/env python
#keys.py
keys = dict(
consumer_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
access_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
access_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
) | Use spaces instead of tabs | Use spaces instead of tabs
| Python | mit | bman4789/weatherBot,bman4789/weatherBot,BrianMitchL/weatherBot |
305b3a83999e7c9d5a80de5aa89e3162d4090d64 | controllers/default.py | controllers/default.py | def index():
def GET():
return locals()
@request.restful()
def api():
response.view = 'generic.json'
def GET(resource,resource_id):
if not resource=='study': raise HTTP(400)
# return the correct nexson of study_id
return dict()
def POST(resource,resource_id):
if ... | def index():
def GET():
return locals()
@request.restful()
def api():
response.view = 'generic.json'
def GET(resource,resource_id):
if not resource=='study': raise HTTP(400)
# return the correct nexson of study_id
return _get_nexson(resource_id)
def POST(resource,resourc... | Refactor treenexus logic into a function | Refactor treenexus logic into a function
| Python | bsd-2-clause | OpenTreeOfLife/phylesystem-api,OpenTreeOfLife/phylesystem-api,leto/new_opentree_api,OpenTreeOfLife/phylesystem-api,leto/new_opentree_api |
15914cc8bd29392f204bec021b8cc34bf8507daa | saleor/integrations/management/commands/update_integrations.py | saleor/integrations/management/commands/update_integrations.py | from __future__ import unicode_literals
from django.core.management import CommandError, BaseCommand
from saleor.integrations.feeds import SaleorFeed
from saleor.integrations import utils
class Command(BaseCommand):
help = 'Updates integration feeds. '
feed_classes = {'saleor': SaleorFeed}
def add_argu... | from __future__ import unicode_literals
from django.core.management import CommandError, BaseCommand
from ....integrations.feeds import SaleorFeed
from ....integrations import utils
class Command(BaseCommand):
help = ('Updates integration feeds.'
'If feed name not provided, updates all available fee... | Fix imports style and made feed_name optional | Fix imports style and made feed_name optional
| Python | bsd-3-clause | KenMutemi/saleor,UITools/saleor,jreigel/saleor,KenMutemi/saleor,HyperManTT/ECommerceSaleor,itbabu/saleor,jreigel/saleor,HyperManTT/ECommerceSaleor,tfroehlich82/saleor,tfroehlich82/saleor,maferelo/saleor,itbabu/saleor,KenMutemi/saleor,mociepka/saleor,UITools/saleor,car3oon/saleor,tfroehlich82/saleor,car3oon/saleor,UIToo... |
27c2878ab43ff1e38492e17971166e8fe3c8f1e1 | tests/unit/test_test_setup.py | tests/unit/test_test_setup.py | """Tests for correctly generated, working setup."""
from os import system
from sys import version_info
from . import pytest_generate_tests # noqa, pylint: disable=unused-import
# pylint: disable=too-few-public-methods
class TestTestSetup(object):
"""
Tests for verifying generated test setups of this cookiec... | """Tests for correctly generated, working setup."""
from os import system
from sys import version_info
from . import pytest_generate_tests # noqa, pylint: disable=unused-import
# pylint: disable=too-few-public-methods
class TestTestSetup(object):
"""
Tests for verifying generated test setups of this cookiec... | Make py_version and assertion more readable | Make py_version and assertion more readable
| Python | apache-2.0 | painless-software/painless-continuous-delivery,painless-software/painless-continuous-delivery,painless-software/painless-continuous-delivery,painless-software/painless-continuous-delivery |
a1cf304f9941b811b33e1b2d786b6f38bc514546 | anafero/templatetags/anafero_tags.py | anafero/templatetags/anafero_tags.py | from django import template
from django.contrib.contenttypes.models import ContentType
from anafero.models import ReferralResponse, ACTION_DISPLAY
register = template.Library()
@register.inclusion_tag("anafero/_create_referral_form.html")
def create_referral(url, obj=None):
if obj:
return {"url": url,... | from django import template
from django.contrib.contenttypes.models import ContentType
from anafero.models import ReferralResponse, ACTION_DISPLAY
register = template.Library()
@register.inclusion_tag("anafero/_create_referral_form.html", takes_context=True)
def create_referral(context, url, obj=None):
if obj... | Add full context to the create_referral tag | Add full context to the create_referral tag | Python | mit | pinax/pinax-referrals,pinax/pinax-referrals |
e709ea42801c7555d683c5d3eda4d22b164938eb | TSatPy/tests/discrete_test.py | TSatPy/tests/discrete_test.py | import unittest
from TSatPy import discrete
class TestDerivative(unittest.TestCase):
def test_derivative(self):
print 'aoue'
d = discrete.Derivative()
return
d.update(4)
print d.val, d
self.assertTrue(True)
if __name__ == "__main__":
unittest.main()
| import unittest
from mock import patch
from TSatPy import discrete
import time
class TestDerivative(unittest.TestCase):
@patch('time.time')
def test_derivative(self, mock_time, *args):
mock_time.return_value = 1234
d = discrete.Derivative()
self.assertEquals(None, d.last_time)
... | Test coverage for the discrete derivative class | Test coverage for the discrete derivative class
| Python | mit | MathYourLife/TSatPy-thesis,MathYourLife/TSatPy-thesis,MathYourLife/TSatPy-thesis,MathYourLife/TSatPy-thesis,MathYourLife/TSatPy-thesis |
c6d396e8ec29a3641ce1d994c386c9ebea353cd8 | shipyard2/shipyard2/rules/capnps.py | shipyard2/shipyard2/rules/capnps.py | """Helpers for writing rules that depends on //py/g1/third-party/capnp."""
__all__ = [
'make_global_options',
]
def make_global_options(ps):
return [
'compile_schemas',
*('--import-path=%s/codex' % path for path in ps['//bases:roots']),
]
| """Helpers for writing rules that depends on //py/g1/third-party/capnp."""
__all__ = [
'make_global_options',
]
def make_global_options(ps):
return [
'compile_schemas',
'--import-path=%s' %
':'.join(str(path / 'codex') for path in ps['//bases:roots']),
]
| Fix joining of capnp import paths | Fix joining of capnp import paths
| Python | mit | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage |
ff6f0204655439e93bab69dc23a9d1d7d0262cb9 | dog/context.py | dog/context.py | __all__ = ['Context']
from lifesaver import bot
class Context(bot.Context):
@property
def pool(self):
return self.bot.pool
| __all__ = ['Context']
from lifesaver import bot
class Context(bot.Context):
@property
def pool(self):
return self.bot.pool
def tick(self, variant: bool = True) -> str:
if variant:
return self.emoji('green_tick')
else:
return self.emoji('red_tick')
def... | Add emoji shortcuts to Context | Add emoji shortcuts to Context
| Python | mit | slice/dogbot,sliceofcode/dogbot,sliceofcode/dogbot,slice/dogbot,slice/dogbot |
f3e39d2250a9c56a2beb6a1a9c1c4dafb97e8c7f | encoder/vgg.py | encoder/vgg.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow_fcn import fcn8_vgg
import tensorflow as tf
def inference(hypes, images, train=True):
"""Build the MNIST model up to where it may be used for inference.
Args:
images: Images pl... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow_fcn import fcn8_vgg
import tensorflow as tf
def inference(hypes, images, train=True):
"""Build the MNIST model up to where it may be used for inference.
Args:
images: Images pl... | Update to VGG laod from datadir | Update to VGG laod from datadir
| Python | mit | MarvinTeichmann/KittiBox,MarvinTeichmann/KittiBox |
97c66e1cbbc6fd691c2fec4f4e72ba22892fa13c | base/components/accounts/backends.py | base/components/accounts/backends.py | from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
User = get_user_model()
class HelloBaseIDBackend(ModelBackend):
def authenticate(self, username=None):
try:
user = User.objects.filter(username=username)[0]
except IndexError:
... | from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
User = get_user_model()
class HelloBaseIDBackend(ModelBackend):
def authenticate(self, username=None):
try:
user = User.objects.filter(username=username)[0]
except IndexError:
... | Remove the try/except clause from get_user(). | Remove the try/except clause from get_user().
It doesn't seem like the code will -ever- hit the except clause as the
method that calls this has fallbacks of its own.
| Python | apache-2.0 | hello-base/web,hello-base/web,hello-base/web,hello-base/web |
fda9d6fd0a8f437b06fa4e34396ca52f4874d32c | modules/pipeurlbuilder.py | modules/pipeurlbuilder.py | # pipeurlbuilder.py
#
import urllib
from pipe2py import util
def pipe_urlbuilder(context, _INPUT, conf, **kwargs):
"""This source builds a url and yields it forever.
Keyword arguments:
context -- pipeline context
_INPUT -- not used
conf:
BASE -- base
PATH -- path elements
... | # pipeurlbuilder.py
#
import urllib
from pipe2py import util
def pipe_urlbuilder(context, _INPUT, conf, **kwargs):
"""This source builds a url and yields it forever.
Keyword arguments:
context -- pipeline context
_INPUT -- not used
conf:
BASE -- base
PATH -- path elements
... | Fix to handle multiple path segments | Fix to handle multiple path segments
| Python | mit | nerevu/riko,nerevu/riko |
7302af8eb70d14360805910377241b974311d215 | taiga/projects/validators.py | taiga/projects/validators.py | from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from . import models
class ProjectExistsValidator:
def validate_project_id(self, attrs, source):
value = attrs[source]
if not models.Project.objects.filter(pk=value).exists():
msg = _("Ther... | # Copyright (C) 2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the F... | Add copyright and license terms | Add copyright and license terms
| Python | agpl-3.0 | xdevelsistemas/taiga-back-community,Rademade/taiga-back,dayatz/taiga-back,joshisa/taiga-back,jeffdwyatt/taiga-back,bdang2012/taiga-back-casting,Tigerwhit4/taiga-back,CMLL/taiga-back,xdevelsistemas/taiga-back-community,gam-phon/taiga-back,dayatz/taiga-back,astronaut1712/taiga-back,forging2012/taiga-back,joshisa/taiga-ba... |
8eb3c6aa123cecec826c3c07f98b2d2b84c265af | scrapi/registry.py | scrapi/registry.py | import sys
class _Registry(dict):
# These must be defined so that doctest gathering doesn't make
# pytest crash when trying to figure out what/where scrapi.registry is
__file__ = __file__
__name__ = __name__
def __init__(self):
dict.__init__(self)
def __getitem__(self, key):
... | import sys
class _Registry(dict):
# These must be defined so that doctest gathering doesn't make
# pytest crash when trying to figure out what/where scrapi.registry is
__file__ = __file__
__name__ = __name__
def __init__(self):
dict.__init__(self)
def __hash__(self):
return ... | Make _Registry hashable so that django can import from scrapi | Make _Registry hashable so that django can import from scrapi
| Python | apache-2.0 | fabianvf/scrapi,felliott/scrapi,erinspace/scrapi,mehanig/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,mehanig/scrapi,felliott/scrapi,CenterForOpenScience/scrapi |
96cc3b85a34b0047a9483b571aa358df52bcaed0 | hitchdoc/recorder.py | hitchdoc/recorder.py | from hitchdoc.database import Database
from hitchdoc import exceptions
import pickle
import base64
class Recorder(object):
def __init__(self, story, sqlite_filename):
self._story = story
self._db = Database(sqlite_filename)
if self._db.Recording.filter(name=story.name).first() is not None... | from hitchdoc.database import Database
from hitchdoc import exceptions
import pickle
import base64
class Recorder(object):
def __init__(self, story, sqlite_filename):
self._story = story
self._db = Database(sqlite_filename)
if self._db.Recording.filter(name=story.name).first() is not None... | REFACTOR : Changed the name of step name from 'name' to 'step_name' to avoid clashing with a potential use of the word 'name' in kwargs. | REFACTOR : Changed the name of step name from 'name' to 'step_name' to avoid clashing with a potential use of the word 'name' in kwargs.
| Python | agpl-3.0 | hitchtest/hitchdoc |
9409b9da1392514b7da5db4d44a32b47d8452e67 | play.py | play.py | import PyWXSB.XMLSchema as xs
import PyWXSB.Namespace as Namespace
from PyWXSB.generate import PythonGenerator as Generator
import sys
import traceback
from xml.dom import minidom
from xml.dom import Node
files = sys.argv[1:]
if 0 == len(files):
files = [ 'schemas/kml21.xsd' ]
Namespace.XMLSchema.modulePath('xs.... | import PyWXSB.XMLSchema as xs
import PyWXSB.Namespace as Namespace
from PyWXSB.generate import PythonGenerator as Generator
import sys
import traceback
from xml.dom import minidom
from xml.dom import Node
files = sys.argv[1:]
if 0 == len(files):
files = [ 'schemas/kml21.xsd' ]
Namespace.XMLSchema.setModulePath('... | Update to new namespace interface, walk components | Update to new namespace interface, walk components
| Python | apache-2.0 | jonfoster/pyxb2,jonfoster/pyxb-upstream-mirror,balanced/PyXB,pabigot/pyxb,balanced/PyXB,jonfoster/pyxb2,jonfoster/pyxb1,jonfoster/pyxb2,jonfoster/pyxb-upstream-mirror,CantemoInternal/pyxb,CantemoInternal/pyxb,jonfoster/pyxb-upstream-mirror,jonfoster/pyxb1,CantemoInternal/pyxb,pabigot/pyxb,balanced/PyXB |
f870254cfed6f5ea0f88dae910f5c80b7f325e9a | freeze/urls.py | freeze/urls.py | # -*- coding: utf-8 -*-
from django.conf.urls import url
from freeze import views
urlpatterns = [
url(r'^download-static-site/$', views.download_static_site, name='freeze_download_static_site'),
url(r'^generate-static-site/$', views.generate_static_site, name='freeze_generate_static_site'),
]
| # -*- coding: utf-8 -*-
if django.VERSION < (2, 0):
from django.conf.urls import include, url as path
else:
from django.urls import include, path
from freeze import views
urlpatterns = [
path("download-static-site/", views.download_static_site, name="freeze_download_static_site"),
path("generate-sta... | Support for newer versions of django | Support for newer versions of django | Python | mit | fabiocaccamo/django-freeze,fabiocaccamo/django-freeze,fabiocaccamo/django-freeze |
5a4cf095a3eda5127ca54f8d293162740b836158 | services/heroku.py | services/heroku.py | import foauth.providers
class Heroku(foauth.providers.OAuth2):
# General info about the provider
provider_url = 'https://heroku.com/'
docs_url = 'https://devcenter.heroku.com/articles/platform-api-reference'
category = 'Code'
# URLs to interact with the API
authorize_url = 'https://id.heroku.... | import foauth.providers
class Heroku(foauth.providers.OAuth2):
# General info about the provider
provider_url = 'https://heroku.com/'
docs_url = 'https://devcenter.heroku.com/articles/platform-api-reference'
category = 'Code'
# URLs to interact with the API
authorize_url = 'https://id.heroku.... | Rewrite Heroku's scope handling a bit to better match reality | Rewrite Heroku's scope handling a bit to better match reality
| Python | bsd-3-clause | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org |
33facaa6e656ecc30233d831ca8c8d1f2abc6d03 | src/tmserver/extensions/__init__.py | src/tmserver/extensions/__init__.py | from auth import jwt
from spark import Spark
spark = Spark()
from gc3pie import GC3Pie
gc3pie = GC3Pie()
from flask.ext.uwsgi_websocket import GeventWebSocket
websocket = GeventWebSocket()
from flask.ext.redis import FlaskRedis
redis_store = FlaskRedis()
| from auth import jwt
from spark import Spark
spark = Spark()
from gc3pie import GC3Pie
gc3pie = GC3Pie()
from flask_uwsgi_websocket import GeventWebSocket
websocket = GeventWebSocket()
from flask_redis import FlaskRedis
redis_store = FlaskRedis()
| Update depracted flask extension code | Update depracted flask extension code
| Python | agpl-3.0 | TissueMAPS/TmServer |
5e54e38ec6fc06aac08f3b900fe728b353b6a052 | gpioCleanup.py | gpioCleanup.py | import RPi.GPIO as GPIO
GPIO.setup(16, GPIO.IN)
GPIO.setup(20, GPIO.IN)
GPIO.setup(23, GPIO.IN)
GPIO.setup(18, GPIO.IN)
GPIO.setup(17, GPIO.IN)
GPIO.setup(27, GPIO.IN)
GPIO.setup(5, GPIO.IN)
GPIO.cleanup()
| import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(16, GPIO.IN)
GPIO.setup(20, GPIO.IN)
GPIO.setup(23, GPIO.IN)
GPIO.setup(18, GPIO.IN)
GPIO.setup(17, GPIO.IN)
GPIO.setup(27, GPIO.IN)
GPIO.setup(5, GPIO.IN)
GPIO.cleanup()
| Add gpio clean up tool | Add gpio clean up tool
| Python | mit | azmiik/tweetBooth |
923c994fe9a7b02e1939b83ebeefc296cd16b607 | lib/proc_query.py | lib/proc_query.py | import re
import snmpy
class proc_query(snmpy.plugin):
def create(self):
for key, val in sorted(self.conf['objects'].items()):
extra = {
'run': self.gather,
'start': val.get('start', 0),
'regex': re.compile(val['regex']),
}
... | import re
import snmpy
class proc_query(snmpy.plugin):
def create(self):
for key, val in sorted(self.conf['objects'].items()):
extra = {
'run': self.gather,
'start': val.get('start', 0),
'regex': re.compile(val['regex']),
}
... | Rename proc object config key from proc_entry to simply object. | Rename proc object config key from proc_entry to simply object.
| Python | mit | mk23/snmpy,mk23/snmpy |
ec9c671bc4140590c17b00277c424f93e20a5a5e | hvac/api/secrets_engines/__init__.py | hvac/api/secrets_engines/__init__.py | """Vault secrets engines endpoints"""
from hvac.api.secrets_engines.aws import Aws
from hvac.api.secrets_engines.azure import Azure
from hvac.api.secrets_engines.gcp import Gcp
from hvac.api.secrets_engines.identity import Identity
from hvac.api.secrets_engines.kv import Kv
from hvac.api.secrets_engines.pki import Pki
... | """Vault secrets engines endpoints"""
from hvac.api.secrets_engines.aws import Aws
from hvac.api.secrets_engines.azure import Azure
from hvac.api.secrets_engines.gcp import Gcp
from hvac.api.secrets_engines.identity import Identity
from hvac.api.secrets_engines.kv import Kv
from hvac.api.secrets_engines.pki import Pki
... | Enable the consul secret engine | Enable the consul secret engine
| Python | apache-2.0 | ianunruh/hvac,ianunruh/hvac |
9d15915784a94056283845a4ec0fd08ac8849d13 | jobs/test_settings.py | jobs/test_settings.py | from decouple import config
from jobs.settings import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'test_db',
'USER': 'postgres',
'PASSWORD': 'pass1234',
'HOST': 'db',
'PORT': 5432,
}
}
#DATABASES = {
# 'default': ... | from decouple import config
from jobs.settings import *
try:
host = config('DB_HOST')
except:
host = 'db'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'test_db',
'USER': 'postgres',
'PASSWORD': 'pass1234',
'HOST': host,
... | Add logic for db host during runtime | Add logic for db host during runtime
| Python | mit | misachi/job_match,misachi/job_match,misachi/job_match |
6fedddf54200d4fcd9a5fac4946311be0abb80f1 | hutmap/urls.py | hutmap/urls.py | from django.conf import settings
from django.conf.urls import patterns, url, include
from django.conf.urls.static import static
from django.contrib.gis import admin
from huts.urls import hut_patterns, api_patterns
admin.autodiscover()
# main site
urlpatterns = patterns('',
url(r'', include((hut_patterns, 'huts', 'h... | from django.conf import settings
from django.conf.urls import patterns, url, include
from django.conf.urls.static import static
from django.contrib.gis import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from huts.urls import hut_patterns, api_patterns
admin.autodiscover()
# main site
ur... | Use proper setting for static files in development | Use proper setting for static files in development
| Python | mit | muescha/hutmap,dylanfprice/hutmap,muescha/hutmap,dylanfprice/hutmap,dylanfprice/hutmap,dylanfprice/hutmap,muescha/hutmap,muescha/hutmap |
05dd1182574c1f95a92c4523d18686e0482e6a68 | kboard/board/urls.py | kboard/board/urls.py | # Created by JHJ on 2016. 10. 5.
from django.conf.urls import url
from . import views
app_name = 'board'
urlpatterns = [
url(r'^$', views.board_list, name='board_list'),
url(r'^(?P<board_slug>[-a-z]+)/$', views.post_list, name='post_list'),
url(r'^(?P<board_slug>[-a-z]+)/new/$', views.new_post, name='new... | # Created by JHJ on 2016. 10. 5.
from django.conf.urls import url
from . import views
app_name = 'board'
urlpatterns = [
url(r'^$', views.board_list, name='board_list'),
url(r'^(?P<board_slug>[-a-z]+)/$', views.post_list, name='post_list'),
url(r'^(?P<board_slug>[-a-z]+)/new/$', views.new_post, name='new... | Delete 'borad_slug' parameter on 'new_comment' url | Delete 'borad_slug' parameter on 'new_comment' url
| Python | mit | guswnsxodlf/k-board,kboard/kboard,hyesun03/k-board,darjeeling/k-board,cjh5414/kboard,cjh5414/kboard,hyesun03/k-board,kboard/kboard,cjh5414/kboard,kboard/kboard,guswnsxodlf/k-board,hyesun03/k-board,guswnsxodlf/k-board |
81908e5f6304cc1c8e8627b0d4c859df194cc36d | ynr/apps/resultsbot/management/commands/store_modgov_urls.py | ynr/apps/resultsbot/management/commands/store_modgov_urls.py | import csv
import os
from django.core.management.base import BaseCommand
import resultsbot
from elections.models import Election
class Command(BaseCommand):
def handle(self, **options):
"""
Stores possible modgov urls stored in CSV file against the related election objects
"""
pa... | import csv
import os
from django.core.management.base import BaseCommand
import resultsbot
from elections.models import Election
class Command(BaseCommand):
def handle(self, **options):
"""
Stores possible modgov urls stored in CSV file against the related election objects
"""
#... | Delete existing urls before each run | Delete existing urls before each run
| Python | agpl-3.0 | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative |
afc959e23f21e086f710cbc7f3bb56d0b4d93329 | bin/set_deploy_permissions.py | bin/set_deploy_permissions.py | #!/usr/bin/env python
"""
Set the file permissions appropriately for deployment. Call with the argument
of the webserver user (e.g. 'www-data') that should have permissions to uploads
and log files.
"""
import os
import sys
import subprocess
server_writable_directories = [
"vendor/solr/apache-solr-4.0.0/example/s... | #!/usr/bin/env python
"""
Set the file permissions appropriately for deployment. Call with the argument
of the webserver user (e.g. 'www-data') that should have permissions to uploads
and log files.
"""
import os
import sys
import subprocess
server_writable_directories = [
"vendor/solr/apache-solr-4.0.0/example/s... | Add builtAssets to webserver-writable dirs | Add builtAssets to webserver-writable dirs
| Python | bsd-2-clause | yourcelf/intertwinkles,yourcelf/intertwinkles |
7a1b6d1999682ef114f81143a99d0f4d8e1f4af2 | transactions_not_entry_line/models/account_invoice.py | transactions_not_entry_line/models/account_invoice.py | # -*- coding: utf-8 -*-
# © <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, _, models
from openerp.exceptions import UserError
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
@api.multi
def action_move_create(self):
... | # -*- coding: utf-8 -*-
# © <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, _, models
from openerp.exceptions import UserError
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
@api.multi
def action_move_create(self):
... | Add ids for balance product in transactions_not_entry_line | [FIX] Add ids for balance product in transactions_not_entry_line
| Python | agpl-3.0 | Gebesa-Dev/Addons-gebesa |
e90afe565a4d54e7fb81b4fbd29d44525b81aa89 | data_structs/queue.py | data_structs/queue.py | #!/usr/bin/env python3
''' Linear queue '''
class Queue:
def __init__(self):
self.items = list()
def is_Empty(self):
return self.items == []
def size(self):
return len(self.items)
def set(self, item):
self.Queue.insert(0, item)
def get(self):
return self... | #!/usr/bin/env python3
''' Linear queue '''
class Queue:
def __init__(self, items=[]):
self.items = items
def is_Empty(self):
return self.items == []
def size(self):
return len(self.items)
def enqueue(self, item):
self.Queue.insert(0, item)
def dequeue(self):
... | Add default values and changed names for getter and setter | LinearQueue: Add default values and changed names for getter and setter
| Python | apache-2.0 | fedusia/python |
ec3d63fb12ad73ee832f11ec5f93d7425e5ce0f0 | kboard/board/urls.py | kboard/board/urls.py | # Created by JHJ on 2016. 10. 5.
from django.conf.urls import url
from . import views
app_name = 'board'
urlpatterns = [
url(r'^$', views.board_list, name='board_list'),
url(r'^(?P<board_slug>[-a-z]+)/$', views.post_list, name='post_list'),
url(r'^(?P<board_slug>[-a-z]+)/new/$', views.new_post, name='new... | # Created by JHJ on 2016. 10. 5.
from django.conf.urls import url
from . import views
app_name = 'board'
urlpatterns = [
url(r'^$', views.board_list, name='board_list'),
url(r'^(?P<board_slug>[-a-z]+)/$', views.post_list, name='post_list'),
url(r'^(?P<board_slug>[-a-z]+)/new/$', views.new_post, name='new... | Delete 'board_slug' in 'view_post' url | Delete 'board_slug' in 'view_post' url
| Python | mit | kboard/kboard,cjh5414/kboard,guswnsxodlf/k-board,darjeeling/k-board,kboard/kboard,kboard/kboard,hyesun03/k-board,guswnsxodlf/k-board,cjh5414/kboard,guswnsxodlf/k-board,hyesun03/k-board,hyesun03/k-board,cjh5414/kboard |
97eabe6697e58f3b4dd8cced9a2c3bf05f3444c2 | accounting/apps/books/context_processors.py | accounting/apps/books/context_processors.py | from .utils import organization_manager
from .models import Organization
def organizations(request):
"""
Add some generally useful metadata to the template context
"""
# selected organization
orga = organization_manager.get_selected_organization(request)
# all user authorized organizations
... | from django.db.models import Q
from .utils import organization_manager
from .models import Organization
def organizations(request):
"""
Add some generally useful metadata to the template context
"""
# selected organization
orga = organization_manager.get_selected_organization(request)
# all ... | Use owner or member filter for the dropdown | Use owner or member filter for the dropdown
| Python | mit | kenjhim/django-accounting,dulaccc/django-accounting,dulaccc/django-accounting,dulaccc/django-accounting,kenjhim/django-accounting,kenjhim/django-accounting,dulaccc/django-accounting,kenjhim/django-accounting |
f11528381ba055ebc6042bde4cb35e0dd0512a3c | wandb/integration/sagemaker/resources.py | wandb/integration/sagemaker/resources.py | import json
import os
import socket
from . import files as sm_files
def parse_sm_secrets():
"""We read our api_key from secrets.env in SageMaker"""
env_dict = dict()
# Set secret variables
if os.path.exists(sm_files.SM_SECRETS):
for line in open(sm_files.SM_SECRETS, "r"):
key, val... | import json
import os
import socket
from . import files as sm_files
def parse_sm_secrets():
"""We read our api_key from secrets.env in SageMaker"""
env_dict = dict()
# Set secret variables
if os.path.exists(sm_files.SM_SECRETS):
for line in open(sm_files.SM_SECRETS, "r"):
key, val... | Fix issue where sagemaker run ids break run queues | [WB-8591] Fix issue where sagemaker run ids break run queues
| Python | mit | wandb/client,wandb/client,wandb/client |
3bd116a301ce8de9d3ea1b0dd4c0a969c278455a | wsgi.py | wsgi.py | from shale import app
if __name__ == '__main__':
app.run(
host='127.0.0.1',
)
| from shale import app
if __name__ == '__main__':
app.run()
| Revert "bind flask to 127.0.0.1" | Revert "bind flask to 127.0.0.1"
This reverts commit 097b126e511d3d7bf5f431cc6df552843fad4477.
I guess I was way wrong about that.
| Python | mit | mhluongo/shale,mhluongo/shale,cardforcoin/shale,cardforcoin/shale |
d77c0dd6b4b7718421bfde323b8ff4d9667fb696 | jasylibrary.py | jasylibrary.py | #import os, json
#from jasy.core.Util import executeCommand
#import jasy.core.Console as Console
#import urllib.parse
# Little helper to allow python modules in current jasylibrarys path
import sys, os.path, inspect
filename = inspect.getframeinfo(inspect.currentframe()).filename
path = os.path.dirname(os.path.abspath... | #import os, json
#from jasy.core.Util import executeCommand
#import jasy.core.Console as Console
#import urllib.parse
# Little helper to allow python modules in current jasylibrarys path
import sys, os.path, inspect
filename = inspect.getframeinfo(inspect.currentframe()).filename
path = os.path.dirname(os.path.abspath... | Fix path resolving in part.url | Fix path resolving in part.url
| Python | mit | fastner/konstrukteur,fastner/konstrukteur,fastner/konstrukteur |
4620502ff75cab02650a0e28628afae27084fdb4 | magnum_ui/version.py | magnum_ui/version.py | import pbr.version
version_info = pbr.version.VersionInfo('magnum-ui')
| # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed u... | Add Apache 2.0 license to source file | Add Apache 2.0 license to source file
As per OpenStack licensing guide lines [1]:
[H102 H103] Newly contributed Source Code should be licensed under
the Apache 2.0 license.
[H104] Files with no code shouldn't contain any license header nor
comments, and must be left completely empty.
[1] http://docs.openstack.org/dev... | Python | apache-2.0 | openstack/magnum-ui,openstack/magnum-ui,openstack/magnum-ui,openstack/magnum-ui |
b7e38f3fc299d906ab81ab7826af96ea4769d066 | fireplace/cards/wog/neutral_common.py | fireplace/cards/wog/neutral_common.py | from ..utils import *
##
# Minions
class OG_151:
"Tentacle of N'Zoth"
deathrattle = Hit(ALL_MINIONS, 1)
class OG_156:
"Bilefin Tidehunter"
play = Summon(CONTROLLER, "OG_156a")
class OG_158:
"Zealous Initiate"
deathrattle = Buff(RANDOM_FRIENDLY_MINION, "OG_158e")
OG_158e = buff(+1, +1)
class OG_323:
"Po... | from ..utils import *
##
# Minions
class OG_150:
"Aberrant Berserker"
enrage = Refresh(SELF, buff="OG_150e")
OG_150e = buff(atk=2)
class OG_151:
"Tentacle of N'Zoth"
deathrattle = Hit(ALL_MINIONS, 1)
class OG_156:
"Bilefin Tidehunter"
play = Summon(CONTROLLER, "OG_156a")
class OG_158:
"Zealous Initiate... | Implement Aberrant Berserker, Infested Tauren, and Spawn of N'Zoth | Implement Aberrant Berserker, Infested Tauren, and Spawn of N'Zoth
| Python | agpl-3.0 | NightKev/fireplace,jleclanche/fireplace,beheh/fireplace |
6fba51e47053d60eb8cb2f44178e548d8f2c3a8e | api/urls.py | api/urls.py | from django.conf.urls import patterns, url, include
from api import views
# The API URLs are now determined automatically by the router.
# Additionally, we include the login URLs for the browseable API.
urlpatterns = patterns('',
# list of all readings
url(r'^api/all', views.ApiRoot.as_view()),
# list of ... | from django.conf.urls import url, include
from api.views import ReadingViewSet, UserViewSet
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'readings', ReadingViewSet)
router.register(r'users', UserViewSet)
urlpatterns = [
url(r'^', include(router.urls)),
url(r'^api-... | Use routers instead of manual routes | Use routers instead of manual routes
| Python | bsd-3-clause | codefornigeria/dustduino-server,codefornigeria/dustduino-server,codefornigeria/dustduino-server,developmentseed/dustduino-server,developmentseed/dustduino-server,developmentseed/dustduino-server |
7e87a91f48ef9d5a031033991ce68c2596193f01 | tests/test_pipe.py | tests/test_pipe.py | from slug import Pipe
def test_goesthrough():
p = Pipe()
p.side_in.write(b"Hello")
p.side_in.close()
data = p.side_out.read()
assert data == b'Hello'
def test_eof():
p = Pipe()
p.side_in.write(b"spam")
data = p.side_out.read()
assert data == b'spam'
p.side_in.close()
d... | import pytest
from slug import Pipe
def test_goesthrough():
p = Pipe()
p.side_in.write(b"Hello")
p.side_in.close()
data = p.side_out.read()
assert data == b'Hello'
def test_eof():
p = Pipe()
p.side_in.write(b"spam")
data = p.side_out.read()
assert data == b'spam'
p.side_in... | Add iteration tests on pipes | Add iteration tests on pipes
| Python | bsd-3-clause | xonsh/slug |
4975361a86fb2288e84beff0056e90a22225bdae | htmlmin/tests/mocks.py | htmlmin/tests/mocks.py | # Copyright 2013 django-htmlmin authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
class RequestMock(object):
def __init__(self, path="/"):
self.path = path
class ResponseMock(dict):
def __init__(self, *args, **kwargs... | # Copyright 2013 django-htmlmin authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
class RequestMock(object):
def __init__(self, path="/"):
self.path = path
self._hit_htmlmin = True
class RequestBareMock(object):
... | Extend RequestMock, add RequestBareMock w/o flag | Extend RequestMock, add RequestBareMock w/o flag
RequestMock always pretends that htmlmin has seen the request, so
all other tests work normally.
| Python | bsd-2-clause | argollo/django-htmlmin,cobrateam/django-htmlmin,erikdejonge/django-htmlmin,erikdejonge/django-htmlmin,argollo/django-htmlmin,erikdejonge/django-htmlmin,Alcolo47/django-htmlmin,Zowie/django-htmlmin,Alcolo47/django-htmlmin,Zowie/django-htmlmin,cobrateam/django-htmlmin |
47b00f384dbee0fb3b82696406978669ae80a3c6 | tests/test_config.py | tests/test_config.py | # Copyright 2015-2016 Masayuki Yamamoto
#
# 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 agree... | # Copyright 2015-2016 Masayuki Yamamoto
#
# 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 agree... | Add test case for dependence constants | Add test case for dependence constants
Expect to depend filename by 'CONFIG_FILENAME' constants.
| Python | apache-2.0 | ma8ma/yanico |
f70a1ae6d86b5e789b5f6120db2772ec492bc088 | mardek_sol_reader.py | mardek_sol_reader.py | from struct import unpack
from os import walk, sep
from os.path import expanduser
from re import search
shared_objects_dirs = [
'Library/Application Support/Google/Chrome/Default/Pepper Data/Shockwave Flash/WritableRoot/#SharedObjects',
'Library/Preferences/Macromedia/Flash Player/#SharedObjects',
'AppData\Local... | from struct import unpack
from os import walk, sep
from os.path import expanduser
from re import search
shared_objects_dirs = [
'Library/Application Support/Google/Chrome/Default/Pepper Data/Shockwave Flash/WritableRoot/#SharedObjects',
'Library/Preferences/Macromedia/Flash Player/#SharedObjects',
'AppData\Local... | Fix to use binary read format | Fix to use binary read format
| Python | apache-2.0 | jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.