commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
fc6a9dfebc8bc016155c791c3325cdbb257dc192 | Move redis import | OParl/validator,OParl/validator | src/cache.py | src/cache.py | # The MIT License (MIT)
#
# Copyright (c) 2017 Stefan Graupner
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... | # The MIT License (MIT)
#
# Copyright (c) 2017 Stefan Graupner
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... | mit | Python |
4f5419fdec8dd1face4e3185d7146c1705b4de0f | add _t_r_a_k to list of available tables | fonttools/fonttools,googlefonts/fonttools | Lib/fontTools/ttLib/tables/__init__.py | Lib/fontTools/ttLib/tables/__init__.py |
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
# DON'T EDIT! This file is generated by MetaTools/buildTableList.py.
def _moduleFinderHint():
"""Dummy function to let modulefinder know what tables may be
dynamically imported. Generated by MetaTools/buildTableList.p... |
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
# DON'T EDIT! This file is generated by MetaTools/buildTableList.py.
def _moduleFinderHint():
"""Dummy function to let modulefinder know what tables may be
dynamically imported. Generated by MetaTools/buildTableList.p... | mit | Python |
b5068d644ffde56f302e9aee5b77e837a1d3e181 | Add some logging to generic error handler. | not-nexus/shelf,kyle-long/pyshelf,not-nexus/shelf,kyle-long/pyshelf | pyshelf/app.py | pyshelf/app.py | import flask
from pyshelf.routes.artifact import artifact
import pyshelf.response_map as response_map
import logging
app = flask.Flask(__name__)
app.register_blueprint(artifact)
@app.errorhandler(Exception)
def generic_exception_handler(error):
"""
Prevents Exceptions flying all around the place.
"""... | import flask
from pyshelf.routes.artifact import artifact
import pyshelf.response_map as response_map
app = flask.Flask(__name__)
app.register_blueprint(artifact)
@app.errorhandler(Exception)
def generic_exception_handler(error):
if not error.message:
error.message = "Internal Server Error"
return res... | mit | Python |
7f0853522424ceefc44d57f7c597dee2df6f2fe7 | include the revisions in the generated diffs | alex/pyvcs | pyvcs/utils.py | pyvcs/utils.py | from difflib import unified_diff
from pyvcs.exceptions import FileDoesNotExist
def generate_unified_diff(repository, changed_files, commit1, commit2):
diffs = []
for file_name in changed_files:
try:
file1 = repository.file_contents(file_name, commit1)
except FileDoesNotExist:
... | from difflib import unified_diff
from pyvcs.exceptions import FileDoesNotExist
def generate_unified_diff(repository, changed_files, commit1, commit2):
diffs = []
for file_name in changed_files:
try:
file1 = repository.file_contents(file_name, commit1)
except FileDoesNotExist:
... | bsd-3-clause | Python |
e503ef58e801cfbc3ba72ba84bc2150c79a401d3 | Save creatorId as well for geometries | OpenChemistry/mongochemserver | girder/molecules/molecules/models/geometry.py | girder/molecules/molecules/models/geometry.py | from bson.objectid import ObjectId
from girder.models.model_base import AccessControlledModel
from girder.constants import AccessType
from .molecule import Molecule as MoleculeModel
class Geometry(AccessControlledModel):
def __init__(self):
super(Geometry, self).__init__()
def initialize(self):
... | from bson.objectid import ObjectId
from girder.models.model_base import AccessControlledModel
from girder.constants import AccessType
from .molecule import Molecule as MoleculeModel
class Geometry(AccessControlledModel):
def __init__(self):
super(Geometry, self).__init__()
def initialize(self):
... | bsd-3-clause | Python |
05f4c0ae11879afecfc9cb9d155905ad4f3bf5fe | change json to find | awangga/signapp | signapp.py | signapp.py | #!/usr/bin/env python
"""
signapp.py
created by Rolly Maulana Awangga
"""
import config
import pymongo
import urllib
from Crypto.Cipher import AES
class Signapp(object):
def __init__(self):
self.key = config.key
self.iv = config.iv
self.opendb()
def opendb(self):
self.conn = pymongo.MongoClient(config.mo... | #!/usr/bin/env python
"""
signapp.py
created by Rolly Maulana Awangga
"""
import config
import pymongo
import urllib
import json
from Crypto.Cipher import AES
class Signapp(object):
def __init__(self):
self.key = config.key
self.iv = config.iv
self.opendb()
def opendb(self):
self.conn = pymongo.MongoClie... | agpl-3.0 | Python |
b90394696d8668891cef8ae218e9170be5bf86dd | Fix - Include isBinary flag | SArnab/JHU-605.401.82-SupaFly,SArnab/JHU-605.401.82-SupaFly,SArnab/JHU-605.401.82-SupaFly,SArnab/JHU-605.401.82-SupaFly,SArnab/JHU-605.401.82-SupaFly | clue/websocket/protocol.py | clue/websocket/protocol.py | from autobahn.twisted.websocket import WebSocketServerProtocol
from twisted.python import log
from clue import errors
from uuid import uuid1
from txaio import create_future
class ClueServerProtocol(WebSocketServerProtocol):
def __init__(self):
self.id = uuid1()
self.is_closed = create_future()
... | from autobahn.twisted.websocket import WebSocketServerProtocol
from twisted.python import log
from clue import errors
from uuid import uuid1
from txaio import create_future
class ClueServerProtocol(WebSocketServerProtocol):
def __init__(self):
self.id = uuid1()
self.is_closed = create_future()
... | mit | Python |
00ffe6505273ca2717d4df8f2b947e1a577829bd | Remove extra annotations | nlpub/mnogoznal,nlpub/mnogoznal,nlpub/mnogoznal | watset_wsd.py | watset_wsd.py | #!/usr/bin/env python
from flask import Flask, render_template, url_for, redirect, request
from flask_misaka import Misaka
from wsd.models import RequestWSD
app = Flask(__name__)
Misaka(app)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/wsd')
def wsd_redirect():
return redir... | #!/usr/bin/env python
from flask import Flask, render_template, url_for, redirect, request
from flask_misaka import Misaka
from wsd.models import RequestWSD
app = Flask(__name__)
Misaka(app)
@app.route('/', methods=['GET'])
def index():
return render_template('index.html')
@app.route('/wsd', methods=['GET'])
... | mit | Python |
7e7bdd474cde49757bff4357e76ae9f72bbefac1 | increase position zoom of the camera flyer | openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro | software/ddapp/src/python/ddapp/cameracontrol.py | software/ddapp/src/python/ddapp/cameracontrol.py | import vtk
import time
import numpy as np
from ddapp.timercallback import TimerCallback
class OrbitController(TimerCallback):
def __init__(self, view):
TimerCallback.__init__(self)
self.view = view
self.orbitTime = 20.0
def tick(self):
speed = 360.0 / self.orbitTime
de... | import vtk
import time
import numpy as np
from ddapp.timercallback import TimerCallback
class OrbitController(TimerCallback):
def __init__(self, view):
TimerCallback.__init__(self)
self.view = view
self.orbitTime = 20.0
def tick(self):
speed = 360.0 / self.orbitTime
de... | bsd-3-clause | Python |
63736a2958aae03749560dd3109fb4fea3b3ca7a | Switch calendar labels to be in Japanese | kfdm/wanikani,kfdm/wanikani | wanikani/django.py | wanikani/django.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.http import HttpResponse
from django.views.generic.base import View
from icalendar import Calendar, Event
from wanikani.core import WaniKani, Radical, Kanji
class WaniKaniView(View):
def get(self, request, **kwargs):
client = ... |
from __future__ import absolute_import
from django.http import HttpResponse
from django.views.generic.base import View
from icalendar import Calendar, Event
from wanikani.core import WaniKani, Radical, Kanji
class WaniKaniView(View):
def get(self, request, **kwargs):
client = WaniKani(kwargs['api_key... | mit | Python |
1c59f6522072a3a1846a9e8124a359d0651b00d7 | Change dependency as well | rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo | dojo/db_migrations/0019_system_settings_allow_anonymous_survey_repsonse.py | dojo/db_migrations/0019_system_settings_allow_anonymous_survey_repsonse.py | # Generated by Django 2.2.1 on 2019-08-21 19:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dojo', '0018_sonarqube_api_integration'),
]
operations = [
migrations.AddField(
model_name='system_settings',
name='... | # Generated by Django 2.2.1 on 2019-08-21 19:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dojo', '0014_jira_conf_resolution_mappings'),
]
operations = [
migrations.AddField(
model_name='system_settings',
na... | bsd-3-clause | Python |
c77fca2f41570a558719e0a9c1ce3efd1a5b206c | Add tests for patient filtering | darkfeline/drchrono-birthday,darkfeline/drchrono-birthday | drchrono_birthday/tests.py | drchrono_birthday/tests.py | # Copyright (C) 2016 Allen Li
#
# This file is part of drchrono Birthday.
#
# drchrono Birthday 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 Free Software Foundation, either version 3 of the License, or
# (at your option) an... | from django.test import TestCase
# Create your tests here.
| agpl-3.0 | Python |
884208477f0556cbe05c2ed965e6a42f57969fd9 | Remove unused import | yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/yunity-core | yunity/groups/models.py | yunity/groups/models.py | from django.db.models import TextField, ManyToManyField, CharField
from yunity.base.base_models import BaseModel, LocationModel
from config import settings
class Group(BaseModel, LocationModel):
name = CharField(max_length=settings.NAME_MAX_LENGTH)
description = TextField(blank=True)
members = ManyToManyF... | from django.db.models import Model
from django.db.models import TextField, ManyToManyField, CharField
from yunity.base.base_models import BaseModel, LocationModel
from config import settings
class Group(BaseModel, LocationModel):
name = CharField(max_length=settings.NAME_MAX_LENGTH)
description = TextField(bl... | agpl-3.0 | Python |
ab8ea5329bc4566b877e2f2991f096909842f9d9 | Bump version to 0.1.4 | totem/cluster-orchestrator,totem/cluster-orchestrator,totem/cluster-orchestrator | orchestrator/__init__.py | orchestrator/__init__.py | import logging
from conf.appconfig import LOG_FORMAT, LOG_DATE, LOG_ROOT_LEVEL
__version__ = '0.1.4'
__author__ = 'sukrit'
logging.basicConfig(format=LOG_FORMAT, datefmt=LOG_DATE, level=LOG_ROOT_LEVEL)
logging.getLogger('boto').setLevel(logging.INFO)
| import logging
from conf.appconfig import LOG_FORMAT, LOG_DATE, LOG_ROOT_LEVEL
__version__ = '0.1.0'
__author__ = 'sukrit'
logging.basicConfig(format=LOG_FORMAT, datefmt=LOG_DATE, level=LOG_ROOT_LEVEL)
logging.getLogger('boto').setLevel(logging.INFO)
| mit | Python |
3429293244359b5635b7d060caf527a36850f3a2 | Prepare for next dev version to incorporate encofing fixes in flask-hyperschema library | totem/cluster-orchestrator,totem/cluster-orchestrator,totem/cluster-orchestrator | orchestrator/__init__.py | orchestrator/__init__.py | from __future__ import absolute_import
from celery.signals import setup_logging
import orchestrator.logger
__version__ = '0.3.6'
__author__ = 'sukrit'
orchestrator.logger.init_logging()
setup_logging.connect(orchestrator.logger.init_celery_logging)
| from __future__ import absolute_import
from celery.signals import setup_logging
import orchestrator.logger
__version__ = '0.3.5'
__author__ = 'sukrit'
orchestrator.logger.init_logging()
setup_logging.connect(orchestrator.logger.init_celery_logging)
| mit | Python |
657ec7f2239cc0a48cb656cfd01ca03f854e0abc | bump version | vmalloc/pydeploy | pydeploy/__version__.py | pydeploy/__version__.py | __version__ = "0.2.6"
| __version__ = "0.2.5"
| bsd-3-clause | Python |
e8b404b4525983df8b790d18afcca4cc79430133 | Make python clean up after itself by removing its /tmp subdir. | google/swiftshader,google/swiftshader,bkaradzic/SwiftShader,bkaradzic/SwiftShader,bkaradzic/SwiftShader,google/swiftshader,bkaradzic/SwiftShader,bkaradzic/SwiftShader | pydir/build-pnacl-ir.py | pydir/build-pnacl-ir.py | #!/usr/bin/env python2
import argparse
import errno
import os
import shutil
import tempfile
from utils import shellcmd
from utils import FindBaseNaCl
if __name__ == '__main__':
argparser = argparse.ArgumentParser()
argparser.add_argument('cfile', nargs='+', type=str,
help='C file(s) to convert')
a... | #!/usr/bin/env python2
import argparse
import os
import tempfile
from utils import shellcmd
from utils import FindBaseNaCl
if __name__ == '__main__':
argparser = argparse.ArgumentParser()
argparser.add_argument('cfile', nargs='+', type=str,
help='C file(s) to convert')
argparser.add_argument('--di... | apache-2.0 | Python |
41941ce6ff0e8b2ac917f14c7ffddfa325ebb008 | Bump version | kinverarity1/pyexperiment,kinverarity1/pyexperiment,kinverarity1/pyexperiment,duerrp/pyexperiment,duerrp/pyexperiment,shaunstanislaus/pyexperiment,DeercoderResearch/pyexperiment,shaunstanislaus/pyexperiment,duerrp/pyexperiment,shaunstanislaus/pyexperiment,shaunstanislaus/pyexperiment,kinverarity1/pyexperiment,Deercoder... | pyexperiment/version.py | pyexperiment/version.py | """Defines the version of pyexperiment
"""
__version__ = '0.2.10'
| """Defines the version of pyexperiment
"""
__version__ = '0.2.9'
| mit | Python |
bcb887b24e19905655b3fe54e58c71319673ed46 | Update version | sendpulse/sendpulse-rest-api-python | pysendpulse/__init__.py | pysendpulse/__init__.py | __author__ = 'Maksym Ustymenko'
__author_email__ = 'tech@sendpulse.com'
__copyright__ = 'Copyright 2017, SendPulse'
__credits__ = ['Maksym Ustymenko', ]
__version__ = '0.0.9'
| __author__ = 'Maksym Ustymenko'
__author_email__ = 'tech@sendpulse.com'
__copyright__ = 'Copyright 2017, SendPulse'
__credits__ = ['Maksym Ustymenko', ]
__version__ = '0.0.8'
| apache-2.0 | Python |
f28459497dbfa0535323cce52a4ea4dc2daa2bf9 | fix pylint in setup | dmlc/xgboost,dmlc/xgboost,dmlc/xgboost,dmlc/xgboost,dmlc/xgboost,dmlc/xgboost | python-package/setup.py | python-package/setup.py | # pylint: disable=invalid-name, exec-used
"""Setup xgboost package."""
from __future__ import absolute_import
import sys
from setuptools import setup, find_packages
import subprocess
sys.path.insert(0, '.')
import os
#build on the fly if install in pip
#otherwise, use build.sh in the parent directory
if 'pip' in __fi... | # pylint: disable=invalid-name
"""Setup xgboost package."""
from __future__ import absolute_import
import sys
from setuptools import setup, find_packages
import subprocess
sys.path.insert(0, '.')
import os
#build on the fly if install in pip
#otherwise, use build.sh in the parent directory
if 'pip' in __file__:
i... | apache-2.0 | Python |
6cb5c6f14c66b5f21214cfc4aa3e08e1f113c856 | add ds9 fits parser | SAOImageDS9/tkblt,SAOImageDS9/tkblt,SAOImageDS9/tkblt | ds9/parsers/fitsparser.tac | ds9/parsers/fitsparser.tac | %{
%}
#include string.tin
%start command
%token MASK_
%token NEW_
%token SLICE_
%%
# XPA/SAMP only
command : fits
;
fits: new filename {FitsCmdLoad $2 {} {}}
| new MASK_ filename {FitsCmdLoad $3 mask {}}
| new SLICE_ filename {FitsCmdLoad $3 {} slice}
| new MASK_ SLICE_ filename {FitsCmdLoad $4 mask slice}
;... | %{
%}
#include string.tin
%start command
%token MASK_
%token NEW_
%token SLICE_
%%
# XPA/SAMP only
command : fits
;
fits: NEW_ {CreateFrame; FitsCmdLoad {} {} {}}
| new STRING_ {FitsCmdLoad $2 {} {}}
| new MASK_ STRING_ {FitsCmdLoad $3 mask {}}
| new SLICE_ STRING_ {FitsCmdLoad $3 {} slice}
| new MASK_ SLIC... | mit | Python |
7d1527b4d6e874ce06ed2bc329c3c0f5555cd2a4 | revise parallel model file | google/jax,tensorflow/probability,google/jax,google/jax,tensorflow/probability,google/jax | pjit_model.py | pjit_model.py | from functools import partial
import numpy.random as npr
import jax.numpy as np
from jax import lax
from jax import grad, pjit, papply
### set up some synthetic data
rng = npr.RandomState(0)
R = lambda *shape: rng.randn(*shape).astype("float32")
layer_sizes = [3, 2]
params = [(R(m, n), R(n)) for m, n in zip(layer_... | from functools import partial
import numpy.random as npr
import jax.numpy as np
from jax import lax
from jax import pjit, grad
### set up some synthetic data
rng = npr.RandomState(0)
R = lambda *shape: rng.randn(*shape).astype("float32")
layer_sizes = [3, 2]
params = [(R(m, n), R(n)) for m, n in zip(layer_sizes[:-... | apache-2.0 | Python |
10b1e000240cd9670e502a2a66c5ab85734c2152 | Remove host to ip | liverliu/netmusichacker,liverliu/netmusichacker | python/hacker/config.py | python/hacker/config.py | __author__ = 'shijianliu'
host = 'http://223.252.199.7'
server_host='127.0.0.1'
server_port=80
| __author__ = 'shijianliu'
host = 'http://music.liverliu.com'
server_host='127.0.0.1'
server_port=80
| apache-2.0 | Python |
3b237d7ef2c418cfcf361f8d9ca32806a265f823 | Rename class | rdmorganiser/rdmo,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug | rdmo/core/swagger.py | rdmo/core/swagger.py | from django.conf.urls import include, url
from rdmo.accounts.urls import accounts_patterns_api
from rdmo.conditions.urls import conditions_patterns_api
from rdmo.domain.urls import domain_patterns_api
from rdmo.options.urls import options_patterns_api
from rdmo.projects.urls import projects_patterns_api
from rdmo.ques... | from django.conf.urls import include, url
from rdmo.accounts.urls import accounts_patterns_api
from rdmo.conditions.urls import conditions_patterns_api
from rdmo.domain.urls import domain_patterns_api
from rdmo.options.urls import options_patterns_api
from rdmo.projects.urls import projects_patterns_api
from rdmo.ques... | apache-2.0 | Python |
966fe99da944ee2864db8a35705c4e021bc29a98 | Add median pivot point for quick sort | akras14/cs-101,akras14/cs-101,akras14/cs-101,akras14/cs-101 | quick-sort/quicksort.py | quick-sort/quicksort.py | """ Quick Sort Implementation"""
def sort(arr, l=None, r=None):
"""Sort Array"""
# Init l and r, if not provided
if l is None:
l = 0
if r is None:
r = len(arr) - 1
# Check for Base case
if l >= r: # Length equal 1
return
p = getP(arr, l, r)
# Swap p with firs... | """ Quick Sort Implementation"""
def sort(arr, l=None, r=None):
"""Sort Array"""
# Init l and r, if not provided
if l is None:
l = 0
if r is None:
r = len(arr) - 1
# Check for Base case
if l >= r: # Length equal 1
return
p = getP(arr, l, r)
# Swap p with firs... | mit | Python |
9aabda0e489639a753d6589e9d0f7923505643cb | Update parseSecure.py | m-sinclair/PythonScript | parseSecure.py | parseSecure.py | #!/usr/bin/python
import time
import re
import subprocess
import os
import iptc
def follow(thefile):
thefile.seek(0,2)
while True:
line = thefile.readline()
if not line:
time.sleep(0.1)
continue
yield line
if __name__ == '__main__':
logfile = open("/var/log/... | #!/usr/bin/python
import time
import re
import subprocess
import os
def follow(thefile):
thefile.seek(0,2)
while True:
line = thefile.readline()
if not line:
time.sleep(0.1)
continue
yield line
if __name__ == '__main__':
logfile = open("/var/log/secure","r")
... | unlicense | Python |
5006ba3124cd80a4529b9ed645aa8981d06a9886 | Stop generate feeds when publishing | andrewheiss/scorecarddiplomacy-org,andrewheiss/scorecarddiplomacy-org,andrewheiss/scorecarddiplomacy-org,andrewheiss/scorecarddiplomacy-org | publishconf.py | publishconf.py | #!/usr/bin/env python3
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = ''
RELATIVE_URLS = False
DELETE_OUTPUT_DIRECTORY = True
# Following items are often useful when publishing
#... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = ''
RELATIVE_URLS = False
FEED_ALL_ATOM = 'fee... | mit | Python |
7e9ff1866c6c640e8709a16f783805bc935e198f | Rename options to user_options. | fhirschmann/penchy,fhirschmann/penchy | penchy/jvms.py | penchy/jvms.py | """
This module provides JVMs to run programs.
"""
import os
import shlex
from penchy.maven import get_classpath
class JVM(object):
"""
This class represents a JVM.
"""
def __init__(self, path, options=""):
"""
:param path: path to jvm executable relative to basepath
:param ... | """
This module provides JVMs to run programs.
"""
import os
import shlex
from penchy.maven import get_classpath
class JVM(object):
"""
This class represents a JVM.
"""
def __init__(self, path, options=""):
"""
:param path: path to jvm executable relative to basepath
:param ... | mit | Python |
ddd3373ce078cf9bf40da7ebd8591995e819b750 | Add function to swap byte order | bjoernricks/phell | phell/utils.py | phell/utils.py | # -*- coding: utf-8 -*-
#
# (c) 2016 Björn Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'phell' for details.
#
import sys
def to_hex(value):
if sys.version_info.major < 3:
return value.encode('hex')
return "".join("%02x" % b for b in value)
def from_hex(value):
if sy... | # -*- coding: utf-8 -*-
#
# (c) 2016 Björn Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'phell' for details.
#
import sys
def to_hex(value):
if sys.version_info.major < 3:
return value.encode('hex')
return "".join("%02x" % b for b in value)
def from_hex(value):
if sy... | mit | Python |
63b5362e4ba531544ea732c1daaaca920e73e936 | Extend nice regex | Venefyxatu/phennyfyxata,Venefyxatu/phennyfyxata,Venefyxatu/phennyfyxata | phenny/suck.py | phenny/suck.py | #!/usr/bin/env python
# coding=utf-8
import time
import random
ACTION = chr(1) + "ACTION "
AFIN = chr(1)
NICE_CHOICES = ['Aww, ik vind jou lief, %s!',
ACTION + ' knuffelt %s' + AFIN,
'%s: jij bent officieel cool!',
ACTION + ' knuffelt %s plat' +AFIN,
'... | #!/usr/bin/env python
# coding=utf-8
import time
import random
ACTION = chr(1) + "ACTION "
AFIN = chr(1)
NICE_CHOICES = ['Aww, ik vind jou lief, %s!',
ACTION + ' knuffelt %s' + AFIN,
'%s: jij bent officieel cool!',
ACTION + ' knuffelt %s plat' +AFIN,
'... | bsd-2-clause | Python |
4ac8d799aa6b272aefdfb6a10100475dad8f8f56 | change name of age standardized rate model to model.asr | ihmeuw/dismod_mr | dismod_mr/model/__init__.py | dismod_mr/model/__init__.py | import likelihood, spline, age_groups, priors, covariates, process
from process import age_specific_rate as asr, consistent
from covariates import predict_for
| import likelihood, spline, age_groups, priors, covariates, process
from process import age_specific_rate, consistent
from covariates import predict_for
| agpl-3.0 | Python |
886a55cde5b2463878ffc95a91b7f3c6b715fcf3 | 更新 modules main/signals.py, 修正 PEP8 警告 | yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo | commonrepo/main/signals.py | commonrepo/main/signals.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from actstream import action
from actstream import registry
from django_comments.signals import comment_was_posted
from threadedcomments.models import ThreadedComment
# Comment has been registeded with actstream.registry.register
def c... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from actstream import action
from actstream import registry
from django_comments.signals import comment_was_posted
from threadedcomments.models import ThreadedComment
# Comment has been registeded with actstream.registry.register
def com... | apache-2.0 | Python |
42c78e5f48f9a3fb3b2b6dd06a2f199a93bc7c72 | Check the address | ArtOfCode-/SmokeDetector,Charcoal-SE/SmokeDetector,NickVolynkin/SmokeDetector,ArtOfCode-/SmokeDetector,Charcoal-SE/SmokeDetector,NickVolynkin/SmokeDetector | continuousintegration.py | continuousintegration.py | import socket
import requests
import sys
from globalvars import GlobalVars
def watchCi():
HOST = ''
PORT = 49494
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "CI Socket Created"
try:
s.bind((HOST, PORT))
except socket.error as msg:
print 'Bind Failed. Error code: ... | import socket
import requests
import sys
from globalvars import GlobalVars
def watchCi():
HOST = ''
PORT = 49494
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "CI Socket Created"
try:
s.bind((HOST, PORT))
except socket.error as msg:
print 'Bind Failed. Error code: ... | apache-2.0 | Python |
5656eb24e50a753aa442944ee73dd944b01d43ed | Bump version number | jrsmith3/datac,jrsmith3/datac | datac/__init__.py | datac/__init__.py | # -*- coding: utf-8 -*-
"""
Base Library (:mod:`datac`)
===========================
.. currentmodule:: datac
"""
from datac import Datac
__version__ = "0.2.0"
| # -*- coding: utf-8 -*-
"""
Base Library (:mod:`datac`)
===========================
.. currentmodule:: datac
"""
from datac import Datac
__version__ = "0.1.0"
| mit | Python |
aebc2c88b1ef1092d1266d2eb0aeb8333a1396c2 | Add context manager functionality to event bus. | rave-engine/rave | rave/events.py | rave/events.py | """
rave event bus.
"""
import rave.log
_log = rave.log.get(__name__)
class StopProcessing(BaseException):
""" Exception raised to indicate this event should not be processed further. """
pass
class HookContext:
def __init__(self, bus, event, handler):
self.bus = bus
self.event = event
... | """
rave event bus.
"""
import rave.log
## API.
class StopProcessing(BaseException):
""" Exception raised to indicate this event should onot be processed further. """
pass
class EventBus:
def __init__(self):
self.handlers = {}
def hook(self, event, handler=None):
if not handler:
... | bsd-2-clause | Python |
73c3c9deac8f298a118c19d81648d86820d69001 | save to config | drssoccer55/RLBot,drssoccer55/RLBot | runner_GUI.py | runner_GUI.py | import tkinter as tk
from tkinter import ttk
from configparser import RawConfigParser
from gui import match_settings_frame
from gui.team_frames.team_frame_notebook import NotebookTeamFrame
from gui.utils import get_file, IndexManager
from utils.rlbot_config_parser import create_bot_config_layout, get_num_players
from ... | import tkinter as tk
from tkinter import ttk
from configparser import RawConfigParser
from gui import match_settings_frame
from gui.team_frames.team_frame_notebook import NotebookTeamFrame
from gui.utils import get_file, IndexManager
from utils.rlbot_config_parser import create_bot_config_layout, get_num_players
from ... | mit | Python |
3c7afc4c157d75ebd3411303e285b42539ef6779 | Remove trailing white space. | opello/adventofcode | python/07-1.py | python/07-1.py | #!/usr/bin/env python
import re
instructions = []
def doOperation(operator, operands):
if operator == '':
return operands[0]
elif operator == 'NOT':
return ~operands[0]
elif operator == 'AND':
return operands[0] & operands[1]
elif operator == 'OR':
return operands[0] | operands[1]... | #!/usr/bin/env python
import re
instructions = []
def doOperation(operator, operands):
if operator == '':
return operands[0]
elif operator == 'NOT':
return ~operands[0]
elif operator == 'AND':
return operands[0] & operands[1]
elif operator == 'OR':
return operands[0] | operands[1]... | mit | Python |
282131179642e653ef292050c53f1620ebddb269 | Make program description more concise | mgarriott/PDFMerger | src/merge.py | src/merge.py | #!/usr/bin/env python
'''
Merge together a pdf document containing only front pages with a separate
document containing only back pages and save the result into a new document.
@author: Matt Garriott
'''
import argparse
import os
from pyPdf import PdfFileReader, PdfFileWriter
def merge(fppath, bppath, outputpath, no... | #!/usr/bin/env python
'''
A simple program designed to allow a user to merge a pdf document
that contains only the front pages to a separate document that contains
only the back pages, and merge them in the right order into a new pdf
document.
@author: Matt Garriott
'''
import argparse
import os
from pyPdf import Pdf... | bsd-2-clause | Python |
c8ffd1fc4c4e06cd71e86d1d48749a3fe527a54e | Fix test to accommodate change of error message. | gaiaresources/biosys,parksandwildlife/biosys,gaiaresources/biosys,serge-gaia/biosys,ropable/biosys,parksandwildlife/biosys,serge-gaia/biosys,ropable/biosys,gaiaresources/biosys,ropable/biosys,serge-gaia/biosys,parksandwildlife/biosys | biosys/apps/main/tests/api/test_serializers.py | biosys/apps/main/tests/api/test_serializers.py | from django.test import TestCase
from main.api.serializers import DatasetSerializer
from main.tests.api import helpers
class TestDatsetSerializer(helpers.BaseUserTestCase):
def test_name_uniqueness(self):
"""
Test that the serializer report an error if the dataset name is not unique within a pro... | from django.test import TestCase
from main.api.serializers import DatasetSerializer
from main.tests.api import helpers
class TestDatsetSerializer(helpers.BaseUserTestCase):
def test_name_uniqueness(self):
"""
Test that the serializer report an error if the dataset name is not unique within a pro... | apache-2.0 | Python |
47c498a174c3a5f32db34b6cc1e646e016ee2187 | Implement make_temp() | saurabhiiit/coala,mr-karan/coala,CruiseDevice/coala,arush0311/coala,saurabhiiit/coala,swatilodha/coala,d6e/coala,tltuan/coala,MattAllmendinger/coala,tushar-rishav/coala,coala-analyzer/coala,Uran198/coala,sagark123/coala,AdeshAtole/coala,rimacone/testing2,Shade5/coala,Nosferatul/coala,yland/coala,CruiseDevice/coala,jayv... | coalib/tests/output/dbus/BuildDbusServiceTest.py | coalib/tests/output/dbus/BuildDbusServiceTest.py | import sys
import unittest
from setuptools.dist import Distribution
from distutils.errors import DistutilsOptionError
sys.path.insert(0, ".")
from coalib.output.dbus.BuildDbusService import BuildDbusService
from coalib.misc import Constants
from coalib.misc.ContextManagers import make_temp
class BuildDbusServiceTest... | import sys
import unittest
import tempfile
import os
from setuptools.dist import Distribution
from distutils.errors import DistutilsOptionError
sys.path.insert(0, ".")
from coalib.output.dbus.BuildDbusService import BuildDbusService
from coalib.misc import Constants
class BuildDbusServiceTest(unittest.TestCase):
... | agpl-3.0 | Python |
e36e2d58526cf2ab8c4445ee28ab5e53440f4218 | Fix UID strings. | kumpelblase2/rn,kumpelblase2/rn,kumpelblase2/rn | Aufgabe2/server/mail.py | Aufgabe2/server/mail.py | import os
class Mail():
def __init__(self, filename):
self.filename = filename
self.content = []
self.uid = ''
self.deleted = False
def load(self):
file = open(self.filename, 'r')
self.content = file.read().split('\r\n')
self.uid = os.path.basename(file.name)
self.uid = self.uid[:self.uid.index('.')... | import os
class Mail():
def __init__(self, filename):
self.filename = filename
self.content = []
self.uid = ''
self.deleted = False
def load(self):
file = open(self.filename, 'r')
self.content = file.read().split('\r\n')
self.uid = file.name[:file.name.index('.')]
file.close()
def size(self):
re... | mit | Python |
23c964580f3fc58146865d9e4d1afbf588068de0 | Update pykubectl/kubectl.py | 4Catalyzer/pykubectl | pykubectl/kubectl.py | pykubectl/kubectl.py | import json
import logging
import tempfile
from subprocess import CalledProcessError, check_output
class KubeCtl:
def __init__(self, bin='kubectl', global_flags=''):
super().__init__()
self.kubectl = f'{bin} {global_flags}'
def execute(self, command, definition=None, safe=False):
cmd ... | import json
import logging
import tempfile
from subprocess import CalledProcessError, check_output
class KubeCtl:
def __init__(self, bin='kubectl', global_flags=''):
super().__init__()
self.kubectl = f'{bin} {global_flags}'
def execute(self, command, definition=None, safe=False):
cmd ... | mit | Python |
0b1376caef3a32d260d36bff4522199b9bf484fe | Normalize version number. | tld/pyptouch | pyptouch/__init__.py | pyptouch/__init__.py | # -*- coding: utf-8 -*-
"""Python driver for P-Touch series of label-printers, with various utilities.
.. moduleauthor:: Terje Elde <terje@elde.net>
"""
__author__ = 'Terje Elde'
__email__ = 'terje@elde.net'
__version__ = '0.0.1.dev0'
| # -*- coding: utf-8 -*-
"""Python driver for P-Touch series of label-printers, with various utilities.
.. moduleauthor:: Terje Elde <terje@elde.net>
"""
__author__ = 'Terje Elde'
__email__ = 'terje@elde.net'
__version__ = '0.0.1-dev0'
| bsd-2-clause | Python |
4e209ce3b531edf41c643cdec94f9746ad032338 | fix rspy.repo.build to not include RelWithDebInfo (in LibCI) | IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense | unit-tests/py/rspy/repo.py | unit-tests/py/rspy/repo.py | # License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2021 Intel Corporation. All Rights Reserved.
import os
# this script is located in librealsense/unit-tests/py/rspy, so main repository is:
root = os.path.dirname( os.path.dirname( os.path.dirname( os.path.dirname( os.path.abspath( __file__ ))))... | # License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2021 Intel Corporation. All Rights Reserved.
import os
# this script is located in librealsense/unit-tests/py/rspy, so main repository is:
root = os.path.dirname( os.path.dirname( os.path.dirname( os.path.dirname( os.path.abspath( __file__ ))))... | apache-2.0 | Python |
78dd3f4c46939c619f4a78b854c07612d4b74573 | Update cam_timeLapse_Threaded_cam.py | philprobinson84/RPi,philprobinson84/RPi | camera/timelapse/cam_timeLapse_Threaded_cam.py | camera/timelapse/cam_timeLapse_Threaded_cam.py | #!/usr/bin/env python2.7
import time
import picamera
import os
import errno
import sys
class Logger(object):
def __init__(self):
self.terminal = sys.stdout
self.log = open("logfile.log", "a")
def write(self, message):
self.terminal.write(message)
self.log.write(message)
sys... | #!/usr/bin/env python2.7
import time
import picamera
import os
import errno
FRAME_INTERVAL = 30
DIRNAME = "/home/pi/timelapse"
frame = 1
def create_dir():
TIME = time.localtime()
CURRENT_YEAR = TIME[0]
CURRENT_MONTH = TIME[1]
CURRENT_DAY = TIME[2]
CURRENT_HOUR = TIME[3]
global DIRNAME
DIR... | artistic-2.0 | Python |
0a5c9f8cdf55916ac9a914a0d2fe68893d2c26af | Fix upload listing test | OpenBazaar/openbazaar-go,OpenBazaar/openbazaar-go,OpenBazaar/openbazaar-go | qa/upload_listing.py | qa/upload_listing.py | import requests
import json
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
class UploadListingTest(OpenBazaarTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 1
def setup_network(self):
self.set... | import requests
import json
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
class UploadListingTest(OpenBazaarTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 1
def setup_network(self):
self.set... | mit | Python |
c3e0249602f2173f21b56af1b88864323baf4e39 | Remove warnings | panoptes/POCS,AstroHuntsman/POCS,Guokr1991/POCS,fmin2958/POCS,AstroHuntsman/POCS,panoptes/POCS,Guokr1991/POCS,joshwalawender/POCS,fmin2958/POCS,joshwalawender/POCS,AstroHuntsman/POCS,joshwalawender/POCS,panoptes/POCS,Guokr1991/POCS,AstroHuntsman/POCS,Guokr1991/POCS,panoptes/POCS,fmin2958/POCS | panoptes/utils/config.py | panoptes/utils/config.py | import yaml
import os
import panoptes.utils.error
panoptes_config = '{}/../../config.yaml'.format(os.path.dirname(__file__))
def has_config(Class):
""" Class Decorator: Adds a config singleton to class """
# If already read, simply return config
if not has_config._config:
load_config(config_file=panoptes_con... | import yaml
import warnings
import os
import panoptes.utils.error
panoptes_config = '{}/../../config.yaml'.format(os.path.dirname(__file__))
def has_config(Class):
""" Class Decorator: Adds a config singleton to class """
# If already read, simply return config
if not has_config._config:
load_config(config_f... | mit | Python |
9a36b60fc5a5a3b103582ee438f06c81889ec1f4 | fix pid dir for daemon | sirech/deliver,sirech/deliver | deliverdaemon.py | deliverdaemon.py | import argparse
import os
from supay import Daemon
from updater import prepare, loop
def init_d():
return Daemon(name='deliver', pid_dir=os.path.abspath(os.path.curdir))
def run():
daemon = init_d()
daemon.start(check_pid=True, verbose=True)
prepare()
loop()
def stop():
daemo... | import argparse
from supay import Daemon
from updater import prepare, loop
def init_d():
return Daemon(name='deliver', pid_dir='.')
def run():
daemon = init_d()
daemon.start(check_pid=True, verbose=True)
prepare()
loop()
def stop():
daemon = init_d()
daemon.stop(verbose=T... | mit | Python |
108c76d85c268891cac2b166f94e437ad498b383 | fix average calculation to be blocks over time | svn2github/libtorrent-trunk,svn2github/libtorrent-trunk,svn2github/libtorrent-trunk,svn2github/libtorrent-trunk | parse_disk_buffer_log.py | parse_disk_buffer_log.py | #!/bin/python
import os, sys, time
lines = open(sys.argv[1], 'rb').readlines()
# logfile format:
# <time(ms)> <key>: <value>
# example:
# 16434 read cache: 17
key_order = ['receive buffer', 'send buffer', 'write cache', 'read cache', 'hash temp']
colors = ['30f030', 'f03030', '80f080', 'f08080', '4040ff']
keys = [... | #!/bin/python
import os, sys, time
lines = open(sys.argv[1], 'rb').readlines()
# logfile format:
# <time(ms)> <key>: <value>
# example:
# 16434 read cache: 17
key_order = ['receive buffer', 'send buffer', 'write cache', 'read cache', 'hash temp']
colors = ['30f030', 'f03030', '80f080', 'f08080', '4040ff']
keys = [... | bsd-3-clause | Python |
91073bd5a6733b14f5f684139477fad38494447d | remove debug print | mattoufoutu/EventViz,mattoufoutu/EventViz | eventviz/views/timeline.py | eventviz/views/timeline.py | # -*- coding: utf-8 -*-
from flask import Blueprint, render_template, request, url_for, redirect
import eventviz
from eventviz import settings
from eventviz.db import connection, get_fieldnames, get_event_types, get_item
timeline = Blueprint('timeline', __name__)
@timeline.route('/', methods=['GET', 'POST'])
def i... | # -*- coding: utf-8 -*-
from flask import Blueprint, render_template, request, url_for, redirect
import eventviz
from eventviz import settings
from eventviz.db import connection, get_fieldnames, get_event_types, get_item
timeline = Blueprint('timeline', __name__)
@timeline.route('/', methods=['GET', 'POST'])
def i... | mit | Python |
ea3a60da2f68969a39e7c13d5dcf1e465bcc597d | add health check | fr0der1c/EveryClass-server,fr0der1c/EveryClass-server,fr0der1c/EveryClass-server,fr0der1c/EveryClass-server | everyclass/server/views.py | everyclass/server/views.py | from flask import Blueprint, flash, jsonify, redirect, render_template, request, url_for
from markupsafe import escape
from everyclass.server.exceptions import NoClassException, NoStudentException
main_blueprint = Blueprint('main', __name__)
@main_blueprint.route('/')
def main():
"""首页"""
return render_temp... | from flask import Blueprint, flash, jsonify, redirect, render_template, request, url_for
from markupsafe import escape
from everyclass.server.exceptions import NoClassException, NoStudentException
main_blueprint = Blueprint('main', __name__)
@main_blueprint.route('/')
def main():
"""首页"""
return render_temp... | mpl-2.0 | Python |
5098e6e5f6156709b77037d3759dae1f43eec667 | Add solution for Lesson_5_Problem_Set/01-Most_Common_City_Name | krzyste/ud032,krzyste/ud032 | Lesson_5_Problem_Set/01-Most_Common_City_Name/city.py | Lesson_5_Problem_Set/01-Most_Common_City_Name/city.py | #!/usr/bin/env python
"""
Use an aggregation query to answer the following question.
What is the most common city name in our cities collection?
Your first attempt probably identified None as the most frequently occurring city name.
What that actually means is that there are a number of cities without a name field ... | #!/usr/bin/env python
"""
Use an aggregation query to answer the following question.
What is the most common city name in our cities collection?
Your first attempt probably identified None as the most frequently occurring city name.
What that actually means is that there are a number of cities without a name field ... | agpl-3.0 | Python |
88b01dba22aa1915778f5a0227c6a3d9851add41 | make UnitsNotReducible import in physical_constants private | yt-project/unyt | unyt/physical_constants.py | unyt/physical_constants.py | """
Predefined useful physical constants
Note that all of these names can be imported from the top-level unyt namespace.
For example::
>>> from unyt.physical_constants import gravitational_constant, solar_mass
>>> from unyt import AU
>>> from math import pi
>>>
>>> period = 2 * pi * ((1 * AU)**3 /... | """
Predefined useful physical constants
Note that all of these names can be imported from the top-level unyt namespace.
For example::
>>> from unyt.physical_constants import gravitational_constant, solar_mass
>>> from unyt import AU
>>> from math import pi
>>>
>>> period = 2 * pi * ((1 * AU)**3 /... | bsd-3-clause | Python |
208fbd6ac390d050fb23f0ec5d6e620f6b4a3164 | update phoenix login description | bird-house/pyramid-phoenix,bird-house/pyramid-phoenix,bird-house/pyramid-phoenix,bird-house/pyramid-phoenix | phoenix/account/schema.py | phoenix/account/schema.py | import colander
import deform
class PhoenixSchema(colander.MappingSchema):
password = colander.SchemaNode(
colander.String(),
title='Password',
description='If you have not configured your password yet then it is likely to be "qwerty"',
validator=colander.Length(min=6),
wid... | import colander
import deform
class PhoenixSchema(colander.MappingSchema):
password = colander.SchemaNode(
colander.String(),
title='Password',
description='If this is a demo instance your password might be "qwerty"',
validator=colander.Length(min=4),
widget=deform.widget.P... | apache-2.0 | Python |
468ede353d0f69753212e7dcb1eb448667fd1dc9 | Add missing imports. | repocracy/repocracy,repocracy/repocracy,repocracy/repocracy,codysoyland/snowman,codysoyland/snowman,codysoyland/snowman | repocracy/repo/tasks.py | repocracy/repo/tasks.py | import os
import subprocess
from django.conf import settings
from celery.decorators import task
from repocracy.repo.models import Repository
@task
def translate_repository(repo_pk):
pass
@task
def clone_repository(repo_pk):
try:
repo = Repository.objects.get(pk=repo_pk)
except Repository.DoesNo... | import os
import subprocess
from repo.models import Repository
@task
def translate_repository(repo_pk):
pass
@task
def clone_repository(repo_pk):
try:
repo = Repository.objects.get(pk=repo_pk)
destination = os.path.join(
settings.REPOCRACY_BASE_REPO_PATH,
repo.pk
... | bsd-3-clause | Python |
873aac264d5edbe7ff341a6270cdd4f687e56f0e | Make requirements compile disable pip's require-virtualenv flag always | adamchainz/mariadb-dyncol | requirements/compile.py | requirements/compile.py | #!/usr/bin/env python
from __future__ import annotations
import os
import subprocess
import sys
from pathlib import Path
if __name__ == "__main__":
os.chdir(Path(__file__).parent)
os.environ["CUSTOM_COMPILE_COMMAND"] = "requirements/compile.py"
os.environ["PIP_REQUIRE_VIRTUALENV"] = "0"
common_args = ... | #!/usr/bin/env python
from __future__ import annotations
import os
import subprocess
import sys
from pathlib import Path
if __name__ == "__main__":
os.chdir(Path(__file__).parent)
os.environ["CUSTOM_COMPILE_COMMAND"] = "requirements/compile.py"
os.environ.pop("PIP_REQUIRE_VIRTUALENV", None)
common_arg... | mit | Python |
49181062e5f697775b8f3fe12050d350b1dd8b9d | Clean up and store http response code as well | icereval/scrapi,mehanig/scrapi,erinspace/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,fabianvf/scrapi,fabianvf/scrapi,ostwald/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,jeffreyliu3230/scrapi,alexgarciac/scrapi,erinspace/scrapi | scrapi/requests.py | scrapi/requests.py | from __future__ import absolute_import
import json
import logging
import functools
from datetime import datetime
import requests
import cqlengine
from cqlengine import columns
from scrapi import database # noqa
from scrapi import settings
logger = logging.getLogger(__name__)
class HarvesterResponse(cqlengine.Mo... | from __future__ import absolute_import
import json
import logging
import functools
from datetime import datetime
import requests
import cqlengine
from cqlengine import columns
from cqlengine import management
from cassandra.cluster import NoHostAvailable
from scrapi import settings
logger = logging.getLogger(__nam... | apache-2.0 | Python |
d2c5c5867a8d8ccd3af23251170fdff405c4cea2 | comment out all ddb | mauriceyap/ccm-assistant | src/resources/playback_db.py | src/resources/playback_db.py | import boto3
import os
dynamodb = boto3.resource('dynamodb', region_name='eu-west-1',
endpoint_url=("https://dynamodb.eu-west-1."
"amazonaws.com"),
aws_access_key_id=os.environ['AWS_ACCESS_KEY_ID'],
a... | import boto3
import os
dynamodb = boto3.resource('dynamodb', region_name='eu-west-1',
endpoint_url=("https://dynamodb.eu-west-1."
"amazonaws.com"),
aws_access_key_id=os.environ['AWS_ACCESS_KEY_ID'],
a... | mit | Python |
ee2970064759eb1f3683410c1ab0d6d5a35b3470 | Fix warning Django 1.9 | lambdalisue/django-permission | src/permission/utils/autodiscover.py | src/permission/utils/autodiscover.py | # coding=utf-8
"""
"""
__author__ = 'Alisue <lambdalisue@hashnote.net>'
import copy
def autodiscover(module_name=None):
"""
Autodiscover INSTALLED_APPS perms.py modules and fail silently when not
present. This forces an import on them to register any permissions bits
they may want.
"""
if djan... | # coding=utf-8
"""
"""
__author__ = 'Alisue <lambdalisue@hashnote.net>'
import copy
def autodiscover(module_name=None):
"""
Autodiscover INSTALLED_APPS perms.py modules and fail silently when not
present. This forces an import on them to register any permissions bits
they may want.
"""
from dj... | mit | Python |
b2f91bd5b0a9f06ddcdcff8f220756ad4a6286f7 | Fix stray webkitpy unit test after r157385. | smishenk/blink-crosswalk,jtg-gg/blink,nwjs/blink,crosswalk-project/blink-crosswalk-efl,jtg-gg/blink,Pluto-tv/blink-crosswalk,XiaosongWei/blink-crosswalk,kurli/blink-crosswalk,smishenk/blink-crosswalk,ondra-novak/blink,XiaosongWei/blink-crosswalk,kurli/blink-crosswalk,smishenk/blink-crosswalk,kurli/blink-crosswalk,Bysmy... | Tools/Scripts/webkitpy/common/net/buildbot/chromiumbuildbot_unittest.py | Tools/Scripts/webkitpy/common/net/buildbot/chromiumbuildbot_unittest.py | # Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | # Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | bsd-3-clause | Python |
da8a8c9b777792d99d8413f966ba5b7cdf6cf938 | Fix relative path join | openkamer/openkamer,openkamer/openkamer,openkamer/openkamer,openkamer/openkamer | create_local_settings.py | create_local_settings.py | #!/usr/bin/env python3
import codecs
import os
import random
import shutil
import string
import tempfile
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
LOCAL_SETTINGS_PATH = os.path.join(BASE_DIR, 'website/local_settings.py')
LOCAL_SETTINGS_EXAMPLE_PATH = os.path.join(BASE_DIR, 'website/local_settings_example... | #!/usr/bin/env python3
import codecs
import os
import random
import shutil
import string
import tempfile
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
LOCAL_SETTINGS_PATH = os.path.join(BASE_DIR, './website/local_settings.py')
LOCAL_SETTINGS_EXAMPLE_PATH = os.path.join(BASE_DIR, './website/local_settings_exa... | mit | Python |
abe311fb9de6a58c9b40b1079785473b5a72d12c | Update activate-devices.py | JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub | cron/activate-devices.py | cron/activate-devices.py | #!/usr/bin/env python
import MySQLdb
#import datetime
#import urllib2
#import os
import datetime
import RPi.GPIO as GPIO
try:
import RPi.GPIO as GPIO
except RuntimeError:
print("Error importing RPi.GPIO!")
servername = "localhost"
username = "pi"
password = "password"
dbname = "pi_heating_db"
cnx = MySQLdb.... | #!/usr/bin/env python
import MySQLdb
#import datetime
#import urllib2
#import os
import datetime
import RPi.GPIO as GPIO
try:
import RPi.GPIO as GPIO
except RuntimeError:
print("Error importing RPi.GPIO!")
servername = "localhost"
username = "pi"
password = "password"
dbname = "pi_heating_db"
cnx = MySQLdb.... | apache-2.0 | Python |
47e470f9c3cdf806fb7190b71447275a9f7a772e | test in base_test adjusted to tuples for parameters | aipescience/uws-client | uws/UWS/tests/test_base.py | uws/UWS/tests/test_base.py | # -*- coding: utf-8 -*-
import unittest
from uws import UWS
class BaseTest(unittest.TestCase):
def testValidateAndParseFilter(self):
filters = {
'phases': ['COMPLETED', 'PENDING']
}
params = UWS.base.BaseUWSClient(None)._validate_and_parse_filters(filters)
self.asser... | # -*- coding: utf-8 -*-
import unittest
from uws import UWS
class BaseTest(unittest.TestCase):
def testValidateAndParseFilter(self):
filters = {
'phases': ['COMPLETED', 'PENDING']
}
params = UWS.base.BaseUWSClient(None)._validate_and_parse_filters(filters)
self.asser... | apache-2.0 | Python |
85905353b23ba4d6bec8fbbd37546ae2849967d9 | Update puush.py | sgoo/puush-linux | src/puush.py | src/puush.py | import config
import time
import multipart
import StringIO
# from gi.repository import Gtk, Gdk
import gtk
import os
import pynotify
NO_INTERNET = False
SERVER = 'puush.me'
API_END_POINT = '/api/tb'
FORMAT = 'png'
NOTIFY_TIMEOUT = 10
def screenshot(x, y, w, h):
screenshot = gtk.gdk.Pixbuf.get_from_drawable(gtk.gdk... | import config
import time
import multipart
import StringIO
# from gi.repository import Gtk, Gdk
import gtk
import os
import pynotify
NO_INTERNET = False
SERVER = 'puush.me'
API_END_POINT = '/api/tb'
FORMAT = 'png'
NOTIFY_TIMEOUT = 10
def screenshot(x, y, w, h):
screenshot = gtk.gdk.Pixbuf.get_from_drawable(gtk.gdk... | mit | Python |
24217196f4516e198155b843d807d02b4911db6c | Include an external_version property in the coverity.hpi.VERSION file created by build.py | jenkinsci/coverity-plugin,jenkinsci/coverity-plugin,jenkinsci/coverity-plugin,jenkinsci/coverity-plugin | build.py | build.py | #/*******************************************************************************
# * Copyright (c) 2016 Synopsys, Inc
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available ... | #/*******************************************************************************
# * Copyright (c) 2016 Synopsys, Inc
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available ... | epl-1.0 | Python |
4c2c86f77c457611d40b39ba36637f70974977f0 | fix flake8 | Caleydo/pathfinder_graph,Caleydo/pathfinder_graph,Caleydo/pathfinder_graph | build.py | build.py | import shutil
from codecs import open
import json
__author__ = 'Samuel Gratzl'
def _git_head(cwd):
import subprocess
try:
output = subprocess.check_output(['git', 'rev-parse', '--verify', 'HEAD'], cwd=cwd)
return output.strip()
except subprocess.CalledProcessError:
return 'error'
def _resolve_plu... | import shutil
from codecs import open
import json
__author__ = 'Samuel Gratzl'
def _git_head(cwd):
import subprocess
try:
output = subprocess.check_output(['git', 'rev-parse', '--verify', 'HEAD'], cwd=cwd)
return output.strip()
except subprocess.CalledProcessError:
return 'error'
def _resolve_plu... | bsd-3-clause | Python |
4a2144ce2c01c5675a7389d5600af4d96462e6d7 | edit ... | ryanrhymes/scandex | cache.py | cache.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Cache abstraction.
#
# Liang Wang @ Computer Lab, Cambridge University
# 2015.06.15
import time
from config import conf, logger
class Cache():
def __init__(self):
"""Init the cache."""
self._root = conf['image_dir']
self._quota = conf['... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Cache abstraction.
#
# Liang Wang @ Computer Lab, Cambridge University
# 2015.06.15
import time
from config import conf, logger
class Cache():
def __init__(self):
"""Init the cache."""
self._root = conf['image_dir']
self._quota = conf['... | mit | Python |
97f53c98a2371d4d4d93b946868f3396a124a737 | bump 0.1.103 | theonion/djes | djes/__init__.py | djes/__init__.py | import djes.signals # noqa
__version__ = "0.1.103"
default_app_config = "djes.apps.DJESConfig"
| import djes.signals # noqa
__version__ = "0.1.102"
default_app_config = "djes.apps.DJESConfig"
| mit | Python |
f0e0ee6f4f8e34cf22213e827ba5993a1b3b91cb | Rename cli description | ekonstantinidis/pypiup | pypiup/cli.py | pypiup/cli.py | import os
import click
from pypiup.requirements import Requirements
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@click.command()
@click.option('--requirement', '-r', default='requirements.txt', type=click.STRING, help='Specify the path of the requirements file. Defaults to "requirements.t... | import os
import click
from pypiup.requirements import Requirements
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@click.command()
@click.option('--requirement', '-r', default='requirements.txt', type=click.STRING, help='Specify the path of the requirements file. Defaults to "requirements.t... | bsd-2-clause | Python |
56c760c9c38c0acf40435d52396dcde9222ab4c7 | fix all sections are below the threshold case | F-Tag/python-vad | pyvad/trim.py | pyvad/trim.py |
import numpy as np
from .vad import vad
def trim(data, fs, fs_vad=16000, hoplength=30, vad_mode=0, thr = 0.015):
""" Voice activity detection.
Trim leading and trailing silence from an audio signal by using vad.
Parameters
----------
data : ndarray
numpy array of mono (1 ch) speech data.
... |
import numpy as np
from .vad import vad
def trim(data, fs, fs_vad=16000, hoplength=30, vad_mode=0, thr = 0.015):
""" Voice activity detection.
Trim leading and trailing silence from an audio signal by using vad.
Parameters
----------
data : ndarray
numpy array of mono (1 ch) speech data.
... | mit | Python |
8747219974bce5efbe1976910ce4860ada919343 | set default lines to blank strings | pigletto/django-postal,mthornhill/django-postal,mthornhill/django-postal,pigletto/django-postal | src/postal/models.py | src/postal/models.py | """
Model of Postal Address, could possibly use some ideas from
http://www.djangosnippets.org/snippets/912/ in the future
"""
# django imports
from django.db import models
from django.utils.translation import ugettext_lazy as _
# other imports
from countries.models import Country
class PostalAddress(models.Model):
... | """
Model of Postal Address, could possibly use some ideas from
http://www.djangosnippets.org/snippets/912/ in the future
"""
# django imports
from django.db import models
from django.utils.translation import ugettext_lazy as _
# other imports
from countries.models import Country
class PostalAddress(models.Model):
... | mit | Python |
dcd4919958840c2629625d4c36ef25f0c8657e07 | Fix tenant deletion | opennode/nodeconductor-saltstack | src/nodeconductor_saltstack/exchange/handlers.py | src/nodeconductor_saltstack/exchange/handlers.py | from nodeconductor.quotas.models import Quota
def increase_exchange_storage_usage_on_tenant_creation(sender, instance=None, created=False, **kwargs):
if created:
add_quota = instance.service_project_link.add_quota_usage
add_quota(instance.service_project_link.Quotas.exchange_storage, instance.mail... | def increase_exchange_storage_usage_on_tenant_creation(sender, instance=None, created=False, **kwargs):
if created:
add_quota = instance.service_project_link.add_quota_usage
add_quota(instance.service_project_link.Quotas.exchange_storage, instance.mailbox_size * instance.max_users)
def decrease_ex... | mit | Python |
5c809c1b2607e00e49d472be54e14a672c62d022 | Fix python import | DarkAce65/rpi-led-matrix,DarkAce65/rpi-led-matrix | python/test.py | python/test.py | #!/usr/bin/env python
from rgbmatrix import RGBMatrix
from random import randint
import time
rows = 16
chains = 1
parallel = 1
ledMatrix = RGBMatrix(rows, chains, parallel)
height = ledMatrix.height
width = ledMatrix.width
for i in range(100):
ledMatrix.setPixel(randint(0, width), randint(0, height), randint(0, 255),... | #!/usr/bin/env python
from rgbmatrix import RGBMatrix
from random import randInt
import time
rows = 16
chains = 1
parallel = 1
ledMatrix = RGBMatrix(rows, chains, parallel)
height = ledMatrix.height
width = ledMatrix.width
for i in range(100):
ledMatrix.setPixel(randInt(0, width), randInt(0, height), randInt(0, 255),... | mit | Python |
b2c53260ae73b01b21452852b932e1febda66746 | Improve Bluetooth serial reliability. | pebble/libpebble2 | libpebble2/communication/transports/serial.py | libpebble2/communication/transports/serial.py | from __future__ import absolute_import
__author__ = 'katharine'
import errno
import serial
import struct
from . import BaseTransport, MessageTargetWatch
from libpebble2.exceptions import ConnectionError
class SerialTransport(BaseTransport):
"""
Represents a direct connection to a physical Pebble paired to t... | from __future__ import absolute_import
__author__ = 'katharine'
import serial
import struct
from . import BaseTransport, MessageTargetWatch
from libpebble2.exceptions import ConnectionError
class SerialTransport(BaseTransport):
"""
Represents a direct connection to a physical Pebble paired to the computer v... | mit | Python |
254ea51140c1c7ede701f4844bc8c297edabab84 | Add linked list class | derekmpham/interview-prep,derekmpham/interview-prep | linked-list/reverse-linked-list.py | linked-list/reverse-linked-list.py | # reverse singly linked list
class Node(object): # define constructor
def __init__(self, data):
self.data = data
self.next = None
class LinkedList(object):
def __init__(self, head=None):
self.head = head
| # reverse singly linked list
class Node(object): # define constructor
def __init__(self, data):
self.data = data
self.next = None
| mit | Python |
b52ff68324bef3883d8c6e176ccd646d65c62b46 | Add repo score calculation | RepoReapers/reaper,RepoReapers/reaper,RepoReapers/reaper,RepoReapers/reaper | score_repo.py | score_repo.py | #!/usr/bin/env python3
import argparse
import importlib
import json
import sys
def loadAttributePlugins(attributes):
for attribute in attributes:
try:
attribute['implementation'] = importlib.import_module("attributes.{0}.main".format(attribute['name']))
except ImportError:
print("Failed to load ... | #!/usr/bin/env python3
import argparse
import importlib
import json
import sys
def loadAttributePlugins(attributes):
for attribute in attributes:
try:
attribute['implementation'] = importlib.import_module("attributes.{0}.main".format(attribute['name']))
except ImportError:
print("Failed to load ... | apache-2.0 | Python |
4858af4e946919b80de6e67204f5a2925bc85800 | Fix backward compatible functions in scrapy.log | songfj/scrapy,agusc/scrapy,cleydson/scrapy,WilliamKinaan/scrapy,jdemaeyer/scrapy,zackslash/scrapy,GregoryVigoTorres/scrapy,Geeglee/scrapy,lacrazyboy/scrapy,foromer4/scrapy,olorz/scrapy,kimimj/scrapy,agreen/scrapy,codebhendi/scrapy,rootAvish/scrapy,umrashrf/scrapy,farhan0581/scrapy,dracony/scrapy,Bourneer/scrapy,nowopen... | scrapy/log.py | scrapy/log.py | """
This module is kept to provide a helpful warning about its removal.
"""
import logging
import warnings
from twisted.python.failure import Failure
from scrapy.exceptions import ScrapyDeprecationWarning
logger = logging.getLogger(__name__)
warnings.warn("Module `scrapy.log` has been deprecated, Scrapy now relies... | """
This module is kept to provide a helpful warning about its removal.
"""
import logging
import warnings
from twisted.python.failure import Failure
from scrapy.exceptions import ScrapyDeprecationWarning
logger = logging.getLogger(__name__)
warnings.warn("Module `scrapy.log` has been deprecated, Scrapy now relies... | bsd-3-clause | Python |
975b1f2cb1be68d542f1f03f126451d6f8d6929e | Optimise AbstractXmlWriter _escape performance .. seems to improve robot run time by 3-4% | fiuba08/robotframework,waldenner/robotframework,fiuba08/robotframework,fiuba08/robotframework,waldenner/robotframework,waldenner/robotframework,ldtri0209/robotframework,ldtri0209/robotframework,ldtri0209/robotframework,waldenner/robotframework,waldenner/robotframework,fiuba08/robotframework,ldtri0209/robotframework,fiu... | src/robot/utils/abstractxmlwriter.py | src/robot/utils/abstractxmlwriter.py | # Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# 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... | # Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# 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... | apache-2.0 | Python |
606f151e2909d16436d5f2480dccf7a61fd3428f | add first_name and last_name to profile | podhub-io/website | podhub/website/models.py | podhub/website/models.py | from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.func import now
import sqlalchemy
import uuid
from . import db
class Base(db.Model):
id = db.Column(UUID, default=lambda: str(uuid.uuid4()), primary_key=True)
created_at = db.Column(db.DateTime(), default=now())
updated_at = db.Column(
... | from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.func import now
import sqlalchemy
import uuid
from . import db
class Base(db.Model):
id = db.Column(UUID, default=lambda: str(uuid.uuid4()), primary_key=True)
created_at = db.Column(db.DateTime(), default=now())
updated_at = db.Column(
... | apache-2.0 | Python |
e0f9c113956078577e3dca420358a203c7f3ed95 | Remove the __main__ function in the script since its in the cli now | schae234/PonyTools | ponytools/cli/sortVCF.py | ponytools/cli/sortVCF.py | #!/usr/bin/env python3
import sys
import tempfile
from optparse import OptionParser
def log(message,*formatting):
print(message.format(*formatting),file=sys.stderr)
def sortVCF(args):
import sys,os
vcf_file = args.vcf
fasta_file = args.fasta
temp_dir="/tmp"
out = args.out
headers = list(... | #!/usr/bin/env python3
import sys
import tempfile
from optparse import OptionParser
def log(message,*formatting):
print(message.format(*formatting),file=sys.stderr)
def sortVCF(args):
import sys,os
vcf_file = args.vcf
fasta_file = args.fasta
temp_dir="/tmp"
out = args.out
headers = list(... | mit | Python |
b1b3504b561a9b4f45664b7c4a69e9604600817e | Fix migration | AltSchool/django-softdelete,AltSchool/django-softdelete | softdelete/migrations/0001_initial.py | softdelete/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Chan... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
]
operations = [
migrations.CreateModel(
... | bsd-2-clause | Python |
27c9da3129c6fbdd8d54276cf054c1f46e665aaf | Remove trailing slashes, add origin url to responses | talavis/kimenu | flask_app.py | flask_app.py | import flask
import flask_caching
import flask_cors
import main
import slack
app = flask.Flask(__name__)
cache = flask_caching.Cache(app, config={"CACHE_TYPE": "simple"})
cors = flask_cors.CORS(app, resources={r"/*": {"origins": "*"}})
app.register_blueprint(slack.blueprint, url_prefix="/api/slack")
@app.route("/a... | from flask import Flask, abort, jsonify
from flask_caching import Cache
from flask_cors import CORS
import main
import slack
app = Flask(__name__)
cache = Cache(app, config={"CACHE_TYPE": "simple"})
cors = CORS(app, resources={r"/*": {"origins": "*"}})
app.register_blueprint(slack.blueprint, url_prefix="/api/slack")... | bsd-3-clause | Python |
de1e7f254d76e3ac7b3d547b35541eea3d83b74a | define main() | yasokada/python-160423_footInput | footInput.py | footInput.py | #!/usr/bin/env python
'''
v0.2 2016 Apr 23
- define main()
- change interval to 10 msec base for UDP comm
v0.1 2016 Apr 23
- can check 5 GPIO input
'''
import RPi.GPIO as GPIO
import time
import os
def main():
GPIO.setmode(GPIO.BOARD)
ins = [40, 38, 36, 32, 26]
for idx in range(5):
GPIO.set... | #!/usr/bin/env python
'''
v0.2 2016 Apr 23
- change interval to 10 msec base for UDP comm
v0.1 2016 Apr 23
- can check 5 GPIO input
'''
import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BOARD)
ins = [40, 38, 36, 32, 26]
for idx in range(5):
GPIO.setup(ins[idx], GPIO.IN, pull_up_down=GPIO.PUD_UP... | mit | Python |
c04ef32ca687e8a941716c078788c45b55c42f7e | Add temporary functions for testing | gogetdata/ggd-cli,gogetdata/ggd-cli | ggd/utils.py | ggd/utils.py | from __future__ import print_function
import os
import sys
import glob
from git import Repo
LOCAL_REPO_DIR = os.getenv("GGD_LOCAL", os.path.expanduser("~/.config/"))
RECIPE_REPO_DIR = os.path.join(LOCAL_REPO_DIR, "ggd-recipes")
GITHUB_URL = "https://github.com/gogetdata/ggd-recipes.git"
def get_species():
update... | from __future__ import print_function
import os
import sys
import glob
from git import Repo
LOCAL_REPO_DIR = os.getenv("GGD_LOCAL", os.path.expanduser("~/.config/"))
RECIPE_REPO_DIR = os.path.join(LOCAL_REPO_DIR, "ggd-recipes")
GITHUB_URL = "https://github.com/gogetdata/ggd-recipes.git"
def get_species():
update... | mit | Python |
46e8002729b758639a0b1c1e9da59f380ca567db | Fix typo 'localtion' -> 'location' | elastic/elasticsearch-dsl-py | test_elasticsearch_dsl/test_integration/test_examples/test_parent_child.py | test_elasticsearch_dsl/test_integration/test_examples/test_parent_child.py | from datetime import datetime
from pytest import fixture
from elasticsearch_dsl import Q
from .parent_child import User, Question, Answer, setup, Comment
honza = User(id=42, signed_up=datetime(2013, 4, 3), username='honzakral',
email='honza@elastic.co', location='Prague')
nick = User(id=47, signed_up=d... | from datetime import datetime
from pytest import fixture
from elasticsearch_dsl import Q
from .parent_child import User, Question, Answer, setup, Comment
honza = User(id=42, signed_up=datetime(2013, 4, 3), username='honzakral',
email='honza@elastic.co', localtion='Prague')
nick = User(id=47, signed_up=... | apache-2.0 | Python |
20d8ecb26fc8c90ec6f55e7f074b5e474db283d9 | fix a missing fake logging method | alfredodeza/remoto,ceph/remoto | remoto/connection.py | remoto/connection.py | from .lib import execnet
#
# Connection Object
#
class Connection(object):
def __init__(self, hostname, logger=None, sudo=False):
self.hostname = hostname
self.gateway = execnet.makegateway('ssh=%s' % hostname)
self.logger = logger or FakeRemoteLogger()
self.sudo = sudo
def ... | from .lib import execnet
#
# Connection Object
#
class Connection(object):
def __init__(self, hostname, logger=None, sudo=False):
self.hostname = hostname
self.gateway = execnet.makegateway('ssh=%s' % hostname)
self.logger = logger or FakeRemoteLogger()
self.sudo = sudo
def ... | mit | Python |
09019094afcfc258194d70cbc115c35233a08d80 | Fix mailchimp feature flag | billyhunt/osf.io,hmoco/osf.io,chrisseto/osf.io,lyndsysimon/osf.io,KAsante95/osf.io,ZobairAlijan/osf.io,mfraezz/osf.io,samchrisinger/osf.io,cwisecarver/osf.io,icereval/osf.io,baylee-d/osf.io,emetsger/osf.io,adlius/osf.io,GageGaskins/osf.io,rdhyee/osf.io,Johnetordoff/osf.io,haoyuchen1992/osf.io,fabianvf/osf.io,samanehsan... | website/mailchimp_utils.py | website/mailchimp_utils.py | import mailchimp
from website import settings
from framework.tasks import app
from framework.auth.core import User
from framework.auth.signals import user_confirmed
def get_mailchimp_api():
if not settings.MAILCHIMP_API_KEY:
raise RuntimeError("An API key is required to connect to Mailchimp.")
return ... | import mailchimp
from website import settings
from framework.tasks import app
from framework.auth.core import User
from framework.auth.signals import user_confirmed
def get_mailchimp_api():
if not settings.MAILCHIMP_API_KEY:
raise RuntimeError("An API key is required to connect to Mailchimp.")
return ... | apache-2.0 | Python |
b7c831756825cfeffcb97387294435511ed9c811 | bump version to 1.0.0rc1 | sat-utils/sat-search | satsearch/version.py | satsearch/version.py | __version__ = '1.0.0rc1'
| __version__ = '1.0.0b12'
| mit | Python |
af363ab33a56031e7e0bbbb295c0987b1f6b076a | add warning to log.py | ceph/remoto,alfredodeza/remoto | remoto/log.py | remoto/log.py |
def reporting(conn, result, timeout=None):
timeout = timeout or conn.global_timeout # -1 a.k.a. wait for ever
log_map = {
'debug': conn.logger.debug,
'error': conn.logger.error,
'warning': conn.logger.warning
}
while True:
try:
received = result.receive(tim... |
def reporting(conn, result, timeout=None):
timeout = timeout or conn.global_timeout # -1 a.k.a. wait for ever
log_map = {'debug': conn.logger.debug, 'error': conn.logger.error}
while True:
try:
received = result.receive(timeout)
level_received, message = list(received.items... | mit | Python |
52c6cabc06c835ef3741ba873a5ff58fbedcfbc7 | remove override dep for app-on-ws-init | xenomachina/i3ipc-python,nicoe/i3ipc-python,acrisci/i3ipc-python,chrsclmn/i3ipc-python | examples/app-on-ws-init.py | examples/app-on-ws-init.py | #!/usr/bin/env python3
# https://faq.i3wm.org/question/3699/how-can-i-open-an-application-when-i-open-a-certain-workspace-for-the-first-time/
from argparse import ArgumentParser
from gi.repository import i3ipc, GLib
i3 = i3ipc.Connection()
parser = ArgumentParser(description='Open an application on a given workspac... | #!/usr/bin/env python3
# https://faq.i3wm.org/question/3699/how-can-i-open-an-application-when-i-open-a-certain-workspace-for-the-first-time/
from argparse import ArgumentParser
from gi.repository import i3ipc
i3 = i3ipc.Connection()
parser = ArgumentParser(description='Open an application on a given workspace when... | bsd-3-clause | Python |
5a293d02b5d6e3905dcd6659b1e2c96fa89d8ba8 | Create succ.py | BlueIsTrue/BlueIsTrue-Cogs | succ/succ.py | succ/succ.py | import discord
from discord.ext import commands
from random import choice as rndchoice
from .utils import checks
import os
class Succ:
"""Succ command."""
def __init__(self, bot):
self.bot = bot
@commands.group(pass_context=True, invoke_without_command=True)
async def givemethesucc(self, ctx... | import discord
from discord.ext import commands
from random import choice as rndchoice
from .utils.dataIO import fileIO
from .utils import checks
import os
class Succ:
"""Succ command."""
def __init__(self, bot):
self.bot = bot
@commands.group(pass_context=True, invoke_without_command=True)
... | mit | Python |
772e094ba31d1d64f22408724f712fcdccce3444 | Add developer secret key | Brok-Bucholtz/CloneTube,Brok-Bucholtz/CloneTube,Brok-Bucholtz/CloneTube | app/app.py | app/app.py | from flask import Flask
app = Flask('CloneTube')
app.secret_key = 'DEV_SECRET_KEY'
| from flask import Flask
app = Flask('CloneTube')
| mit | Python |
2af5600296a09a7d9d72b9089404eaca73cd34a7 | Fix line length. | tsanders-kalloop/django-mailer-2,SmileyChris/django-mailer-2,Giftovus/django-mailer-2,mfwarren/django-mailer-2,APSL/django-mailer-2,GreenLightGo/django-mailer-2,danfairs/django-mailer-2,pegler/django-mailer-2,APSL/django-mailer-2,maykinmedia/django-mailer-2,maykinmedia/django-mailer-2,tclancy/django-mailer-2,maykinmedi... | django_mailer/management/commands/send_mail.py | django_mailer/management/commands/send_mail.py | from django.conf import settings
from django.core.management.base import NoArgsCommand
from django_mailer.engine import send_all
from optparse import make_option
import logging
# Provide a way of temporarily pausing the sending of mail.
PAUSE_SEND = getattr(settings, "MAILER_PAUSE_SEND", False)
LOGGING_LEVEL = {'0': ... | from django.conf import settings
from django.core.management.base import NoArgsCommand
from django_mailer.engine import send_all
from optparse import make_option
import logging
# Provide a way of temporarily pausing the sending of mail.
PAUSE_SEND = getattr(settings, "MAILER_PAUSE_SEND", False)
LOGGING_LEVEL = {'0': ... | mit | Python |
3a2853007ad002687d4dda7066b2c50d82f3cc3c | Update 0002_auto_20180627_1121 migration | pydanny/dj-stripe,kavdev/dj-stripe,kavdev/dj-stripe,dj-stripe/dj-stripe,dj-stripe/dj-stripe,pydanny/dj-stripe | djstripe/migrations/0002_auto_20180627_1121.py | djstripe/migrations/0002_auto_20180627_1121.py | # Generated by Django 2.0.6 on 2018-06-27 08:21
from django.db import migrations
import djstripe.fields
class Migration(migrations.Migration):
dependencies = [
("djstripe", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="account",
name="busi... | # Generated by Django 2.0.6 on 2018-06-27 08:21
from django.db import migrations
import djstripe.fields
class Migration(migrations.Migration):
dependencies = [
("djstripe", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="account",
name="busi... | mit | Python |
6e16eaec078f18f0a098861afa4bd0bd94cb205f | Fix ROOT_URLCONF and remove WSGI_APP from settings | siggame/discuss | discuss/discuss/settings.py | discuss/discuss/settings.py | """
Django settings for discuss project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
import os
# Determine some important file locations
SETTINGS_DIR = os.pa... | """
Django settings for discuss project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
import os
# Determine some important file locations
SETTINGS_DIR = os.pa... | bsd-3-clause | Python |
e2f83a6a5d43ebc52d03d4059a7526a579a425c1 | Set User Profile Unicode Function | s1na/darkoob,s1na/darkoob,s1na/darkoob | darkoob/social/models.py | darkoob/social/models.py | from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
SEX_CHOICES = (
('Male', 'Male'),
('Female', 'Female'),
)
class UserProfile(models.Model):
user = models.OneToOneField(User)
sex = models.CharField(max_length = 6, choices = SEX_CHO... | from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
SEX_CHOICES = (
('Male', 'Male'),
('Female', 'Female'),
)
class UserProfile(models.Model):
user = models.OneToOneField(User)
sex = models.CharField(max_length = 6, choices = SEX_CHO... | mit | Python |
584f4fb7487e05cfa3bc4dd0c52c57cd17f08ac1 | Add @anonymous_required decorator to django-common | Tivix/django-common,Tivix/django-common,WikiRealtyInc/django-common,WikiRealtyInc/django-common,WikiRealtyInc/django-common,Tivix/django-common | django_common/decorators.py | django_common/decorators.py | try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps
import inspect
from django.conf import settings
from django.http import HttpResponseRedirect
def ssl_required(allow_non_ssl=False):
"""Views decorated with this will always get redirected to https except when ... | try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps
import inspect
from django.conf import settings
from django.http import HttpResponseRedirect
def ssl_required(allow_non_ssl=False):
"""Views decorated with this will always get redirected to https except when ... | mit | Python |
41a002c8f4854f3bcabf395b9e8747e7aa57d0a8 | fix allele delimiter splitting | ClinGen/ildb,ClinGen/ildb,ClinGen/ildb,ClinGen/ildb | beacon/src/api/import_controllers.py | beacon/src/api/import_controllers.py | """
@package api
Data import controllers
"""
from flask import Blueprint, jsonify, Flask, request, redirect, url_for
from werkzeug.utils import secure_filename
from api.database import DataAccess
from api import app
import vcf
import io
import re
import_controllers = Blueprint('import_controllers', __name__)
@import_... | """
@package api
Data import controllers
"""
from flask import Blueprint, jsonify, Flask, request, redirect, url_for
from werkzeug.utils import secure_filename
from api.database import DataAccess
from api import app
import vcf
import io
import_controllers = Blueprint('import_controllers', __name__)
@import_controller... | mit | Python |
d3e69e7512fbc24537fa37e4e3187ec042009128 | Add a GUID, description and published date to podcast RSS items | blancltd/blanc-basic-podcast | blanc_basic_podcast/podcast/feeds.py | blanc_basic_podcast/podcast/feeds.py | from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from django.contrib.sites.models import Site
from django.contrib.staticfiles.storage import staticfiles_storage
import mimetypes
from .itunesfeed import PodcastFeed
from .models import PodcastFile
class BasicPodcastFeed(PodcastFeed):
... | from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from django.contrib.sites.models import Site
from django.contrib.staticfiles.storage import staticfiles_storage
import mimetypes
from .itunesfeed import PodcastFeed
from .models import PodcastFile
class BasicPodcastFeed(PodcastFeed):
... | bsd-2-clause | Python |
8fd6127fe1597262039b483553b9c7d72fdad703 | Change name for content view test | kaka0525/Copy-n-Haste,kaka0525/Copy-n-Haste,tpeek/Copy-n-Haste,tpeek/Copy-n-Haste,tpeek/Copy-n-Haste,kaka0525/Copy-n-Haste | CopyHaste/typing_test/tests.py | CopyHaste/typing_test/tests.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase, Client
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.contrib.auth.models import User
from django.core import mail
from django.test.utils import override_settings... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase, Client
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.contrib.auth.models import User
from django.core import mail
from django.test.utils import override_settings... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.