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 |
|---|---|---|---|---|---|---|---|---|
7f0b530db953698e6e923366be6d0d98033e4afb | add description | seanpwilliams/pronto | prontopull.py | prontopull.py | # -*- coding: utf-8 -*-
'''
Pulls data from pronto cycle share. Combine with cron job to
get data over time
'''
from urllib2 import Request, urlopen
import json
from pandas.io.json import json_normalize
import time
url = "https://secure.prontocycleshare.com/data/stations.json"
request = Request(url)
response = urlope... | # -*- coding: utf-8 -*-
from urllib2 import Request, urlopen
import json
from pandas.io.json import json_normalize
import time
#from datetime import datetime
url = "https://secure.prontocycleshare.com/data/stations.json"
request = Request(url)
response = urlopen(request)
data = json.loads(response.read())
df=json_nor... | mit | Python |
d016e9f2620688bc1059977a12df638393c3fff1 | Bump version | markstory/lint-review,markstory/lint-review,markstory/lint-review | lintreview/__init__.py | lintreview/__init__.py | __version__ = '2.1.2'
| __version__ = '2.1.1'
| mit | Python |
c86e7107d2f9d8079b0010ac100f627f1c34d127 | Update ipc_lista1.2.py | any1m1c/ipc20161 | lista1/ipc_lista1.2.py | lista1/ipc_lista1.2.py | #ipc_lista1.2
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um Programa que peça um número e então mostre a mensagem O número informado foi [número].
number = input("Digite um número: ")
print "O número digitado foi ",number
| #ipc_lista1.2
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um Programa que peça um número e então mostre a mensagem O número informado foi [número].
number = input("Digite um número: ")
print "O número digitado foi ",number
| apache-2.0 | Python |
85432b9509744eadc47c73a21b49f9ea93172c78 | Update ipc_lista1.8.py | any1m1c/ipc20161 | lista1/ipc_lista1.8.py | lista1/ipc_lista1.8.py | #ipc_lista1.8
#Professor: Jucimar Junior
#Any Mendes Carvalho - 161531
| #ipc_lista1.8
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615
| apache-2.0 | Python |
9cad93eb5f04e9f455cec679089d8c8787ce3b04 | Enable appsembler reporting settings | gymnasium/edx-platform,gymnasium/edx-platform,gymnasium/edx-platform,gymnasium/edx-platform | lms/envs/appsembler.py | lms/envs/appsembler.py | import os
import json
from path import path
SERVICE_VARIANT = os.environ.get('SERVICE_VARIANT', None)
CONFIG_ROOT = path('/edx/app/edxapp/') #don't hardcode this in the future
CONFIG_PREFIX = SERVICE_VARIANT + "." if SERVICE_VARIANT else ""
with open(CONFIG_ROOT / CONFIG_PREFIX + 'env.json') as env_file:
ENV_TOK... | import os
import json
from path import path
SERVICE_VARIANT = os.environ.get('SERVICE_VARIANT', None)
CONFIG_ROOT = path('/edx/app/edxapp/') #don't hardcode this in the future
CONFIG_PREFIX = SERVICE_VARIANT + "." if SERVICE_VARIANT else ""
with open(CONFIG_ROOT / CONFIG_PREFIX + 'env.json') as env_file:
ENV_TOK... | agpl-3.0 | Python |
4315d028f114ae1005f57d33df964be05b2fb8a6 | use bin/penchy_test_job instead of running it directly | fhirschmann/penchy,fhirschmann/penchy | docs/commented_sample_job.py | docs/commented_sample_job.py | # A job description is two part: part 1 introduces the involved elements and
# part 2 joins them in a job
# part 1: introduce the elements
# setup job environment
from penchy.jobs import *
# import the configuration file (if needed)
import config
# define a node
node = NodeConfiguratio... | # A job description is two part: part 1 introduces the involved elements and
# part 2 joins them in a job
# part 1: introduce the elements
# setup job environment
from penchy.jobs import *
# define a node
node = NodeConfiguration(
# that is the localhost
'localhost',
# ssh p... | mit | Python |
927de70d3212c5106846b6f6f6333b93eceacea5 | add python 脚本 | ohun/mpush,hongjun117/mpush,hongjun117/mpush,mpusher/mpush,mpusher/mpush,mpusher/mpush,hongjun117/mpush,ohun/mpush | pub-python.py | pub-python.py | # coding=utf8
import paramiko
import datetime
import telnetlib
HOSTS = [
{
'HOST':'hive1_host',
'PORT':9092,
'USER':'root'
},
{
'HOST':'hive2_host',
'PORT':9092,
'USER':'root'
}
]
BASEPATH = '/root/mpush'
class SSH():
def __init__(self):
... | # coding=utf8
import paramiko
import datetime
HOSTS = [
{
'HOST':'hive1_host',
'PORT':9092,
'USER':'root'
},
{
'HOST':'hive2_host',
'PORT':9092,
'USER':'root'
}
]
class SSH():
def __init__(self):
self.client = None
def connect(self,host... | apache-2.0 | Python |
9f699f66c1ff14d884157cee358793d715b1e702 | delete print | LiGhT1EsS/cobra,40huo/cobra,braveghz/cobra,40huo/cobra,braveghz/cobra,40huo/cobra,wufeifei/cobra,LiGhT1EsS/cobra,LiGhT1EsS/cobra,LiGhT1EsS/cobra,40huo/cobra,40huo/cobra,wufeifei/cobra,wufeifei/cobra,LiGhT1EsS/cobra,braveghz/cobra,braveghz/cobra,wufeifei/cobra,wufeifei/cobra,braveghz/cobra,40huo/cobra,LiGhT1EsS/cobra,br... | tests/test_apiserver.py | tests/test_apiserver.py | # -*- coding: utf-8 -*-
"""
tests.apiserver
~~~~~~~~~~~~
Tests cobra.api
:author: 40huo <git@40huo.cn>
:homepage: https://github.com/wufeifei/cobra
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 Feei. All rights reserved
"""
# 测试完成需要手动关闭 API server 和扫描进... | # -*- coding: utf-8 -*-
"""
tests.apiserver
~~~~~~~~~~~~
Tests cobra.api
:author: 40huo <git@40huo.cn>
:homepage: https://github.com/wufeifei/cobra
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 Feei. All rights reserved
"""
# 测试完成需要手动关闭 API server 和扫描进... | mit | Python |
17d79c5ec4584ea2f1f8b7fe52b157b3988bb7fc | test gap score | yjzhang/uncurl_python,yjzhang/uncurl_python | tests/test_gap_score.py | tests/test_gap_score.py | """
Using gap score to determine optimal cluster number
"""
import unittest
from unittest import TestCase
from flaky import flaky
import numpy as np
import scipy
from uncurl import gap_score
class GapScoreTest(TestCase):
def setUp(self):
pass
def test_gap_score(self):
data_mat = scipy.io.l... | """
Using gap score to determine optimal cluster number
"""
import unittest
from unittest import TestCase
from flaky import flaky
import numpy as np
import scipy
from uncurl import gap_score
class GapScoreTest(TestCase):
def setUp(self):
pass
def test_gap_score(self):
data_mat = scipy.io.l... | mit | Python |
04f7b8aa85bf2bb2c16eb246ee7c9d7ae5fc8cff | check contents | deginner/bitjws | tests/test_roundtrip.py | tests/test_roundtrip.py | import json
import bitjws
def test_encode_decode():
key = bitjws.PrivateKey()
ser = bitjws.sign_serialize(key)
header, payload = bitjws.validate_deserialize(ser)
rawheader, rawpayload = ser.rsplit('.', 1)[0].split('.')
origheader = bitjws.base64url_decode(rawheader.encode('utf8'))
origpayload... | import json
import bitjws
def test_encode_decode():
key = bitjws.PrivateKey()
ser = bitjws.sign_serialize(key)
header, payload = bitjws.validate_deserialize(ser)
rawheader, rawpayload = ser.rsplit('.', 1)[0].split('.')
origheader = bitjws.base64url_decode(rawheader.encode('utf8'))
origpayload... | mit | Python |
3059e2cf76e2e7bfb90c6c03afc5ee372294de94 | use with_setup instead of setUp/tearDown | chelmertz/spotifile,raoulh/spotifile,raoulh/spotifile,catharsis/spotifile,raoulh/spotifile,catharsis/spotifile,chelmertz/spotifile,chelmertz/spotifile,catharsis/spotifile | tests/test_spotifile.py | tests/test_spotifile.py | from nose import with_setup
import os
from os import path
from subprocess import check_call
from sh import ls, cat
mountpoint = '/tmp/spotifile_test_mount'
def fs_mount():
if not path.exists(mountpoint):
os.mkdir(mountpoint)
check_call(['./spotifile', mountpoint])
def fs_unmount():
check_call(['fusermount', '-... | import unittest
import os
from subprocess import check_call
from sh import ls
mountpoint = '/tmp/spotifile_test_mount'
class SpotifileTestClass(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not os.path.exists(mountpoint):
os.mkdir(mountpoint)
@classmethod
def tearDownClass(cls):
if os.path.exis... | bsd-3-clause | Python |
7fb5b04bb4054f60cefc79efabcef07979628285 | add directory encoding test in test_conf | zestyr/lbry,zestyr/lbry,lbryio/lbry,zestyr/lbry,lbryio/lbry,lbryio/lbry | tests/unit/test_conf.py | tests/unit/test_conf.py | import os
from twisted.trial import unittest
from lbrynet import conf
class SettingsTest(unittest.TestCase):
def setUp(self):
os.environ['LBRY_TEST'] = 'test_string'
def tearDown(self):
del os.environ['LBRY_TEST']
@staticmethod
def get_mock_config_instance():
settings = {'te... | import os
from twisted.trial import unittest
from lbrynet import conf
class SettingsTest(unittest.TestCase):
def setUp(self):
os.environ['LBRY_TEST'] = 'test_string'
def tearDown(self):
del os.environ['LBRY_TEST']
@staticmethod
def get_mock_config_instance():
settings = {'t... | mit | Python |
c81393a8de27595f61cffc09fa6fa8352bb54b9c | Return a random set of factors | CubicComet/exercism-python-solutions | palindrome-products/palindrome_products.py | palindrome-products/palindrome_products.py | import random
from collections import defaultdict
def largest_palindrome(max_factor, min_factor=0):
return _palindromes(max_factor, min_factor, max)
def smallest_palindrome(max_factor, min_factor=0):
return _palindromes(max_factor, min_factor, min)
def _palindromes(max_factor, min_factor, minmax):
pal... | from collections import defaultdict
def largest_palindrome(max_factor, min_factor=0):
return _palindromes(max_factor, min_factor, max)
def smallest_palindrome(max_factor, min_factor=0):
return _palindromes(max_factor, min_factor, min)
def _palindromes(max_factor, min_factor, minmax):
pals = defaultdic... | agpl-3.0 | Python |
45c1446779cbce050573264101b1afe3d7fe42b4 | Update BaseSearchCommand | yunojuno/elasticsearch-django | elasticsearch_django/management/commands/__init__.py | elasticsearch_django/management/commands/__init__.py | # -*- coding: utf-8 -*-
"""Base command for search-related management commands."""
import logging
from django.core.management.base import BaseCommand
from elasticsearch.exceptions import TransportError
logger = logging.getLogger(__name__)
class BaseSearchCommand(BaseCommand):
"""Base class for commands that i... | # -*- coding: utf-8 -*-
"""Base command for search-related management commands."""
import logging
from django.core.management.base import BaseCommand
from elasticsearch.exceptions import TransportError
logger = logging.getLogger(__name__)
class BaseSearchCommand(BaseCommand):
"""Base class for commands that i... | mit | Python |
15a32b91b36c9deba5a4fc1d8c843a5e044b62c3 | remove unnecessary comments and print statements | datavisyn/tdp_core,datavisyn/tdp_core,datavisyn/tdp_core,datavisyn/tdp_core | tdp_core/mapping_table.py | tdp_core/mapping_table.py | import logging
from . import db
import itertools
_log = logging.getLogger(__name__)
class SQLMappingTable(object):
def __init__(self, mapping, engine):
self.from_idtype = mapping.from_idtype
self.to_idtype = mapping.to_idtype
self._engine = engine
self._query = mapping.query
self._integer_ids =... | import logging
from . import db
import itertools
_log = logging.getLogger(__name__)
class SQLMappingTable(object):
def __init__(self, mapping, engine):
self.from_idtype = mapping.from_idtype
self.to_idtype = mapping.to_idtype
self._engine = engine
self._query = mapping.query
self._integer_ids =... | bsd-3-clause | Python |
f14c5c9e4a3c7d196421ce3d60ec64fdee4749dd | make arguments consistent | kuchenrolle/redditquery | src/redditquery/parse.py | src/redditquery/parse.py | #!/usr/bin/python3
import os
import argparse
def parser():
"""Parses arguments from comman line using argparse.
Parameters"""
# default directory for reddit files
default_directory = os.path.join(os.getcwd(), "data")
parser = argparse.ArgumentParser()
# obligatory
parser.add_argument("mod... | #!/usr/bin/python3
import os
import argparse
def parser():
"""Parses arguments from comman line using argparse.
Parameters"""
# default directory for reddit files
default_directory = os.path.join(os.getcwd(), "data")
parser = argparse.ArgumentParser()
# obligatory
parser.add_argument("mod... | mit | Python |
2797797497f4f5ad606764815b334321732bef3b | Rename fibonacci() to fibonacci_recur() | bowen0701/algorithms_data_structures | alg_fibonacci.py | alg_fibonacci.py | """Fibonacci series:
0, 1, 1, 2, 3, 5, 8,...
- Fib(0) = 0
- Fib(1) = 1
- Fib(n) = Fib(n - 1) + Fib(n - 2)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def fibonacci_recur(n):
"""Get nth number of Fibonacci series by recursion."""
if n <= 1... | """Fibonacci series:
0, 1, 1, 2, 3, 5, 8,...
- Fib(0) = 0
- Fib(1) = 1
- Fib(n) = Fib(n - 1) + Fib(n - 2)
"""
from __future__ import print_function
def fibonacci(n):
"""Get nth number of Fibonacci series by recursion."""
if n == 0:
return 0
elif n == 1 or n == 2:
return 1
else:
... | bsd-2-clause | Python |
ebbcce590483a5970268db0c59bae0cec81648ad | Add example commands for the User Preferences api | ColdrickSotK/storyboard,ColdrickSotK/storyboard,ColdrickSotK/storyboard | storyboard/api/v1/user_preferences.py | storyboard/api/v1/user_preferences.py | # Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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... | # Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | apache-2.0 | Python |
f0ab4ecbc2e385dd69d644b6f8e4e41cdaa48423 | Add note. | christabor/MoAL,christabor/MoAL,christabor/MoAL,christabor/MoAL,christabor/MoAL | software_engineering/problem_solving/design_patterns/grasp/pattern_pure_fabrication.py | software_engineering/problem_solving/design_patterns/grasp/pattern_pure_fabrication.py | # -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
if __name__ == '__main__':
from os import getcwd
from os import sys
sys.path.append(getcwd())
from helpers.display import Section
from uuid import uuid1
from random import choice
from random import randrange as rr
DEBUG = True ... | # -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
if __name__ == '__main__':
from os import getcwd
from os import sys
sys.path.append(getcwd())
from helpers.display import Section
from uuid import uuid1
from random import choice
from random import randrange as rr
DEBUG = True ... | apache-2.0 | Python |
aa278487b4e65da413a217729b852a9c08a090cf | create function headers and change request structure | pagarme/pagarme-python | pagarme/resources/handler_request.py | pagarme/resources/handler_request.py | import requests
TEMPORARY_COMPANY = 'https://api.pagar.me/1/companies/temporary'
def validate_response(pagarme_response):
if pagarme_response.status_code == 200:
return pagarme_response.json()
else:
return error(pagarme_response.json())
def create_temporary_company():
company = request... | import requests
import json
TEMPORARY_COMPANY = 'https://api.pagar.me/1/companies/temporary'
def validate_response(pagarme_response):
if pagarme_response.status_code == 200:
return pagarme_response.json()
else:
return error(pagarme_response.json())
def create_temporary_company():
compan... | mit | Python |
c838bee36ac1e68afd5f00630b98f806289f89c8 | Update fetch_metrics.py | GoogleCloudPlatform/gcsfuse,GoogleCloudPlatform/gcsfuse,GoogleCloudPlatform/gcsfuse | perfmetrics/scripts/fetch_metrics.py | perfmetrics/scripts/fetch_metrics.py | """Executes fio_metrics.py and vm_metrics.py by passing appropriate arguments.
"""
import socket
import sys
import time
from fio import fio_metrics
from vm_metrics import vm_metrics
from gsheet import gsheet
INSTANCE = socket.gethostname()
PERIOD_SEC = 120
# Google sheet worksheets
FIO_WORKSHEET_NAME = 'fio_metrics'
... | """Executes fio_metrics.py and vm_metrics.py by passing appropriate arguments.
"""
import socket
import sys
import time
from fio import fio_metrics
from vm_metrics import vm_metrics
from gsheet import gsheet
INSTANCE = socket.gethostname()
PERIOD = 120
# Google sheet worksheets
FIO_WORKSHEET_NAME = 'fio_metrics'
VM_W... | apache-2.0 | Python |
597ea6bd20c9c1dbca46891d8c2aa12c625da555 | Fix unit tests | nettorta/yandex-tank,asekretenko/yandex-tank,yandex/yandex-tank,netortik/yandex-tank,direvius/yandex-tank,nnugumanov/yandex-tank,f2nd/yandex-tank,fomars/yandex-tank,direvius/yandex-tank,yandex/yandex-tank,nnugumanov/yandex-tank,asekretenko/yandex-tank,netortik/yandex-tank,nettorta/yandex-tank,ei-grad/yandex-tank,f2nd/y... | Tests/ConsoleWorkerTest.py | Tests/ConsoleWorkerTest.py | from Tank.ConsoleWorker import ConsoleTank
from Tank.Plugins.ConsoleOnline import ConsoleOnlinePlugin
from Tank.Plugins.DataUploader import DataUploaderPlugin
from Tests.ConsoleOnlinePluginTest import FakeConsoleMarkup
from Tests.DataUploaderTest import FakeAPICLient
from Tests.TankTests import FakeOptions
import TankT... | import TankTests
import os
import unittest
from Tank.ConsoleWorker import ConsoleTank
from Tests.TankTests import FakeOptions
from Tank.Plugins.DataUploader import DataUploaderPlugin
from Tests.DataUploaderTest import FakeAPICLient
from Tank.Plugins.ConsoleOnline import ConsoleOnlinePlugin
from Tests.ConsoleOnlinePlugi... | lgpl-2.1 | Python |
8a4d259df272a65f95bacf233dc8654c68f5f54f | add identity coordinate mapping to ToUint8 and ToFloat32 augmentors (#339) | ppwwyyxx/tensorpack,eyaler/tensorpack,eyaler/tensorpack,ppwwyyxx/tensorpack | tensorpack/dataflow/imgaug/convert.py | tensorpack/dataflow/imgaug/convert.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: convert.py
from .base import ImageAugmentor
from .meta import MapImage
import numpy as np
import cv2
__all__ = ['ColorSpace', 'Grayscale', 'ToUint8', 'ToFloat32']
class ColorSpace(ImageAugmentor):
""" Convert into another colorspace. """
def __init__(se... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: convert.py
from .base import ImageAugmentor
from .meta import MapImage
import numpy as np
import cv2
__all__ = ['ColorSpace', 'Grayscale', 'ToUint8', 'ToFloat32']
class ColorSpace(ImageAugmentor):
""" Convert into another colorspace. """
def __init__(se... | apache-2.0 | Python |
1e7a6b0fbbdb57053d3510b67c95c5d7e2fb6b81 | Enable to display accuracy graph | fukatani/CW_gui | floppy/report_widget.py | floppy/report_widget.py | from floppy.train_configuration import TrainParamServer
from PyQt5.QtWidgets import QWidget
from PyQt5.QtWidgets import QTabWidget
from PyQt5.QtGui import QPixmap
from PyQt5.QtGui import QPainter
from PyQt5.QtCore import Qt
from PyQt5.QtCore import QPoint
class ReportWidget(QTabWidget):
def __init__(self, *args... | from floppy.train_configuration import TrainParamServer
from PyQt5.QtWidgets import QWidget
from PyQt5.QtGui import QPixmap
from PyQt5.QtGui import QPainter
from PyQt5.QtCore import Qt
from PyQt5.QtCore import QPoint
class ReportWidget(QWidget):
def __init__(self, *args, **kwargs):
super(ReportWidget, s... | bsd-3-clause | Python |
335abb7a4ddeabf9175b522d9336b94b7e32acc0 | Fix incorrect FAIL data. | zlargon/mosquitto,zlargon/mosquitto,zlargon/mosquitto,zlargon/mosquitto,zlargon/mosquitto | test/broker/01-connect-anon-denied.py | test/broker/01-connect-anon-denied.py | #!/usr/bin/python
# Test whether an anonymous connection is correctly denied.
import subprocess
import socket
import time
from struct import *
rc = 1
keepalive = 10
connect_packet = pack('!BBH6sBBHH17s', 16, 12+2+17,6,"MQIsdp",3,2,keepalive,17,"connect-anon-test")
connack_packet = pack('!BBBB', 32, 2, 0, 5);
broker... | #!/usr/bin/python
# Test whether an anonymous connection is correctly denied.
import subprocess
import socket
import time
from struct import *
rc = 1
keepalive = 10
connect_packet = pack('!BBH6sBBHH17s', 16, 12+2+17,6,"MQIsdp",3,2,keepalive,17,"connect-anon-test")
connack_packet = pack('!BBBB', 32, 2, 0, 5);
broker... | bsd-3-clause | Python |
9de0a05d28c83742224c0e708e80b8add198a8a8 | Add user data export for comments | stefanw/froide,fin/froide,stefanw/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide,fin/froide,fin/froide | froide/comments/apps.py | froide/comments/apps.py | import json
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class CommentConfig(AppConfig):
name = 'froide.comments'
verbose_name = _('Comments')
def ready(self):
from froide.account import account_canceled
from froide.account.export import regis... | from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class CommentConfig(AppConfig):
name = 'froide.comments'
verbose_name = _('Comments')
def ready(self):
from froide.account import account_canceled
account_canceled.connect(cancel_user)
def cancel_... | mit | Python |
4a201a37318d5eea1e50e0619580a23f37e2e7da | Fix path for boringssl | peeracle/libwebsockets,peeracle/libwebsockets,peeracle/libwebsockets,peeracle/libwebsockets,peeracle/libwebsockets | libwebsockets.gyp | libwebsockets.gyp | {
'targets': [
{
'target_name': 'libwebsockets',
'type': 'static_library',
'standalone_static_library': 1,
'sources': [
'lib/base64-decode.c',
'lib/handshake.c',
'lib/libwebsockets.c',
'lib/service.c',
'lib/pollfd.c',
'lib/output.c',
... | {
'targets': [
{
'target_name': 'libwebsockets',
'type': 'static_library',
'standalone_static_library': 1,
'sources': [
'lib/base64-decode.c',
'lib/handshake.c',
'lib/libwebsockets.c',
'lib/service.c',
'lib/pollfd.c',
'lib/output.c',
... | lgpl-2.1 | Python |
eed4faf3bfe670421e7dc9c3065adbfceef0d2b6 | fix test for heapify | dnl-blkv/algorithms | linear_heapify.py | linear_heapify.py | # Building hash in O(n) time and O(1) additional space. Inspired by https://www.youtube.com/watch?v=MiyLo8adrWw
def heapify(a):
for i in range(len(a) // 2, -1, -1):
parent = i
while True:
candidates = [parent, 2 * parent + 1, 2 * parent + 2]
candidates = [e for e in candid... | # Building hash in O(n) time and O(1) additional space. Inspired by https://www.youtube.com/watch?v=MiyLo8adrWw
def heapify(a):
for i in range(len(a) // 2, -1, -1):
parent = i
while True:
candidates = [parent, 2 * parent + 1, 2 * parent + 2]
candidates = [e for e in candid... | mit | Python |
b113cf82004b608b371d1a249801340f57195587 | add __str__. | ulule/django-linguist | linguist/cache.py | linguist/cache.py | # -*- coding: utf-8 -*-
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class CachedTranslation(object):
def __init__(self, **kwargs):
from .models import Translation
self.instances = ['instance', 'translation']
self.fields = Translation._meta.... | # -*- coding: utf-8 -*-
class CachedTranslation(object):
def __init__(self, **kwargs):
from .models import Translation
self.instances = ['instance', 'translation']
self.fields = Translation._meta.get_all_field_names()
self.fields.remove('id')
attrs = self.fields + self.... | mit | Python |
b83576644d5aacd4ab841a03ff228796ff1b1b67 | change name | juschaef/purchase-workflow,juschaef/purchase-workflow,juschaef/purchase-workflow | coolTestly/__openerp__.py | coolTestly/__openerp__.py | {
"name": "coolTestly",
"author": "Ju",
"version": "1.0",
"category": "Generic Modules/Sales & Purchases",
"depends": [
"purchase",
],
"demo": [],
"data": [
],
"installable": True
}
| {
"name": "testly",
"author": "Ju",
"version": "1.0",
"category": "Generic Modules/Sales & Purchases",
"depends": [
"purchase",
],
"demo": [],
"data": [
],
"installable": True
} | agpl-3.0 | Python |
f844b95e7cb034985f1d284a41789d1e427b0f74 | Update env_detect.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | device/src/env_detect.py | device/src/env_detect.py | #!/usr/bin/env python
#Weather station.
#detect environment information from several sensors:
#water leverl, air humity, raining, air temperature, light sensitivity.
#Air temperature&humity sensor: DHT11.
#Add dht.py in micropython/stmhal/modules, refer to esp8266
#Compile the DHT in firmware, then use DHT lib in appli... | #!/usr/bin/env python
#Weather station.
#detect environment information from several sensors:
#water leverl, air humity, raining, air temperature, light sensitivity.
#Air temperature&humity sensor: DHT11.
#Add dht.py in micropython/stmhal/modules, refer to esp8266
#Compile the DHT in firmware, then use DHT lib in appli... | mit | Python |
ce948b49fbd4f3e8012b6d351bbf53db32172474 | fix repeated import of CascadeRPNHead (#8578) | open-mmlab/mmdetection,open-mmlab/mmdetection | mmdet/models/dense_heads/__init__.py | mmdet/models/dense_heads/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .anchor_free_head import AnchorFreeHead
from .anchor_head import AnchorHead
from .atss_head import ATSSHead
from .autoassign_head import AutoAssignHead
from .cascade_rpn_head import CascadeRPNHead, StageCascadeRPNHead
from .centernet_head import CenterNetHead
from .c... | # Copyright (c) OpenMMLab. All rights reserved.
from .anchor_free_head import AnchorFreeHead
from .anchor_head import AnchorHead
from .atss_head import ATSSHead
from .autoassign_head import AutoAssignHead
from .cascade_rpn_head import CascadeRPNHead, StageCascadeRPNHead
from .centernet_head import CenterNetHead
from .c... | apache-2.0 | Python |
5e7e60f8afb3ddeeec2714a9d11dd30a6ea3e52f | Add new calc_total_error tests | larrybradley/photutils,astropy/photutils | photutils/utils/tests/test_prepare_data.py | photutils/utils/tests/test_prepare_data.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from numpy.testing import assert_allclose
from astropy.tests.helper import pytest
import astropy.units as u
from .. import calc_... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from numpy.testing import assert_allclose
from astropy.tests.helper import pytest
from .. import calc_total_error
SHAPE = (5, 5... | bsd-3-clause | Python |
5dd6fa526eac5632f75d543342a7a5a45b866716 | Update plantcv/plantcv/visualize/obj_size_ecdf.py | stiphyMT/plantcv,stiphyMT/plantcv,danforthcenter/plantcv,danforthcenter/plantcv,stiphyMT/plantcv,danforthcenter/plantcv | plantcv/plantcv/visualize/obj_size_ecdf.py | plantcv/plantcv/visualize/obj_size_ecdf.py | # Plot Empirical Cumulative Distribution Function for Object Size
import os
import cv2
import pandas as pd
from plantcv.plantcv import params
from plantcv.plantcv._debug import _debug
from statsmodels.distributions.empirical_distribution import ECDF
from plotnine import ggplot, aes, geom_point, labels, scale_x_log10
... | # Plot Empirical Cumulative Distribution Function for Object Size
import os
import cv2
import pandas as pd
from plantcv.plantcv import params
from plantcv.plantcv._debug import _debug
from statsmodels.distributions.empirical_distribution import ECDF
from plotnine import ggplot, aes, geom_point, labels, \
scale_col... | mit | Python |
e56df10f3e40b9287735f1295a0ed72e1525896f | change json to md RasaHQ/roadmap#280 | RasaHQ/rasa_core,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu,RasaHQ/rasa_core,RasaHQ/rasa_nlu,RasaHQ/rasa_core | examples/restaurantbot/bot.py | examples/restaurantbot/bot.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import logging
import warnings
from policy import RestaurantPolicy
from rasa_core import utils
from rasa_core.agent import Agent
from rasa_core.policies.... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import logging
import warnings
from policy import RestaurantPolicy
from rasa_core import utils
from rasa_core.agent import Agent
from rasa_core.policies.... | apache-2.0 | Python |
40316f4a2f1e973ba98a50592a54f21a2d5ac18e | Add the exceptions module to describe exceptions from external target | yehzhang/RapidTest,yehzhang/RapidTest | rapidtest/executors/exceptions.py | rapidtest/executors/exceptions.py | from ..utils import Dictable
MSG_CANNOT_GUESS_METHOD = '''cannot find the target method. You may specify operations as \
arguments to Case if there are multiple methods to be called, or prepend all names of private \
methods with underscores.'''
class ExternalError(Exception):
pass
class ExternalEnvironmentErro... | class ExternalExecutionTargetError(Exception):
pass
| mit | Python |
07aca8e96d5e93edb684d0c4684ef8f837e8fc58 | Use comment builder for dirhtml too | sunnyzwh/readthedocs.org,hach-que/readthedocs.org,kenwang76/readthedocs.org,singingwolfboy/readthedocs.org,sid-kap/readthedocs.org,michaelmcandrew/readthedocs.org,dirn/readthedocs.org,sid-kap/readthedocs.org,espdev/readthedocs.org,tddv/readthedocs.org,mrshoki/readthedocs.org,SteveViss/readthedocs.org,sils1297/readthedo... | readthedocs/doc_builder/loader.py | readthedocs/doc_builder/loader.py | from django.utils.importlib import import_module
from django.conf import settings
# Managers
mkdocs = import_module(getattr(settings, 'MKDOCS_BACKEND', 'doc_builder.backends.mkdocs'))
sphinx = import_module(getattr(settings, 'SPHINX_BACKEND', 'doc_builder.backends.sphinx'))
loading = {
# Possible HTML Builders
... | from django.utils.importlib import import_module
from django.conf import settings
# Managers
mkdocs = import_module(getattr(settings, 'MKDOCS_BACKEND', 'doc_builder.backends.mkdocs'))
sphinx = import_module(getattr(settings, 'SPHINX_BACKEND', 'doc_builder.backends.sphinx'))
loading = {
# Possible HTML Builders
... | mit | Python |
adb9b262167beecb30edc281e4ab10fc05b3e6da | optimize imports and add common exceptions | joaolrpaulo/eletronic-voting-system,joaolrpaulo/eletronic-voting-system,joaolrpaulo/eletronic-voting-system | voting-server/app/errors.py | voting-server/app/errors.py | from flask import jsonify
from werkzeug.exceptions import HTTPException, default_exceptions
from app import app
def json_error(error):
response = jsonify(message = str(error))
response.status_code = error.code if isinstance(error, HTTPException) else 500
return response
for code in default_exceptions.ke... | from flask import jsonify
from werkzeug.exceptions import HTTPException
from werkzeug.exceptions import default_exceptions
from app import app
def json_error(error):
response = jsonify(message = str(error))
response.status_code = error.code if isinstance(error, HTTPException) else 500
return response
fo... | mit | Python |
7d650f3ee367a8eac710893c1818aa08cccf7598 | Add auth | Jim-Lin/like-japanavgirls,Jim-Lin/like-japanavgirls,Jim-Lin/like-japanavgirls,Jim-Lin/like-japanavgirls,Jim-Lin/like-japanavgirls | bot/dao.py | bot/dao.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from pymongo import MongoClient, IndexModel
class DAO:
def __init__(self, *args, **kwargs):
#args -- tuple of anonymous arguments
#kwargs -- dictionary of named arguments
if kwargs.get('mongo') is None:
self.default_mongo_init()
... | #!/usr/bin/python
# -*- coding: utf-8 -*-
from pymongo import MongoClient, IndexModel
class DAO:
def __init__(self, *args, **kwargs):
#args -- tuple of anonymous arguments
#kwargs -- dictionary of named arguments
if kwargs.get('mongo') is None:
self.default_mongo_init()
... | mit | Python |
4b8339b53f1b9dcd79f2a9060933713328a13b90 | Mark dask-distributed tests on Windows as xfail (#1747) | markelg/xray,shoyer/xarray,shoyer/xarray,pydata/xarray,chunweiyuan/xarray,jhamman/xarray,jcmgray/xarray,jhamman/xray,markelg/xray,pydata/xarray,pydata/xarray,markelg/xray,xray/xray,jhamman/xarray,jhamman/xarray,shoyer/xray | xarray/tests/test_distributed.py | xarray/tests/test_distributed.py | import sys
import pytest
import xarray as xr
from xarray.core.pycompat import suppress
distributed = pytest.importorskip('distributed')
da = pytest.importorskip('dask.array')
import dask
from distributed.utils_test import cluster, loop, gen_cluster
from distributed.client import futures_of, wait
from xarray.tests.te... | import pytest
import xarray as xr
from xarray.core.pycompat import suppress
distributed = pytest.importorskip('distributed')
da = pytest.importorskip('dask.array')
import dask
from distributed.utils_test import cluster, loop, gen_cluster
from distributed.client import futures_of, wait
from xarray.tests.test_backends ... | apache-2.0 | Python |
6c3ff180c3bda17f1b6fdcf4500fdefdef9d713f | Fix copy & paste errors in setting I brought over from django-skel. | PrecisionMojo/pm-www,PrecisionMojo/pm-www | vsub/settings/production.py | vsub/settings/production.py | """Settings used in the production environment."""
from memcacheify import memcacheify
from postgresify import postgresify
from base import *
## Email configuration
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# See: https://... | """Settings used in the production environment."""
from memcacheify import memcacheify
from postgresify import postgresify
from base import *
## Email configuration
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# See: https://... | mit | Python |
c3b0d4b05314dc9fd51c790a86d30659d09c5250 | Allow negative numbers in the GEOS string | Frojd/wagtail-geo-widget,Frojd/wagtail-geo-widget,Frojd/wagtail-geo-widget,Frojd/wagtail-geo-widget | wagtailgeowidget/helpers.py | wagtailgeowidget/helpers.py | import re
geos_ptrn = re.compile(
"^SRID=([0-9]{1,});POINT\((-?[0-9\.]{1,})\s(-?[0-9\.]{1,})\)$"
)
def geosgeometry_str_to_struct(value):
'''
Parses a geosgeometry string into struct.
Example:
SRID=5432;POINT(12.0 13.0)
Returns:
>> [5432, 12.0, 13.0]
'''
result = geos_pt... | import re
geos_ptrn = re.compile(
"^SRID=([0-9]{1,});POINT\(([0-9\.]{1,})\s([0-9\.]{1,})\)$"
)
def geosgeometry_str_to_struct(value):
'''
Parses a geosgeometry string into struct.
Example:
SRID=5432;POINT(12.0 13.0)
Returns:
>> [5432, 12.0, 13.0]
'''
result = geos_ptrn.m... | mit | Python |
7e45a26f86095ee2f6972e08697aa132e642636e | Test for types in __mul__ | bjodah/symengine.py,bjodah/symengine.py,symengine/symengine.py,bjodah/symengine.py,symengine/symengine.py,symengine/symengine.py | csympy/tests/test_arit.py | csympy/tests/test_arit.py | from nose.tools import raises
from csympy import Symbol, Integer
def test_arit1():
x = Symbol("x")
y = Symbol("y")
e = x + y
e = x * y
e = Integer(2)*x
e = 2*x
def test_arit2():
x = Symbol("x")
y = Symbol("y")
assert x+x == Integer(2) * x
assert x+x != Integer(3) * x
asser... | from csympy import Symbol, Integer
def test_arit1():
x = Symbol("x")
y = Symbol("y")
e = x + y
e = x * y
e = Integer(2)*x
e = 2*x
def test_arit2():
x = Symbol("x")
y = Symbol("y")
assert x+x == Integer(2) * x
assert x+x != Integer(3) * x
assert x+x == 2 * x
| mit | Python |
852c62eef3d9beea43927f75b1a8aaa021ce25f9 | Add a docstring to test helper | VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,edofic/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,j0gurt/ggrc-core,jmakov/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,josthkko/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,jos... | test/selenium/src/lib/test_helpers.py | test/selenium/src/lib/test_helpers.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
"""
Utility classes for page objects used in tests.
Details:
Most of the te... | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
"""
Utility classes for page objects used in tests.
Details:
Most of the te... | apache-2.0 | Python |
665ece3f699d6a62be0d9c859532ae73e250d86f | Update __init__.py | inkenbrandt/WellApplication | wellapplication/__init__.py | wellapplication/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.2.24'
__author__ = 'Paul Inkenbrandt'
__name__ = 'wellapplication'
from transport import *
from usgs import *
from chem import WQP
from mesopy import *
from graphs import piper, fdc, gantt
import MannKendall
import avgMeths
| # -*- coding: utf-8 -*-
__version__ = '0.2.24'
__author__ = 'Paul Inkenbrandt'
__name__ = 'wellapplication'
from transport import *
from usgs import *
from chem import WQP
from graphs import piper, fdc, gantt
import MannKendall
import avgMeths
| mit | Python |
f5e459e369f1a00d3407f7993e427b676047da21 | bump version | cberzan/django-anger | django_anger/__init__.py | django_anger/__init__.py | __version__ = "0.1.1-20130516"
| __version__ = "0.1-20130513.try3"
| mit | Python |
ed37e4fc5968c7ab17fa55aca3958e72c963ea78 | replace with right code | nvoron23/owasp-pysec,blabla1337/owasp-pysec,cardoso010/owasp-pysec,cardoso010/owasp-pysec,ebranca/owasp-pysec,nvoron23/owasp-pysec,ebranca/owasp-pysec,blabla1337/owasp-pysec,blabla1337/owasp-pysec,ebranca/owasp-pysec,cardoso010/owasp-pysec,nvoron23/owasp-pysec | demo/sort/sort.py | demo/sort/sort.py | #!/usr/bin/python2.7 -OOBRtt
import errno
import os
import operator
import sys
from pysec import alg
from pysec.io import fd
from pysec.utils import ilen, xrange
from pysec import tb
from pysec.xsplit import xbounds
# tb.set_excepthook(tb.short_tb)
BUFSIZE = 4096
MAX_MEMORY_SORT = 10240
TMP_DIR = os.path.abspath('... | #!/usr/bin/python2.7 -OOBRtt
import os
import sys
from pysec import alg
from pysec.io import fd
from pysec.xsplit import xbounds
def find_ck(fp, sub, chunk):
buf = fp[:chunk]
offset = len(buf)
sub_len = len(sub)
while buf:
pos = alg.find(sub)
if pos >= 0:
yield pos
... | apache-2.0 | Python |
34db4460aa67fc9abfaaaf2c48a6ea7c5b801ff0 | Fix for libtest for cpython 2.6 / jython / pypy | spaceone/pyjs,minghuascode/pyj,pombredanne/pyjs,lancezlin/pyjs,Hasimir/pyjs,gpitel/pyjs,pyjs/pyjs,anandology/pyjamas,gpitel/pyjs,pombredanne/pyjs,minghuascode/pyj,minghuascode/pyj,lancezlin/pyjs,pyjs/pyjs,pyjs/pyjs,pyjs/pyjs,minghuascode/pyj,spaceone/pyjs,spaceone/pyjs,anandology/pyjamas,Hasimir/pyjs,pombredanne/pyjs,p... | examples/libtest/imports/__init__.py | examples/libtest/imports/__init__.py |
exec_order = []
class Imports(object):
exec_order = exec_order
def __init__(self):
self.v = 1
imports = Imports()
overrideme = "not overridden"
from . import cls as loccls
# This is not valid since Python 2.6!
try:
from .imports import cls as upcls
except ImportError:
upcls = loccls
def c... |
exec_order = []
class Imports(object):
exec_order = exec_order
def __init__(self):
self.v = 1
imports = Imports()
overrideme = "not overridden"
from . import cls as loccls
from .imports import cls as upcls
def conditional_func():
return "not overridden"
if True:
def conditional_func():
... | apache-2.0 | Python |
e354eba380c6df2f0a14e324da9cbe6467494ddc | add - ModelIORedis & build up interface. | rfaulkner/easyML,rfaulkner/easyML,rfaulkner/easyML,rfaulkner/easyML | versus/tools/modelIO.py | versus/tools/modelIO.py | """
Class family for Model IO classes to handle read/write of learning models
"""
import redis
class ModelIO(object):
def __init__(self, **kwargs):
pass
def write(self, model):
raise NotImplementedError()
def validate(self, model):
""" Ensures that the model is valid. """
... | """
Class family for Model IO classes to handle read/write of learning models
"""
class ModelIO(object):
def __init__(self):
pass
def write(self):
raise NotImplementedError() | bsd-3-clause | Python |
4b9da366b4169caf8802dcbbf20168512cc4e12e | Fix typo | mikalstill/ostrich,mikalstill/ostrich | ostrich/stages/stage_30_clone_osa.py | ostrich/stages/stage_30_clone_osa.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 th... | # 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 th... | apache-2.0 | Python |
62f137072aa26999ad30dda01fe2a736c3e00495 | exclude in admin | Samael500/django-typograf | django_typograf/admin.py | django_typograf/admin.py | from django.contrib import admin
from django_typograf.utils import get_typograf_field_name, get_typograf_hash_field_name
class TypografAdmin(admin.ModelAdmin):
""" Admin class for hide typograf fields from admin site """
def _exclude(self, obj=None):
""" Mark typograf fields as exclude """
e... | from django.contrib import admin
from django_typograf.utils import get_typograf_field_name, get_typograf_hash_field_name
class TypografAdmin(admin.ModelAdmin):
""" Admin class for hide typograf fields from admin site """
def _exclude(self, obj=None):
""" Mark typograf fields as exclude """
e... | mit | Python |
1ba74fc225d71bc071827291d9942738ef56dd1f | Correct login view | jason2506/flask-skeleton,jason2506/flask-skeleton | apps/__init__.py | apps/__init__.py | # -*- coding: utf-8 -*-
from flask import Flask
from flask.ext.login import LoginManager
from .models import db, User
from .views import module
__all__ = ('create_app',)
def _init_db(app):
db.app = app
db.init_app(app)
def _init_jinja(app):
pass
def _init_login(app):
login_manager = LoginManage... | # -*- coding: utf-8 -*-
from flask import Flask
from flask.ext.login import LoginManager
from .models import db, User
from .views import module
__all__ = ('create_app',)
def _init_db(app):
db.app = app
db.init_app(app)
def _init_jinja(app):
pass
def _init_login(app):
login_manager = LoginManage... | bsd-3-clause | Python |
586418860c0441eaebadd0fe79989d6d9f90fa28 | Fix for the component lookup error in vocabulary | espenmn/bda.plone.productshop,espenmn/bda.plone.productshop,espenmn/bda.plone.productshop | src/bda/plone/productshop/vocabularies.py | src/bda/plone/productshop/vocabularies.py | from zope.interface import directlyProvides
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import (
SimpleVocabulary,
SimpleTerm,
)
from zope.i18nmessageid import MessageFactory
from .utils import (
dotted_name,
available_variant_aspects,
)
#added by espen
from zope.c... | from zope.interface import directlyProvides
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import (
SimpleVocabulary,
SimpleTerm,
)
from zope.i18nmessageid import MessageFactory
from .utils import (
dotted_name,
available_variant_aspects,
)
#added by espen
from zope.c... | bsd-3-clause | Python |
3cade5788e55b124ce6c55350afb1beae4d3a5c3 | Update __init__.py | qpxu007/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,rpiotti/Flask-AppBuilder,qpxu007/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,rpiotti/Flask-AppBuilder,qpxu007/Flask-AppBuilder,dpgaspar/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,zhounanshu/Flask-AppBuilder,qpxu007/Flask-AppBuilder,rpiott... | examples/quickhowto2/app/__init__.py | examples/quickhowto2/app/__init__.py | import logging
from flask import Flask
from flask.ext.appbuilder import SQLA, AppBuilder
#from sqlalchemy.engine import Engine
#from sqlalchemy import event
logging.basicConfig(format='%(asctime)s:%(levelname)s:%(name)s:%(message)s')
logging.getLogger().setLevel(logging.DEBUG)
app = Flask(__name__)
app.config.from_ob... | import logging
from flask import Flask
from flask.ext.appbuilder import SQLA, AppBuilder
#from sqlalchemy.engine import Engine
#from sqlalchemy import event
logging.basicConfig(format='%(asctime)s:%(levelname)s:%(name)s:%(message)s')
logging.getLogger().setLevel(logging.DEBUG)
app = Flask(__name__)
app.config.from_ob... | bsd-3-clause | Python |
14d12b1d6bbcf5784256b82f58974f02fe8d1503 | Remove unused imports. Gating tests so they do not run on Windows | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/states/test_cron.py | tests/integration/states/test_cron.py | # -*- coding: utf-8 -*-
'''
Tests for the cron state
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
log = logging.getLogger(__name__)
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
# Import... | # -*- coding: utf-8 -*-
'''
Tests for the cron state
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
log = logging.getLogger(__name__)
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
from test... | apache-2.0 | Python |
6493cc31acdc09df6c0ad952e95380ac31a0e504 | Update __init__.py | hronoses/vispy,sh4wn/vispy,julienr/vispy,jay3sh/vispy,sh4wn/vispy,ghisvail/vispy,jay3sh/vispy,drufat/vispy,hronoses/vispy,bollu/vispy,Eric89GXL/vispy,inclement/vispy,RebeccaWPerry/vispy,drufat/vispy,ghisvail/vispy,dchilds7/Deysha-Star-Formation,kkuunnddaannkk/vispy,srinathv/vispy,sh4wn/vispy,RebeccaWPerry/vispy,srinath... | vispy/color/__init__.py | vispy/color/__init__.py | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
Convience interfaces to manipulate colors.
This module provides support for manipulating colors.
"""
__all__ = ['Color', 'ColorArray', 'Colormap',
'get_colorma... | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
Convience interfaces to manipulate colors.
This module provides support for manipulating colors.
"""
<<<<<<< HEAD
__all__ = ['Color', 'ColorArray', 'Colormap',
... | bsd-3-clause | Python |
a364196814c3b33e7fd51a42b4c3a48a3aaeaee8 | Update list of extraordinary gentlemen | RealDolos/volaparrot | volaparrot/constants.py | volaparrot/constants.py | ADMINFAG = ["RealDolos"]
PARROTFAG = "Parrot"
BLACKFAGS = [i.casefold() for i in (
"kalyx", "merc", "loliq", "annoying", "RootBeats", "JEW2FORU", "quag", "mire", "perici", "Voldemort", "briseis", "brisis", "GNUsuks", "rhooes", "n1sm4n", "honeyhole", "Printer", "yume1")]
OBAMAS = [i.casefold() for i in (
"couns... | ADMINFAG = ["RealDolos"]
PARROTFAG = "Parrot"
BLACKFAGS = [i.casefold() for i in (
"kalyx", "merc", "loliq", "annoying", "bot", "RootBeats", "JEW2FORU", "quag", "mire", "perici")]
OBAMAS = [i.casefold() for i in (
"counselor", "briseis", "apha", "bread", "ark3", "jizzbomb", "acid", "elkoalemos", "tarta")]
BLA... | mit | Python |
84965de8b53dcb5b10788808a2bf135df82cd4d9 | Update dev DB to sqlite3 | voer-platform/vp.repo,voer-platform/vp.repo,voer-platform/vp.repo,voer-platform/vp.repo | vpr/vpr/settings/dev.py | vpr/vpr/settings/dev.py | # Django settings for vpr project.
from base import *
DEBUG = True
DEVELOPMENT = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'vpr.sqlite3', # Or path to databas... | # Django settings for vpr project.
from base import *
DEBUG = True
DEVELOPMENT = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
#'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
#'NAME': 'vpr.sqlite3', # Or path to datab... | agpl-3.0 | Python |
52f9d95582456754aa4e9f9cd5d59a308c9e256c | remove comments | curtiswest/pepi,curtiswest/pepi,curtiswest/pepi,curtiswest/pepi | server.py | server.py | import socket
import communication
import time
import cv2
import numpy as np
from picamera import PiCamera
import sys
import signal
run_condition = True
def signal_handler(signal, frame):
print('Exiting...')
global run_condition
run_condition = False
sys.exit(0)
def generateRandomImg(... | import socket
import communication
import time
import cv2
import numpy as np
from picamera import PiCamera
import sys
import signal
run_condition = True
def signal_handler(signal, frame):
print('Exiting...')
global run_condition
run_condition = False
sys.exit(0)
def generateRandomImg(... | apache-2.0 | Python |
95495c1b0ae1a696b95eb486c7a40d54f507dacb | Add cross origin requests. | Imvoo/MiniZinc-server,Imvoo/MiniZinc-server,Imvoo/MiniZinc-server | server.py | server.py | import pymzn
import os
from subprocess import Popen, PIPE
from flask import Flask, json, Response
app = Flask(__name__)
folder = 'models' #where the .mzn files are stored
models = []
for file in os.listdir(folder):
if file.endswith('.mzn'):
models.append(file)
@app.route('/')
def Allmodels():
return json.jsonify(... | import pymzn
import os
from subprocess import Popen, PIPE
from flask import Flask, json, Response
app = Flask(__name__)
folder = 'models' #where the .mzn files are stored
models = []
for file in os.listdir(folder):
if file.endswith('.mzn'):
models.append(file)
@app.route('/')
def Allmodels():
return json.jsonify(... | mit | Python |
eb889d08c6031ba6c2b55a883d09e22f5684f0ee | Add mode (training|arena) option to the command line | miguel89/vinidium | server.py | server.py | #!/usr/bin/env python
import os
import sys
import requests
import re
from bot import RandomBot
def get_new_game_state(server_host, key, mode='training', number_of_turns = '20'):
if(mode=='training'):
params = { 'key': key, 'turns': number_of_turns}
r = requests.post(server_host + '/api/training', ... | #!/usr/bin/env python
import os
import sys
import requests
import re
from bot import RandomBot
def get_new_game_state(server_host, key, number_of_turns = '20', mode='training'):
if(mode=='training'):
params = { 'key': key, 'turns': number_of_turns}
r = requests.post(server_host + '/api/training', ... | apache-2.0 | Python |
7542d224d2ab15adec31a2d896a22cab6a7a2b37 | add log | yiplee/ltc-huobi,yiplee/ltc-huobi,yiplee/ltc-huobi | spider.py | spider.py | # -*- coding: utf-8 -*-
import http.client
from ltc.models import Record
import json
def get_current_price():
conn = http.client.HTTPSConnection('api.huobi.com')
conn.request('GET','/staticmarket/ticker_ltc_json.js')
r = conn.getResponse()
if r.status == 200 :
data = r.read()
string = ... | # -*- coding: utf-8 -*-
import http.client
from ltc.models import Record
import json
def get_current_price():
conn = http.client.HTTPSConnection('api.huobi.com')
conn.request('GET','/staticmarket/ticker_ltc_json.js')
r = conn.getResponse()
if r.status == 200 :
data = r.read()
string = ... | mit | Python |
195e5cde1d81d7f73b77ce1b1c52f0beea8a2595 | Fix tclist iterator slicing | uranusjr/ctypes-ejdb | ejdb/tc.py | ejdb/tc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numbers
from . import c
from .utils import CObjectWrapper
class ListIterator(CObjectWrapper):
"""Python iterator wrapper for a `TCLIST *`.
"""
def __init__(self, wrapped, count=None):
super(ListIterator, self).__init__(
wrapped=wra... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numbers
from . import c
from .utils import CObjectWrapper
class ListIterator(CObjectWrapper):
"""Python iterator wrapper for a `TCLIST *`.
"""
def __init__(self, wrapped, count=None):
super(ListIterator, self).__init__(
wrapped=wra... | bsd-2-clause | Python |
93ed74d3c904c743f91f0c9e81f6d36bda731a10 | modify example.py | minoku/FixQueue | example.py | example.py | #! /usr/bin/python
import FixQueue
if __name__ == "__main__" :
fq = FixQueue(2) # 2 means queue size
fq.append('a')
fq.append('b')
print (fq) # ['a', 'b']
fq.append('c')
print (fq) # ['b', 'c']
print (fq.pop()) # b
print (fq) # ['b']
| #! /usr/bin/python
from FixQueue import FixQueue
if __name__ == "__main__" :
fq = FixQueue(2) # 2 means queue size
fq.append('a')
fq.append('b')
print (fq) # ['a', 'b']
fq.append('c')
print (fq) # ['b', 'c']
print (fq.pop()) # b
print (fq) # ['b']
| mit | Python |
80adb43a22f82a036d72bdd398d45ee4daa9a5ff | Update example.py | sskender/pornhub-api | example.py | example.py | import pornhub
search_keywords = []
#client = pornhub.PornHub("5.135.164.72", 3128, search_keywords)
#With proxy, given a Proxy IP and Port. For the countries with restricted access like Turkey, etc.
client = pornhub.PornHub(search_keywords)
for star in client.getStars(10):
print(star)
print(star["name"])
... | import pornhub
search_keywords = []
#client = pornhub.PornHub("5.135.164.72", 3128, search_keywords)
#With proxy, given a Proxy IP and Port. For the countries with restricted access like Turkey, etc.
client = pornhub.PornHub(search_keywords)
for star in client.getStars(10):
print(star)
print(star["name"])
... | mit | Python |
4053baa698f1047f09540c9ff3d6e8a08d844335 | Comment example | hickford/MechanicalSoup,hemberger/MechanicalSoup,MechanicalSoup/MechanicalSoup | example.py | example.py | """Example app to login to GitHub"""
import argparse
import mechanicalsoup
parser = argparse.ArgumentParser(description='Login to GitHub.')
parser.add_argument("username")
parser.add_argument("password")
args = parser.parse_args()
browser = mechanicalsoup.Browser()
# request github login page
login_page = browser.ge... | """Example app to login to GitHub"""
import argparse
import mechanicalsoup
parser = argparse.ArgumentParser(description='Login to GitHub.')
parser.add_argument("username")
parser.add_argument("password")
args = parser.parse_args()
browser = mechanicalsoup.Browser()
# request github login page
login_page = browser.ge... | mit | Python |
72b3642953d0e14d4b4c9ec03560a96d259f7d16 | Remove monkey patching in favor of inheritance for SpatialReference | bkg/greenwich | contones/srs.py | contones/srs.py | """Spatial reference systems"""
from osgeo import osr
class BaseSpatialReference(osr.SpatialReference):
"""Base class for extending osr.SpatialReference."""
def __repr__(self):
return self.wkt
@property
def srid(self):
"""Returns the EPSG ID as int if it exists."""
epsg_id = ... | """Spatial reference systems"""
from osgeo import osr
# Monkey patch SpatialReference since inheriting from SWIG classes is a hack
def srid(self):
"""Returns the EPSG ID as int if it exists."""
epsg_id = (self.GetAuthorityCode('PROJCS') or
self.GetAuthorityCode('GEOGCS'))
try:
retu... | bsd-3-clause | Python |
aef91895b31a615bb9af4cfae96aae97d91cad91 | Add Intercept transformer. | madrury/basis-expansions | dftransformers.py | dftransformers.py | import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
class ColumnSelector(BaseEstimator, TransformerMixin):
"""Transformer that selects a column in a numpy array or DataFrame
by index or name.
"""
def __init__(self, idxs=None, name=None):
self.idxs = ... | import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
class ColumnSelector(BaseEstimator, TransformerMixin):
"""Transformer that selects a column in a numpy array or DataFrame
by index or name.
"""
def __init__(self, idxs=None, name=None):
self.idxs = ... | bsd-3-clause | Python |
4a67891a1b8a96fcc666e12b2d4c27e3598d20a2 | add support email | it-projects-llc/website-addons,it-projects-llc/website-addons,it-projects-llc/website-addons | product_price_factor_online/__openerp__.py | product_price_factor_online/__openerp__.py | # -*- coding: utf-8 -*-
{
'name': "Product price factor for web shop",
'summary': """Multiplies price depending on product attributes""",
'category': 'Website',
'license': 'GPL-3',
'author': "IT-Projects LLC, Ildar Nasyrov",
'price': 20.00,
'currency': 'EUR',
'images': ['images/1.png'],
... | # -*- coding: utf-8 -*-
{
'name': "Product price factor for web shop",
'summary': """Multiplies price depending on product attributes""",
'category': 'Website',
'license': 'GPL-3',
'author': "IT-Projects LLC, Ildar Nasyrov",
'price': 20.00,
'currency': 'EUR',
'images': ['images/1.png'],
... | mit | Python |
6853fd1e45370a9db650b0983e9835c14ea9209e | Add diagnostics endpoint | c-w/gutenberg-http,c-w/gutenberg-http | gutenberg_http/views.py | gutenberg_http/views.py | from sanic.exceptions import RequestTimeout
from sanic.request import Request
from sanic.response import json
from gutenberg_http import app
from gutenberg_http.errors import InvalidUsage
from gutenberg_http.logic import body as _body
from gutenberg_http.logic import metadata as _metadata
from gutenberg_http.logic imp... | from sanic.exceptions import RequestTimeout
from sanic.request import Request
from sanic.response import json
from gutenberg_http import app
from gutenberg_http.errors import InvalidUsage
from gutenberg_http.logic import body as _body
from gutenberg_http.logic import metadata as _metadata
from gutenberg_http.logic imp... | apache-2.0 | Python |
39f0e8ed68bea6318bcb58801b5368428582f549 | remove SF checks from user api endpoint | openstax/openstax-cms,Connexions/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,Connexions/openstax-cms | api/views.py | api/views.py | from django.core.management import call_command
from django.utils.six import StringIO
from rest_framework import viewsets
from salesforce.models import Adopter
from salesforce.functions import check_if_faculty_pending
from social.apps.django_app.default.models import \
DjangoStorage as SocialAuthStorage
from wagtai... | from django.core.management import call_command
from django.utils.six import StringIO
from rest_framework import viewsets
from salesforce.models import Adopter
from salesforce.functions import check_if_faculty_pending
from social.apps.django_app.default.models import \
DjangoStorage as SocialAuthStorage
from wagtai... | agpl-3.0 | Python |
d994337007eb9cfe41edef591cbd30765660a822 | Prepare for next development iteration | toidi/hadoop-yarn-api-python-client | yarn_api_client/__init__.py | yarn_api_client/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.3.8.dev'
__all__ = ['ApplicationMaster', 'HistoryServer', 'NodeManager', 'ResourceManager']
from .application_master import ApplicationMaster
from .history_server import HistoryServer
from .node_manager import NodeManager
from .resource_manager import ResourceManager
| # -*- coding: utf-8 -*-
__version__ = '0.3.7'
__all__ = ['ApplicationMaster', 'HistoryServer', 'NodeManager', 'ResourceManager']
from .application_master import ApplicationMaster
from .history_server import HistoryServer
from .node_manager import NodeManager
from .resource_manager import ResourceManager
| bsd-3-clause | Python |
e3ff630917d6bb0f744330abace7c41d2b48ba8f | Add "pip_install" task | Turbo87/skylines,Harry-R/skylines,skylines-project/skylines,Turbo87/skylines,RBE-Avionik/skylines,Turbo87/skylines,Turbo87/skylines,kerel-fs/skylines,skylines-project/skylines,shadowoneau/skylines,kerel-fs/skylines,Harry-R/skylines,skylines-project/skylines,kerel-fs/skylines,shadowoneau/skylines,shadowoneau/skylines,Ha... | fabfile.py | fabfile.py | from fabric.api import env, task, local, cd, run, sudo, put
from tempfile import NamedTemporaryFile
env.use_ssh_config = True
env.hosts = ['skylines@skylines']
APP_DIR = '/home/skylines'
SRC_DIR = '%s/src' % APP_DIR
@task
def deploy(branch='master', force=False):
push(branch, force)
restart()
@task
def p... | from fabric.api import env, task, local, cd, run, sudo, put
from tempfile import NamedTemporaryFile
env.use_ssh_config = True
env.hosts = ['skylines@skylines']
APP_DIR = '/home/skylines'
SRC_DIR = '%s/src' % APP_DIR
@task
def deploy(branch='master', force=False):
push(branch, force)
restart()
@task
def p... | agpl-3.0 | Python |
6fae23c1d442880256ed2d4298844a50d6a7968e | Make sure "fab publish" cleans the dist folder | exhuma/puresnmp,exhuma/puresnmp | fabfile.py | fabfile.py | import fabric.api as fab
def generate_type_hierarchy():
"""
Generate a document containing the available variable types.
"""
fab.local('./env/bin/python -m puresnmp.types > docs/typetree.rst')
@fab.task
def doc():
generate_type_hierarchy()
fab.local('sphinx-apidoc '
'-o docs/de... | import fabric.api as fab
def generate_type_hierarchy():
"""
Generate a document containing the available variable types.
"""
fab.local('./env/bin/python -m puresnmp.types > docs/typetree.rst')
@fab.task
def doc():
generate_type_hierarchy()
fab.local('sphinx-apidoc '
'-o docs/de... | mit | Python |
fcdb3de7465467e4ea4a50faec1c39ec9a26e15c | set main function | mehmetkose/python3-async-crawler | async_crawler.py | async_crawler.py | #!/usr/bin/env python
# python 3.5 async web crawler.
# https://github.com/mehmetkose/python3.5-async-crawler
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2016 Mehmet Kose mehmet@linux.com
import aiohttp
import asyncio
from urllib.parse import urljoin, urldefrag... | #!/usr/bin/env python
# python 3.5 async web crawler.
# https://github.com/mehmetkose/python3.5-async-crawler
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2016 Mehmet Kose mehmet@linux.com
import aiohttp
import asyncio
from urllib.parse import urljoin, urldefrag... | mit | Python |
604d610d7d7e5d883c643daeba09f5b65db943ce | Make aws template use non-interactive apt-get (#1098) | Parsl/parsl,Parsl/parsl,Parsl/parsl,Parsl/parsl | parsl/providers/aws/template.py | parsl/providers/aws/template.py | template_string = """#!/bin/bash
#sed -i 's/us-east-2\.ec2\.//g' /etc/apt/sources.list
cd ~
export DEBIAN_FRONTEND=noninteractive
apt-get update -y
apt-get install -y python3 python3-pip libffi-dev g++ libssl-dev
pip3 install numpy scipy parsl
$worker_init
$user_script
# Shutdown the instance as soon as the worker sc... | template_string = """#!/bin/bash
#sed -i 's/us-east-2\.ec2\.//g' /etc/apt/sources.list
cd ~
apt-get update -y
apt-get install -y python3 python3-pip libffi-dev g++ libssl-dev
pip3 install numpy scipy parsl
$worker_init
$user_script
# Shutdown the instance as soon as the worker scripts exits
# or times out to avoid EC... | apache-2.0 | Python |
406987b860987894e297d5172a2a3eb0f4e082f8 | Fix a bug in the data resizer. | berendkleinhaneveld/Registrationshop,berendkleinhaneveld/Registrationshop | core/data/DataResizer.py | core/data/DataResizer.py | """
DataResizer
:Authors:
Berend Klein Haneveld
"""
from vtk import vtkImageResample
from vtk import vtkVersion
VTK_MAJOR_VERSION = vtkVersion.GetVTKMajorVersion()
class DataResizer(object):
"""
DataResizer is a tool that will resize a given image dataset.
You can specify a certain magnification factor or you c... | """
DataResizer
:Authors:
Berend Klein Haneveld
"""
from vtk import vtkImageResample
from vtk import vtkVersion
VTK_MAJOR_VERSION = vtkVersion.GetVTKMajorVersion()
class DataResizer(object):
"""
DataResizer is a tool that will resize a given image dataset.
You can specify a certain magnification factor or you c... | mit | Python |
31b0b97590ce496ba22a39c396ff868c6f511637 | install pre-commit | RockefellerArchiveCenter/DACSspace | dacsspace/client.py | dacsspace/client.py | #!/usr/bin/env python3
from configparser import ConfigParser
from asnake.aspace import ASpace
class ArchivesSpaceClient:
"""Handles communication with ArchivesSpace."""
def __init__(self):
config = ConfigParser()
config.read("local_settings.cfg")
self.aspace = ASpace(baseurl=config.g... | #!/usr/bin/env python3
import argparse
from configparser import ConfigParser
from asnake.aspace import ASpace
#published_only = False
class ArchivesSpaceClient:
"""Handles communication with ArchivesSpace."""
def __init__(self):
config = ConfigParser()
config.read("local_settings.cfg")
... | mit | Python |
0ca727f0ce5877ba2ca3ef74c9309c752a51fbf6 | Fix enable action on plugins | looker/sentry,looker/sentry,jean/sentry,ifduyue/sentry,jean/sentry,BuildingLink/sentry,fotinakis/sentry,zenefits/sentry,BuildingLink/sentry,jean/sentry,fotinakis/sentry,daevaorn/sentry,looker/sentry,alexm92/sentry,fotinakis/sentry,beeftornado/sentry,JackDanger/sentry,nicholasserra/sentry,BuildingLink/sentry,mvaled/sent... | src/sentry/web/frontend/project_plugin_enable.py | src/sentry/web/frontend/project_plugin_enable.py | from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.plugins import plugins
from sentry.web.frontend.base import ProjectView
class ProjectPluginEnableView(ProjectView):
required_scope = 'project:write'
def post(self, request, organization, team, project, slug):
... | from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.plugins import plugins
from sentry.web.frontend.base import ProjectView
class ProjectPluginEnableView(ProjectView):
required_scope = 'project:write'
def post(self, request, organization, team, project, slug):
... | bsd-3-clause | Python |
0599b259ed08121160196734f7212dc7fa33149f | Remove execute_auth_api_request method | devicehive/devicehive-python | devicehive/token.py | devicehive/token.py | from devicehive.api_request import ApiRequest
class Token(object):
"""Token class."""
AUTH_HEADER_NAME = 'Authorization'
AUTH_HEADER_VALUE_PREFIX = 'Bearer '
def __init__(self, transport, auth):
self._transport = transport
self._login = auth.get('login')
self._password = auth... | from devicehive.api_request import ApiRequest
from devicehive.api_response import ApiResponseError
class Token(object):
"""Token class."""
AUTH_HEADER_NAME = 'Authorization'
AUTH_HEADER_VALUE_PREFIX = 'Bearer '
def __init__(self, transport, auth):
self._transport = transport
self._lo... | apache-2.0 | Python |
0237fb8114f5a8423d39f44b2882d5dbf10954d7 | make .seen replies for CTCP ACTIONs say "doing nick message"; leaves .seen replies for PRIVMSG to channel the same ("saying message"). | Uname-a/knife_scraper,Uname-a/knife_scraper,Uname-a/knife_scraper | willie/modules/seen.py | willie/modules/seen.py | # coding=utf8
"""
seen.py - Willie Seen Module
Copyright 2008, Sean B. Palmer, inamidst.com
Copyright © 2012, Elad Alfassa <elad@fedoraproject.org>
Licensed under the Eiffel Forum License 2.
http://willie.dftba.net
"""
from __future__ import unicode_literals
import time
import datetime
from willie.tools import Identi... | # coding=utf8
"""
seen.py - Willie Seen Module
Copyright 2008, Sean B. Palmer, inamidst.com
Copyright © 2012, Elad Alfassa <elad@fedoraproject.org>
Licensed under the Eiffel Forum License 2.
http://willie.dftba.net
"""
from __future__ import unicode_literals
import time
import datetime
from willie.tools import Identi... | mit | Python |
107b72da8629d97452dc6b7ee0f44eeb7d9e351c | remove x-based matplotlib rendering | mahnen/gamma_limits_sensitivity | gamma_limits_sensitivity/__init__.py | gamma_limits_sensitivity/__init__.py | '''
This is the hard working code in order to calculate ULs, sensitivities,
and time to detections.
'''
import matplotlib.pyplot as plt
matplotlib.use('Agg')
def upper_limit(N_on, N_off, alpha, l_lim, A_eff):
figures = [plt.figure()]
dictionary = {
'plots': figures
}
return dictionary
de... | '''
This is the hard working code in order to calculate ULs, sensitivities,
and time to detections.
'''
import matplotlib.pyplot as plt
def upper_limit(N_on, N_off, alpha, l_lim, A_eff):
figures = [plt.figure()]
dictionary = {
'plots': figures
}
return dictionary
def sensitivity(s_bg, a... | mit | Python |
2a67ef989fa79aefccb9bcefe543715346642f91 | Normalize time to UTC. | abusesa/abusehelper | abusehelper/contrib/autoshun/autoshunbot.py | abusehelper/contrib/autoshun/autoshunbot.py | import idiokit
import time as _time
import calendar
from abusehelper.core import utils, cymruwhois, bot, events
AUTOSHUN_CSV_URL = "http://www.autoshun.org/files/shunlist.csv"
class AutoshunBot(bot.PollingBot):
COLUMNS = ["ip", "time", "type"]
feed_url = bot.Param(default=AUTOSHUN_CSV_URL)
use_cymru_whoi... | import idiokit
from abusehelper.core import utils, cymruwhois, bot, events
AUTOSHUN_CSV_URL = "http://www.autoshun.org/files/shunlist.csv"
class AutoshunBot(bot.PollingBot):
COLUMNS = ["ip", "time", "type"]
feed_url = bot.Param(default=AUTOSHUN_CSV_URL)
use_cymru_whois = bot.BoolParam(default=True)
... | mit | Python |
19afe973bffe1bb90942757fcbf81f3630ffddda | Update code formatting. | ghostwords/chameleon-crawler,ghostwords/chameleon-crawler,ghostwords/chameleon-crawler | crawler/args.py | crawler/args.py | #!/usr/bin/env python3
# chameleon-crawler
#
# Copyright 2015 ghostwords.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from os import path
import argparse
def ... | #!/usr/bin/env python3
# chameleon-crawler
#
# Copyright 2015 ghostwords.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from os import path
import argparse
def ... | mpl-2.0 | Python |
696b4e093171e9d6f17502650f15c9299438b874 | Drop Py2 and six on tests/integration/modules/test_virtualenv_mod.py | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/modules/test_virtualenv_mod.py | tests/integration/modules/test_virtualenv_mod.py | import os
import tempfile
import salt.utils.path
from salt.modules.virtualenv_mod import KNOWN_BINARY_NAMES
from tests.support.case import ModuleCase
from tests.support.helpers import slowTest
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import skipIf
@skipIf(
salt.utils.path.which_bin... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
import tempfile
import salt.utils.path
from salt.modules.virtualenv_mod import KNOWN_BINARY_NAMES
from tests.support.case import ModuleCase
from tests.support.helpers import slowTest
from tests.support.runtests ... | apache-2.0 | Python |
872320e02d5c922e177434f6b9fa70af8cf822b9 | Revert "RT-26" | unrealsolver/django-wkhtmltopdf,unrealsolver/django-wkhtmltopdf | wkhtmltopdf/__init__.py | wkhtmltopdf/__init__.py | import os
if 'DJANGO_SETTINGS_MODULE' in os.environ:
from .utils import *
__author__ = 'Incuna Ltd'
__version__ = '2.0.3'
| # Have to comment this import to perfrom pip install at the same time as django install
# import os
# if 'DJANGO_SETTINGS_MODULE' in os.environ:
# from .utils import *
__author__ = 'Incuna Ltd'
__version__ = '2.0.3'
| bsd-2-clause | Python |
563a82246180d949917bcd444411bbeb82604e97 | Add an assertion in search.py | luci/recipes-py,luci/recipes-py | recipe_modules/buildbucket/tests/search.py | recipe_modules/buildbucket/tests/search.py | # Copyright 2019 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
from recipe_engine import types
from google.protobuf import json_format
from PB.go.chromium.org.luci.buildbucket.proto import build as build_pb2... | # Copyright 2019 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
from recipe_engine import types
from google.protobuf import json_format
from PB.go.chromium.org.luci.buildbucket.proto import build as build_pb2... | apache-2.0 | Python |
ebe5a4ce8c12489bceb8991f627fdea29329e854 | Enable discovery server to reply also when started w/o net connection | knupouls/extremefeedbacklamp,knupouls/extremefeedbacklamp,dvaske/extremefeedbacklamp,dvaske/extremefeedbacklamp,dvaske/extremefeedbacklamp,knupouls/extremefeedbacklamp,switchgears/extremefeedbacklamp,switchgears/extremefeedbacklamp,switchgears/extremefeedbacklamp | xfd_discovery_server.py | xfd_discovery_server.py | #!/usr/bin/env python
#
# Author Aske Olsson aske.olsson@switch-gears.dk
#
import socket
import struct
import time
#MCAST_GRP = '224.1.1.1'
#MCAST_PORT = 5007
MCAST_ADDR = "239.77.124.213"
MCAST_PORT = 19418
MCAST_ANS_PORT = 19419
def socket_setup():
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_D... | #!/usr/bin/env python
#
# Author Aske Olsson aske.olsson@switch-gears.dk
#
import socket
import struct
#MCAST_GRP = '224.1.1.1'
#MCAST_PORT = 5007
MCAST_ADDR = "239.77.124.213"
MCAST_PORT = 19418
MCAST_ANS_PORT = 19419
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.setsockopt(socke... | mit | Python |
2cf4a0b93db423207798ffd93b2e91cdb73b6d2b | Add identifier for UT Brownsville | texastribune/tx_salaries,texastribune/tx_salaries | tx_salaries/utils/transformers/ut_brownsville.py | tx_salaries/utils/transformers/ut_brownsville.py | from . import base
from . import mixins
class TransformedRecord(mixins.GenericCompensationMixin,
mixins.GenericDepartmentMixin, mixins.GenericIdentifierMixin,
mixins.GenericJobTitleMixin, mixins.GenericPersonMixin,
mixins.MembershipMixin, mixins.OrganizationMixin, mixins.PostMixin,
mix... | from . import base
from . import mixins
class TransformedRecord(mixins.GenericCompensationMixin,
mixins.GenericDepartmentMixin, mixins.GenericIdentifierMixin,
mixins.GenericJobTitleMixin, mixins.GenericPersonMixin,
mixins.MembershipMixin, mixins.OrganizationMixin, mixins.PostMixin,
mix... | apache-2.0 | Python |
c3df6a10d008441c79eb07b889f52fe0de22538b | Fix the default prefix | miquella/powerline-vaulted-segment | powerline_vaulted_segment/vaulted.py | powerline_vaulted_segment/vaulted.py | from __future__ import (unicode_literals, division, absolute_import, print_function)
from powerline.theme import requires_segment_info
@requires_segment_info
def vaulted(pl, segment_info, prefix=''):
'''Return the current vaulted vault
:param string prefix:
The prefix to use in front of the vault na... | from __future__ import (unicode_literals, division, absolute_import, print_function)
from powerline.theme import requires_segment_info
@requires_segment_info
def vaulted(pl, segment_info, prefix=None):
'''Return the current vaulted vault
:param string prefix:
The prefix to use in front of the vault ... | mit | Python |
e4cc4447bf9aca4f579eef34baccd3aaf73939c3 | Print statement verwijderd uit functie | RobinvdGriend/hamming-code | hamming-code/hamming.py | hamming-code/hamming.py | from matrix import Matrix
#The encoding matrix
encoding_matrix = Matrix([
[1, 1, 0, 1],
[1, 0, 1, 1],
[1, 0, 0, 0],
[0, 1, 1, 1],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]
])
#The parity checking matrix
checking_matrix = Matrix([
[1, 0, 1, 0, 1, 0, 1],
[0, 1, 1, 0, 0, 1, 1],
[0, 0... | from matrix import Matrix
#The encoding matrix
encoding_matrix = Matrix([
[1, 1, 0, 1],
[1, 0, 1, 1],
[1, 0, 0, 0],
[0, 1, 1, 1],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]
])
#The parity checking matrix
checking_matrix = Matrix([
[1, 0, 1, 0, 1, 0, 1],
[0, 1, 1, 0, 0, 1, 1],
[0, 0... | mit | Python |
825eb37e15e2fb08ac205b7495e93a91acb79c26 | Add function for flashing all form errors | hack4impact/clean-air-council,hack4impact/clean-air-council,hack4impact/clean-air-council | app/utils.py | app/utils.py | import re
from flask import url_for, flash
def register_template_utils(app):
"""Register Jinja 2 helpers (called from __init__.py)."""
@app.template_test()
def equalto(value, other):
return value == other
@app.template_global()
def is_hidden_field(field):
from wtforms.fields impo... | import re
from flask import url_for
def register_template_utils(app):
"""Register Jinja 2 helpers (called from __init__.py)."""
@app.template_test()
def equalto(value, other):
return value == other
@app.template_global()
def is_hidden_field(field):
from wtforms.fields import Hidd... | mit | Python |
c0e1bed70bc331041622e0db06871d4f3e3277f3 | Update activate-devices.py | JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub | cron/activate-devices.py | cron/activate-devices.py | #!/usr/bin/env python
import MySQLdb
#import datetime
#import urllib2
#import os
import datetime
import RPi.GPIO as GPIO
try:
import RPi.GPIO as GPIO
except RuntimeError:
print("Error importing RPi.GPIO!")
servername = "localhost"
username = "pi"
password = "password"
dbname = "pi_heating_db"
GPIO.setmode(G... | #!/usr/bin/env python
import MySQLdb
#import datetime
#import urllib2
#import os
import datetime
import RPi.GPIO as GPIO
try:
import RPi.GPIO as GPIO
except RuntimeError:
print("Error importing RPi.GPIO!")
servername = "localhost"
username = "pi"
password = "password"
dbname = "pi_heating_db"
GPIO.setmode(G... | apache-2.0 | Python |
8701318037b9d425149f0689fa137be78a782aa7 | return the name of the face found | adamreis/DANIEL-server | app/views.py | app/views.py | from app import app
from flask import Flask, request, jsonify
import kairos
DEFAULT_GALLERY = 'default_gallery'
# App Logic
@app.route('/', methods=['GET'])
def index():
return 'yo'
@app.route('/upload/<name>', methods=['POST'])
def upload(name):
img_url = request.form['img_url']
success = kairos.add_fac... | from app import app
from flask import Flask, request, jsonify
import kairos
DEFAULT_GALLERY = 'default_gallery'
# App Logic
@app.route('/', methods=['GET'])
def index():
return 'yo'
@app.route('/upload/<name>', methods=['POST'])
def upload(name):
img_url = request.form['img_url']
success = kairos.add_fac... | mit | Python |
23f87565a9074b7d6bd5e45b1ce8686ba49d3ce8 | Update nsoltSynthesis2dNetwork.py | shodimaggio/SaivDr,shodimaggio/SaivDr | appendix/pytorch/nsoltSynthesis2dNetwork.py | appendix/pytorch/nsoltSynthesis2dNetwork.py | import torch
import torch.nn as nn
from nsoltBlockIdct2dLayer import NsoltBlockIdct2dLayer
from nsoltFinalRotation2dLayer import NsoltFinalRotation2dLayer
from nsoltLayerExceptions import InvalidNumberOfChannels, InvalidPolyPhaseOrder, InvalidNumberOfVanishingMoments
class NsoltSynthesis2dNetwork(nn.Module):
... | import torch
import torch.nn as nn
from nsoltBlockIdct2dLayer import NsoltBlockIdct2dLayer
from nsoltFinalRotation2dLayer import NsoltFinalRotation2dLayer
class NsoltSynthesis2dNetwork(nn.Module):
def __init__(self,
number_of_channels=[],
decimation_factor=[]):
super(NsoltSynt... | bsd-2-clause | Python |
0d056fefa1896a1e4d17b56f0e84dae106c17c57 | fix bug | czgu/metaHack,czgu/metaHack,czgu/metaHack,czgu/metaHack | meta/api/views.py | meta/api/views.py | from django.conf.urls import patterns, url
from django.shortcuts import render
from django.http import Http404
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from django.contrib.sites.shortcuts import get_current_site
import requests
from .forms import UploadImageForm
from .... | from django.conf.urls import patterns, url
from django.shortcuts import render
from django.http import Http404
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from django.contrib.sites.shortcuts import get_current_site
import requests
from .forms import UploadImageForm
from .... | apache-2.0 | Python |
3380d0fed1a8d24eba8627bd65dccc1fb2f772dd | Update version to next release | minio/minio-py,NitishT/minio-py,NitishT/minio-py,minio/minio-py | minio/__init__.py | minio/__init__.py | # -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015, 2016, 2017 MinIO, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.ap... | # -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015, 2016, 2017 MinIO, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.ap... | apache-2.0 | Python |
4815315b2200cb8061640f6333f2cb96b0707965 | update admin to enable list edit | diegobz/django-admin-sso,flatfox-ag/django-admin-sso,frog32/django-admin-sso,matthiask/django-admin-sso,diegobz/django-admin-sso,frog32/django-admin-sso,flatfox-ag/django-admin-sso,allink/django-admin-sso,matthiask/django-admin-sso,allink/django-admin-sso | django_sso/admin.py | django_sso/admin.py | from django.contrib import admin
from django_sso import settings
from django_sso.models import Assignment
class AssignmentAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'username', 'username_mode', 'domain', 'user', 'weight')
list_editable = ('username', 'username_mode', 'domain', 'user', 'weight')
... | from django.contrib import admin
from django_sso import settings
from django_sso.models import Assignment
class AssignmentAdmin(admin.ModelAdmin):
pass
admin.site.register(Assignment, AssignmentAdmin)
if settings.DJANGO_SSO_ADD_LOGIN_BUTTON:
admin.site.login_template = 'django_sso/login.html'
| bsd-3-clause | Python |
5022cefce20ecf20d7689fa6d2c280f8774ee677 | add forgot password link to admin login | DjangoGirls/djangogirls,DjangoGirls/djangogirls,patjouk/djangogirls,patjouk/djangogirls,DjangoGirls/djangogirls,patjouk/djangogirls,patjouk/djangogirls | djangogirls/urls.py | djangogirls/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.base import RedirectView
urlpatterns = patterns('',
# Redirect old links:
url(r'^pages/in-your-city/$', RedirectView.as_view(url='/organize/', permanent=True)),
url(r'^admin$', RedirectView.as_vi... | from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.base import RedirectView
urlpatterns = patterns('',
# Redirect old links:
url(r'^pages/in-your-city/$', RedirectView.as_view(url='/organize/', permanent=True)),
url(r'^admin$', RedirectView.as_vi... | bsd-3-clause | Python |
232d4c2c8876b05cec4a427fcdf141a036c97045 | Rename "Events" into "EventRegistry" and "trigger" into "notify" | pyofwave/PyOfWave,pyofwave/PyOfWave | pyofwave_server/pyofwave/core/operation.py | pyofwave_server/pyofwave/core/operation.py | """
Standard interface for connecting client protocols to the operation extensions.
"""
from delta import DeltaObserverPool as dop
import opdev, delta
# Perform operation
def _getChildren(tag):
rep = [tag.text, ]
for child in tag:
rep.append(child)
rep.append(child.tail)
return rep
def pe... | """
Standard interface for connecting client protocols to the operation extensions.
"""
from delta import DeltaObserverPool as dop
import opdev, delta
# Perform operation
def _getChildren(tag):
rep = [tag.text, ]
for child in tag:
rep.append(child)
rep.append(child.tail)
return rep
def pe... | mpl-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.