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 |
|---|---|---|---|---|---|---|---|---|
fdecb8d45ce58929b62cb1ce2d91d8447c4d7a68 | Remove unnecessary import | efiop/dvc,dataversioncontrol/dvc,efiop/dvc,dmpetrov/dataversioncontrol,dataversioncontrol/dvc,dmpetrov/dataversioncontrol | tests/utils/httpd.py | tests/utils/httpd.py | import hashlib
import os
import threading
from dvc.utils.compat import HTTPServer, SimpleHTTPRequestHandler
class ETagHandler(SimpleHTTPRequestHandler):
def end_headers(self):
file = self.translate_path(self.path)
if not os.path.isdir(file) and os.path.exists(file):
with open(file, "... | import hashlib
import os
import socket
import threading
from dvc.utils.compat import HTTPServer, SimpleHTTPRequestHandler
class ETagHandler(SimpleHTTPRequestHandler):
def end_headers(self):
file = self.translate_path(self.path)
if not os.path.isdir(file) and os.path.exists(file):
wit... | apache-2.0 | Python |
b7ec5b9c5f1281ba5d0b2e85f1c4679b30bac971 | Fix the ZSCII tests by checking for the correct ASCII code. | sussman/zvm,sussman/zvm | tests/zscii_tests.py | tests/zscii_tests.py | #
# Unit tests for the zscii class.
#
# For the license of this file, please consult the LICENSE file in the
# root directory of this distribution.
#
from unittest import TestCase
from zvm import zstring
from zvm import zmemory
def make_zmemory():
# We use Graham Nelson's 'curses' game for our unittests.
story... | #
# Unit tests for the zscii class.
#
# For the license of this file, please consult the LICENSE file in the
# root directory of this distribution.
#
from unittest import TestCase
from zvm import zstring
from zvm import zmemory
def make_zmemory():
# We use Graham Nelson's 'curses' game for our unittests.
story... | bsd-3-clause | Python |
ae5db950c683501c1ec77fee430b818293e6c603 | Split up lines to pass the linter | reubano/csv2ofx,reubano/csv2ofx | csv2ofx/mappings/gls.py | csv2ofx/mappings/gls.py | from operator import itemgetter
mapping = {
'has_header': True,
'currency': 'EUR',
'delimiter': ';',
'bank': 'GLS Bank',
'account': itemgetter('Kontonummer'),
# Chop up the dotted German date format and put it in ridiculous M/D/Y order
'date': lambda r: r['Buchungstag'][3:5] + '/'
... | from operator import itemgetter
mapping = {
'has_header': True,
'currency': 'EUR',
'delimiter': ';',
'bank': 'GLS Bank',
'account': itemgetter('Kontonummer'),
'date': lambda r: r['Buchungstag'][3:5] + '/' + r['Buchungstag'][:2] + '/' + r['Buchungstag'][-4:], # Chop up the dotted German date for... | mit | Python |
130a9c67a6d4096dc5ec973375155e7ad2071d57 | fix admin | BruceZhang1993/PyIrcBot,BruceZhang1993/PyIrcBot | plugins/admin.py | plugins/admin.py | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
# -----------------------------
# Author: Bruce Zhang
# Email: zy183525594@163.com
# Version: 0.1
# -----------------------------
import importlib
import logging
import pyircbot.globalvar
'''admin management plugin'''
logger = logging.getLogger('ircbot')
def admin(a... | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
# -----------------------------
# Author: Bruce Zhang
# Email: zy183525594@163.com
# Version: 0.1
# -----------------------------
import importlib
import logging
import pyircbot.globalvar
'''admin management plugin'''
logger = logging.getLogger('ircbot')
def admin(a... | mit | Python |
a21aea6a0327d697d9213ecdbfd6365a77d0b40e | Add views for deck CRUD | DummyDivision/Tsune,DummyDivision/Tsune,DummyDivision/Tsune | cardbox/deck_views.py | cardbox/deck_views.py | # coding=utf-8
# TODO: User authentication
from django.contrib.localflavor import kw
from django.http import HttpResponse
from django.http.response import HttpResponseForbidden
from django.template import context
from django.views.generic import ListView, DetailView
from django.views.generic import CreateView, UpdateV... | from django.http import HttpResponse
def index(request):
return HttpResponse("Hallo Welt!") | mit | Python |
adf70f08cc109d3c0603aecdbbc7b30e2f9cc354 | Bump to new release. | NitishT/minio-py,minio/minio-py,minio/minio-py,NitishT/minio-py | minio/__init__.py | minio/__init__.py | # -*- coding: utf-8 -*-
# Minio Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015, 2016, 2017 Minio, Inc.
#
# 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.ap... | # -*- coding: utf-8 -*-
# Minio Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015, 2016 Minio, Inc.
#
# 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.o... | apache-2.0 | Python |
414c9eab47bf2aa729f4e096d7372fc63e1a840f | Add test for rinoh --format | brechtm/rinohtype,brechtm/rinohtype,brechtm/rinohtype | tests_regression/test_rinoh.py | tests_regression/test_rinoh.py | # This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
from pathlib import Path
import pytest
from helpers.reg... | # This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
from pathlib import Path
import pytest
from helpers.reg... | agpl-3.0 | Python |
ba68b9f90d67e656a1cb2b5d57310ce5af354f04 | bump the version to 0.0.11 | ceph/chacractl,alfredodeza/chacractl | chacractl/__init__.py | chacractl/__init__.py | config = {'verbosity': 'info'}
__version__ = '0.0.11'
| config = {'verbosity': 'info'}
__version__ = '0.0.10'
| mit | Python |
f5b721074490008fcfa09bcedf874726cfaffee6 | Add preliminary material admin config | GISAElkartea/tresna-kutxa,GISAElkartea/tresna-kutxa,GISAElkartea/tresna-kutxa,GISAElkartea/tresna-kutxa | tk/material/admin.py | tk/material/admin.py | from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
from modeltranslation.admin import TranslationAdmin
from .models import (Subject, Goal, GroupFeature, Location, Language,
Approval, Activity, Reading, Video, Link)
# TODO: Do not delete related
admin.regist... | from django.contrib import admin
# Register your models here.
| agpl-3.0 | Python |
db44d918ae92b64572728fa4954fd291c2f30731 | Fix db engine name for SQLAlchemy 1.4 | hasgeek/boxoffice,hasgeek/boxoffice,hasgeek/boxoffice,hasgeek/boxoffice | instance/testing.py | instance/testing.py | import os
#: Database backend
SECRET_KEY = 'testkey'
SQLALCHEMY_DATABASE_URI = 'postgresql:///boxoffice_testing'
SERVER_NAME = 'boxoffice.travis.dev:6500'
BASE_URL = 'http://' + SERVER_NAME
RAZORPAY_KEY_ID = os.environ.get('RAZORPAY_KEY_ID')
RAZORPAY_KEY_SECRET = os.environ.get('RAZORPAY_KEY_SECRET')
ALLOWED_ORIGINS ... | import os
#: Database backend
SECRET_KEY = 'testkey'
SQLALCHEMY_DATABASE_URI = 'postgres:///boxoffice_testing'
SERVER_NAME = 'boxoffice.travis.dev:6500'
BASE_URL = 'http://' + SERVER_NAME
RAZORPAY_KEY_ID = os.environ.get('RAZORPAY_KEY_ID')
RAZORPAY_KEY_SECRET = os.environ.get('RAZORPAY_KEY_SECRET')
ALLOWED_ORIGINS = ... | agpl-3.0 | Python |
8aa250d679a0e03546001295ee2e30fcb82516aa | Change class name | Kriechi/mitmproxy,MatthewShao/mitmproxy,cortesi/mitmproxy,mitmproxy/mitmproxy,xaxa89/mitmproxy,StevenVanAcker/mitmproxy,ujjwal96/mitmproxy,mosajjal/mitmproxy,MatthewShao/mitmproxy,zlorb/mitmproxy,ddworken/mitmproxy,ujjwal96/mitmproxy,xaxa89/mitmproxy,mhils/mitmproxy,dwfreed/mitmproxy,zlorb/mitmproxy,mhils/mitmproxy,dwf... | examples/complex/dns_spoofing.py | examples/complex/dns_spoofing.py | """
This inline scripts makes it possible to use mitmproxy in scenarios where IP spoofing has been used to redirect
connections to mitmproxy. The way this works is that we rely on either the TLS Server Name Indication (SNI) or the
Host header of the HTTP request.
Of course, this is not foolproof - if an HTTPS connectio... | """
This inline scripts makes it possible to use mitmproxy in scenarios where IP spoofing has been used to redirect
connections to mitmproxy. The way this works is that we rely on either the TLS Server Name Indication (SNI) or the
Host header of the HTTP request.
Of course, this is not foolproof - if an HTTPS connectio... | mit | Python |
ca49ed4dfb660482663ed7b1e04c3c51644fd4cf | Convert gcode now houses all files. | makerbot/s3g,makerbot/s3g,Jnesselr/s3g,makerbot/s3g,Jnesselr/s3g,makerbot/s3g | examples/convert_gcode_to_s3g.py | examples/convert_gcode_to_s3g.py | import os
import sys
lib_path = os.path.abspath('../')
sys.path.append(lib_path)
import s3g
#input_file = '../doc/gcode_samples/skeinforge_single_extrusion_snake.gcode'
input_file = '../doc/gcode_samples/skeinforge_dual_extrusion_hilbert_cube.gcode'
#input_file = '../doc/gcode_samples/miracle_grue_single_extrusion.gc... | import os
import sys
lib_path = os.path.abspath('../')
sys.path.append(lib_path)
import s3g
#input_file = '../doc/gcode_samples/skeinforge_single_extrusion_snake.gcode'
#input_file = '../doc/gcode_samples/skeinforge_dual_extrusion_hilbert_cube.gcode'
input_file = '../doc/gcode_samples/miracle_grue_single_extrusion.gc... | agpl-3.0 | Python |
b79f4ad3c753514b3c87bca4c98c1eed0a4e2ec5 | Fix tag | Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org | Instanssi/kompomaatti/templatetags/kompomaatti_base_tags.py | Instanssi/kompomaatti/templatetags/kompomaatti_base_tags.py | # -*- coding: utf-8 -*-
from django import template
from Instanssi.kompomaatti.models import Compo, Competition, Event
register = template.Library()
@register.inclusion_tag('kompomaatti/tags/compo_nav_items.html')
def render_base_compos_nav(event_id):
return {
'event_id': event_id,
'compos': Comp... | # -*- coding: utf-8 -*-
from django import template
from Instanssi.kompomaatti.models import Compo, Competition
register = template.Library()
@register.inclusion_tag('kompomaatti/tags/compo_nav_items.html')
def render_base_compos_nav(event_id):
return {
'event_id': event_id,
'compos': Compo.objec... | mit | Python |
d639eba81384c34e7ada435edf431b0e8c130302 | Replace PACKAGE_NAME with package_name() in bzl files. | google/truth,google/truth,google/truth,cgruber/truth,cgruber/truth | core/src/test/java/com/google/common/truth/gen_j2cl_test_rules.bzl | core/src/test/java/com/google/common/truth/gen_j2cl_test_rules.bzl | """Generate j2cl tests per test file.
One j2cl test target will be generated for each file in `test_files` list.
This rule serves similar purpose to //java/com/google/testing/builddefs:GenTestRules.bzl but for
j2cl tests.
"""
load("//testing/build_defs/common:java_functions.bzl", "package_from_path")
load("//testing/... | """Generate j2cl tests per test file.
One j2cl test target will be generated for each file in `test_files` list.
This rule serves similar purpose to //java/com/google/testing/builddefs:GenTestRules.bzl but for
j2cl tests.
"""
load("//testing/build_defs/common:java_functions.bzl", "package_from_path")
load("//testing/... | apache-2.0 | Python |
f92ed4f407784e62c04cc19fa1733d48ac24b07d | Add multiple UCRs to aysnc table at once | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/userreports/management/commands/async_rebuild_table.py | corehq/apps/userreports/management/commands/async_rebuild_table.py | from __future__ import print_function
import argparse
from collections import namedtuple
from django.core.management.base import BaseCommand
from corehq.apps.userreports.document_stores import get_document_store
from corehq.apps.userreports.models import AsyncIndicator, get_datasource_config
from corehq.apps.userrepo... | from __future__ import print_function
from collections import namedtuple
from django.core.management.base import BaseCommand
from corehq.apps.userreports.document_stores import get_document_store
from corehq.apps.userreports.models import AsyncIndicator, get_datasource_config
from corehq.apps.userreports.util import ... | bsd-3-clause | Python |
6ad990b0309d673a279f9a1308f6029d028c11b7 | Remove outdated comment | vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa | model-integration/src/test/models/tensorflow/softmax/softmax.py | model-integration/src/test/models/tensorflow/softmax/softmax.py | # Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
import numpy as np
import tensorflow as tf
# Creates simple random neural network that has softmax on output. No training.
n_inputs = 5
n_outputs = 3
input = tf.placeholder(tf.float32, shape=(None, n_inpu... | # Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
import numpy as np
import tensorflow as tf
# Creates simple random neural network that has softmax on output. No training.
n_inputs = 5
n_outputs = 3
input = tf.placeholder(tf.float32, shape=(None, n_inpu... | apache-2.0 | Python |
6aee650cfb3a517707dd86a96364754066aa1062 | Make create_security_policy command's help accurate. | anantb/datahub,datahuborg/datahub,datahuborg/datahub,RogerTangos/datahub-stub,datahuborg/datahub,datahuborg/datahub,datahuborg/datahub,anantb/datahub,anantb/datahub,RogerTangos/datahub-stub,anantb/datahub,RogerTangos/datahub-stub,anantb/datahub,anantb/datahub,RogerTangos/datahub-stub,RogerTangos/datahub-stub,datahuborg... | src/account/management/commands/create_security_policy_table.py | src/account/management/commands/create_security_policy_table.py | import factory
from django.db.models import signals
from django.core.management.base import BaseCommand
from config import settings
from core.db.manager import DataHubManager
class Command(BaseCommand):
help = ("Creates the public policy schema and table "
"necessary for creating row level security ... | import factory
from django.db.models import signals
from django.core.management.base import BaseCommand
from config import settings
from core.db.manager import DataHubManager
class Command(BaseCommand):
help = ("Creates the public and anonymous users "
"necessary for publishing data.")
def hand... | mit | Python |
b5ca6892f34481935f476baf46de7d98a48960b4 | Integrate LLVM at llvm/llvm-project@5a5a94ed34b0 | frreiss/tensorflow-fred,Intel-tensorflow/tensorflow,paolodedios/tensorflow,frreiss/tensorflow-fred,Intel-Corporation/tensorflow,sarvex/tensorflow,yongtang/tensorflow,Intel-tensorflow/tensorflow,gautam1858/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_saved_model,Intel-Corporation/tensorflow,yongtang/te... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "5a5a94ed34b07079046ac81e7e97d980ce2c834f"
LLVM_SHA256 = "277b8ed022255175ad597e8d11204152110500c9ebd4c7f11809c804e78b135f"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "67b39661c84742142628591aec181eef1cb6c3b7"
LLVM_SHA256 = "a9cdb4f9c3b21cfba61970ea65ca6a50c99e0264333e9897b419663ac572550e"
tf_http_archive(
... | apache-2.0 | Python |
2b4cdac7579f076951031ed82d9c8d0e447227db | update docstring | Roguelazer/fakemtpd | fakemtpd/better_lockfile.py | fakemtpd/better_lockfile.py | import fcntl
import lockfile
import logging
import os
class BetterLockfile(object):
"""
A lockfile (matching the specification of the builtin lockfile class)
based off of flock. Only uses a single lock file rather than one per process/thread.
"""
def __init__(self, path):
self.path = path
... | import fcntl
import lockfile
import logging
import os
class BetterLockfile(object):
"""
A lockfile (matching the specification of the builtin lockfile class)
based off of lockf. Only uses a single lock file rather than one per process/thread.
"""
def __init__(self, path):
self.path = path
... | isc | Python |
d125ce5d3d8fda7e64682e19cdc19c7c43bedaf9 | Integrate LLVM at llvm/llvm-project@64612f5d8e35 | tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflo... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "64612f5d8e35a47008554e646e5b434c4bf738ae"
LLVM_SHA256 = "e510cc416fcea0f0e9b634f4c06d3442d3dc91b82315743cf8069d34bfeda775"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "79b5829a155f256001ead535c358a1193cd0cbe8"
LLVM_SHA256 = "b82e715a0e47da8e426aebb7b9a7bdfe387c2f244c6e72f282bf09f0b36acfc9"
tf_http_archive(
... | apache-2.0 | Python |
57456476239aa7247ac12288e86e46918d070321 | Integrate LLVM at llvm/llvm-project@3f97c66b0040 | tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "3f97c66b00400f5e7f0cd260107f53c11b1cc33b"
LLVM_SHA256 = "21b7d20e289327434eb3a25f940d3a78a686ccd8384f51ec960c2a9e56d05a9d"
tfrt_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "f28cb01be071a52e817c8ba84a5ef503a614b86e"
LLVM_SHA256 = "62d54c8105464b926176368d7b25023eb1b6d2e45a124f14d6e50f1deca7bcdc"
tfrt_http_archive(
... | apache-2.0 | Python |
e619de6b1b6184b9fa214248d97d05b86266577d | Add docstring | kwadrat/rgb_tdd | red_green_bar.py | red_green_bar.py | #!/usr/bin/python
'''
Given:
1. status code: (0 - OK, other value - BAD)
2. terminal window width
shows red/green bar to visualize return code of previous command
'''
import sys
if len(sys.argv) >= 2:
value = int(sys.argv[1])
cols_limit = int(sys.argv[2])
esc = chr(27)
if value:
col_char = '... | #!/usr/bin/python
import sys
if len(sys.argv) >= 2:
value = int(sys.argv[1])
cols_limit = int(sys.argv[2])
esc = chr(27)
if value:
col_char = '1'
else:
col_char = '2'
print ''.join((
esc,
'[4',
col_char,
'm',
' ' * (cols_limit - 2),
... | mit | Python |
c7497fd46f7eba2b0488ec0c7b3b6893427c979c | Integrate LLVM at llvm/llvm-project@1fd6f06b9e97 | tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "1fd6f06b9e975386f4bb30ce8a1d044abeb1b633"
LLVM_SHA256 = "c44e02070ec02cac6d7e9975d8b13103ea99348f3d7dd47f029b11b84b66a9e4"
tfrt_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "5a64bc207ee07d939271ee8631bf28b01e431a46"
LLVM_SHA256 = "b9e5fb8451619e11357c1d46ed52ca08d1ca5427a9c9134512da6475b1b618d1"
tfrt_http_archive(
... | apache-2.0 | Python |
fa765df128f8dc0e6450a7b1e6d418135fcd2dc7 | Bump to 4.1c1 | blueyed/coveragepy,hugovk/coveragepy,blueyed/coveragepy,nedbat/coveragepy,hugovk/coveragepy,blueyed/coveragepy,hugovk/coveragepy,hugovk/coveragepy,nedbat/coveragepy,hugovk/coveragepy,blueyed/coveragepy,blueyed/coveragepy,nedbat/coveragepy,nedbat/coveragepy,nedbat/coveragepy | coverage/version.py | coverage/version.py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""The version and URL for coverage.py"""
# This file is exec'ed in setup.py, don't import anything!
# Same semantics as sys.version_info.
version_info = (4, 1, 0,... | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""The version and URL for coverage.py"""
# This file is exec'ed in setup.py, don't import anything!
# Same semantics as sys.version_info.
version_info = (4, 1, 0,... | apache-2.0 | Python |
678622c048910e58e9e1c9c155481b9158242c85 | update error handler map to more easily support custom handlers (rather than manually setting keys on the result, you pass in a dictionary, which is offers a bit of typechecking) | kezabelle/clastic,kezabelle/clastic | clastic/exceptions.py | clastic/exceptions.py | from __future__ import unicode_literals
from werkzeug.exceptions import *
def make_error_handler_map(handler_map=None,
default_400=None,
default_500=None):
handler_map = dict(handler_map or {})
ret = {}
if default_400:
if not callable(default_... | from __future__ import unicode_literals
from werkzeug.exceptions import *
def make_default_handler_map(default_400=None, default_500=None):
ret = {}
if default_400 and not callable(default_400):
raise TypeError('default_400 expected function, not %r' % default_400)
if default_500 and not callable... | bsd-3-clause | Python |
b14df3cdcf98a6c21a9e7434a793be38b0152fef | Integrate LLVM at llvm/llvm-project@bcd153485ebf | tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "bcd153485ebf07fe79e2b843ed5f1cb74997df1b"
LLVM_SHA256 = "6f23b7084362cb7d4ff28c0eff1d7432dc68e2da229477318bf05892e85ae3b0"
tfrt_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "5166345f50412f1a380948c18809545c4b7a9bd3"
LLVM_SHA256 = "2dad75b85dad1e3ce48373d8e8a547905aea10e208c179e5ad3182f5e42323c9"
tfrt_http_archive(
... | apache-2.0 | Python |
993baa6a03de4a1b7fc9789812e2a482c12ace80 | Tweak to middleware | ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas | apps/govuk_utils/middleware.py | apps/govuk_utils/middleware.py | import time
from django.conf import settings
from django.utils import translation
def get_session_timeout(request):
try:
has_plea_data = request.session["plea_data"]["case"]
except KeyError:
has_plea_data = False
try:
has_feedback_data = request.session["feedback_data"]["service"]... | import time
from django.conf import settings
from django.utils import translation
def get_session_timeout(request):
try:
if (request.session.get("plea_data", {}).get("case", False)
or request.session.get("feedback_data", {}).get("service", False)):
timeout = int(time.time() + getat... | mit | Python |
2fd0cdb51407c8d3b79cf271d452ad81e53c750c | Remove extra whitespaces and fix too long lines in soc.logic.helper.request module. | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | app/soc/logic/helper/request.py | app/soc/logic/helper/request.py | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | apache-2.0 | Python |
2eb0413356b1420546f1e4b29c3b7d4a8783e177 | fix importing urlunparse in nodepy.utils.urlpath | nodepy/nodepy | nodepy/utils/urlpath.py | nodepy/utils/urlpath.py | """
A #pathlib.Path implementation for URLs.
"""
from nodepy.utils import pathlib
import os
import io
import posixpath
try:
from urllib.request import urlopen
from urllib.parse import urlparse, urlunparse
except ImportError:
from urllib2 import urlopen
from urlparse import urlparse, urlunparse
class _UrlFla... | """
A #pathlib.Path implementation for URLs.
"""
from nodepy.utils import pathlib
import os
import io
import posixpath
try:
from urllib.request import urlopen
from urllib.parse import urlparse, urlunparse
except ImportError:
from urllib2 import urlopen, urlparse, urlunparse
class _UrlFlavour(pathlib._PosixFla... | mit | Python |
96997154b05f704339f8f43a77040532667a8ce4 | Drop incomplete documentation | tylerdave/devpi-plumber | devpi_plumber/server.py | devpi_plumber/server.py | import contextlib
import subprocess
from twitter.common.contextutil import temporary_dir
from devpi_plumber.client import DevpiClient
@contextlib.contextmanager
def TestServer(users={}, indices={}, config={}):
"""
Starts a devpi server to be used within tests.
"""
with temporary_dir() as server_dir:... | import contextlib
import subprocess
from twitter.common.contextutil import temporary_dir
from devpi_plumber.client import DevpiClient
@contextlib.contextmanager
def TestServer(users={}, indices={}, config={}):
"""
Starts a devpi server to be used within tests
Users: Dictionary of
"""
with tempo... | bsd-3-clause | Python |
131033fa3ab170ac2a66c1dd89074ea74702fb52 | Remove vestigial (?) "woo" default for article slug and title fields. | ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit | icekit/page_types/articles/migrations/0002_auto_20161012_2231.py | icekit/page_types/articles/migrations/0002_auto_20161012_2231.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icekit_articles', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='article',
name=... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icekit_articles', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='article',
name=... | mit | Python |
0acc2d3e605cbfd41ebd88ca7e9d65827beed44e | Make diagram colors pale | ivochkin/dfk,isn-/dfk,ivochkin/dfk,isn-/dfk,ivochkin/dfk,ivochkin/dfk,isn-/dfk,isn-/dfk | tools/visualog/visualog/cli.py | tools/visualog/visualog/cli.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script parses dfk debug log, matches coroutine context switches by regexp
and outputs plantuml diagram that illustrates execution path.
Plantuml diagram source can be viewed either by using web service like [1],
or using a local plantuml app, that could be found at the... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script parses dfk debug log, matches coroutine context switches by regexp
and outputs plantuml diagram that illustrates execution path.
Plantuml diagram source can be viewed either by using web service like [1],
or using a local plantuml app, that could be found at the... | unknown | Python |
b918b62e132849a163810a49489a899234213901 | Make DNS config more robust | grunskis/nuimo-hub-backend,grunskis/senic-hub,grunskis/nuimo-hub-backend,grunskis/nuimo-hub-backend,grunskis/senic-hub,grunskis/senic-hub,grunskis/senic-hub,getsenic/senic-hub,grunskis/senic-hub,grunskis/nuimo-hub-backend,grunskis/nuimo-hub-backend,getsenic/senic-hub,grunskis/senic-hub | deployment/fab_pine64.py | deployment/fab_pine64.py | # coding: utf-8
from fabric import api as fab
from fabric.api import task, env
eth_interface = """auto {eth_iface}
iface {eth_iface} inet static
address {eth_ip}
netmask {eth_netmask}
gateway {eth_gateway}
"""
eth_resolvconf = """nameserver {eth_dns}
"""
@task
def bootstrap(boot_ip):
"""bootstrap a freshl... | # coding: utf-8
from fabric import api as fab
from fabric.api import task, env
eth_interface = """auto {eth_iface}
iface {eth_iface} inet static
address {eth_ip}
netmask {eth_netmask}
gateway {eth_gateway}
"""
eth_resolvconf = """nameserver {eth_dns}
"""
@task
def bootstrap(boot_ip):
"""bootstrap a freshl... | mit | Python |
2bf09eaa60ebf5193c568d172de75652744dcc31 | Add unit tests for artists.models | FreeMusicNinja/freemusic.ninja,FreeMusicNinja/freemusic.ninja | django/artists/tests.py | django/artists/tests.py | import datetime
from unittest import TestCase
from . import models
class ArtistModelTest(TestCase):
"""Tests for Artist model."""
def test_str(self):
name = "Brad Sucks"
artist = models.Artist(name=name)
self.assertEqual(str(artist), name)
class HyperlinkModelTest(TestCase):
... | from django.test import TestCase
# Create your tests here.
| bsd-3-clause | Python |
99e674e54255e88e4c1c17094ff6c37a11563a29 | Update export_runs.py | dominodatalab/python-domino,dominodatalab/python-domino | examples/export_runs.py | examples/export_runs.py | from domino import Domino
import pandas as pd
import json
import os
output_dir = "results"
# connect to domino; be sure to have these environment variables set
# (runs inside a Domino executor automatically set these for you)
domino = Domino("nick/winequality", api_key=os.environ['DOMINO_USER_API_KEY'], host=os.envi... | from domino import Domino
import pandas as pd
import json
import os
output_dir = "results"
# connect to domino; be sure to have these environment variables set
# (runs inside a Domino executor automatically set these for you)
domino = Domino("nick/winequality", api_key=os.environ['DOMINO_USER_API_KEY'], host=os.envi... | apache-2.0 | Python |
decdec6846a1ca590713b2789d9c999b5c1d9502 | Remove setting REPORT_TYPE. Reformatted code. Remove ANYBAR_COLOR_FAIL. | skk/dotfiles,skk/dotfiles | dotfiles/cashbot.cfg.py | dotfiles/cashbot.cfg.py | {
'REPORT_RECIPIENTS': 'steven.knight@cashstar.com',
'JENKINS_USERNAME': 'sknight',
'JENKINS_API_TOKEN': '594849a68d4911d6c39a2cb5f700c385',
'FEATURES': {
'PASSWORD_DECRYPTION': False,
'AWS': False,
'ANYBAR': True
},
# 'LOG_DB_URL': 'sqlite:///Users/steven.knight/Proje... | {
'REPORT_TYPE': 'HTML',
'REPORT_RECIPIENTS': 'steven.knight@cashstar.com',
'JENKINS_USERNAME': 'sknight',
'JENKINS_API_TOKEN': '594849a68d4911d6c39a2cb5f700c385',
'FEATURES': {'PASSWORD_DECRYPTION': False, 'AWS': False, 'ANYBAR': True},
# 'LOG_DB_URL': 'sqlite:///Users/steven.knight/Projects... | mit | Python |
78c0849a248caa2e07eefb0d46e209e5bf08ec16 | Add astdump.py description | bpradipt/rethinkdb,bpradipt/rethinkdb,JackieXie168/rethinkdb,grandquista/rethinkdb,Qinusty/rethinkdb,jmptrader/rethinkdb,bpradipt/rethinkdb,catroot/rethinkdb,catroot/rethinkdb,JackieXie168/rethinkdb,dparnell/rethinkdb,bchavez/rethinkdb,dparnell/rethinkdb,robertjpayne/rethinkdb,Qinusty/rethinkdb,Qinusty/rethinkdb,dparne... | drivers/java/astdump.py | drivers/java/astdump.py | #!/usr/bin/env python3
'''This is a helper script. It takes in python statements on the
command line and dumps out a json-like representation of the AST
returned by ast.parse(expression, mode='eval').body
It is useful if you're making changes to the convert_java.py script
and want to know what the ast of some python e... | #!/usr/bin/env python3
import ast
import json
def convert_to_dict(node):
if isinstance(node, list):
return [convert_to_dict(n) for n in node]
elif isinstance(node, dict):
return {k: convert_to_dict(v) for k, v in node.items()}
elif isinstance(node, ast.AST):
nodedict = node.__dict_... | agpl-3.0 | Python |
89f7a2740deaf047dc5fce0a5212b6b31c849f16 | Add is_active and is_base to the admin | ydaniv/django-currencies,bashu/django-simple-currencies,ydaniv/django-currencies,pathakamit88/django-currencies,panosl/django-currencies,mysociety/django-currencies,mysociety/django-currencies,panosl/django-currencies,marcosalcazar/django-currencies,marcosalcazar/django-currencies,barseghyanartur/django-currencies,bash... | currencies/admin.py | currencies/admin.py | from django.contrib import admin
from currencies.models import Currency
class CurrencyAdmin(admin.ModelAdmin):
list_display = ("name", "is_active", "is_base", "is_default", "code", "symbol", "factor")
list_filter = ("is_active", )
search_fields = ("name", "code")
admin.site.register(Currency, CurrencyAdm... | from django.contrib import admin
from currencies.models import Currency
class CurrencyAdmin(admin.ModelAdmin):
list_display = ("name", "is_default", "code", "symbol", "factor")
search_fields = ("name", "code")
admin.site.register(Currency, CurrencyAdmin)
| bsd-3-clause | Python |
b49e8c909bfbf83a2479002dee46bd4602a312b1 | Fix for cors | okfn/goodtables-web,okfn/goodtables-web,okfn/goodtables-web,okfn/goodtables-web | web/factory.py | web/factory.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
def create_app(config):
"""A factory that returns an application object from the passed config.
The factory accepts further configurati... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
def create_app(config):
"""A factory that returns an application object from the passed config.
The factory accepts further configurati... | mit | Python |
bb1eb380e8364878247cbef443bd64c829a190db | Remove unused BehaviourForm | crossgovernmentservices/csdigital-prototype,crossgovernmentservices/csdigital-prototype,crossgovernmentservices/csdigital-prototype,crossgovernmentservices/csdigital-prototype | application/competency/forms.py | application/competency/forms.py | from flask.ext.login import current_user
from flask.ext.wtf import Form
from wtforms.fields import SelectField
def make_link_form(**enable):
form = Form()
user = current_user._get_current_object()
def choices(items):
return [(str(item.id), str(item)) for item in items]
for linktype in ['comp... | from flask.ext.login import current_user
from flask.ext.wtf import Form
from wtforms.fields import SelectField, SelectMultipleField
from wtforms.widgets import CheckboxInput, ListWidget
class MultiCheckboxField(SelectMultipleField):
widget = ListWidget(prefix_label=False)
option_widget = CheckboxInput()
cla... | mit | Python |
de6bc61ef2eece52ef384ca99a52c1ed06d0bc51 | add missing user import | treethought/flask-assistant | flask_assistant/__init__.py | flask_assistant/__init__.py | import logging
logger = logging.getLogger("flask_assistant")
handler = logging.StreamHandler()
formatter = logging.Formatter(
"%(asctime)s:%(name)s:%(levelname)s: %(message)s", "%Y-%m-%d %H:%M:%S"
)
handler.setFormatter(formatter)
logger.addHandler(handler)
if logger.level == logging.NOTSET:
logger.setLevel(... | import logging
logger = logging.getLogger("flask_assistant")
handler = logging.StreamHandler()
formatter = logging.Formatter(
"%(asctime)s:%(name)s:%(levelname)s: %(message)s", "%Y-%m-%d %H:%M:%S"
)
handler.setFormatter(formatter)
logger.addHandler(handler)
if logger.level == logging.NOTSET:
logger.setLevel(... | apache-2.0 | Python |
7c1af79a550bb66ddb5ba2d11d90a2e8b07d66b5 | Update copyright years | khalim19/gimp-plugin-export-layers,khalim19/gimp-plugin-export-layers | export_layers/config.py | export_layers/config.py | # -*- coding: utf-8 -*-
#
# This file is part of Export Layers.
#
# Copyright (C) 2013-2016 khalim19 <khalim19@gmail.com>
#
# Export Layers is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... | # -*- coding: utf-8 -*-
#
# This file is part of Export Layers.
#
# Copyright (C) 2013-2016 khalim19 <khalim19@gmail.com>
#
# Export Layers is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... | bsd-3-clause | Python |
6c0739ccfc41bea38b2670b863022055f855f75d | add failing test | qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq | corehq/apps/accounting/tests/test_stripe_payment.py | corehq/apps/accounting/tests/test_stripe_payment.py | from mock import patch
from django.test import TransactionTestCase
from django.test.client import RequestFactory
import stripe
from corehq.apps.accounting.models import PaymentRecord, PaymentMethod, BillingAccount
from corehq.apps.accounting.payment_handlers import CreditStripePaymentHandler
from corehq.apps.domain.... | from mock import patch
from django.test.client import RequestFactory
import stripe
from corehq.apps.accounting.models import PaymentRecord, PaymentMethod, BillingAccount
from corehq.apps.accounting.payment_handlers import CreditStripePaymentHandler
from corehq.apps.accounting.tests import BaseAccountingTest
from cor... | bsd-3-clause | Python |
a06591fe0597d49c83899533f3ff01deec017964 | Clarify current behavior regarding inheritance | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/locations/tests/test_location_safety.py | corehq/apps/locations/tests/test_location_safety.py | from django.views.generic.base import View
from mock import MagicMock
from ..permissions import is_location_safe, location_safe
@location_safe
def safe_fn_view(request, domain):
return "hello"
def unsafe_fn_view(request, domain):
return "hello"
@location_safe
class SafeClsView(View):
pass
class Un... | from django.views.generic.base import View
from mock import MagicMock
from ..permissions import is_location_safe, location_safe
@location_safe
def safe_fn_view(request, domain):
return "hello"
def unsafe_fn_view(request, domain):
return "hello"
@location_safe
class SafeClsView(View):
pass
class Un... | bsd-3-clause | Python |
b33b7dfcb7f3a64ee33805a862d3b17b9aa4ce92 | change bauld rate | brendanhoran/nmea_faker | client/nmea_client.py | client/nmea_client.py | # Author Brendan Horan
# License : BSD 3-Clause
# Description : Get a NMEA setence from the NMEA faker sever
import urequests
import time
from machine import UART
class NMEA_Base:
def __init__(self,rx_pin, tx_pin,server_address):
uart = UART(1, 4800, timeout=0)
uart.init(4800, bits=8, parity=None, stop=1, r... | # Author Brendan Horan
# License : BSD 3-Clause
# Description : Get a NMEA setence from the NMEA faker sever
import urequests
import time
from machine import UART
class NMEA_Base:
def __init__(self,rx_pin, tx_pin,server_address):
uart = UART(1, 9600, timeout=0)
uart.init(9600, bits=8, parity=None, stop=1, r... | bsd-3-clause | Python |
520e65e3c3837a8e010386dec6649e6de870c956 | Remove unnecessary example code | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | python/ql/src/experimental/Security/CWE-943/NoSQLInjection-Good.py | python/ql/src/experimental/Security/CWE-943/NoSQLInjection-Good.py | # Annotated version
from mongosanitizer.sanitizer import sanitize
unsanitized_search = json.loads(request.args['search'])
sanitize(unsanitized_search)
db_results = mongo.db.user.find({'name': unsanitized_search})
| # Annotated version
from mongosanitizer.sanitizer import sanitize
unsanitized_search = json.loads(request.args['search'])
sanitize(unsanitized_search)
db_results = mongo.db.user.find({'name': unsanitized_search})
return db_results[0].keys()
| mit | Python |
8980c8309223b37c5566834fdacfa0ba142b16ff | Add register_as() to simplify replacing formatter implementations (if necessary). | hugeinc/behave-parallel | behave/formatter/formatters.py | behave/formatter/formatters.py | # -*- coding: utf-8 -*-
import sys
import codecs
# -----------------------------------------------------------------------------
# FORMATTER REGISTRY:
# -----------------------------------------------------------------------------
formatters = {}
def register_as(formatter_class, name):
"""
Register formatter... | # -*- coding: utf-8 -*-
import sys
import codecs
# -----------------------------------------------------------------------------
# FORMATTER REGISTRY:
# -----------------------------------------------------------------------------
formatters = {}
def register(formatter):
formatters[formatter.name] = formatter
... | bsd-2-clause | Python |
876b4a556bb17209195500cf9bf3f7397b88b6b3 | Convert lsof mapper to class | RedHatInsights/insights-core,RedHatInsights/insights-core | falafel/mappers/lsof.py | falafel/mappers/lsof.py | from falafel.core.plugins import mapper
from falafel.core import MapperOutput
FILTER_LIST = ['COMMAND', 'libssl', 'libcrypto', 'libssl.so', 'multipath']
class Splitter(object):
def __init__(self, lines):
self.lines = lines
# In some sosreport the lsof does not start with the header
self.... | from falafel.core.plugins import mapper
FILTER_LIST = ['COMMAND', 'libssl', 'libcrypto', 'libssl.so', 'multipath']
class Splitter(object):
def __init__(self, lines):
self.lines = lines
# In some sosreport the lsof does not start with the header
self.header_lines = [(i, l) for i, l in enu... | apache-2.0 | Python |
b8acce0168e73194bc4363c456cd55a941c06ac9 | Update image url generate for THUMBOR_SERVER | williamroot/opps,jeanmask/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,YACOWS/opps,opps/opps,jeanmask/opps,opps/opps,YACOWS/opps,YACOWS/opps,williamroot/opps,williamroot/opps,opps/opps,jeanmask/opps | opps/images/generate.py | opps/images/generate.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from libthumbor import CryptoURL
from django.conf import settings
crypto = CryptoURL(key=settings.THUMBOR_SECURITY_KEY)
def _remove_prefix(url, prefix):
if url.startswith(prefix):
return url[len(prefix):]
return url
def _remove_schema(url):
return ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from libthumbor import CryptoURL
from django.conf import settings
crypto = CryptoURL(key=settings.THUMBOR_SECURITY_KEY)
def _remove_prefix(url, prefix):
if url.startswith(prefix):
return url[len(prefix):]
return url
def _remove_schema(url):
return ... | mit | Python |
64ed6b12697d6d83f8653ef03ae283d601c38231 | Update MD5-DICT.py | thezakman/CTF-Scripts,thezakman/CTF-Scripts | MD5-DICT.py | MD5-DICT.py | from hashlib import md5
# by TheZakMan
# Exemplo de md5: 21232f297a57a5a743894a0e4a801fc3 (admin)
# dict: /usr/share/wordlists/rockyou.txt
print "[Md5 Dict-Cracker]"
print "| wordlist.txt |\n"
crackme = raw_input("MD5:")
# Carrega o dict rockyou no local default do kali
#f = open('wordlist.txt', 'r')
f = open('/usr... | from hashlib import md5
# by TheZakMan
# Exemplo de md5: 21232f297a57a5a743894a0e4a801fc3 (admin)
# dict: /usr/share/wordlists/rockyou.txt
print "[Md5 Dict-Cracker]"
print "| wordlist.txt |\n"
crackme = raw_input("MD5:")
#f = open('wordlist.txt', 'r')
f = open('/usr/share/wordlists/rockyou.txt', 'r')
words = [line... | artistic-2.0 | Python |
b0a943971bb7998d7461d0eeeb2b7e2e53b579c1 | correct version number - prep for 1.0 release! | mprefer/findingaids,mprefer/findingaids,emory-libraries/findingaids,emory-libraries/findingaids | findingaids/__init__.py | findingaids/__init__.py | __version_info__ = (1, 0, 0)
# Dot-connect all but the last. Last is dash-connected if not None.
__version__ = '.'.join(str(i) for i in __version_info__[:-1])
if __version_info__[-1] is not None:
__version__ += ('-%s' % (__version_info__[-1],))
#THIS IS DUPLICATE CODE FROM DWRANGLER AND SHOULD EVENTUALLY BE MOVE... | __version_info__ = (0, 1, 0)
# Dot-connect all but the last. Last is dash-connected if not None.
__version__ = '.'.join(str(i) for i in __version_info__[:-1])
if __version_info__[-1] is not None:
__version__ += ('-%s' % (__version_info__[-1],))
#THIS IS DUPLICATE CODE FROM DWRANGLER AND SHOULD EVENTUALLY BE MOVE... | apache-2.0 | Python |
6f5955170146576f862060d10baed8f60ca19a56 | work on VFs and otfs | googlefonts/gftools,googlefonts/gftools | bin/gftools-fix-weightclass.py | bin/gftools-fix-weightclass.py | #!/usr/bin/env python3
# Copyright 2018 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... | #!/usr/bin/env python3
# Copyright 2018 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... | apache-2.0 | Python |
a66868a743f5445410e52452a690884b4fc28236 | Increment version number to 0.0.5 | arecarn/dploy | dploy/version.py | dploy/version.py | """
This files purpose is to the be one place of truth for the version of this
project.
The variable __version__ is a string following the guidelines of semantic
versioning. The general guidelines are as follows
Given a version number MAJOR.MINOR.PATCH, increment the:
1. MAJOR version when you make incompatible API ... | """
This files purpose is to the be one place of truth for the version of this
project.
The variable __version__ is a string following the guidelines of semantic
versioning. The general guidelines are as follows
Given a version number MAJOR.MINOR.PATCH, increment the:
1. MAJOR version when you make incompatible API ... | mit | Python |
7b8d7def279604b625e2574bd82edc6dc9431825 | fix (un)subscribing | ev-agelos/Python-bookmarks,ev-agelos/Python-bookmarks,ev-agelos/Python-bookmarks | bookmarks/api/subscriptions.py | bookmarks/api/subscriptions.py | from flask import g
from flask.views import MethodView
from flask_login import login_required
from flask_smorest import Blueprint, abort
from bookmarks import db, csrf
from bookmarks.users.models import User
from .schemas import SubscriptionsSchema, SubscriptionsGETSchema, SubscriptionsPOSTSchema
subscriptions_api =... | from flask import g
from flask.views import MethodView
from flask_login import login_required
from flask_smorest import Blueprint, abort
from bookmarks import db, csrf
from bookmarks.users.models import User
from .schemas import SubscriptionsSchema, SubscriptionsGETSchema, SubscriptionsPOSTSchema
subscriptions_api =... | mit | Python |
91671be7ccc8481e66c4dc681c3f656883a3314d | add new version (#17735) | iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-keras-preprocessing/package.py | var/spack/repos/builtin/packages/py-keras-preprocessing/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 PyKerasPreprocessing(PythonPackage):
"""Utilities for working with image data, text data, ... | # 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 PyKerasPreprocessing(PythonPackage):
"""Utilities for working with image data, text data, ... | lgpl-2.1 | Python |
91a915b9d9e98cf08a379387fdc97f5f492a0245 | Bump version number. | tdda/tdda,tdda/tdda,tdda/tdda,tdda/tdda | __init__.py | __init__.py | __version__ = '0.1.09'
| __version__ = '0.1.08'
| mit | Python |
3a11e827302c451b838b696929a5b4bfb6bf1b21 | clear content | mamaddeveloper/telegrambot,mamaddeveloper/telegrambot,mamaddeveloper/teleadmin,mamaddeveloper/teleadmin | __init__.py | __init__.py | #tamer | mit | Python | |
ff61408b8ad36698bc7acd3e72cf37b5d870d6a8 | Move faker init inside insert method | openedoo/module_employee,openedoo/module_employee,openedoo/module_employee | __init__.py | __init__.py | import datetime
from openedoo.core.libs import (render_template, redirect, request,
session, blueprint)
from openedoo import db
from database import User
from flask import jsonify
from faker import Faker
from .forms import Login
module_employee = blueprint('module_employee', __name__,
... | import datetime
from openedoo.core.libs import (render_template, redirect, request,
session, blueprint)
from openedoo import db
from database import User
from flask import jsonify
from faker import Faker
from .forms import Login
fake = Faker()
module_employee = blueprint('module_employ... | mit | Python |
0e647f729d5df23ec7e42a560c9c73a639b29e50 | Update plugin's author list | appleseedhq/blenderseed,dictoon/blenderseed,dictoon/blenderseed,appleseedhq/blenderseed,jasperges/blenderseed | __init__.py | __init__.py |
#
# This source file is part of appleseed.
# Visit http://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2014-2017 The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this s... |
#
# This source file is part of appleseed.
# Visit http://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2014-2017 The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this s... | mit | Python |
13ff46a419ad4359286f14f8c6f4b3eae5152f05 | Fix get_document_by_id | selurvedu/robot_tests,bubanoid/robot_tests,SlaOne/robot_tests,kosaniak/robot_tests,Rzaporozhets/robot_tests,mykhaly/robot_tests,cleardevice/robot_tests,VadimShurhal/robot_tests.broker.aps,openprocurement/robot_tests | op_robot_tests/tests_files/brokers/openprocurement_client_helper.py | op_robot_tests/tests_files/brokers/openprocurement_client_helper.py | from openprocurement_client.client import Client
from openprocurement_client.utils import get_tender_id_by_uaid
from openprocurement_client.exceptions import IdNotFound
from restkit.errors import RequestFailed
from retrying import retry
import os
import urllib
def retry_if_request_failed(exception):
return isinst... | from openprocurement_client.client import Client
from openprocurement_client.utils import get_tender_id_by_uaid
from openprocurement_client.exceptions import IdNotFound
from restkit.errors import RequestFailed
from retrying import retry
import os
import urllib
def retry_if_request_failed(exception):
return isinst... | apache-2.0 | Python |
39842d3cd3d8fb46a1d258849a30e766d2f28b2f | correct usage of create_new_story in test code | mohrm/umklapp_site,mohrm/umklapp_site,mohrm/umklapp_site | umklapp/test.py | umklapp/test.py | from django.test import TestCase
from django.test.utils import override_settings
from umklapp.models import *
class UmklappTestCase(TestCase):
def addUsers(self):
self.users = []
for i in range(0,7):
u = User.objects.create_user(
"user%d" % i,
"test@exam... | from django.test import TestCase
from django.test.utils import override_settings
from umklapp.models import *
class UmklappTestCase(TestCase):
def addUsers(self):
self.users = []
for i in range(0,7):
u = User.objects.create_user(
"user%d" % i,
"test@exam... | mit | Python |
bab54bb76d36655475f16294a9bdf05c5ab0e710 | Initialize cabinet file widget as far as possible using the current file and folder | matthiask/django-cabinet,matthiask/django-cabinet,matthiask/django-cabinet | cabinet/fields.py | cabinet/fields.py | from django import forms
from django.contrib.admin.widgets import ForeignKeyRawIdWidget
from django.core.exceptions import ValidationError
from django.db import models
from django.urls import NoReverseMatch, reverse
from django.utils.text import Truncator
from django.utils.translation import ugettext_lazy as _
from ca... | from django import forms
from django.contrib.admin.widgets import ForeignKeyRawIdWidget
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cabinet.base_admin import folder_choices
from cabinet.models import Folder
class UploadForm(forms.Form):
folder = forms.ModelChoiceFiel... | bsd-3-clause | Python |
d4d801c246940904f959ad14dbdaefde51a672eb | tweak costs slightly | mandiant/capa,mandiant/capa | capa/optimizer.py | capa/optimizer.py | import logging
import capa.engine as ceng
import capa.features.common
logger = logging.getLogger(__name__)
def get_node_cost(node):
if isinstance(node, (capa.features.common.OS, capa.features.common.Arch, capa.features.common.Format)):
# we assume these are the most restrictive features:
# autho... | import logging
import capa.engine as ceng
import capa.features.common
logger = logging.getLogger(__name__)
def get_node_cost(node):
if isinstance(node, (capa.features.common.OS, capa.features.common.Arch, capa.features.common.Format)):
# we assume these are the most restrictive features:
# autho... | apache-2.0 | Python |
cde02a3129d276d02054e04c1b0a0b605b837d32 | Allow assembler to be imported from eodatasets3 root | GeoscienceAustralia/eo-datasets,jeremyh/eo-datasets,jeremyh/eo-datasets,GeoscienceAustralia/eo-datasets | eodatasets3/__init__.py | eodatasets3/__init__.py | # coding=utf-8
from __future__ import absolute_import
from ._version import get_versions
from .assemble import DatasetAssembler
REPO_URL = "https://github.com/GeoscienceAustralia/eo-datasets.git"
__version__ = get_versions()["version"]
del get_versions
__all__ = (DatasetAssembler, REPO_URL, __version__)
| # coding=utf-8
from __future__ import absolute_import
from ._version import get_versions
REPO_URL = "https://github.com/GeoscienceAustralia/eo-datasets.git"
__version__ = get_versions()["version"]
del get_versions
| apache-2.0 | Python |
391ffe647832a3e774d46e17e15d524bfbad7d02 | Fix symlinks | danielcorreia/dotfiles,danielcorreia/dotfiles | bootstrap.py | bootstrap.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import subprocess
commands = {
'ssh_key': "ssh-keygen -t rsa -b 4096 -C '{email}'"
}
DOTFILES = [
'.aliases',
'.bash_profile',
'.bash_prompt',
'.exports',
'.functions',
'.gitconfig',
'.gitignore',
'.hushlogin',
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import subprocess
commands = {
'ssh_key': "ssh-keygen -t rsa -b 4096 -C '{email}'"
}
DOTFILES = [
'.aliases',
'.bash_profile',
'.bash_prompt',
'.exports',
'.functions',
'.gitconfig',
'.gitignore',
'.hushlogin',
... | mit | Python |
011baa7816a550a883d270bd83116f8740901d4e | Update urls.py for newer Django import | theherk/django-theherk-updates | updates/urls.py | updates/urls.py | from django.conf.urls import *
urlpatterns = patterns(
'updates.views',
url(r'^$', 'index', name='index'),
)
| from django.conf.urls.defaults import *
urlpatterns = patterns(
'updates.views',
url(r'^$', 'index', name='index'),
)
| bsd-3-clause | Python |
f2b1814400b311b769e58a59c04f85e02e85bed4 | update rules_proto digest to 97bbeab (#1213) | googleapis/gapic-generator-typescript,googleapis/gapic-generator-typescript,googleapis/gapic-generator-typescript | repositories.bzl | repositories.bzl | load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def gapic_generator_typescript_repositories():
maybe(
http_archive,
name = "build_bazel_rules_nodejs",
sha256 = "c911b5bd8aee8b0498cc387cacdb5f917098ce477fb4182db07b0ef8a9e0... | load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def gapic_generator_typescript_repositories():
maybe(
http_archive,
name = "build_bazel_rules_nodejs",
sha256 = "c911b5bd8aee8b0498cc387cacdb5f917098ce477fb4182db07b0ef8a9e0... | apache-2.0 | Python |
bf98cc9591b36ccc911c550f62ab26b249b9ee86 | test logsumexp | followthesheep/galpy,followthesheep/galpy,jobovy/galpy,followthesheep/galpy,followthesheep/galpy,jobovy/galpy,jobovy/galpy,jobovy/galpy | nose/test_util.py | nose/test_util.py | #Test the functions in galpy/util/__init__.py
import numpy
def test_save_pickles():
import os
import tempfile
import pickle
from galpy.util import save_pickles
savethis= numpy.linspace(0.,100.,1001)
savefile, tmp_savefilename= tempfile.mkstemp()
try:
os.close(savefile) #Easier this ... | #Test the functions in galpy/util/__init__.py
import numpy
def test_save_pickles():
import os
import tempfile
import pickle
from galpy.util import save_pickles
savethis= numpy.linspace(0.,100.,1001)
savefile, tmp_savefilename= tempfile.mkstemp()
try:
os.close(savefile) #Easier this ... | bsd-3-clause | Python |
68513b33616ff2ef93972acf1b992e7b1a18c4d1 | Clarify names and comments, according to yanlend comments 26 May | pytest-dev/pytest-asyncio | tests/async_fixtures/test_async_fixtures_with_finalizer.py | tests/async_fixtures/test_async_fixtures_with_finalizer.py | import asyncio
import contextlib
import functools
import pytest
@pytest.mark.asyncio
async def test_module_with_event_loop_finalizer(port_with_event_loop_finalizer):
await asyncio.sleep(0.01)
assert port_with_event_loop_finalizer
@pytest.mark.asyncio
async def test_module_with_get_event_loop_finalizer(port_w... | import asyncio
import contextlib
import functools
import pytest
@pytest.mark.asyncio
async def test_module_with_event_loop_finalizer(port1):
await asyncio.sleep(0.01)
assert port1
@pytest.mark.asyncio
async def test_module_with_get_event_loop_finalizer(port2):
await asyncio.sleep(0.01)
assert port2
... | apache-2.0 | Python |
1472acdc54687c2797c8637f4f1917d20d5ca069 | add workaround for https://github.com/qbittorrent/qBittorrent/issues/6860 | rain87/rutracker-keeper-suite,rain87/rutracker-keeper-suite | rutracker_ks/qbt_api.py | rutracker_ks/qbt_api.py | import logging
from bencode import bdecode
import utils
import os
import requests
LOGGER = logging.getLogger(__name__)
def is_torrent_completed(sha1):
with open('/home/rain87/.local/share/data/qBittorrent/BT_backup/{}.fastresume'.format(sha1), 'rb') as f:
fresume = bdecode(f.read())
return fresume['... | import logging
from bencode import bdecode
import utils
import os
import requests
LOGGER = logging.getLogger(__name__)
def is_torrent_completed(sha1):
with open('/home/rain87/.local/share/data/qBittorrent/BT_backup/{}.fastresume'.format(sha1), 'rb') as f:
fresume = bdecode(f.read())
return fresume['... | mit | Python |
4cf073d8f96a23f1f7262d6927dcf529107cd4b6 | Fix wrong index for Minutely | dvdme/forecastiopy | forecastiopy/FIOMinutely.py | forecastiopy/FIOMinutely.py | # -*- coding: utf-8 -*-
"""
This module recieves an ForecastIO object and holds the minutely weather
conditions. It has one class for this purpose.
"""
class FIOMinutely(object):
"""
This class recieves an ForecastIO object and holds the minutely weather
conditions. It has one class for this purpose.
"... | # -*- coding: utf-8 -*-
"""
This module recieves an ForecastIO object and holds the minutely weather
conditions. It has one class for this purpose.
"""
class FIOMinutely(object):
"""
This class recieves an ForecastIO object and holds the minutely weather
conditions. It has one class for this purpose.
"... | epl-1.0 | Python |
bb71159d11883f37df09d3095ac461751f599cf5 | Use json.loads() instead of resp.json() for Ubuntu 12.04 compat | dstufft/psf-salt,caktus/psf-salt,zware/psf-salt,zooba/psf-salt,python/psf-salt,python/psf-salt,caktus/psf-salt,zware/psf-salt,zooba/psf-salt,caktus/psf-salt,zware/psf-salt,dstufft/psf-salt,zware/psf-salt,python/psf-salt,dstufft/psf-salt,zooba/psf-salt,python/psf-salt | salt/_modules/consul.py | salt/_modules/consul.py | import json
try:
import requests
except ImportError:
requests = None
def __virtual__():
if requests is None:
return False, ["requests must be installed and importable."]
return True
def cluster_ready():
# Determine if we have at least one server
try:
resp = requests.get("htt... | import json
try:
import requests
except ImportError:
requests = None
def __virtual__():
if requests is None:
return False, ["requests must be installed and importable."]
return True
def cluster_ready():
# Determine if we have at least one server
try:
resp = requests.get("htt... | mit | Python |
be423ccdead4269b98c00344ff34d8188990dc01 | Fix notification whitelisting as reported in #12 | flakas/reconbot | reconbot/tasks.py | reconbot/tasks.py | import sys, traceback, datetime
from reconbot.notificationprinters.esi.slack import Slack as ESISlack
from reconbot.notificationprinters.esi.discord import Discord as ESIDiscord
from reconbot.esi import ESI
def esi_notification_task(notification_options, api_queue, printer, notifier):
MAX_NOTIFICATION_AGE_IN_SECO... | import sys, traceback, datetime
from reconbot.notificationprinters.esi.slack import Slack as ESISlack
from reconbot.notificationprinters.esi.discord import Discord as ESIDiscord
from reconbot.esi import ESI
def esi_notification_task(notification_options, api_queue, printer, notifier):
MAX_NOTIFICATION_AGE_IN_SECO... | mit | Python |
02b2a17210004c119d43d577d560e12bf7e6b635 | Add test_parametric.test_assembler_init | tkf/compapp | compapp/tests/test_parametric.py | compapp/tests/test_parametric.py | import unittest
from ..core import Parametric
class MyParametric(Parametric):
i = 1
x = 2.0
class nested(Parametric):
a = 100
b = 200
class TestMixObject(unittest.TestCase):
class AutoMixed(MyParametric):
class nested(object):
a = -1
def test_default_value... | import unittest
from ..core import Parametric
class MyParametric(Parametric):
i = 1
x = 2.0
class nested(Parametric):
a = 100
b = 200
class TestMixObject(unittest.TestCase):
class AutoMixed(MyParametric):
class nested(object):
a = -1
def test_default_value... | bsd-2-clause | Python |
98f8a8fb51ae539aad6a3e2faebced4b806c3f0c | Build random path using os.path.join | o-zander/django-filer,nimbis/django-filer,nimbis/django-filer,webu/django-filer,divio/django-filer,matthiask/django-filer,skirsdeda/django-filer,stefanfoulis/django-filer,sopraux/django-filer,Flight/django-filer,sopraux/django-filer,belimawr/django-filer,matthiask/django-filer,o-zander/django-filer,DylannCordel/django-... | filer/utils/generate_filename.py | filer/utils/generate_filename.py | from __future__ import unicode_literals
try:
from django.utils.encoding import force_text
except ImportError:
# Django < 1.5
from django.utils.encoding import force_unicode as force_text
from django.utils.timezone import now
from filer.utils.files import get_valid_filename
import os
def by_date(instance,... | from __future__ import unicode_literals
try:
from django.utils.encoding import force_text
except ImportError:
# Django < 1.5
from django.utils.encoding import force_unicode as force_text
from django.utils.timezone import now
from filer.utils.files import get_valid_filename
import os
def by_date(instance,... | bsd-3-clause | Python |
c7aafb64040522f5e3e68cb6fcbf7cb7ec67d3fc | Fix EVPobject layout in Python 3.5.0 through 3.5.2 | kislyuk/rehash | rehash/structs.py | rehash/structs.py | from __future__ import absolute_import, division, print_function, unicode_literals
from ssl import OPENSSL_VERSION
from sys import version_info as PYTHON_VERSION
from ctypes import c_void_p, POINTER, Structure, c_int, c_ulong, c_char, c_size_t, c_ssize_t, py_object
PyObject_HEAD = [
('ob_refcnt', c_size_t),
(... | from __future__ import absolute_import, division, print_function, unicode_literals
from ssl import OPENSSL_VERSION
from sys import version_info as PYTHON_VERSION
from ctypes import c_void_p, POINTER, Structure, c_int, c_ulong, c_char, c_size_t, c_ssize_t, py_object
PyObject_HEAD = [
('ob_refcnt', c_size_t),
(... | apache-2.0 | Python |
f7bd6c6410c97bacbe64216443bdc95043845f3a | Use parallel assignment instead of tuple indices in loader. | vyos-legacy/vyconfd,vyos-legacy/vyconfd | vyconf/configfile/curly/loader.py | vyconf/configfile/curly/loader.py | # vyconf.configfile.curly.loader: config loader that uses the AST
# produced by curly parser
#
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License... | # vyconf.configfile.curly.loader: config loader that uses the AST
# produced by curly parser
#
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License... | lgpl-2.1 | Python |
de8b55200e8f7e6ad99be005444f56fd4ff9f736 | Fix bad test | lgp171188/fjord,lgp171188/fjord,mozilla/fjord,staranjeet/fjord,mozilla/fjord,Ritsyy/fjord,rlr/fjord,staranjeet/fjord,lgp171188/fjord,mozilla/fjord,DESHRAJ/fjord,hoosteeno/fjord,DESHRAJ/fjord,DESHRAJ/fjord,Ritsyy/fjord,staranjeet/fjord,staranjeet/fjord,hoosteeno/fjord,Ritsyy/fjord,lgp171188/fjord,hoosteeno/fjord,mozilla... | fjord/base/tests/test_browser.py | fjord/base/tests/test_browser.py | import json
import os
from django import test
from nose.tools import eq_
from fjord.base import browsers, middleware
class TestUserAgentDetection(object):
def check_ua(self, case):
"""Check and individual user agent test case."""
parsed = browsers.parse_ua(case['user_agent'])
assert(pa... | import json
import os
from django import test
from nose.tools import eq_
from fjord.base import browsers, middleware
class TestUserAgentDetection(object):
def check_ua(self, case):
"""Check and individual user agent test case."""
parsed = browsers.parse_ua(case['user_agent'])
assert(pa... | bsd-3-clause | Python |
fd8ab2de894b720f99c32f980d4579562d29a538 | bump version number | bashu/fluentcms-publishing,bashu/fluentcms-publishing,bashu/fluentcms-publishing | fluentcms_publishing/__init__.py | fluentcms_publishing/__init__.py | __version__ = "1.2.4"
default_app_config = '%s.apps.AppConfig' % __name__
| __version__ = "1.2.3"
default_app_config = '%s.apps.AppConfig' % __name__
| mit | Python |
91fc0c304ef7ce0220b22f1c49bf3151ce0dd9ea | Remove code duplication in method_choices | elegion/djangodash2012,elegion/djangodash2012 | fortuitus/feditor/models_base.py | fortuitus/feditor/models_base.py | from autoslug.fields import AutoSlugField
from django.db import models
from fortuitus.feditor.dbfields import ParamsField
class Method:
OPTIONS = 'OPTIONS'
HEAD = 'HEAD'
GET = 'GET'
POST = 'POST'
PUT = 'PUT'
DELETE = 'DELETE'
PATCH = 'PATCH'
method_choices = [(f, f) for f in dir(Method)... | from autoslug.fields import AutoSlugField
from django.db import models
from fortuitus.feditor.dbfields import ParamsField
class Method:
GET = 'get'
POST = 'post'
method_choices = (
(Method.GET, 'get'),
(Method.POST, 'post'),
)
class TestProject(models.Model):
"""
Test project.
Co... | mit | Python |
db6c48a3760d8d7cc98e3355e4a2be6d98939e66 | Allow metrics to start with a braces expression | tmm1/graphite,tmm1/graphite,tmm1/graphite,tmm1/graphite,tmm1/graphite | webapp/graphite/render/grammar.py | webapp/graphite/render/grammar.py | from graphite.thirdparty.pyparsing import *
ParserElement.enablePackrat()
grammar = Forward()
expression = Forward()
# Literals
intNumber = Combine(
Optional('-') + Word(nums)
)('integer')
floatNumber = Combine(
Optional('-') + Word(nums) + Literal('.') + Word(nums)
)('float')
aString = quotedString('string')
... | from graphite.thirdparty.pyparsing import *
ParserElement.enablePackrat()
grammar = Forward()
expression = Forward()
# Literals
intNumber = Combine(
Optional('-') + Word(nums)
)('integer')
floatNumber = Combine(
Optional('-') + Word(nums) + Literal('.') + Word(nums)
)('float')
aString = quotedString('string')
... | apache-2.0 | Python |
f8e375bdc07b6fdefdae589f2d75c4ec0f5f3864 | Fix result loading for novel mutations | reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/ActiveDriverDB,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualist... | website/search/mutation_result.py | website/search/mutation_result.py | from models import Protein, Mutation
from database import get_or_create
class SearchResult:
def __init__(self, protein, mutation, is_mutation_novel, type, **kwargs):
self.protein = protein
self.mutation = mutation
self.is_mutation_novel = is_mutation_novel
self.type = type
... | from models import Protein, Mutation
class SearchResult:
def __init__(self, protein, mutation, is_mutation_novel, type, **kwargs):
self.protein = protein
self.mutation = mutation
self.is_mutation_novel = is_mutation_novel
self.type = type
self.meta_user = None
self... | lgpl-2.1 | Python |
f387df4e1cdcd56da18172a3742042b5e4ddc3ef | Refactor code to enable submitting to multiple Reddits | djc/pmf | bot.py | bot.py | import praw, feedparser
import urlparse
import ident
import sys, os, urllib2
UA = 'MozillaPlanetFeeder-0.1, by /u/Manuzhai'
HEADERS = {'User-Agent': 'MozillaPlanetFeeder-0.1'}
REDIRECT_URI = 'http://dirkjan.ochtman.nl/reddit/'
SOURCE = 'http://planet.mozilla.org/atom.xml'
DEBUG = os.isatty(sys.stdout.fileno())
REDDITS... | import praw, feedparser
import urlparse
import ident
import sys, os, urllib2
UA = 'MozillaPlanetFeeder-0.1, by /u/Manuzhai'
HEADERS = {'User-Agent': 'MozillaPlanetFeeder-0.1'}
REDIRECT_URI = 'http://dirkjan.ochtman.nl/reddit/'
SOURCE = 'http://planet.mozilla.org/atom.xml'
DEBUG = os.isatty(sys.stdout.fileno())
def re... | mit | Python |
60db2a3056970a276c65d2d9d5e42f19c3d5c537 | Add I Think Yes Feature | aver803bath5/igene_bot,iGene/igene_bot | bot.py | bot.py | # -*- coding: utf-8 -*-
from telegram.ext import Updater
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,
ConversationHandler)
from bs4 import BeautifulSoup
from ConfigParser import RawConfigParser
import logging
import re
import requests
logging.basi... | # -*- coding: utf-8 -*-
from telegram.ext import Updater
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,
ConversationHandler)
from bs4 import BeautifulSoup
from ConfigParser import RawConfigParser
import logging
import re
import requests
logging.basi... | mit | Python |
9411ddb9a96b261c82682739e131e7456773a7be | Change int to value for is_number | diath/pyfsw,diath/pyfsw,diath/pyfsw | pyfsw/helpers.py | pyfsw/helpers.py | from flask import redirect, url_for, session, request
from functools import wraps
from pyfsw import app, db
from pyfsw import Account, Library, Guild, GuildMembership, GuildRank
from pyfsw import PlayerItem
from pyfsw import ADMIN_ACCOUNT_TYPE
def login_required(f):
@wraps(f)
def decorated(*args, **kwargs):
if 'a... | from flask import redirect, url_for, session, request
from functools import wraps
from pyfsw import app, db
from pyfsw import Account, Library, Guild, GuildMembership, GuildRank
from pyfsw import PlayerItem
from pyfsw import ADMIN_ACCOUNT_TYPE
def login_required(f):
@wraps(f)
def decorated(*args, **kwargs):
if 'a... | mit | Python |
e15d6f4470820c661f64bdea17544c404c80d15b | Add abaility to set bot source IP address. | carwyn/veillance,carwyn/veillance,carwyn/veillance,carwyn/veillance | bot.py | bot.py | import time
import functools
import httplib
import urllib2
#BOT_SITE = "http://news.bbc.co.uk/"
BOT_SITE = "http://news.bbc.co.uk/"
#SOURCE_IP = "10.42.0.104"
SOURCE_IP = "10.42.0.188"
SLEEP_TIME = 60
class BoundHTTPHandler(urllib2.HTTPHandler):
def __init__(self, source_address=None, debuglevel=0):
ur... | import urllib2
import time
BOT_SITE = "http://news.bbc.co.uk/"
SLEEP_TIME = 60
def main():
while True:
f = urllib2.urlopen(BOT_SITE)
content = f.readlines()
print f.getcode(), f.geturl(), "Length: ", len(content)
time.sleep(SLEEP_TIME)
if __name__ == "__main__": main()... | bsd-3-clause | Python |
ab366f3fceb98aaf7c88c4fcd85165a185b0e8fe | Improve description | pyupio/changelogs | changelogs/cli.py | changelogs/cli.py | # -*- coding: utf-8 -*-
import sys
import changelogs
from packaging.version import parse
import argparse
import logging
def main():
parser = argparse.ArgumentParser(
description='A changelog finder and parser for packages available on pypi, npm and rubygems.'
)
parser.add_argument("package", help=... | # -*- coding: utf-8 -*-
import sys
import changelogs
from packaging.version import parse
import argparse
import logging
def main():
parser = argparse.ArgumentParser(
description='bla'
)
parser.add_argument("package", help="package name")
parser.add_argument("vendor", help="vendor (pypi, npm, g... | mit | Python |
b97db335bfa8e2f8ff124109bc27f32d243a419c | Update version number | johannfaouzi/pyts | pyts/__init__.py | pyts/__init__.py | """Time series transformation and classification module for Python.
pyts is a Python package for time series classification.
It aims to make time series classification easily accessible by providing
preprocessing and utility tools, and implementations of state-of-the-art
algorithms. Most of these algorithms transform ... | """Time series transformation and classification module for Python.
pyts is a Python package for time series classification.
It aims to make time series classification easily accessible by providing
preprocessing and utility tools, and implementations of state-of-the-art
algorithms. Most of these algorithms transform ... | bsd-3-clause | Python |
87a5f785dffca7ddf9f734451494f251d553c5a8 | Exclude current addon in ComponentRegistryCase setup | OCA/connector,OCA/connector | connector/tests/test_listener.py | connector/tests/test_listener.py | # -*- coding: utf-8 -*-
# Copyright 2017 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
import mock
from odoo.tools import frozendict
from odoo.addons.component.core import Component
from odoo.addons.component_event.core import EventWorkContext
from odoo.addons.component_event.compo... | # -*- coding: utf-8 -*-
# Copyright 2017 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
import mock
from odoo.tools import frozendict
from odoo.addons.component.core import Component
from odoo.addons.component_event.core import EventWorkContext
from odoo.addons.component_event.compo... | agpl-3.0 | Python |
938eb219435b6d2dc49e76b68f54df822a94149a | Bump to version 0.45.1 | nerevu/riko,nerevu/riko | riko/__init__.py | riko/__init__.py | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko
~~~~
Provides functions for analyzing and processing streams of structured data
Examples:
basic usage::
>>> from itertools import chain
>>> from functools import partial
>>> from riko.modules import itembuilder, strreplace
... | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko
~~~~
Provides functions for analyzing and processing streams of structured data
Examples:
basic usage::
>>> from itertools import chain
>>> from functools import partial
>>> from riko.modules import itembuilder, strreplace
... | mit | Python |
9089b883e0b789d9dbeec89553076d9968f04a51 | Bump to version 0.54.0 | nerevu/riko,nerevu/riko | riko/__init__.py | riko/__init__.py | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko
~~~~
Provides functions for analyzing and processing streams of structured data
Examples:
basic usage::
>>> from itertools import chain
>>> from functools import partial
>>> from riko.modules import itembuilder, strreplace
... | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko
~~~~
Provides functions for analyzing and processing streams of structured data
Examples:
basic usage::
>>> from itertools import chain
>>> from functools import partial
>>> from riko.modules import itembuilder, strreplace
... | mit | Python |
213972aa88495db5fb5f60e4175e42bc84ab4141 | Correct retry behavior | getsentry/freight,rshk/freight,rshk/freight,rshk/freight,getsentry/freight,jkimbo/freight,klynton/freight,klynton/freight,jkimbo/freight,jkimbo/freight,rshk/freight,jkimbo/freight,getsentry/freight,getsentry/freight,klynton/freight,klynton/freight,getsentry/freight | ds/tasks/base.py | ds/tasks/base.py | from __future__ import absolute_import
from ds.config import celery, db
class ExtendedTask(celery.Task):
retry_on = (Exception, )
def __call__(self, *args, **kwargs):
try:
rv = super(ExtendedTask, self).__call__(*args, **kwargs)
except self.retry_on as exc:
db.session... | from __future__ import absolute_import
from celery.task import current
from ds.config import celery, db
class ExtendedTask(celery.Task):
retry_on = (Exception, )
def __call__(self, *args, **kwargs):
try:
rv = super(ExtendedTask, self).__call__(*args, **kwargs)
except self.retry_... | apache-2.0 | Python |
56d6edcb75197f830faa6af9296aa2fdb40ea26b | Test ColorBackgroundGenerator | erykoff/redmapper,erykoff/redmapper | tests/test_color_background.py | tests/test_color_background.py | from __future__ import division, absolute_import, print_function
from past.builtins import xrange
import unittest
import numpy.testing as testing
import numpy as np
import fitsio
import tempfile
import os
from redmapper import ColorBackground
from redmapper import ColorBackgroundGenerator
from redmapper import Config... | from __future__ import division, absolute_import, print_function
from past.builtins import xrange
import unittest
import numpy.testing as testing
import numpy as np
import fitsio
from redmapper import ColorBackground
class ColorBackgroundTestCase(unittest.TestCase):
def runTest(self):
file_name = 'test_... | apache-2.0 | Python |
e5c6427f95242b6d4627784d83843cf6562a4b48 | Test for custom character blacklist config option | m42e/tvnamer,lahwaacz/tvnamer,dbr/tvnamer | tests/test_configfunctional.py | tests/test_configfunctional.py | #!/usr/bin/env python
#encoding:utf-8
#author:dbr/Ben
#project:tvnamer
#repository:http://github.com/dbr/tvnamer
#license:Creative Commons GNU GPL v2
# http://creativecommons.org/licenses/GPL/2.0/
"""Tests various configs load correctly
"""
from functional_runner import run_tvnamer, verify_out_data
from nose.plugins.... | #!/usr/bin/env python
#encoding:utf-8
#author:dbr/Ben
#project:tvnamer
#repository:http://github.com/dbr/tvnamer
#license:Creative Commons GNU GPL v2
# http://creativecommons.org/licenses/GPL/2.0/
"""Tests various configs load correctly
"""
from functional_runner import run_tvnamer, verify_out_data
from nose.plugins.... | unlicense | Python |
6137db4da275bbce4560263e865cf62f893e3df1 | Update the twisted test with the new spec | mlundblad/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,community-ssu/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,community-ssu/telepathy-gabble,jku/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,community-ssu/tele... | tests/twisted/test-location.py | tests/twisted/test-location.py | from gabbletest import exec_test, make_result_iq
from servicetest import call_async
def test(q, bus, conn, stream):
# hack
import dbus
conn.interfaces['Location'] = \
dbus.Interface(conn, 'org.freedesktop.Telepathy.Connection.Interface.Location.DRAFT')
conn.Connect()
q.expect('dbus-signal'... | from gabbletest import exec_test, make_result_iq
from servicetest import call_async
def test(q, bus, conn, stream):
# hack
import dbus
conn.interfaces['Location'] = \
dbus.Interface(conn, 'org.freedesktop.Telepathy.Connection.Interface.Location.DRAFT')
conn.Connect()
q.expect('dbus-signal'... | lgpl-2.1 | Python |
654981e291a9c80387bbeb72e4558d284fb04059 | Integrate LLVM at llvm/llvm-project@cb65419b1ac0 | tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "cb65419b1ac05c3020dd05b64db183712235d2ff"
LLVM_SHA256 = "95fcd4af4b21b6cb2ceda9e45d22c6b0014585258cc21727b5c864f7e9804fab"
tfrt_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "bc56620b8b765b5720dbc1849511fb783e05b8cc"
LLVM_SHA256 = "dc996e2f96576274ddb089162c14afee173ff43cc6b1c8f76206a30f379087f0"
tfrt_http_archive(
... | apache-2.0 | Python |
1f7eb6431506c67281f6d955a044102601addc52 | Integrate LLVM at llvm/llvm-project@c490f8feb71e | tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "c490f8feb71e837dd7011e7a7d8a7928507c9c76"
LLVM_SHA256 = "687aae26e7cf262da4dc7f3bd426ccc6cbcc74485a10d2398d3f53b84c97bd7e"
tfrt_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "6c654b51983543dbd65736e992bb1cbe50b4336e"
LLVM_SHA256 = "7b5538677a4072300477d6356c4fb81bf68b60844db58fb2b14782a989fbaa0d"
tfrt_http_archive(
... | apache-2.0 | Python |
725f971ed160ac2fc1ebadcc0991fba3e5d1516f | Switch to CBV for subscribing | dominicrodger/tinyblog,dominicrodger/tinyblog | tinyblog/views/subscription.py | tinyblog/views/subscription.py | from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.views.generic import DetailView, FormView
from tinyblog.forms import EmailSubscriptionForm, EmailSubscriber
... | from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.views.generic import DetailView
from tinyblog.forms import EmailSubscriptionForm, EmailSubscriber
from tinyb... | bsd-3-clause | Python |
bcb121bd0350afd0cf37bf3f196d994c117a01b2 | Update purifycss.py | adityahase/frappe,vjFaLk/frappe,almeidapaulopt/frappe,vjFaLk/frappe,StrellaGroup/frappe,adityahase/frappe,vjFaLk/frappe,mhbu50/frappe,mhbu50/frappe,yashodhank/frappe,yashodhank/frappe,saurabh6790/frappe,frappe/frappe,frappe/frappe,mhbu50/frappe,adityahase/frappe,mhbu50/frappe,almeidapaulopt/frappe,saurabh6790/frappe,St... | frappe/website/purifycss.py | frappe/website/purifycss.py | from __future__ import print_function, unicode_literals
'''
Check for unused CSS Classes
sUpdate source and target apps below and run from CLI
bench --site [sitename] execute frappe.website.purifycss.purify.css
'''
import frappe, re, os
source = frappe.get_app_path('frappe_theme', 'public', 'less', 'frappe_theme.... | from __future__ import print_funciton, unicode_literals
'''
Check for unused CSS Classes
sUpdate source and target apps below and run from CLI
bench --site [sitename] execute frappe.website.purifycss.purify.css
'''
import frappe, re, os
source = frappe.get_app_path('frappe_theme', 'public', 'less', 'frappe_theme.... | mit | Python |
27b2eef55599f87ed07d9e68b3cee82d19a65917 | Add not_in filter | lotrekagency/djlotrek,lotrekagency/djlotrek | templatetags/djlotrek_filters.py | templatetags/djlotrek_filters.py | from django import template
register = template.Library()
@register.filter(name='label')
def label(queryset, args):
identifier,attr = args.split(',')
filtered_objects = queryset.filter(identifier=identifier)
if len(filtered_objects):
return getattr(filtered_objects[0], attr)
return ''
@reg... | from django import template
register = template.Library()
@register.filter(name='label')
def label(queryset, args):
identifier,attr = args.split(',')
filtered_objects = queryset.filter(identifier=identifier)
if len(filtered_objects):
return getattr(filtered_objects[0], attr)
return ''
@reg... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.