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 |
|---|---|---|---|---|---|---|---|---|
c0d79ba0420f6e0176e98266a02c60b1f53f4a93 | apply same simplification to setfield | crccheck/dj-obj-update | obj_update.py | obj_update.py | from __future__ import unicode_literals
import logging
import sys
# for python 2/3 compatibility
text_type = unicode if sys.version_info[0] < 3 else str
logger = logging.getLogger('obj_update')
def setfield(obj, fieldname, value):
"""Fancy setattr with debugging."""
old = getattr(obj, fieldname)
old_r... | from __future__ import unicode_literals
import logging
import sys
# for python 2/3 compatibility
text_type = unicode if sys.version_info[0] < 3 else str
logger = logging.getLogger('obj_update')
def setfield(obj, fieldname, value):
"""Fancy setattr with debugging."""
old = getattr(obj, fieldname)
if ol... | apache-2.0 | Python |
c3587c23f6a5f34cf7bdc0a88b4057381f7752ac | add cascade delete table | maigfrga/flaskutils,maigfrga/flaskutils,Riffstation/flaskutils,maigfrga/flaskutils,Riffstation/flaskutils,Riffstation/flaskutils,maigfrga/flaskutils,Riffstation/flaskutils | flaskutils/test.py | flaskutils/test.py | from flaskutils import app
from .models import FlaskModel
from pgsqlutils.base import syncdb, Session
class ModelTestCase(object):
def setup(self):
"""
Use this test case when no interaction in a view is required
"""
syncdb()
def teardown(self):
Session.rollback()
... | from flaskutils import app
from .models import FlaskModel
from pgsqlutils.base import syncdb, Session
class ModelTestCase(object):
def setup(self):
"""
Use this test case when no interaction in a view is required
"""
syncdb()
def teardown(self):
Session.rollback()
... | apache-2.0 | Python |
e8f941aca9a111eb81c41e0be3a0c6591386083c | change way to get if celery should be used | nelsonmonteiro/django-flowjs | flowjs/settings.py | flowjs/settings.py | from django.conf import settings
# Media path where the files are saved
FLOWJS_PATH = getattr(settings, "FLOWJS_PATH", 'flowjs/')
# Remove the upload files when the model is deleted
FLOWJS_REMOVE_FILES_ON_DELETE = getattr(settings, "FLOWJS_REMOVE_FILES_ON_DELETE", True)
# Remove temporary chunks after file have been... | from django.conf import settings
# Media path where the files are saved
FLOWJS_PATH = getattr(settings, "FLOWJS_PATH", 'flowjs/')
# Remove the upload files when the model is deleted
FLOWJS_REMOVE_FILES_ON_DELETE = getattr(settings, "FLOWJS_REMOVE_FILES_ON_DELETE", True)
# Remove temporary chunks after file have been... | mit | Python |
c2798702a1f2b1dc40c10b481b9989f9a86c71b2 | Fix indentation error in some helpers | AliOsm/arabic-text-diacritization | helpers/fix_fathatan.py | helpers/fix_fathatan.py | # -*- coding: utf-8 -*-
import os
import re
import argparse
def fix_fathatan(file_path):
with open(file_path, 'r') as file:
lines = file.readlines()
new_lines = []
for line in lines:
new_lines.append(re.sub(r'اً', 'ًا', line))
file_path = file_path.split(os.sep)
file_path[-1] = 'fixed_' + file_pat... | # -*- coding: utf-8 -*-
import os
import re
import argparse
def fix_fathatan(file_path):
with open(file_path, 'r') as file:
lines = file.readlines()
new_lines = []
for line in lines:
new_lines.append(re.sub(r'اً', 'ًا', line))
file_path = file_path.split(os.sep)
file_path[-1] = 'fixed_' + file_pat... | mit | Python |
5398f356cab1e98673c253849a1de2bb76fc537a | move lapse archival to staging | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/util/autolapses2box.py | scripts/util/autolapses2box.py | """Send autolapse tar files to staging for archival.
Run from RUN_MIDNIGHT.sh for the previous date"""
import datetime
import subprocess
import os
import stat
import glob
from pyiem.util import logger
LOG = logger()
def main():
"""Run for the previous date, please"""
valid = datetime.date.today() - datetim... | """Send autolapse tar files to box for archival.
Run from RUN_MIDNIGHT.sh for the previous date"""
import datetime
import os
import stat
import glob
from pyiem.box_utils import sendfiles2box
def main():
"""Run for the previous date, please"""
valid = datetime.date.today() - datetime.timedelta(days=1)
no... | mit | Python |
97a490db75f0a4976199365c3f654ba8cdb9a781 | Test zip, and print format | zzz0072/Python_Exercises,zzz0072/Python_Exercises | 01_Built-in_Types/tuple.py | 01_Built-in_Types/tuple.py | #!/usr/bin/env python
import sys
import pickle
# Test zip, and format in print
names = ["xxx", "yyy", "zzz"]
ages = [18, 19, 20]
persons = zip(names, ages)
for name, age in persons:
print "{0}'s age is {1}".format(name, age)
# Check argument
if len(sys.argv) != 2:
print("%s filename" % sys.argv[0])
rai... | #!/usr/bin/env python
import sys
import pickle
# Check argument
if len(sys.argv) != 2:
print("%s filename" % sys.argv[0])
raise SystemExit(1)
# Write tuples
file = open(sys.argv[1], "wb");
line = []
while True:
print("Enter name, age, score (ex: zzz, 16, 90) or quit");
line = sys.stdin.readline()
... | bsd-2-clause | Python |
ba6ef8c9f0881e7236063d5372f64656df1b4bf0 | rename package from 'motion_control' to 'kinesis' | MSLNZ/msl-equipment | msl/equipment/resources/thorlabs/__init__.py | msl/equipment/resources/thorlabs/__init__.py | """
Wrappers around APIs from Thorlabs.
"""
from .kinesis.motion_control import MotionControl
from .kinesis.callbacks import MotionControlCallback
| """
Wrappers around APIs from Thorlabs.
"""
from .motion_control.motion_control import MotionControl
from .motion_control.callbacks import MotionControlCallback
| mit | Python |
a68f9e0e7f9d99e0052c6c01395dbb131c052797 | remove k4 | childe/esproxy,childe/esproxy | esproxy/views.py | esproxy/views.py | import os
from django.http import HttpResponse, HttpResponseRedirect
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from django.shortcuts import render_to_response
from settings import ELASTICSEARCH_PROXY, ELASTIC... | from django.http import HttpResponse, HttpResponseRedirect
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from django.shortcuts import render_to_response
from settings import ELASTICSEARCH_PROXY, ELASTICSEARCH_REA... | mit | Python |
8cd2332871bd246352f23f286ae459c2cf399a35 | allow classifier parameter to be configurable | GoogleCloudPlatform/cloudml-samples,GoogleCloudPlatform/cloudml-samples | sklearn/sklearn-template/template/trainer/model.py | sklearn/sklearn-template/template/trainer/model.py | # Copyright 2019 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | # Copyright 2019 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 | Python |
ad8ff0e8d280a8a0b3876382b63a1be4ad0784e5 | increment version | shacknetisp/fourthevaz,shacknetisp/fourthevaz,shacknetisp/fourthevaz | version.py | version.py | # -*- coding: utf-8 -*-
import platform
name = "Fourth Evaz"
version = (0, 1, 10)
source = "https://github.com/shacknetisp/fourthevaz"
def gitstr():
try:
return "%s" % (open('.git/refs/heads/master').read().strip()[0:10])
except FileNotFoundError:
return ""
except IndexError:
retur... | # -*- coding: utf-8 -*-
import platform
name = "Fourth Evaz"
version = (0, 1, 9)
source = "https://github.com/shacknetisp/fourthevaz"
def gitstr():
try:
return "%s" % (open('.git/refs/heads/master').read().strip()[0:10])
except FileNotFoundError:
return ""
except IndexError:
return... | mit | Python |
185f174b6c1d50ad51987765f42e078a6081e5d3 | Remove semi-colon | kranthikumar/exercises-in-programming-style,crista/exercises-in-programming-style,crista/exercises-in-programming-style,kranthikumar/exercises-in-programming-style,crista/exercises-in-programming-style,crista/exercises-in-programming-style,kranthikumar/exercises-in-programming-style,kranthikumar/exercises-in-programmin... | 06-pipeline/tf-06.py | 06-pipeline/tf-06.py | #!/usr/bin/env python
import sys, re, operator, string
#
# The functions
#
def read_file(path_to_file):
"""
Takes a path to a file and returns the entire
contents of the file as a string
"""
with open(path_to_file) as f:
data = f.read()
return data
def filter_chars_and_normalize(str_da... | #!/usr/bin/env python
import sys, re, operator, string
#
# The functions
#
def read_file(path_to_file):
"""
Takes a path to a file and returns the entire
contents of the file as a string
"""
with open(path_to_file) as f:
data = f.read()
return data
def filter_chars_and_normalize(str_da... | mit | Python |
e5963987e678926ad8cdde93e2551d0516a7686b | Increase timeout for bench_pictures on Android | Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Ti... | slave/skia_slave_scripts/android_bench_pictures.py | slave/skia_slave_scripts/android_bench_pictures.py | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Run the Skia bench_pictures executable. """
from android_render_pictures import AndroidRenderPictures
from android_run_bench i... | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Run the Skia bench_pictures executable. """
from android_render_pictures import AndroidRenderPictures
from android_run_bench i... | bsd-3-clause | Python |
d4e890a16fcb155c6df78d378b3ba9429590c74b | fix test | marco-hoyer/cfn-sphere,cfn-sphere/cfn-sphere,ImmobilienScout24/cfn-sphere,cfn-sphere/cfn-sphere,cfn-sphere/cfn-sphere | src/unittest/python/aws/kms_tests.py | src/unittest/python/aws/kms_tests.py | import base64
import unittest2
from boto.kms.exceptions import InvalidCiphertextException
from cfn_sphere.aws.kms import KMS
from mock import patch
from cfn_sphere.exceptions import InvalidEncryptedValueException
class KMSTests(unittest2.TestCase):
@patch('cfn_sphere.aws.kms.kms.connect_to_region')
def test_... | import unittest2
from boto.kms.exceptions import InvalidCiphertextException
from cfn_sphere.aws.kms import KMS
from mock import patch
from cfn_sphere.exceptions import InvalidEncryptedValueException
class KMSTests(unittest2.TestCase):
@patch('cfn_sphere.aws.kms.kms.connect_to_region')
def test_decrypt_value(s... | apache-2.0 | Python |
8425a06fb270e18b7aa7b137cb99b43ce39a4b53 | Fix bitrotted function call | henn/hil,meng-sun/hil,henn/hil,henn/haas,SahilTikale/haas,kylehogan/haas,CCI-MOC/haas,kylehogan/hil,meng-sun/hil,henn/hil_sahil,kylehogan/hil,henn/hil_sahil | haas.wsgi | haas.wsgi | #!/usr/bin/env python
import haas.api
from haas import config, model, server
config.load('/etc/haas.cfg')
config.configure_logging()
config.load_extensions()
server.init()
from haas.rest import wsgi_handler as application
| #!/usr/bin/env python
import haas.api
from haas import config, model, server
config.load('/etc/haas.cfg')
config.configure_logging()
config.load_extensions()
server.api_server_init()
from haas.rest import wsgi_handler as application
| apache-2.0 | Python |
b219823af7188f968d7c52c5273148c510bd7454 | Simplify the ckernel pass a bit more | ChinaQuants/blaze,jdmcbr/blaze,xlhtc007/blaze,aterrel/blaze,FrancescAlted/blaze,mrocklin/blaze,maxalbert/blaze,alexmojaki/blaze,dwillmer/blaze,cowlicks/blaze,LiaoPan/blaze,jcrist/blaze,maxalbert/blaze,mrocklin/blaze,cowlicks/blaze,ChinaQuants/blaze,aterrel/blaze,scls19fr/blaze,mwiebe/blaze,FrancescAlted/blaze,nkhuyu/bl... | blaze/compute/air/frontend/ckernel_impls.py | blaze/compute/air/frontend/ckernel_impls.py | """
Convert 'kernel' Op to 'ckernel'.
"""
from __future__ import absolute_import, division, print_function
from pykit.ir import transform, Op
def run(func, env):
strategies = env['strategies']
transform(CKernelImplementations(strategies), func)
class CKernelImplementations(object):
"""
For kernels... | """
Lift ckernels to their appropriate rank so they always consume the full array
arguments.
"""
from __future__ import absolute_import, division, print_function
import datashape
from pykit.ir import transform, Op
#------------------------------------------------------------------------
# Run
#----------------------... | bsd-3-clause | Python |
60dd476337ead3262daaa17ee4a973937cac380d | Add help for sites argument to manage.py scan | DNSUsher/securethenews,freedomofpress/securethenews,freedomofpress/securethenews,DNSUsher/securethenews,freedomofpress/securethenews,freedomofpress/securethenews,DNSUsher/securethenews | securethenews/sites/management/commands/scan.py | securethenews/sites/management/commands/scan.py | import json
import subprocess
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from sites.models import Site, Scan
def pshtt(domain):
pshtt_cmd = ['pshtt', '--json', domain]
p = subprocess.Popen(
pshtt_cmd,
stdout=subprocess.PIPE,
s... | import json
import subprocess
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from sites.models import Site, Scan
def pshtt(domain):
pshtt_cmd = ['pshtt', '--json', domain]
p = subprocess.Popen(
pshtt_cmd,
stdout=subprocess.PIPE,
s... | agpl-3.0 | Python |
53c6e1f1d0939b4c585301427920e0cf1dd9e341 | Remove tabs. | ibus/ibus,ueno/ibus,luoxsbupt/ibus,fujiwarat/ibus,luoxsbupt/ibus,phuang/ibus,fujiwarat/ibus,ueno/ibus,phuang/ibus,ibus/ibus,luoxsbupt/ibus,ibus/ibus-cros,Keruspe/ibus,Keruspe/ibus,j717273419/ibus,fujiwarat/ibus,ibus/ibus-cros,ibus/ibus-cros,phuang/ibus,fujiwarat/ibus,luoxsbupt/ibus,Keruspe/ibus,luoxsbupt/ibus,j71727341... | panel/main.py | panel/main.py | import ibus
import gtk
import dbus
import dbus.mainloop.glib
import panel
class PanelApplication:
def __init__ (self):
self._dbusconn = dbus.connection.Connection (ibus.IBUS_ADDR)
self._dbusconn.add_signal_receiver (self._disconnected_cb,
"Disconnected",
dbus_interface = dbus.LOCAL_IFACE)
self._p... | import ibus
import gtk
import dbus
import dbus.mainloop.glib
import panel
class PanelApplication:
def __init__ (self):
self._dbusconn = dbus.connection.Connection (ibus.IBUS_ADDR)
self._dbusconn.add_signal_receiver (self._disconnected_cb,
"Disconnected",
dbus_interface = dbus.LOCAL_IFACE)
self._p... | lgpl-2.1 | Python |
6bdc16e24e51d16b0fa214d30394317079bc90a9 | Throw more user-friendly execption inside get_backend_instance method. | nzlosh/st2,peak6/st2,Plexxi/st2,peak6/st2,Plexxi/st2,peak6/st2,Plexxi/st2,tonybaloney/st2,nzlosh/st2,Plexxi/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2,StackStorm/st2,nzlosh/st2,tonybaloney/st2,tonybaloney/st2,StackStorm/st2 | st2auth/st2auth/backends/__init__.py | st2auth/st2auth/backends/__init__.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python |
212a9a901625605000210ec8c436c8f6e9be7c39 | correct the log filename and handler | xgfone/pycom,xgfone/xutils | xutils/log.py | xutils/log.py | # -*- coding: utf-8 -*-
import os
import os.path
import logging
from logging.handlers import RotatingFileHandler
def init(logger=None, level="INFO", file=None, handler_cls=None, process=False,
max_count=30, propagate=True, file_config=None, dict_config=None):
root = logging.getLogger()
if not logge... | # -*- coding: utf-8 -*-
import os
import os.path
import logging
from logging.handlers import RotatingFileHandler
def init(logger=None, level="INFO", file=None, handler_cls=None, process=False,
max_count=30, propagate=True, file_config=None, dict_config=None):
root = logging.getLogger()
if not logge... | mit | Python |
0e60c23ce6e40304437218151e895dcaf856f832 | Update project version | skioo/django-customer-billing,skioo/django-customer-billing | billing/__init__.py | billing/__init__.py | __version__ = '1.7'
__copyright__ = 'Copyright (c) 2020, Skioo SA'
__licence__ = 'MIT'
__URL__ = 'https://github.com/skioo/django-customer-billing'
| __version__ = '1.6'
__copyright__ = 'Copyright (c) 2020, Skioo SA'
__licence__ = 'MIT'
__URL__ = 'https://github.com/skioo/django-customer-billing'
| mit | Python |
22fef4c07a28a96267e1d3f0390bc366790252a0 | Use alias for nodejs_tool. | wt/bazel_rules_nodejs | nodejs/def.bzl | nodejs/def.bzl | _js_filetype = FileType([".js"])
SCRIPT_TEMPLATE = """\
#!/bin/bash
"{node_bin}" "{script_path}"
"""
def nodejs_binary_impl(ctx):
ctx.file_action(
ctx.outputs.executable,
SCRIPT_TEMPLATE.format(node_bin=ctx.file._nodejs_tool.short_path,
script_path=ctx.file.main_scri... | _js_filetype = FileType([".js"])
SCRIPT_TEMPLATE = """\
#!/bin/bash
"{node_bin}" "{script_path}"
"""
def nodejs_binary_impl(ctx):
ctx.file_action(
ctx.outputs.executable,
SCRIPT_TEMPLATE.format(node_bin=ctx.file._nodejs_tool.short_path,
script_path=ctx.file.main_scri... | apache-2.0 | Python |
e8540104547878e9f8360ba07ca0cbf1ee63e6ca | update Nottingham import script | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_nottingham.py | polling_stations/apps/data_collection/management/commands/import_nottingham.py | from data_collection.github_importer import BaseGitHubImporter
class Command(BaseGitHubImporter):
srid = 4326
districts_srid = 4326
council_id = "E06000018"
elections = []
scraper_name = "wdiv-scrapers/DC-PollingStations-Nottingham"
geom_type = "geojson"
def district_record_to_dict(self,... | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "E06000018"
addresses_name = "parl.2017-06-08/Version 1/Democracy_Club__08June2017 8.tsv"
stations_name = "parl.2017-06-08/Version 1/Democracy_Club__08June2017... | bsd-3-clause | Python |
6647025f3cb44818d0ff403160df35aa827516c7 | refactor env var load | zanaca/docker-dns,zanaca/docker-dns | src/config.py | src/config.py | import os
import sys
import socket
import platform
import util
import json
import re
APP = os.path.basename(sys.argv[0])
USER = os.environ.get('SUDO_USER', 'USER')
HOME = os.path.expanduser(f"~{USER}")
HOME_ROOT = os.path.expanduser("~root")
BASE_PATH = os.path.dirname(os.path.dirname(__file__))
HOSTNAME = socket.get... | import os
import sys
import socket
import platform
import util
import json
import re
APP = os.path.basename(sys.argv[0])
USER = os.environ.get('SUDO_USER')
if not USER:
USER = os.environ.get('USER')
HOME = os.path.expanduser(f"~{USER}")
HOME_ROOT = os.path.expanduser("~root")
BASE_PATH = os.path.dirname(os.path.... | mit | Python |
24110636fd6eaae8962478c9f3e56c9da469be81 | bump version to 0.9.0 | njsmith/zs,njsmith/zs | zs/version.py | zs/version.py | # This file is part of ZS
# Copyright (C) 2013-2014 Nathaniel Smith <njs@pobox.com>
# See file LICENSE.txt for license information.
# This file must be kept very simple, because it is consumed from several
# places -- it is imported by zs/__init__.py, execfile'd by setup.py, etc.
# We use a simple scheme:
# 1.0.0 -... | # This file is part of ZS
# Copyright (C) 2013-2014 Nathaniel Smith <njs@pobox.com>
# See file LICENSE.txt for license information.
# This file must be kept very simple, because it is consumed from several
# places -- it is imported by zs/__init__.py, execfile'd by setup.py, etc.
# We use a simple scheme:
# 1.0.0 -... | bsd-2-clause | Python |
970978b5355259fe943d5efed1b8b4ce945fdfa7 | Debug control flow and exit on errors | robbystk/weather | weather.py | weather.py | #! /usr/bin/python2
from os.path import expanduser,isfile
import sys
from urllib import urlopen
location_path="~/.location"
def location_from_homedir():
if isfile(expanduser(location_path)):
with open(expanduser(location_path)) as f:
return "&".join(f.read().split("\n"))
else:
pri... | #! /usr/bin/python2
from os.path import expanduser,isfile
from sys import argv
from urllib import urlopen
location_path="~/.location"
def location_from_homedir():
if isfile(expanduser(location_path)):
with open(expanduser(location_path)) as f:
return "&".join(f.read().split("\n"))
else:
... | mit | Python |
6e024501b76beaccc2daa46f045f4e3444aa146b | update python client library example | alerta/python-alerta-client,alerta/python-alerta,alerta/python-alerta-client | examples/send.py | examples/send.py | #!/usr/bin/env python
from alerta.api import ApiClient
from alerta.alert import Alert
api = ApiClient(endpoint='http://localhost:8080', key='tUA6oBX6E5hUUQZ+dyze6vZbOMmiZWA7ke88Nvio')
alert = Alert(
resource='web-server-01',
event='HttpError',
group='Web',
environment='Production',
service='thegu... | #!/usr/bin/env python
from alerta.client import Alert, ApiClient
client = ApiClient()
alert = Alert(resource='res1', event='event1')
print alert
print client.send(alert)
| apache-2.0 | Python |
00d006d280960228f249480e7af990cf7df39b59 | remove useless function | miLibris/flask-rest-jsonapi | jsonapi_utils/alchemy.py | jsonapi_utils/alchemy.py | # -*- coding: utf-8 -*-
from sqlalchemy.sql.expression import desc, asc, text
from jsonapi_utils.constants import DEFAULT_PAGE_SIZE
def paginate_query(query, pagination_kwargs):
"""Paginate query result according to jsonapi rfc
:param sqlalchemy.orm.query.Query query: sqlalchemy queryset
:param dict pa... | # -*- coding: utf-8 -*-
from sqlalchemy.sql.expression import desc, asc, text
from jsonapi_utils.constants import DEFAULT_PAGE_SIZE
def paginate_query(query, pagination_kwargs):
"""Paginate query result according to jsonapi rfc
:param sqlalchemy.orm.query.Query query: sqlalchemy queryset
:param dict pa... | mit | Python |
1f31ed22627cb1cf5b4323a18435bd9fb7fc7462 | add trailing slash | cwilkes/crispy-barnacle,cwilkes/crispy-barnacle,cwilkes/crispy-barnacle | web/url.py | web/url.py | from flask import Flask, render_template, jsonify, redirect, url_for
from web.clasher import Clasher
import os
xml_file = 'https://s3.amazonaws.com/navishack/PC-00-COMP-BBC.xml.gz'
clash_data = None
app = Flask(__name__)
app.debug = 'DEBUG' in os.environ
@app.route('/')
def index():
return redirect('/clash/')
... | from flask import Flask, render_template, jsonify, redirect, url_for
from web.clasher import Clasher
import os
xml_file = 'https://s3.amazonaws.com/navishack/PC-00-COMP-BBC.xml.gz'
clash_data = None
app = Flask(__name__)
app.debug = 'DEBUG' in os.environ
@app.route('/')
def index():
return redirect('/clash/')
... | mit | Python |
3dd84fc4dc6cff921329286485e287c13ebebdec | Update version.py | mir-dataset-loaders/mirdata | mirdata/version.py | mirdata/version.py | #!/usr/bin/env python
"""Version info"""
short_version = "0.3"
version = "0.3.4b1"
| #!/usr/bin/env python
"""Version info"""
short_version = "0.3"
version = "0.3.4b0"
| bsd-3-clause | Python |
32b287b9d22b22262d291fb7e352a3502fe2e68f | Fix Docker test to wait fixed time (#5858) | lolski/grakn,graknlabs/grakn,graknlabs/grakn,graknlabs/grakn,lolski/grakn,lolski/grakn,lolski/grakn,graknlabs/grakn | test/assembly/docker.py | test/assembly/docker.py | #!/usr/bin/env python
import os
import socket
import subprocess as sp
import sys
import time
print('Building the image...')
sp.check_call(['bazel', 'run', '//:assemble-docker'])
print('Starting the image...')
sp.check_call(['docker', 'run', '-v', '{}:/grakn-core-all-linux/logs/'.format(os.getcwd()), '--name', 'grakn... | #!/usr/bin/env python
import os
import socket
import subprocess as sp
import sys
import time
def wait_for_port(port, host='localhost', timeout=30.0):
start_time = time.time()
while True:
try:
socket.create_connection((host, port), timeout=timeout)
return
except OSError... | agpl-3.0 | Python |
d8a27a94d90e5611b24c26c331a0016bbbb87af0 | update debug set default to false | gobuild-old/gobuild3,gobuild-old/gobuild3,gobuild/gobuild3,gobuild-old/gobuild3,gobuild/gobuild3,gobuild-old/gobuild3,gobuild/gobuild3,gobuild-old/gobuild3,gobuild/gobuild3,gobuild/gobuild3 | web/web.py | web/web.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# web
#
import os
import flask
import models
app = flask.Flask(__name__)
app.secret_key = 'some_secret'
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # max 16M
#app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
def register_routers():
from routers import home
a... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# web
#
import os
import flask
import models
app = flask.Flask(__name__)
app.secret_key = 'some_secret'
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # max 16M
#app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
def register_routers():
from routers import home
a... | mit | Python |
aea0d98fd7fb5eaa0fd547b5442af6984f8d78e0 | fix bugs | Charleo85/SIS-Rebuild,Charleo85/SIS-Rebuild,Charleo85/SIS-Rebuild,Charleo85/SIS-Rebuild | exp/exp/tests.py | exp/exp/tests.py | from django.test import TestCase, RequestFactory
import json
from . import views_model, views_auth
class SearchTestCase(TestCase):
def setUp(self):
self.factory = RequestFactory()
def test_general_search(self):
post_data = {
'search_query': 'tp3ks',
'query_specifier':... | from django.test import TestCase, RequestFactory
import json
from . import views_model, views_auth
class SearchTestCase(TestCase):
def setUp(self):
self.factory = RequestFactory()
def test_general_search(self):
post_data = {
'search_query': 'tp3ks',
'query_specifier':... | bsd-3-clause | Python |
ebfac180c04d24ea8ff93583eac52e6c0bc8d553 | Add contract test for 'v2' email notification | alphagov/notifications-api,alphagov/notifications-api | tests/app/public_contracts/test_GET_notification.py | tests/app/public_contracts/test_GET_notification.py | from . import return_json_from_response, validate_v0, validate
from app.models import ApiKey, KEY_TYPE_NORMAL
from app.dao.api_key_dao import save_model_api_key
from app.v2.notifications.notification_schemas import get_notification_response
from tests import create_authorization_header
def _get_notification(client, n... | from . import return_json_from_response, validate_v0, validate
from app.models import ApiKey, KEY_TYPE_NORMAL
from app.dao.api_key_dao import save_model_api_key
from app.v2.notifications.notification_schemas import get_notification_response
from tests import create_authorization_header
def _get_notification(client, n... | mit | Python |
fc6ad89460dca9e1e5b1a4effe14c868cafc0e54 | add looping around math | mlyons-tcc/test | test.py | test.py | __author__ = 'mike.lyons'
print "Hello World!"
while True:
x = raw_input("Enter any number: ")
y = raw_input("Enter another number: ")
try:
x = float(x)
y = float(y)
except ValueError:
x = 0.0
y = 0.0
print x+y
print x/2
print y**2
user_exit = raw_inp... | __author__ = 'mike.lyons'
print "Hello World!"
x = raw_input("Enter any number: ")
y = raw_input("Enter another number: ")
try:
x = float(x)
y = float(y)
except ValueError:
x = 0.0
y = 0.0
print x+y
print x/2
print y**2
| apache-2.0 | Python |
91a3a94466736ef6996befa73549e309fb9251f8 | Remove unused import | enstrategic/django-sql-explorer,tzangms/django-sql-explorer,enstrategic/django-sql-explorer,groveco/django-sql-explorer,grantmcconnaughey/django-sql-explorer,epantry/django-sql-explorer,enstrategic/django-sql-explorer,groveco/django-sql-explorer,dsanders11/django-sql-explorer,enstrategic/django-sql-explorer,epantry/dja... | explorer/urls.py | explorer/urls.py | from django.conf.urls import url
from explorer.views import (
QueryView,
CreateQueryView,
PlayQueryView,
DeleteQueryView,
ListQueryView,
ListQueryLogView,
download_query,
view_csv_query,
email_csv_query,
download_csv_from_sql,
schema,
format_sql,
)
urlpatterns = [
ur... | from django.conf.urls import patterns, url
from explorer.views import (
QueryView,
CreateQueryView,
PlayQueryView,
DeleteQueryView,
ListQueryView,
ListQueryLogView,
download_query,
view_csv_query,
email_csv_query,
download_csv_from_sql,
schema,
format_sql,
)
urlpatterns ... | mit | Python |
3b4dd9a59de9a37a4167f64fec2f3896479f56c9 | Simplify option formatting. | ohsu-qin/qipipe | qipipe/registration/ants/similarity_metrics.py | qipipe/registration/ants/similarity_metrics.py | class SimilarityMetric(object):
_FMT = "{name}[{fixed}, {moving}, {opts}]"
def __init__(self, name, *opts):
self.name = name
self.opts = opts
def format(self, fixed, moving, weight=1):
"""
Formats the ANTS similiarity metric argument.
:param reference: the fixed re... | class SimilarityMetric(object):
_FMT = "{name}[{fixed}, {moving}, {opts}]"
def __init__(self, name, *opts):
self.name = name
self.opts = opts
def format(self, fixed, moving, weight=1):
"""
Formats the ANTS similiarity metric argument.
:param reference: the fixed re... | bsd-2-clause | Python |
bc6bacf6bd5fccf2e09dd3c07f6104e1f845351b | Revert "Added solution to assignment 4" | infoscout/python-bootcamp-pv | bootcamp/lesson4.py | bootcamp/lesson4.py | import datetime
import math
import requests
from core import test_helper
# Question 1
# ----------
# Using the datetime module return a datetime object with the year of 2015, the month of June, and the day of 1
def playing_with_dt():
# Write code here
pass
# Question 2
# ----------
# Using the math module... | import datetime
import math
import requests
from core import test_helper
# Question 1
# ----------
# Using the datetime module return a datetime object with the year of 2015, the month of June, and the day of 1
def playing_with_dt():
return datetime.datetime(year=2015, month=06, day=01)
# Question 2
# -------... | mit | Python |
864d551ca7aaf661ecfe54cca8c69e0f9daf1c46 | fix license | laike9m/ezcf,hzruandd/ezcf,laike9m/ezcf,hzruandd/ezcf | ezcf/__init__.py | ezcf/__init__.py | __author__ = "laike9m (laike9m@gmail.com)"
__title__ = 'ezcf'
__version__ = '0.0.1'
__license__ = 'MIT'
__copyright__ = 'Copyright 2015 laike9m'
import sys
from .api import ConfigFinder
sys.meta_path.append(ConfigFinder()) | __author__ = "laike9m (laike9m@gmail.com)"
__title__ = 'ezcf'
__version__ = '0.0.1'
# __build__ = None
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2015 laike9m'
import sys
from .api import ConfigFinder
sys.meta_path.append(ConfigFinder()) | mit | Python |
ae8e98a4e609bee0e73175bdc50859dd0bed62cb | Fix lint errors. | mozilla/normandy,mozilla/normandy,mozilla/normandy,mozilla/normandy | recipe-server/normandy/base/api/serializers.py | recipe-server/normandy/base/api/serializers.py | from django.contrib.auth.models import User
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
id = serializers.IntegerField()
first_name = serializers.CharField()
last_name = serializers.CharField()
email = serializers.CharField()
class Meta:
model... | from django.contrib.auth.models import User
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
id = serializers.IntegerField()
first_name = serializers.CharField()
last_name = serializers.CharField()
email = serializers.CharField()
class Meta:
model... | mpl-2.0 | Python |
53db7465c8bb5f7ea0a9647b69555df36ade4191 | Use a trigger and lambda instead of schedule for the delay stage. | matham/moa | moa/stage/delay.py | moa/stage/delay.py |
__all__ = ('Delay', )
import random
import time
from kivy.clock import Clock
from kivy.properties import (OptionProperty, BoundedNumericProperty,
ReferenceListProperty)
from moa.stage import MoaStage
class Delay(MoaStage):
_delay_step_trigger = None
def __init__(self, **kwargs):
super(Delay, ... |
__all__ = ('Delay', )
import random
import time
from kivy.clock import Clock
from kivy.properties import (OptionProperty, BoundedNumericProperty,
ReferenceListProperty)
from moa.stage import MoaStage
class Delay(MoaStage):
def pause(self, *largs, **kwargs):
if super(Delay, self).pause(*largs, **kw... | mit | Python |
bdacc7646c087d8fd87feb20c6af1d23d5cb1feb | clean up track/models | nikolas/edx-platform,Stanford-Online/edx-platform,polimediaupv/edx-platform,appliedx/edx-platform,zubair-arbi/edx-platform,iivic/BoiseStateX,Endika/edx-platform,Livit/Livit.Learn.EdX,chand3040/cloud_that,antoviaque/edx-platform,nanolearning/edx-platform,UXE/local-edx,alexthered/kienhoc-platform,carsongee/edx-platform,z... | common/djangoapps/track/models.py | common/djangoapps/track/models.py | from django.db import models
class TrackingLog(models.Model):
"""Defines the fields that are stored in the tracking log database"""
dtcreated = models.DateTimeField('creation date', auto_now_add=True)
username = models.CharField(max_length=32, blank=True)
ip = models.CharField(max_length=32, blank=Tru... | from django.db import models
from django.db import models
class TrackingLog(models.Model):
dtcreated = models.DateTimeField('creation date', auto_now_add=True)
username = models.CharField(max_length=32, blank=True)
ip = models.CharField(max_length=32, blank=True)
event_source = models.CharField(max_l... | agpl-3.0 | Python |
ed6b086f785c4856ef73484ffc2082a0fba200b8 | Update accessible classes | oscar6echo/ezhc,oscar6echo/ezhc,oscar6echo/ezhc | ezhc/__init__.py | ezhc/__init__.py |
from ._config import load_js_libs
from ._highcharts import Highcharts
from ._highstock import Highstock
from ._global_options import GlobalOptions
from ._theme import Theme
from . import sample
from . import build
from ._clock import Clock
__all__ = ['Highcharts',
'Highstock',
'GlobalOptions... |
from ._config import load_js_libs
from ._highcharts import Highcharts
from ._highstock import Highstock
from . import sample
from . import build
from ._clock import Clock
__all__ = ['Highcharts',
'Highstock',
'sample',
'build',
'Clock',
]
load_js_libs()
| mit | Python |
dec3d29f8482cb71f5ea3337622460a38b4f9124 | Set the default to production | chouseknecht/galaxy,chouseknecht/galaxy,chouseknecht/galaxy,chouseknecht/galaxy | galaxy/__init__.py | galaxy/__init__.py | # (c) 2012-2016, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
... | # (c) 2012-2016, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
... | apache-2.0 | Python |
a7f2a211edad68ed2042266eae05bc3153904580 | adjust simulation_exp3.py | ntucllab/striatum | simulation/simulation_exp3.py | simulation/simulation_exp3.py | from striatum.storage import history
from striatum.storage import model
from striatum.bandit import exp3
import simulation as sm
import numpy as np
import matplotlib.pyplot as plt
def main():
times = 1000
d = 5
actions = [1, 2, 3, 4, 5]
# Parameter tunning
tunning_region = np.arange(0.001, 1, 0.0... | from striatum.storage import history
from striatum.storage import model
from striatum.bandit import exp3
import simulation as sm
import numpy as np
import matplotlib.pyplot as plt
def main():
times = 1000
d = 5
actions = [1, 2, 3, 4, 5]
# Parameter tunning
tunning_region = np.arange(0.001, 1, 0.0... | bsd-2-clause | Python |
20d41f31e40a8d20902fcfea4543fa9c2c4d8cae | add dummy import function, so modulefinder can find our tables. | googlefonts/fonttools,fonttools/fonttools | Lib/fontTools/ttLib/tables/__init__.py | Lib/fontTools/ttLib/tables/__init__.py | def _moduleFinderHint():
import B_A_S_E_
import C_F_F_
import D_S_I_G_
import DefaultTable
import G_D_E_F_
import G_P_O_S_
import G_S_U_B_
import J_S_T_F_
import L_T_S_H_
import O_S_2f_2
import T_S_I_B_
import T_S_I_D_
import T_S_I_J_
import T_S_I_P_
import T_S_I_S_
import T_S_I_V_
import T_S_I__0
imp... | """Empty __init__.py file to signal Python this directory is a package.
(It can't be completely empty since WinZip seems to skip empty files.)
"""
| mit | Python |
c24979627a8a2282a297704b735b1445b56dbce6 | Bump version. [skip ci] | mindflayer/python-mocket,mocketize/python-mocket | mocket/__init__.py | mocket/__init__.py | try:
# Py2
from mocket import mocketize, Mocket, MocketEntry, Mocketizer
except ImportError:
# Py3
from mocket.mocket import mocketize, Mocket, MocketEntry, Mocketizer
__all__ = (mocketize, Mocket, MocketEntry, Mocketizer)
__version__ = '2.7.2'
| try:
# Py2
from mocket import mocketize, Mocket, MocketEntry, Mocketizer
except ImportError:
# Py3
from mocket.mocket import mocketize, Mocket, MocketEntry, Mocketizer
__all__ = (mocketize, Mocket, MocketEntry, Mocketizer)
__version__ = '2.7.1'
| bsd-3-clause | Python |
3e96eaeb9bb722d24fe4e589c49e52d32e8af1aa | Bump version. | mocketize/python-mocket,mindflayer/python-mocket | mocket/__init__.py | mocket/__init__.py | try:
# Py2
from mocket import mocketize, Mocket, MocketEntry, Mocketizer
except ImportError:
# Py3
from mocket.mocket import mocketize, Mocket, MocketEntry, Mocketizer
__all__ = (mocketize, Mocket, MocketEntry, Mocketizer)
__version__ = '3.7.1'
| try:
# Py2
from mocket import mocketize, Mocket, MocketEntry, Mocketizer
except ImportError:
# Py3
from mocket.mocket import mocketize, Mocket, MocketEntry, Mocketizer
__all__ = (mocketize, Mocket, MocketEntry, Mocketizer)
__version__ = '3.7.0'
| bsd-3-clause | Python |
812c40bfaf2ef4f59643c53e8b8ac76f20777423 | Modify a debian example to archlinux | ronnix/fabtools,ahnjungho/fabtools,bitmonk/fabtools,davidcaste/fabtools,AMOSoft/fabtools,hagai26/fabtools,pombredanne/fabtools,fabtools/fabtools,prologic/fabtools,sociateru/fabtools,n0n0x/fabtools-python,wagigi/fabtools-python,badele/fabtools | fabtools/arch.py | fabtools/arch.py | """
Archlinux packages
==================
This module provides tools to manage Archlinux packages
and repositories.
"""
from __future__ import with_statement
from fabric.api import hide, run, settings
from fabtools.utils import run_as_root
MANAGER = 'LC_ALL=C pacman'
def update_index(quiet=True):
"""
Up... | """
Archlinux packages
==================
This module provides tools to manage Archlinux packages
and repositories.
"""
from __future__ import with_statement
from fabric.api import hide, run, settings
from fabtools.utils import run_as_root
MANAGER = 'LC_ALL=C pacman'
def update_index(quiet=True):
"""
Up... | bsd-2-clause | Python |
c9aff74371f176daa011514a05875f59c86a33c6 | Refactor CLI argument parsing. | bsuweb/checker | checker/main.py | checker/main.py | #!/usr/bin/env python
import os
import sys
import subprocess
import argparse
class Checker:
def __init__(self, path):
if not os.path.isdir(path):
sys.exit(1);
self.path = os.path.realpath(path)
self.jobs = self.getExecutableFiles(self.path)
def getExecutableFiles(self,pat... | #!/usr/bin/env python
import os
import sys
import subprocess
import getopt
class Checker:
def __init__(self, path):
if not os.path.isdir(path):
sys.exit(1);
self.path = os.path.realpath(path)
self.jobs = self.getExecutableFiles(self.path)
def getExecutableFiles(self,path)... | mit | Python |
3c231fb34f8adb1d290f2cfc0164dbea6049bc34 | Reorder methods in test.py | ConsenSys/ethjsonrpc | test.py | test.py | from ethjsonrpc import EthJsonRpc
methods = [
'web3_clientVersion',
'net_version',
'net_peerCount',
'net_listening',
'eth_protocolVersion',
'eth_coinbase',
'eth_mining',
'eth_hashrate',
'eth_gasPrice',
'eth_accounts',
'eth_blockNumber',
'eth_getCompilers',
'eth_newPe... | from ethjsonrpc import EthJsonRpc
methods = [
'web3_clientVersion',
'net_version',
'net_listening',
'net_peerCount',
'eth_protocolVersion',
'eth_coinbase',
'eth_mining',
'eth_hashrate',
'eth_gasPrice',
'eth_accounts',
'eth_blockNumber',
'eth_getCompilers',
'eth_newPe... | unlicense | Python |
7a1ad4ae0e3ec15c1fd5aec763476e482ea76ba8 | Make a better version of shuffle | stephantul/somber | somber/components/utilities.py | somber/components/utilities.py | """Utility functions."""
import numpy as np
class Scaler(object):
"""
Scales data based on the mean and standard deviation.
Attributes
----------
mean : numpy array
The columnwise mean of the data after scaling.
std : numpy array
The columnwise standard deviation of the data a... | """Utility functions."""
import numpy as np
class Scaler(object):
"""
Scales data based on the mean and standard deviation.
Attributes
----------
mean : numpy array
The columnwise mean of the data after scaling.
std : numpy array
The columnwise standard deviation of the data a... | mit | Python |
00b57b668a5c68a209dac335915bbf2312df0580 | Make sure tests run on local package | scott-maddox/openbandparams | test.py | test.py | #
# Copyright (c) 2013-2014, Scott J Maddox
#
# This file is part of openbandparams.
#
# openbandparams 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
# ... | #
# Copyright (c) 2013-2014, Scott J Maddox
#
# This file is part of openbandparams.
#
# openbandparams 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
# ... | agpl-3.0 | Python |
a122193144185320f045367613650b40f7df00b8 | Rework the test script a bit. | djc/jasinja,djc/jasinja | test.py | test.py | import codegen, jinja2, spidermonkey, sys
import simplejson as json
TESTS = [
('{{ test }}', {'test': 'crap'}),
('{% if a %}x{% endif %}', {'a': True}),
('{% if a %}c{% endif %}b', {'a': False}),
('{{ 1 if a else 2 }}', {'a': True}),
('{{ 1 if a else 2 }}', {'a': False}),
('{% if a %}d{% else %}e{% endif %}', {'... | import codegen, jinja2, spidermonkey, sys
import simplejson as json
def jstest(env, src, data):
run = spidermonkey.Runtime()
ctx = run.new_context()
js = codegen.generate(env, codegen.compile(env, src))
jsobj = json.dumps(data)
code = js + '\ntemplate.render(%s);' % jsobj
return ctx.execute(code)
def pytest(env... | bsd-3-clause | Python |
6d425b617a28b2eb35d53f35f5136148aa1f2ef6 | Add relative import for the parser | buddly27/champollion | source/champollion/__init__.py | source/champollion/__init__.py | # :coding: utf-8
import os
from ._version import __version__
from .directive.data import AutoDataDirective
from .directive.function import AutoFunctionDirective
from .directive.class_ import AutoClassDirective
from .directive.method import AutoMethodDirective
from .directive.attribute import AutoAttributeDirective
... | # :coding: utf-8
import os
from ._version import __version__
from .directive.data import AutoDataDirective
from .directive.function import AutoFunctionDirective
from .directive.class_ import AutoClassDirective
from .directive.method import AutoMethodDirective
from .directive.attribute import AutoAttributeDirective
... | apache-2.0 | Python |
1caace2631f8e9c38cf0adfb1179a5260dcd3c33 | Change output_all_unitprot to allow multi ids for some proteins. | cmunk/protwis,fosfataza/protwis,fosfataza/protwis,fosfataza/protwis,cmunk/protwis,protwis/protwis,cmunk/protwis,cmunk/protwis,fosfataza/protwis,protwis/protwis,protwis/protwis | tools/management/commands/output_all_uniprot.py | tools/management/commands/output_all_uniprot.py | from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
from django.conf import settings
from django.db import connection
from django.db.models import Q
from django.template.loader import render_to_string
from protein.models import Protein
from residue.models im... | from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
from django.conf import settings
from django.db import connection
from django.db.models import Q
from django.template.loader import render_to_string
from protein.models import Protein
from residue.models im... | apache-2.0 | Python |
1b06091101c119f30eb5eabb2d2638fab0e8f658 | Test modified to work with renamed debug function | petrgabrlik/BullsAndCows | test_debug.py | test_debug.py | from bullsandcows import isdebug
def test_isdebug():
assert isdebug() == 0, "program is in debug mode, this should not be commited"
| from bullsandcows import isdebugmode
def test_isdebugmode():
assert isdebugmode() == 0, "program is in debug mode, this should not be commited"
| mit | Python |
f1c47f99255bc6ff2dc7819d72ceafbecaa328a4 | Fix comment formatting | bechtoldt/imapclient,bechtoldt/imapclient | imapclient/test/util.py | imapclient/test/util.py | # Copyright (c) 2014, Menno Smits
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
from __future__ import unicode_literals
def find_unittest2():
import unittest
if hasattr(unittest, 'skip') and hasattr(unittest, 'loader'):
return unittest # unittest f... | # Copyright (c) 2014, Menno Smits
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
from __future__ import unicode_literals
def find_unittest2():
import unittest
if hasattr(unittest, 'skip') and hasattr(unittest, 'loader'):
return unittest # unittest f... | bsd-3-clause | Python |
96261b3c277cb2f694fb5cc2f7cbe29847ff1a53 | change the receiver | elixirhub/events-portal-scraping-scripts | SyncEmailNotification.py | SyncEmailNotification.py | __author__ = 'chuqiao'
import smtplib
import base64
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
def viewlog(file):
file = open("syncsolr.log")
file.seek(0,2)# Go to the end of the file
while True:
line = file.readline()
if "***Finished synchronizi... | __author__ = 'chuqiao'
import smtplib
import base64
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
def viewlog(file):
file = open("syncsolr.log")
file.seek(0,2)# Go to the end of the file
while True:
line = file.readline()
if "***Finished synchronizi... | mit | Python |
474dfd3aa9d03ed6bbda47078523badcc7909664 | Reorganize and refactor | jnfrye/local_plants_book | scripts/observations/scrape/CalFloraScraper.py | scripts/observations/scrape/CalFloraScraper.py | from selenium import webdriver
import pandas as pd
import argparse
import PyFloraBook.web.communication as scraping
import PyFloraBook.input_output.data_coordinator as dc
# ---------------- GLOBALS ----------------
SITE_NAME = "CalFlora"
# ---------------- INPUT ----------------
# Parse arguments
PARSER = argparse... | from selenium import webdriver
import pandas as pd
import argparse
import PyFloraBook.web.communication as scraping
import PyFloraBook.input_output.data_coordinator as dc
# ---------------- INPUT ----------------
# Parse arguments
parser = argparse.ArgumentParser(
description='Scrape CalFlora for species counts... | mit | Python |
1305af162dd05591cc0e5328eb192843b63dabb1 | Use DefaultRouter instead of SimpleRouter | City-of-Helsinki/kerrokantasi,vikoivun/kerrokantasi,stephawe/kerrokantasi,stephawe/kerrokantasi,stephawe/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,vikoivun/kerrokantasi,City-of-Helsinki/kerrokantasi,vikoivun/kerrokantasi | kk/urls_v1.py | kk/urls_v1.py | from django.conf.urls import include, url
from kk.views import (
HearingCommentViewSet, HearingImageViewSet, HearingViewSet, SectionCommentViewSet,
SectionViewSet, UserDataViewSet
)
from rest_framework_nested import routers
router = routers.DefaultRouter()
router.register(r'hearing', HearingViewSet)
router.reg... | from django.conf.urls import include, url
from kk.views import (
HearingCommentViewSet, HearingImageViewSet, HearingViewSet, SectionCommentViewSet,
SectionViewSet, UserDataViewSet
)
from rest_framework_nested import routers
router = routers.SimpleRouter()
router.register(r'hearing', HearingViewSet)
router.regi... | mit | Python |
a0dcb73836222e3515c4af4cf4cfe2d41f470b9e | handle missing stash[benchstorage] (#3564) | cloudify-cosmo/cloudify-manager,cloudify-cosmo/cloudify-manager,cloudify-cosmo/cloudify-manager | tests/integration_tests/tests/benchmarks/conftest.py | tests/integration_tests/tests/benchmarks/conftest.py | import pytest
from datetime import datetime
def log_result(name, timing, start, stop):
if timing:
name = f'{name}.{timing}'
print(f'BENCH {name}: {stop - start}')
class _Timings(object):
def __init__(self, func_name):
self.records = {}
self._func_name = func_name
def start(s... | import pytest
from datetime import datetime
def log_result(name, timing, start, stop):
if timing:
name = f'{name}.{timing}'
print(f'BENCH {name}: {stop - start}')
class _Timings(object):
def __init__(self, func_name):
self.records = {}
self._func_name = func_name
def start(s... | apache-2.0 | Python |
57adb8240cf0015e1e10f2e9fd4f090a8d896a27 | Revert "[examples...bindings_generator] began to update" | pymor/dune-pymor,pymor/dune-pymor | examples/stationarylinear_bindings_generator.py | examples/stationarylinear_bindings_generator.py | #! /usr/bin/env python
# This file is part of the dune-pymor project:
# https://github.com/pymor/dune-pymor
# Copyright Holders: Felix Albrecht, Stephan Rave
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
import sys
from pybindgen import param, retval
from dune.pymor.core import prepa... | #! /usr/bin/env python
# This file is part of the dune-pymor project:
# https://github.com/pymor/dune-pymor
# Copyright Holders: Felix Albrecht, Stephan Rave
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
import sys
from pybindgen import param, retval
from dune.pymor.core import prepa... | bsd-2-clause | Python |
e6cef6d96a3c2bd6dd07f580f4a704734133d316 | Bump version to 0.3c2 | OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server | lava_server/__init__.py | lava_server/__init__.py | # Copyright (C) 2010, 2011 Linaro Limited
#
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
#
# This file is part of LAVA Server.
#
# LAVA Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License version 3
# as published by the Free Software F... | # Copyright (C) 2010, 2011 Linaro Limited
#
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
#
# This file is part of LAVA Server.
#
# LAVA Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License version 3
# as published by the Free Software F... | agpl-3.0 | Python |
cf194c1c3a64c4547049c16fb901a2b33dc84ddf | Add verbose output | xii/xii,xii/xii | src/xii/output.py | src/xii/output.py | import os
from threading import Lock
from abc import ABCMeta, abstractmethod
# synchronize output from multiple threads
output_lock = Lock()
class colors:
TAG = '\033[0m'
NORMAL = '\033[37m'
CLEAR = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
WARN = '\033[91m'
SUCCESS = '\033[34m'
... | import os
from threading import Lock
from abc import ABCMeta, abstractmethod
# synchronize output from multiple threads
output_lock = Lock()
class colors:
TAG = '\033[0m'
NORMAL = '\033[37m'
CLEAR = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
WARN = '\033[91m'
SUCCESS = '\033[34m'
... | apache-2.0 | Python |
b3b99ed11d6c86721e9e57441111e0c88461eb70 | Fix example state relation | jrleeman/rsfmodel | examples/defining_new_state_relation.py | examples/defining_new_state_relation.py | import numpy as np
import matplotlib.pyplot as plt
from math import log
from rsfmodel import rsf
# This is really just the Ruina realtion, but let's pretend we invented it!
# We'll inherit attributes from rsf.StateRelation, but you wouldn't have to.
# It does provide velocity contribution calculation for us though!
... | import numpy as np
import matplotlib.pyplot as plt
from math import log
from rsfmodel import rsf
# This is really just the Ruina realtion, but let's pretend we invented it!
# We'll inherit attributes from rsf.StateRelation, but you wouldn't have to.
# It does provide velocity contribution calculation for us though!
... | mit | Python |
abd3daed5cd0c70d76bf8fa1cfdda93efcda3e70 | Make the `now` helper timezone aware | funkybob/knights-templater,funkybob/knights-templater | knights/compat/django.py | knights/compat/django.py |
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.utils.encoding import iri_to_uri
import datetime
from knights.library import Library
register = Library()
@register.helper
def now(fmt):
return timezone.now().strftime(fmt)
@register.helper
def url(name, *args, **kwar... |
from django.core.urlresolvers import reverse
from django.utils.encoding import iri_to_uri
import datetime
from knights.library import Library
register = Library()
@register.helper
def now(fmt):
return datetime.datetime.now().strftime(fmt)
@register.helper
def url(name, *args, **kwargs):
try:
ret... | mit | Python |
cbe4f5470fec966538f63ca9beb04838bfbf3aa3 | change to contentnode_1 and contentnode_2 for content relationship | jayoshih/kolibri,learningequality/kolibri,jamalex/kolibri,66eli77/kolibri,rtibbles/kolibri,aronasorman/kolibri,jayoshih/kolibri,mrpau/kolibri,benjaoming/kolibri,jamalex/kolibri,rtibbles/kolibri,christianmemije/kolibri,DXCanas/kolibri,whitzhu/kolibri,DXCanas/kolibri,learningequality/kolibri,jayoshih/kolibri,lyw07/kolibr... | kolibri/content/admin.py | kolibri/content/admin.py | from django.contrib import admin
from .models import PrerequisiteContentRelationship, RelatedContentRelationship
class PrerequisiteRelationshipInline1(admin.TabularInline):
model = PrerequisiteContentRelationship
fk_name = 'contentnode_1'
max = 20
extra = 0
class PrerequisiteRelationshipInline2(admi... | from django.contrib import admin
from .models import PrerequisiteContentRelationship, RelatedContentRelationship
class PrerequisiteRelationshipInline1(admin.TabularInline):
model = PrerequisiteContentRelationship
fk_name = 'contentmetadata_1'
max = 20
extra = 0
class PrerequisiteRelationshipInline2(... | mit | Python |
d43657286f49271a6236499bdba288925fb23087 | update tests to v1.2.0 (#1307) | jmluy/xpython,exercism/python,exercism/xpython,smalley/python,smalley/python,exercism/python,N-Parsons/exercism-python,behrtam/xpython,jmluy/xpython,exercism/xpython,behrtam/xpython,N-Parsons/exercism-python | exercises/roman-numerals/roman_numerals_test.py | exercises/roman-numerals/roman_numerals_test.py | import unittest
import roman_numerals
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.2.0
class RomanTest(unittest.TestCase):
numerals = {
1: 'I',
2: 'II',
3: 'III',
4: 'IV',
5: 'V',
6: 'VI',
9: 'IX',
27: 'XXVII',
48... | import unittest
import roman_numerals
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0
class RomanTest(unittest.TestCase):
numerals = {
1: 'I',
2: 'II',
3: 'III',
4: 'IV',
5: 'V',
6: 'VI',
9: 'IX',
27: 'XXVII',
48... | mit | Python |
34b2385d6a3bb7acdbcd3f894d30dfbc734bd52e | allow to set matplotlib backend from env MATPLOTLIB_BACKEND | has2k1/plotnine,has2k1/plotnine | ggplot/__init__.py | ggplot/__init__.py | # For testing purposes we might need to set mpl backend before any
# other import of matplotlib.
def _set_mpl_backend():
import os
import matplotlib as mpl
env_backend = os.environ.get('MATPLOTLIB_BACKEND')
if env_backend:
# we were instructed
mpl.use(env_backend)
_set_mpl_backend()
f... | from .ggplot import *
from .exampledata import *
| mit | Python |
4e9a530403dce47f322df471255a0fc40fd1071f | Change number of episodes to 60000 | davidrobles/mlnd-capstone-code | examples/tic_ql_tabular_selfplay_all.py | examples/tic_ql_tabular_selfplay_all.py | '''
The Q-learning algorithm is used to learn the state-action values for all
Tic-Tac-Toe positions by playing games against itself (self-play).
'''
from capstone.game.games import TicTacToe
from capstone.game.players import RandPlayer
from capstone.rl import Environment, GameMDP
from capstone.rl.learners import QLearn... | '''
The Q-learning algorithm is used to learn the state-action values for all
Tic-Tac-Toe positions by playing games against itself (self-play).
'''
from capstone.game.games import TicTacToe
from capstone.game.players import RandPlayer
from capstone.rl import Environment, GameMDP
from capstone.rl.learners import QLearn... | mit | Python |
f694b2a234216ae7ecc7b925799f43caca5e9a32 | add more debug output for config file | fretboardfreak/escadrille,fretboardfreak/escadrille,fretboardfreak/escadrille | preprocess.py | preprocess.py | #!/usr/bin/env python3
# Copyright 2016 Curtis Sand <curtissand@gmail.com>
#
# 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 requir... | #!/usr/bin/env python3
# Copyright 2016 Curtis Sand <curtissand@gmail.com>
#
# 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 requir... | apache-2.0 | Python |
292fd33a3d251b4c5773e96989e45d8e3d7c6c3b | Change tasks in settingfs | vtemian/kruncher | krunchr/settings/base.py | krunchr/settings/base.py | from socket import gethostname
HOSTNAME = gethostname()
HOSTNAME_SHORT = HOSTNAME.split('.')[0]
APPLICATION_ROOT = '/v1/krunchr'
DEBUG = True
RETHINKDB_HOST = 'batman.krunchr.net'
RETHINKDB_PORT = 28019
RETHINKDB_AUTH = ''
RETHINKDB_DB = 'krunchr'
BROKER_URL = 'redis://localhost:6379'
CELERY_RESULT_BACKEND = 'redi... | from socket import gethostname
HOSTNAME = gethostname()
HOSTNAME_SHORT = HOSTNAME.split('.')[0]
APPLICATION_ROOT = '/v1/krunchr'
DEBUG = True
RETHINKDB_HOST = 'batman.krunchr.net'
RETHINKDB_PORT = 28019
RETHINKDB_AUTH = ''
RETHINKDB_DB = 'krunchr'
BROKER_URL = 'redis://localhost:6379'
CELERY_RESULT_BACKEND = 'redi... | apache-2.0 | Python |
2d391f9e6183f06c0785cbb2c57b7a4fcf703a80 | Bump version to 0.1a14 | letuananh/chirptext,letuananh/chirptext | chirptext/__version__.py | chirptext/__version__.py | # -*- coding: utf-8 -*-
# chirptext's package version information
__author__ = "Le Tuan Anh"
__email__ = "tuananh.ke@gmail.com"
__copyright__ = "Copyright (c) 2012, Le Tuan Anh"
__credits__ = []
__license__ = "MIT License"
__description__ = "ChirpText is a collection of text processing tools for Python."
__url__ = "ht... | # -*- coding: utf-8 -*-
# chirptext's package version information
__author__ = "Le Tuan Anh"
__email__ = "tuananh.ke@gmail.com"
__copyright__ = "Copyright (c) 2012, Le Tuan Anh"
__credits__ = []
__license__ = "MIT License"
__description__ = "ChirpText is a collection of text processing tools for Python."
__url__ = "ht... | mit | Python |
6436a8adf4088f59c704a7d49e5f61c30d665058 | return true in ping cli | longaccess/longaccess-client,longaccess/longaccess-client,longaccess/longaccess-client | lacli/server/__init__.py | lacli/server/__init__.py | from lacli.decorators import command
from lacli.command import LaBaseCommand
from twisted.python.log import startLogging, msg
from twisted.internet import reactor
from thrift.transport import TTwisted
from thrift.protocol import TBinaryProtocol
from lacli.server.interface.ClientInterface import CLI
import sys
import z... | from lacli.decorators import command
from lacli.command import LaBaseCommand
from twisted.python.log import startLogging, msg
from twisted.internet import reactor
from thrift.transport import TTwisted
from thrift.protocol import TBinaryProtocol
from lacli.server.interface.ClientInterface import CLI
import sys
import z... | apache-2.0 | Python |
af40e69bca873a7d0060aaf3391fb8feb91bf673 | Use correct format for custom payload keys | ebmdatalab/openprescribing,ebmdatalab/openprescribing,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing | openprescribing/frontend/signals/handlers.py | openprescribing/frontend/signals/handlers.py | import logging
from allauth.account.signals import user_logged_in
from anymail.signals import tracking
from requests_futures.sessions import FuturesSession
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.conf import settings
... | import logging
from allauth.account.signals import user_logged_in
from anymail.signals import tracking
from requests_futures.sessions import FuturesSession
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.conf import settings
... | mit | Python |
52a6ea1e7dd4333b9db6a0bbd53b8ae0b39a1f6d | Add __doc__ to module functions | AndersonMasese/Myshop,AndersonMasese/Myshop,AndersonMasese/Myshop | Designs/redundant.py | Designs/redundant.py | '''Due to the needs arising from completing the project on time, I have defined redundant.py
which will hold replacement modules as I migrate from file based application to lists only web application. This modules
so far will offer the capabilities of registration, creating a shopping list and adding items into
a shopp... | '''Due to the needs arising from completing the project on time, I have defined redundant.py
which will hold replacement modules as I migrate from file based application to lists only web application. This modules
so far will offer the capabilities of registration, creating a shopping list and adding items into
a shopp... | mit | Python |
111cdf1496074e25b764e042fa0ab1b7b0e2a2b7 | Add agriculture import to calendar registry | rsheftel/pandas_market_calendars,rsheftel/pandas_market_calendars | pandas_market_calendars/calendar_registry.py | pandas_market_calendars/calendar_registry.py | from .market_calendar import MarketCalendar
from .exchange_calendar_asx import ASXExchangeCalendar
from .exchange_calendar_bmf import BMFExchangeCalendar
from .exchange_calendar_cfe import CFEExchangeCalendar
from .exchange_calendar_cme import CMEExchangeCalendar
from .exchange_calendar_cme_agriculture import CMEAgricu... | from .market_calendar import MarketCalendar
from .exchange_calendar_asx import ASXExchangeCalendar
from .exchange_calendar_bmf import BMFExchangeCalendar
from .exchange_calendar_cfe import CFEExchangeCalendar
from .exchange_calendar_cme import CMEExchangeCalendar
from .exchange_calendar_eurex import EUREXExchangeCalend... | mit | Python |
1534c3c47fea71db2cf4f9f224c2e5ff5a8632e2 | Remove audio file after playing, not while | milkey-mouse/swood | tests/test.py | tests/test.py | from time import sleep
import sys
import os
sys.path.insert(0, os.path.realpath("../../swood"))
import swood
def find_program(prog):
for path in os.environ["PATH"].split(os.pathsep):
vlc_location = os.path.join(path.strip('"'), prog)
if os.path.isfile(fpath):
return vlc_location, args
... | from time import sleep
import sys
import os
sys.path.insert(0, os.path.realpath("../../swood"))
import swood
def find_program(prog):
for path in os.environ["PATH"].split(os.pathsep):
vlc_location = os.path.join(path.strip('"'), prog)
if os.path.isfile(fpath):
return vlc_location, args
... | mit | Python |
f2350b4be2e88f282e7a49cafebb7e8e7c37efd9 | Bump version | TyVik/YaDiskClient | YaDiskClient/__init__.py | YaDiskClient/__init__.py | """
Client for Yandex.Disk.
"""
__version__ = '1.0.1'
| """
Client for Yandex.Disk.
"""
__version__ = '0.5.1'
| mit | Python |
9a1a346999b77ef7485913c79d7d854c779ecd0d | add version 2.10.0 (#15205) | iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-h5py/package.py | var/spack/repos/builtin/packages/py-h5py/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyH5py(PythonPackage):
"""The h5py package provides both a high- and low-level interface t... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyH5py(PythonPackage):
"""The h5py package provides both a high- and low-level interface t... | lgpl-2.1 | Python |
6a7611c4c2a41d5bf316697df92636b2b43e9125 | add version 2.1.2 to r-gsodr (#21035) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-gsodr/package.py | var/spack/repos/builtin/packages/r-gsodr/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RGsodr(RPackage):
"""A Global Surface Summary of the Day (GSOD) Weather Data Client for R
... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RGsodr(RPackage):
"""A Global Surface Summary of the Day (GSOD) Weather Data Client for R"... | lgpl-2.1 | Python |
22428bcdbb095b407a0845c35e06c8ace0653a44 | Use MEDIA_URL instead of a hardcoded path | fiam/blangoblog,fiam/blangoblog,fiam/blangoblog | urls.py | urls.py | from django.conf.urls.defaults import *
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/(.*)', admin.site.root),
(r'^', include('blangoblog.blango.urls')),
)
handler500 = 'blango.views.server_error'
handler404 = 'blango.views.page_not... | from django.conf.urls.defaults import *
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/(.*)', admin.site.root),
(r'^', include('blangoblog.blango.urls')),
)
handler500 = 'blango.views.server_error'
handler404 = 'blango.views.page_not... | bsd-3-clause | Python |
b30391c105e8aaa6533cbd043772983aad14a04a | remove bigbrother from urls | SpreadBand/SpreadBand,SpreadBand/SpreadBand | urls.py | urls.py | from django.conf.urls.defaults import patterns, url, include
from django.contrib.gis import admin
import settings
admin.autodiscover()
# Sitemaps
import venue.sitemaps
import band.sitemaps
import event.sitemaps
sitemaps = {}
sitemaps.update(venue.sitemaps.sitemaps)
sitemaps.update(band.sitemaps.sitemaps)
sitemaps.u... | from django.conf.urls.defaults import patterns, url, include
from django.contrib.gis import admin
import settings
admin.autodiscover()
# Sitemaps
import venue.sitemaps
import band.sitemaps
import event.sitemaps
sitemaps = {}
sitemaps.update(venue.sitemaps.sitemaps)
sitemaps.update(band.sitemaps.sitemaps)
sitemaps.u... | agpl-3.0 | Python |
46666faa163fde00c29eca375398f20ee2b86154 | fix line splitting for diff generation | balabit/git-magic,balabit/git-magic | gitmagic/change.py | gitmagic/change.py | import difflib
from io import StringIO
import git
class Change(object):
def __init__(self, a_file_name: str, b_file_name: str, a_file_content: [str],
b_file_content: [str], a_hunk: (int, int), b_hunk: (int, int), diff: str):
self.a_file_name = a_file_name
self.b_file_name = b_fil... | import difflib
from io import StringIO
import git
class Change(object):
def __init__(self, a_file_name: str, b_file_name: str, a_file_content: [str],
b_file_content: [str], a_hunk: (int, int), b_hunk: (int, int), diff: str):
self.a_file_name = a_file_name
self.b_file_name = b_fil... | mit | Python |
62f4e31ef3a8f96adbfb4016c809777b6ed3b331 | Reduce useless imports in urls.py | SmartJog/webengine,SmartJog/webengine | urls.py | urls.py | from django.conf.urls.defaults import patterns, url, include
from webengine.utils import get_valid_plugins
from django.contrib import admin
from django.conf import settings
# List of patterns to apply, default view is webengine.index
urlpatterns = patterns('',
url(r'^$', 'webengine.utils.default_view'),
)
if hasa... | from django.conf.urls.defaults import *
from webengine.utils import get_valid_plugins
from django.contrib import admin
from django.conf import settings
# List of patterns to apply, default view is webengine.index
urlpatterns = patterns('',
url(r'^$', 'webengine.utils.default_view'),
)
if hasattr(settings, 'ENABLE... | lgpl-2.1 | Python |
224700aada7e7d80b4389b123ee00b5f14e88c99 | Fix HTML escaping of TextPlugin, by feature/text-filters branch | django-fluent/django-fluent-contents,django-fluent/django-fluent-contents,edoburu/django-fluent-contents,edoburu/django-fluent-contents,django-fluent/django-fluent-contents,edoburu/django-fluent-contents | fluent_contents/plugins/text/content_plugins.py | fluent_contents/plugins/text/content_plugins.py | """
Definition of the plugin.
"""
from django.utils.safestring import mark_safe
from fluent_contents.extensions import ContentPlugin, plugin_pool, ContentItemForm
from fluent_contents.plugins.text.models import TextItem
class TextItemForm(ContentItemForm):
"""
Perform extra processing for the text item
""... | """
Definition of the plugin.
"""
from django.utils.html import format_html
from fluent_contents.extensions import ContentPlugin, plugin_pool, ContentItemForm
from fluent_contents.plugins.text.models import TextItem
class TextItemForm(ContentItemForm):
"""
Perform extra processing for the text item
"""
... | apache-2.0 | Python |
f48b3df88bb01edd8489f0d7f59794b2cd46bde8 | Make PY3 compatible | pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus | test/core/028-dynamic-hierarchy/local_hierarchy.py | test/core/028-dynamic-hierarchy/local_hierarchy.py | #!/usr/bin/env python
import os
import subprocess
import sys
from Pegasus.DAX3 import *
if len(sys.argv) != 2:
print("Usage: %s CLUSTER_PEGASUS_HOME" % sys.argv[0])
sys.exit(1)
cluster_pegasus_home = sys.argv[1]
# to setup python lib dir for importing Pegasus PYTHON DAX API
# pegasus_config = os.path.join... | #!/usr/bin/env python
import os
import sys
import subprocess
if len(sys.argv) != 2:
print "Usage: %s CLUSTER_PEGASUS_HOME" % (sys.argv[0])
sys.exit(1)
cluster_pegasus_home=sys.argv[1]
# to setup python lib dir for importing Pegasus PYTHON DAX API
#pegasus_config = os.path.join("pegasus-config") + "... | apache-2.0 | Python |
919c2e5ea6a22ac7b24aa005e5ad3c7886b3feb7 | fix broadcaster display | eellak/ccradio,eellak/ccradio,eellak/ccradio | panel/admin.py | panel/admin.py | from ccradio.panel.models import Broadcaster, Category, Stream
from django.contrib import admin
from django.contrib.auth.models import User
class BroadcasterAdmin(admin.ModelAdmin):
list_display = ('title', 'category', 'stream', 'url')
list_filter = ('category', 'stream')
ordering = ('title', 'category')
... | from ccradio.panel.models import Broadcaster, Category, Stream
from django.contrib import admin
from django.contrib.auth.models import User
class BroadcasterAdmin(admin.ModelAdmin):
list_display = ('title', 'category', 'active', 'stream')
list_filter = ('category', 'stream', 'active')
ordering = ('title', ... | agpl-3.0 | Python |
afe5e9a0a097d6b6615e01d574b42e6c996282d6 | Disable colore for @mrtazz | ericmjl/legit,wkentaro/legit,blueyed/legit,jetgeng/legit,kennethreitz/legit,deshion/legit,kennethreitz/legit,hickford/legit,nxnfufunezn/legit,mattn/legit,nxnfufunezn/legit,hickford/legit,ericmjl/legit,wkentaro/legit,jetgeng/legit,deshion/legit,mattn/legit,blueyed/legit | legit/core.py | legit/core.py | # -*- coding: utf-8 -*-
"""
legit.core
~~~~~~~~~~
This module provides the basic functionality of legit.
"""
# from clint import resources
import os
import clint.textui.colored
__version__ = '0.0.9'
__author__ = 'Kenneth Reitz'
__license__ = 'BSD'
if 'LEGIT_NO_COLORS' in os.environ:
clint.textui.colored.DIS... | # -*- coding: utf-8 -*-
"""
legit.core
~~~~~~~~~~
This module provides the basic functionality of legit.
"""
# from clint import resources
__version__ = '0.0.9'
__author__ = 'Kenneth Reitz'
__license__ = 'BSD'
# resources.init('kennethreitz', 'legit')
# resources.user.write('config.ini', "we'll get there.") | bsd-3-clause | Python |
05cd983e108764d288798784508249726b0ffd70 | add version 0.6.2 to yaml-cpp (#7931) | LLNL/spack,tmerrick1/spack,matthiasdiener/spack,LLNL/spack,mfherbst/spack,iulian787/spack,krafczyk/spack,LLNL/spack,krafczyk/spack,matthiasdiener/spack,tmerrick1/spack,matthiasdiener/spack,tmerrick1/spack,mfherbst/spack,matthiasdiener/spack,LLNL/spack,iulian787/spack,mfherbst/spack,krafczyk/spack,tmerrick1/spack,krafcz... | var/spack/repos/builtin/packages/yaml-cpp/package.py | var/spack/repos/builtin/packages/yaml-cpp/package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
58d3d5fb4ae8fc081e5e503e2b6316dc81deb678 | Rewrite views.py | kagemiku/gpbot-line | gpbot/bot/views.py | gpbot/bot/views.py | from django.shortcuts import render
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden
from django.conf import settings
from linebot import LineBotApi, WebhookParser
from linebot.exceptions import InvalidSignatureError, LineBotApiError
from linebot.models import (
MessageEvent,
... | from django.shortcuts import render
from django.http import HttpResponse
import os
import json
import requests
REPLY_ENDPOINT = 'https://api.line.me/v2/bot/message/reply'
CHANNEL_ACCESS_TOKEN = os.environ['LINE_CHANNEL_ACCESS_TOKEN']
HEADER = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + C... | mit | Python |
63f01e99acf8b365539c7d58d1acf86d70d03261 | Fix name-tests-test | chriskuehl/pre-commit-hooks,bgschiller/pre-commit-hooks,Harwood/pre-commit-hooks,jordant/pre-commit-hooks,pre-commit/pre-commit-hooks,Coverfox/pre-commit-hooks,jordant/pre-commit-hooks,dupuy/pre-commit-hooks,arahayrabedian/pre-commit-hooks | pre_commit_hooks/tests_should_end_in_test.py | pre_commit_hooks/tests_should_end_in_test.py | from __future__ import print_function
import argparse
import sys
def validate_files(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument('filenames', nargs='*')
args = parser.parse_args(argv)
retcode = 0
for filename in args.filenames:
if (
not filename.ends... | from __future__ import print_function
import sys
def validate_files(argv=None):
retcode = 0
for filename in argv:
if (
not filename.endswith('_test.py') and
not filename.endswith('__init__.py') and
not filename.endswith('/conftest.py')
):
... | mit | Python |
edf96afa7045efa4d60d80edaef9a13226535892 | Fix typo in feature_blocksdir.py log message | chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin | test/functional/feature_blocksdir.py | test/functional/feature_blocksdir.py | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the blocksdir option.
"""
import os
import shutil
from test_framework.test_framework import BitcoinTe... | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the blocksdir option.
"""
import os
import shutil
from test_framework.test_framework import BitcoinTe... | mit | Python |
cb0b197ccad0b49baa24f3dff374de2ff2572cde | Make ua_comment test pass on 0.16.0 | chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin | test/functional/feature_uacomment.py | test/functional/feature_uacomment.py | #!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the -uacomment option."""
from test_framework.test_framework import BitcoinTestFramework
from test_fra... | #!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the -uacomment option."""
from test_framework.test_framework import BitcoinTestFramework
from test_fra... | mit | Python |
e41dde0874ff40dde175830618b40ae3828865d6 | Update file paths to new location for trac, inside of irrigator_pro | warnes/irrigatorpro,warnes/irrigatorpro,warnes/irrigatorpro,warnes/irrigatorpro | irrigator_pro/trac/cgi-bin/trac.wsgi | irrigator_pro/trac/cgi-bin/trac.wsgi | import os, os.path, site, sys, socket
# Add django root dir to python path
PROJECT_ROOT = '/prod/irrigator_pro'
print "PROJECT_ROOT=", PROJECT_ROOT
sys.path.append(PROJECT_ROOT)
# Add virtualenv dirs to python path
if socket.gethostname()=='gregs-mbp':
VIRTUAL_ENV_ROOT = os.path.join( PROJECT_ROOT, 'Virtual... | import os, os.path, site, sys, socket
# Add django root dir to python path
PROJECT_ROOT = '/prod/irrigator_pro'
print "PROJECT_ROOT=", PROJECT_ROOT
sys.path.append(PROJECT_ROOT)
# Add virtualenv dirs to python path
if socket.gethostname()=='gregs-mbp':
VIRTUAL_ENV_ROOT = os.path.join( PROJECT_ROOT, 'Virtual... | mit | Python |
44e3643f9ddacce293feac2a2e9ca09799b7ff68 | Use options.rootdir instead of __file__ | ella/citools,ella/citools | citools/pavement.py | citools/pavement.py | import os
import sys
from os.path import join, abspath, dirname
from paver.easy import *
@task
@consume_args
@needs('unit', 'integrate')
def test():
""" Run whole testsuite """
def djangonize_test_environment(test_project_module):
sys.path.insert(0, options.rootdir)
sys.path.insert(0, join(options.root... | import os
import sys
from os.path import join, abspath, dirname
from paver.easy import *
@task
@consume_args
@needs('unit', 'integrate')
def test():
""" Run whole testsuite """
def djangonize_test_environment(test_project_module):
sys.path.insert(0, abspath(join(dirname(__file__))))
sys.path.insert(0, ... | bsd-3-clause | Python |
8ff877fe82ced94582ca48cb066a9363995b09cd | Fix flake8 | bow/bioconda-recipes,colinbrislawn/bioconda-recipes,Luobiny/bioconda-recipes,JenCabral/bioconda-recipes,acaprez/recipes,rob-p/bioconda-recipes,omicsnut/bioconda-recipes,martin-mann/bioconda-recipes,ivirshup/bioconda-recipes,ostrokach/bioconda-recipes,HassanAmr/bioconda-recipes,CGATOxford/bioconda-recipes,abims-sbr/bioc... | recipes/metaphlan2/download_metaphlan2_db.py | recipes/metaphlan2/download_metaphlan2_db.py | #!/usr/bin/env python3
import argparse
import tarfile
import os
import urllib2
import shutil
METAPHLAN2_URL = 'https://bitbucket.org/biobakery/metaphlan2/get/2.6.0.tar.gz'
def download_file(url):
"""Download a file from a URL
Fetches a file from the specified URL.
Returns the name that the file is save... | #!/usr/bin/env python3
import argparse
import tarfile
import os
import urllib2
import shutil
METAPHLAN2_URL = 'https://bitbucket.org/biobakery/metaphlan2/get/2.6.0.tar.gz'
def download_file(url, target=None, wd=None):
"""Download a file from a URL
Fetches a file from the specified URL.
If 'target' is s... | mit | Python |
d6432e9718a160bda79afe473adc9630d36a9ce5 | add v2.4.40 (#25065) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/bedops/package.py | var/spack/repos/builtin/packages/bedops/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Bedops(MakefilePackage):
"""BEDOPS is an open-source command-line toolkit that performs hi... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Bedops(MakefilePackage):
"""BEDOPS is an open-source command-line toolkit that performs hi... | lgpl-2.1 | Python |
7b486fd84dfca220b1415fa2956a8c4bc32dc470 | add version 0.7 | LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/py-ics/package.py | var/spack/repos/builtin/packages/py-ics/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyIcs(PythonPackage):
"""Ics.py : iCalendar for Humans
Ics.py is a pythonic and easy ... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyIcs(PythonPackage):
"""Ics.py : iCalendar for Humans
Ics.py is a pythonic and easy ... | lgpl-2.1 | Python |
4c5c7aa74b2dec2cbfb6b6bd7e24d5922e92c112 | Document 'repo status' output | flingone/git-repo,artprogramming/git-repo,duralog/repo,sapiippo/git-repo,HenningSchroeder/git-repo,ronan22/repo,Mioze7Ae/android_tools_repo,vmx/git-repo,flingone/git-repo,petemoore/git-repo,linuxdeepin/git-repo,caicry/android.repo,alanbian/git-repo,lifuzu/repo,martinjina/git-repo,Jokebin/git-repo,mer-tools/git-repo,oss... | subcmds/status.py | subcmds/status.py | #
# Copyright (C) 2008 The Android Open Source Project
#
# 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 la... | #
# Copyright (C) 2008 The Android Open Source Project
#
# 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 la... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.