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 |
|---|---|---|---|---|---|---|---|---|
ec0cad36ccffb000111cacdfc22cc17bc8be4e84 | Adjust display threshold when using verbose mode. | jchoude/tractconverter,jchoude/tractconverter,MarcCote/tractconverter,MarcCote/tractconverter | tractconverter/utils.py | tractconverter/utils.py | import os
import logging
from pdb import set_trace as dbg
from tractconverter.formats.tck import TCK
from tractconverter.formats.trk import TRK
from tractconverter.formats.fib import FIB
from tractconverter.formats.vtk import VTK
# Supported format
FORMATS = {"tck": TCK,
"trk": TRK,
"fib": FIB,
... | import os
import logging
from pdb import set_trace as dbg
from tractconverter.formats.tck import TCK
from tractconverter.formats.trk import TRK
from tractconverter.formats.fib import FIB
from tractconverter.formats.vtk import VTK
# Supported format
FORMATS = {"tck": TCK,
"trk": TRK,
"fib": FIB,
... | bsd-3-clause | Python |
26887135f1d8fcce669874f264b0c5ba4a0ddaad | Set version to 'dev' in master | srthurman/transitland-python-client,transitland/transitland-python-client | transitland/__init__.py | transitland/__init__.py | """
Transitland Python Client.
This library implements an interface for the Transitland Feed Registry, Transitland Datastore, and working with Onestop IDs:
https://github.com/transit-land/onestop-id
Modules:
registry - Feed Registry reader
entities - Transitland entities
geom - Geometry utilities
util - ... | """
Transitland Python Client.
This library implements an interface for the Transitland Feed Registry, Transitland Datastore, and working with Onestop IDs:
https://github.com/transit-land/onestop-id
Modules:
registry - Feed Registry reader
entities - Transitland entities
geom - Geometry utilities
util - ... | mit | Python |
ad0d43246ab135facdfa865b4c335ca2bb2db491 | write data in bulk and remove the path to the data file - require the arg instead in the script | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | portality/migrate/2966_add_oa_start_date_from_backup/add_oa_start_date_from_backup.py | portality/migrate/2966_add_oa_start_date_from_backup/add_oa_start_date_from_backup.py | import csv
from copy import deepcopy
from datetime import datetime
import esprit
from portality.core import es_connection
from portality.models import Journal
from portality.settings import BASE_FILE_PATH
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(... | import csv
from copy import deepcopy
from portality.models import Journal
from portality.settings import BASE_FILE_PATH
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-o", "--out", help="output file path")
args = parser.parse_args()
if not arg... | apache-2.0 | Python |
da84d680ca271fd79027692eac127167c00fcee8 | Fix morning time span to be between 6 and 8 | fjacob21/MAX,fjacob21/MAX,fjacob21/MAX,fjacob21/MAX | service/src/state_scheduler/states/salon_entry_light_state/salon_entry_light_state.py | service/src/state_scheduler/states/salon_entry_light_state/salon_entry_light_state.py | import MAX
import time
import datetime
from .off_state import off_state
from .on_state import on_state
from .prio_off_state import prio_off_state
from .prio_on_state import prio_on_state
class salon_entry_light_state(object):
def __init__(self):
self._off_state = off_state(self)
self._on_state = on... | import MAX
import time
import datetime
from .off_state import off_state
from .on_state import on_state
from .prio_off_state import prio_off_state
from .prio_on_state import prio_on_state
class salon_entry_light_state(object):
def __init__(self):
self._off_state = off_state(self)
self._on_state = on... | mit | Python |
3f43163e0900aa6b830013f2ba3c6c6915f514aa | implement playMovie action | flurischt/omxremote,flurischt/omxremote,flurischt/omxremote | omxremote/backend.py | omxremote/backend.py | import os
import json
import hashlib
from flask import Flask, Response, request, jsonify
from omxremote.dbus_connection import OmxRemote
app = Flask(__name__)
#TODO
SUPPORTED_COMMANDS = ('pause', 'togglesubtitles', 'volumeup', 'volumedown', 'stop')
VIDEO_FILE_EXTENSIONS = ('.avi', '.mkv', '.mp4')
MOVIES_DIR = 'movi... | import os
import json
import hashlib
from flask import Flask, Response, request, jsonify
from omxremote.dbus_connection import OmxRemote
app = Flask(__name__)
#TODO
SUPPORTED_COMMANDS = ('pause', 'togglesubtitles', 'volumeup', 'volumedown', 'stop')
VIDEO_FILE_EXTENSIONS = ('.avi', '.mkv', '.mp4')
MOVIES_DIR = 'movi... | bsd-2-clause | Python |
95655e2dc094a72f6b9e25c2c44ac69f5fba6094 | Add search urls on articles | opps/opps,jeanmask/opps,williamroot/opps,opps/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,williamroot/opps,williamroot/opps,opps/opps,opps/opps,YACOWS/opps,jeanmask/opps | opps/article/urls.py | opps/article/urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from django.conf.urls import patterns, url
from opps.article.views import OppsDetail, OppsList, Search
urlpatterns = patterns(
'',
url(r'^$', OppsList.as_view(), name='home'),
url(r'^search/', Search(), name='search'),
url(r'^(?P<channel__long_slug>[\w/... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from django.conf.urls import patterns, url
from opps.article.views import OppsDetail, OppsList
urlpatterns = patterns(
'',
url(r'^$', OppsList.as_view(), name='home'),
url(r'^(?P<channel__long_slug>[\w//-]+)/(?P<slug>[\w-]+)$',
OppsDetail.as_view(),... | mit | Python |
39eeca93f28ee6e452590041dee18ec853c761f2 | Use tf.contrib.rnn.LayerNormBasicLSTMCell | raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten | nn/rnn/cell.py | nn/rnn/cell.py | import tensorflow as tf
from ..flags import FLAGS
from ..util import funcname_scope
@funcname_scope
def ln_lstm(output_size, dropout_prob=FLAGS.dropout_prob):
return tf.contrib.rnn.LayerNormBasicLSTMCell(
output_size,
dropout_keep_prob=1-dropout_prob)
@funcname_scope
def gru(output_size, dropout_pro... | import tensorflow as tf
from ..assertion import is_sequence
from ..util import funcname_scope, static_shape, static_rank
from ..normalization import layer_normalization
class LNLSTMCell(tf.nn.rnn_cell.RNNCell):
def __init__(self, num_units, forget_bias=1.0, activation=tf.tanh):
self._num_units = num_units
... | unlicense | Python |
780bf8ee4bbe8936055ddc0e71042fc7736f0192 | Fix prime declaraion in make_tests | boppreh/ecc,boppreh/ecc | make_tests.py | make_tests.py | #!/bin/env python3
from field import FieldValue
from random import randint
import math
prime = 2**31 -1
n_chunks = math.ceil(math.log2(prime) / 2)
F = lambda i: FieldValue(i, prime)
h = lambda i: hex(i)[2:]
print("""
#include "ecc.c"
int main() {
""")
print('\tNumber p = parse("{}");'.format(h(prime)))
print('\tNumb... | #!/bin/env python3
from field import FieldValue
from random import randint
import math
prime = 2**31 -1
n_chunks = math.ceil(math.log2(prime) / 2)
F = lambda i: FieldValue(i, prime)
h = lambda i: hex(i)[2:]
print("""
#include "ecc.c"
int main() {
""")
print('\tNumber p = parse("{}");'.format(prime))
print('\tNumber ... | mit | Python |
ee5bc5d6d212e2bd8e0d60e6024c5180821f6a35 | Format test according to Black | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | tests/integration/services/ticketing/test_creation.py | tests/integration/services/ticketing/test_creation.py | """
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from unittest.mock import patch
from pytest import raises
from byceps.services.ticketing import (
event_service,
ticket_creation_service,
ticket_service,
)
def test_create_ticket(admin_app, category, tic... | """
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from unittest.mock import patch
from pytest import raises
from byceps.services.ticketing import (
event_service,
ticket_creation_service,
ticket_service,
)
def test_create_ticket(admin_app, category, tic... | bsd-3-clause | Python |
784f58a27c6e010b87ff568fc8c0719e52c037a2 | Update disabled_print_settings_for_custom_print_format.py | rmehta/frappe,StrellaGroup/frappe,mhbu50/frappe,mbauskar/frappe,elba7r/builder,mbauskar/frappe,mhbu50/frappe,elba7r/frameworking,yashodhank/frappe,manassolanki/frappe,rmehta/frappe,StrellaGroup/frappe,almeidapaulopt/frappe,indautgrp/frappe,frappe/frappe,mbauskar/frappe,rohitwaghchaure/frappe,bcornwellmott/frappe,manass... | frappe/patches/v7_1/disabled_print_settings_for_custom_print_format.py | frappe/patches/v7_1/disabled_print_settings_for_custom_print_format.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doctype('Print Format')
frappe.db.sql("""
update
`tabPrint Format`
set
... | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.db.sql("""
update
`tabPrint Format`
set
align_labels_left = 0, line_breaks =... | mit | Python |
4aac0d6d1c5b253a8078316fc8ac5a4d735cd69f | Upgrade to Chrome 38.0.2125.102 | fabien-d/electron,JesselJohn/electron,dkfiresky/electron,lzpfmh/electron,JussMee15/electron,howmuchcomputer/electron,kenmozi/electron,jannishuebl/electron,brave/muon,meowlab/electron,icattlecoder/electron,bwiggs/electron,nekuz0r/electron,jtburke/electron,michaelchiche/electron,kokdemo/electron,posix4e/electron,LadyNagg... | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '70fe9677634a8f13fd5c67b8c83c056f2d9c8d46'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
... | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '3245ef802fbf546f1a1d206990aa9d18be6bfbfe'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
... | mit | Python |
1f2c3057d4fa5ec875c60297184c154ecd0fff39 | Bump reported version string to 1.3.1 | basho-labs/riak-mesos-tools,basho-labs/riak-mesos-tools | riak_mesos/constants.py | riak_mesos/constants.py | #
# Copyright (C) 2016 Basho Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | #
# Copyright (C) 2016 Basho Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python |
f3ab4f25797e59187807095ebc689616007b8c9e | add more test case | nonlining/SimpleML | Regression/testKnearestRegression.py | Regression/testKnearestRegression.py | #-------------------------------------------------------------------------------
# Name: test Knearest Regression
# Purpose:
#
# Author: Nonlining
#
# Created: 23/03/2017
# Copyright: (c) Nonlining 2017
# Licence: <your licence>
#--------------------------------------------------------------------... | #-------------------------------------------------------------------------------
# Name: test Knearest Regression
# Purpose:
#
# Author: Nonlining
#
# Created: 23/03/2017
# Copyright: (c) Nonlining 2017
# Licence: <your licence>
#--------------------------------------------------------------------... | mit | Python |
92b9a27ade884bb84dd06cf3af8295d5270773cc | make last.py and lastz.py interface similar | tanghaibao/jcvi,sgordon007/jcvi_062915 | apps/last.py | apps/last.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Wrapper for LAST program.
<http://last.cbrc.jp>
"""
import sys
from optparse import OptionParser
from jcvi.utils.cbook import depends
from jcvi.apps.base import debug, sh, set_outfile
debug()
@depends
def run_lastdb(infile=None, outfile=None):
outfilebase = o... | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Wrapper for LAST program.
<http://last.cbrc.jp>
"""
import sys
from optparse import OptionParser
from jcvi.utils.cbook import depends
from jcvi.apps.base import ActionDispatcher, debug, sh, set_outfile
debug()
def main():
actions = (
('last', 'run LA... | bsd-2-clause | Python |
525f604a898967b2f07e53264479b5609173d2b7 | Add a BLT parser test. | cjerdonek/open-rcv,cjerdonek/open-rcv | openrcv/test/test.py | openrcv/test/test.py |
from io import StringIO
from textwrap import dedent
import unittest
from unittest import TestCase
from openrcv.main import BLTParser, ContestInfo
def run_tests():
# TODO: discover all tests.
unittest.main(module=__name__)
class MainTestCase(TestCase):
def test(self):
self.assertEqual(1, 1)
... |
import unittest
def run_tests():
# TODO: discover all tests.
unittest.main(module=__name__)
class MainTestCase(unittest.TestCase):
def test(self):
self.assertEqual(1, 1)
| mit | Python |
7428fc66f76a9c25ca924871e91c664a133d362e | update web site and git url for BMI package (#12036) | iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/bmi/package.py | var/spack/repos/builtin/packages/bmi/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Bmi(AutotoolsPackage):
"""a communications framework and network abstraction layer"""
... | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Bmi(AutotoolsPackage):
"""a communications framework and network abstraction layer"""
... | lgpl-2.1 | Python |
b3fcfc1cb25884f668466816be08a2a68cee256a | Add lz4 1.9.2 (#13155) | LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/lz4/package.py | var/spack/repos/builtin/packages/lz4/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import sys
class Lz4(MakefilePackage):
"""LZ4 is lossless compression algorithm, providing compr... | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import sys
class Lz4(Package):
"""LZ4 is lossless compression algorithm, providing compression s... | lgpl-2.1 | Python |
cd70f6b89b1fff89c5c6a628c926365be9e3c95f | change scenario and for loop | openego/data_processing | preprocessing/python_scripts/renpass_gis/simple_feedin/results_to_oedb.py | preprocessing/python_scripts/renpass_gis/simple_feedin/results_to_oedb.py | """
Write results of simple_feedin.py into the openEnergy Database.
links:
https://www.shanelynn.ie/select-pandas-dataframe-rows-and-columns-using-iloc-loc-and-ix/
http://www.datacarpentry.org/python-ecology-lesson/02-index-slice-subset/
ToDo:
Insert capacity
move to odeb
update data_processing
"""
__co... | """
Write results of simple_feedin.py into the openEnergy Database.
links:
https://www.shanelynn.ie/select-pandas-dataframe-rows-and-columns-using-iloc-loc-and-ix/
http://www.datacarpentry.org/python-ecology-lesson/02-index-slice-subset/
ToDo:
Insert capacity
move to odeb
update data_processing
"""
__co... | agpl-3.0 | Python |
87846ebce6214b72f2445b929db49e7545ae2be5 | replace 1wire sensor with new one, change the id | teemuhirsikangas/magicaespeculo,teemuhirsikangas/magicaespeculo,teemuhirsikangas/magicaespeculo,teemuhirsikangas/magicaespeculo | scripts/send_temp.py | scripts/send_temp.py | #!/usr/bin/python
import time
import os
import json
import requests
#for adafruit dht22/AM2302 sensor lib
import sys
import Adafruit_DHT
outside_temp=os.path.join("/","mnt","1wire","28.FF1521621603","temperature")
floor_temp=os.path.join("/","mnt","1wire","10.04A794020800","temperature")
room_temp=os.path.join("/","mn... | #!/usr/bin/python
import time
import os
import json
import requests
#for adafruit dht22/AM2302 sensor lib
import sys
import Adafruit_DHT
outside_temp=os.path.join("/","mnt","1wire","10.E1B894020800","temperature")
floor_temp=os.path.join("/","mnt","1wire","10.04A794020800","temperature")
room_temp=os.path.join("/","mn... | mit | Python |
e4990f65c08db3dbdf2dce0056d2b0b5102b3ee5 | Use relative imports | MBARIMike/biofloat,biofloat/biofloat,biofloat/biofloat,MBARIMike/oxyfloat,MBARIMike/biofloat,MBARIMike/oxyfloat | oxyfloat/__init__.py | oxyfloat/__init__.py | __all__ = ['exceptions', 'OxyFloat']
from .OxyFloat import OxyFloat
from .exceptions import RequiredVariableNotPresent, OpenDAPServerError
| __all__ = ['exceptions', 'OxyFloat']
from oxyfloat.OxyFloat import OxyFloat
from oxyfloat.exceptions import RequiredVariableNotPresent, OpenDAPServerError
| mit | Python |
ea972c89cd7abe4fdb772ce359dd9acd83817242 | Add http_transport and websocket_transport methods | devicehive/devicehive-python | tests/test.py | tests/test.py | from devicehive import Handler
from devicehive import DeviceHive
class TestHandler(Handler):
"""Test handler class."""
def handle_connect(self):
if not self.options['handle_connect'](self):
self.api.disconnect()
def handle_event(self, event):
pass
class Test(object):
""... | from devicehive import Handler
from devicehive import DeviceHive
class TestHandler(Handler):
"""Test handler class."""
def handle_connect(self):
if not self.options['handle_connect'](self):
self.api.disconnect()
def handle_event(self, event):
pass
class Test(object):
""... | apache-2.0 | Python |
49d9f8374769a5febc20edaa09ed7be02e5c6b25 | Fix test | noxiouz/docker-registry-driver-elliptics,noxiouz/docker-registry-driver-elliptics | tests/test.py | tests/test.py | # -*- coding: utf-8 -*-
import logging
from docker_registry import testing
logger = logging.getLogger(__name__)
class TestQuery(testing.Query):
def __init__(self):
self.scheme = 'elliptics'
class TestDriver(testing.Driver):
def __init__(self):
self.scheme = 'elliptics'
self.path =... | # -*- coding: utf-8 -*-
import logging
from docker_registry import testing
logger = logging.getLogger(__name__)
class TestQuery(testing.Query):
def __init__(self):
self.scheme = 'elliptics'
class TestDriver(testing.Driver):
def __init__(self):
self.scheme = 'elliptics'
self.path =... | apache-2.0 | Python |
2717f5ba22ccc0308b4805658c8ebe9077c20352 | add a str-to-int helper | alfredodeza/ceph-doctor | ceph_medic/util/__init__.py | ceph_medic/util/__init__.py |
def str_to_int(string):
"""
Parses a string number into an integer, optionally converting to a float
and rounding down.
Some LVM values may come with a comma instead of a dot to define decimals.
This function normalizes a comma into a dot
"""
error_msg = "Unable to convert to integer: '%s'... | mit | Python | |
885e41eebe513cc237c9473069f61a609d2eb9b4 | Bump version number. | tkem/mopidy-mobile,tkem/mopidy-mobile,tkem/mopidy-mobile | mopidy_mobile/__init__.py | mopidy_mobile/__init__.py | from __future__ import unicode_literals
import os
from mopidy import config, ext
__version__ = '1.8.1'
class Extension(ext.Extension):
dist_name = 'Mopidy-Mobile'
ext_name = 'mobile'
version = __version__
def get_config_schema(self):
schema = super(Extension, self).get_config_schema()
... | from __future__ import unicode_literals
import os
from mopidy import config, ext
__version__ = '1.8.0'
class Extension(ext.Extension):
dist_name = 'Mopidy-Mobile'
ext_name = 'mobile'
version = __version__
def get_config_schema(self):
schema = super(Extension, self).get_config_schema()
... | apache-2.0 | Python |
74c20f976060f2056c91edcde810ccc3e8dc3f14 | add scene_doc to subscene iteration | gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl | tests/serialize.py | tests/serialize.py | #!/usr/bin/env python
import os
import os.path as op
from pynodegl_utils.com import query_subproc, query_inplace
def serialize(dirname, subproc=False):
module_pkg = 'pynodegl_utils.examples'
if subproc:
ret = query_subproc(query='list', pkg=module_pkg)
else:
ret = query_inplace(query='li... | #!/usr/bin/env python
import os
import os.path as op
from pynodegl_utils.com import query_subproc, query_inplace
def serialize(dirname, subproc=False):
module_pkg = 'pynodegl_utils.examples'
if subproc:
ret = query_subproc(query='list', pkg=module_pkg)
else:
ret = query_inplace(query='li... | apache-2.0 | Python |
b1e8ee5d8578ce18484e278d4b7bf3b654ce96de | use compatible python3 syntax | Sevalecan/paintown,Sevalecan/paintown,boyjimeking/paintown,Sevalecan/paintown,boyjimeking/paintown,boyjimeking/paintown,Sevalecan/paintown,boyjimeking/paintown,Sevalecan/paintown,boyjimeking/paintown,boyjimeking/paintown,boyjimeking/paintown,boyjimeking/paintown,Sevalecan/paintown,Sevalecan/paintown,Sevalecan/paintown | misc/cores.py | misc/cores.py | # http://codeliberates.blogspot.com/2008/05/detecting-cpuscores-in-python.html
def detectCPUs():
import os
"""
Detects the number of CPUs on a system. Cribbed from pp.
"""
# Linux, Unix and MacOS:
if hasattr(os, "sysconf"):
if os.sysconf_names.has_key("SC_NPROCESSORS_ONLN"):
# L... | # http://codeliberates.blogspot.com/2008/05/detecting-cpuscores-in-python.html
def detectCPUs():
import os
"""
Detects the number of CPUs on a system. Cribbed from pp.
"""
# Linux, Unix and MacOS:
if hasattr(os, "sysconf"):
if os.sysconf_names.has_key("SC_NPROCESSORS_ONLN"):
# L... | bsd-3-clause | Python |
def8eb0844e95d82b25c0a79c3be42bfaacb100c | add sphinx documentation | rflamary/POT,aje/POT,rflamary/POT,aje/POT | ot/__init__.py | ot/__init__.py |
# Python Optimal Transport toolbox
import utils
import datasets
import plot
# Ot functions
from emd import emd
from bregman import sinkhorn
from utils import dist,dots
__all__ = ["emd","sinkhorn","utils",'datasets','plot','dist','dots']
|
# Python Optimal Transport toolbox
import utils
import datasets
import plot
# Ot functions
from emd import emd
from bregman import sinkhorn
from utils import dist,dots
__all__ = ["emd","sinkhorn","utils",'datasets','plot','dist','dot']
| mit | Python |
96d6dea52b4ed0f793364e8641ffbb452a23c599 | Extend tests use cases | syci/partner-contact,syci/partner-contact | partner_ref_unique/tests/test_res_partner_ref.py | partner_ref_unique/tests/test_res_partner_ref.py | # Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests import common
from odoo.exceptions import ValidationError
class TestResPartnerRefUnique(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestResPartnerRefUniq... | # Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests import common
from odoo.exceptions import ValidationError
class TestResPartnerRefUnique(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestResPartnerRefUniq... | agpl-3.0 | Python |
550c7b5b36c7f8c35eb31c3a32887c59d3519f84 | Update pytest for new deepclean function (1 fewer input, reverse scan) | NREL/bifacial_radiance,NREL/bifacial_radiance,NREL/bifacial_radiance,NREL/bifacial_radiance | tests/test_load.py | tests/test_load.py | # -*- coding: utf-8 -*-
"""
Created 2/19/19
@author: cdeline
Using pytest to create unit tests for load.py
to run unit tests, run pytest from the command line in the bifacial_radiance directory
"""
import bifacial_radiance
import os, pytest
# try navigating to tests directory so tests run from here.
try:
os.c... | # -*- coding: utf-8 -*-
"""
Created 2/19/19
@author: cdeline
Using pytest to create unit tests for load.py
to run unit tests, run pytest from the command line in the bifacial_radiance directory
"""
import bifacial_radiance
import os, pytest
# try navigating to tests directory so tests run from here.
try:
os.c... | bsd-3-clause | Python |
edea6cec717d2bbfd0dc078a447f2bd2a7e90054 | Add test for when local is empty and s3 is populated | MichaelAquilina/s3backup,MichaelAquilina/s3backup | tests/test_main.py | tests/test_main.py | # -*- coding: utf-8 -*-
import gzip
import json
import os
import shutil
import tempfile
import boto3
from faker import Faker
import moto
from s3backup import main
from s3backup.local_sync_client import LocalSyncClient, traverse
from s3backup.s3_sync_client import S3SyncClient
fake = Faker()
def setup_local_syn... | # -*- coding: utf-8 -*-
import os
import shutil
import tempfile
import boto3
from faker import Faker
import moto
from s3backup import main
from s3backup.local_sync_client import LocalSyncClient
from s3backup.s3_sync_client import S3SyncClient
fake = Faker()
def setup_local_sync_client(target_folder, file_names... | mit | Python |
99a445163450b8ae43c8241cb8dde41a95092292 | test only on python 3 | tiagoantao/pygenomics | tests/test_plot.py | tests/test_plot.py | # -*- coding: utf-8 -*-
import six
def test_basic_chart():
if six.PY2:
return
from os import path
import tempfile
import matplotlib.pyplot as plt
plt.switch_backend('Agg')
from genomics.plot import GridGenomePlot
from genomics.organism import genome_db
ggp = GridGenomePlot(gen... | # -*- coding: utf-8 -*-
def test_basic_chart():
from os import path
import tempfile
import matplotlib.pyplot as plt
plt.switch_backend('Agg')
from genomics.plot import GridGenomePlot
from genomics.organism import genome_db
ggp = GridGenomePlot(genome_db['Ag'], 2)
with tempfile.Temporar... | agpl-3.0 | Python |
f874ab3c48926fa04558f1a862bb3de66934bce4 | rename test as test_url_to_all_params and remove paramater path as it was always the same value | lektor/lektor,lektor/lektor,lektor/lektor,lektor/lektor | tests/test_urls.py | tests/test_urls.py | import pytest
def test_cleanup_path():
from lektor.utils import cleanup_path
assert cleanup_path('/') == '/'
assert cleanup_path('/foo') == '/foo'
assert cleanup_path('/foo/') == '/foo'
assert cleanup_path('/////foo/') == '/foo'
assert cleanup_path('/////foo////') == '/foo'
assert cleanup_... | import pytest
def test_cleanup_path():
from lektor.utils import cleanup_path
assert cleanup_path('/') == '/'
assert cleanup_path('/foo') == '/foo'
assert cleanup_path('/foo/') == '/foo'
assert cleanup_path('/////foo/') == '/foo'
assert cleanup_path('/////foo////') == '/foo'
assert cleanup_... | bsd-3-clause | Python |
2fec479006e7349f692f3a978f359b3619d7713e | Create drop target widget | thomasleese/tvnamer,tomleese/tvnamer | tvnamer/gui/__init__.py | tvnamer/gui/__init__.py | import sys
from PySide import QtCore, QtGui
class DirectoryDropWidget(QtGui.QLabel):
def __init__(self):
super().__init__()
self.setAcceptDrops(True)
self.setStyleSheet("background-color:black;")
self.setText("Hello.")
def dragEnterEvent(self, e):
if e.mimeData().hasU... | from PySide import QtCore, QtGui
class MainWindow(QtGui.QWidget):
pass
def main():
app = QtGui.QApplication(sys.argv)
window = MainWindow()
sys.exit(app.exec_())
| mit | Python |
68e62b56c836665e0446e2335000ae9a029302f7 | Sort DefinitionContainersModel by category and name | onitake/Uranium,onitake/Uranium | UM/Settings/Models/DefinitionContainersModel.py | UM/Settings/Models/DefinitionContainersModel.py | from UM.Qt.ListModel import ListModel
from PyQt5.QtCore import pyqtProperty, Qt, pyqtSignal
from UM.Settings.ContainerRegistry import ContainerRegistry
from UM.Settings.DefinitionContainer import DefinitionContainer
## Model that holds definition containers. By setting the filter property the definitions held by t... | from UM.Qt.ListModel import ListModel
from PyQt5.QtCore import pyqtProperty, Qt, pyqtSignal
from UM.Settings.ContainerRegistry import ContainerRegistry
from UM.Settings.DefinitionContainer import DefinitionContainer
## Model that holds definition containers. By setting the filter property the definitions held by t... | agpl-3.0 | Python |
216b935f30baad28d6ff3fcc85c5d8e4acf2c84e | Bump version to 0.2.0 | sjperkins/tfopgen | tfopgen/version.py | tfopgen/version.py | # Do not edit this file, pipeline versioning is governed by git tags
__version__="0.2.0" | # Do not edit this file, pipeline versioning is governed by git tags
__version__="0.1.0" | mit | Python |
42a4a8b4480bc481e0467ae7ee46c60400d63f77 | Create tmp directory if it doesn't exist | kmklr72/LMMS-Theme-Installer | theme-installer.py | theme-installer.py | #!/usr/bin/env python
import sys
from inc.functions import *
from PySide.QtGui import QApplication, QPixmap, QSplashScreen
from ui.mainwindow import MainWindow
# Create tmp directory if it doesn't exist
if not os.path.exists(os.path.join(os.getcwd(), 'tmp')):
os.mkdir(os.path.join(os.getcwd(), 'tmp'))
# The app
if ... | #!/usr/bin/env python
import sys
from inc.functions import *
from PySide.QtGui import QApplication, QPixmap, QSplashScreen
from ui.mainwindow import MainWindow
# The app
if __name__ == '__main__':
# Create app
app = QApplication(sys.argv)
app.setApplicationName('LMMS Theme Installer')
# Show window
window = Mai... | lgpl-2.1 | Python |
f6b6d988d03927484f7e02da90e970eb17f93ae5 | Update models | hs-hannover/salt-observer,hs-hannover/salt-observer,hs-hannover/salt-observer | salt_observer/models.py | salt_observer/models.py | from django.db import models
import json
class Network(models.Model):
''' Representation of an Network '''
net = models.CharField(max_length=15)
subnet_mask = models.CharField(max_length=15)
class Minion(models.Model):
''' Representation of a Server in Salt '''
fqdn = models.CharField(max_len... | from django.db import models
class Network(models.Model):
''' Representation of an Network '''
net = models.CharField(max_length=15)
subnet_mask = models.CharField(max_length=15)
class Minion(models.Model):
''' Representation of a Server in Salt '''
name = models.CharField(max_length=255)
| mit | Python |
4b40c8207c8fc4003f5381299e7485a8e7ac04f9 | Update for release | lucius-feng/tg2,lucius-feng/tg2 | tg/release.py | tg/release.py | """TurboGears project related information"""
version = "2.3.2"
description = "Next generation TurboGears"
long_description="""
TurboGears brings together a best of breed python tools
to create a flexible, full featured, and easy to use web
framework.
TurboGears 2 provides an integrated and well tested set of tools for... | """TurboGears project related information"""
version = "2.3.2"
description = "Next generation TurboGears"
long_description="""
TurboGears brings together a best of breed python tools
to create a flexible, full featured, and easy to use web
framework.
TurboGears 2 provides an integrated and well tested set of tools for... | mit | Python |
a8af5dd775731b05ebc92e0bdd7509736c9daa74 | Make progress.py test a bit nicer. | grandquista/rethinkdb,captainpete/rethinkdb,AntouanK/rethinkdb,sbusso/rethinkdb,AntouanK/rethinkdb,wojons/rethinkdb,greyhwndz/rethinkdb,gdi2290/rethinkdb,robertjpayne/rethinkdb,sebadiaz/rethinkdb,dparnell/rethinkdb,dparnell/rethinkdb,niieani/rethinkdb,spblightadv/rethinkdb,ayumilong/rethinkdb,Wilbeibi/rethinkdb,gavioto... | test/interface/progress.py | test/interface/progress.py | #!/usr/bin/env python
import sys, os, time
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, http_admin, scenario_common
from memcached_workload_common import MemcacheConnection
from vcoptparse import *
op = OptParser()
scenario_common.prepare_option_par... | #!/usr/bin/env python
import sys, os, time
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, http_admin, scenario_common
from memcached_workload_common import MemcacheConnection
from vcoptparse import *
op = OptParser()
scenario_common.prepare_option_par... | apache-2.0 | Python |
ab8756c6a1664a44fd7a41ebe0af5bc0445738c8 | remove unused import | darren-wang/ks3,darren-wang/ks3 | keystone/common/sql/migrate_repo/versions/017_add_enabled_to_policy.py | keystone/common/sql/migrate_repo/versions/017_add_enabled_to_policy.py | import sqlalchemy as sql
_POLICY_TABLE_NAME = 'policy'
def upgrade(migrate_engine):
meta = sql.MetaData()
meta.bind = migrate_engine
policy_table = sql.Table(_POLICY_TABLE_NAME, meta, autoload=True)
# adding new columns
policy_enabled = sql.Column('enabled', sql.Boolean, nullable=False, default=... | import sqlalchemy as sql
import migrate
_POLICY_TABLE_NAME = 'policy'
def upgrade(migrate_engine):
meta = sql.MetaData()
meta.bind = migrate_engine
policy_table = sql.Table(_POLICY_TABLE_NAME, meta, autoload=True)
# adding new columns
policy_enabled = sql.Column('enabled', sql.Boolean, nullable=... | apache-2.0 | Python |
2e2104a33aacb6d23c4eab6ae47231992fcf0497 | raise exception | uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw | myuw/views/api/finance.py | myuw/views/api/finance.py | import logging
import traceback
from myuw.dao.finance import get_account_balances_for_current_user
from myuw.dao.notice import get_tuition_due_date
from myuw.dao.pws import is_student
from myuw.logger.timer import Timer
from myuw.logger.logresp import (
log_data_not_found_response, log_msg, log_success_response)
fr... | import logging
import traceback
from myuw.dao.finance import get_account_balances_for_current_user
from myuw.dao.notice import get_tuition_due_date
from myuw.dao.pws import is_student
from myuw.logger.timer import Timer
from myuw.logger.logresp import (
log_data_not_found_response, log_msg, log_success_response)
fr... | apache-2.0 | Python |
5174fe64a076de6ef5afc73278d457157eca8d69 | Update transpositionTest: fixed imports and PEP8 formatting | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/CrackingCodesWithPython/Chapter09/transpositionTest.py | books/CrackingCodesWithPython/Chapter09/transpositionTest.py | # Transposition Cipher Test
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
import random, sys
from books.CrackingCodesWithPython.Chapter07.transpositionEncrypt import encryptMessage
from books.CrackingCodesWithPython.Chapter08.transpositionDecrypt import decryptMessage
def main():
random.seed(42) # Se... | # Transposition Cipher Test
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
import random, sys, transpositionEncrypt, transpositionDecrypt
def main():
random.seed(42) # Set the random "seed" to a static value.
for i in range(20): # Run 20 tests.
# Generate random messages to test.
... | mit | Python |
e9ec3a7ea22540c10b6db3e78fe2c5299e127119 | update importer management command to prep for multiple importers | texastribune/the-dp,texastribune/the-dp,texastribune/the-dp,texastribune/the-dp | tx_highered/management/commands/tx_highered_import.py | tx_highered/management/commands/tx_highered_import.py | import os
from django.core.management.base import BaseCommand
from tx_highered.scripts.import_customreport import generic
class Command(BaseCommand):
args = '(ipeds|thecb) <file file ...>'
help = "Import Data"
def handle(self, importer_type, *args, **options):
# TODO handle THECB data
... | import os
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Import Data"
def handle(self, *args, **options):
# TODO handle THECB data
from tx_highered.scripts.import_customreport import generic
for path in args:
if os.path.isfile(pat... | apache-2.0 | Python |
d97b3b49cb916182550ada3e8e3384a29236a41a | Fix mongo queue test | giserh/grab,lorien/grab,pombredanne/grab-1,alihalabyah/grab,raybuhr/grab,maurobaraldi/grab,codevlabs/grab,kevinlondon/grab,giserh/grab,kevinlondon/grab,subeax/grab,DDShadoww/grab,codevlabs/grab,shaunstanislaus/grab,raybuhr/grab,subeax/grab,lorien/grab,liorvh/grab,SpaceAppsXploration/grab,istinspring/grab,huiyi1990/grab... | test/spider_mongo_queue.py | test/spider_mongo_queue.py | # coding: utf-8
from random import shuffle
from unittest import TestCase, main
from grab.spider import Spider, Task
from util import FakeServerThread, RESPONSE, SLEEP, BASE_URL
class TestSpider(TestCase):
TASKS_COUNT = 10
def setUp(self):
FakeServerThread().start()
def test_spider(self):
... | # coding: utf-8
from random import shuffle
from unittest import TestCase, main
from grab.spider import Spider, Task
from util import FakeServerThread, RESPONSE, SLEEP, BASE_URL
class TestSpider(TestCase):
TASKS_COUNT = 10
def setUp(self):
FakeServerThread().start()
def test_spider(self):
... | mit | Python |
dd40b392b73ddc1bcf88d932418b4f891bcc6a89 | Allow star imports from twine | pypa/twine | twine/__init__.py | twine/__init__.py | # Copyright 2013 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | # Copyright 2013 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | apache-2.0 | Python |
4988d4138994a392c2c558794d62af3b7c5ec2d8 | Add GPIO aliases to ZCU104 base overlay to match the Pynq-Z1/2 | Xilinx/PYNQ,yunqu/PYNQ,schelleg/PYNQ,Xilinx/PYNQ,yunqu/PYNQ,cathalmccabe/PYNQ,Xilinx/PYNQ,cathalmccabe/PYNQ,cathalmccabe/PYNQ,Xilinx/PYNQ,schelleg/PYNQ,cathalmccabe/PYNQ,schelleg/PYNQ,cathalmccabe/PYNQ,yunqu/PYNQ,cathalmccabe/PYNQ,Xilinx/PYNQ,schelleg/PYNQ,yunqu/PYNQ,yunqu/PYNQ,schelleg/PYNQ | boards/ZCU104/base/base.py | boards/ZCU104/base/base.py | import pynq
import pynq.lib
import time
from pynq.lib.video.clocks import *
from pynq import MMIO
class BaseOverlay(pynq.Overlay):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.is_loaded():
self.iop_pmod0.mbtype = "Pmod"
self.iop_pmod1.mbtype... | import pynq
import pynq.lib
import time
from pynq.lib.video.clocks import *
from pynq import MMIO
class BaseOverlay(pynq.Overlay):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.is_loaded():
self.iop_pmod0.mbtype = "Pmod"
self.iop_pmod1.mbtype... | bsd-3-clause | Python |
cddd4487c388cf5f010a39e36df1286568882135 | FIX CS-782 | CompassionCH/compassion-switzerland,CompassionCH/compassion-switzerland,CompassionCH/compassion-switzerland | wordpress_connector/models/request.py | wordpress_connector/models/request.py | ##############################################################################
#
# Copyright (C) 2019 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Christopher Meier <dev@c-meier.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | ##############################################################################
#
# Copyright (C) 2019 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Christopher Meier <dev@c-meier.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | agpl-3.0 | Python |
10e4f30cbc4327b6ee51a600bba4304261c27ca0 | Update release script | adferrand/docker-letsencrypt-dns | utils/create_release.py | utils/create_release.py | import subprocess
from distutils.version import StrictVersion
def main():
git_clean = subprocess.check_output(
"git status --porcelain", universal_newlines=True
).strip()
if git_clean:
raise RuntimeError("Error, git workspace is not clean: \n{0}".format(git_clean))
current_version = s... | import subprocess
import sys
from distutils.version import StrictVersion
def main():
git_clean = subprocess.check_output("git status --porcelain", universal_newlines=True).strip()
# if git_clean:
# raise RuntimeError("Error, git workspace is not clean: \n{0}".format(git_clean))
current_version = ... | mit | Python |
49f8a47dfc06484a4d9d767a10c07c47fe5e76d3 | Fix synthax error | bird-house/flyingpigeon | flyingpigeon/processes/__init__.py | flyingpigeon/processes/__init__.py | from .wps_subset_countries import ClippingProcess
from .wps_subset_continents import ClipcontinentProcess
from .wps_subset_regionseurope import ClipregionseuropeProcess
from .wps_pointinspection import PointinspectionProcess
from .wps_landseamask import LandseamaskProcess
from .wps_climatefactsheet import FactsheetProc... | from .wps_subset_countries import ClippingProcess
from .wps_subset_continents import ClipcontinentProcess
from .wps_subset_regionseurope import ClipregionseuropeProcess
from .wps_pointinspection import PointinspectionProcess
from .wps_landseamask import LandseamaskProcess
from .wps_climatefactsheet import FactsheetProc... | apache-2.0 | Python |
c29354ac1ef5805659ad20a30b9f78122f54012e | Include the active SDK version in --version output. | pebble/pebble-tool,pebble/pebble-tool,pebble/pebble-tool,gregoiresage/pebble-tool,gregoiresage/pebble-tool,pebble/pebble-tool,gregoiresage/pebble-tool,gregoiresage/pebble-tool | pebble_tool/__init__.py | pebble_tool/__init__.py | from __future__ import absolute_import, print_function
__author__ = 'katharine'
import atexit
import argparse
import logging
import sys
import requests.packages.urllib3 as urllib3
from .commands.base import register_children
from .commands.sdk import build, create
from .commands import (install, logs, screenshot, tim... | from __future__ import absolute_import, print_function
__author__ = 'katharine'
import atexit
import argparse
import logging
import sys
import requests.packages.urllib3 as urllib3
from .commands.base import register_children
from .commands.sdk import build, create
from .commands import (install, logs, screenshot, tim... | mit | Python |
3548e134f760b85b2b76d5cf3c8c3462f3885852 | update URLs (#5355) | iulian787/spack,tmerrick1/spack,skosukhin/spack,lgarren/spack,tmerrick1/spack,tmerrick1/spack,mfherbst/spack,mfherbst/spack,krafczyk/spack,tmerrick1/spack,krafczyk/spack,matthiasdiener/spack,iulian787/spack,EmreAtes/spack,skosukhin/spack,TheTimmy/spack,LLNL/spack,LLNL/spack,krafczyk/spack,LLNL/spack,matthiasdiener/spac... | var/spack/repos/builtin/packages/libsodium/package.py | var/spack/repos/builtin/packages/libsodium/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
fe728a9741be7eb1cfa440bf5d9c9b008255f3d7 | Add py-future (#19195) | iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-future/package.py | var/spack/repos/builtin/packages/py-future/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyFuture(PythonPackage):
"""Clean single-source support for Python 3 and 2"""
homepag... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyFuture(PythonPackage):
"""Clean single-source support for Python 3 and 2"""
homepag... | lgpl-2.1 | Python |
0c84f6dd314ea62019356b09363f98118a4da776 | Use built-in IP address functionality to unmap IPv4 addresses | Heufneutje/txircd | txircd/factory.py | txircd/factory.py | from twisted.internet.protocol import ClientFactory, Factory
from txircd.server import IRCServer
from txircd.user import IRCUser
from ipaddress import ip_address
from typing import Union
def unmapIPv4(ip: str) -> Union["IPv4Address", "IPv6Address"]:
"""
Converts an IPv6-mapped IPv4 address to a bare IPv4 address.
"... | from twisted.internet.protocol import ClientFactory, Factory
from txircd.server import IRCServer
from txircd.user import IRCUser
from ipaddress import ip_address
import re
ipv4MappedAddr = re.compile("::ffff:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})")
def unmapIPv4(ip: str) -> str:
"""
Converts an IPv6-mapped IPv4 addres... | bsd-3-clause | Python |
d496568ff9615dbb69bb9d4edf971231232ff438 | add version 1.5 (#26731) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-gevent/package.py | var/spack/repos/builtin/packages/py-gevent/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyGevent(PythonPackage):
"""gevent is a coroutine-based Python networking library."""
... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyGevent(PythonPackage):
"""gevent is a coroutine-based Python networking library."""
... | lgpl-2.1 | Python |
58472d21c46cfe4a24e31a5553019731479e1e0b | Update ssh_dispatcher.py | nitzmahone/netmiko,ivandgreat/netmiko,shamanu4/netmiko,jumpojoy/netmiko,isidroamv/netmiko,isponline/netmiko,jinesh-patel/netmiko,nvoron23/netmiko,shsingh/netmiko,fooelisa/netmiko,rdezavalia/netmiko,shsingh/netmiko,mileswdavis/netmiko,isidroamv/netmiko,rdezavalia/netmiko,fooelisa/netmiko,mileswdavis/netmiko,mzbenami/net... | netmiko/ssh_dispatcher.py | netmiko/ssh_dispatcher.py | from cisco import CiscoIosSSH
from cisco import CiscoAsaSSH
from cisco import CiscoNxosSSH
from cisco import CiscoXrSSH
from arista import AristaSSH
from hp import HPProcurveSSH
CLASS_MAPPER = {
'cisco_ios' : CiscoIosSSH,
'cisco_xe' : CiscoIosSSH,
'cisco_asa' : CiscoAsaSSH,
'cisco_nxos' ... | from cisco import CiscoIosSSH
from cisco import CiscoAsaSSH
from cisco import CiscoNxosSSH
from cisco import CiscoXrSSH
from arista import AristaSSH
from hp import HPProcurveSSH
CLASS_MAPPER = {
'cisco_ios' : CiscoIosSSH,
'cisco_xe' : CiscoIosSSH,
'cisco_asa' : CiscoAsaSSH,
'cisco_nxos' ... | mit | Python |
46214b0caa1772b405d76c370882eb259579dca5 | Set r-chipseq to bioconductor format (#24315) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-chipseq/package.py | var/spack/repos/builtin/packages/r-chipseq/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RChipseq(RPackage):
"""A package for analyzing chipseq data
Tools for helping process... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RChipseq(RPackage):
"""A package for analyzing chipseq data"""
homepage = "https://bi... | lgpl-2.1 | Python |
cf83a6abc6709fadfe8dfa44408462e79bd8c1ff | Enable apache logging for uweb_info. | edelooff/newWeb,edelooff/newWeb | uweb_info/www/router.py | uweb_info/www/router.py | #!/usr/bin/python
"""An uweb info page and testcase."""
# Custom modules
from underdark.libs import uweb
from underdark.libs.uweb.uweb_info import pages
__author__ = 'Elmer de Looff <elmer@underdark.nl>'
__version__ = '0.2'
CONFIG = 'example.conf'
PACKAGE = 'uweb_info'
# PAGE_CLASS is the constant that defines the ... | #!/usr/bin/python
"""An uweb info page and testcase."""
# Custom modules
from underdark.libs import uweb
from underdark.libs.uweb.uweb_info import pages
__author__ = 'Elmer de Looff <elmer@underdark.nl>'
__version__ = '0.2'
CONFIG = 'example.conf'
PACKAGE = 'uweb_info'
# PAGE_CLASS is the constant that defines the ... | isc | Python |
bee5ed1d9815a4c4291179d0de3ec54fe467b219 | Save sessions in JSON format instead of pickle. | shaurz/devo | project.py | project.py | import os
import json
import fileutil
class Project(object):
def __init__(self, name, rootdir, filename, session=None):
self.name = name
self.rootdir = rootdir
self.filename = filename
self.session = session
def read_project(filename, rootdir):
with open(filename, "rb") as f:
... | import os, cPickle as pickle
import fileutil
class Project(object):
def __init__(self, name, rootdir, filename, session=None):
self.name = name
self.rootdir = rootdir
self.filename = filename
self.session = session
def read_project(filename, rootdir):
with open(filename, "rb") ... | mit | Python |
5b5ca9a25df66cef52d3e302a9bb135884f3981a | Update qt_translations.py | bowscoin/bowscoin,bowscoin/bowscoin,bowscoin/bowscoin,bowscoin/bowscoin,bowscoin/bowscoin | contrib/qt_translations.py | contrib/qt_translations.py | #!/usr/bin/env python
# Helpful little script that spits out a comma-separated list of
# language codes for Qt icons that should be included
# in binary bitcoin distributions
import glob
import os
import re
import sys
if len(sys.argv) != 3:
sys.exit("Usage: %s $QTDIR/translations $BOWSCOINDIR/src/qt/locale"%sys.ar... | #!/usr/bin/env python
# Helpful little script that spits out a comma-separated list of
# language codes for Qt icons that should be included
# in binary bitcoin distributions
import glob
import os
import re
import sys
if len(sys.argv) != 3:
sys.exit("Usage: %s $QTDIR/translations $BITCOINDIR/src/qt/locale"%sys.arg... | mit | Python |
225a5987f4cdf494770321f4f37641902b0422d9 | add help command to help message | Zumium/boxes | boxes/handlers/help_msg.py | boxes/handlers/help_msg.py | #Copyright (C) 2016 Zumium martin007323@gmail.com
#
#
#Licensed to the Apache Software Foundation (ASF) under one
#or more contributor license agreements. See the NOTICE file
#distributed with this work for additional information
#regarding copyright ownership. The ASF licenses this file
#to you under the Apache Lice... | #Copyright (C) 2016 Zumium martin007323@gmail.com
#
#
#Licensed to the Apache Software Foundation (ASF) under one
#or more contributor license agreements. See the NOTICE file
#distributed with this work for additional information
#regarding copyright ownership. The ASF licenses this file
#to you under the Apache Lice... | apache-2.0 | Python |
14c7d797c3b327aa4e55efe832c536d14bee16fc | Update pelican config for the tag cloud | fretboardfreak/escadrille,fretboardfreak/escadrille,fretboardfreak/escadrille | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import time
AUTHOR = u'Curtis Sand'
ABOUT_AUTHOR_URL = "pages/about-me.html"
SITENAME = u'Quizzical Silicon'
SITESUBTITLE=u'A charge carrier is not a wallet.'
SITEURL = 'http://curtissand.com/cs'
SITETHUMBNAIL_URL = SITEURL + '/ima... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import time
AUTHOR = u'Curtis Sand'
ABOUT_AUTHOR_URL = "pages/about-me.html"
SITENAME = u'Quizzical Silicon'
SITESUBTITLE=u'A charge carrier is not a wallet.'
SITEURL = 'http://curtissand.com/cs'
SITETHUMBNAIL_URL = SITEURL + '/ima... | apache-2.0 | Python |
9344f45bdd9677ffe120bd3b9d96620fe8a9255e | fix pelican_dynamic name | fly/burrito.sh,bsdlp/burrito.sh,fly/burrito.sh,bsdlp/burrito.sh | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'jchen'
AUTHOR_FULLNAME = u'Jon Chen'
SITENAME = u'burrito'
SITEURL = 'http://burrito.sh'
SITETAGLINE = 'Excelling at mediocrity.'
TIMEZONE = 'Etc/UTC'
DEFAULT_LANG = u'en'
# theme stuff
THEME = './theme'
# plugins
PL... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'jchen'
AUTHOR_FULLNAME = u'Jon Chen'
SITENAME = u'burrito'
SITEURL = 'http://burrito.sh'
SITETAGLINE = 'Excelling at mediocrity.'
TIMEZONE = 'Etc/UTC'
DEFAULT_LANG = u'en'
# theme stuff
THEME = './theme'
# plugins
PL... | bsd-3-clause | Python |
b8dfd90bfa5b20dbfbc056ea5b461879bccfe6f8 | Improve smbio.util.pandas documentation. | brenns10/smbio | smbio/util/pandas.py | smbio/util/pandas.py | """Utility functions for pandas."""
def dataframe_append(dataframe, rowdict):
"""
Shortcut method for appending a row to a DataFrame.
:param pandas.DataFrame dataframe: The DataFrame to append to.
:param dict rowdict: A dictionary containing each column's value.
"""
newrow = len(dataframe)
... | """Utility functions for pandas."""
def dataframe_append(dataframe, rowdict):
"""
Shortcut method for appending a row to a DataFrame.
:param dataframe: The DataFrame to append to.
:param rowdict: A dictionary containing each column's value.
"""
newrow = len(dataframe)
dataframe.loc[newrow]... | mit | Python |
5f070174ea67966767b0ef9cf9ad6dcff24f245e | update copyright info | jdstemmler/jdstemmler.github.io,jdstemmler/jdstemmler.github.io | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import os
import datetime
AUTHOR = u'Jayson Stemmler'
SITENAME = u'Jayson Stemmler'
SITEURL = ''
COPYRIGHT_NAME = "Jayson Stemmler"
COPYRIGHT_YEAR = datetime.datetime.today().strftime('%Y')
# THEME_DIR = os.path.join(os.getenv("H... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import os
AUTHOR = u'Jayson Stemmler'
SITENAME = u'Jayson Stemmler'
SITEURL = ''
THEME_DIR = os.path.join(os.getenv("HOME"), 'Documents/Blogging/pelican-themes')
THEME = os.path.join(THEME_DIR, 'Flex')
USE_FOLDER_AS_CATEGORY = Tr... | mit | Python |
81e35a4cd97f34420b9b9bf0b59f245783df457d | Solve sum of multiples | rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism | python/sum-of-multiples/sum_of_multiples.py | python/sum-of-multiples/sum_of_multiples.py | def sum_of_multiples(limit, factors):
return sum(all_multiples(limit, factors))
def all_multiples(limit, factors):
multiples = set()
for factor in factors:
multiples = multiples.union(get_multiples(limit, factor))
return multiples
def get_multiples(limit, factor):
if factor == 0:
... | def sum_of_multiples():
pass
| mit | Python |
454b1718bf7daa6e224f911c9f807c3f4ed78981 | Set use_egg_info to True in freeze | osupython/pip2 | pip2/commands/freeze.py | pip2/commands/freeze.py | """
Returns a dictionary containing all installed packages.
return: A dictionary, key is package name value is a dictionary with
information about package.
"""
from pip2.compat import packaging
def freeze():
results = list(packaging.database.get_distributions(use_egg_info=True))
installed = dict()
... | """
Returns a dictionary containing all installed packages.
return: A dictionary, key is package name value is a dictionary with
information about package.
"""
from pip2.compat import packaging
def freeze():
results = list(packaging.database.get_distributions())
installed = dict()
for dist in re... | mit | Python |
764b0125967fac2146e5b8cfb1e5d147bec862a8 | Add social links | glasslion/zha-beta,glasslion/zha-beta,glasslion/zha,glasslion/zha,glasslion/zha-beta,glasslion/zha | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'Leonardo Zhou'
SITENAME = u'\u4e91\u7ffc\u56fe\u5357'
SITEURL = ''
TIMEZONE = 'Asia/Shanghai'
DEFAULT_LANG = u'zh'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = Non... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'Leonardo Zhou'
SITENAME = u'\u4e91\u7ffc\u56fe\u5357'
SITEURL = ''
TIMEZONE = 'Asia/Shanghai'
DEFAULT_LANG = u'zh'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = Non... | cc0-1.0 | Python |
507f90417338ffd3221723544bb68c680fbca1b8 | Add is in tree and fix is_in_tree | jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm | python_practice/graph/binary_search_tree.py | python_practice/graph/binary_search_tree.py |
class binary_search_tree(object):
def __init__(self, value):
self.value = value
self.right_node = None
self.left_node = None
def __str__(self):
print self.left_node
print self.value
print self.right_node
def insert_node(self, insert_value):
if insert_value == self.value:
retur... |
class binary_search_tree(object):
def __init__(self, value):
self.value = value
self.right_node = None
self.left_node = None
def __str__(self):
print self.left_node
print self.value
print self.right_node
def insert_node(self, insert_value):
if insert_value == self.value:
retur... | mit | Python |
6cda967d56a3cdf672576260af4d1e0218771855 | replace DummyDocument by DummyDocument{Odt, Weasyprint} | Anaethelion/django-mapentity,Anaethelion/django-mapentity,makinacorpus/django-mapentity,makinacorpus/django-mapentity,Anaethelion/django-mapentity,makinacorpus/django-mapentity | mapentity/tests/views.py | mapentity/tests/views.py | from mapentity import views as mapentity_views
from .models import DummyModel
class DummyList(mapentity_views.MapEntityList):
model = DummyModel
class DummyLayer(mapentity_views.MapEntityLayer):
model = DummyModel
class DummyJsonList(mapentity_views.MapEntityJsonList, DummyList):
pass
class DummyFo... | from mapentity import views as mapentity_views
from .models import DummyModel
class DummyList(mapentity_views.MapEntityList):
model = DummyModel
class DummyLayer(mapentity_views.MapEntityLayer):
model = DummyModel
class DummyJsonList(mapentity_views.MapEntityJsonList, DummyList):
pass
class DummyFo... | bsd-3-clause | Python |
cbc9c3d075f8128e25aa4707998b89eeeff903a8 | Add check for mainConnection being None, which will set it | ollien/Timpani,ollien/Timpani,ollien/Timpani | py/blog.py | py/blog.py | import database
import configmanager
def getMainConnection():
return database.ConnectionManager.getConnection("main")
mainConnection = getMainConnection()
def getPosts(connection = mainConnection):
global mainConnection
if connection == mainConnection and mainConnection == None:
mainConnection = getMainConnect... | import database
import configmanager
mainConnection = database.ConnectionManager.getConnection("main")
def getPosts(connection = mainConnection):
posts = {} #Will be a dict formatted as such {postId: {post: $POST_OBJECT_FROM_DATABASE, tags: [$TAGS_FROM_DATABASE]}}
postsAndTags = connection.session.query(database.ta... | mit | Python |
3aeaea75bd5b1db66e6dea9e5c1f41f3f9c6ed9e | Enable rudimentary logging to stderr in the Python start script. | NCI-Cloud/reporting-api,NCI-Cloud/reporting-api,NeCTAR-RC/reporting-api,NeCTAR-RC/reporting-api | bin/start.py | bin/start.py | #!/usr/bin/python
import sys, os
from paste.deploy import loadapp, loadserver
from paste import httpserver
import logging
if __name__ == '__main__':
logging.basicConfig()
realfile = os.path.realpath(__file__)
realdir = os.path.dirname(realfile)
pardir = os.path.realpath(os.path.join(realdir, os.pardir))
confdir ... | #!/usr/bin/python
import sys, os
from paste.deploy import loadapp, loadserver
from paste import httpserver
if __name__ == '__main__':
realfile = os.path.realpath(__file__)
realdir = os.path.dirname(realfile)
pardir = os.path.realpath(os.path.join(realdir, os.pardir))
confdir = os.path.join(pardir, 'conf')
paste_... | apache-2.0 | Python |
a587d48694690957934a159bad98cacd3f012a6a | Change contextlib import to handle the new location in Python 3. | danielsamuels/cms,jamesfoley/cms,jamesfoley/cms,jamesfoley/cms,dan-gamble/cms,danielsamuels/cms,dan-gamble/cms,lewiscollard/cms,jamesfoley/cms,dan-gamble/cms,lewiscollard/cms,danielsamuels/cms,lewiscollard/cms | cms/tests/test_externals.py | cms/tests/test_externals.py | from django.test import TestCase
from ..externals import External
try:
from contextlib import GeneratorContextManager
except ImportError:
from contextlib import _GeneratorContextManager as GeneratorContextManager
from types import FunctionType
class TestExternals(TestCase):
def test_load(self):
... | from django.test import TestCase
from ..externals import External
from contextlib import GeneratorContextManager
from types import FunctionType
class TestExternals(TestCase):
def test_load(self):
external = External('foo')
with self.assertRaises(ImportError):
external._load('')
... | bsd-3-clause | Python |
9d57f85837d577e733cf1a45e560fc763a62be1f | Implement a custom exception type for undefined variable errors | dajose/cookiecutter,dajose/cookiecutter,Springerle/cookiecutter,pjbull/cookiecutter,audreyr/cookiecutter,audreyr/cookiecutter,stevepiercy/cookiecutter,stevepiercy/cookiecutter,terryjbates/cookiecutter,michaeljoseph/cookiecutter,luzfcb/cookiecutter,hackebrot/cookiecutter,pjbull/cookiecutter,hackebrot/cookiecutter,Spring... | cookiecutter/exceptions.py | cookiecutter/exceptions.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.exceptions
-----------------------
All exceptions used in the Cookiecutter code base are defined here.
"""
class CookiecutterException(Exception):
"""
Base exception class. All Cookiecutter-specific exceptions should subclass
this class.
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.exceptions
-----------------------
All exceptions used in the Cookiecutter code base are defined here.
"""
class CookiecutterException(Exception):
"""
Base exception class. All Cookiecutter-specific exceptions should subclass
this class.
... | bsd-3-clause | Python |
278069a0637f7f329ceaff0975e3b95d609a7b9f | Improve the command line interface | cosmoscope/cosmoscope | cosmoscope/cli.py | cosmoscope/cli.py | # -*- coding: utf-8 -*-
"""Console script for cosmoscope."""
import sys
import click
from .core.server import launch
@click.command()
@click.option('--server-address', default="tcp://127.0.0.1:4242", help="Server IP address.")
@click.option('--publisher-address', default="tcp://127.0.0.1:4243", help="Publisher IP a... | # -*- coding: utf-8 -*-
"""Console script for cosmoscope."""
import sys
import click
@click.command()
def main(args=None):
"""Console script for cosmoscope."""
click.echo("Replace this message by putting your code into "
"cosmoscope.cli.main")
click.echo("See click documentation at http://... | mit | Python |
780002f5df7278776a26bb65b4b0f3dce84537a1 | Allow unit tests to run on iOS. (filesystem restriction) | cropleyb/pentai,cropleyb/pentai,cropleyb/pentai | pentai/db/test_db.py | pentai/db/test_db.py | import os
import logging
def init():
""" TODO: Call this setUp """
global initialised
try:
if initialised:
return
except:
init_logging()
import zodb_dict as z_m
# Use kivy's user_data_dir so we're guaranteed write access
os.environ['KIVY_NO_CONSOLELO... | import os
import logging
def init():
""" TODO: Call this setUp """
global initialised
try:
if initialised:
return
except:
init_logging()
import zodb_dict as z_m
z_m.set_db("test.db")
initialised = True
def init_logging():
logger = logging.getLog... | mit | Python |
c7dbbfff233f5b04cc1f99120a0f602daa8683a7 | load c functions on demand | lazka/pgi,lazka/pgi | pgi/gitypes/_util.py | pgi/gitypes/_util.py | # Copyright 2012 Christoph Reiter
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
from ctypes import CDLL
_so_mapping = {
"glib-2.0": "libglib-2.0.so.0",
"gobject-2.0": "l... | # Copyright 2012 Christoph Reiter
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
_dll_cache = {}
_so_mapping = {
"glib-2.0": "libglib-2.0.so.0",
"gobject-2.0": "libgobject-... | lgpl-2.1 | Python |
c423a1198eb94866062fa88cc6e7bf0e83543291 | bump version to 2.2.6 | ababic/wagtailmodeladmin,rkhleics/wagtailmodeladmin,rkhleics/wagtailmodeladmin,ababic/wagtailmodeladmin | wagtailmodeladmin/__init__.py | wagtailmodeladmin/__init__.py | __version__ = '2.2.6'
| __version__ = '2.2.5'
| mit | Python |
c026de1bb6275dfe92cba55c2ec05ddf05656411 | update thread local set / get for bootstrap version | qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq | corehq/apps/style/utils.py | corehq/apps/style/utils.py | import threading
_thread_local = threading.local()
BOOTSTRAP_2 = 'bootstrap-2'
BOOTSTRAP_3 = 'bootstrap-3'
def get_bootstrap_version():
try:
bootstrap_version = _thread_local.BOOTSTRAP_VERSION
except AttributeError:
bootstrap_version = BOOTSTRAP_2
return bootstrap_version
def set_boots... | from thread import _local
BOOTSTRAP_2 = 'bootstrap-2'
BOOTSTRAP_3 = 'bootstrap-3'
def get_bootstrap_version():
bootstrap_version = _local.BOOTSTRAP_VERSION
if bootstrap_version is None:
bootstrap_version = BOOTSTRAP_2
return bootstrap_version
def set_bootstrap_version3():
_local.BOOTSTRAP_V... | bsd-3-clause | Python |
14adb95b1ade833ccbf1b3dbe7359f08c7f02923 | Update digis.py | anodos-ru/catalog,anodos-ru/catalog,anodos-ru/catalog | updaters/digis.py | updaters/digis.py | from datetime import date
from datetime import datetime
from catalog.models import Updater
from catalog.models import Distributor
from catalog.models import Stock
from catalog.models import Currency
from catalog.models import Unit
from catalog.models import CategorySynonym
from catalog.models import VendorSynonym
from ... | from datetime import date
from datetime import datetime
from catalog.models import Updater
from catalog.models import Distributor
from catalog.models import Stock
from catalog.models import Currency
from catalog.models import Unit
from catalog.models import CategorySynonym
from catalog.models import VendorSynonym
from ... | mit | Python |
4efa9c87264eabb6712f4fb787ab0de42be18de6 | Move places urlpatterns to Django 2.0 preferred method | evanepio/dotmanca,evanepio/dotmanca,evanepio/dotmanca | places/urls.py | places/urls.py | from django.urls import include, path
from . import views
app_name = 'places'
urlpatterns = [
path('', views.IndexView.as_view(), name='index'),
path('<slug:slug>/', views.PlaceView.as_view(), name='place'),
]
| from django.conf.urls import url
from . import views
app_name = 'places'
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<slug>[-\w]+)/$', views.PlaceView.as_view(), name='place'),
]
| mit | Python |
4a540bb86aa9e1ef45358adc453f636f177efcfb | Remove print | bugsnag/bugsnag-python,overplumbum/bugsnag-python,overplumbum/bugsnag-python,bugsnag/bugsnag-python | bugsnag/django/__init__.py | bugsnag/django/__init__.py | from django.conf import settings
import bugsnag
def configure():
# Ignore django 404s by default
bugsnag.configuration.ignore_classes.append("django.http.Http404")
# Import Bugsnag settings from settings.py
django_bugsnag_settings = getattr(settings, 'BUGSNAG', {})
bugsnag.configure(**django_bugs... | from django.conf import settings
import bugsnag
def configure():
# Ignore django 404s by default
print "Configuring!"
bugsnag.configuration.ignore_classes.append("django.http.Http404")
# Import Bugsnag settings from settings.py
django_bugsnag_settings = getattr(settings, 'BUGSNAG', {})
bugsna... | mit | Python |
ce0a013ad70362f6bdd52165d5b6c61a1bc82ba2 | Update bubble_sort.py (#535) | TheAlgorithms/Python | sorts/bubble_sort.py | sorts/bubble_sort.py | from __future__ import print_function
def bubble_sort(collection):
"""Pure implementation of bubble sort algorithm in Python
:param collection: some mutable ordered collection with heterogeneous
comparable items inside
:return: the same collection ordered by ascending
Examples:
>>> bubble_so... | from __future__ import print_function
def bubble_sort(collection):
"""Pure implementation of bubble sort algorithm in Python
:param collection: some mutable ordered collection with heterogeneous
comparable items inside
:return: the same collection ordered by ascending
Examples:
>>> bubble_so... | mit | Python |
00aa6bd37a6a134ea44be7d2073ecac3148495a5 | support for yaml added | josuebrunel/yahoo-oauth | yahoo_oauth/utils.py | yahoo_oauth/utils.py | from __future__ import absolute_import, unicode_literals
import json
import yaml
from rauth import OAuth1Service, OAuth2Service
services = {
'oauth1': dict(
SERVICE = OAuth1Service,
REQUEST_TOKEN_URL = "https://api.login.yahoo.com/oauth/v2/get_request_token",
ACCESS_TOKEN_URL = "https://ap... | from __future__ import absolute_import, unicode_literals
import json
from rauth import OAuth1Service, OAuth2Service
services = {
'oauth1': dict(
SERVICE = OAuth1Service,
REQUEST_TOKEN_URL = "https://api.login.yahoo.com/oauth/v2/get_request_token",
ACCESS_TOKEN_URL = "https://api.login.yaho... | mit | Python |
c3426ba34635c13c6d7aad95acf4507b97b0b256 | update website | it-projects-llc/pos-addons,it-projects-llc/pos-addons,it-projects-llc/pos-addons | pos_mobile_restaurant/__manifest__.py | pos_mobile_restaurant/__manifest__.py | {
"name": """POS Mobile UI for Waiters""",
"summary": """Your Restaurant in the Mobile Version""",
"category": "Point of Sale",
"live_test_url": "http://apps.it-projects.info/shop/product/pos-mobile-ui?version=11.0",
"images": ["images/pos_mobile_restaurant.png"],
"version": "12.0.1.2.6",
"a... | {
"name": """POS Mobile UI for Waiters""",
"summary": """Your Restaurant in the Mobile Version""",
"category": "Point of Sale",
"live_test_url": "http://apps.it-projects.info/shop/product/pos-mobile-ui?version=11.0",
"images": ["images/pos_mobile_restaurant.png"],
"version": "12.0.1.2.6",
"a... | mit | Python |
baf36a6b7bfbe149eeefde774be2b01d4b2f7167 | Add cookie sharing | andychase/codebook,andychase/codebook | codebook/settingslive.py | codebook/settingslive.py | import dj_database_url
from .settings import *
DEBUG = False
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Allow all host headers
ALLOWED_HOSTS = ['*']
# Static asset configuration
BASE_DIR = os.path.dirname(os.path.abspath(__file__)... | import dj_database_url
from .settings import *
DEBUG = False
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Allow all host headers
ALLOWED_HOSTS = ['*']
# Static asset configuration
BASE_DIR = os.path.dirname(os.path.abspath(__file__)... | mit | Python |
5c2e19150e4de1d7f5e7f43061223f5b0bce1008 | clean up clm sampling a bit | xiamike/stanford-ctc,xiamike/stanford-ctc,amaas/stanford-ctc,xiamike/stanford-ctc,amaas/stanford-ctc,amaas/stanford-ctc,xiamike/stanford-ctc,amaas/stanford-ctc,xiamike/stanford-ctc,amaas/stanford-ctc,amaas/stanford-ctc,xiamike/stanford-ctc | ctc_fast/clm/sample_clm.py | ctc_fast/clm/sample_clm.py | import numpy as np
from srilm import LM
from decoder_config import LM_ARPA_FILE, SPACE, LM_ORDER
'''
Sample text from character language model
'''
def sample_continuation(s, lm, order, alpha=1.0):
# Higher alpha -> more and more like most likely sequence
n = lm.vocab.max_interned()
probs = np.empty(n, dt... | import numpy as np
from srilm import LM
from decoder_config import LM_ARPA_FILE, SPACE
'''
Sample text from character language model
'''
def sample_continuation(s, lm, order):
n = lm.vocab.max_interned()
probs = np.empty(n, dtype=np.float64)
for k in range(1, n + 1):
probs[k-1] = 10 ** lm.logprob... | apache-2.0 | Python |
75e41b1b6e07bd14e1fd042d42b2450942fecad1 | Add in simple OtherNames admin | texas/tx_people,texas/tx_people | tx_people/admin.py | tx_people/admin.py | from django.contrib import admin
from django.db.models import Count
from django.utils.translation import ugettext_lazy as _
from . import models
class ParentOrganizationFilter(admin.SimpleListFilter):
title = _('Parent Organization')
parameter_name = 'parent'
def lookups(self, request, model_admin):
... | from django.contrib import admin
from django.db.models import Count
from django.utils.translation import ugettext_lazy as _
from . import models
class ParentOrganizationFilter(admin.SimpleListFilter):
title = _('Parent Organization')
parameter_name = 'parent'
def lookups(self, request, model_admin):
... | apache-2.0 | Python |
a9dc245f99e5c29f3b11cadc77dcfa0f44274b74 | Add login_required decorator to protected sites | c0d3z3r0/ctf-backend,c0d3z3r0/ctf-backend,c0d3z3r0/ctf-backend,c0d3z3r0/ctf-backend | ctfbackend/backend/urls.py | ctfbackend/backend/urls.py | from django.conf.urls import url, include
from django.contrib.auth import views as auth_views
from . import views
from django.contrib.auth.decorators import login_required
urlpatterns = [
# Authentication
## Override logout next_page
url(r'^accounts/logout/$',
auth_views.logout,
{'next_page... | from django.conf.urls import url, include
from django.http import HttpResponseRedirect
from django.conf import settings
from django.contrib.auth import views as auth_views
from . import views
urlpatterns = [
# Authentication
## Override logout next_page
url(r'^accounts/logout/$', auth_views.logout, {'next_... | agpl-3.0 | Python |
c621495de901918c433eee7d7f4517c85df9c09b | change default | freeman-lab/pim | pim/commands/init.py | pim/commands/init.py | import os
import click
import getpass
from clint.textui import puts, colored, indent, prompt, validators
from ..utils import write, retrieve
@click.command('init', short_help='initialize a project', options_metavar='<options>')
@click.option('--force/--no-force', default=False, help='Force overwrite existing files.')
... | import os
import click
import getpass
from clint.textui import puts, colored, indent, prompt, validators
from ..utils import write, retrieve
@click.command('init', short_help='initialize a project', options_metavar='<options>')
@click.option('--force/--no-force', default=False, help='Force overwrite existing files.')
... | mit | Python |
a31459a3612e616e21d1d484f6757b29cdb6a21c | Add comments to the demo views. | vetional/django-socketio,Solution4Future/django-socketio,clarkperkins/django-socketio,freylis/django-socketio,clarkperkins/django-socketio,DESHRAJ/django-socketio,stephenmcd/django-socketio,pekermert/django-socketio,clarkperkins/django-socketio,vetional/django-socketio,vetional/django-socketio,DESHRAJ/django-socketio,s... | django_socketio/example_project/chat/views.py | django_socketio/example_project/chat/views.py |
from django.shortcuts import get_object_or_404, render, redirect
from django.utils.html import strip_tags
from django_socketio import events
from chat.models import ChatRoom, ChatUser
@events.on_message(channel="^room-")
def message(request, socket, context, message):
"""
Event handler for a room receiving ... |
from django.shortcuts import get_object_or_404, render, redirect
from django.utils.html import strip_tags
from django_socketio import events
from chat.models import ChatRoom, ChatUser
@events.on_message(channel="^room-")
def message(request, socket, context, message):
message = message[0]
room = get_object_... | bsd-2-clause | Python |
2f535837dfc026f3804b684541e257fba2a9a66b | Fix typo. | mono/bockbuild,BansheeMediaPlayer/bockbuild,bl8/bockbuild,mono/bockbuild,bl8/bockbuild,BansheeMediaPlayer/bockbuild,bl8/bockbuild,BansheeMediaPlayer/bockbuild | profiles/mono-mac-release/packages.py | profiles/mono-mac-release/packages.py | import os
from bockbuild.darwinprofile import DarwinProfile
class MonoReleasePackages:
def __init__(self):
# Toolchain
self.packages.extend([
# 'autoconf.py',
# 'automake.py',
# 'libtool.py',
'xz.py',
'tar.py',
'gettext.py',
'pkg-config.py'
])
# # Base Libraries
self.package... | import os
from bockbuild.darwinprofile import DarwinProfile
class MonoReleasePackages:
def __init__(self):
# Toolchain
self.packages.extend([
# 'autoconf.py',
# 'automake.py',
# 'libtool.py',
'xz.py',
'tar.py',
'gettext.py',
'pkg-config.py'
])
# # Base Libraries
self.package... | mit | Python |
dfbb93a132d9165e53478b579db92fa0b4cf02ce | Update compiler test infrastructure | ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang | tests/compiler/__init__.py | tests/compiler/__init__.py | import itertools
from thinglang import pipeline
from thinglang.compiler.opcodes import OpcodeCallInternal
from thinglang.lexer.values.identifier import Identifier
from thinglang.symbols.symbol_mapper import SymbolMapper
from thinglang.utils.source_context import SourceContext
SELF_ID, A_ID, B_ID, INST_ID, LST_ID, A_I... | from thinglang import pipeline
from thinglang.compiler.opcodes import OpcodeCallInternal
from thinglang.lexer.values.identifier import Identifier
from thinglang.symbols.symbol_mapper import SymbolMapper
from thinglang.utils.source_context import SourceContext
SELF_ID, A_ID, B_ID, INST_ID, LST_ID, IMPLICIT_ITERATOR_ID,... | mit | Python |
1a2de64b2f9828dcdc7d345808251e8979cea23b | Change test tasks | GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek | geotrek/common/tests/test_tasks.py | geotrek/common/tests/test_tasks.py | # -*- encoding: utf-8 -*-
from django.test import TestCase
from geotrek.common.tasks import import_datas
from geotrek.common.models import FileType
class TasksTest(TestCase):
def setUp(self):
self.filetype = FileType.objects.create(type=u"Photographie")
def test_import_exceptions(self):
self... | # -*- encoding: utf-8 -*-
from django.test import TestCase
from geotrek.common.tasks import import_datas
from geotrek.common.models import FileType
class TasksTest(TestCase):
def setUp(self):
self.filetype = FileType.objects.create(type=u"Photographie")
def test_import_exceptions(self):
self... | bsd-2-clause | Python |
5372c246587c6097ba42c846d3965a78273ca555 | update price | it-projects-llc/misc-addons,it-projects-llc/misc-addons,it-projects-llc/misc-addons | web_debranding/__openerp__.py | web_debranding/__openerp__.py | {
'name': "Backend debranding",
'version': '1.0.5',
'author': 'IT-Projects LLC, Ivan Yelizariev',
'license': 'GPL-3',
'category': 'Debranding',
'website': 'https://twitter.com/yelizariev',
'price': 150.00,
'currency': 'EUR',
'depends': ['web', 'share', 'disable_openerp_online', 'mail... | {
'name': "Backend debranding",
'version': '1.0.5',
'author': 'IT-Projects LLC, Ivan Yelizariev',
'license': 'GPL-3',
'category': 'Debranding',
'website': 'https://twitter.com/yelizariev',
'price': 90.00,
'currency': 'EUR',
'depends': ['web', 'share', 'disable_openerp_online', 'mail_... | mit | Python |
defdf2220804ca492ec889c9f4b6eff9ff56eefc | Correct import statement after renaming test_lists.py to testcases | Baaaaam/cyBaM,Baaaaam/cyBaM,jlittell/cycamore,cyclus/cycaless,gonuke/cycamore,Baaaaam/cyBaM,Baaaaam/cycamore,rwcarlsen/cycamore,rwcarlsen/cycamore,Baaaaam/cycamore,rwcarlsen/cycamore,Baaaaam/cyCLASS,gonuke/cycamore,rwcarlsen/cycamore,Baaaaam/cyCLASS,cyclus/cycaless,jlittell/cycamore,Baaaaam/cyBaM,jlittell/cycamore,gonu... | tests/create_references.py | tests/create_references.py | #! /usr/bin/env python
import os
from cyclus_tools import run_cyclus
from testcases import sim_files
def main():
"""Creates reference databases. Assumes that cyclus is included into PATH.
"""
cwd = os.getcwd()
# Run cyclus
run_cyclus("cyclus", cwd, sim_files)
if __name__ == "__main__": main()
| #! /usr/bin/env python
import os
from cyclus_tools import run_cyclus
from tests_list import sim_files
def main():
"""Creates reference databases. Assumes that cyclus is included into PATH.
"""
cwd = os.getcwd()
# Run cyclus
run_cyclus("cyclus", cwd, sim_files)
if __name__ == "__main__": main()
| bsd-3-clause | Python |
f89751b4f4b0f091561e614e0392dcd8b08ecf53 | Update pip package version | PAIR-code/lit,pair-code/lit,pair-code/lit,pair-code/lit,PAIR-code/lit,pair-code/lit,PAIR-code/lit,PAIR-code/lit,PAIR-code/lit,pair-code/lit | pip_package/setup.py | pip_package/setup.py | # Copyright 2020 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 2020 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 |
3d5e798eafb3f33151de8032d14f1732030a9244 | Add quick todo so i don't forget | napalm-automation/napalm-nxos,spotify/napalm,spotify/napalm,napalm-automation/napalm | utils/__init__.py | utils/__init__.py | # TODO move utils folder inside napalm | apache-2.0 | Python | |
9cedca2bfc045f596945de33e1a9076150022396 | Add docstrings | BeatButton/beattie,BeatButton/beattie-bot | utils/aioutils.py | utils/aioutils.py | import functools
import aiofiles
import aitertools
aopen = functools.partial(aiofiles.open, encoding='utf-8')
async def areader(aiofile):
"""An async csv reader."""
async for line in aiofile:
yield [val.strip() for val in line.split(',')]
async def make_batches(iterable, size):
"""Make batches... | import functools
import aiofiles
import aitertools
aopen = functools.partial(aiofiles.open, encoding='utf-8')
async def areader(aiofile):
async for line in aiofile:
yield [val.strip() for val in line.split(',')]
async def make_batches(iterable, size):
iterator = await aitertools.aiter(iterable)
... | mit | Python |
c194696644c2caa40048e5508cf8624a65e7c9b8 | add 1 second to sleep in core take method for opera | 2gis/dali | common/core/dali_core.py | common/core/dali_core.py | import json
import sys
import time
from selenium.webdriver import Remote
from selenium.webdriver.remote.errorhandler import ErrorHandler
from selenium.webdriver.remote.remote_connection import RemoteConnection
from compare.pixel_diff import diff
from supplement.scripts import Scripts
class DaliRemote(Remote):
d... | import json
import sys
import time
from selenium.webdriver import Remote
from selenium.webdriver.remote.errorhandler import ErrorHandler
from selenium.webdriver.remote.remote_connection import RemoteConnection
from compare.pixel_diff import diff
from supplement.scripts import Scripts
class DaliRemote(Remote):
d... | mit | Python |
c2e0b640a5cb26626e914a0621e94f672304161e | remove irrelevant docs from pallet | agrc/raster,agrc/raster,agrc/raster | scripts/RasterPallet.py | scripts/RasterPallet.py | #!/usr/bin/env python
# * coding: utf8 *
'''
RasterPallet.py
A module that contains a forklift pallet definition for the Raster app.
'''
from json import loads
from os.path import dirname, join, realpath, basename
import arcpy
from forklift.models import Pallet
import raster_secrets as secrets
current_folder = di... | #!/usr/bin/env python
# * coding: utf8 *
'''
RasterPallet.py
A module that contains a forklift pallet definition for the Raster app.
It updates all data in the raster.gdb database.
The DRG.gdb database is managed manually in staging.
'''
from json import loads
from os.path import dirname, join, realpath, basename
im... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.