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 |
|---|---|---|---|---|---|---|---|---|
8e53783953285c3d33ef55dce1c33a3bd46458a9 | Add concurrency capability to client | eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog | 2017/async-socket-server/simple-client.py | 2017/async-socket-server/simple-client.py | import argparse
import logging
import socket
import sys
import threading
import time
class ReadThread(threading.Thread):
def __init__(self, name, sockobj):
super().__init__()
self.sockobj = sockobj
self.name = name
self.bufsize = 8 * 1024
def run(self):
while True:
... | import logging
import socket
import sys
import threading
import time
class ReadThread(threading.Thread):
def __init__(self, sockobj):
super().__init__()
self.sockobj = sockobj
self.bufsize = 8 * 1024
def run(self):
while True:
buf = self.sockobj.recv(self.bufsize)
... | unlicense | Python |
bb9b380e93da9e9fc65d5aac2ba3650272fd2bba | print syntax. | yishayv/lyacorr,yishayv/lyacorr | mpi_helper.py | mpi_helper.py | from __future__ import print_function
from mpi4py import MPI
import numpy as np
comm = MPI.COMM_WORLD
def r_print(*args):
"""
print message on the root node (rank 0)
:param args:
:return:
"""
if comm.rank == 0:
print('ROOT:', end=' ')
for i in args:
print(i, end=' ... | from mpi4py import MPI
import numpy as np
from __future__ import print_function
comm = MPI.COMM_WORLD
def r_print(*args):
"""
print message on the root node (rank 0)
:param args:
:return:
"""
if comm.rank == 0:
print 'ROOT:',
for i in args:
print((i, end=' '))
... | mit | Python |
baa379107e9b229830a12efecba491f63c8afe02 | Order dashboard url overwrites | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | meinberlin/apps/dashboard/urls.py | meinberlin/apps/dashboard/urls.py | from django.conf.urls import url
from meinberlin.apps.bplan.views import BplanProjectCreateView
from meinberlin.apps.dashboard2.urls import \
urlpatterns as a4dashboard_urlpatterns
from meinberlin.apps.extprojects.views import ExternalProjectCreateView
from meinberlin.apps.projectcontainers.views import ContainerC... | from django.conf.urls import url
from meinberlin.apps.bplan.views import BplanProjectCreateView
from meinberlin.apps.dashboard2.urls import \
urlpatterns as a4dashboard_urlpatterns
from meinberlin.apps.extprojects.views import ExternalProjectCreateView
from meinberlin.apps.projectcontainers.views import ContainerC... | agpl-3.0 | Python |
7ffe699d4f146a6bf695fb544689a5f35703d368 | Add startdir to files listed by os.listdir() | hughdbrown/git-tools | src/common/__init__.py | src/common/__init__.py | from __future__ import print_function
from hashlib import sha1
import sys
import os
import os.path
from subprocess import Popen, PIPE
BUFSIZE = 16 * 1024 * 1024
def message(msg):
print(msg, file=sys.stderr)
def binary_in_path(binary):
return any(os.path.exists(os.path.join(path, binary)) for path in set(... | from __future__ import print_function
from hashlib import sha1
import sys
import os
import os.path
from subprocess import Popen, PIPE
BUFSIZE = 16 * 1024 * 1024
def message(msg):
print(msg, file=sys.stderr)
def binary_in_path(binary):
return any(os.path.exists(os.path.join(path, binary)) for path in set(... | mit | Python |
04058304e68fe88cb52402e6134ab15fa9563ad1 | add new methods in ProgressMonitor | TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl | AlphaTwirl/ProgressBar/ProgressMonitor.py | AlphaTwirl/ProgressBar/ProgressMonitor.py | # Tai Sakuma <tai.sakuma@cern.ch>
from ProgressReporter import ProgressReporter
##__________________________________________________________________||
class Queue(object):
def __init__(self, presentation):
self.presentation = presentation
def put(self, report):
self.presentation.present(repor... | # Tai Sakuma <tai.sakuma@cern.ch>
from ProgressReporter import ProgressReporter
##__________________________________________________________________||
class Queue(object):
def __init__(self, presentation):
self.presentation = presentation
def put(self, report):
self.presentation.present(repor... | bsd-3-clause | Python |
c089ef827954436d30b4b6718ef1bcceac11d1fa | Make 0 an invalid CEI | poliquin/brazilnum | brazilnum/cei.py | brazilnum/cei.py | #!/usr/bin/env python
from __future__ import absolute_import
import re
import random
from .util import clean_id, pad_id
"""
Functions for working with Brazilian CEI identifiers.
"""
NONDIGIT = re.compile(r'[^0-9]')
CEI_WEIGHTS = [7, 4, 1, 8, 5, 2, 1, 6, 3, 7, 4]
def validate_cei(cei, autopad=True):
"""Check... | #!/usr/bin/env python
from __future__ import absolute_import
import re
import random
from .util import clean_id, pad_id
"""
Functions for working with Brazilian CEI identifiers.
"""
NONDIGIT = re.compile(r'[^0-9]')
CEI_WEIGHTS = [7, 4, 1, 8, 5, 2, 1, 6, 3, 7, 4]
def validate_cei(cei, autopad=True):
"""Check... | mit | Python |
331222d553c0778840f522e21cb399226d89310e | Fix version | Yelp/yelp_clog,Yelp/yelp_clog | clog/__init__.py | clog/__init__.py | # Copyright 2015 Yelp 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | # Copyright 2015 Yelp 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | apache-2.0 | Python |
38f87a266a0dbc2b09f80feb0a3eeb01db4b096b | improve cnn date reporting | flupzor/bijgeschaafd,COLABORATI/newsdiffs,catcosmo/newsdiffs,bjowi/newsdiffs,amandabee/newsdiffs,catcosmo/newsdiffs,catcosmo/newsdiffs,COLABORATI/newsdiffs,flupzor/newsdiffs,amandabee/newsdiffs,COLABORATI/newsdiffs,flupzor/newsdiffs,bjowi/newsdiffs,flupzor/bijgeschaafd,flupzor/newsdiffs,bjowi/newsdiffs,amandabee/newsdi... | parsers/cnn.py | parsers/cnn.py | from baseparser import BaseParser
import re
from BeautifulSoup import BeautifulSoup
from datetime import datetime, timedelta
DATE_FORMAT = '%B %d, %Y at %l:%M%P EDT'
class CNNParser(BaseParser):
domains = ['edition.cnn.com']
feeder_base = 'http://edition.cnn.com/'
feeder_pat = '^http://edition.cnn.com/2... | from baseparser import BaseParser
import re
from BeautifulSoup import BeautifulSoup
from datetime import datetime, timedelta
DATE_FORMAT = '%B %d, %Y at %l:%M%P EDT'
class CNNParser(BaseParser):
domains = ['edition.cnn.com']
feeder_base = 'http://edition.cnn.com/'
feeder_pat = '^http://edition.cnn.com/2... | mit | Python |
b16b61914e1fa6ed0c3036404b913026dcc24a24 | Update organizers.py | pyconca/2017-web,pyconca/2017-web,pyconca/2017-web,pyconca/2017-web | config/organizers.py | config/organizers.py |
ORGANIZERS = {
('Francis Deslauriers', 'https://twitter.com/frdeso_'),
('Myles Braithwaite', 'https://mylesb.ca/'),
('Peter McCormick', 'https://twitter.com/pdmccormick'),
('Terry Yanchynskyy', 'https://github.com/onebit0fme'),
# Add you name and url here ^ and submit a pull request
# Order do... |
ORGANIZERS = {
('Francis Deslauriers', 'https://twitter.com/francisDeslaur'),
('Myles Braithwaite', 'https://mylesb.ca/'),
('Peter McCormick', 'https://twitter.com/pdmccormick'),
('Terry Yanchynskyy', 'https://github.com/onebit0fme'),
# Add you name and url here ^ and submit a pull request
# O... | mit | Python |
84d02292f9cc9749b619d823aac1cde88be97edd | change site name | bsdlp/burrito.sh,fly/burrito.sh,fly/burrito.sh,bsdlp/burrito.sh | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'jchen'
AUTHOR_FULLNAME = u'Jon Chen'
SITENAME = u'burritos r us'
SITEURL = 'http://burrito.sh'
TIMEZONE = 'ETC/UTC'
DEFAULT_LANG = u'en'
CSS_FILE = 'style.css'
# theme stuff
THEME = './theme'
# plugins
PLUGIN_PATH =... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'jchen'
AUTHOR_FULLNAME = u'Jon Chen'
SITENAME = u'burrito?'
SITEURL = 'http://burrito.sh'
TIMEZONE = 'ETC/UTC'
DEFAULT_LANG = u'en'
CSS_FILE = 'style.css'
# theme stuff
THEME = './theme'
# plugins
PLUGIN_PATH = './p... | bsd-3-clause | Python |
3104834e9ee7525a8f8b43edcb00443d913e0792 | Update config settings. | edx/ecommerce,edx/ecommerce,janusnic/ecommerce,mferenca/HMS-ecommerce,eduNEXT/edunext-ecommerce,eduNEXT/edunext-ecommerce,janusnic/ecommerce,eduNEXT/edunext-ecommerce,edx/ecommerce,mferenca/HMS-ecommerce,janusnic/ecommerce,edx/ecommerce,eduNEXT/edunext-ecommerce,mferenca/HMS-ecommerce | ecommerce/settings/production.py | ecommerce/settings/production.py | """Production settings and globals."""
from os import environ
# Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception.
from django.core.exceptions import ImproperlyConfigured
import yaml
from ecommerce.settings.base import *
from ecommerce.setting... | """Production settings and globals."""
from os import environ
# Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception.
from django.core.exceptions import ImproperlyConfigured
import yaml
from ecommerce.settings.base import *
from ecommerce.setting... | agpl-3.0 | Python |
2a3ecf262ac2057503ea8b9a4576068aaa8cfa1f | Fix filter gte (>=)/lte (<=) | AndrzejR/mining,mlgruby/mining,chrisdamba/mining,jgabriellima/mining,avelino/mining,chrisdamba/mining,AndrzejR/mining,seagoat/mining,seagoat/mining,mining/mining,mlgruby/mining,mlgruby/mining,mining/mining,avelino/mining,jgabriellima/mining | mining/utils.py | mining/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unicodedata
import re
from decimal import Decimal
from pandas import tslib, date_range
def fix_render(value):
if type(value) is str:
try:
return unicode(value)
except UnicodeDecodeError:
return unicode(value.decode('lati... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unicodedata
import re
from decimal import Decimal
from pandas import tslib, date_range
def fix_render(value):
if type(value) is str:
try:
return unicode(value)
except UnicodeDecodeError:
return unicode(value.decode('lati... | mit | Python |
290838a09bc932e11f95140f5de449c732110a71 | add x access mode to Log/ | yasokada/python-151113-lineMonitor,yasokada/python-151113-lineMonitor | utilLogger.py | utilLogger.py | import os.path
import datetime
import time
# for chmod
import os
from stat import *
'''
v0.7 2015/12/03
- change access mode of the file and folder(Log/) to make OTHER writable
v0.6 2015/12/02
- add msec string for time stamp
v0.5 2015/12/01
- remove CRLF at the end of the line
- save to Log/
- use [0] * 10 to... | import os.path
import datetime
import time
# for chmod
import os
from stat import *
'''
v0.7 2015/12/03
- change access mode of the file and folder(Log/) to make OTHER writable
v0.6 2015/12/02
- add msec string for time stamp
v0.5 2015/12/01
- remove CRLF at the end of the line
- save to Log/
- use [0] * 10 to... | mit | Python |
b5de756da50fb699eb497226ce4ee1e45759ac2a | Add port drawing to GraphBlock | anton-golubkov/Garland,anton-golubkov/Garland | src/gui/graphblock.py | src/gui/graphblock.py | # -*- coding: utf-8 -*-
from PySide import QtGui
class GraphBlock(QtGui.QGraphicsWidget):
""" GraphBlock represents IPFBlock in graphics scene
"""
block_width = 40
block_height = 32
port_size = 10
def __init__(self, block):
super(GraphBlock, self).__init__()
self... | # -*- coding: utf-8 -*-
from PySide import QtGui
class GraphBlock(QtGui.QGraphicsWidget):
""" GraphBlock represents IPFBlock in graphics scene
"""
block_width = 40
block_height = 32
def __init__(self, block):
super(GraphBlock, self).__init__()
self.block = block
... | lgpl-2.1 | Python |
36700dff3bfc010a31cb406108473d4823467dee | Update check_updates.py | site24x7/plugins,site24x7/plugins,site24x7/plugins | check_updates/check_updates.py | check_updates/check_updates.py | #!/usr/bin/python
import sys
import json
import subprocess
PYTHON_MAJOR_VERSION = sys.version_info[0]
if PYTHON_MAJOR_VERSION == 3:
import distro as platform
elif PYTHON_MAJOR_VERSION == 2:
import platform
os_info = platform.linux_distribution()[0].lower()
PLUGIN_VERSION = "1"
HE... | #!/usr/bin/python
import json
import platform
import subprocess
PLUGIN_VERSION = "1"
HEARTBEAT="true"
data={}
data['plugin_version'] = PLUGIN_VERSION
data['heartbeat_required']=HEARTBEAT
data['packages_to_be_updated']=0
data['security_updates']=0
command="yum check-update --security | grep -i 'needed for security'"... | bsd-2-clause | Python |
8fd9bd1a1084f1d8d1f61774fdf28a45be9cb4e5 | Undo faulty work | limbera/django-nap | nap/rpc/views.py | nap/rpc/views.py |
import inspect
import json
from django.views.generic import View
from nap import http
from nap.utils import JsonMixin
RPC_MARKER = '_rpc'
def method(view):
'''Mark a view as accessible via RPC'''
setattr(view, RPC_MARKER, True)
return view
def is_rpc_method(m):
return getattr(m, RPC_MARKER, Fals... |
import inspect
import json
from django.views.generic import View
from nap import http
from nap.utils import JsonMixin
RPC_MARKER = '_rpc'
def method(view):
'''Mark a view as accessible via RPC'''
setattr(view, RPC_MARKER, True)
return view
def is_rpc_method(m):
return getattr(m, RPC_MARKER, Fals... | bsd-3-clause | Python |
4f6d9bd2539e4a97c91703f1719936e4e53dfcc1 | Add check for netifaces | RagBillySandstone/SysAdmin_Stuffs,RagBillySandstone/SysAdmin_Stuffs | pingGateway.py | pingGateway.py | #!/usr/bin/env python
# pingDefault.py -- pings the machine's default gateway
# In most home networks, this is 192.168.0.1, but this script does not
# make that assumption
# It does, however, assume linux ping utility
# Linux is notorious for dropping WiFi connections, especially on laptops
# I found that pinging ... | #!/usr/bin/env python
# pingDefault.py -- pings the machine's default gateway
# In most home networks, this is 192.168.0.1, but this script does not
# make that assumption
# It does, however, assume linux ping utility
# Linux is notorious for dropping WiFi connections, especially on laptops
# I found that pinging ... | apache-2.0 | Python |
50ea692ffa5a5e42cd0e94b8b0b8c6c8fe5aca76 | Correct indentation | scitran/api,scitran/core,scitran/api,scitran/core,scitran/core,scitran/core | bin/oneoffs/load_external_data.py | bin/oneoffs/load_external_data.py | #!/usr/bin/env python
import bson
import copy
import datetime
import dateutil.parser
import json
from api import config
## DEFAULTS ##
USER_ID = "meganhenning@flywheel.io"
SAFE_FILE_HASH = "v0-sha384-a8d0d1bd9368e5385f31d3582db07f9bc257537d5e1f207d36a91fdd3d2f188fff56616c0874bb3535c37fdf761a446c"
PROJECT_ID = "5a26... | #!/usr/bin/env python
import bson
import copy
import datetime
import dateutil.parser
import json
from api import config
## DEFAULTS ##
USER_ID = "meganhenning@flywheel.io"
SAFE_FILE_HASH = "v0-sha384-a8d0d1bd9368e5385f31d3582db07f9bc257537d5e1f207d36a91fdd3d2f188fff56616c0874bb3535c37fdf761a446c"
PROJECT_ID = "5a26... | mit | Python |
32566b73fae3a07fea95d20aa12962754b46efb1 | use django convention for importing urls defaults (gets handler404, etc.) | peterayeni/rapidsms,ehealthafrica-ci/rapidsms,caktus/rapidsms,dimagi/rapidsms,lsgunth/rapidsms,peterayeni/rapidsms,peterayeni/rapidsms,lsgunth/rapidsms,catalpainternational/rapidsms,ken-muturi/rapidsms,ehealthafrica-ci/rapidsms,ken-muturi/rapidsms,eHealthAfrica/rapidsms,unicefuganda/edtrac,catalpainternational/rapidsms... | lib/rapidsms/djangoproject/urls.py | lib/rapidsms/djangoproject/urls.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import os
from django.conf.urls.defaults import *
from rapidsms.utils.modules import try_import
from ..conf import settings
# this list will be populated with the urls from the urls.urlpatterns of
# each installed app, then found by django as if we'd listed them he... | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import os
from django.conf.urls.defaults import patterns, url
from rapidsms.utils.modules import try_import
from ..conf import settings
# this list will be populated with the urls from the urls.urlpatterns of
# each installed app, then found by django as if we'd li... | bsd-3-clause | Python |
82a1cbc477bcf57629f8d5e07184cb03e536b603 | Check for device connection before sending packet. | Motsai/neblina-python,Motsai/neblina-python | neblinaDevice.py | neblinaDevice.py | #!/usr/bin/env python
###################################################################################
#
# Copyright (c) 2010-2016 Motsai
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softwa... | #!/usr/bin/env python
###################################################################################
#
# Copyright (c) 2010-2016 Motsai
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softwa... | mit | Python |
335bb6cc9bc93320915aa08d56c5e5d24eb70b18 | replace $ with command prefix | sammdot/circa | modules/help.py | modules/help.py | class HelpModule:
def __init__(self, circa):
self.circa = circa
self.events = {
"cmd.help": [self.help]
}
self.docs = {
"help": "help [<module>[.<command>]|$<command>] → show usage info for a command, or list all commands in a module, or list all modules"
}
def help(self, fr, to, msg, m):
pfx = sel... | class HelpModule:
def __init__(self, circa):
self.circa = circa
self.events = {
"cmd.help": [self.help]
}
self.docs = {
"help": "help [<module>[.<command>]|$<command>] → show usage info for a command, or list all commands in a module, or list all modules"
}
def help(self, fr, to, msg, m):
pfx = sel... | bsd-3-clause | Python |
60ea2738b39b38bdc1f25594a759aace0f520501 | Add utility function to dump flask env | usgo/online-ratings,usgo/online-ratings,usgo/online-ratings,Kashomon/online-ratings,Kashomon/online-ratings,Kashomon/online-ratings | web/manage.py | web/manage.py | from flask.ext.script import Manager
from app import get_app
from create_db import drop_all_tables, create_barebones_data, create_all_data, create_server
app = get_app('config.DockerConfiguration')
manager = Manager(app)
manager.command(drop_all_tables)
manager.command(create_barebones_data)
manager.command(create_... | from flask.ext.script import Manager
from app import get_app
from create_db import drop_all_tables, create_barebones_data, create_all_data, create_server
app = get_app('config.DockerConfiguration')
manager = Manager(app)
manager.command(drop_all_tables)
manager.command(create_barebones_data)
manager.command(create_... | mit | Python |
b4078ad91d56d653c575d10d32ee34168b1df5b3 | Add list_of_numbers | eagafonov/json_schema_helpers | json_schema_helpers/helpers.py | json_schema_helpers/helpers.py |
# Simple types
type_string = dict(type="string")
type_null = dict(type="null")
type_integer = dict(type="integer")
type_number = dict(type="number")
type_object = dict(type="object")
type_list = dict(type="array") # Python clashed with JavaScript :-)
type_boolean = dict(type="boolean")
# Simple type or null
type_str... |
# Simple types
type_string = dict(type="string")
type_null = dict(type="null")
type_integer = dict(type="integer")
type_number = dict(type="number")
type_object = dict(type="object")
type_list = dict(type="array") # Python clashed with JavaScript :-)
type_boolean = dict(type="boolean")
# Simple type or null
type_str... | mit | Python |
9001989292761e40adc648cb14d421dcb9703ad8 | Change port number and bind to default ip address | haramaki/spark-openstack | webhookapp.py | webhookapp.py | # import Flask
from flask import Flask, request
# import custom-made modules
import sparkmessage
import argparse
# Create an instance of Flask
app = Flask(__name__)
TOKEN = ""
# Index page will trigger index() function
@app.route('/')
def index():
return 'Hello World'
# Webhook page will trigger webhooks() func... | # import Flask
from flask import Flask, request
# import custom-made modules
import sparkmessage
import argparse
# Create an instance of Flask
app = Flask(__name__)
TOKEN = ""
# Index page will trigger index() function
@app.route('/')
def index():
return 'Hello World'
# Webhook page will trigger webhooks() func... | apache-2.0 | Python |
2daace6af733e833246830ecaa129bea09c247a9 | Fix topic rewrite | sebastinas/debian-devel-changes-bot | DebianDevelChangesBot/utils/rewrite_topic.py | DebianDevelChangesBot/utils/rewrite_topic.py | # -*- coding: utf-8 -*-
#
# Debian Changes Bot
# Copyright (C) 2015 Sebastian Ramacher <sramacher@debian.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 ... | # -*- coding: utf-8 -*-
#
# Debian Changes Bot
# Copyright (C) 2015 Sebastian Ramacher <sramacher@debian.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 ... | agpl-3.0 | Python |
0d4023d629b14d4396d370c395a68fa87b59ddb2 | rename to __version__ | b-mueller/mythril,b-mueller/mythril,b-mueller/mythril,b-mueller/mythril | mythril/__version__.py | mythril/__version__.py | """This file contains the current Mythril version.
This file is suitable for sourcing inside POSIX shell, e.g. bash as well
as for importing into Python.
"""
__version__ = "v0.20.8"
| """This file contains the current Mythril version.
This file is suitable for sourcing inside POSIX shell, e.g. bash as well
as for importing into Python.
"""
VERSION = "v0.20.8" # NOQA
| mit | Python |
6de456df864fcf3f801f41e247d1fcf551195429 | fix conflict | n0stack/n0core | n0core/compute/main.py | n0core/compute/main.py | import sys
sys.path.append('../../') # NOQA
import pulsar
from n0core.lib.n0mq import N0MQ
from n0core.lib.proto import CreateVMRequest
client = N0MQ('pulsar://localhost:6650')
consumer = client.subscribe('persistent://sample/standalone/compute/handle')
@consumer.on('CreateVMRequest')
def create_VM_request(messag... | import sys
sys.path.append('../../') # NOQA
import pulsar
from n0core.lib.n0mq import N0MQ
from n0core.lib.proto import CreateVMRequest
client = N0MQ('pulsar://localhost:6650')
consumer = client.subscribe('persistent://sample/standalone/compute/handle')
@consumer.on('CreateVMRequest')
def create_VM_request(messag... | bsd-2-clause | Python |
c3626cdea8b73d81f21aa3acf14a9e018df64790 | Fix tests/functional/get_installed_test.py | Yelp/venv-update,Yelp/pip-faster,Yelp/pip-faster,Yelp/venv-update,Yelp/pip-faster,Yelp/venv-update | tests/functional/get_installed_test.py | tests/functional/get_installed_test.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import pytest
from testing import run
from testing import venv_update_script
def get_installed():
out, err = venv_update_script('''\
import pip_faster as p
for p in sorted(p.reqnames(p.pip_get_in... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from testing import run
from testing import venv_update_script
def get_installed():
out, err = venv_update_script('''\
import pip_faster as p
for p in sorted(p.reqnames(p.pip_get_installed())):
... | mit | Python |
7024a02daeabd98cd6fa02c63f339a60995f9200 | Rename SpacyVectors->StaticVectors, and refactor to make it easier to customise vector loading | explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc | thinc/neural/_classes/spacy_vectors.py | thinc/neural/_classes/spacy_vectors.py | import numpy
from ...import describe
from ...describe import Dimension, Synapses, Gradient
from .._lsuv import LSUVinit
from ..ops import NumpyOps
from ...api import layerize
from .model import Model
from ...extra.load_nlp import get_vectors
try:
import cupy
except ImportError:
cupy = None
@layerize
def get... | import numpy
from ...import describe
from ...describe import Dimension, Synapses, Gradient
from .._lsuv import LSUVinit
from ..ops import NumpyOps
from ...api import layerize
from .model import Model
from ...extra.load_nlp import get_vectors
try:
import cupy
except ImportError:
cupy = None
@layerize
def get... | mit | Python |
b13a0bdbc3d66cc8fb63c916e9337e5e715e0ef4 | update options | mrpau/kolibri,mrpau/kolibri,indirectlylit/kolibri,learningequality/kolibri,mrpau/kolibri,learningequality/kolibri,learningequality/kolibri,indirectlylit/kolibri,learningequality/kolibri,indirectlylit/kolibri,mrpau/kolibri,indirectlylit/kolibri | kolibri/plugins/html5_viewer/options.py | kolibri/plugins/html5_viewer/options.py | import logging
logger = logging.getLogger(__name__)
# Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox
allowable_sandbox_tokens = set(
[
"allow-downloads-without-user-activation",
"allow-forms",
"allow-modals",
"allow-orientation-lock",
... | import logging
logger = logging.getLogger(__name__)
# Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox
allowable_sandbox_tokens = set(
[
"allow-downloads-without-user-activation",
"allow-forms",
"allow-modals",
"allow-orientation-lock",
... | mit | Python |
89e1040f4a3beae18655a16366e8661ae08378db | Add a /favicon.ico url to fix errors in dev/test | StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite | labonneboite/web/root/views.py | labonneboite/web/root/views.py | # coding: utf8
from flask import Blueprint, current_app
from flask import abort, send_from_directory, redirect, render_template, request
from labonneboite.common import doorbell
from labonneboite.common import pro
from labonneboite.conf import settings
from labonneboite.web.search.forms import CompanySearchForm
from ... | # coding: utf8
from flask import Blueprint, current_app
from flask import abort, send_from_directory, redirect, render_template, request
from labonneboite.common import doorbell
from labonneboite.common import pro
from labonneboite.conf import settings
from labonneboite.web.search.forms import CompanySearchForm
from ... | agpl-3.0 | Python |
fa4dd74bca5d89db946dae78c20e2f5f0f758dd7 | Add fake @decorator_tag | whyflyru/django-cacheops,ErwinJunge/django-cacheops,bourivouh/django-cacheops,Suor/django-cacheops,rutube/django-cacheops,andwun/django-cacheops,LPgenerator/django-cacheops | cacheops/fake.py | cacheops/fake.py | from funcy import ContextDecorator
from django.db.models import Manager
from django.db.models.query import QuerySet
# query
def cached_as(*samples, **kwargs):
return lambda func: func
cached_view_as = cached_as
def install_cacheops():
if not hasattr(Manager, 'get_queryset'):
Manager.get_queryset = la... | from funcy import ContextDecorator
from django.db.models import Manager
from django.db.models.query import QuerySet
# query
def cached_as(*samples, **kwargs):
return lambda func: func
cached_view_as = cached_as
def install_cacheops():
if not hasattr(Manager, 'get_queryset'):
Manager.get_queryset = la... | bsd-3-clause | Python |
eaa397715c2f667c375e936581296feb609c799d | Add tabswitching.typical_25 benchmark | M4sse/chromium.src,Fireblend/chromium-crosswalk,Chilledheart/chromium,Just-D/chromium-1,chuan9/chromium-crosswalk,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,dednal/chromium.src,dednal/chromium.src,chuan9/chromium-crosswalk,markYoungH/chromium.src,PeterWangIntel/chromium-crosswalk,littlstar/chromium.sr... | tools/perf/benchmarks/tab_switching.py | tools/perf/benchmarks/tab_switching.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import test
from measurements import tab_switching
class TabSwitchingTop10(test.Test):
test = tab_switching.TabSwitching
page_set = 'pa... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import test
from measurements import tab_switching
class TabSwitchingTop10(test.Test):
test = tab_switching.TabSwitching
page_set = 'pa... | bsd-3-clause | Python |
f57616df11408514e43dec70aee121b4221039a7 | store the total budget | mdietrichc2c/vertical-ngo,jorsea/vertical-ngo,jorsea/vertical-ngo,yvaucher/vertical-ngo | logistic_budget/model/sale_order.py | logistic_budget/model/sale_order.py | # -*- coding: utf-8 -*-
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ve... | # -*- coding: utf-8 -*-
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ve... | agpl-3.0 | Python |
a5847a40104e17d243e0b41ae40bc4820dcd9725 | update head comments typo | Maple0/Algorithm,Maple0/Algorithm | leetcode/merge-overlapping-intervals.py | leetcode/merge-overlapping-intervals.py | #Author: Maple0
#Github:https://github.com/Maple0
#4th Sep 2016
#Given a collection of intervals, merge all overlapping intervals.
#For example,
#Given [1,3],[2,6],[8,10],[15,18],
#return [1,6],[8,10],[15,18].
class Interval(object):
def __init__(self, s=0, e=0):
self.start = s
self.end = e
class Merge_Resu... | #Author: Maple0
#Github:https://github.com/Maple0
#4th Sep 2016
#pGiven a collection of intervals, merge all overlapping intervals.
#For example,
#Given [1,3],[2,6],[8,10],[15,18],
#return [1,6],[8,10],[15,18].
class Interval(object):
def __init__(self, s=0, e=0):
self.start = s
self.end = e
class Merge_Res... | mit | Python |
b68149f807cd3814cb7ed7e9c695e80f9400a66b | Update _version.py | missionpinball/mpf,missionpinball/mpf | mpf/_version.py | mpf/_version.py | """Holds various Version strings of MPF.
This modules holds the MPF version strings, including the version of BCP it
needs and the config file version it needs.
It's used internally for all sorts of things, from printing the output of the
`mpf --version` command, to making sure any processes connected via BCP are
the... | """Holds various Version strings of MPF.
This modules holds the MPF version strings, including the version of BCP it
needs and the config file version it needs.
It's used internally for all sorts of things, from printing the output of the
`mpf --version` command, to making sure any processes connected via BCP are
the... | mit | Python |
39946f9fa5127d240d7147d50b676ad083514e85 | Add custom debug toolbar URL mount point. | fladi/django-campus02,fladi/django-campus02 | campus02/urls.py | campus02/urls.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns(
'',
url(r'^', include('django.contrib.auth.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^web/', include('... | #!/usr/bin/python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns(
'',
url(r'^', include('django.contrib.auth.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^web/', include('campus02.web.urls', namespace='we... | mit | Python |
c25947147ec592142ddbce7dc9e25e3969255c9a | Check iplayer installed | ianmiell/shutit,ianmiell/shutit,ianmiell/shutit | library/get_iplayer/get_iplayer.py | library/get_iplayer/get_iplayer.py | #Copyright (C) 2014 OpenBet Limited
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribu... | #Copyright (C) 2014 OpenBet Limited
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribu... | mit | Python |
f88a6c65fc0e6a1c65284890052b8e1ceb4081ec | Add Kennard-Stone algorithm | skearnes/muv | muv/__init__.py | muv/__init__.py | """
Miscellaneous utilities.
"""
import numpy as np
def kennard_stone(d, k):
"""
Use the Kennard-Stone algorithm to select k maximally separated
examples from a dataset.
Algorithm
---------
1. Choose the two examples separated by the largest distance. In the
case of a tie, use the fir... | bsd-3-clause | Python | |
3a036c947835c51bc7dcf89b2b4e3ae6ab32de75 | Return bytes, not a bytearray | pypa/linehaul | linehaul/protocol/line_receiver.py | linehaul/protocol/line_receiver.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | apache-2.0 | Python |
44186c1a03d8504aad8a68f1261538801f689c03 | Make sure backends is a fully functional list | bacontext/mopidy,pacificIT/mopidy,vrs01/mopidy,priestd09/mopidy,diandiankan/mopidy,SuperStarPL/mopidy,diandiankan/mopidy,jmarsik/mopidy,ZenithDK/mopidy,ZenithDK/mopidy,priestd09/mopidy,ali/mopidy,bencevans/mopidy,rawdlite/mopidy,swak/mopidy,bencevans/mopidy,swak/mopidy,glogiotatidis/mopidy,mokieyue/mopidy,abarisain/mop... | mopidy/core/actor.py | mopidy/core/actor.py | import itertools
import pykka
from mopidy.audio import AudioListener
from .current_playlist import CurrentPlaylistController
from .library import LibraryController
from .playback import PlaybackController
from .stored_playlists import StoredPlaylistsController
class Core(pykka.ThreadingActor, AudioListener):
#... | import itertools
import pykka
from mopidy.audio import AudioListener
from .current_playlist import CurrentPlaylistController
from .library import LibraryController
from .playback import PlaybackController
from .stored_playlists import StoredPlaylistsController
class Core(pykka.ThreadingActor, AudioListener):
#... | apache-2.0 | Python |
f7909cd72361d06bac259fea0cb021a410885336 | Add compulsory keywords | musalbas/listentotwitter,musalbas/listentotwitter,musalbas/listentotwitter | listentotwitter/keywordsmanager.py | listentotwitter/keywordsmanager.py | import time
from listentotwitter import socketio
from listentotwitter.tweetanalyser import TweetAnalyser
from listentotwitter.tweetstreamer import TweetStreamer
def keyword_test(keyword):
if len(keyword) >= 3 and len(keyword) <= 15:
return True
else:
return False
class KeywordsManager:
... | import time
from listentotwitter import socketio
from listentotwitter.tweetanalyser import TweetAnalyser
from listentotwitter.tweetstreamer import TweetStreamer
def keyword_test(keyword):
if len(keyword) >= 3 and len(keyword) <= 15:
return True
else:
return False
class KeywordsManager:
... | agpl-3.0 | Python |
2fbbdb3725ec5abe73d633618e318e958617acd3 | Prepend file path prefix to XML doc file paths | MarquisLP/Sidewalk-Champion | lib/custom_data/character_loader_new.py | lib/custom_data/character_loader_new.py | """This module loads character data from XML files and stores them in
CharacterData objects that can be read by the game engine.
Attributes:
CHARACTER_LIST_PATH (String): The filepath for the text file which
lists the paths to all of the characters' XML files.
Each path is separated by a new-line.
... | """This module loads character data from XML files and stores them in
CharacterData objects that can be read by the game engine.
Attributes:
CHARACTER_LIST_PATH (String): The filepath for the text file which
lists the paths to all of the characters' XML files.
Each path is separated by a new-line.
... | unlicense | Python |
fa7f3be4fb9b4b34081f4bb46eaf836a87e9931c | add support to afreecatv.com.tw | lyhiving/livestreamer,flijloku/livestreamer,wolftankk/livestreamer,chhe/livestreamer,chhe/livestreamer,flijloku/livestreamer,Feverqwe/livestreamer,okaywit/livestreamer,programming086/livestreamer,hmit/livestreamer,hmit/livestreamer,Saturn/livestreamer,Dobatymo/livestreamer,programming086/livestreamer,caorong/livestream... | src/livestreamer/plugins/afreecatv.py | src/livestreamer/plugins/afreecatv.py | import re
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.plugin.api.utils import parse_query
from livestreamer.stream import RTMPStream
VIEW_LIVE_API_URL = "http://api.afreeca.tv/live/view_live.php"
VIEW_LIVE_API_URL_TW = "http://api.afreecatv.com.tw/live/... | import re
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.plugin.api.utils import parse_query
from livestreamer.stream import RTMPStream
VIEW_LIVE_API_URL = "http://api.afreeca.tv/live/view_live.php"
_url_re = re.compile("http(s)?://(\w+\.)?afreeca.tv/(?P<... | bsd-2-clause | Python |
dff7153d7f68dfed2e4dc002c22f34008378a81a | Remove unused imports | robotichead/NearBeach,robotichead/NearBeach,robotichead/NearBeach | locust_tests/load_testing_locus.py | locust_tests/load_testing_locus.py | # Import the locust libraries
import getpass
from locust import HttpUser, task, between
# Request the username and password to login into NearBeach
username = input("\nPlease enter the username: ")
password = getpass.getpass("\nPlease enter the password: ")
class QuickstartUser(HttpUser):
wait_time = between(1, ... | # Import the locust libraries
import time
import getpass
from locust import HttpUser, task, between
# Request the username and password to login into NearBeach
username = input("\nPlease enter the username: ")
password = getpass.getpass("\nPlease enter the password: ")
class QuickstartUser(HttpUser):
wait_time =... | mit | Python |
d92b8c824b1efed241c1857f12132e8ef5742a8b | add staticfiles storage | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | meinberlin/config/settings/build.py | meinberlin/config/settings/build.py | from .base import *
SECRET_KEY = "dummykeyforbuilding"
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
| from .base import *
SECRET_KEY = "dummykeyforbuilding"
| agpl-3.0 | Python |
7a4284cd1fd69847e9beba1fa45bfa9ebfebe2f2 | Use errno module instead of hardcoding error codes | jaraco/keyring | keyring/tests/backends/test_file.py | keyring/tests/backends/test_file.py | import os
import tempfile
import sys
import errno
from ..py30compat import unittest
from ..test_backend import BackendBasicTests
from ..util import random_string
from keyring.backends import file
class FileKeyringTests(BackendBasicTests):
def setUp(self):
super(FileKeyringTests, self).setUp()
s... | import os
import tempfile
import sys
from ..py30compat import unittest
from ..test_backend import BackendBasicTests
from ..util import random_string
from keyring.backends import file
class FileKeyringTests(BackendBasicTests):
def setUp(self):
super(FileKeyringTests, self).setUp()
self.keyring =... | mit | Python |
ce990bfb3c742c9f19f0af43a10aad8193fa084c | Use the package name when looking up version | cernops/python-keystoneclient-kerberos | keystoneclient_kerberos/__init__.py | keystoneclient_kerberos/__init__.py | # -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | apache-2.0 | Python |
a05bb771a8b9ee7cffb296534b4b7f6244784d4b | Configure default logging handler | AdamWill/mwclient,Jobava/mirror-mwclient,JeroenDeDauw/mwclient,mwclient/mwclient,ubibene/mwclient,danmichaelo/mwclient,PierreSelim/mwclient | mwclient/__init__.py | mwclient/__init__.py | """
Copyright (c) 2006-2011 Bryan Tong Minh
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish,... | """
Copyright (c) 2006-2011 Bryan Tong Minh
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish,... | mit | Python |
84a4f0e3e26403fc4618f06f56a1fbd8443d6e1a | Remove remnant debug statements | gogoair/foremast,gogoair/foremast | src/foremast/pipeline/__main__.py | src/foremast/pipeline/__main__.py | """Create Spinnaker Pipeline."""
import argparse
import logging
from ..args import add_app, add_debug, add_gitlab_token, add_properties
from ..consts import LOGGING_FORMAT, ENVS
from .create_pipeline import SpinnakerPipeline
from .create_pipeline_onetime import SpinnakerPipelineOnetime
def main():
"""Run newer s... | """Create Spinnaker Pipeline."""
import argparse
import logging
from ..args import add_app, add_debug, add_gitlab_token, add_properties, add_env
from ..consts import LOGGING_FORMAT, ENVS
from .create_pipeline import SpinnakerPipeline
from .create_pipeline_onetime import SpinnakerPipelineOnetime
def main():
"""Ru... | apache-2.0 | Python |
9fa0c60a2277491d1666048f3043938880b7a66a | clarify docstring | gboeing/osmnx,gboeing/osmnx | osmnx/_api.py | osmnx/_api.py | """Expose most common parts of public API directly in `osmnx.` namespace."""
from .bearing import add_edge_bearings
from .boundaries import gdf_from_place
from .boundaries import gdf_from_places
from .distance import get_nearest_edge
from .distance import get_nearest_edges
from .distance import get_nearest_node
from .... | """Expose the core OSMnx API."""
from .bearing import add_edge_bearings
from .boundaries import gdf_from_place
from .boundaries import gdf_from_places
from .distance import get_nearest_edge
from .distance import get_nearest_edges
from .distance import get_nearest_node
from .distance import get_nearest_nodes
from .elev... | mit | Python |
be751cb7e354a621502ee94e72f431f826e14444 | Convert mox to mock: tests/compute/test_nova.py | hguemar/cinder,nexusriot/cinder,JioCloud/cinder,duhzecca/cinder,rakeshmi/cinder,scottdangelo/RemoveVolumeMangerLocks,julianwang/cinder,manojhirway/ExistingImagesOnNFS,phenoxim/cinder,Nexenta/cinder,Paul-Ezell/cinder-1,JioCloud/cinder,manojhirway/ExistingImagesOnNFS,scality/cinder,leilihh/cinder,j-griffith/cinder,openst... | cinder/tests/compute/test_nova.py | cinder/tests/compute/test_nova.py | # Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | # Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | apache-2.0 | Python |
81195e2c15e99e5281085afeebdb19c5e8dcdace | Update _script.py | LeastAuthority/kubetop | src/kubetop/_script.py | src/kubetop/_script.py | # Copyright Least Authority Enterprises.
# See LICENSE for details.
"""
The command-line interface.
Theory of Operation
===================
#. Convert command line arguments to structured configuration, supplying defaults where necessary.
#. Construct the top-level kubetop service from the configuration.
#. Run the ... | # Copyright Least Authority Enterprises.
# See LICENSE for details.
"""
The command-line interface.
Theory of Operation
===================
#. Convert command line arguments to structured configuration, supplying defaults where necessary.
#. Construct the top-level kubetop service from the configuration.
#. Run the ... | mit | Python |
801c2233b61a96fa9a620c3c740cdce8dad3d490 | Complete iter sol | bowen0701/algorithms_data_structures | lc0941_valid_mountain_array.py | lc0941_valid_mountain_array.py | """Leetcode 941. Valid Mountain Array
Easy
URL: https://leetcode.com/problems/valid-mountain-array/
Given an array A of integers, return true if and only if it is a valid
mountain array.
Recall that A is a mountain array if and only if:
- A.length >= 3
- There exists some i with 0 < i < A.length - 1 such that:
* A... | """Leetcode 941. Valid Mountain Array
Easy
URL: https://leetcode.com/problems/valid-mountain-array/
Given an array A of integers, return true if and only if it is a valid
mountain array.
Recall that A is a mountain array if and only if:
- A.length >= 3
- There exists some i with 0 < i < A.length - 1 such that:
* A... | bsd-2-clause | Python |
433d9b2c1c29f32a7d5289e84673308c96302d8d | FIX a bug, you fuck'in forgot to rename the new function | cardmaster/makeclub,cardmaster/makeclub,cardmaster/makeclub | controlers/access.py | controlers/access.py | '''Copyright(C): Leaf Johnson 2011
This file is part of makeclub.
makeclub 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 the License, or
(at your option) any later versi... | '''Copyright(C): Leaf Johnson 2011
This file is part of makeclub.
makeclub 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 the License, or
(at your option) any later versi... | agpl-3.0 | Python |
a861238786a71fe6f0bea5f0d5a8f6b21cb68a62 | add TODO | pyro-ppl/numpyro | numpyro/util.py | numpyro/util.py | from __future__ import division
def dual_averaging(t0=10, kappa=0.75, gamma=0.05):
# TODO: add docs
def init_fn(prox_center=0.):
x_t = 0.
x_avg = 0. # average of primal sequence
g_avg = 0. # average of dual sequence
t = 0
return (x_t, x_avg, g_avg, t, prox_center)
... | from __future__ import division
def dual_averaging(t0=10, kappa=0.75, gamma=0.05):
def init_fn(prox_center=0.):
x_t = 0.
x_avg = 0. # average of primal sequence
g_avg = 0. # average of dual sequence
t = 0
return (x_t, x_avg, g_avg, t, prox_center)
def update_fn(g, st... | apache-2.0 | Python |
36cd68912202e04d533a26bcec3b0aa8514ba5fa | fix performance issues of purify | farakavco/lutino | src/lutino/persian.py | src/lutino/persian.py | # -*- coding: utf-8 -*-
_character_map = str.maketrans({
'ي': 'ی',
'ك': 'ک',
'ة': 'ه',
'ۀ': 'ه',
# Eastern Arabic-Indic digits (Persian and Urdu) U+06Fn: ۰۱۲۳۴۵۶۷۸۹
'۰': '0',
'۱': '1',
'۲': '2',
'۳': '3',
'۴': '4',
'۵': '5',
'۶': '6',
'۷': '7',
'۸': '8',
'۹'... | # -*- coding: utf-8 -*-
__author__ = 'vahid'
_character_map = {
'ي': 'ی',
'ك': 'ک',
'ة': 'ه',
'ۀ': 'ه',
# Eastern Arabic-Indic digits (Persian and Urdu) U+06Fn: ۰۱۲۳۴۵۶۷۸۹
'۰': '0',
'۱': '1',
'۲': '2',
'۳': '3',
'۴': '4',
'۵': '5',
'۶': '6',
'۷': '7',
'۸': '8',
... | apache-2.0 | Python |
6fcdfbea98d2770d770122ef10bcc4bb349f64e9 | Remove stub | stripe/stripe-python | tests/api_resources/test_source_transaction.py | tests/api_resources/test_source_transaction.py | from __future__ import absolute_import, division, print_function
import stripe
from tests.helper import StripeTestCase
class SourceTransactionTest(StripeTestCase):
def test_is_listable(self):
source = stripe.Source.construct_from({
'id': 'src_123',
'object': 'source'
}, st... | from __future__ import absolute_import, division, print_function
import stripe
from tests.helper import StripeTestCase
class SourceTransactionTest(StripeTestCase):
def test_is_listable(self):
# TODO: remove stub once stripe-mock supports source_transactions
self.stub_request(
'get',
... | mit | Python |
1a32bd6d797ebff3c447f865274d809d1b058a13 | test BQ download_to_file download_to_dataframe | CartoDB/cartoframes,CartoDB/cartoframes | tests/unit/data/client/test_bigquery_client.py | tests/unit/data/client/test_bigquery_client.py | import os
import csv
import pandas as pd
from unittest.mock import Mock, patch
from cartoframes.auth import Credentials
from cartoframes.data.clients.bigquery_client import BigQueryClient
class ResponseMock(list):
def __init__(self, data, **kwargs):
super(ResponseMock, self).__init__(data, **kwargs)
... | import os
import csv
from unittest.mock import Mock, patch
from cartoframes.auth import Credentials
from cartoframes.data.clients.bigquery_client import BigQueryClient
class ResponseMock(list):
def __init__(self, data, **kwargs):
super(ResponseMock, self).__init__(data, **kwargs)
self.total_rows... | bsd-3-clause | Python |
97710a45761ff6220b94df4d518151e31eb8ef5d | Make CI happy | snazy2000/netbox,lampwins/netbox,Alphalink/netbox,digitalocean/netbox,Alphalink/netbox,lampwins/netbox,lampwins/netbox,digitalocean/netbox,digitalocean/netbox,snazy2000/netbox,digitalocean/netbox,Alphalink/netbox,Alphalink/netbox,snazy2000/netbox,lampwins/netbox,snazy2000/netbox | netbox/extras/api/customfields.py | netbox/extras/api/customfields.py | from django.contrib.contenttypes.models import ContentType
from rest_framework import serializers
from extras.models import CF_TYPE_SELECT, CustomField, CustomFieldChoice
#
# Custom fields
#
class CustomFieldSerializer(serializers.BaseSerializer):
"""
Extends ModelSerializer to render any CustomFields and ... | from django.contrib.contenttypes.models import ContentType
from rest_framework import serializers
from extras.models import CF_TYPE_SELECT, CustomField, CustomFieldChoice
#
# Custom fields
#
class CustomFieldSerializer(serializers.BaseSerializer):
"""
Extends ModelSerializer to render any CustomFields and ... | apache-2.0 | Python |
63310b5417b39bcc8d98bef3a6e82e9488c60d57 | Refactor code | akperkins/cover-letter | createCoverLetter.py | createCoverLetter.py | from django.template import Template,Context
from django.conf import settings
import pyperclip
import sys
'''
creating a python script that will read in the coverLetter template
add the company name, and save it to a new file and the system's clipboard
Also append the current date to the letters as well
the compnay_na... | from django.template import Template,Context
from django.conf import settings
import pyperclip
import sys
argsList = None
if sys.argv[0] == "createCoverLetter.py":
argsList = sys.argv[1:]
else:
argsList = sys.argv
company_name=""
if len(argsList) != 1:
print "Invalid number of arguments passed,"+str(len... | mit | Python |
e47fa24ac7d5f56f2e1884247d2aa3068fa265e2 | fix loading ntlk and wordnet exception | makcedward/nlpaug,makcedward/nlpaug | nlpaug/model/word_dict/wordnet.py | nlpaug/model/word_dict/wordnet.py | try:
import nltk
from nltk.corpus import wordnet
except ImportError:
# No installation required if not using this function
pass
from nlpaug.model.word_dict import WordDictionary
class WordNet(WordDictionary):
def __init__(self, lang, is_synonym=True):
super().__init__(cache=True)
... | try:
import nltk
from nltk.corpus import wordnet
except ImportError:
# No installation required if not using this function
pass
from nlpaug.model.word_dict import WordDictionary
class WordNet(WordDictionary):
def __init__(self, lang, is_synonym=True):
super().__init__(cache=True)
... | mit | Python |
3b2a7b392522cbbb34586affd1ba1826145a2cb5 | Fix passing of parameters. | pikinder/nn-patterns | nn_patterns/explainer/__init__.py | nn_patterns/explainer/__init__.py |
from .base import *
from .gradient_based import *
from .misc import *
from .pattern_based import *
from .relevance_based import *
def create_explainer(name,
output_layer, patterns=None, to_layer=None, **kwargs):
return {
# Gradient based
"gradient": GradientExplainer,
... |
from .base import *
from .gradient_based import *
from .misc import *
from .pattern_based import *
from .relevance_based import *
def create_explainer(name,
output_layer, patterns=None, to_layer=None, **kwargs):
return {
# Gradient based
"gradient": GradientExplainer,
... | mit | Python |
bb9307ae43bab623f895db7c4040f736f545e8fc | Bump version number to 0.11. | ChristopherHogan/cython,mrGeen/cython,slonik-az/cython,mrGeen/cython,scoder/cython,c-blake/cython,hickford/cython,cython/cython,JelleZijlstra/cython,fabianrost84/cython,scoder/cython,rguillebert/CythonCTypesBackend,roxyboy/cython,mcanthony/cython,madjar/cython,hpfem/cython,bzzzz/cython,fperez/cython,roxyboy/cython,hhsp... | Cython/Compiler/Version.py | Cython/Compiler/Version.py | version = '0.11'
| version = '0.11.rc3'
| apache-2.0 | Python |
59ce22d604241d5092096a8aea0a6d25fc1325f3 | Remove dangling Docker images | morninj/django-docker,morninj/django-docker,morninj/django-docker | fabfile.py | fabfile.py | from fabric.api import *
from fabric.contrib.files import *
import os
from ConfigParser import SafeConfigParser
parser = SafeConfigParser()
parser.read(os.path.join(os.path.dirname(__file__), 'config.ini'))
import time
# Configure server admin login credentials
if parser.get('production', 'USE_PASSWORD'):
env.pass... | from fabric.api import *
from fabric.contrib.files import *
import os
from ConfigParser import SafeConfigParser
parser = SafeConfigParser()
parser.read(os.path.join(os.path.dirname(__file__), 'config.ini'))
import time
# Configure server admin login credentials
if parser.get('production', 'USE_PASSWORD'):
env.pass... | mit | Python |
addc1e83911f72282eca9603e2c483ba6ef5ef7c | Update to the latest XSP. | BansheeMediaPlayer/bockbuild,mono/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,mono/bockbuild | packages/xsp.py | packages/xsp.py | GitHubTarballPackage('mono', 'xsp', '3.0.11', '4587438369691b9b3e8415e1f113aa98b57d1fde', configure = './autogen.sh --prefix="%{prefix}"')
| GitHubTarballPackage('mono', 'xsp', '2.11', 'd3e2f80ff59ddff68e757a520655555e2fbf2695', configure = './autogen.sh --prefix="%{prefix}"')
| mit | Python |
cb702893ef902f120b1548057d2b433b48a5b04b | add filters for payment admin | lafranceinsoumise/api-django,lafranceinsoumise/api-django,lafranceinsoumise/api-django,lafranceinsoumise/api-django | src/payments/admin.py | src/payments/admin.py | from ajax_select.fields import AutoCompleteSelectField
from django import forms
from django.contrib import admin
from api.admin import admin_site
from payments import models
class PaymentForm(forms.ModelForm):
person = AutoCompleteSelectField(
"people",
required=True,
label="Personne"
... | from ajax_select.fields import AutoCompleteSelectField
from django import forms
from django.contrib import admin
from api.admin import admin_site
from payments import models
class PaymentForm(forms.ModelForm):
person = AutoCompleteSelectField(
"people",
required=True,
label="Personne"
... | agpl-3.0 | Python |
f8e30e1f69976829de2d473fecb6e32264a8fa59 | Add canonical urls for pages model #21 | GoWebyCMS/goweby-core-dev,GoWebyCMS/goweby-core-dev,GoWebyCMS/goweby-core-dev | pages/models.py | pages/models.py | from django.db import models
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from ckeditor.fields import RichTextField
from django.utils import timezone
# Create your models here.
class Page(models.Model):
STATUS_CHOICES = (
('draft', 'Draft'),
('published'... | from django.db import models
from django.contrib.auth.models import User
from ckeditor.fields import RichTextField
from django.utils import timezone
# Create your models here.
class Page(models.Model):
STATUS_CHOICES = (
('draft', 'Draft'),
('published', 'Published'),
)
menu_title = mo... | mit | Python |
d8b29fd094a7a2d74c74e32b05a810930655fb47 | Fix raw_input() error in python 3 | marella/phython,marella/phython,marella/phython | src/modules/phython.py | src/modules/phython.py | import json
import runpy
import sys
def run():
args = sys.argv
if len(args) < 3:
raise Exception('Both module name and function name are required.')
module, function = args[1:3]
module = runpy.run_module(module)
if function not in module:
raise Exception(function + ' is not defin... | import json
import runpy
import sys
def run():
args = sys.argv
if len(args) < 3:
raise Exception('Both module name and function name are required.')
module, function = args[1:3]
module = runpy.run_module(module)
if function not in module:
raise Exception(function + ' is not defin... | mit | Python |
262bb53597268145f18dfb42fbb20fe7a37c6671 | Fix error under windows when generating a UID. | pyhmsa/pyhmsa | src/pyhmsa/type/uid.py | src/pyhmsa/type/uid.py | #!/usr/bin/env python
"""
================================================================================
:mod:`uid` -- Generate unique identifier id
================================================================================
.. module:: uid
:synopsis: Generate unique identifier id
.. inheritance-diagram:: p... | #!/usr/bin/env python
"""
================================================================================
:mod:`uid` -- Generate unique identifier id
================================================================================
.. module:: uid
:synopsis: Generate unique identifier id
.. inheritance-diagram:: p... | mit | Python |
c2f6f2c2ed32d715ff65ae332e83be5ff55238f5 | Disable startup.warm.chrome_signin on Android | Pluto-tv/chromium-crosswalk,hgl888/chromium-crosswalk,Chilledheart/chromium,Just-D/chromium-1,hgl888/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,axinging/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,hgl888/chromium-crosswal... | tools/perf/benchmarks/chrome_signin_startup.py | tools/perf/benchmarks/chrome_signin_startup.py | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from core import perf_benchmark
from measurements import startup
import page_sets
from telemetry import benchmark
class _StartupWarm(perf_benchmark.PerfBen... | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from core import perf_benchmark
from measurements import startup
import page_sets
from telemetry import benchmark
class _StartupWarm(perf_benchmark.PerfBen... | bsd-3-clause | Python |
7726f50ee966d4f1ed542e6653907e2433b448b8 | set URI variable within conditional | jasonclark/python-samples | getFeed.py | getFeed.py | #!/usr/bin/env python
# get feed data from url
import urllib
import sys
import xml.dom.minidom
# URI of the feed
URI = sys.argv[1] if len(sys.argv) > 1 else 'http://www.npr.org/rss/rss.php?id=1019'
#URI = 'http://www.npr.org/rss/rss.php?id=1019'
#if len(sys.argv) > 1:
#URI = sys.argv[1]
# actual xml document
doc... | #!/usr/bin/env python
# get feed data from url
import urllib
import sys
import xml.dom.minidom
# URI of the feed
#URI = 'https://www.npr.org/rss/rss.php?id=1019'
#allow URI to be passed to script
URI = sys.argv[1]
# actual xml document
document = xml.dom.minidom.parse(urllib.urlopen(URI))
# create empty string to s... | mit | Python |
5ba1ee67df42d00eb336cadd4748469121c17ad5 | Remove "settings" function | piotrekw/pirx | pirx/utils.py | pirx/utils.py | import os
def path(*p):
import __main__
project_root = os.path.dirname(os.path.realpath(__main__.__file__))
return os.path.join(project_root, *p)
| import os
def setting(name):
return name.upper()
def path(*p):
import __main__
project_root = os.path.dirname(os.path.realpath(__main__.__file__))
return os.path.join(project_root, *p)
| mit | Python |
051e7ea666aa987334a2243756a2c97484037b61 | Update boundaries to main_curve ones | M2-AAIS/BAD | plot_s_curve.py | plot_s_curve.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from numpy import array, log
import sys
import os
import matplotlib.animation as animation
fig = plt.figure()
inpath = sys.argv[1]
if os.path.isfile(inpath):
print('Visiting {}'.format(inpath))
filenames = [inpath]
else:
_fil... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from numpy import array, log
import sys
import os
import matplotlib.animation as animation
fig = plt.figure()
inpath = sys.argv[1]
if os.path.isfile(inpath):
print('Visiting {}'.format(inpath))
filenames = [inpath]
else:
_fil... | mit | Python |
dde62a1bc100ba4be16489e4171f0c78593d95af | Add tests to http plugin | Muzer/smartbot,tomleese/smartbot,Cyanogenoid/smartbot,thomasleese/smartbot-old | plugins/http.py | plugins/http.py | import io
import requests
import unittest
class Plugin:
def on_command(self, bot, msg, stdin, stdout, reply):
url = None
if len(msg["args"]) >= 3:
url = msg["args"][2]
else:
url = stdin.read().strip()
if url:
headers = {"User-Agent": "SmartBot"}... | import requests
import sys
class Plugin:
def on_command(self, bot, msg):
url = None
if len(sys.argv) >= 3:
url = sys.argv[2]
else:
url = sys.stdin.read().strip()
if url:
headers = {"User-Agent": "SmartBot"}
page = requests.get(url, h... | mit | Python |
db1a951d7d1708546f1df1def92b6764135ff3cc | change the url base for lists | crateio/crate.web,crateio/crate.web | crate_project/urls.py | crate_project/urls.py | from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
import evaluator
evaluator.autodiscover
import ji18n.translate
ji18n.translate.patch()
from pinax.apps.account.openid_consumer import PinaxConsumer
from search.views import Sea... | from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
import evaluator
evaluator.autodiscover
import ji18n.translate
ji18n.translate.patch()
from pinax.apps.account.openid_consumer import PinaxConsumer
from search.views import Sea... | bsd-2-clause | Python |
8ff1206db08a53f5085f95eed3e85b8812723408 | validate url | littlezz/IslandCollection | core/analyzer.py | core/analyzer.py | from urllib import parse
from .islands import island_netloc_table, island_class_table, IslandNotDetectError
__author__ = 'zz'
def determine_island_name(url):
netloc = parse.urlparse(url).netloc
for url, name in island_netloc_table.items():
if url == netloc:
return name
else:
ra... | from urllib import parse
from .islands import island_netloc_table, island_class_table, IslandNotDetectError
__author__ = 'zz'
def determine_island_name(url):
netloc = parse.urlparse(url).netloc
for url, name in island_netloc_table.items():
if url == netloc:
return name
else:
ra... | mit | Python |
dd76e1b70f63cb5aa2c720c734b244789426abb8 | Add artful; stop building for yakkety | mit-athena/build-system | dabuildsys/config.py | dabuildsys/config.py | #!/usr/bin/python
"""
Shared configuration-level variables.
"""
from glob import glob
import os
import os.path
# If you edit these releases and tags, please also update
# debian-versions.sh in scripts.git (checked out at /mit/debathena/bin).
debian_releases = ['wheezy', 'jessie', 'stretch']
ubuntu_releases = ['prec... | #!/usr/bin/python
"""
Shared configuration-level variables.
"""
from glob import glob
import os
import os.path
# If you edit these releases and tags, please also update
# debian-versions.sh in scripts.git (checked out at /mit/debathena/bin).
debian_releases = ['wheezy', 'jessie', 'stretch']
ubuntu_releases = ['prec... | mit | Python |
b60d4d5a93f0f24e119f856c7877b8d386d0eee5 | make sure to return the state | neogenix/daikon | daikon/connection.py | daikon/connection.py | import requests
import anyjson as json
import urlparse
class Connection(object):
_state = None
_health = None
def __init__(self, host, port):
self.host = host
self.port = port
self.url = 'http://%s:%s' % (host, port)
def get(self, path, raise_for_status=True):
url = ur... | import requests
import anyjson as json
import urlparse
class Connection(object):
_state = None
_health = None
def __init__(self, host, port):
self.host = host
self.port = port
self.url = 'http://%s:%s' % (host, port)
def get(self, path, raise_for_status=True):
url = ur... | apache-2.0 | Python |
bc1d19800d58291f4c4392d041a7913602fe8c7d | Fix sorting dict items in python 3 | jcpeterson/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger | dallinger/jupyter.py | dallinger/jupyter.py | from ipywidgets import widgets
from jinja2 import Template
from traitlets import (
observe,
Unicode,
)
from dallinger.config import get_config
header_template = Template(u"""
<h2>{{ name }}</h2>
<div>Status: {{ status }}</div>
{% if app_id %}<div>App ID: {{ app_id }}</div>{% endif %}
""")
config_template = T... | from ipywidgets import widgets
from jinja2 import Template
from traitlets import (
observe,
Unicode,
)
from dallinger.config import get_config
header_template = Template(u"""
<h2>{{ name }}</h2>
<div>Status: {{ status }}</div>
{% if app_id %}<div>App ID: {{ app_id }}</div>{% endif %}
""")
config_template = T... | mit | Python |
020bca819d0e6e2d40136c3e819383baab11699f | return split in LDA. | mostafa-mahmoud/HyPRec,mostafa-mahmoud/sahwaka | lib/LDA.py | lib/LDA.py | #!/usr/bin/env python
import numpy
from lib.content_based import ContentBased
from sklearn.decomposition import LatentDirichletAllocation
from sklearn.feature_extraction.text import CountVectorizer
class LDARecommender(ContentBased):
def __init__(self, abstracts, evaluator, config, verbose=False):
super(L... | #!/usr/bin/env python
import numpy
from lib.content_based import ContentBased
from sklearn.decomposition import LatentDirichletAllocation
from sklearn.feature_extraction.text import CountVectorizer
class LDARecommender(ContentBased):
def __init__(self, abstracts, evaluator, config, verbose=False):
super(L... | apache-2.0 | Python |
6273aa694516cb38bdebc80886fa78497473b275 | update ip plugin | BruceZhang1993/PyIrcBot,BruceZhang1993/PyIrcBot | plugins/ip.py | plugins/ip.py | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
# -----------------------------
# Author: Bruce Zhang
# Email: zy183525594@163.com
# Version: 0.1
# -----------------------------
'''ip lookup plugin'''
import re
import json
import requests
def ip(args, nick, channel, c, e):
if not args:
return "%s: %s" ... | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
# -----------------------------
# Author: Bruce Zhang
# Email: zy183525594@163.com
# Version: 0.1
# -----------------------------
'''ip lookup plugin'''
import re
import json
import requests
def ip(args, nick, channel, c, e):
if not args:
return "%s: %s" ... | mit | Python |
1c01080116a94e1dcd30afa143454818a9aeaf31 | change version to represent actual version | androguard/androguard,shuxin/androguard,androguard/androguard,reox/androguard,huangtao2003/androguard | androguard/__init__.py | androguard/__init__.py | # The current version of Androguard
# Please use only this variable in any scripts,
# to keep the version number the same everywhere.
__version__ = "3.1.0-rc1"
| # The current version of Androguard
# Please use only this variable in any scripts,
# to keep the version number the same everywhere.
__version__ = "3.1.0"
| apache-2.0 | Python |
965f3ed4f4723547b69f9430fc5efc097c864579 | Remove extraneous spaces. | andybalaam/pepper,andybalaam/pepper,andybalaam/pepper,andybalaam/pepper,andybalaam/pepper | src/test/testparser.py | src/test/testparser.py |
from cStringIO import StringIO
from nose.tools import *
from tokenutils import Iterable2TokenStream, make_token
from libeeyore.functionvalues import *
from libeeyore.languagevalues import *
from libeeyore.values import *
from parse import EeyoreLexer
from parse import EeyoreParser
from parse import EeyoreTreeWalker... |
from cStringIO import StringIO
from nose.tools import *
from tokenutils import Iterable2TokenStream, make_token
from libeeyore.functionvalues import *
from libeeyore.languagevalues import *
from libeeyore.values import *
from parse import EeyoreLexer
from parse import EeyoreParser
from parse import EeyoreTreeWalker... | mit | Python |
5a85c1588d90524289af1d6f0cce99bf842dae5a | Fix a hack in the echo client. | CheeseLord/warts,CheeseLord/warts | src/test_echoclient.py | src/test_echoclient.py | import os
from twisted.internet import task, stdio, reactor
from twisted.internet.defer import Deferred
from twisted.internet.protocol import ClientFactory
from twisted.protocols.basic import Int16StringReceiver, LineReceiver
theClient = None
class EchoClient(Int16StringReceiver):
def __init__(self, onClientCo... | #!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from __future__ import print_function
import os
from twisted.internet import task, stdio, reactor
from twisted.internet.defer import Deferred
from twisted.internet.protocol import ClientFactory
from twisted.protocols.basic ... | mit | Python |
d449e9a81687de41d43a59a10eecf335dce9e30a | Use transaction.atomic() to manage transactions. | scibi/django-teryt,ad-m/django-teryt,ad-m/django-teryt,scibi/django-teryt | teryt/management/commands/teryt_parse.py | teryt/management/commands/teryt_parse.py | from django.core.management.base import BaseCommand, CommandError
from django.db import transaction, DatabaseError, IntegrityError
from optparse import make_option
from teryt.models import (
RodzajMiejscowosci, JednostkaAdministracyjna, Miejscowosc, Ulica
)
from teryt.utils import parse
import os.path
class Co... | from django.core.management.base import BaseCommand, CommandError
from django.db import transaction, DatabaseError, IntegrityError
from optparse import make_option
from teryt.models import (
RodzajMiejscowosci, JednostkaAdministracyjna, Miejscowosc, Ulica
)
from teryt.utils import parse
import os.path
class Co... | mit | Python |
223ffba460867f566dec8ae71619e0ca96249f72 | Add doc string to git_manager.py | tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes | src/utils/code_etl/git_manager.py | src/utils/code_etl/git_manager.py | #!/usr/bin/env python
"""Provides a Repository class to handle the downloading and removal of a
github repository.
This class should be used as follows:
with Repository("lab41/hermes") as hermes_repo:
# do_stuff()
The repository is downloaded to a temporary directory when the with block
enters, and is r... | #!/usr/bin/env python
"""
"""
import tempfile
import shutil
import subprocess
class Repository(object):
"""Manage the download and cleanup of a github.com git repository.
Given the name of a github repository, this class will download it to a
local, temporary directory. The directory will be cleaned up... | apache-2.0 | Python |
c8117584e3ebd331ed7aea8ec91751242d607a4e | clean up test_create_large_static_cells_and_rows | scylladb/scylla,scylladb/scylla,scylladb/scylla,scylladb/scylla | test/cql-pytest/test_large_cells_rows.py | test/cql-pytest/test_large_cells_rows.py | # Copyright 2020 ScyllaDB
#
# This file is part of Scylla.
#
# Scylla is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Scylla... | # Copyright 2020 ScyllaDB
#
# This file is part of Scylla.
#
# Scylla is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Scylla... | agpl-3.0 | Python |
d8c31128ee581a167c3b7fede6bdb600a154b1f3 | Add missing LICENSE headers | dennybaa/st2,peak6/st2,pixelrebel/st2,emedvedev/st2,emedvedev/st2,armab/st2,grengojbo/st2,punalpatel/st2,tonybaloney/st2,alfasin/st2,StackStorm/st2,StackStorm/st2,grengojbo/st2,lakshmi-kannan/st2,jtopjian/st2,pinterb/st2,pixelrebel/st2,pixelrebel/st2,dennybaa/st2,Plexxi/st2,Plexxi/st2,nzlosh/st2,pinterb/st2,dennybaa/st... | st2common/st2common/util/jinja.py | st2common/st2common/util/jinja.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | import json
import jinja2
import six
def render_values(mapping=None, context=None):
"""
Render an incoming mapping using context provided in context using Jinja2. Returns a dict
containing rendered mapping.
:param mapping: Input as a dictionary of key value pairs.
:type mapping: ``dict``
:p... | apache-2.0 | Python |
9b8bfbbe7f55a72f78de8865e5d7b0c727528e35 | set allows_subquery to True (#7863) | apache/incubator-superset,mistercrunch/panoramix,mistercrunch/panoramix,zhouyao1994/incubator-superset,zhouyao1994/incubator-superset,zhouyao1994/incubator-superset,apache/incubator-superset,airbnb/caravel,airbnb/superset,zhouyao1994/incubator-superset,mistercrunch/panoramix,mistercrunch/panoramix,apache/incubator-supe... | superset/db_engine_specs/druid.py | superset/db_engine_specs/druid.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 | Python |
4e628f9b2c3b30df81fb878d00343005badf952a | fix missing import | david-farrar/exaproxy,PrFalken/exaproxy,PrFalken/exaproxy,PrFalken/exaproxy,jbfavre/exaproxy,jbfavre/exaproxy,david-farrar/exaproxy,david-farrar/exaproxy | lib/exaproxy/network/server.py | lib/exaproxy/network/server.py | #!/usr/bin/env python
# encoding: utf-8
"""
server.py
Created by Thomas Mangin on 2011-11-30.
Copyright (c) 2011 Exa Networks. All rights reserved.
"""
# http://code.google.com/speed/articles/web-metrics.html
# http://itamarst.org/writings/pycon05/fast.html
from exaproxy.network.functions import listen
from exaproxy... | #!/usr/bin/env python
# encoding: utf-8
"""
server.py
Created by Thomas Mangin on 2011-11-30.
Copyright (c) 2011 Exa Networks. All rights reserved.
"""
# http://code.google.com/speed/articles/web-metrics.html
# http://itamarst.org/writings/pycon05/fast.html
from exaproxy.network.functions import listen
from exaproxy... | bsd-2-clause | Python |
e519b05d5137764b298c471e3b3566a25cb859d0 | Add depth first search | jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm | python_practice/graph/undirectedGraph.py | python_practice/graph/undirectedGraph.py |
class undirectedGraph(object):
def __init__(self, degrees):
self.degrees = degrees
self.adjacent_matrix = []
for i in range(degrees):
self.adjacent_matrix.append([0]*degrees)
def __str__(self):
output = ""
for row in self.adjacent_matrix:
for item in row:
output += "|"+str(item)
output += "|\... |
class undirectedGraph(object):
def __init__(self, degrees):
self.degrees = degrees
self.adjacent_matrix = []
for i in range(degrees):
self.adjacent_matrix.append([0]*degrees)
def __str__(self):
output = ""
for row in self.adjacent_matrix:
for item in row:
output += "|"+str(item)
output += "|\... | mit | Python |
ba64752915055014cf586ab854d64a6e30dc1690 | Add hours_since and minutes_since | webkom/coffee,webkom/coffee | coffee/models.py | coffee/models.py | import redis
from datetime import datetime
from coffee.config import app_config
class Status (object):
def __init__(self):
self.redis = redis.Redis(
host=app_config['REDIS_HOST'],
port=app_config['REDIS_PORT'],
password=app_config['REDIS_PW']
)
try:
... | import redis
from datetime import datetime
from coffee.config import app_config
class Status (object):
def __init__(self):
self.redis = redis.Redis(
host=app_config['REDIS_HOST'],
port=app_config['REDIS_PORT'],
password=app_config['REDIS_PW']
)
try:
... | mit | Python |
351c7645c43e217d9173362f0939648fd2c6123f | Fix Siri VM test | jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk | busstops/management/tests/test_import_sirivm.py | busstops/management/tests/test_import_sirivm.py | import os
from vcr import use_cassette
from django.test import TestCase
from ...models import DataSource
from ..commands import import_sirivm
class SiriVMImportTest(TestCase):
@use_cassette(os.path.join('data', 'vcr', 'import_sirivm.yaml'), decode_compressed_response=True)
def test_handle(self):
comma... | import os
from vcr import use_cassette
# from mock import patch
from django.test import TestCase
from ...models import DataSource
# with patch('time.sleep', return_value=None):
from ..commands import import_sirivm
@use_cassette(os.path.join('data', 'vcr', 'import_sirivm.yaml'), decode_compressed_response=True)
class ... | mpl-2.0 | Python |
159fa9d96a2182b9cf445f60c18fe465a298d5fb | Fix test logic | rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org | readthedocs/search/tests/test_proxied_api.py | readthedocs/search/tests/test_proxied_api.py | import pytest
from readthedocs.search.tests.test_api import BaseTestDocumentSearch
@pytest.mark.proxito
@pytest.mark.search
class TestProxiedSearchAPI(BaseTestDocumentSearch):
# This project slug needs to exist in the ``all_projects`` fixture.
host = 'docs.readthedocs.io'
@pytest.fixture(autouse=True)
... | import pytest
from readthedocs.search.tests.test_api import BaseTestDocumentSearch
@pytest.mark.proxito
@pytest.mark.search
class TestProxiedSearchAPI(BaseTestDocumentSearch):
host = 'pip.readthedocs.io'
@pytest.fixture(autouse=True)
def setup_settings(self, settings):
settings.PUBLIC_DOMAIN = ... | mit | Python |
3d3325f5ad654b8b14f0935883eaab579fc13780 | bump version | vmalloc/backslash-python,slash-testing/backslash-python | backslash/__version__.py | backslash/__version__.py | __version__ = "2.4.1"
| __version__ = "2.4.0"
| bsd-3-clause | Python |
ee6637dd9d63227a018b8a24ddae88a64a758f70 | bump version | praiskup/atomic,rh-atomic-bot/atomic,praiskup/atomic,cdrage/atomic,charliedrage/atomic,cdrage/atomic,dustymabe/atomic,charliedrage/atomic,ibotty/atomic,ibotty/atomic,sallyom/atomic,lsm5/atomic,sallyom/atomic,rh-atomic-bot/atomic,lsm5/atomic,dustymabe/atomic,aveshagarwal/atomic,aveshagarwal/atomic | Atomic/__init__.py | Atomic/__init__.py | import sys
from .pulp import PulpServer
from .config import PulpConfig
from .atomic import Atomic
__version__ = "1.2"
def writeOut(output, lf="\n"):
sys.stdout.flush()
sys.stdout.write(str(output) + lf)
def push_image_to_pulp(image, server_url, username, password, verify_ssl,
docker_... | import sys
from .pulp import PulpServer
from .config import PulpConfig
from .atomic import Atomic
__version__ = "1.1"
def writeOut(output, lf="\n"):
sys.stdout.flush()
sys.stdout.write(str(output) + lf)
def push_image_to_pulp(image, server_url, username, password, verify_ssl,
docker_... | lgpl-2.1 | Python |
0fc759a2142c2733b74ae5283ef46b29c31dd94f | update version number | hanya/MRI,hanya/MRI | pythonpath/mytools_Mri/values.py | pythonpath/mytools_Mri/values.py | # Copyright 2011 Tsutomu Uchino
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | # Copyright 2011 Tsutomu Uchino
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | Python |
a29563dab552d45a8ec6766246bacf4af2d16246 | Remove newimages method from ClosedSite | wikimedia/pywikibot-core,wikimedia/pywikibot-core | pywikibot/site/_obsoletesites.py | pywikibot/site/_obsoletesites.py | """Objects representing obsolete MediaWiki sites."""
#
# (C) Pywikibot team, 2019-2021
#
# Distributed under the terms of the MIT license.
#
import pywikibot
from pywikibot.exceptions import NoPage
from pywikibot.site._apisite import APISite
from pywikibot.site._basesite import BaseSite
from pywikibot.tools import rem... | """Objects representing obsolete MediaWiki sites."""
#
# (C) Pywikibot team, 2019-2021
#
# Distributed under the terms of the MIT license.
#
import pywikibot
from pywikibot.exceptions import NoPage
from pywikibot.site._apisite import APISite
from pywikibot.site._basesite import BaseSite
from pywikibot.tools import rem... | mit | Python |
6a1c42fb34826e54a604903b010f71f63a991784 | Update PyPI homepage link (refs #101) | phargogh/paver,gregorynicholas/paver,cecedille1/paver,cecedille1/paver,thedrow/paver,nikolas/paver,gregorynicholas/paver | paver/release.py | paver/release.py | """Release metadata for Paver."""
from paver.options import Bunch
from paver.tasks import VERSION
setup_meta=Bunch(
name='Paver',
version=VERSION,
description='Easy build, distribution and deployment scripting',
long_description="""Paver is a Python-based build/distribution/deployment scripting tool a... | """Release metadata for Paver."""
from paver.options import Bunch
from paver.tasks import VERSION
setup_meta=Bunch(
name='Paver',
version=VERSION,
description='Easy build, distribution and deployment scripting',
long_description="""Paver is a Python-based build/distribution/deployment scripting tool a... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.