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 |
|---|---|---|---|---|---|---|---|---|
96d17640a1aef57f35f22620fe45028bf1c0f6fb | Fix error with Django admin urls | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | openquake/server/urls.py | openquake/server/urls.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2018 GEM Foundation
#
# OpenQuake 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 Licen... | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2018 GEM Foundation
#
# OpenQuake 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 Licen... | agpl-3.0 | Python |
b5416d4e68e273ce7164fc177d99f7c5b29e8ca4 | Handle OSError on sendall, re-connect socket when error occurred. | scarchik/opentsdb-py | opentsdb/tsdb_connect.py | opentsdb/tsdb_connect.py | import threading
import logging
import socket
import time
logger = logging.getLogger('opentsdb-py')
class TSDBConnect:
def __init__(self, host: str, port: int, check_tsdb_alive: bool=False):
self.tsdb_host = host
self.tsdb_port = int(port)
if check_tsdb_alive:
self.is_alive(... | import threading
import logging
import socket
import time
logger = logging.getLogger('opentsdb-py')
class TSDBConnect:
def __init__(self, host: str, port: int, check_tsdb_alive: bool=False):
self.tsdb_host = host
self.tsdb_port = int(port)
if check_tsdb_alive:
self.is_alive(... | mit | Python |
207fbc64fc9001abc62d0e687beefb3e3a25ef73 | fix exception error | Hanaasagi/sorator | orator/exceptions/orm.py | orator/exceptions/orm.py | # -*- coding: utf-8 -*-
class ModelNotFound(RuntimeError):
def __init__(self, model):
self._model = model
self.message = 'No query results found for model [%s]' % self._model.__name__
def __str__(self):
return self.message
class MassAssignmentError(RuntimeError):
pass
class ... | # -*- coding: utf-8 -*-
class ModelNotFound(RuntimeError):
def __init__(self, model):
self._model = model
self.message = 'No query results found for model [%s]' % self._model.__name__
def __str__(self):
return self.message
class MassAssignmentError(RuntimeError):
pass
class ... | mit | Python |
a26ad106dba7ce2f00a0b9438629abf32a15a061 | Improve reliability of test by clearing cache | tkf/orgviz | orgviz/tests/test_web.py | orgviz/tests/test_web.py | import os
import tempfile
import shutil
import unittest
import textwrap
import json
import datetime
from .. import web
TMP_PREFIX = 'orgviz-test-'
def totimestamp(dt):
zero = datetime.datetime.fromtimestamp(0)
return (dt - zero).total_seconds()
class TestWebEventsData(unittest.TestCase):
@classmethod... | import os
import tempfile
import shutil
import unittest
import textwrap
import json
import datetime
from .. import web
TMP_PREFIX = 'orgviz-test-'
def totimestamp(dt):
zero = datetime.datetime.fromtimestamp(0)
return (dt - zero).total_seconds()
class TestWebEventsData(unittest.TestCase):
@classmethod... | mit | Python |
6147a5229f67874179f371ded2e835c318a2bd56 | correct prob formulation for secondary user beamforming | cvxgrp/qcqp | examples/secondary_user_beamforming.py | examples/secondary_user_beamforming.py | #!/usr/bin/python
# Secondary user multicast beamforming
# minimize ||w||^2
# subject to |h_i^H w|^2 >= tau
# |g_i^H w|^2 <= eta
# with variable w in complex^n.
# Data vectors h_i and g_i are also in complex^n.
# The script below expands out the complex part and
# works with real numbers only.
import... | #!/usr/bin/python
# Secondary user multicast beamforming
# minimize ||w||^2
# subject to |h_i^H w|^2 >= tau
# |g_i^H w|^2 <= eta
# with variable w in complex^n
import numpy as np
import cvxpy as cvx
import qcqp
n = 10
m = 8
l = 2
tau = 10
eta = 1
np.random.seed(1)
H = np.random.randn(m, n)
G = np.... | mit | Python |
183e08be99fae2ba521c5fb60b7205d3c3c5b520 | Add grappelli styles to make inlines collapsible | Princeton-CDH/winthrop-django,Princeton-CDH/winthrop-django,Princeton-CDH/winthrop-django | winthrop/books/admin.py | winthrop/books/admin.py | from django.contrib import admin
from winthrop.common.admin import NamedNotableAdmin
from .models import Subject, Language, Publisher, OwningInstitution, \
Book, Catalogue, BookSubject, BookLanguage, CreatorType, Creator, \
PersonBook, PersonBookRelationshipType
class NamedNotableBookCount(NamedNotableAdmin)... | from django.contrib import admin
from winthrop.common.admin import NamedNotableAdmin
from .models import Subject, Language, Publisher, OwningInstitution, \
Book, Catalogue, BookSubject, BookLanguage, CreatorType, Creator, \
PersonBook, PersonBookRelationshipType
class NamedNotableBookCount(NamedNotableAdmin)... | apache-2.0 | Python |
a40c80eea715626616ef280b87de6bbcc7b73b7f | use relative imports | mdietrichc2c/vertical-ngo,yvaucher/vertical-ngo,jorsea/vertical-ngo,gurneyalex/vertical-ngo,jorsea/vertical-ngo,jgrandguillaume/vertical-ngo | transport_information/model/__init__.py | transport_information/model/__init__.py | # -*- coding: utf-8 -*-
from . import transport_mode
from . import transport_vehicle
| # -*- coding: utf-8 -*-
import transport_mode
import transport_vehicle
| agpl-3.0 | Python |
08cf82852ab19417f9521af45f2fb296d9e223d6 | Update batch processing example | takluyver/nbparameterise | batch_eg.py | batch_eg.py | """Example of using nbparameterise API to substitute variables in 'batch mode'
"""
from nbparameterise import code
import nbformat
from nbconvert.preprocessors.execute import ExecutePreprocessor
from nbconvert.exporters.notebook import NotebookExporter
from nbconvert.writers import FilesWriter
stock_names = ['YHOO', ... | """Example of using nbparameterise API to substitute variables in 'batch mode'
"""
from nbparameterise import code
from IPython.nbformat import current as nbformat
from IPython.nbconvert.preprocessors.execute import ExecutePreprocessor
from IPython.nbconvert.exporters.notebook import NotebookExporter
from IPython.nbco... | mit | Python |
97939c334543d9ca4d717a7bc75ae30e848c8a09 | Replace native.git_repository with skylark rule | GerritCodeReview/plugins_javamelody,GerritCodeReview/plugins_javamelody,GerritCodeReview/plugins_javamelody | bazlets.bzl | bazlets.bzl | load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
NAME = "com_googlesource_gerrit_bazlets"
def load_bazlets(
commit,
local_path = None):
if not local_path:
git_repository(
name = NAME,
remote = "https://gerrit.googlesource.com/bazlets",
... | NAME = "com_googlesource_gerrit_bazlets"
def load_bazlets(
commit,
local_path = None):
if not local_path:
native.git_repository(
name = NAME,
remote = "https://gerrit.googlesource.com/bazlets",
commit = commit,
)
else:
native.local_rep... | apache-2.0 | Python |
36cc738308b8ae4435d6becac38fa3c4e96dc491 | Remove useless code | patchboard/patchboard-py | patchboard/patchboard.py | patchboard/patchboard.py | # patchboard.py
#
# Copyright 2014 BitVault.
from __future__ import print_function
import json
from resource import Resource
from api import API
from schema_manager import SchemaManager
from client import Client
from util import to_camel_case
def discover(url):
"""
Retrieve the API definition from the gi... | # patchboard.py
#
# Copyright 2014 BitVault.
from __future__ import print_function
import json
from api import API
from schema_manager import SchemaManager
from client import Client
from util import to_camel_case
def discover(url):
"""
Retrieve the API definition from the given URL and construct
a Pa... | mit | Python |
382a715ec78d9bcc53e949e9536bdb1077d3ed98 | Update docstring | thombashi/pathvalidate | pathvalidate/__init__.py | pathvalidate/__init__.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
import re
import dataproperty
__INVALID_PATH_CHARS = '\:*?"<>|'
def validate_filename(filename):
"""
:param str filename: Filename to validate.
:raises ValueError:
If the ``filename`` is empty or includes invali... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
import re
import dataproperty
__INVALID_PATH_CHARS = '\:*?"<>|'
def validate_filename(filename):
"""
:param str filename: Filename to validate.
:raises ValueError:
If ``filename`` is empty or include invalid cha... | mit | Python |
798639f4d22bec341667a4067db7a18095d36beb | Add missing doc string values. | christabor/flask_jsondash,christabor/flask_jsondash,christabor/flask_jsondash | flask_jsondash/data_utils/wordcloud.py | flask_jsondash/data_utils/wordcloud.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
flask_jsondash.data_utils.wordcloud
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities for working with wordcloud formatted data.
:copyright: (c) 2016 by Chris Tabor.
:license: MIT, see LICENSE for more details.
"""
from collections import Counter
# Py2/3 compat.
try:
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
flask_jsondash.data_utils.wordcloud
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities for working with wordcloud formatted data.
:copyright: (c) 2016 by Chris Tabor.
:license: MIT, see LICENSE for more details.
"""
from collections import Counter
# Py2/3 compat.
try:
... | mit | Python |
253361e56ad2b1e331691f0bf3c9010c22c0c9aa | Fix tests | Charcoal-SE/SmokeDetector,Charcoal-SE/SmokeDetector | test/test_blacklists.py | test/test_blacklists.py | #!/usr/bin/env python3
from glob import glob
from helpers import only_blacklists_changed
def test_blacklist_integrity():
for bl_file in glob('bad_*.txt') + glob('blacklisted_*.txt'):
with open(bl_file, 'r') as lines:
seen = dict()
for lineno, line in enumerate(lines, 1):
... | #!/usr/bin/env python3
from glob import glob
from helpers import only_blacklists_changed
def test_blacklist_integrity():
for bl_file in glob('bad_*.txt') + glob('blacklisted_*.txt'):
with open(bl_file, 'r') as lines:
seen = dict()
for lineno, line in enumerate(lines, 1):
... | apache-2.0 | Python |
e13cfe7a7e215f43e8210fb6d116ccafe80c8756 | fix names of functions | adrn/gary,adrn/gary,adrn/gary,adrn/gala,adrn/gala,adrn/gala | gary/observation/tests/test_rrlyrae.py | gary/observation/tests/test_rrlyrae.py | # coding: utf-8
"""
Test the RR Lyrae helper functions.
"""
from __future__ import absolute_import, unicode_literals, division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
# Third-party
import astropy.units as u
import numpy as np
import pytest
from ..core imp... | # coding: utf-8
"""
Test the RR Lyrae helper functions.
"""
from __future__ import absolute_import, unicode_literals, division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
# Third-party
import astropy.units as u
import numpy as np
import pytest
from ..core imp... | mit | Python |
ff2cfb51b1fa30d0103bc782843f69fea08e0d51 | Fix formatting for table declaration | manthey/girder,kotfic/girder,Xarthisius/girder,RafaelPalomar/girder,jbeezley/girder,girder/girder,sutartmelson/girder,adsorensen/girder,RafaelPalomar/girder,adsorensen/girder,manthey/girder,RafaelPalomar/girder,data-exp-lab/girder,kotfic/girder,Xarthisius/girder,Kitware/girder,sutartmelson/girder,jbeezley/girder,data-e... | girder/utility/assetstore_utilities.py | girder/utility/assetstore_utilities.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware 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 cop... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware 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 cop... | apache-2.0 | Python |
38e224c282c62ad358c753eb707cf71ad1f00aff | fix os x gyp settings | angelmic/node-usb-detection,MadLittleMods/node-usb-detection,MadLittleMods/node-usb-detection,MadLittleMods/node-usb-detection,angelmic/node-usb-detection,angelmic/node-usb-detection,AMI-NTBU/AndyLau,AMI-NTBU/AndyLau,AMI-NTBU/AndyLau | binding.gyp | binding.gyp | {
"targets": [
{
"target_name": "detection",
"sources": [
"src/detection.cpp",
"src/detection.h",
"src/deviceList.cpp"
],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
],
'conditions': [
['OS=="win"',
{
'source... | {
"targets": [
{
"target_name": "detection",
"sources": [
"src/detection.cpp",
"src/detection.h",
"src/deviceList.cpp"
],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
],
'conditions': [
['OS=="win"',
{
'source... | mit | Python |
de0180ccccdd3e2b83c6a7188fd2688c64c70580 | add rpath linker option in binding.gyp when --sqlite option is used with a custom sqlite | mapbox/node-sqlite3,briangreenery/node-sqlite3,damonpetta/node-sqlite3,march1993/node-sqlite3,alejandronunez/sqlitenw,FeodorFitsner/node-sqlite3,tomhughes/node-sqlite3,ashikcse20/node-sqlite3,mapbox/node-sqlite3,Finkes/node-sqlite3,ashikcse20/node-sqlite3,kevinsawicki/node-sqlite3,kevinsawicki/node-sqlite3,t3mulligan/n... | binding.gyp | binding.gyp | {
'includes': [ 'deps/common-sqlite.gypi' ],
'variables': {
'sqlite%':'internal',
},
'targets': [
{
'target_name': 'node_sqlite3',
'conditions': [
['sqlite != "internal"', {
'libraries': [
'-L<@(sqlite)/lib',
'-lsqlite3'
],
... | {
'includes': [ 'deps/common-sqlite.gypi' ],
'variables': {
'sqlite%':'internal',
},
'targets': [
{
'target_name': 'node_sqlite3',
'conditions': [
['sqlite != "internal"', {
'libraries': [
'-L<@(sqlite)/lib',
'-lsqlite3'
],
... | bsd-3-clause | Python |
3fe8dd01906fe2d8e3e52b537acd34f65073ca01 | remove the cflags | lukaskollmer/objc | binding.gyp | binding.gyp | {
"targets": [
{
"target_name": "objc",
"sources": [
"src/binding/objc.cc",
"src/binding/Proxy.cc",
"src/binding/utils.cc",
"src/binding/Invocation.cc",
"src/binding/constants.cpp"
],
"include_dirs": [
"<!(node -e \"require('nan')\")",
... | {
"targets": [
{
"target_name": "objc",
"sources": [
"src/binding/objc.cc",
"src/binding/Proxy.cc",
"src/binding/utils.cc",
"src/binding/Invocation.cc",
"src/binding/constants.cpp"
],
"include_dirs": [
"<!(node -e \"require('nan')\")",
... | mit | Python |
0a90376144ee5568e6e140cbf657d7e85070f1f1 | remove the matplotlib agg setting | simpeg/discretize,simpeg/discretize,simpeg/discretize | tests/base/test_view.py | tests/base/test_view.py | from __future__ import print_function
import matplotlib
import unittest
import numpy as np
import matplotlib.pyplot as plt
import discretize
from discretize import Tests, utils
import warnings
import pytest
np.random.seed(16)
TOL = 1e-1
class Cyl3DView(unittest.TestCase):
def setUp(self):
self.mesh =... | from __future__ import print_function
import matplotlib
matplotlib.use('Agg')
import unittest
import numpy as np
import matplotlib.pyplot as plt
import discretize
from discretize import Tests, utils
import warnings
import pytest
np.random.seed(16)
TOL = 1e-1
class Cyl3DView(unittest.TestCase):
def setUp(self... | mit | Python |
a114325be4f81cd34438f96fbc134a7881d5fe7a | Add link to get_input_var_names | mperignon/bmi-delta,mperignon/bmi-STM,mperignon/bmi-delta,mperignon/bmi-STM | bmi/vars.py | bmi/vars.py | #! /usr/bin/env python
class BmiVars(object):
"""Defines an interface for converting a standalone model into an
integrated modeling framework component.
"""
def get_var_type(self, long_var_name):
"""Returns the type of the given variable.
Parameters
----------
long_va... | #! /usr/bin/env python
class BmiVars(object):
"""Defines an interface for converting a standalone model into an
integrated modeling framework component.
"""
def get_var_type(self, long_var_name):
"""Returns the type of the given variable.
Parameters
----------
long_va... | mit | Python |
390059007169b964649b3ec8af84503b38e41e97 | refactor date formatting | ods94065/opost,ods94065/opost | postweb/utils.py | postweb/utils.py | import bleach
from django.conf import settings
import dateutil.parser
import markdown
markdown = markdown.Markdown()
# Tags suitable for rendering markdown
# From https://github.com/yourcelf/bleach-allowlist/blob/main/bleach_allowlist/bleach_allowlist.py
MARKDOWN_TAGS = [
"h1",
"h2",
"h3",
"h4",
... | import bleach
from django.conf import settings
import dateutil.parser
import markdown
markdown = markdown.Markdown()
# Tags suitable for rendering markdown
# From https://github.com/yourcelf/bleach-allowlist/blob/main/bleach_allowlist/bleach_allowlist.py
MARKDOWN_TAGS = [
"h1",
"h2",
"h3",
"h4",
... | mit | Python |
d0ac7153cd9a88c5a9c6edef4f6d415b4d88143b | make admin classes overridable | pinax/pinax-referrals,pinax/pinax-referrals | pinax/referrals/admin.py | pinax/referrals/admin.py | from django.contrib import admin
from .models import Referral, ReferralResponse
@admin.register(Referral)
class ReferralAdmin(admin.ModelAdmin):
list_display = [
"user",
"code",
"label",
"redirect_to",
"target_content_type",
"target_object_id"
]
readonly_fi... | from django.contrib import admin
from .models import Referral, ReferralResponse
admin.site.register(
Referral,
list_display=[
"user",
"code",
"label",
"redirect_to",
"target_content_type",
"target_object_id"
],
readonly_fields=["code", "created_at"],
... | mit | Python |
51cf3706504adb6b1772b491c6d9d612a64e49ab | fix check mention | everpcpc/yubari,everpcpc/yubari | yubari/bots/qq_watch.py | yubari/bots/qq_watch.py | #!/usr/bin/env python
# coding: utf-8
import time
import logging
from yubari.config import QQ_GROUP, MENTION_NAME, QQ_ME
from yubari.lib.qq import qqbot
logger = logging.getLogger(__name__)
def check_mention_self(content):
for word in MENTION_NAME:
if word in content:
return True
retur... | #!/usr/bin/env python
# coding: utf-8
import time
import logging
from yubari.config import QQ_GROUP, MENTION_NAME
from yubari.lib.qq import qqbot
logger = logging.getLogger(__name__)
def run():
continue_count = 0
last_msg = ""
last_call = 0
for msg in qqbot.poll():
logger.info(msg)
... | mit | Python |
eda12e10ae41dce8a34903709afb7a0c73fcd3e2 | Add dict merging and fix wrapped | 1064CBread/1064Chat,1064CBread/1064Chat,1064CBread/1064Chat,1064CBread/1064Chat | src/server/blueprints/rest/restutil.py | src/server/blueprints/rest/restutil.py | """
Utilities specific to REST blueprints.
"""
from enum import Enum
from collections.abc import MutableMapping
from util import get_current_app
from flask import Response
from functools import wraps
import re
class ClientType(str, Enum):
BROWSER = "browser" # most useful in debug
CURL = "cURL" # also usefu... | """
Utilities specific to REST blueprints.
"""
from enum import Enum
from util import get_current_app
from functools import wraps
import re
class ClientType(str, Enum):
BROWSER = "browser" # most useful in debug
CURL = "cURL" # also useful in debug
OTHER = "other" # usually production apps
browsers =... | mit | Python |
74ad5c935abd69b7408a0c1ba2d7cc4ed57e3bd9 | test solely running linkcheck as it requires the html to be built | simpeg/discretize,simpeg/discretize,simpeg/discretize | tests/docs/test_docs.py | tests/docs/test_docs.py | import subprocess
import unittest
import os
import platform
class Doc_Test(unittest.TestCase):
@property
def path_to_docs(self):
dirname, file_name = os.path.split(os.path.abspath(__file__))
return dirname.split(os.path.sep)[:-2] + ["docs"]
# def test_html(self):
# wd = os.getcwd(... | import subprocess
import unittest
import os
import platform
class Doc_Test(unittest.TestCase):
@property
def path_to_docs(self):
dirname, file_name = os.path.split(os.path.abspath(__file__))
return dirname.split(os.path.sep)[:-2] + ["docs"]
def test_html(self):
wd = os.getcwd()
... | mit | Python |
a80ac141b7341e867f1395858e0bdccaa9a83b37 | Fix for Py2 test. | jeffrimko/Auxly | tests/filesys_test_7.py | tests/filesys_test_7.py | # -*- coding: utf-8 -*-
##==============================================================#
## SECTION: Imports #
##==============================================================#
from testlib import *
from auxly.filesys import File
##========================================... | # -*- coding: utf-8 -*-
##==============================================================#
## SECTION: Imports #
##==============================================================#
from testlib import *
from auxly.filesys import File
##========================================... | mit | Python |
e883d625bf78c52d4f1206f13ef64e53df23c3dd | Add a tool for getting the current schema. Not sure if this could break things. Concurrency might be a bitch. | luzfcb/django-boardinghouse,luzfcb/django-boardinghouse,luzfcb/django-boardinghouse | multi_schema/schema.py | multi_schema/schema.py | from django.db import models
from .models import Schema
def get_schema():
cursor = models.connection.cursor()
cursor.execute('SHOW search_path')
search_path = cursor.fetchone()[0]
return Schema.objects.get(schema=search_path.split(',')[0])
| bsd-3-clause | Python | |
6306288b7b65481a7e0706d3515d673b2344d2f0 | Bump version | beerfactory/hbmqtt | hbmqtt/__init__.py | hbmqtt/__init__.py | # Copyright (c) 2015 Nicolas JOUANIN
#
# See the file license.txt for copying permission.
VERSION = (0, 3, 0, 'alpha', 0)
| # Copyright (c) 2015 Nicolas JOUANIN
#
# See the file license.txt for copying permission.
VERSION = (0, 2, 0, 'final', 0)
| mit | Python |
eebafcf8a7a34108fbae12645e469979496403ab | Add documentation and clean up daemon code. | myDevicesIoT/Cayenne-Agent,myDevicesIoT/Cayenne-Agent | myDevices/os/daemon.py | myDevices/os/daemon.py | """
This module provides a class for restarting the agent if errors occur and exiting on critical failures.
"""
from sys import exit
from datetime import datetime
from myDevices.utils.logger import exception, info, warn, error, debug
from myDevices.os.services import ServiceManager
#defining reset timeout in seconds
R... | #!/usr/bin/env python
from sys import exit
from datetime import datetime
from os.path import getmtime
from myDevices.utils.logger import exception, info, warn, error, debug
from myDevices.os.services import ServiceManager
#defining reset timeout in seconds
RESET_TIMEOUT=30
FAILURE_COUNT=1000
PYTHON_BIN='/usr/bin/pytho... | mit | Python |
6076b6a7824072b97936aaa3da3ba1acf2bc87d6 | Bump 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.21.7"
| """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.21.6"
| mit | Python |
e906e108ab5118ec1c8856a54b8ebe1fd69484ac | Add shebang to and update permissions of servefiles.py | Traiver/FBI,Jerry-Shaw/FBI,Traiver/FBI,Jerry-Shaw/FBI,Jerry-Shaw/FBI,Jerry-Shaw/FBI,Traiver/FBI | servefiles/servefiles.py | servefiles/servefiles.py | #!/bin/python
import os
import socket
import struct
import sys
import threading
import time
import urllib
try:
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import TCPServer
from urlparse import urljoin
from urllib import pathname2url, quote
except ImportError:
from http.server import Si... | import os
import socket
import struct
import sys
import threading
import time
import urllib
try:
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import TCPServer
from urlparse import urljoin
from urllib import pathname2url, quote
except ImportError:
from http.server import SimpleHTTPReques... | mit | Python |
d45e2237cccf9a29db93fd485de34b9cc4dc3cfe | Update gpio.py | souravsingh/beaglebone-codes,souravsingh/beaglebone-codes,souravsingh/beaglebone-codes | 02traffic_python/gpio.py | 02traffic_python/gpio.py | ##########################################################
# * Python GPIO Functions for Traffic Signal Simulation
# * using Baglebone Black running Debian 7 Linux distribution
##########################################################
import sys
import os
SYSFS_GPIO_DIR = "/sys/class/gpio"
def gpioUnexport (gpio):... | ##########################################################
# * Python GPIO Functions for Traffic Signal Simulation
# * using Baglebone Black running Debian 7 Linux distribution
##########################################################
# * Developed by MicroEmbedded Technologies
########################################... | apache-2.0 | Python |
22ab27f9966c19c1f3496e445e460f9ac6400de7 | Fix doubling order admin when custom order model used | khchine5/django-shop,chriscauley/django-shop,jrief/django-shop,airtonix/django-shop,nimbis/django-shop,khchine5/django-shop,awesto/django-shop,dwx9/test,chriscauley/django-shop,katomaso/django-shop,ojii/django-shop,airtonix/django-shop,fusionbox/django-shop,katomaso/django-shop,divio/django-shop,creimers/django-shop,sc... | shop/admin/orderadmin.py | shop/admin/orderadmin.py | #-*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib.admin.options import ModelAdmin
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from shop.models.ordermodel import (Order, OrderItem,
OrderExtraInfo, ExtraOrderPriceField, OrderPayment)
class ... | #-*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib.admin.options import ModelAdmin
from django.utils.translation import ugettext_lazy as _
from shop.models.ordermodel import (Order, OrderItem,
OrderExtraInfo, ExtraOrderPriceField, OrderPayment)
class OrderExtraInfoInline(admin.Tabula... | bsd-3-clause | Python |
1b3e5d52911f3c623b8f320adadea2d8f3ee226a | Implement web service based Pathway Commons client | pvtodorov/indra,jmuhlich/indra,johnbachman/belpy,sorgerlab/belpy,jmuhlich/indra,johnbachman/indra,pvtodorov/indra,pvtodorov/indra,johnbachman/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/belpy,sorgerlab/belpy,pvtodorov/indra,johnbachman/belpy,sorgerlab/indra,jmuhlich/indra,johnbachman/indra,bgyori/indra,bgyori/ind... | indra/biopax/pathway_commons_client.py | indra/biopax/pathway_commons_client.py | import urllib, urllib2
from indra.java_vm import autoclass, JavaException
pc2_url = 'http://www.pathwaycommons.org/pc2/'
def send_request(kind, source, target=None):
kind_str = kind.lower()
if kind not in ['neighborhood', 'pathsbetween', 'pathsfromto']:
print 'Invalid query type %s' % kind_str
... | from indra.java_vm import autoclass, JavaException
def run_pc_query(query_type, source_genes, target_genes=None, neighbor_limit=1):
cpath_client = autoclass('cpath.client.CPathClient').\
newInstance('http://www.pathwaycommons.org/pc2/')
query = cpath_client.createGraphQuery()
query.kind(query_type)... | bsd-2-clause | Python |
a7062bb3d87954478f4be23a8ac2cc3d125804e7 | resolve #13: consecutive blank row are preserved | chfw/pyexcel-ods,chfw/pyexcel-ods | tests/test_bug_fixes.py | tests/test_bug_fixes.py | #!/usr/bin/python
# -*- encoding: utf-8 -*-
import os
from pyexcel_ods import get_data, save_data
from nose.tools import raises, eq_
def test_bug_fix_for_issue_1():
data = get_data(os.path.join("tests", "fixtures", "repeated.ods"))
assert data["Sheet1"] == [['repeated', 'repeated', 'repeated', 'repeated']]
... | #!/usr/bin/python
# -*- encoding: utf-8 -*-
import os
from pyexcel_ods import get_data, save_data
from nose.tools import raises
def test_bug_fix_for_issue_1():
data = get_data(os.path.join("tests", "fixtures", "repeated.ods"))
assert data["Sheet1"] == [['repeated', 'repeated', 'repeated', 'repeated']]
def t... | bsd-3-clause | Python |
12d244ce9bd15d95817d4c4d774a1ab1758db894 | fix broken build | lordakshaya/pyexcel,chfw/pyexcel,lordakshaya/pyexcel,lordakshaya/pyexcel,chfw/pyexcel | tests/test_extension.py | tests/test_extension.py | from nose.tools import raises
class TestExt:
def test_test(self):
"""test test"""
from pyexcel.ext import test
from pyexcel.io import READERS
from pyexcel.io import WRITERS
assert READERS['test'] == 'test'
assert WRITERS['test'] == 'test'
@raises(ImportErr... | from nose.tools import raises
class TestExt:
def test_test(self):
"""test test"""
from pyexcel.ext import test
from pyexcel.io import READERS
from pyexcel.io import WRITERS
assert READERS['test'] == 'test'
assert WRITERS['test'] == 'test'
@raises(ImportErr... | bsd-3-clause | Python |
47b32b1b2d5fe81dcf86c78d61690c1f0572b8ea | Add failing name and docstring test for things exported | Suor/funcy | tests/test_interface.py | tests/test_interface.py | import pkgutil
import pytest
import funcy
from funcy.cross import PY2, PY3
from funcy.py2 import cat
from funcy import py2, py3
py = py2 if PY2 else py3
# Introspect all modules
exclude = ('cross', '_inspect', 'py2', 'py3', 'simple_funcs', 'funcmakers')
module_names = list(name for _, name, _ in pkgutil.iter_module... | import pkgutil
import pytest
import funcy
from funcy.cross import PY2, PY3
from funcy.py2 import cat
from funcy import py2, py3
py = py2 if PY2 else py3
# Introspect all modules
exclude = ('cross', '_inspect', 'py2', 'py3', 'simple_funcs', 'funcmakers')
module_names = list(name for _, name, _ in pkgutil.iter_module... | bsd-3-clause | Python |
5baa216b615b39fe5d9bf5bb71e9ae8048ef4dc0 | delete samples on metric delete | shaunsephton/holodeck,euan/django-holodeck,euan/django-holodeck,shaunsephton/holodeck | holodeck/models.py | holodeck/models.py | import uuid
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_delete
from django.dispatch import receiver
from holodeck.utils import get_widget_type_choices, load_class_by_string, \
metric_to_shard_mapper, sample_to_shard_mapper
class Dashboard(mod... | import uuid
from django.db import models
from holodeck.utils import get_widget_type_choices, load_class_by_string, \
metric_to_shard_mapper, sample_to_shard_mapper
from django.contrib.auth.models import User
class Dashboard(models.Model):
name = models.CharField(max_length=255)
owner = models.ForeignKey(... | bsd-3-clause | Python |
62150ec45c9c062397f0ac0270466b4497d459de | Fix world time plugin | skoczen/will,skoczen/will,skoczen/will | will/plugins/productivity/world_time.py | will/plugins/productivity/world_time.py | import datetime
import pytz
import requests
import time
from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings
from will import settings
def get_location(place):
payload = {'address': place, 'sensor': False}
r = requests... | import datetime
import requests
from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings
from will import settings
class TimePlugin(WillPlugin):
@respond_to("what time is it in (?P<place>.*)")
def what_time_is_it_in(self, ... | mit | Python |
47bb5b64dfec5ea4718d8eac4c204f8e61dd60f8 | Add test that checks relative variable initialisation | OceanPARCELS/parcels,OceanPARCELS/parcels | tests/test_particles.py | tests/test_particles.py | from parcels import Grid, ScipyParticle, JITParticle, Variable
import numpy as np
import pytest
from operator import attrgetter
ptype = {'scipy': ScipyParticle, 'jit': JITParticle}
@pytest.fixture
def grid(xdim=100, ydim=100):
U = np.zeros((xdim, ydim), dtype=np.float32)
V = np.zeros((xdim, ydim), dtype=np.... | from parcels import Grid, ScipyParticle, JITParticle, Variable
import numpy as np
import pytest
ptype = {'scipy': ScipyParticle, 'jit': JITParticle}
@pytest.fixture
def grid(xdim=100, ydim=100):
U = np.zeros((xdim, ydim), dtype=np.float32)
V = np.zeros((xdim, ydim), dtype=np.float32)
lon = np.linspace(0... | mit | Python |
def480fd6b44e85cb85bcb3ed8cc0b98d771ee97 | Rework test. | babble/babble,babble/babble,babble/babble,babble/babble,babble/babble,babble/babble | src/test/ed/lang/python/import4_test.py | src/test/ed/lang/python/import4_test.py | '''
Copyright (C) 2008 10gen Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License, version 3,
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but ... | '''
Copyright (C) 2008 10gen Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License, version 3,
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but ... | apache-2.0 | Python |
519ad83f47ead62549c2e0a533ffd3ff5488e384 | Add lint test and format generated code (#4114) | googleapis/google-cloud-java,googleapis/google-cloud-java,googleapis/google-cloud-java | java-asset/google-cloud-asset/synth.py | java-asset/google-cloud-asset/synth.py | # Copyright 2018 Google LLC
#
# 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, s... | # Copyright 2018 Google LLC
#
# 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, s... | apache-2.0 | Python |
c68e6c52b9576f149ef34aa9593bd5e46c2deb9f | reduce training size | maxpumperla/elephas,maxpumperla/elephas | tests/integration/test_custom_models.py | tests/integration/test_custom_models.py | import random
import numpy as np
import pytest
from tensorflow.keras.backend import sigmoid
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.optimizers import SGD
from elephas.spark_model import SparkModel
from elephas.utils import to_simple_rdd
@pytest.... | import random
import numpy as np
import pytest
from tensorflow.keras.backend import sigmoid
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.optimizers import SGD
from elephas.spark_model import SparkModel
from elephas.utils import to_simple_rdd
@pytest.... | mit | Python |
286d0d577921126512263e8d16a01a75878ee453 | Add missing import | JohnLZeller/jenkinsapi,mistermocha/jenkinsapi,jduan/jenkinsapi,JohnLZeller/jenkinsapi,mistermocha/jenkinsapi,imsardine/jenkinsapi,mistermocha/jenkinsapi,JohnLZeller/jenkinsapi,imsardine/jenkinsapi,salimfadhley/jenkinsapi,domenkozar/jenkinsapi,imsardine/jenkinsapi,salimfadhley/jenkinsapi,aerickson/jenkinsapi,zaro0508/je... | jenkinsapi/utils/urlopener_kerberos.py | jenkinsapi/utils/urlopener_kerberos.py | import urllib2
import kerberos as krb
from urlparse import urlparse
class KerberosAuthHandler(urllib2.BaseHandler):
"""
A BaseHandler class that will add Kerberos Auth headers to a request
"""
def __init__(self,tgt):
self.tgt = tgt
def http_request(self,req):
req.add_unredirected_h... | import urllib2
import kerberos as krb
class KerberosAuthHandler(urllib2.BaseHandler):
"""
A BaseHandler class that will add Kerberos Auth headers to a request
"""
def __init__(self,tgt):
self.tgt = tgt
def http_request(self,req):
req.add_unredirected_header('Authorization', 'Negoti... | mit | Python |
f95555ee63323d4046444f14395813a415aa0683 | implement just enough of mtrand to make tests start passing | NextThought/pypy-numpy,NextThought/pypy-numpy,NextThought/pypy-numpy,NextThought/pypy-numpy | numpy/random/mtrand.py | numpy/random/mtrand.py | import random
from numpy import zeros
def random_sample(length=0):
if length == 0:
return random.random()
ret = zeros((length,))
for x in xrange(length):
ret[x] = random.random()
return ret
def randn(length=0):
if length == 0:
return random.gauss(0., 1.)
ret = zeros((len... | random_sample = None
| bsd-3-clause | Python |
0b048cef1f0efd190d8bf8f50c69df35c59b91a3 | Add verbosity on JSON compare fail | SymbiFlow/yosys-symbiflow-plugins,SymbiFlow/yosys-symbiflow-plugins,SymbiFlow/yosys-f4pga-plugins,SymbiFlow/yosys-symbiflow-plugins,chipsalliance/yosys-f4pga-plugins,antmicro/yosys-symbiflow-plugins,chipsalliance/yosys-f4pga-plugins,antmicro/yosys-symbiflow-plugins,antmicro/yosys-symbiflow-plugins,SymbiFlow/yosys-f4pga... | xdc-plugin/tests/compare_output_json.py | xdc-plugin/tests/compare_output_json.py | #!/usr/bin/env python3
"""
This script extracts the top module cells and their corresponding parameters
from json files produced by Yosys.
The return code of this script is used to check if the output is equivalent.
"""
import sys
import json
parameters = ["IOSTANDARD", "DRIVE", "SLEW", "IN_TERM"]
def read_cells(js... | #!/usr/bin/env python3
"""
This script extracts the top module cells and their corresponding parameters
from json files produced by Yosys.
The return code of this script is used to check if the output is equivalent.
"""
import sys
import json
def read_cells(json_file):
with open(json_file) as f:
data = j... | apache-2.0 | Python |
fa28919d3d968fead742138484fcc81a6fca46d4 | Add tests for hubsync.sync.yesno_as_boolean | Mariocj89/hubsync | tests/unit/sync_test.py | tests/unit/sync_test.py | """Sync module tests"""
import unittest
from hubsync import sync
class SyncTestCase(unittest.TestCase):
def test_yesno_as_boolean_yes(self):
self.assertTrue(sync.yesno_as_boolean("yes"))
def test_yesno_as_boolean_no(self):
self.assertFalse(sync.yesno_as_boolean("no"))
class ZipPairsTestCas... | """Sync module tests"""
import unittest
from hubsync import sync
class ZipPairsTestCase(unittest.TestCase):
def test_empty_lists(self):
self.assertEqual(
[],
list(sync.zip_pairs([], []))
)
def test_empty_first_list(self):
self.assertEqual(
[(1, Non... | mit | Python |
816d6bcd5660d539c4482ea76f1adcf69c23cc92 | add inverse test | adrn/streams,adrn/streams | streams/coordinates/tests/test_core.py | streams/coordinates/tests/test_core.py | # coding: utf-8
"""
Test conversions in core.py
"""
from __future__ import absolute_import, division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
import os
import pytest
import numpy as np
import astropy.coordinates as coord
import astropy.units as u
from astropy.io import ascii
from ..core im... | # coding: utf-8
"""
Test conversions in core.py
"""
from __future__ import absolute_import, division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
import os
import pytest
import numpy as np
import astropy.coordinates as coord
import astropy.units as u
from astropy.io import ascii
from ..core im... | mit | Python |
2a4adaa7e5bca8bc8bd3f552f23a46d73ef04a86 | fix authentication bug in token_Data and start_session | InPermutation/droste,InPermutation/droste | cheezapi.py | cheezapi.py | from flask import url_for, session
import os
import requests
def redirect_uri():
redirect_uri = url_for('cheez', _external=True)
# API includes protocol as part of URL matching. Use this to force HTTPS:
if os.environ.get('FORCE_HTTPS') == 'True':
redirect_uri = redirect_uri.replace('http://', 'http... | from flask import url_for, session
import os
import requests
def redirect_uri():
redirect_uri = url_for('cheez', _external=True)
# API includes protocol as part of URL matching. Use this to force HTTPS:
if os.environ.get('FORCE_HTTPS') == 'True':
redirect_uri = redirect_uri.replace('http://', 'http... | bsd-3-clause | Python |
b4eb149099b64bcfccc8a8f2fd0c5008c74a4fe0 | move write() out of the scope of an IOError catch clause not meant for it | dstufft/ooni-backend,dstufft/ooni-backend | oonib/deck/handlers.py | oonib/deck/handlers.py | import glob
import json
import os
import re
import yaml
from oonib import errors as e
from oonib.handlers import OONIBHandler
from oonib import log
from oonib.config import config
class DeckDescHandler(OONIBHandler):
def get(self, deckID):
# note:
# we don't have to sanitize deckID, because it's a... | import glob
import json
import os
import re
import yaml
from oonib import errors as e
from oonib.handlers import OONIBHandler
from oonib import log
from oonib.config import config
class DeckDescHandler(OONIBHandler):
def get(self, deckID):
# note:
# we don't have to sanitize deckID, because it's a... | bsd-2-clause | Python |
fd456d55ceb4cd084c9ca754771c7b12235dcb5e | reset key | Watfaq/add-egg | s.py | s.py | #encoding: utf-8
import os
from apscheduler.schedulers.blocking import BlockingScheduler
import requests
MAILGUN_KEY = os.environ.get('MAILGUN_KEY')
sched = BlockingScheduler()
@sched.scheduled_job('cron', day_of_week='mon-fri', hour=12)
def add_egg():
print(send_mail(get_text(get_price())))
@sched.schedul... | #encoding: utf-8
import os
from apscheduler.schedulers.blocking import BlockingScheduler
import requests
MAILGUN_KEY = os.environ.get('MAILGUN_KEY')
sched = BlockingScheduler()
@sched.scheduled_job('cron', day_of_week='mon-fri', hour=12)
def add_egg():
print(send_mail(get_text(get_price())))
@sched.schedul... | unlicense | Python |
c3fb87846d1f1a38fe2e37521464dea59832ff6c | remove unused import from distutils | PyWavelets/pywt,rgommers/pywt,rgommers/pywt,rgommers/pywt,PyWavelets/pywt,grlee77/pywt,rgommers/pywt,grlee77/pywt | pywt/__init__.py | pywt/__init__.py | # flake8: noqa
# Copyright (c) 2006-2012 Filip Wasilewski <http://en.ig.ma/>
# Copyright (c) 2012-2016 The PyWavelets Developers
# <https://github.com/PyWavelets/pywt>
# See COPYING for license details.
"""
Discrete forward and inverse wavelet transform, stationary wavelet transform,
wavelet p... | # flake8: noqa
# Copyright (c) 2006-2012 Filip Wasilewski <http://en.ig.ma/>
# Copyright (c) 2012-2016 The PyWavelets Developers
# <https://github.com/PyWavelets/pywt>
# See COPYING for license details.
"""
Discrete forward and inverse wavelet transform, stationary wavelet transform,
wavelet p... | mit | Python |
b82f21ea92aad44ca101744a3f5300280f081524 | Fix site when logged in | GNOME/extensions-web,magcius/sweettooth,GNOME/extensions-web,magcius/sweettooth,GNOME/extensions-web,GNOME/extensions-web | sweettooth/review/context_processors.py | sweettooth/review/context_processors.py |
from extensions.models import ExtensionVersion
def n_unreviewed_extensions(request):
if not request.user.has_perm("review.can-review-extensions"):
return dict()
return dict(n_unreviewed_extensions=ExtensionVersion.objects.unreviewed().count())
|
from extensions.models import ExtensionVersion
def n_unreviewed_extensions(request):
if not request.user.has_perm("review.can-review-extensions"):
return dict()
return dict(n_unreviewed_extensions=ExtensionVersion.unreviewed().count())
| agpl-3.0 | Python |
13ab494e0caaca6a460a49528c3aae4c7707042a | add a bit more docstring | chenjiandongx/pyecharts,chenjiandongx/pyecharts,chenjiandongx/pyecharts | pyecharts/custom/page.py | pyecharts/custom/page.py | #!/usr/bin/env python
# coding=utf-8
from pyecharts import template
class Page(object):
def __init__(self):
self.__charts = []
def add(self, achart_or_charts):
"""
Append chart(s) to the rendering page
:param achart_or_charts:
:return:
"""
if isinsta... | #!/usr/bin/env python
# coding=utf-8
from pyecharts import template
class Page(object):
def __init__(self):
self.__charts = []
def add(self, achart_or_charts):
"""
:param achart_or_charts:
:return:
"""
if isinstance(achart_or_charts, list):
self.... | mit | Python |
96e3d2720a805a08190936a78c91a8c9746daab9 | Update Keras.py | paperrune/Neural-Networks,paperrune/Neural-Networks | Depthwise-Separable-Convolution/Keras.py | Depthwise-Separable-Convolution/Keras.py | from keras.datasets import mnist
from keras.initializers import RandomUniform
from keras.layers import Conv2D, Dense, DepthwiseConv2D, Flatten, MaxPooling2D
from keras.models import Sequential
from keras.optimizers import SGD
from keras.utils import to_categorical
# input image dimensions
img_rows, img_cols =... | from keras.datasets import mnist
from keras.initializers import RandomUniform
from keras.layers import Conv2D, Dense, DepthwiseConv2D, Flatten, MaxPooling2D
from keras.models import Sequential
from keras.optimizers import SGD
from keras.utils import to_categorical
# input image dimensions
img_rows, img_cols =... | mit | Python |
efbb841bb0968abeb2d3bba5a535cb8619131b2b | Remove dupe licence header | yaybu/touchdown | touchdown/config/ini.py | touchdown/config/ini.py | # Copyright 2015 Isotoma Limited
#
# 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... | # Copyright 2015 Isotoma Limited
#
# 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... | apache-2.0 | Python |
1e21ba5101fe1e47fec5acacd8ac9329a71fc9bb | Change __init__ | khrapovs/mygmm | __init__.py | __init__.py | from .mygmm import *
| from .mygmm.mygmm import * | mit | Python |
c26c44f044a2e48cc53a0f52adce366807c87e2d | Add version number. | vmlaker/coils | __init__.py | __init__.py | __version__ = '1.0'
from .Averager import Averager
from .Config import Config
from .RateTicker import RateTicker
from .Ring import Ring
from .SocketTalk import SocketTalk
from .SortedList import SortedList
from .String import string2time, time2string, time2levels, time2dir, time2fname
from .Timer import Timer
from .Use... | from .Averager import Averager
from .Config import Config
from .RateTicker import RateTicker
from .Ring import Ring
from .SocketTalk import SocketTalk
from .SortedList import SortedList
from .String import string2time, time2string, time2levels, time2dir, time2fname
from .Timer import Timer
from .UserInput import user_i... | mit | Python |
bde3b3d1d90338e23e2550bc6fdd317e5e696f0f | Add command-line arguments: root, hosts and name with regexp | aleksandr-vin/zk-find | zk-find.py | zk-find.py | #
# This is a FIND utility for Zookeeper
#
# Author: Aleksandr Vinokurov <aleksandr.vin@gmail.com>
# Url: https://github.com/aleksandr-vin/zk-find
#
import logging
import logging.config
import argparse
try:
logging.config.fileConfig('logging.conf')
except:
logging.basicConfig()
logger = logging.getLogger(... | #
# This is a FIND utility for Zookeeper
#
# Author: Aleksandr Vinokurov <aleksandr.vin@gmail.com>
# Url: https://github.com/aleksandr-vin/zk-find
#
import logging
import logging.config
try:
logging.config.fileConfig('logging.conf')
except:
logging.basicConfig()
logger = logging.getLogger('zk-find')
from... | mit | Python |
b6da8865c9a12b9ce88d809d2fa4dfb601be01d0 | make sure same timezone is used when calculating delta | DataDog/integrations-extras,DataDog/integrations-extras,DataDog/integrations-extras,DataDog/integrations-extras,DataDog/integrations-extras | reboot_required/check.py | reboot_required/check.py | # vim: ts=4:sw=4:et
# (C) Datadog, Inc. 2010-2017
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# project
from checks import AgentCheck
from os import stat, utime, remove
from os.path import isfile
from stat import ST_MTIME
from datetime import datetime, timedelta
class RebootRequiredCh... | # vim: ts=4:sw=4:et
# (C) Datadog, Inc. 2010-2017
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# project
from checks import AgentCheck
from os import stat, utime, remove
from os.path import isfile
from stat import ST_MTIME
from datetime import datetime, timedelta
class RebootRequiredCh... | bsd-3-clause | Python |
6f7fc9067df57c4c15204a3208768acf4b76ed85 | Update version to 0.2.0.dev0 | jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000 | bfg9000/version.py | bfg9000/version.py | version = '0.2.0.dev0'
| version = '0.1.0'
| bsd-3-clause | Python |
ef156eca331203696f38b2f829314c48eeb5f207 | Update version to 0.1.0 | jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000 | bfg9000/version.py | bfg9000/version.py | version = '0.1.0'
| version = '0.1.0-dev'
| bsd-3-clause | Python |
8099c35b31e67643e14dcd3cd30fa104fcca6fb5 | Revert accidental change out of version.py | newville/scikit-image,emmanuelle/scikits.image,WarrenWeckesser/scikits-image,vighneshbirodkar/scikit-image,keflavich/scikit-image,almarklein/scikit-image,pratapvardhan/scikit-image,vighneshbirodkar/scikit-image,almarklein/scikit-image,SamHames/scikit-image,youprofit/scikit-image,chriscrosscutler/scikit-image,blink1073/... | scikits/image/version.py | scikits/image/version.py | version='unbuilt-dev'
| # THIS FILE IS GENERATED FROM THE SCIKITS.IMAGE SETUP.PY
version='0.2dev'
| bsd-3-clause | Python |
fc51c36b636d4a396faac02285605dafe0779104 | Bump version to 18.0.0a5 | genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio | resolwe_bio/__about__.py | resolwe_bio/__about__.py | """Central place for package metadata."""
# NOTE: We use __title__ instead of simply __name__ since the latter would
# interfere with a global variable __name__ denoting object's name.
__title__ = 'resolwe-bio'
__summary__ = 'Bioinformatics pipelines for the Resolwe platform'
__url__ = 'https://github.com/genial... | """Central place for package metadata."""
# NOTE: We use __title__ instead of simply __name__ since the latter would
# interfere with a global variable __name__ denoting object's name.
__title__ = 'resolwe-bio'
__summary__ = 'Bioinformatics pipelines for the Resolwe platform'
__url__ = 'https://github.com/genial... | apache-2.0 | Python |
15a2ed134f32cefcba5e38fa9d043ab80fc36172 | work on getClasses() | JPTrey/Scheduler,JPTrey/Scheduler | scheduler.py | scheduler.py | # Scheduler.py by Jon Paul, 2014
# Handles user input and returns all schedules fitting user filters
""" Global Variables """
# schedules = [] # all schedules fit to user criteria
# courses = [] # all courses within a schedule
""" Classes """
# Course object representing a class entry
class Course:
def __init__(... | # Scheduler.py by Jon Paul, 2014
# Handles user input and returns all schedules fitting user filters
from array import *
""" Global Variables """
schedules = [] # all schedules fit to user criteria
courses = [] # all courses within a schedule
""" Classes """
# Course object representing a class entry
class Cours... | mit | Python |
5bdd659768ad5e5a50f85113a2d354ac51653b42 | Update ds_list_contains_duplicate.py | ngovindaraj/Python | leetcode/ds_list_contains_duplicate.py | leetcode/ds_list_contains_duplicate.py | # @file Contains Duplicate
# @brief Given an array of numbers find if there are any duplicates
# https://leetcode.com/problems/contains-duplicate/
'''
Given an array of integers, find if the array contains any duplicates.
Your function should return true if any value appears at least twice in the
array, and it shoul... | # @file Contains Duplicate
# @brief Given an array of numbers find if there are any duplicates
# https://leetcode.com/problems/contains-duplicate/
'''
Given an array of integers, find if the array contains any duplicates.
Your function should return true if any value appears at least twice in the
array, and it shoul... | mit | Python |
e10195f93cb39afcc432ec25466073cec093b2bb | remove debug output | anthraxx/arch-security-tracker,anthraxx/arch-security-tracker,anthraxx/arch-security-tracker,archlinux/arch-security-tracker,jelly/arch-security-tracker,archlinux/arch-security-tracker,jelly/arch-security-tracker | app/form/validators.py | app/form/validators.py | from wtforms.validators import ValidationError
from app.pacman import get_pkg
from app.util import multiline_to_list
from pyalpm import vercmp
class ValidPackageName(object):
def __init__(self):
self.message = u'Unknown package.'
def __call__(self, form, field):
versions = get_pkg(field.data)... | from wtforms.validators import ValidationError
from app.pacman import get_pkg
from app.util import multiline_to_list
from pyalpm import vercmp
class ValidPackageName(object):
def __init__(self):
self.message = u'Unknown package.'
def __call__(self, form, field):
versions = get_pkg(field.data)... | mit | Python |
e8b4f7d6917647d4158ed39991cd00cfe45a0264 | Add some support for bigg.ucsd.edu/api/v2 | biosustain/cameo,biosustain/cameo,KristianJensen/cameo | cameo/webmodels.py | cameo/webmodels.py | # Copyright 2014 Novo Nordisk Foundation Center for Biosustainability, DTU.
#
# 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 requi... | # Copyright 2014 Novo Nordisk Foundation Center for Biosustainability, DTU.
#
# 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 requi... | apache-2.0 | Python |
314931a10f74afc6660b132db6eb2f9aaa3d640c | Detach mcpat.py | learning-on-chip/studio | sniper/scripts/bullet.py | sniper/scripts/bullet.py | import os, sim, sys, time
output = sim.config.output_dir
period = 1e6 * sim.util.Time.NS
mcpat_bin = os.path.join(os.getenv('TOOLS_ROOT'), 'mcpat.py')
if not os.path.exists(mcpat_bin): die('cannot find mcpat.py')
bullet_bin = os.path.join(os.getenv('BULLET_ROOT'), 'bin', 'bullet')
if not os.path.exists(bullet_bin): ... | import os, sim, sys, time
output = sim.config.output_dir
period = 1e6 * sim.util.Time.NS
mcpat_bin = os.path.join(os.getenv('TOOLS_ROOT'), 'mcpat.py')
if not os.path.exists(mcpat_bin): die('cannot find mcpat.py')
bullet_bin = os.path.join(os.getenv('BULLET_ROOT'), 'bin', 'bullet')
if not os.path.exists(bullet_bin): ... | mit | Python |
0fe6e79f9bc201b3c63ad6f1ce400c9d79bd484a | Fix path issues in example script | djmattyg007/IdiotScript | bin/idiotscript.py | bin/idiotscript.py | #!/usr/bin/python3
import os, sys
def alter_path():
script_path = os.path.dirname(os.path.realpath(__file__))
try:
path_index = sys.path.index(script_path)
except ValueError:
return
sys.path.pop(path_index)
alter_path()
if len(sys.argv) < 2 or len(sys.argv) > 3:
print("Invalid num... | #!/usr/bin/python3
import os, sys
if len(sys.argv) < 2 or len(sys.argv) > 3:
print("Invalid number of arguments.")
sys.exit()
if os.path.isfile(sys.argv[1]) == False:
print("IdiotScript program does not exist.")
sys.exit()
import io
import idiotscript
from idiotscript import InstructionSet, Collect... | unlicense | Python |
d926f321a26fe7c6b72513f88fe60bc4f3c899e4 | Update model cnes bed | daniel1409/dataviva-api,DataViva/dataviva-api | app/models/cnes_bed.py | app/models/cnes_bed.py | from sqlalchemy import Column, Integer, String, func
from app import db
class CnesBed(db.Model):
__tablename__ = 'cnes_bed'
year = Column(Integer, primary_key=True)
region = Column(String(1), primary_k... | from sqlalchemy import Column, Integer, String, func
from app import db
class CnesBed(db.Model):
__tablename__ = 'cnes_bed'
year = Column(Integer, primary_key=True)
region = Column(String(1), primary_key=True)
mesoregion = Column(String(4), primary_key=True)
microregion = Colum... | mit | Python |
8fb80540499d0f303d68150304fd896367313f94 | remove incorrect is instance check in children_changed | cornhundred/ipywidgets,cornhundred/ipywidgets,cornhundred/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,cornhundred/ipywidgets,cornhundred/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywi... | IPython/html/widgets/widget_container.py | IPython/html/widgets/widget_container.py | """ContainerWidget class.
Represents a container that can be used to group other widgets.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the ... | """ContainerWidget class.
Represents a container that can be used to group other widgets.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the ... | bsd-3-clause | Python |
d24f3a1f008e4d2bef262a0f1253da04071a180d | move dataset crop into generic as it is used in several datasets | GuessWhatGame/generic,GuessWhatGame/generic | data_provider/dataset.py | data_provider/dataset.py | import copy
class AbstractDataset(object):
def __init__(self, games):
self.games = games
def get_data(self, indices=list()):
if len(indices) > 0:
return [self.games[i] for i in indices]
else:
return self.games
def n_examples(self):
return len(self.... | class AbstractDataset(object):
def __init__(self, games):
self.games = games
def get_data(self, indices=list()):
if len(indices) > 0:
return [self.games[i] for i in indices]
else:
return self.games
def n_examples(self):
return len(self.games)
class... | apache-2.0 | Python |
7907aeb6a006655ad96d5d3995b5fdbd4bf00d16 | fix usage of get_all_enabled_projects | google/llvm-premerge-checks,google/llvm-premerge-checks | scripts/pipeline_main.py | scripts/pipeline_main.py | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law ... | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law ... | apache-2.0 | Python |
c38ad4f02d6f036f23ef6d3c1e033e9843fb068a | comment unused tests | simodalla/mezzanine_nowait,simodalla/mezzanine_nowait,simodalla/mezzanine_nowait | functional_tests/test_admins.py | functional_tests/test_admins.py | # -*- coding: utf-8 -*-
# from __future__ import unicode_literals, absolute_import
#
# from django.contrib.admin.templatetags.admin_urls import admin_urlname
#
# from .base import FunctionalTest
# from nowait.tests.factories import AdminF
# from nowait.models import BookingType
#
#
# class AdminTest(FunctionalTest):
# ... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from unittest import skip
from django.contrib.admin.templatetags.admin_urls import admin_urlname
from .base import FunctionalTest
from nowait.tests.factories import AdminF
from nowait.models import BookingType
@skip
class AdminTest(Fun... | bsd-3-clause | Python |
18bc54f964a2925005543df8b4989271ad4464be | Fix inheritance in soc.models.base module. FieldsProxy inherited from DbModelForm which was deleted in previous commits (replace that with BaseForm). | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | app/soc/models/base.py | app/soc/models/base.py | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | apache-2.0 | Python |
b4acc5d4c5f6b3e94225ca5926d06a50c511173c | add json exporter | Informationretrieval2016/furnito | furnito_crawler/json_manager.py | furnito_crawler/json_manager.py | import json
class Json_Manager:
def __init__(self):
pass
def export_json(self, path, json_content):
'''
@usage: export dict to json and store on local storage
@arg: path, path to store json, string eg, 'downlaods/1.json'
@arg: json_content, the content want to export, d... | class Json_Manager:
def __init__(self):
pass
| mit | Python |
5bde6ca1fd62277463156875e874c4c6843923fd | Use the correct variable for the test | luzfcb/cookiecutter-pytest-plugin,pytest-dev/cookiecutter-pytest-plugin,s0undt3ch/cookiecutter-pytest-plugin | pytest-{{cookiecutter.plugin_name}}/tests/test_{{cookiecutter.plugin_name}}.py | pytest-{{cookiecutter.plugin_name}}/tests/test_{{cookiecutter.plugin_name}}.py | # -*- coding: utf-8 -*-
def test_bar_fixture(testdir):
"""Make sure that pytest accepts our fixture."""
# create a temporary pytest test module
testdir.makepyfile("""
def test_sth(bar):
assert bar == "europython2015"
""")
# run pytest with the following cmd args
result = t... | # -*- coding: utf-8 -*-
def test_bar_fixture(testdir):
"""Make sure that pytest accepts our fixture."""
# create a temporary pytest test module
testdir.makepyfile("""
def test_sth(bar):
assert bar == "europython2015"
""")
# run pytest with the following cmd args
result = t... | mit | Python |
164262400dbb265a3363eb9f1415284b391c079c | Remove duplicate call | henfredemars/Fork-Lang,henfredemars/Fork-Lang,henfredemars/Fork-Lang,henfredemars/Fork-Lang,henfredemars/Fork-Lang,henfredemars/Fork-Lang,henfredemars/Fork-Lang | fc.py | fc.py | #!/usr/bin/python3
#Fork compiler toolchain script
import argparse
import re, os
from sys import exit
def main():
#Parse arguments
parser = argparse.ArgumentParser(description='Fork toolchain command line parser...')
parser.add_argument('-v',action='store_true',help='Use valgrind')
parser.add_argument('-c',act... | #!/usr/bin/python3
#Fork compiler toolchain script
import argparse
import re, os
from sys import exit
def main():
#Parse arguments
parser = argparse.ArgumentParser(description='Fork toolchain command line parser...')
parser.add_argument('-v',action='store_true',help='Use valgrind')
parser.add_argument('-c',act... | apache-2.0 | Python |
1e14d68c86e0cacb9bedc51884081ef0a1cfdcdc | Fix for trevis | FedericoPonzi/Isitdown.site,FedericoPonzi/Isitdown.site,FedericoPonzi/Isitdown.site | isitdown/config.py | isitdown/config.py | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = False
TESTING = False
DATABASE_URI = os.environ.get("ISITDOWN_DATABASE_URI", 'sqlite:///' + os.path.join(basedir, 'app.db'))
SECRET_KEY = os.environ.get('ISITDOWN_SECRET_KEY', 'you-will-never-guess')
SQLAL... | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = False
TESTING = False
DATABASE_URI = os.environ["ISITDOWN_DATABASE_URI"] or 'sqlite:///' + os.path.join(basedir, 'app.db')
SECRET_KEY = os.environ['ISITDOWN_SECRET_KEY'] or 'you-will-never-guess'
SQLALCHEM... | apache-2.0 | Python |
16d87a91bcd6eb5cdb23d6aeb45e48ca7baf181a | remove unnecessary import | dschmaryl/golf-flask,dschmaryl/golf-flask,dschmaryl/golf-flask | createdb.py | createdb.py | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask('app')
app.config.from_object('config')
db = SQLAlchemy(app)
db.create_all()
| from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask('app')
app.config.from_object('config')
db = SQLAlchemy(app)
from app import models
db.create_all()
| mit | Python |
ee1b02d7327eeeeb65115c705a0df1ffd7c82034 | Make random election view a bit more random | DemocracyClub/Website,DemocracyClub/Website,DemocracyClub/Website,DemocracyClub/Website | democracy_club/apps/everyelection/views.py | democracy_club/apps/everyelection/views.py | import random
from django.db.models import Count
from django.shortcuts import get_object_or_404
from django.views.generic import RedirectView, UpdateView
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from braces.views import LoginRequiredMixin
from .models import AuthorityElectio... | from django.db.models import Count
from django.shortcuts import get_object_or_404
from django.views.generic import RedirectView, UpdateView
from django.core.urlresolvers import reverse
from braces.views import LoginRequiredMixin
from .models import AuthorityElection, AuthorityElectionPosition
from .forms import Autho... | bsd-3-clause | Python |
2549a66b6785d5a0ed0658a4f375a21c486792df | Raise explicit exception on no type match | alisaifee/sifr,alisaifee/sifr | sifr/util.py | sifr/util.py | import datetime
from dateutil import parser
import six
def normalize_time(t):
try:
if isinstance(t, datetime.datetime):
return t
elif isinstance(t, datetime.date):
return datetime.datetime(t.year, t.month, t.day)
elif isinstance(t, (int, float)):
return ... | import datetime
from dateutil import parser
import six
def normalize_time(t):
try:
if isinstance(t, datetime.datetime):
return t
elif isinstance(t, datetime.date):
return datetime.datetime(t.year, t.month, t.day)
elif isinstance(t, (int, float)):
return ... | mit | Python |
62ede23b0e13ab907b3eab620193921de29e162b | Bump version to 4.3.2b1 | platformio/platformio,platformio/platformio-core,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
d4af985eb8786f6531e319e837fcc8d7b3e33ece | Bump version to 4.0.0a5 | platformio/platformio-core,platformio/platformio,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
454cd8d7847074988bf967f6240d59f25bdf310e | Bump version to 5.0.2rc1 | platformio/platformio-core,platformio/platformio,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
dc14bd73623f453d8ef272a9cd46df3733fcfad9 | Bump version to 6.1.5rc1 | platformio/platformio-core,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
1800e98f0570bfd1029d9df881fb144fdd943e72 | Remove leftover debug print from Melnor (#78870) | mezz64/home-assistant,w1ll1am23/home-assistant,nkgilley/home-assistant,w1ll1am23/home-assistant,mezz64/home-assistant,nkgilley/home-assistant | tests/components/melnor/test_number.py | tests/components/melnor/test_number.py | """Test the Melnor sensors."""
from __future__ import annotations
from .conftest import (
mock_config_entry,
patch_async_ble_device_from_address,
patch_async_register_callback,
patch_melnor_device,
)
async def test_manual_watering_minutes(hass):
"""Test the manual watering switch."""
entry ... | """Test the Melnor sensors."""
from __future__ import annotations
from .conftest import (
mock_config_entry,
patch_async_ble_device_from_address,
patch_async_register_callback,
patch_melnor_device,
)
async def test_manual_watering_minutes(hass):
"""Test the manual watering switch."""
entry ... | apache-2.0 | Python |
ae6025a4be24637e57c0545aa860d96a0447aa89 | Raise any exceptions from ended listeners in workers | andrewgodwin/django-channels,django/channels,andrewgodwin/channels | channels/worker.py | channels/worker.py | import asyncio
from asgiref.server import StatelessServer
class Worker(StatelessServer):
"""
ASGI protocol server that surfaces events sent to specific channels
on the channel layer into a single application instance.
"""
def __init__(self, application, channels, channel_layer, max_applications=... | import asyncio
from asgiref.server import StatelessServer
class Worker(StatelessServer):
"""
ASGI protocol server that surfaces events sent to specific channels
on the channel layer into a single application instance.
"""
def __init__(self, application, channels, channel_layer, max_applications=... | bsd-3-clause | Python |
6149cef01900d6710efa322ef934965c5f1379f8 | Fix pylint | marcore/pok-eco,marcore/pok-eco | xapi/utils.py | xapi/utils.py | from opaque_keys.edx.keys import CourseKey
from opaque_keys import InvalidKeyError
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from xmodule.modulestore.django import modulestore
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from openedx.core.djangoapps.conte... | from opaque_keys.edx.keys import CourseKey
from opaque_keys import InvalidKeyError
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from xmodule.modulestore.django import modulestore
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from openedx.core.djangoapps.conte... | agpl-3.0 | Python |
0b707c2e3a4d00aef5dad683c535498cb8bc1e21 | use the default date formatter for logging | xgfone/xutils,xgfone/pycom | xutils/log.py | xutils/log.py | # -*- coding: utf-8 -*-
import os
import os.path
import logging
from logging.handlers import RotatingFileHandler
def init(logger=None, level="INFO", file=None, handler_cls=None, process=False,
max_count=30, propagate=True, file_config=None, dict_config=None):
root = logging.getLogger()
if not logge... | # -*- coding: utf-8 -*-
import os
import os.path
import logging
from logging.handlers import RotatingFileHandler
def init(logger=None, level="INFO", file=None, handler_cls=None, process=False,
max_count=30, propagate=True, file_config=None, dict_config=None):
root = logging.getLogger()
if not logge... | mit | Python |
7d8380a65523e7d6ef77d39eaf125823e3e10812 | Bump version to 5.0.0dev0 | chardet/chardet,chardet/chardet | chardet/version.py | chardet/version.py | """
This module exists only to simplify retrieving the version number of chardet
from within setup.py and from chardet subpackages.
:author: Dan Blanchard (dan.blanchard@gmail.com)
"""
__version__ = "5.0.0dev0"
VERSION = __version__.split('.')
| """
This module exists only to simplify retrieving the version number of chardet
from within setup.py and from chardet subpackages.
:author: Dan Blanchard (dan.blanchard@gmail.com)
"""
__version__ = "4.0.0"
VERSION = __version__.split('.')
| lgpl-2.1 | Python |
4cb36450aa4ddabe0a6fa48300dc37edc053dd13 | fix bug in isOpen for reports | clarkerubber/irwin,clarkerubber/irwin | modules/queue/ModReport.py | modules/queue/ModReport.py | """Queue item for basic analysis by irwin"""
from collections import namedtuple
from datetime import datetime, timedelta
import pymongo
class ModReport(namedtuple('ModReport', ['id', 'processed', 'created'])):
@staticmethod
def new(userId):
return ModReport(
id=userId,
processed... | """Queue item for basic analysis by irwin"""
from collections import namedtuple
from datetime import datetime, timedelta
import pymongo
class ModReport(namedtuple('ModReport', ['id', 'processed', 'created'])):
@staticmethod
def new(userId):
return ModReport(
id=userId,
processed... | agpl-3.0 | Python |
6326cfa9ad5cb203eeade0c5875a005e06bbe932 | fix isort test | aioworkers/aioworkers,aamalev/aioworkers | tests/test_core_base_multi_executor.py | tests/test_core_base_multi_executor.py | from datetime import timedelta
import pytest
@pytest.fixture
def config_yaml(unused_port):
return """
e:
cls: aioworkers.core.base.MultiExecutorEntity
executors:
get: 1
put: 1
none: none
x: null
"""
async def test_multiexecutor(context):
asser... | import pytest
from datetime import timedelta
@pytest.fixture
def config_yaml(unused_port):
return """
e:
cls: aioworkers.core.base.MultiExecutorEntity
executors:
get: 1
put: 1
none: none
x: null
"""
async def test_multiexecutor(context):
assert... | apache-2.0 | Python |
94260ec953de44ae9a4108b964a9a607b0457148 | fix new search index | MuckRock/muckrock,MuckRock/muckrock,MuckRock/muckrock,MuckRock/muckrock | muckrock/news/search_indexes.py | muckrock/news/search_indexes.py | """
Search Index for the news application
"""
from haystack.indexes import SearchIndex, CharField, DateTimeField
from haystack import site
from muckrock.news.models import Article
class ArticleIndex(SearchIndex):
"""Search index for news articles"""
text = CharField(document=True, use_template=True)
auth... | """
Search Index for the news application
"""
from haystack.indexes import SearchIndex, CharField, DateTimeField
from haystack import site
from muckrock.news.models import Article
class ArticleIndex(SearchIndex):
"""Search index for news articles"""
text = CharField(document=True, use_template=True)
auth... | agpl-3.0 | Python |
2bafdb04dc4e04c5a2cf9136135dfa130ac6e78b | read full buffer, not byte by byte | stharding/serialSniffer | serialSniffer/sniffer.py | serialSniffer/sniffer.py | from serial import Serial
from concurrent.futures import ThreadPoolExecutor
class Sniffer(object):
"""
TODO: write docstring
"""
def __init__(self, virtual_comm='COM7', physical_comm='COM1'):
self.virtual_comm = Serial(virtual_comm)
self.physical_comm = Serial(physical_comm)
... | from serial import Serial
from concurrent.futures import ThreadPoolExecutor
class Sniffer(object):
"""
TODO: write docstring
"""
def __init__(self, virtual_comm='COM7', physical_comm='COM1'):
self.virtual_comm = Serial(virtual_comm)
self.physical_comm = Serial(physical_comm)
... | mit | Python |
eac867faba8d4653fa580ee0c2bd708ff83b13ee | Remove test workaround | MACSIFS/IFS,MACSIFS/IFS,MACSIFS/IFS,MACSIFS/IFS | server/tests/test_api.py | server/tests/test_api.py | import json
from server.tests.base import BaseTestCase
from server.models import db, Lecturer, Course, Lecture, Comment
class GetCommentsApiTest(BaseTestCase):
def setUp(self):
super(GetCommentsApiTest, self).setUp()
simon = Lecturer('Simon', 'McCallum')
db.session.add(simon)
imt... | import json
from server.tests.base import BaseTestCase
from server.models import db, Lecturer, Course, Lecture, Comment
class GetCommentsApiTest(BaseTestCase):
def setUp(self):
super(GetCommentsApiTest, self).setUp()
simon = Lecturer('Simon', 'McCallum')
db.session.add(simon)
imt... | mit | Python |
cf8cba155edb7f1d27fce7b20aaafce044415a22 | Update 35b556aef8ef_add_news_flash_table.py | hasadna/anyway,hasadna/anyway,hasadna/anyway,hasadna/anyway | alembic/versions/35b556aef8ef_add_news_flash_table.py | alembic/versions/35b556aef8ef_add_news_flash_table.py | """add new table
Revision ID: 35b556aef8ef
Revises: 423a7ea74c0a
Create Date: 2018-12-10 11:31:29.518909
"""
# revision identifiers, used by Alembic.
revision = '35b556aef8ef'
down_revision = '423a7ea74c0a'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
##... | """add new table
Revision ID: 35b556aef8ef
Revises: 3c8ad66233c0
Create Date: 2018-12-10 11:31:29.518909
"""
# revision identifiers, used by Alembic.
revision = '35b556aef8ef'
down_revision = '423a7ea74c0a'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
##... | mit | Python |
5f12bac216f5380e55dc65ccfcd16e369c575dac | Use redis on localhost | emmetog/page-hit-counter | app.py | app.py | from flask import Flask
from redis import Redis
import os
app = Flask(__name__)
redis = Redis(host= "localhost", port=6379)
@app.route('/')
def hello():
redis.incr('hits')
return 'This page has been seen {0} times' . format (redis.get( 'hits' ))
if __name__ == "__main__":
app.run(host= "0.0.0.0", debug=T... | from flask import Flask
from redis import Redis
import os
app = Flask(__name__)
redis = Redis(host= "redis", port=6379)
@app.route('/')
def hello():
redis.incr('hits')
return 'This page has been seen {0} times' . format (redis.get( 'hits' ))
if __name__ == "__main__":
app.run(host= "0.0.0.0", debug=True) | mit | Python |
a1c558027cd17eec69a2babb786e35b147ffae6b | add start.html | abhiram304/APIWorldHackathon-SmartAssistant,abhiram304/APIWorldHackathon-SmartAssistant | app.py | app.py | #!flask/bin/python
from flask import request, render_template, Flask
import os, sys, json
import requests
app = Flask(__name__)
from random import randint
from telesign.messaging import MessagingClient
from telesign.voice import VoiceClient
from flask import request
@app.route('/')
def index():
return render_te... | #!flask/bin/python
from flask import request, render_template, Flask
import os, sys, json
import requests
app = Flask(__name__)
from random import randint
from telesign.messaging import MessagingClient
from telesign.voice import VoiceClient
from flask import request
@app.route('/')
def index():
return render_te... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.