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 |
|---|---|---|---|---|---|---|---|---|
206991a376c0d7ee9d431c82323b1da72593708d | Revert "Improve urls formatting." | Imaginashion/cloud-vision,Imaginashion/cloud-vision,extremoburo/django-jquery-file-upload,Imaginashion/cloud-vision,sigurdga/django-jquery-file-upload,indrajithi/mgc-django,Imaginashion/cloud-vision,extremoburo/django-jquery-file-upload,extremoburo/django-jquery-file-upload,indrajithi/mgc-django,Imaginashion/cloud-visi... | fileupload/urls.py | fileupload/urls.py | # encoding: utf-8
from django.conf.urls import patterns, url
from fileupload.views import BasicVersionCreateView, BasicPlusVersionCreateView, PictureCreateView, AngularVersionCreateView, jQueryVersionCreateView, PictureDeleteView
urlpatterns = patterns('',
(r'^basic/$', BasicVersionCreateView.as_view(), {}, 'uploa... | # encoding: utf-8
from django.conf.urls import patterns, url
from .views import (BasicVersionCreateView, BasicPlusVersionCreateView,
PictureCreateView, AngularVersionCreateView, jQueryVersionCreateView,
PictureDeleteView, PictureListView)
urlpatterns = patterns('',
url(
r'^basic/$',
BasicVe... | mit | Python |
cf972237100aa556a748cc84732b2e268a341dc9 | Remove demo string | kentmacdonald2/Sas-Problem-Fixer | find_duplicates.py | find_duplicates.py | def find_problems(given_list = ["12345678a", "12345678b", "12345678c", "abcdefghi1","123"],print_me=True):
"""
Scans a list of strings to find any cases where the first 8 characters are matching
:param given_list: A string or list of strings to scan (optional, will demo otherwise)
:param print_me: Boole... | def find_problems(given_list = ["12345678a", "12345678b", "12345678c", "abcdefghi1","123"],print_me=True):
"""
Scans a list of strings to find any cases where the first 8 characters are matching
:param given_list: A string or list of strings to scan (optional, will demo otherwise)
:param print_me: Boole... | mit | Python |
6f24dbf7b9da9cfe3565c697e8615949bd39cfcc | Fix celery tasks logging and add shortcut for app context | Infinidat/lanister,vmalloc/mailboxer,getslash/mailboxer,vmalloc/mailboxer,vmalloc/mailboxer,getslash/mailboxer,Infinidat/lanister,getslash/mailboxer | flask_app/tasks.py | flask_app/tasks.py | from __future__ import absolute_import
import functools
import os
import sys
import logbook
from celery import Celery
from celery.signals import after_setup_logger, after_setup_task_logger
from .app import create_app
_logger = logbook.Logger(__name__)
queue = Celery('tasks', broker='redis://localhost')
queue.con... | from __future__ import absolute_import
from logging import Formatter
from logbook.compat import LoggingHandler
from logging.handlers import SysLogHandler
from celery import Celery
from celery.signals import after_setup_task_logger, after_setup_logger
import os
queue = Celery('tasks', broker='redis://localhost')
queu... | bsd-3-clause | Python |
571fc0ace1712e772baf08d60a25a33b6c231f76 | test sublime | pouyana/teireader,pouyana/teireader,pouyana/teireader,pouyana/teireader,pouyana/teireader,pouyana/teireader | parser.py | parser.py | #!#/usr/bin/env python
# -*- coding: utf-8 -*- | #!#/usr/bin/env python
# -*- coding: utf-8 -*-
hi | mit | Python |
38357d8d6043561084c8f7469ee11d373878cf3b | Fix spacing in jnp tile | e3nn/e3nn-jax,e3nn/e3nn-jax | e3nn_jax/_dropout.py | e3nn_jax/_dropout.py | import jax
import jax.numpy as jnp
import haiku as hk
from e3nn_jax import Irreps
class Dropout(hk.Module):
"""Equivariant Dropout
:math:`A_{zai}` is the input and :math:`B_{zai}` is the output where
- ``z`` is the batch index
- ``a`` any non-batch and non-irrep index
- ``i`` is the irrep index, ... | import jax
import jax.numpy as jnp
import haiku as hk
from e3nn_jax import Irreps
class Dropout(hk.Module):
"""Equivariant Dropout
:math:`A_{zai}` is the input and :math:`B_{zai}` is the output where
- ``z`` is the batch index
- ``a`` any non-batch and non-irrep index
- ``i`` is the irrep index, ... | apache-2.0 | Python |
e48e0654e1bbed6c3e49835c5a40356fa6127fe5 | Make the REPL loop. | darikg/pgcli,j-bennet/pgcli,w4ngyi/pgcli,bitmonk/pgcli,bitmonk/pgcli,lk1ngaa7/pgcli,dbcli/vcli,stuartquin/pgcli,joewalnes/pgcli,bitemyapp/pgcli,koljonen/pgcli,d33tah/pgcli,n-someya/pgcli,dbcli/pgcli,MattOates/pgcli,janusnic/pgcli,lk1ngaa7/pgcli,janusnic/pgcli,bitemyapp/pgcli,suzukaze/pgcli,nosun/pgcli,TamasNo1/pgcli,w4... | pg-cli.py | pg-cli.py | #!/usr/bin/env python
from __future__ import unicode_literals
from prompt_toolkit import CommandLineInterface, AbortAction, Exit
from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.line import Line
from prompt_toolkit.layout import Layout
from prompt_toolkit.layout.prompt import DefaultProm... | #!/usr/bin/env python
from __future__ import unicode_literals
from prompt_toolkit import CommandLineInterface
from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.line import Line
from prompt_toolkit.layout import Layout
from prompt_toolkit.layout.prompt import DefaultPrompt
from prompt_tool... | bsd-3-clause | Python |
67c110e7e7d64727de66cc992fb9b21bf75d4dfc | fix url to image because in expression like this: for x in Model.objects[:10]: print(x.image) then x.image get incorrect url without THUMBOR_HOST | gerasim13/libthumbor | libthumbor/flask/field.py | libthumbor/flask/field.py | from werkzeug.datastructures import FileStorage
from urllib.parse import urlparse, urljoin
from flask import current_app
from mongoengine.base import BaseField
from libthumbor.crypto import CryptoURL
from mongoengine import *
import requests
crypto_url = None
cla... | from werkzeug.datastructures import FileStorage
from urllib.parse import urlparse, urljoin
from flask import current_app
from mongoengine.base import BaseField
from libthumbor.crypto import CryptoURL
from mongoengine import *
import requests
crypto_url = None
cla... | mit | Python |
d092c8de1bc018968eb87137c9003aa4b5a43e39 | delete useless if..elif.. | ccagg/xunlei,windygu/xunlei-lixian,davies/xunlei-lixian,liujianpc/xunlei-lixian,xieyanhao/xunlei-lixian,sndnvaps/xunlei-lixian,iambus/xunlei-lixian,myself659/xunlei-lixian,GeassDB/xunlei-lixian,wangjun/xunlei-lixian,wogong/xunlei-lixian,sdgdsffdsfff/xunlei-lixian | lixian_commands/delete.py | lixian_commands/delete.py |
from lixian import XunleiClient
from lixian_commands.util import *
from lixian_cli_parser import *
from lixian_encoding import default_encoding
from lixian_colors import colors
import lixian_help
import lixian_query
@command_line_parser(help=lixian_help.delete)
@with_parser(parse_login)
@with_parser(parse_colors)
@co... |
from lixian import XunleiClient
from lixian_commands.util import *
from lixian_cli_parser import *
from lixian_encoding import default_encoding
from lixian_colors import colors
import lixian_help
import lixian_query
@command_line_parser(help=lixian_help.delete)
@with_parser(parse_login)
@with_parser(parse_colors)
@co... | mit | Python |
a5eb5450a91eb43a2227bdc5f3d25555faaf8544 | Add hypen as delimiter | suclearnub/discordgrapher | scrape.py | scrape.py | import discord
import asyncio
from tqdm import tqdm
import argparse
parser = argparse.ArgumentParser(description='Discord channel scraper')
requiredNamed = parser.add_argument_group('Required arguments:')
requiredNamed.add_argument('-c', '--channel', type=str, help='Channel to scrape. Requires the channel ID.',... | import discord
import asyncio
from tqdm import tqdm
import argparse
parser = argparse.ArgumentParser(description='Discord channel scraper')
requiredNamed = parser.add_argument_group('Required arguments:')
requiredNamed.add_argument('-c', '--channel', type=str, help='Channel to scrape. Requires the channel ID.',... | mit | Python |
0af3258cd3a6ad4a75aad8c967d72f7c1b755624 | Refactor to use with-block | kentoj/python-fundamentals | series.py | series.py | """Read and print an integer series."""
import sys
def read_series(filename):
with open(filename, mode='rt', encoding='utf-8') as f:
return [int(line.strip()) for line in f]
def main(filename):
print(read_series(filename))
if __name__ == '__main__':
main(sys.argv[1])
| """Read and print an integer series."""
import sys
def read_series(filename):
try:
f = open(filename, mode='rt', encoding='utf-8')
return [int(line.strip()) for line in f]
finally:
f.close()
def main(filename):
print(read_series(filename))
if __name__ == '__main__':
main(s... | mit | Python |
fb02617b29cab97a70a1a11b0d3b7b62b834aa3b | Structure for sending dummy files | rotemh/soteria | server.py | server.py | from flask import Flask
from flask import request
import flask
import hashlib
import json
import gzip
app = Flask(__name__)
stored_files = {}
@app.route('/profile/<type>', methods=['GET'])
def get_dummy_files(type):
if type == 'lawyer':
gzip_address = './zipfiles/doc.tar.gz'
elif type == 'doctor:':
... | from flask import Flask
from flask import request
import flask
import hashlib
import json
import gzip
app = Flask(__name__)
stored_files = {}
@app.route('/profile/<type>', methods=['GET'])
def get_dummy_files(type):
if type == 'lawyer':
pass
elif type == 'doctor:':
pass
elif type == 'fema... | mit | Python |
82424fa6ce90f384e418c54bd9bdc61216e550d8 | Remove shadowing of file builtin in server.py. PEP8 formatting | Capocaccia/reacting,Capocaccia/reacting | server.py | server.py | # This file provided by Facebook is for non-commercial testing and evaluation
# purposes only. Facebook reserves all rights not expressly granted.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PAR... | # This file provided by Facebook is for non-commercial testing and evaluation
# purposes only. Facebook reserves all rights not expressly granted.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PAR... | mit | Python |
0fbea689d8debebea36a96d960946bc4d49fe004 | Fix a bug that would only show the first letter of the announcing message of a new client on the server to other clients. | nvanheuverzwijn/naughty-chat | server.py | server.py | import socket
import os
import select
import sys
import commands
import parsers
import clients
import string
import protocols
class Server(object):
"""The chat server. It relays communication between client."""
_port = 0
_bind = ""
_server_socket = None
_clients = []
@property
def port(self):
return self._p... | import socket
import os
import select
import sys
import commands
import parsers
import clients
import string
import protocols
class Server(object):
"""The chat server. It relays communication between client."""
_port = 0
_bind = ""
_server_socket = None
_clients = []
@property
def port(self):
return self._p... | mit | Python |
cc697b677bc5b97b033cd24444d43d8b94bc85a1 | Fix mock connection | russss/python-emv | emv/test/test_transmission.py | emv/test/test_transmission.py | from unittest2 import TestCase
from emv.util import unformat_bytes
from emv.protocol.command import SelectCommand
from emv.protocol.response import SuccessResponse
from emv.transmission import TransmissionProtocol
class MockConnection(object):
T0_protocol = 1
def __init__(self, responses):
self.respo... | from unittest2 import TestCase
from emv.util import unformat_bytes
from emv.protocol.command import SelectCommand
from emv.protocol.response import SuccessResponse
from emv.transmission import TransmissionProtocol
class MockConnection(object):
T0_protocol = 1
def __init__(self, responses):
self.respo... | mit | Python |
24fc06d17303868ef4ea057cd001ec6cb49ab18f | Fix utf-8 problem with åäö and friends. | sknippen/refreeze,sknippen/refreeze,sknippen/refreeze | flask_app.py | flask_app.py | import os
from flask import Flask, render_template
from jinja2 import Template
app = Flask(__name__, template_folder='.', static_url_path='', static_folder='..')
app.config.from_pyfile('settings.py')
BASE = '/%s' % app.config['REPO_NAME']
@app.route('/')
def home():
with open('talk.md', 'r') as f:
templa... | import os
from flask import Flask, render_template
from jinja2 import Template
app = Flask(__name__, template_folder='.', static_url_path='', static_folder='..')
app.config.from_pyfile('settings.py')
BASE = '/%s' % app.config['REPO_NAME']
@app.route('/')
def home():
with open('talk.md', 'r') as f:
templa... | bsd-3-clause | Python |
0cbc06890eb131fb5014a88c8f5a111d3a6abb0d | Update mockito-core to 2.24.5 | GerritCodeReview/plugins_delete-project,GerritCodeReview/plugins_delete-project,GerritCodeReview/plugins_delete-project,GerritCodeReview/plugins_delete-project | external_plugin_deps.bzl | external_plugin_deps.bzl | load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps():
maven_jar(
name = "mockito",
artifact = "org.mockito:mockito-core:2.24.5",
sha1 = "599509fe319bd9e39559b8f987bee5d4b77167e4",
deps = [
"@byte-buddy//jar",
"@byte-buddy-agent//jar",
... | load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps():
maven_jar(
name = "mockito",
artifact = "org.mockito:mockito-core:2.24.0",
sha1 = "969a7bcb6f16e076904336ebc7ca171d412cc1f9",
deps = [
"@byte-buddy//jar",
"@byte-buddy-agent//jar",
... | apache-2.0 | Python |
56dabb4f34385c007ee9bdcebcd35953fe5b9085 | Upgrade mockito-core to 2.9.0 | GerritCodeReview/plugins_webhooks | external_plugin_deps.bzl | external_plugin_deps.bzl | load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps():
maven_jar(
name = "mockito",
artifact = "org.mockito:mockito-core:2.9.0",
sha1 = "f28b9606eca8da77e10df30a7e301f589733143e",
deps = [
'@byte-buddy//jar',
'@objenesis//jar',
],
)
maven_jar(
name = "byte... | load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps():
maven_jar(
name = "mockito",
artifact = "org.mockito:mockito-core:2.7.21",
sha1 = "23e9f7bfb9717e849a05b84c29ee3ac723f1a653",
deps = [
'@byte-buddy//jar',
'@objenesis//jar',
],
)
maven_jar(
name = "byt... | apache-2.0 | Python |
a827ee08e73ac7474908a06f871fba4dfcceee0b | drop todo comment | drmonkeysee/ecs-scheduler,drmonkeysee/ecs-scheduler | ecs_scheduler/env.py | ecs_scheduler/env.py | """ECS scheduler initialization helper methods."""
import os
import logging
import logging.handlers
import setuptools_scm
from . import triggers, __version__
_logger = logging.getLogger(__name__)
def init():
"""Initialize global application state."""
_init_logging()
triggers.init()
def get_var(name,... | """ECS scheduler initialization helper methods."""
import os
import logging
import logging.handlers
import setuptools_scm
from . import triggers, __version__
_logger = logging.getLogger(__name__)
def init():
"""Initialize global application state."""
_init_logging()
triggers.init()
def get_var(name,... | mit | Python |
6c35c54cd9561c9f829e8ba9500acdcd09642a32 | rename global to make usage clear | Connexions/cnx-archive,Connexions/cnx-archive | cnxarchive/utils/safe.py | cnxarchive/utils/safe.py | import subprocess
import threading
from subprocess import PIPE
from logging import getLogger
logger = getLogger('safestat')
safe_stat_process = None
def safe_stat(path, timeout=1, cmd=None):
"Use threads and a subproc to bodge a timeout on top of filesystem access"
global safe_stat_process
if cmd is N... | import subprocess
import threading
from subprocess import PIPE
from logging import getLogger
logger = getLogger('safestat')
process = None
def safe_stat(path, timeout=1, cmd=None):
"Use threads and a subproc to bodge a timeout on top of filesystem access"
global process
if cmd is None:
cmd = [... | agpl-3.0 | Python |
a1e92f9fcb8364eee991f0a7f976b4e1b83dcddd | Use consistent data in "colour.models.cie_uvw" module doc tests. | colour-science/colour | colour/models/cie_uvw.py | colour/models/cie_uvw.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
CIE UVW Colourspace
===================
Defines the *CIE UVW* colourspace transformations:
- :func:`XYZ_to_UVW`
See Also
--------
`CIE UVW Colourspace IPython Notebook
<http://nbviewer.ipython.org/github/colour-science/colour-ipython/blob/master/notebooks/models/c... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
CIE UVW Colourspace
===================
Defines the *CIE UVW* colourspace transformations:
- :func:`XYZ_to_UVW`
See Also
--------
`CIE UVW Colourspace IPython Notebook
<http://nbviewer.ipython.org/github/colour-science/colour-ipython/blob/master/notebooks/models/c... | bsd-3-clause | Python |
2ea688e90d6924bbad8fb59aa0706e9328fbba6d | Add initial FlatContainer class. | nodev-io/nodev.specs | nodev/specs/generic.py | nodev/specs/generic.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015-2016 Alessandro Amici.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, ... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015-2016 Alessandro Amici.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, ... | mit | Python |
37d8fadd25ebf06207e046007097b06ecb9f33ac | Use Numpy dtype when creating Numpy array | sklam/numba,pombredanne/numba,IntelLabs/numba,GaZ3ll3/numba,stonebig/numba,stuartarchibald/numba,IntelLabs/numba,jriehl/numba,IntelLabs/numba,ssarangi/numba,stonebig/numba,stonebig/numba,seibert/numba,seibert/numba,jriehl/numba,GaZ3ll3/numba,jriehl/numba,sklam/numba,stonebig/numba,gmarkall/numba,numba/numba,gmarkall/nu... | numba/cuda/tests/cudapy/test_alignment.py | numba/cuda/tests/cudapy/test_alignment.py | import numpy as np
from numba import from_dtype, cuda
from numba import unittest_support as unittest
class TestAlignment(unittest.TestCase):
def test_record_alignment(self):
rec_dtype = np.dtype([('a', 'int32'), ('b', 'float64')], align=True)
rec = from_dtype(rec_dtype)
@cuda.jit((rec[:],... | import numpy as np
from numba import from_dtype, cuda
from numba import unittest_support as unittest
class TestAlignment(unittest.TestCase):
def test_record_alignment(self):
rec_dtype = np.dtype([('a', 'int32'), ('b', 'float64')], align=True)
rec = from_dtype(rec_dtype)
@cuda.jit((rec[:],... | bsd-2-clause | Python |
ad7b71212a9c2356227048a28ee94c52193f6156 | clean up | awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat | onadata/apps/fsforms/line_data_project.py | onadata/apps/fsforms/line_data_project.py | import datetime
from collections import OrderedDict
from django.db.models import Count
from .models import FInstance
def date_range(start, end, intv):
start = datetime.datetime.strptime(start,"%Y%m%d")
end = datetime.datetime.strptime(end,"%Y%m%d")
diff = (end - start ) / intv
for i in range(intv):
... | import datetime
from collections import OrderedDict
from django.db.models import Count
from .models import FInstance
def date_range(start, end, intv):
start = datetime.datetime.strptime(start,"%Y%m%d")
end = datetime.datetime.strptime(end,"%Y%m%d")
diff = (end - start ) / intv
for i in range(intv):
... | bsd-2-clause | Python |
dbd3320bba832d031781f02d8199628d9acd3fac | Fix except syntax | hastexo/edx-shopify,fghaas/edx-shopify | edx_shopify/tasks.py | edx_shopify/tasks.py | from celery import Task
from celery.utils.log import get_task_logger
from .models import Order, OrderItem
from .utils import auto_enroll_email
logger = get_task_logger(__name__)
class ProcessOrder(Task):
"""
Process order creation event.
"""
def run(self, data):
order = Order.objects.get(id... | from celery import Task
from celery.utils.log import get_task_logger
from .models import Order, OrderItem
from .utils import auto_enroll_email
logger = get_task_logger(__name__)
class ProcessOrder(Task):
"""
Process order creation event.
"""
def run(self, data):
order = Order.objects.get(id... | agpl-3.0 | Python |
4b2f91c2fe3629e0dac6d95cb2736a01984ca63b | Update koth example to match new Entity behavior | BHSPitMonkey/vmflib | examples/koth_vmflib_example.py | examples/koth_vmflib_example.py | #!/usr/bin/python3
"""Example map generator: King of the Hill Example
This script demonstrates vmflib by generating a basic "king of the hill" style
map. "King of the hill" is a game mode in Team Fortress 2 where each team tries
to maintain control of a central "control point" for some total defined amount
of time (b... | #!/usr/bin/python3
"""Example map generator: King of the Hill Example
This script demonstrates vmflib by generating a basic "king of the hill" style
map. "King of the hill" is a game mode in Team Fortress 2 where each team tries
to maintain control of a central "control point" for some total defined amount
of time (b... | bsd-2-clause | Python |
2bc0cf211a15a6bd20f9a851ba92a12d8bb8479c | fix float instead of int | instagrambot/instabot,ohld/instabot,rasperepodvipodvert/instabot,vkgrd/instabot,misisnik/testinsta,AlexBGoode/instabot,instagrambot/instabot,Diapostrofo/instabot,sudoguy/instabot,misisnik/testinsta,instagrambot/instapro | examples/ultimate_schedule/ultimate.py | examples/ultimate_schedule/ultimate.py | import schedule
import time
import sys
import os
import random
from tqdm import tqdm
sys.path.append(os.path.join(sys.path[0],'../../'))
from instabot import Bot
bot = Bot()
bot.login()
bot.logger.info("ULTIMATE script. 24hours save")
comments_file_name = "comments.txt"
random_user_file = bot.read_list_from_file("us... | import schedule
import time
import sys
import os
import random
from tqdm import tqdm
sys.path.append(os.path.join(sys.path[0],'../../'))
from instabot import Bot
bot = Bot()
bot.login()
bot.logger.info("ULTIMATE script. 24hours save")
comments_file_name = "comments.txt"
random_user_file = bot.read_list_from_file("us... | apache-2.0 | Python |
911c8ebd648fb0e14d5b7d713ebdb2b0fc42b63e | add documenation for restore_signals | datalib/proclib | proclib/helpers.py | proclib/helpers.py | """
proclib.helpers
~~~~~~~~~~~~~~~
Helper utility functions.
"""
import shlex
import signal
TO_RESTORE = tuple(
getattr(signal, sig) for sig in ('SIGPIPE', 'SIGXFZ', 'SIGXFSZ')
if hasattr(signal, sig)
)
def restore_signals(signals=TO_RESTORE):
"""
Restores signals before the proc... | """
proclib.helpers
~~~~~~~~~~~~~~~
Helper utility functions.
"""
import shlex
import signal
TO_RESTORE = tuple(
getattr(signal, sig) for sig in ('SIGPIPE', 'SIGXFZ', 'SIGXFSZ')
if hasattr(signal, sig)
)
def restore_signals(signals=TO_RESTORE):
"""
Function for restoring the signa... | mit | Python |
f5dbe1df012241d680cd05c2a96cf4c5d3ccb463 | add logger | legnaleurc/acddl,legnaleurc/acddl,legnaleurc/acddl | acddl/util.py | acddl/util.py | import argparse
import signal
import sys
from tornado import ioloop, web, httpserver
from wcpan.logger import setup as setup_logger, INFO
from . import api
from .controller import RootController
def parse_args(args):
parser = argparse.ArgumentParser('acddl')
parser.add_argument('-l', '--listen', required=T... | import argparse
import signal
import sys
from tornado import ioloop, web, httpserver
from wcpan.logger import setup as setup_logger, INFO
from . import api
from .controller import RootController
def parse_args(args):
parser = argparse.ArgumentParser('acddl')
parser.add_argument('-l', '--listen', required=T... | mit | Python |
995f2f032fd37273d976bc94a2b5b28b2e2abbbd | Fix public room pagination for client_reader app | TribeMedia/synapse,matrix-org/synapse,TribeMedia/synapse,TribeMedia/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,TribeMedia/synapse,matrix-org/synapse,TribeMedia/synapse | synapse/replication/slave/storage/room.py | synapse/replication/slave/storage/room.py | # -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
#
# 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 applica... | # -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
#
# 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 applica... | apache-2.0 | Python |
ed91a2a5caa296c35bf806cac4b92ba3ceaa5441 | Remove unused imports (#10) | Hackathonners/vania | examples/simple_distribution.py | examples/simple_distribution.py | from vania import FairDistributor
def main():
# User input for the number of targets and objects.
users = ['user1', 'user2']
tasks = ['task1', 'task2']
preferences = [
[1, 2],
[2, 1],
]
# Run solver
distributor = FairDistributor(users, tasks, preferences)
output = dist... | import sys
import time
from random import shuffle
from vania.fair_distributor import FairDistributor
def main():
# User input for the number of targets and objects.
users = ['user1', 'user2']
tasks = ['task1', 'task2']
preferences = [
[1, 2],
[2, 1],
]
# Run solver
distrib... | mit | Python |
0dfa43733b9cf5be5722520f2949da77bf8d9dc6 | add safe_format for None | guiniol/py3status,ultrabug/py3status,valdur55/py3status,vvoland/py3status,tobes/py3status,docwalter/py3status,guiniol/py3status,Andrwe/py3status,Andrwe/py3status,tobes/py3status,ultrabug/py3status,alexoneill/py3status,ultrabug/py3status,valdur55/py3status,valdur55/py3status | py3status/modules/getjson.py | py3status/modules/getjson.py | # -*- coding: utf-8 -*-
"""
Display JSON data fetched from a URL.
This module gets the given `url` configuration parameter and assumes the
response is a JSON object. The keys of the JSON object are used as the format
placeholders. The format placeholders are replaced by the value. Objects that
are nested can be access... | # -*- coding: utf-8 -*-
"""
Display JSON response from a URL.
This module gets the given `url` configuration parameter and assumes the
response is a JSON object. The keys of the JSON object are used as the format
placeholders. The format placeholders are replaced by the value. Objects that
are nested can be accessed b... | bsd-3-clause | Python |
933308ea388f46273648af588dfb54cd78e71d12 | return on same line | tijko/Project-Euler,tijko/Project-Euler,tijko/Project-Euler,tijko/Project-Euler,tijko/Project-Euler,tijko/Project-Euler,tijko/Project-Euler,tijko/Project-Euler | py_solutions_1-10/Euler_2.py | py_solutions_1-10/Euler_2.py | # sum of even fibonacci numbers below 4 million?
import timeit
start = timeit.default_timer()
#def euler_2():
# a1 = 1
# b1 = 1
# b2 = 0
# limit = 4000000
# while b2 <= limit:
# b2 = a1 + b1
# a1 = b1
# b1 = b2
# if b2 % 2 == 0:
# yield b2
def euler_2(t=0, n=2... | # sum of even fibonacci numbers below 4 million?
import timeit
start = timeit.default_timer()
#def euler_2():
# a1 = 1
# b1 = 1
# b2 = 0
# limit = 4000000
# while b2 <= limit:
# b2 = a1 + b1
# a1 = b1
# b1 = b2
# if b2 % 2 == 0:
# yield b2
def euler_2(t=0, n=2... | mit | Python |
70043341fef4942b0486074a5f2ae50ea537de72 | Update version.py | uezo/minette-python | minette/version.py | minette/version.py | __version__ = "0.4.dev4"
| __version__ = "0.4.dev3"
| apache-2.0 | Python |
a3413ab2932dfcf5fce1110b87ea2333ff908fac | fix typo | balanced-ops/infra-zookeeper | formation/zookeeper.py | formation/zookeeper.py | #!/usr/bin/python
from confu import atlas
from troposphere import ( Template, FindInMap, GetAtt, Ref, Parameter, Join, Base64, Select, Output, ec2 as ec2 )
template = Template()
template.add_description('ZooKeeper')
atlas.infra_params(template) ## ssh_key, Env, Silo
atlas.conf_params(template) ## Conf Name, Co... | #!/usr/bin/python
from confu import atlas
from troposphere import ( Template, FindInMap, GetAtt, Ref, Parameter, Join, Base64, Select, Output, ec2 as ec2 )
template = Template()
template.add_description('ZooKeeper')
atlas.infra_params(template) ## ssh_key, Env, Silo
atlas.conf_params(template) ## Conf Name, Co... | mit | Python |
9d7db8f4ba86e8e5e526efacd878b31403b75e90 | fix test_examples | bjodah/pycodeexport,bjodah/pycodeexport | examples/tests/test_examples.py | examples/tests/test_examples.py | # -*- coding: utf-8 -*-
import glob
import os
import subprocess
import sys
import pytest
tests = glob.glob(os.path.join(os.path.dirname(__file__), '../*_main.py'))
@pytest.mark.parametrize('pypath', tests)
def test_examples(pypath):
p = subprocess.Popen(
[sys.executable, pypath, 'clean'],
cwd=... | # -*- coding: utf-8 -*-
import glob
import os
import subprocess
import sys
import pytest
tests = glob.glob(os.path.join(os.path.dirname(__file__), '../*_main.py'))
@pytest.mark.parametrize('pypath', tests)
def test_examples(pypath):
p = subprocess.Popen(
['python3' if sys.version_info.major == 3 else ... | bsd-2-clause | Python |
ce15f3a9143e6d9b640cd49f695c3179957c211e | comment quanmin | ieiayaobb/lushi8,ieiayaobb/lushi8,ieiayaobb/lushi8 | web/management/commands/fetch.py | web/management/commands/fetch.py | # -*- coding: utf-8 -*-
import sys
from web.fetch import Fetcher
from django.core.management.base import BaseCommand
import leancloud
from settings import LEAN_CLOUD_ID, LEAN_CLOUD_SECRET
reload(sys)
sys.setdefaultencoding("utf-8")
class Command(BaseCommand):
def handle(self, *args, **options):
leancloud.... | # -*- coding: utf-8 -*-
import sys
from web.fetch import Fetcher
from django.core.management.base import BaseCommand
import leancloud
from settings import LEAN_CLOUD_ID, LEAN_CLOUD_SECRET
reload(sys)
sys.setdefaultencoding("utf-8")
class Command(BaseCommand):
def handle(self, *args, **options):
... | mit | Python |
915098188119a930600a2e202137ad043f18a666 | Bump version 2.0.3 | arteria/django-hijack,arteria/django-hijack,arteria/django-hijack | hijack/__init__.py | hijack/__init__.py | # -*- coding: utf-8 -*-
__version__ = '2.0.3' # pragma: no cover
default_app_config = 'hijack.apps.HijackConfig'
| # -*- coding: utf-8 -*-
__version__ = '2.0.2' # pragma: no cover
default_app_config = 'hijack.apps.HijackConfig'
| mit | Python |
7dc3ca92b33951ef712e463d650aaeb5c3ef7403 | Bump to version 0.1.5 | posterior/treecat,posterior/treecat | treecat/__init__.py | treecat/__init__.py | __version__ = '0.1.5'
| __version__ = '0.1.4'
| apache-2.0 | Python |
8d519a811b05ffa6b63444ccbf85fb7c4e07f8ef | rename utils to math | ojengwa/algpy | algpy/math.py | algpy/math.py | """Summary."""
from __future__ import absolute_import
class Fraction(object):
"""docstring for Fraction."""
def __init__(self, numerator, denominator=1, whole_number=0):
"""
Constructor.
Args:
numerator (int): The numerator or top part of the fraction
denomina... | """Summary."""
from __future__ import absolute_import
class Fraction(object):
"""docstring for Fraction."""
def __init__(self, numerator, denominator):
"""
Constructor.
Args:
numerator (int): The numerator or top part of the fraction
denominator (int): The den... | mit | Python |
bcc9c398eafeaf2b1ae4b02c67e1f6b4260f9355 | Enable OrderedEnqueuer from keras in tf.keras. (#19183) | ageron/tensorflow,nburn42/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,benoitsteiner/tensorflow-xsmm,aselle/tensorflow,jbedorf/tensorflow,frreiss/tensorflow-fred,xodus7/tensorflow,ageron/tensorflow,snnn/tensorflow,dancingdan/tensorflow,alsrgv/tensorflow,nburn42/tensorflow,xodus7/tensorflow,Z... | tensorflow/python/keras/utils/__init__.py | tensorflow/python/keras/utils/__init__.py | # Copyright 2016 The TensorFlow Authors. 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 applica... | # Copyright 2016 The TensorFlow Authors. 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 applica... | apache-2.0 | Python |
4963856156516689b0ae1a38c681d92f2c15ec6e | remove warnings by renaming variables/methods | rtcTo/rtc2git,WtfJoke/rtc2git,cwill747/rtc2git,ohumbel/rtc2git,akchinSTC/rtc2git,jacobilsoe/rtc2git | sorter.py | sorter.py | def getfirstentryfromeachkeyasmap(changeentrymap):
firstentries = {}
for key in changeentrymap.keys():
changeentries = changeentrymap.get(key)
if changeentries:
firstentries[key] = changeentries[0]
return firstentries
def deleteentry(changeentrymap, changeentrytodelete):
fo... | def getfirstentryfromeachkeyasmap(changeentrymap):
firstentries = {}
for key in changeentrymap.keys():
changeentries = changeentrymap.get(key)
if changeentries:
firstentries[key] = changeentries[0]
return firstentries
def deleteentry(changeentrymap, changeentrytodelete):
fo... | mit | Python |
62d385e2bbcd8ce36a4f91adc021cd8ec6be41d3 | Convert functions into class | neoliberal/css-updater | source/update.py | source/update.py | """updates subreddit css with compiled sass"""
from os import path
from typing import List, Dict, Any, Tuple
import praw
import sass
# leave my typedefs alone, pylint: disable=C0103
WebhookResponse = Dict[str, Any]
class SubredditUploader(object):
"""various uploads"""
def __init__(
self: Subre... | """updates subreddit css with compiled sass"""
from os import path
import time
from typing import List, Dict, Any, Tuple
import praw
import sass
# leave my typedefs alone, pylint: disable=C0103
WebhookResponse = Dict[str, Any]
def css() -> str:
"""compiles sass and returns css"""
return sass.compile(filenam... | mit | Python |
2502447e05daedd0fc44443b92e67ce3bf40ff37 | fix pep8 on tamplate tag article (box), E302 expected ./opps/article/templatetags/article_tags.py:9:1: E302 expected 2 blank lines, found 1 | jeanmask/opps,williamroot/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,opps/opps,williamroot/opps,opps/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,jeanmask/opps,opps/opps,opps/opps,YACOWS/opps | opps/article/templatetags/article_tags.py | opps/article/templatetags/article_tags.py | # -*- coding: utf-8 -*-
from django import template
from django.conf import settings
from opps.article.models import ArticleBox
register = template.Library()
@register.inclusion_tag('article/articlebox_detail.html')
def get_articlebox(slug, channel_slug=None):
if channel_slug:
slug = slug + '-' + channe... | # -*- coding: utf-8 -*-
from django import template
from django.conf import settings
from opps.article.models import ArticleBox
register = template.Library()
@register.inclusion_tag('article/articlebox_detail.html')
def get_articlebox(slug, channel_slug=None):
if channel_slug:
slug = slug + '-' + channel... | mit | Python |
7ec3c34be0c57163840a8df0f7e2c174a7f0dd67 | Add batch command for sqlite files | matslindh/kimochi,matslindh/kimochi | alembic/env.py | alembic/env.py | # from https://github.com/virajkanwade/alembic-templates-pyramid/blob/master/pyramid/env.py
from alembic import context
from sqlalchemy import engine_from_config, pool
from paste.deploy import loadapp
from pyramid.paster import get_appsettings, setup_logging
#from logging.config import fileConfig
# this is the Alembic... | # from https://github.com/virajkanwade/alembic-templates-pyramid/blob/master/pyramid/env.py
from alembic import context
from sqlalchemy import engine_from_config, pool
from paste.deploy import loadapp
from pyramid.paster import get_appsettings, setup_logging
#from logging.config import fileConfig
# this is the Alembic... | mit | Python |
d3f82c3ed1e4879dfc0a0885e35c848b6cf311fb | use dns cache for improved adress resolving | Lispython/pycurl,Lispython/pycurl,Lispython/pycurl | pycurl/tests/test.py | pycurl/tests/test.py | # $Id$
## System modules
import sys
import threading
import time
## PycURL module
import pycurl
class Test(threading.Thread):
def __init__(self, url, ofile):
threading.Thread.__init__(self)
self.curl = pycurl.init()
self.curl.setopt(pycurl.URL, url)
self.curl.setopt(pycurl.FILE,... | # $Id$
## System modules
import sys
import threading
import time
## PycURL module
import pycurl
class Test(threading.Thread):
def __init__(self, url, ofile):
threading.Thread.__init__(self)
self.curl = pycurl.init()
self.curl.setopt(pycurl.URL, url)
self.curl.setopt(pycurl.FILE,... | lgpl-2.1 | Python |
ba408df025136563c0eafe00551f23e44e9c2731 | Change version to 1.0.1 unstable | xcgd/account_credit_transfer | __openerp__.py | __openerp__.py | # -*- coding: utf-8 -*-
{
"name": "Account Credit Transfer",
"version": "1.0.1",
"author": "XCG Consulting",
"website": "http://www.openerp-experts.com",
"category": 'Accounting',
"description": """Account Voucher Credit Transfer Payment.
You need to set up some things before using it.
... | # -*- coding: utf-8 -*-
{
"name": "Account Credit Transfer",
"version": "1.0",
"author": "XCG Consulting",
"website": "http://www.openerp-experts.com",
"category": 'Accounting',
"description": """Account Voucher Credit Transfer Payment.
You need to set up some things before using it.
A ... | agpl-3.0 | Python |
f27fc83bf7a9c14b90cba1052d54397a211f7a24 | add a forward slash to the allowed regex pattern when making the repo slug | rca/issuebranch | src/issuebranch/console_scripts.py | src/issuebranch/console_scripts.py | #!/usr/bin/env python
"""
create a new branch for the given redmine issue
"""
import argparse
import importlib
import os
import sh
import sys
from slugify import slugify
MAX_SLUG_LENGTH = 50
def make_branch(name):
command_l = 'git checkout -b {} master'.format(name).split()
getattr(sh, command_l[0])(*comman... | #!/usr/bin/env python
"""
create a new branch for the given redmine issue
"""
import argparse
import importlib
import os
import sh
import sys
from slugify import slugify
MAX_SLUG_LENGTH = 50
def make_branch(name):
command_l = 'git checkout -b {} master'.format(name).split()
getattr(sh, command_l[0])(*comman... | apache-2.0 | Python |
c1809cf217f268a5325b58513e4872a8ad44e231 | Add cross domain request support for server, incomplete. | mgunyho/kiltiskahvi | webserver.py | webserver.py | """
This module is responsible for handling web requests using Flask.
Requests are of the form (start, end) in unix time and are passed on to the db
manager, which then returns the appropriate data to be sent back as JSON.
"""
#TODO: turn this into a daemon
from flask import Flask, request, current_app, jsonify
fro... | """
This module is responsible for handling web requests using Flask.
Requests are of the form (start, end) in unix time and are passed on to the db
manager, which then returns the appropriate data to be sent back as JSON.
"""
#TODO: turn this into a daemon
from flask import Flask, request
import json
import db
imp... | mit | Python |
c4187e804d3a0f2b9b0053acdc34d9868abd2b65 | Test git | gras/SensorWorkshop | python/02-HelloWorld/main.py | python/02-HelloWorld/main.py | # Making Sense of Sensors Workshop
# Educators Edition 2015
#
# 00-SampleIncludeFiles
# main.py
'''
@author: Dead Robot Society
'''
import actions as act
##################################
# main routine
##################################
'''
This routine controls everything that happens.
Remember to start w... | # Making Sense of Sensors Workshop
# Educators Edition 2015
#
# 00-SampleIncludeFiles
# main.py
'''
@author: Dead Robot Society
'''
import actions as act
##################################
# main routine
##################################
'''
This routine controls everything that happens.
Remember to start w... | mit | Python |
3ca66d7fe4c325ee6b607522b0fb544e1bdc78ec | Update pybind11_bazel from 26973c0ff320cb4b39e45bc3e4297b82bc3a6c09 to 72cbbf1fbc830e487e3012862b7b720001b70672. | tensorflow/tensorflow-experimental_link_static_libraries_once,yongtang/tensorflow,gautam1858/tensorflow,gautam1858/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,paolodedios/tensorflow,Intel-tensorflow/tensorflow,yongtang/tensorflow,paolodedios/tensorflow,tensorflow/tenso... | third_party/pybind11_abseil/workspace.bzl | third_party/pybind11_abseil/workspace.bzl | """Provides the repo macro to import pybind11_abseil.
pybind11_abseil requires pybind11 (which is loaded in another rule) and pybind11_bazel.
See https://github.com/pybind/pybind11_abseil#installation.
"""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports pybind11_abseil.... | """Provides the repo macro to import pybind11_abseil.
pybind11_abseil requires pybind11 (which is loaded in another rule) and pybind11_bazel.
See https://github.com/pybind/pybind11_abseil#installation.
"""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports pybind11_abseil.... | apache-2.0 | Python |
c9c4ac9cad24b691edd6848595edc85c608873fe | Patch mockito params matcher | drslump/pyshould | pyshould/__init__.py | pyshould/__init__.py | """
pyshould - a should style wrapper for pyhamcrest
"""
from pyshould.dsl import *
__author__ = "Ivan -DrSlump- Montes"
__email__ = "drslump@pollinimini.net"
__license__ = "MIT"
# Override the list public symbols for a wildcard import
__all__ = [
'should',
'should_not',
'should_any',
'should_all',... | """
pyshould - a should style wrapper for pyhamcrest
"""
from pyshould.dsl import *
__author__ = "Ivan -DrSlump- Montes"
__email__ = "drslump@pollinimini.net"
__license__ = "MIT"
# Override the list public symbols for a wildcard import
__all__ = [
'should',
'should_not',
'should_any',
'should_all',... | mit | Python |
5b0421a10497f89ab62e9c0f75e760be38eb5d27 | remove plot_curve in v2.__init__ to avoid importing matplotlib when test | baidu/Paddle,chengduoZH/Paddle,emailweixu/Paddle,lispc/Paddle,reyoung/Paddle,livc/Paddle,lispc/Paddle,jacquesqiao/Paddle,emailweixu/Paddle,lcy-seso/Paddle,hedaoyuan/Paddle,emailweixu/Paddle,pengli09/Paddle,pkuyym/Paddle,jacquesqiao/Paddle,cxysteven/Paddle,reyoung/Paddle,yu239/Paddle,luotao1/Paddle,pkuyym/Paddle,pengli0... | python/paddle/v2/__init__.py | python/paddle/v2/__init__.py | # Copyright (c) 2016 PaddlePaddle Authors. 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 applic... | # Copyright (c) 2016 PaddlePaddle Authors. 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 applic... | apache-2.0 | Python |
4a878bc4cca45e3258a70dcd5e43d28d9eef9d96 | Implement slots for refreshed and edit_patch | vadmium/python-quilt,bjoernricks/python-quilt | quilt/cli/refresh.py | quilt/cli/refresh.py | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as publi... | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as publi... | mit | Python |
6b5dd8c23bd3b9c17ce672b67da3c36e7d63981a | fix issue #61 (#2) | SandstoneHPC/sandstone-spawner | sandstone_spawner/spawner.py | sandstone_spawner/spawner.py | from jupyterhub.spawner import LocalProcessSpawner
from jupyterhub.utils import random_port
from subprocess import Popen
from tornado import gen
import pipes
import shutil
import os
# This is the path to the sandstone-jupyterhub script
APP_PATH = os.environ.get('SANDSTONE_APP_PATH')
SANDSTONE_SETTINGS = os.environ.... | from jupyterhub.spawner import LocalProcessSpawner
from jupyterhub.utils import random_port
from subprocess import Popen
from tornado import gen
import pipes
import shutil
import os
# This is the path to the sandstone-jupyterhub script
APP_PATH = os.environ.get('SANDSTONE_APP_PATH')
SANDSTONE_SETTINGS = os.environ.... | mit | Python |
89b64ae2c83a0af7d103d1117efa89242dd669da | add rgb2ycc, ycc2rgb | piraaa/VideoDigitalWatermarking | src/image.py | src/image.py | #
# image.py
# Created by pira on 2017/07/28.
#
#coding: utf-8
import numpy as np
import cv2
def readImage(filename):
#imreadのflags flags>0(cv2.IMREAD_COLOR):3ChannelColors,flags=0(cv2.IMREAD_GRAYSCALE):GrayScale,flags<0(cv2.IMREAD_UNCHANGED):Original
#白黒画像でも強制的にRGBで扱う.
img = cv2.imread(filename, 1)
print('Read ... | #
# image.py
# Created by pira on 2017/07/28.
#
#coding: utf-8
import numpy as np
import cv2
def readImage(filename):
#imreadのflags flags>0(cv2.IMREAD_COLOR):3ChannelColors,flags=0(cv2.IMREAD_GRAYSCALE):GrayScale,flags<0(cv2.IMREAD_UNCHANGED):Original
#白黒画像でも強制的にRGBで扱う.
img = cv2.imread(filename, 1)
print('Read ... | mit | Python |
38a9f75bc87dbfb698b852145b7d62e9913602b4 | Stop trying to be overly clever | tolysz/tcldis,tolysz/tcldis,tolysz/tcldis,tolysz/tcldis | tcldis.py | tcldis.py | from __future__ import print_function
import _tcldis
printbc = _tcldis.printbc
getbc = _tcldis.getbc
inst_table = _tcldis.inst_table
| from __future__ import print_function
def _tcldis_init():
import sys
import _tcldis
mod = sys.modules[__name__]
for key, value in _tcldis.__dict__.iteritems():
if not callable(value):
continue
mod.__dict__[key] = value
_tcldis_init()
| bsd-3-clause | Python |
63eba95bccaaecc497fecc9fb60766dc11c37c47 | update setup.py for upload to pypi | aepyornis/nyc-db,aepyornis/nyc-db | src/setup.py | src/setup.py | import setuptools
setuptools.setup(
name="nycdb",
version="0.1.0",
url="https://github.com/aepyornis/nyc-db",
author="ziggy",
author_email="nycdb@riseup.net",
license='GPL',
description="database of nyc housing data",
long_description=open('README.md').read(),
packages=['nycdb']... | import setuptools
setuptools.setup(
name="nycdb",
version="0.1.0",
url="https://github.com/aepyornis/nyc-db",
author="ziggy",
author_email="ziggy@elephant-bird.net",
description="nyc housing database",
long_description=open('README.md').read(),
packages=setuptools.find_packages(exclu... | agpl-3.0 | Python |
4294c286afda9126aed5497e2a1048fc9bbbb491 | Update test.py | 1313e/e13Tools | test/test.py | test/test.py | # -*- coding: utf-8 -*-
"""
Testing script for travis
"""
from __future__ import division, absolute_import, print_function
import pytest
def tests():
# Check if all modules can be imported
import e13tools as e13
import e13tools.pyplot as e13plt
import e13tools.sampling as e13spl
assert True
if... | # -*- coding: utf-8 -*-
"""
Testing script for travis
"""
from __future__ import division, absolute_import, print_function
import pytest
def tests():
# Check if all modules can be imported
import e13tools as e13
import e13tools.pyplot as e13plt
import e13tools.sampling as e13spl
if(__name__ == '__m... | bsd-3-clause | Python |
0c8739457150e4ae6e47ffb42d43a560f607a141 | Add test re: hide kwarg | frol/invoke,sophacles/invoke,mkusz/invoke,alex/invoke,mkusz/invoke,frol/invoke,pyinvoke/invoke,kejbaly2/invoke,mattrobenolt/invoke,mattrobenolt/invoke,pfmoore/invoke,tyewang/invoke,kejbaly2/invoke,pfmoore/invoke,singingwolfboy/invoke,pyinvoke/invoke | tests/run.py | tests/run.py | from spec import eq_, skip, Spec, raises, ok_, trap
from invoke.run import run
from invoke.exceptions import Failure
class Run(Spec):
"""run()"""
def return_code_in_result(self):
r = run("echo 'foo'")
eq_(r.stdout, "foo\n")
eq_(r.return_code, 0)
eq_(r.exited, 0)
def nonze... | from spec import eq_, skip, Spec, raises, ok_
from invoke.run import run
from invoke.exceptions import Failure
class Run(Spec):
"""run()"""
def return_code_in_result(self):
r = run("echo 'foo'")
eq_(r.stdout, "foo\n")
eq_(r.return_code, 0)
eq_(r.exited, 0)
def nonzero_ret... | bsd-2-clause | Python |
133c48e759a30135c4cd5fdf92b75a83f58205c9 | Update at 2017-07-22 21-38-49 | amoshyc/tthl-code | train_vgg.py | train_vgg.py | import json
from pathlib import Path
import numpy as np
import pandas as pd
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
set_session(tf.Session(config=config))
from keras.models import Sequential, Model
from keras.pr... | import json
from pathlib import Path
import numpy as np
import pandas as pd
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
set_session(tf.Session(config=config))
from keras.models import Sequential, Model
from keras.pr... | apache-2.0 | Python |
6b94d3622759a4851886e0a917551f3e6bb62fdb | Set log level to CRITICAL when not in verbose mode. Reason: We catch the important errors anyway. | buckket/twtxt | twtxt/log.py | twtxt/log.py | """
twtxt.log
~~~~~~~~~
This module configures the logging module for twtxt.
:copyright: (c) 2016 by buckket.
:license: MIT, see LICENSE for more details.
"""
import logging
def init_logging(debug=False):
logger = logging.getLogger()
formatter = logging.Formatter("%(asctime)s %(name)-1... | """
twtxt.log
~~~~~~~~~
This module configures the logging module for twtxt.
:copyright: (c) 2016 by buckket.
:license: MIT, see LICENSE for more details.
"""
import logging
def init_logging(debug=False):
logger = logging.getLogger()
formatter = logging.Formatter("%(asctime)s %(name)-1... | mit | Python |
cd8815c7d82d7c8b3e0c66622ab99762e54ae330 | Change models to allow for blank URLs | lo-windigo/fragdev,lo-windigo/fragdev | projects/models.py | projects/models.py | from django.db import models
from django.core.urlresolvers import reverse
class Project(models.Model):
'''
A open source/development project to be displayed on the Projects page
'''
PUBLIC = 'pub'
HIDDEN = 'hid'
PROJECT_STATUS = (
(PUBLIC, 'Public'),
(HIDDEN, 'Hidden'),
)
... | from django.db import models
class Project(models.Model):
'''
A open source/development project to be displayed on the Projects page
'''
PUBLIC = 'pub'
HIDDEN = 'hid'
PROJECT_STATUS = (
(PUBLIC, 'Public'),
(HIDDEN, 'Hidden'),
)
name = models.CharField(max_length=150)
... | agpl-3.0 | Python |
c32b64c3d391f525e65bb43e6e24d6f3ea486e6e | Update urls.py | mcuringa/nyc-el | el/el/urls.py | el/el/urls.py | from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^$', 'el.views.home', ),
url(r'^link1$', 'el.views.link1', ),
url(r'^link2$', 'el.views.link2', ),
url(r'^tokyo$', 'el.views.tokyo', ),
url(r'^link4$', 'el.views.link4', ),
url(r'^home$', 'el.views.link5', ),
... | from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^$', 'el.views.home', ),
url(r'^link1$', 'el.views.link1', ),
url(r'^link2$', 'el.views.link2', ),
url(r'^link3$', 'el.views.link3', ),
url(r'^link4$', 'el.views.link4', ),
url(r'^home$', 'el.views.link5', ),
... | agpl-3.0 | Python |
7fe3776a59de7a133c5e396cb43d9b4bcc476f7d | Fix the check if form is submitted | Hackfmi/Diaphanum,Hackfmi/Diaphanum | protocols/views.py | protocols/views.py | from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import render
from members.models import User
from .models import Protocol, Topic
from .forms import ProtocolForm, TopicForm, InstitutionForm
@login_required
def add(request):
data = request.POST ... | from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import render
from members.models import User
from .models import Protocol, Topic
from .forms import ProtocolForm, TopicForm, InstitutionForm
@login_required
def add(request):
data = request.POST ... | mit | Python |
f53026455803bcd2171531faa48cc5a6bbdfcdd7 | Add note to tokenstorage about Windows permissions (#532) | sirosen/globus-sdk-python,globus/globus-sdk-python,globus/globus-sdk-python | src/globus_sdk/tokenstorage/base.py | src/globus_sdk/tokenstorage/base.py | import abc
import contextlib
import os
from typing import Any, Dict, Iterator, Optional
from globus_sdk.services.auth import OAuthTokenResponse
class StorageAdapter(metaclass=abc.ABCMeta):
@abc.abstractmethod
def store(self, token_response: OAuthTokenResponse) -> None:
"""
Store an `OAuthToke... | import abc
import contextlib
import os
from typing import Any, Dict, Iterator, Optional
from globus_sdk.services.auth import OAuthTokenResponse
class StorageAdapter(metaclass=abc.ABCMeta):
@abc.abstractmethod
def store(self, token_response: OAuthTokenResponse) -> None:
"""
Store an `OAuthToke... | apache-2.0 | Python |
d683f56c50587d346fa6891c20d6f68f37e2c9da | update imports | wolverton-research-group/qmpy,wolverton-research-group/qmpy,wolverton-research-group/qmpy,wolverton-research-group/qmpy,wolverton-research-group/qmpy | qmpy/web/views/materials/__init__.py | qmpy/web/views/materials/__init__.py | from entry import *
from structure import *
from composition import *
from discovery import *
from chem_pots import *
from element_groups import *
from deposit import *
def common_materials_view(request):
return render_to_response('materials/index.html', {})
| from entry import *
from structure import *
from composition import *
from discovery import *
from chem_pots import *
from deposit import *
def common_materials_view(request):
return render_to_response('materials/index.html', {})
| mit | Python |
0f48f1e9570fb194a19f0d8faf8c23c879a61d8b | remove any associated .pyc file before loading a module from path; this may fix the config load problem in sasview | SasView/sasmodels,SasView/sasmodels,SasView/sasmodels,SasView/sasmodels | sasmodels/custom/__init__.py | sasmodels/custom/__init__.py | """
Custom Models
-------------
This is a place holder for the custom models namespace. When models are
loaded from a file by :func:`generate.load_kernel_module` they are loaded
as if they exist in *sasmodels.custom*. This package needs to exist for this
to occur without error.
"""
from __future__ import division, p... | """
Custom Models
-------------
This is a place holder for the custom models namespace. When models are
loaded from a file by :func:`generate.load_kernel_module` they are loaded
as if they exist in *sasmodels.custom*. This package needs to exist for this
to occur without error.
"""
from __future__ import division, p... | bsd-3-clause | Python |
96167530d37f5aab6ae91cc8ff4583a86740e3f4 | Update locustfile.py | joejcollins/WomertonFarm,joejcollins/WomertonFarm,joejcollins/WomertonFarm,joejcollins/WomertonFarm | locust_test/locustfile.py | locust_test/locustfile.py | """Generic locustfile used to load testing sites."""
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
@task(2)
def index(self):
self.client.get("/")
@task(1)
def where(self):
self.client.get("/location")
@task(1)
def what(self):
self.client.ge... | """Generic locustfile used to load testing Zengenti sites."""
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
@task(2)
def index(self):
self.client.get("/")
@task(1)
def where(self):
self.client.get("/location")
@task(1)
def what(self):
self.... | mit | Python |
7592ca157c74a8ee66cb0ce68956f473469ffc10 | Add areyoumyfriend | bryanforbes/Erasmus | erasmus/cogs/misc.py | erasmus/cogs/misc.py | from __future__ import annotations
from discord.ext import commands
from ..context import Context
from ..erasmus import Erasmus
class Misc(commands.Cog[Context]):
def __init__(self, bot: Erasmus) -> None:
self.bot = bot
@commands.command(brief='Get the invite link for Erasmus')
@commands.cooldo... | from __future__ import annotations
from discord.ext import commands
from ..context import Context
from ..erasmus import Erasmus
class Misc(commands.Cog[Context]):
def __init__(self, bot: Erasmus) -> None:
self.bot = bot
@commands.command(brief='Get the invite link for Erasmus')
@commands.cooldo... | bsd-3-clause | Python |
9d908b1c59d02d32f1bcf425d6157e330ed0d11c | Fix codepoint-based-lookup (eg. .u 203D) in Python 3 | Uname-a/knife_scraper,Uname-a/knife_scraper,Uname-a/knife_scraper | willie/modules/unicode_info.py | willie/modules/unicode_info.py | #coding: utf8
"""
codepoints.py - Willie Codepoints Module
Copyright 2013, Edward Powell, embolalia.net
Copyright 2008, Sean B. Palmer, inamidst.com
Licensed under the Eiffel Forum License 2.
http://willie.dfbta.net
"""
from __future__ import unicode_literals
import unicodedata
import sys
from willie.module import com... | #coding: utf8
"""
codepoints.py - Willie Codepoints Module
Copyright 2013, Edward Powell, embolalia.net
Copyright 2008, Sean B. Palmer, inamidst.com
Licensed under the Eiffel Forum License 2.
http://willie.dfbta.net
"""
from __future__ import unicode_literals
import unicodedata
from willie.module import commands, exam... | mit | Python |
7d1a903845db60186318575db11a712cd62d884d | Fix mypy import errors due to removed services | amolenaar/gaphor,amolenaar/gaphor | win-installer/gaphor-script.py | win-installer/gaphor-script.py | if __name__ == "__main__":
import gaphor
from gaphor import core
from gaphor.services.componentregistry import ComponentRegistry
from gaphor.ui.consolewindow import ConsoleWindow
from gaphor.services.copyservice import CopyService
from gaphor.plugins.diagramlayout import DiagramLayout
from g... | if __name__ == "__main__":
import gaphor
from gaphor import core
from gaphor.services.actionmanager import ActionManager
from gaphor.plugins.alignment import Alignment
from gaphor.services.componentregistry import ComponentRegistry
from gaphor.ui.consolewindow import ConsoleWindow
from gapho... | lgpl-2.1 | Python |
c9d9375db1a70e6095d76344773699cb5189fa43 | Update rasa_core/policies/mapping_policy.py | RasaHQ/rasa_nlu,RasaHQ/rasa_core,RasaHQ/rasa_core,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu,RasaHQ/rasa_core | rasa_core/policies/mapping_policy.py | rasa_core/policies/mapping_policy.py | import logging
import os
from typing import Any, List, Text
from rasa_core.actions.action import ACTION_LISTEN_NAME
from rasa_core import utils
from rasa_core.domain import Domain
from rasa_core.policies.policy import Policy
from rasa_core.trackers import DialogueStateTracker
from rasa_core.constants import MAPPING_S... | import logging
import os
from typing import Any, List, Text
from rasa_core.actions.action import ACTION_LISTEN_NAME
from rasa_core import utils
from rasa_core.domain import Domain
from rasa_core.policies.policy import Policy
from rasa_core.trackers import DialogueStateTracker
from rasa_core.constants import MAPPING_S... | apache-2.0 | Python |
cf011d9c8018a0ceba732c5fbb3fc7bdd58a3011 | Upgrade step small fix | veroc/Bika-LIMS,veroc/Bika-LIMS,veroc/Bika-LIMS,labsanmartin/Bika-LIMS,labsanmartin/Bika-LIMS,rockfruit/bika.lims,labsanmartin/Bika-LIMS,rockfruit/bika.lims | bika/lims/upgrade/to318.py | bika/lims/upgrade/to318.py | from Acquisition import aq_inner
from Acquisition import aq_parent
from Products.CMFCore.utils import getToolByName
from bika.lims.permissions import AddMultifile
from Products.Archetypes.BaseContent import BaseContent
from bika.lims.upgrade import stub
from bika.lims import logger
def upgrade(tool):
"""Upgrade st... | from Acquisition import aq_inner
from Acquisition import aq_parent
from Products.CMFCore.utils import getToolByName
from bika.lims.permissions import AddMultifile
from Products.Archetypes.BaseContent import BaseContent
from bika.lims.upgrade import stub
from bika.lims import logger
def upgrade(tool):
"""Upgrade st... | agpl-3.0 | Python |
3646aba05566631f07695b2b5e6ad2fe0ece309b | Patch version bump to 29.3.1 | alphagov/notifications-utils | notifications_utils/version.py | notifications_utils/version.py | __version__ = '29.3.1'
| __version__ = '29.3.0'
| mit | Python |
1c2b06829c597d2287b7546b1a28661be44735c6 | Remove unnecessary try catch | adityahase/frappe,almeidapaulopt/frappe,frappe/frappe,saurabh6790/frappe,mhbu50/frappe,mhbu50/frappe,saurabh6790/frappe,frappe/frappe,almeidapaulopt/frappe,mhbu50/frappe,adityahase/frappe,StrellaGroup/frappe,frappe/frappe,saurabh6790/frappe,adityahase/frappe,StrellaGroup/frappe,mhbu50/frappe,StrellaGroup/frappe,yashodh... | frappe/desk/form/save.py | frappe/desk/form/save.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, json
from frappe.desk.form.load import run_onload
@frappe.whitelist()
def savedocs(doc, action):
"""save / submit / update doclist"""
try:
doc = frappe.get_doc... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, json
from frappe.desk.form.load import run_onload
@frappe.whitelist()
def savedocs(doc, action):
"""save / submit / update doclist"""
try:
doc = frappe.get_doc... | mit | Python |
db02b2cc2b8de947511fa0e750697a3b89a88714 | Remove some more unused code. | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | openquake/utils/db/__init__.py | openquake/utils/db/__init__.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2011, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenQuak... | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2011, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenQuak... | agpl-3.0 | Python |
5aca39cef15ea4381b30127b8ded31ec37ffd273 | Add image to ifff request | niqdev/packtpub-crawler,niqdev/packtpub-crawler,niqdev/packtpub-crawler | script/notification/ifttt.py | script/notification/ifttt.py | from logs import *
import requests
class Ifttt(object):
"""
"""
def __init__(self, config, packpub_info, upload_info):
self.__packpub_info = packpub_info
self.__url = "https://maker.ifttt.com/trigger/{eventName}/with/key/{apiKey}".format(
eventName=config.get('ifttt', 'ifttt.ev... | from logs import *
import requests
class Ifttt(object):
"""
"""
def __init__(self, config, packpub_info, upload_info):
self.__packpub_info = packpub_info
self.__url = "https://maker.ifttt.com/trigger/{eventName}/with/key/{apiKey}".format(
eventName=config.get('ifttt', 'ifttt.ev... | mit | Python |
754af1b3b06c489929c302ee1ec2a17bbf681cd1 | Remove unused import time | daybarr/timelapse,daybarr/timelapse | server/download.py | server/download.py | #!/usr/bin/env python
from __future__ import print_function
import argparse
import logging
import os
import sys
import pysftp
LOG_FORMAT = '%(asctime)-15s %(name)-10s %(levelname)-7s %(message)s'
# max number of files to download per sftp connection - not getting them all at
# once helps avoid lockups/hangs on the ... | #!/usr/bin/env python
from __future__ import print_function
import argparse
import logging
import os
import sys
import time
import pysftp
LOG_FORMAT = '%(asctime)-15s %(name)-10s %(levelname)-7s %(message)s'
# max number of files to download per sftp connection - not getting them all at
# once helps avoid lockups/h... | mit | Python |
392aeb99891ff9949c9e9e205743937d8e9cb632 | Use threading.local() to store a requests.Session object per-thread and use it to perform the requests, allowing connections to be reused, speeding bot replies a lot | alvarogzp/telegram-bot,alvarogzp/telegram-bot | bot/api/telegram.py | bot/api/telegram.py | import threading
import requests
class TelegramBotApi:
"""This is a threading-safe API. Avoid breaking it by adding state."""
def __init__(self, auth_token, debug: bool):
self.base_url = "https://api.telegram.org/bot" + auth_token + "/"
self.debug = debug
self.local = threading.local... | import requests
class TelegramBotApi:
"""This is a threading-safe API. Avoid breaking it by adding state."""
def __init__(self, auth_token, debug: bool):
self.base_url = "https://api.telegram.org/bot" + auth_token + "/"
self.debug = debug
def __getattr__(self, item):
return self.... | agpl-3.0 | Python |
56cea385b0f16056d3a164676bd8d135ecf370cb | Allow access from rawgit.com | alvarogzp/telegram-games,alvarogzp/telegram-games,alvarogzp/telegram-games,alvarogzp/telegram-games | bot/game/api/api.py | bot/game/api/api.py | import http.server
import json
import socketserver
import ssl
from tools import config
LISTEN_ADDRESS = ("", 4343)
API_PATH = "/cgbapi/"
RESPONSE_ENCODING = "utf-8"
class ApiServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
def server_bind(self):
super().server_bind()
self.socket = s... | import http.server
import json
import socketserver
import ssl
from tools import config
LISTEN_ADDRESS = ("", 4343)
API_PATH = "/cgbapi/"
RESPONSE_ENCODING = "utf-8"
class ApiServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
def server_bind(self):
super().server_bind()
self.socket = s... | apache-2.0 | Python |
0bc3cc9bd927540915cd99dfe351da56c37d71d2 | Fix a ResourceWarning in setuptools_build | sigmavirus24/pip,techtonik/pip,zvezdan/pip,rouge8/pip,pfmoore/pip,sigmavirus24/pip,fiber-space/pip,techtonik/pip,atdaemon/pip,zvezdan/pip,xavfernandez/pip,sbidoul/pip,zvezdan/pip,rouge8/pip,rouge8/pip,benesch/pip,pypa/pip,xavfernandez/pip,sbidoul/pip,xavfernandez/pip,sigmavirus24/pip,RonnyPfannschmidt/pip,pypa/pip,bene... | pip/utils/setuptools_build.py | pip/utils/setuptools_build.py | # Shim to wrap setup.py invocation with setuptools
SETUPTOOLS_SHIM = (
"import setuptools, tokenize;__file__=%r;"
"f=getattr(tokenize, 'open', open)(__file__);"
"code=f.read().replace('\\r\\n', '\\n');"
"f.close();"
"exec(compile(code, __file__, 'exec'))"
)
| # Shim to wrap setup.py invocation with setuptools
SETUPTOOLS_SHIM = (
"import setuptools, tokenize;__file__=%r;"
"exec(compile(getattr(tokenize, 'open', open)(__file__).read()"
".replace('\\r\\n', '\\n'), __file__, 'exec'))"
)
| mit | Python |
5e7cf63d33f000a6022e8ec7830a2166a29e5175 | Fix context if value is None | fin/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide,fin/froide,fin/froide | froide/helper/widgets.py | froide/helper/widgets.py | from django import forms
from django.conf import settings
from taggit.forms import TagWidget
class BootstrapChoiceMixin(object):
def __init__(self, *args, **kwargs):
kwargs.setdefault('attrs', {})
kwargs['attrs'].update({'class': 'form-check-input'})
super(BootstrapChoiceMixin, self).__in... | from django import forms
from django.conf import settings
from taggit.forms import TagWidget
class BootstrapChoiceMixin(object):
def __init__(self, *args, **kwargs):
kwargs.setdefault('attrs', {})
kwargs['attrs'].update({'class': 'form-check-input'})
super(BootstrapChoiceMixin, self).__in... | mit | Python |
619d934b8742eece8ed8670016994c6133428218 | test fix: merge subtests, expected by jar tests | moreati/pydgin,futurecore/pydgin,cornell-brg/pydgin,futurecore/pydgin,cornell-brg/pydgin,futurecore/pydgin,cornell-brg/pydgin,futurecore/pydgin,moreati/pydgin,moreati/pydgin,cornell-brg/pydgin,moreati/pydgin | interp_asm_test.py | interp_asm_test.py | import sys
import subprocess
sys.path.append('/Users/dmlockhart/vc/git-brg/parc/pymtl')
from inspect import getmembers, ismodule, isfunction
import pisa.pisa_inst_addu_test
import pisa.pisa_inst_subu_test
import pisa.pisa_inst_and_test
import pisa.pisa_inst_or_test
import pisa.pisa_inst_xor_test
import pisa.pisa_inst... | import sys
import subprocess
sys.path.append('/Users/dmlockhart/vc/git-brg/parc/pymtl')
from inspect import getmembers, ismodule, isfunction
import pisa.pisa_inst_addu_test
import pisa.pisa_inst_subu_test
import pisa.pisa_inst_and_test
import pisa.pisa_inst_or_test
import pisa.pisa_inst_xor_test
import pisa.pisa_inst... | bsd-3-clause | Python |
b99719e71282a3e6a9766932b294a0ed6a7479ff | Bump version | mattrobenolt/invoke,mattrobenolt/invoke,tyewang/invoke,singingwolfboy/invoke,mkusz/invoke,pyinvoke/invoke,pyinvoke/invoke,kejbaly2/invoke,mkusz/invoke,sophacles/invoke,frol/invoke,pfmoore/invoke,pfmoore/invoke,kejbaly2/invoke,frol/invoke | invoke/_version.py | invoke/_version.py | __version_info__ = (0, 4, 0)
__version__ = '.'.join(map(str, __version_info__))
| __version_info__ = (0, 3, 0)
__version__ = '.'.join(map(str, __version_info__))
| bsd-2-clause | Python |
1b3a1d18e7a66c7067ab9d4aacddfabe33d29ca1 | add scheme (if missing) via urlparse.scheme check | mutaku/Stumpy,mutaku/Stumpy | shortener/views.py | shortener/views.py | from django.http import HttpResponse,Http404
from django import forms
from shortener.models import stumps
from django.utils.encoding import smart_str
from django.shortcuts import get_object_or_404,get_list_or_404,render_to_response,redirect
import hashlib
import urlparse
from django.db.models import Sum,Count
from djan... | from django.http import HttpResponse,Http404
from django import forms
from shortener.models import stumps
from django.utils.encoding import smart_str
from django.shortcuts import get_object_or_404,get_list_or_404,render_to_response,redirect
import hashlib
import urlparse
from django.db.models import Sum,Count
from djan... | bsd-3-clause | Python |
127860c8feee3b4bdaee1bad6c76ff1c8a8acaf1 | remove remove by try_remove closes #525 | Konubinix/weboob,eirmag/weboob,Boussadia/weboob,willprice/weboob,eirmag/weboob,sputnick-dev/weboob,laurent-george/weboob,nojhan/weboob-devel,nojhan/weboob-devel,yannrouillard/weboob,sputnick-dev/weboob,Boussadia/weboob,frankrousseau/weboob,franek/weboob,nojhan/weboob-devel,Konubinix/weboob,laurent-george/weboob,yannrou... | weboob/backends/lefigaro/pages/article.py | weboob/backends/lefigaro/pages/article.py | "ArticlePage object for inrocks"
# -*- coding: utf-8 -*-
# Copyright(C) 2011 Julien Hebert
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distr... | "ArticlePage object for inrocks"
# -*- coding: utf-8 -*-
# Copyright(C) 2011 Julien Hebert
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distr... | agpl-3.0 | Python |
2fca0582d6590def19f3788e0b804a2ec85ca42d | Fix logging | opennode/nodeconductor-openstack | src/nodeconductor_openstack/log.py | src/nodeconductor_openstack/log.py | from nodeconductor.logging.loggers import EventLogger, event_logger
class BackupEventLogger(EventLogger):
resource = 'structure.Resource'
class Meta:
event_types = ('resource_backup_creation_scheduled',
'resource_backup_creation_succeeded',
'resource_back... | from nodeconductor.logging.loggers import EventLogger, event_logger
class BackupEventLogger(EventLogger):
resource = 'structure.Resource'
class Meta:
event_types = ('resource_backup_creation_scheduled',
'resource_backup_creation_succeeded',
'resource_back... | mit | Python |
f171cd79fbee3cf9cfd378f9b34bf8fef351a292 | return the gravity comp response correctly | HLP-R/hlpr_kinesthetic_teaching | hlpr_kinesthetic_interaction/src/hlpr_kinesthetic_interaction/jaco_arm.py | hlpr_kinesthetic_interaction/src/hlpr_kinesthetic_interaction/jaco_arm.py | #!/usr/bin/env python
import rospy
from hlpr_manipulation_utils.manipulator import Gripper
from wpi_jaco_msgs.srv import GravComp
from kinova_msgs.srv import Start, Stop
"""
jaco_arm.py
Simple wrapper that abstracts out the arm class so that other arms
can use kinesthetic_interaction
"""
class Arm():
GRAVITY_C... | #!/usr/bin/env python
import rospy
from hlpr_manipulation_utils.manipulator import Gripper
from wpi_jaco_msgs.srv import GravComp
from kinova_msgs.srv import Start, Stop
"""
jaco_arm.py
Simple wrapper that abstracts out the arm class so that other arms
can use kinesthetic_interaction
"""
class Arm():
GRAVITY_C... | bsd-3-clause | Python |
dfd1aeba24c8373b64a073f5f779a22311db8c42 | add price | it-projects-llc/website-addons,it-projects-llc/website-addons,it-projects-llc/website-addons | website_sale_quantity_hide/__openerp__.py | website_sale_quantity_hide/__openerp__.py | # -*- coding: utf-8 -*-
{
'name': "Hide quantity field in web shop",
'summary': "Allows to sale only 1 item at once",
'author': 'IT-Projects LLC, Ivan Yelizariev',
'license': 'GPL-3',
"price": 20.00,
"currency": "EUR",
'category': 'Website',
'website': 'https://twitter.com/yelizariev',
... | # -*- coding: utf-8 -*-
{
'name': "Hide quantity field in web shop",
'summary': "Allows to sale only 1 item at once",
'author': 'IT-Projects LLC, Ivan Yelizariev',
'license': 'GPL-3',
'category': 'Website',
'website': 'https://twitter.com/yelizariev',
'version': '1.0.0',
'depends': ['web... | mit | Python |
a018da55959b438f803e0ede7855f34a1a0712c4 | Load security data | cubells/l10n-spain,cubells/l10n-spain,cubells/l10n-spain | l10n_es_ticketbai_api/__manifest__.py | l10n_es_ticketbai_api/__manifest__.py | # Copyright 2021 Binovo IT Human Project SL
# Copyright 2021 Landoo Sistemas de Informacion SL
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "TicketBAI - API",
"version": "14.0.2.2.1",
"category": "Accounting & Finance",
"website": "https://github.com/OCA/l10n-spain",
"... | # Copyright 2021 Binovo IT Human Project SL
# Copyright 2021 Landoo Sistemas de Informacion SL
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "TicketBAI - API",
"version": "14.0.2.2.1",
"category": "Accounting & Finance",
"website": "https://github.com/OCA/l10n-spain",
"... | agpl-3.0 | Python |
f832bd54dd293c9b76d46d48e00ba1430eab5566 | Fix usage message | plamere/spotipy | examples/user_playlists_contents.py | examples/user_playlists_contents.py | # shows a user's playlists (need to be authenticated via oauth)
import sys
import os
import spotipy
import spotipy.util as util
def show_tracks(results):
for i, item in enumerate(tracks['items']):
track = item['track']
print(" %d %32.32s %s" % (i, track['artists'][0]['name'], track['name']))
i... | # shows a user's playlists (need to be authenticated via oauth)
import sys
import os
import spotipy
import spotipy.util as util
def show_tracks(results):
for i, item in enumerate(tracks['items']):
track = item['track']
print(" %d %32.32s %s" % (i, track['artists'][0]['name'], track['name']))
i... | mit | Python |
78232ed4b075bc66ecd52108df22362c453b4da7 | Update vuln-39.py | mtesauro/gauntlt-demo,gauntlt/gauntlt-demo,mtesauro/gauntlt-demo,gauntlt/gauntlt-demo | examples/webgoat/vuln-39/vuln-39.py | examples/webgoat/vuln-39/vuln-39.py | import requests
import json
loginurl = 'http://127.0.0.1:8080/WebGoat/login.mvc'
authurl = 'http://127.0.0.1:8080/WebGoat/j_spring_security_check'
menuurl = 'http://127.0.0.1:8080/WebGoat/service/lessonmenu.mvc'
attackurl = 'http://127.0.0.1:8080/WebGoat/'
login = {"username":"guest", "password":"guest"}
purchase = {"P... | import requests
import json
loginurl = 'http://127.0.0.1:8080/WebGoat/login.mvc'
authurl = 'http://127.0.0.1:8080/WebGoat/j_spring_security_check'
menuurl = 'http://127.0.0.1:8080/WebGoat/service/lessonmenu.mvc'
attackurl = 'http://127.0.0.1:8080/WebGoat/'
login = {"username":"guest", "password":"guest"}
purchase = {"P... | mit | Python |
a760d60ec2b37613c621508001b57dc81b464b5c | add precision | charliezon/deep_stock | experiments/exp_20170722_01/main.py | experiments/exp_20170722_01/main.py | import xgboost as xgb
# Accuracy on test set: 63%
# read in data
dtrain = xgb.DMatrix('../../data/data_20170722_01/train_data.txt')
dtest = xgb.DMatrix('../../data/data_20170722_01/test_data.txt')
# specify parameters via map, definition are same as c++ version
param = {'max_depth':22, 'eta':0.1, 'silent':0, 'object... | import xgboost as xgb
# Accuracy on test set: 63%
# read in data
dtrain = xgb.DMatrix('../../data/data_20170722_01/train_data.txt')
dtest = xgb.DMatrix('../../data/data_20170722_01/test_data.txt')
# specify parameters via map, definition are same as c++ version
param = {'max_depth':22, 'eta':0.1, 'silent':0, 'object... | mit | Python |
99baef55bc5e2d2311ba356ccf29bd8c16b99f64 | add watchlist | charliezon/deep_stock | experiments/exp_20170722_01/main.py | experiments/exp_20170722_01/main.py | import xgboost as xgb
# read in data
dtrain = xgb.DMatrix('../../data/data_20170722_01/train_data.txt')
dtest = xgb.DMatrix('../../data/data_20170722_01/test_data.txt')
# specify parameters via map, definition are same as c++ version
param = {'max_depth':22, 'eta':0.1, 'silent':0, 'objective':'binary:logistic','min_c... | import xgboost as xgb
# read in data
dtrain = xgb.DMatrix('../../data/data_20170722_01/train_data.txt')
dtest = xgb.DMatrix('../../data/data_20170722_01/test_data.txt')
# specify parameters via map
param = {'max_depth':2, 'eta':1, 'silent':1, 'objective':'binary:logistic' }
num_round = 2
bst = xgb.train(param, dtrain,... | mit | Python |
0dbcc4c1604cca0e77b0cd3c1a812398c1d4bc56 | Implement read_data and write_data in curate_data_parse.py. translate_to_parse unfinished. | rice-apps/atlas,rice-apps/atlas,rice-apps/atlas | scripts/curate_data_parse.py | scripts/curate_data_parse.py | """
This script curates the Places data in a format compatible with the Place class
in the Parse Rice Maps Data store.
Input File: places_data.json
Output File: places_data_parse.json
"""
import json
def read_data(f_name):
"""
Given an input file name f_name, reads the JSON data inside returns as
Python data o... | """
This script curates the Places data in a format compatible with the Place class
in the Parse Rice Maps Data store.
Input File: places_data.json
Output File: places_data_parse.json
"""
def read_data(f_name):
"""
Given an input file name f_name, reads the JSON data inside returns as
Python data object.
"""... | mit | Python |
37c35db753425dfcd14be4e72b8aea95afaf7762 | Fix KeyError of OS_AUTH_URL | opnfv/functest,opnfv/functest,mywulin/functest,mywulin/functest | functest/cli/commands/cli_os.py | functest/cli/commands/cli_os.py | #!/usr/bin/env python
#
# jose.lausuch@ericsson.com
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# pylint: disable=missin... | #!/usr/bin/env python
#
# jose.lausuch@ericsson.com
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# pylint: disable=missin... | apache-2.0 | Python |
92e728a1a1c2f770adeb175a61433da125571198 | fix todo path | SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray | fuzzers/056-rempips/generate.py | fuzzers/056-rempips/generate.py | #!/usr/bin/env python3
from prjxray.segmaker import Segmaker
verbose = 1
segmk = Segmaker("design.bits")
tiledata = dict()
pipdata = dict()
ignpip = set()
todo = set()
print("Loading todo from ../todo.txt.")
with open("../../todo.txt", "r") as f:
for line in f:
line = tuple(line.strip().split("."))
... | #!/usr/bin/env python3
from prjxray.segmaker import Segmaker
verbose = 1
segmk = Segmaker("design.bits")
tiledata = dict()
pipdata = dict()
ignpip = set()
todo = set()
print("Loading todo from ../todo.txt.")
with open("../todo.txt", "r") as f:
for line in f:
line = tuple(line.strip().split("."))
... | isc | Python |
fc4b1e3f03fefd0108ced28b78240650ba453ca6 | update imports in utils.py | jnoortheen/django-utils-plus | utils_plus/utils.py | utils_plus/utils.py | import os
import django.urls
import django.apps
IP_ADDRESS_HEADERS = ('HTTP_X_REAL_IP', 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR')
def get_ip_address(request):
for header in IP_ADDRESS_HEADERS:
addr = request.META.get(header)
if addr:
return addr.split(',')[0].strip()
... | import os
from django.urls import reverse_lazy
from django.apps import apps
IP_ADDRESS_HEADERS = ('HTTP_X_REAL_IP', 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR')
def get_ip_address(request):
for header in IP_ADDRESS_HEADERS:
addr = request.META.get(header)
if addr:
return ... | mit | Python |
5de5bb74a3e329305ba07ffce6551fa99b9b705f | bump rest retries to 3 | UWIT-IAM/iam-resttools | resttools/dao_implementation/live.py | resttools/dao_implementation/live.py | """
Provides access to the http connection pools and
connections for live data from a web service
"""
import logging
import ssl
import time
import socket
from urlparse import urlparse
from urllib3 import connection_from_url
import urllib3
# temporary during testing
urllib3.disable_warnings()
logging.captureWarnings(... | """
Provides access to the http connection pools and
connections for live data from a web service
"""
import logging
import ssl
import time
import socket
from urlparse import urlparse
from urllib3 import connection_from_url
import urllib3
# temporary during testing
urllib3.disable_warnings()
logging.captureWarnings(... | apache-2.0 | Python |
9b0e221c2a45e71159c782db43b0d371fec0debb | Add methods | Kyria/LazyBlacksmith,Kyria/LazyBlacksmith,Kyria/LazyBlacksmith,Kyria/LazyBlacksmith | lazyblacksmith/models/eve_sde/item.py | lazyblacksmith/models/eve_sde/item.py | from . import db
from .activity import Activity
from flask import url_for
class Item(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=False)
name = db.Column(db.String(100), nullable=True)
max_production_limit = db.Column(db.Integer, nullable=True)
# foreign keys
activit... | from . import db
class Item(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=False)
name = db.Column(db.String(100), nullable=True)
max_production_limit = db.Column(db.Integer, nullable=True)
# foreign keys
activities = db.relationship('Activity', backref='blueprint',... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.