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 |
|---|---|---|---|---|---|---|---|---|
0be1534dda491d7d0410c72c95605d82f92621a6 | bump version to 0.4.0 to fix 0.3.9 release bugs | wecatch/app-turbo,tao12345666333/app-turbo,tao12345666333/app-turbo,tao12345666333/app-turbo | turbo/__init__.py | turbo/__init__.py | #!/usr/bin/env python
#
# Copyright 2014 Wecatch
#
# 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 ag... | #!/usr/bin/env python
#
# Copyright 2014 Wecatch
#
# 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 ag... | apache-2.0 | Python |
bab96393134be0baa1fae4a8f9cd8506f9f8d20b | Remove empty line | desbma/sacad,desbma/sacad | sacad/sources/amazonbase.py | sacad/sources/amazonbase.py | from sacad.sources.base import CoverSource
class AmazonBaseCoverSource(CoverSource):
""" Base class for Amazon cover sources. """
def __init__(self, *args, base_domain, **kwargs):
super().__init__(*args,
allow_cookies=True,
min_delay_between_accesses=2,
... | from sacad.sources.base import CoverSource
class AmazonBaseCoverSource(CoverSource):
""" Base class for Amazon cover sources. """
def __init__(self, *args, base_domain, **kwargs):
super().__init__(*args,
allow_cookies=True,
min_delay_between_accesses=2,
... | mpl-2.0 | Python |
2fd21bfb6f235136f55a0734818d710e67475a0a | Fix wrong description in ExportFile type | mociepka/saleor,mociepka/saleor,mociepka/saleor | saleor/graphql/csv/types.py | saleor/graphql/csv/types.py | import graphene
from graphql_jwt.exceptions import PermissionDenied
from ...core.permissions import AccountPermissions
from ...csv import models
from ..account.types import User
from ..core.connection import CountableDjangoObjectType
from ..core.types.common import Job
from ..utils import get_user_or_app_from_context
... | import graphene
from graphql_jwt.exceptions import PermissionDenied
from ...core.permissions import AccountPermissions
from ...csv import models
from ..account.types import User
from ..core.connection import CountableDjangoObjectType
from ..core.types.common import Job
from ..utils import get_user_or_app_from_context
... | bsd-3-clause | Python |
70c2612264079cead70aba47c43e923637d1bbb2 | UPDATE VERSION | Top20Talent/django-impersonate,Top20Talent/django-impersonate | impersonate/__init__.py | impersonate/__init__.py | # -*- coding: utf-8 -*-
default_app_config = 'impersonate.apps.AccountsConfig'
VERSION = (1, 2, 0, 'final', 0)
# taken from django-registration
def get_version():
"Returns a PEP 386-compliant version number from VERSION."
assert len(VERSION) == 5
assert VERSION[3] in ('alpha', 'beta', 'rc', 'final')
... | # -*- coding: utf-8 -*-
default_app_config = 'impersonate.apps.AccountsConfig'
VERSION = (1, 1, 0, 'final', 0)
# taken from django-registration
def get_version():
"Returns a PEP 386-compliant version number from VERSION."
assert len(VERSION) == 5
assert VERSION[3] in ('alpha', 'beta', 'rc', 'final')
... | bsd-3-clause | Python |
b818928cae7c7fe3b2914877effbd31030f6c883 | Enable passing in custom directory for saving the output placement files. | google-research/circuit_training | circuit_training/learning/eval.py | circuit_training/learning/eval.py | # coding=utf-8
# Copyright 2021 The Circuit Training Team 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 ap... | # coding=utf-8
# Copyright 2021 The Circuit Training Team 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 ap... | apache-2.0 | Python |
19d809d2bab15a36d6b96970bf4e7a4640a48d57 | Fix misleading message in deploy/python/deploy.py | polysquare/polysquare-ci-scripts,polysquare/polysquare-ci-scripts | ciscripts/deploy/python/deploy.py | ciscripts/deploy/python/deploy.py | # /ciscripts/deploy/python/deploy.py
#
# Activate haskell container in preparation for deployment. This is required
# because we need to have pandoc available in our PATH.
#
# See /LICENCE.md for Copyright information
"""Activate haskell container in preparation for deployment."""
def run(cont, util, shell, argv=None... | # /ciscripts/deploy/python/deploy.py
#
# Activate haskell container in preparation for deployment. This is required
# because we need to have pandoc available in our PATH.
#
# See /LICENCE.md for Copyright information
"""Activate haskell container in preparation for deployment."""
def run(cont, util, shell, argv=None... | mit | Python |
e6f363160fa73f5f27e2d16fbb3d4ab95de6e7dd | Make sure to .upper the command we're given | ElementalAlchemist/txircd,Heufneutje/txircd | txircd/ircbase.py | txircd/ircbase.py | from twisted.protocols.basic.LineOnlyReceiver
class IRCBase(LineOnlyReceiver):
delimiter = "\n" # Default to splitting by \n, and then we'll also split \r in the handler
def lineReceived(self, data):
for line in data.split("\r"):
command, params, prefix, tags = self._parseLine(line)
if command:
self.ha... | from twisted.protocols.basic.LineOnlyReceiver
class IRCBase(LineOnlyReceiver):
delimiter = "\n" # Default to splitting by \n, and then we'll also split \r in the handler
def lineReceived(self, data):
for line in data.split("\r"):
command, params, prefix, tags = self._parseLine(line)
if command:
self.ha... | bsd-3-clause | Python |
a22a7bff2caf04bf7267a8510e889631889a100c | Implement initial functionality. | bamos/conference-tracker,bamos/conference-tracker | report.py | report.py | #!/usr/bin/env python3
import argparse
import datetime as dt
import os
import sys
import yaml
from itertools import chain
from operator import attrgetter
today = dt.datetime.today().date()
def getExpectedField(yaml, field):
if field not in yaml:
print("Error: {} not in {}.".format(yaml, field))
... | #!/usr/bin/env python3
import argparse
import os
import yaml
def iterData(dataDir):
for root, dirs, files in os.walk(args.dataDir):
for group in files:
with open(os.path.join(root, group), 'r') as f:
yield yaml.load(f)
if __name__ == '__main__':
parser = argparse.Argumen... | mit | Python |
87c158b45ea2f3868b28b912b3950c6f3f9e768a | Update version to 8.0.3 | richbrowne/f5-openstack-agent,F5Networks/f5-openstack-agent,richbrowne/f5-openstack-agent,richbrowne/f5-openstack-agent,F5Networks/f5-openstack-agent,F5Networks/f5-openstack-agent | f5_openstack_agent/__init__.py | f5_openstack_agent/__init__.py | __version__ = "8.0.3"
| __version__ = "8.0.2"
| apache-2.0 | Python |
c7ba72fc5f383d9e87b9eb85c61b0667e3095523 | Fix missing newline | matrix-org/matrix-python-sdk | samples/SimpleChatClient.py | samples/SimpleChatClient.py | #!/usr/bin/env python3
# A simple chat client for matrix.
# This sample will allow you to connect to a room, and send/recieve messages.
# Args: host:port username password room
# Error Codes:
# 1 - Unknown problem has occured
# 2 - Could not find the server.
# 3 - Bad URL Format.
# 4 - Bad username/password.
# 11 - Wr... | #!/usr/bin/env python3
# A simple chat client for matrix.
# This sample will allow you to connect to a room, and send/recieve messages.
# Args: host:port username password room
# Error Codes:
# 1 - Unknown problem has occured
# 2 - Could not find the server.
# 3 - Bad URL Format.
# 4 - Bad username/password.
# 11 - Wr... | apache-2.0 | Python |
517f53dc91164f4249de9dbaf31be65df02ffde7 | Add _LARGE_FILES to def_macros[] when platform is AIX (gh-15938) | mhvk/numpy,pbrod/numpy,mattip/numpy,anntzer/numpy,numpy/numpy,numpy/numpy,pbrod/numpy,rgommers/numpy,numpy/numpy,endolith/numpy,abalkin/numpy,pdebuyl/numpy,grlee77/numpy,mattip/numpy,grlee77/numpy,pdebuyl/numpy,charris/numpy,charris/numpy,seberg/numpy,pbrod/numpy,grlee77/numpy,anntzer/numpy,jakirkham/numpy,seberg/numpy... | numpy/fft/setup.py | numpy/fft/setup.py | import sys
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('fft', parent_package, top_path)
config.add_data_dir('tests')
# AIX needs to be told to use large file support - at all times
defs = [('_LARGE_FILES', None)] i... |
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('fft', parent_package, top_path)
config.add_data_dir('tests')
# Configure pocketfft_internal
config.add_extension('_pocketfft_internal',
sources=... | bsd-3-clause | Python |
732ccba4fe2c8710b3f06b8a8a1b20cde55cb99f | make y label unit type | justinccdev/opensimulator-tools,justinccdev/opensimulator-tools,justinccdev/opensimulator-tools,justinccdev/opensimulator-tools | analysis/opensimulator-stats-analyzer/src/ostagraph.py | analysis/opensimulator-stats-analyzer/src/ostagraph.py | #!/usr/bin/python
import argparse
import matplotlib.pyplot as plt
import sys
from pylab import *
from osta.osta import *
#################
### FUNCTIONS ###
#################
def plotNoneAction(stats, type):
for stat in stats:
plt.plot(stat[type]['values'], label=stat['container'])
def plotSumAct... | #!/usr/bin/python
import argparse
import matplotlib.pyplot as plt
import sys
from pylab import *
from osta.osta import *
#################
### FUNCTIONS ###
#################
def plotNoneAction(stats, type):
for stat in stats:
plt.plot(stat[type]['values'], label=stat['container'])
def plotSumAct... | bsd-3-clause | Python |
aece6ee482f3bbb9f12454ca00ea4817dbbe0cd4 | add json endpoint. fixes #1393 | Scifabric/pybossa,PyBossa/pybossa,Scifabric/pybossa,PyBossa/pybossa | pybossa/view/help.py | pybossa/view/help.py | # -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2017 Scifabric LTD.
#
# PYBOSSA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | # -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2017 Scifabric LTD.
#
# PYBOSSA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | agpl-3.0 | Python |
8a522bc92bbf5bee8bc32a0cc332dc77fa86fcd6 | Update http server to un-blocking | fs714/drcontroller | drcontroller/http_server.py | drcontroller/http_server.py | import eventlet
import os
import commands
from eventlet import wsgi
from paste.deploy import loadapp
# Monkey patch socket, time, select, threads
eventlet.patcher.monkey_patch(all=False, socket=True, time=True,
select=True, thread=True, os=True)
def main():
conf = "conf/api-paste.i... | import eventlet
import os
import commands
from eventlet import wsgi
from paste.deploy import loadapp
def main():
conf = "conf/api-paste.ini"
appname = "main"
commands.getoutput('mkdir -p ../logs')
app = loadapp("config:%s" % os.path.abspath(conf), appname)
wsgi.server(eventlet.listen(('', 80)), a... | apache-2.0 | Python |
9bc9b2ea4a53e27b4d9f5f55e2c36fe483ab2de5 | Initialize random sequence of words when starting training, so that words do not repeat | dtantsur/pylancard | pylancard/trainer.py | pylancard/trainer.py | import logging
import random
DIRECT = 'direct'
REVERSE = 'reverse'
LOG = logging.getLogger(__name__)
class Trainer:
def __init__(self, store, kind=DIRECT):
self.store = store
if kind == DIRECT:
self._words = list(store.direct_index.items())
self._plugin = store.meaning_p... | import logging
import random
DIRECT = 'direct'
REVERSE = 'reverse'
LOG = logging.getLogger(__name__)
class Trainer:
def __init__(self, store, kind=DIRECT):
self.store = store
if kind == DIRECT:
self._words = list(store.direct_index.items())
self._plugin = store.meaning_p... | bsd-2-clause | Python |
444e391852e2b4a2669722613107177aa2c7cf7a | Fix mistakes with dataset unit tests | analysiscenter/dataset | batchflow/tests/dataset_test.py | batchflow/tests/dataset_test.py | # pylint: disable=missing-docstring
import pytest
import numpy as np
from batchflow import Dataset, Batch, DatasetIndex, Pipeline
@pytest.fixture
def dataset():
index = DatasetIndex(np.arange(100))
return Dataset(index, Batch)
class TestDataset:
def test_from_dataset(self, dataset):
new_index ... | #pylint: disable=missing-docstring
import pytest
import numpy as np
from batchflow import Dataset, Batch, DatasetIndex, Pipeline
@pytest.fixture
def dataset():
index = DatasetIndex(np.arange(100))
return Dataset(index, Batch)
class TestDataset:
def test_from_dataset(self, dataset):
new_index =... | apache-2.0 | Python |
d0075d4f28360cf3ac192df1b6ba4ba029d4da72 | Fix missing quote. | csdms/coupling,csdms/pymt,csdms/coupling | pymt/utils/prefix.py | pymt/utils/prefix.py | from collections import OrderedDict
def prefix_is_empty(prefix):
"""Check if a namespace prefix is empty.
A prefix is empty if it is ``None``, just a "." or an empty string.
Return ``True`` if empty, otherwise ``False``.
"""
return prefix is None or prefix == "." or len(prefix) == 0
def names_... | from collections import OrderedDict
def prefix_is_empty(prefix):
"""Check if a namespace prefix is empty. A prefix is empty if it's None,
just a '.' or an empty string.
Return ``True`` if empty, otherwise ``False``.
"""
return prefix is None or prefix == "." or len(prefix) == 0
def names_with_p... | mit | Python |
dd44b948715fc1f5753b6d6d6259c76b90d5b124 | replace add_stylesheet with add_css_file | sony/nnabla,sony/nnabla,sony/nnabla | doc/conf.py | doc/conf.py | # Copyright (c) 2017 Sony Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | # Copyright (c) 2017 Sony Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | apache-2.0 | Python |
e4236e46610f9efecb3230e3911b7d472e823276 | Fix ProcessAlreadyExited | Tiago-Lira/scrapyd-mongodb | scrapyd_mongodb/launcher.py | scrapyd_mongodb/launcher.py | # -*- coding: utf-8 -*-
import os
import sys
import signal
from twisted.internet import reactor
from twisted.internet import error
from twisted.python import log
from scrapy.crawler import _get_spider_loader
from scrapy.utils.project import get_project_settings
from scrapyd.utils import get_crawl_args
from scrapyd im... | # -*- coding: utf-8 -*-
import os
import sys
import signal
from twisted.internet import reactor
from twisted.python import log
from scrapy.crawler import _get_spider_loader
from scrapy.utils.project import get_project_settings
from scrapyd.utils import get_crawl_args
from scrapyd import launcher
from scrapyd import r... | mit | Python |
545fec7a1446348d117f8c840cb4e334a67e25da | Fix documentation (#5311) | TheAlgorithms/Python | maths/euler_modified.py | maths/euler_modified.py | from typing import Callable
import numpy as np
def euler_modified(
ode_func: Callable, y0: float, x0: float, step_size: float, x_end: float
) -> np.array:
"""
Calculate solution at each step to an ODE using Euler's Modified Method
The Euler Method is straightforward to implement, but can't give accur... | from typing import Callable
import numpy as np
def euler_modified(
ode_func: Callable, y0: float, x0: float, step_size: float, x_end: float
) -> np.array:
"""
Calculate solution at each step to an ODE using Euler's Modified Method
The Euler is straightforward to implement, but can't give accurate sol... | mit | Python |
620bf504292583b2547cf7489eeeaaa582ddad77 | Fix and extend test conditions | sorgerlab/indra,sorgerlab/belpy,johnbachman/indra,bgyori/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/belpy,bgyori/indra,bgyori/indra,sorgerlab/belpy | indra/tests/test_ctd.py | indra/tests/test_ctd.py | import os
from indra.statements import *
from indra.sources import ctd
from indra.sources.ctd.processor import CTDChemicalGeneProcessor
HERE = os.path.dirname(os.path.abspath(__file__))
def test_statement_type_mapping():
st = CTDChemicalGeneProcessor.get_statement_types(
'decreases^phosphorylation', 'X',... | import os
from indra.statements import *
from indra.sources import ctd
from indra.sources.ctd.processor import CTDChemicalGeneProcessor
HERE = os.path.dirname(os.path.abspath(__file__))
def test_statement_type_mapping():
st = CTDChemicalGeneProcessor.get_statement_types(
'decreases^phosphorylation', 'X',... | bsd-2-clause | Python |
0e2270415b287cb643cff5023dcaacbcb2d5e3fc | Fix Google Translator request & processing | ChameleonTartu/neurotolge,ChameleonTartu/neurotolge,ChameleonTartu/neurotolge | translators/google.py | translators/google.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import requests
import json
def save_google_translation(queue, source_text, translate_from='et', translate_to='en'):
translation = ''
try:
begin = time.time()
translation = google_translation(source_text,
... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import requests
def save_google_translation(queue, source_text, client_id, client_secret, translate_from='et', translate_to='en'):
translation = ''
try:
begin = time.time()
translation = google_translation(source_text,
... | mit | Python |
0f018ec9bfd0c93d980b232af325be453c065632 | Update to dev version 0.14.1+dev20220804 | quantumlib/qsim,quantumlib/qsim,quantumlib/qsim,quantumlib/qsim | qsimcirq/_version.py | qsimcirq/_version.py | """The version number defined here is read automatically in setup.py."""
__version__ = "0.14.1.dev20220804"
| """The version number defined here is read automatically in setup.py."""
__version__ = "0.14.0"
| apache-2.0 | Python |
d6108eef43c110412d16844b448009101e6b1621 | Fix #1105 --plugins | Pretagonist/Flexget,ibrahimkarahan/Flexget,gazpachoking/Flexget,spencerjanssen/Flexget,ZefQ/Flexget,camon/Flexget,jacobmetrick/Flexget,Danfocus/Flexget,qvazzler/Flexget,ZefQ/Flexget,sean797/Flexget,antivirtel/Flexget,xfouloux/Flexget,poulpito/Flexget,ianstalk/Flexget,qk4l/Flexget,jawilson/Flexget,jacobmetrick/Flexget,J... | flexget/plugins/cli_plugins.py | flexget/plugins/cli_plugins.py | import logging
from optparse import SUPPRESS_HELP
from flexget.plugin import register_plugin, register_parser_option, plugins
log = logging.getLogger('plugins')
class PluginsList(object):
"""
Implements --plugins
"""
def on_process_start(self, feed):
if feed.manager.options.plugins:
... | import logging
from optparse import SUPPRESS_HELP
from flexget.plugin import register_plugin, register_parser_option, plugins, feed_phases, phase_methods, get_plugins_by_phase
log = logging.getLogger('plugins')
class PluginsList(object):
"""
Implements --plugins
"""
def on_process_start(self, fe... | mit | Python |
58052e436622857a6f99ac1f2f109f91ef4e7f51 | convert the minutes skeleton | karlcow/webcompat,karlcow/webcompat | moz/minutes/minutes.py | moz/minutes/minutes.py | #!/usr/bin/env python
# encoding: utf-8
"""
minutes.py
Created by Karl Dubost on 2014-09-25.
Copyright (c) 2014 La Grange. All rights reserved.
MIT License
We want:
1. Import
https://etherpad.mozilla.org/ep/pad/export/webcompat/latest?format=txt
2. Extract the effective minutes from the text
3. Extract the date
4. C... | #!/usr/bin/env python
# encoding: utf-8
"""
minutes.py
Created by Karl Dubost on 2014-09-25.
Copyright (c) 2014 La Grange. All rights reserved.
MIT License
We want:
1. Import
https://etherpad.mozilla.org/ep/pad/export/webcompat/latest?format=txt
2. Extract the effective minutes from the text
3. Extract the date
4. C... | mit | Python |
1d71d0da0b5060bdd929e131b62d9b10190ffc9a | add --float-format parameter to meshio-convert | nschloe/meshio | meshio/_cli/_convert.py | meshio/_cli/_convert.py | import argparse
import numpy
from .._helpers import _writer_map, read, reader_map, write
from ._helpers import _get_version_text
def convert(argv=None):
# Parse command line arguments.
parser = _get_convert_parser()
args = parser.parse_args(argv)
# read mesh data
mesh = read(args.infile, file_f... | import argparse
import numpy
from .._helpers import _writer_map, read, reader_map, write
from ._helpers import _get_version_text
def convert(argv=None):
# Parse command line arguments.
parser = _get_convert_parser()
args = parser.parse_args(argv)
# read mesh data
mesh = read(args.infile, file_f... | mit | Python |
73cbabb1b7aa56a811cc8b08c32545e249960d9a | fix run_tests | vasole/fisx,vasole/fisx,vasole/fisx,vasole/fisx,vasole/fisx | python/fisx/tests/__init__.py | python/fisx/tests/__init__.py | #/*##########################################################################
#
# The fisx library for X-Ray Fluorescence
#
# Copyright (c) 2014-2018 European Synchrotron Radiation Facility
#
# This file is part of the fisx X-ray developed by V.A. Sole
#
# Permission is hereby granted, free of charge, to any person obt... | #/*##########################################################################
#
# The fisx library for X-Ray Fluorescence
#
# Copyright (c) 2014-2018 European Synchrotron Radiation Facility
#
# This file is part of the fisx X-ray developed by V.A. Sole
#
# Permission is hereby granted, free of charge, to any person obt... | mit | Python |
cd8e2760f2754614b237cb202162f08b5aa0a9ec | Allow multiple status query | Omicia/omicia_api_examples,Omicia/omicia_api_examples,Omicia/omicia_api_examples | python/get_report_variants.py | python/get_report_variants.py | """Get a clinical report's variants.
Usages: python get_report_variants.py 1542
python get_report_variants.py 1542 --status "FAILED_CONFIRMATION,REVIEWED"
python get_report_variants.py 1542 --status "CONFIRMED"
"""
import os
import requests
from requests.auth import HTTPBasicAuth
import sys
import json... | """Get a clinical report's variants.
"""
import os
import requests
from requests.auth import HTTPBasicAuth
import sys
import json
import argparse
#Load environment variables for request authentication parameters
if "OMICIA_API_PASSWORD" not in os.environ:
sys.exit("OMICIA_API_PASSWORD environment variable missing... | mit | Python |
30eb66e4fdb783c34c96686fb535a3d0255cfdcb | Update myth_commercial_cut.py | tcarmean/myth_commercial_cut | myth_commercial_cut.py | myth_commercial_cut.py | #!/usr/bin/env python
import os
import sys
import base64
import uuid
import subprocess
import ConfigParser
import StringIO
import shutil
try:
import MySQLdb
except ImportError:
print('You need to install the MySQLdb python module in order to use this script')
exit(1)
if __name__ == "__main__":... | #!/usr/bin/env python
if __name__ == "__main__":
print "hello world!"
| mit | Python |
48bb4810eb6b9bd705fcabae742b6e13cfb2860d | Change for Django 1.8 | artscoop/django-treemenus-plus,artscoop/django-treemenus-plus | treemenus/templatetags/tree_menu_tags.py | treemenus/templatetags/tree_menu_tags.py | import django
from django import template
from django.template.defaulttags import url
from django.template import Node, TemplateSyntaxError
from treemenus.models import Menu, MenuItem
from treemenus.config import APP_LABEL
register = template.Library()
@register.simple_tag
def get_treemenus_static_prefix():
if... | import django
from django import template
from django.template.defaulttags import url
from django.template import Node, TemplateSyntaxError
from treemenus.models import Menu, MenuItem
from treemenus.config import APP_LABEL
register = template.Library()
@register.simple_tag
def get_treemenus_static_prefix():
if... | bsd-3-clause | Python |
664a82ee0a9403c4518ff32da33ff031a094698c | Extend jobspec with the available api fields | fiaas/k8s | k8s/models/job.py | k8s/models/job.py | #!/usr/bin/env python
# -*- coding: utf-8
from __future__ import absolute_import
from .pod import PodTemplateSpec
from .common import ObjectMeta
from ..base import Model
from ..fields import Field
class LabelSelector(Model):
matchLabels = Field(dict)
class JobSpec(Model):
template = Field(PodTemplateSpec)
... | #!/usr/bin/env python
# -*- coding: utf-8
from __future__ import absolute_import
from .pod import PodTemplateSpec
from .common import ObjectMeta
from ..base import Model
from ..fields import Field
class JobSpec(Model):
template = Field(PodTemplateSpec)
backoffLimit = Field(int)
class Job(Model):
class ... | apache-2.0 | Python |
040b0420239e38c09cb79b3fea78200f88d58745 | Remove unused import: Kafka producer | IngaFeick/kafka-influxdb,mre/kafka-influxdb,mre/kafka-influxdb | kafka_influxdb.py | kafka_influxdb.py | from kafka.client import KafkaClient
from kafka.consumer import SimpleConsumer
from influxdb import InfluxDBClient
import json
import argparse
class InfluxDBData(object):
def __init__(self, name, columns):
self.name = name
self.columns = columns
self.points = []
def add_point(self, *point):
self.points.app... | from kafka.client import KafkaClient
from kafka.consumer import SimpleConsumer
from kafka.producer import SimpleProducer, KeyedProducer
from influxdb import InfluxDBClient
import json
import argparse
class InfluxDBData(object):
def __init__(self, name, columns):
self.name = name
self.columns = columns
self.poi... | apache-2.0 | Python |
80e2e72b073f1f581dfc5968168387039850b869 | comment out "ConfigDrive" | bincentvaret/bsd-cloudinit,CropCircleSys/bsd-cloudinit,pellaeon/bsd-cloudinit,pellaeon/bsd-cloudinit | cloudbaseinit/metadata/factory.py | cloudbaseinit/metadata/factory.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Cloudbase Solutions Srl
#
# 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/LICEN... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Cloudbase Solutions Srl
#
# 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/LICEN... | apache-2.0 | Python |
ef50e02816c23d7af2a89a74abc6c4a33b2350f2 | Add quit option | TeamSirius/Utilities,TeamSirius/Utilities,TeamSirius/Utilities,TeamSirius/Utilities | runner.py | runner.py | import argparse
import os
from scripts import Locator, analysis, dump, newmapper
def print_options(options):
message = '{}: {}'
for indx, item in enumerate(options):
print (message.format(indx, item))
print (message.format('q', 'Quit'))
return raw_input('Your selection: ')
def main(args):
... | import argparse
import os
from scripts import Locator, analysis, dump, newmapper
def print_options(options):
message = '{}: {}'
for indx, item in enumerate(options):
print (message.format(indx, item))
return raw_input('Your selection: ')
def main(args):
options = ['Locate last point', 'Anal... | apache-2.0 | Python |
ce59f65efe471df5107fd404d280e7be528ef84c | test registering commands | VeryCB/flask-slack | test_flask.py | test_flask.py | from pytest import fixture
from flask import Flask
from flask_slack import Slack
class App(object):
def __init__(self):
self.app = Flask(__name__)
self.app.debug = True
self.slack = Slack(self.app)
self.app.add_url_rule('/', view_func=self.slack.dispatch)
self.client = se... | from pytest import fixture
from flask import Flask
from flask_slack import Slack
class App(object):
def __init__(self):
self.app = Flask(__name__)
self.app.debug = True
self.slack = Slack(self.app)
self.app.add_url_rule('/', view_func=self.slack.dispatch)
self.client = se... | bsd-3-clause | Python |
b86dfa56f6721e098845a0eee1091c07c5787967 | add a little bit more flexibility to the SimplePlugin Reception class, enable it to return only selected plugin classes | sreichholf/python-coherence,furbrain/Coherence,coherence-project/Coherence,furbrain/Coherence,unintended/Cohen,unintended/Cohen,sreichholf/python-coherence,opendreambox/python-coherence,ismaelgaudioso/Coherence,opendreambox/python-coherence,coherence-project/Coherence,ismaelgaudioso/Coherence | coherence/extern/simple_plugin.py | coherence/extern/simple_plugin.py | # -*- coding: utf-8 -*-
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2007, Frank Scholz <coherence@beebits.net>
""" real simple plugin system
meant as a replacement when setuptools/pkg_resources
are not available
"""
import os
import sys
class Plugin(object)... | # -*- coding: utf-8 -*-
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2007, Frank Scholz <coherence@beebits.net>
""" real simple plugin system
meant as a replacement when setuptools/pkg_resources
are not available
"""
import os
import sys
class Plugin(object)... | mit | Python |
53e6df1594a5b83aff673c627369102376d4c271 | Refactor kuryr/__init__.py not to use objects but modules. | celebdor/kuryr,midonet/kuryr,openstack/kuryr,midonet/kuryr,celebdor/kuryr,celebdor/kuryr-libnetwork,celebdor/kuryr-libnetwork,openstack/kuryr,midonet/kuryr,celebdor/kuryr-libnetwork | kuryr/__init__.py | kuryr/__init__.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | apache-2.0 | Python |
8d3a091225b490fe44699670bfcdf09e31134360 | Use relative import for module (#80) | AlexAplin/nndownload | nndownload/__init__.py | nndownload/__init__.py | from . import nndownload
def execute(*args):
args_list = [e.strip() for e in args]
nndownload.cmdl_opts = nndownload.cmdl_parser.parse_args(args_list)
nndownload.main()
| from nndownload import nndownload
def execute(*args):
args_list = [e.strip() for e in args]
nndownload.cmdl_opts = nndownload.cmdl_parser.parse_args(args_list)
nndownload.main()
| mit | Python |
643c80218688c20773492f61b9ddb1c1f0818e4f | add crunchbang | XertroV/nodeup-xk-io,XertroV/nodeup-xk-io,XertroV/nodeup-xk-io,XertroV/nodeup-xk-io | nodeup-server/on_tx.py | nodeup-server/on_tx.py | #!/usr/bin/env python3
import argparse
import json
import sys
from bitcoinrpc import connect_to_local
from models import txs, known_txs, unprocessed_txs, addr_to_uid, Account
parser = argparse.ArgumentParser()
parser.add_argument('--txid')
args = parser.parse_args()
txid = args.txid
known_tx = True if known_txs.ad... | import argparse
import json
import sys
from bitcoinrpc import connect_to_local
from models import txs, known_txs, unprocessed_txs, addr_to_uid, Account
parser = argparse.ArgumentParser()
parser.add_argument('--txid')
args = parser.parse_args()
txid = args.txid
known_tx = True if known_txs.add(txid) == 0 else False
... | mit | Python |
6c7f65766f67298c91a9c7d82ebba436be258925 | Fix typo in NotImplementedError | stamhe/pybitcointools | bitcoin/cryptos/bitcoin_cash.py | bitcoin/cryptos/bitcoin_cash.py | from .bitcoin import Bitcoin
from ..transaction import SIGHASH_ALL, SIGHASH_FORKID
from ..explorers import blockdozer
class BitcoinCash(Bitcoin):
display_name = "Bitcoin Cash"
coin_symbol = "bcc"
magicbyte = 0
hashcode = SIGHASH_ALL + SIGHASH_FORKID
def __init__(self, testnet=False, **kwargs):
... | from .bitcoin import Bitcoin
from ..transaction import SIGHASH_ALL, SIGHASH_FORKID
from ..explorers import blockdozer
class BitcoinCash(Bitcoin):
display_name = "Bitcoin Cash"
coin_symbol = "bcc"
magicbyte = 0
hashcode = SIGHASH_ALL + SIGHASH_FORKID
def __init__(self, testnet=False, **kwargs):
... | mit | Python |
ccc2cac1bb218483f69f9b9fecbedc603e20cb52 | remove debug | happyleavesaoc/aoc-mgz | mgz/summary/__init__.py | mgz/summary/__init__.py | from mgz.fast.header import decompress, parse_version
from mgz.summary.full import FullSummary
from mgz.model.compat import ModelSummary
from mgz.util import Version
import logging
import zlib
logger = logging.getLogger(__name__)
class SummaryStub:
def __call__(self, data, playback=None, fallback=False):
... | from mgz.fast.header import decompress, parse_version
from mgz.summary.full import FullSummary
from mgz.model.compat import ModelSummary
from mgz.util import Version
import logging
import zlib
logger = logging.getLogger(__name__)
class SummaryStub:
def __call__(self, data, playback=None, fallback=False):
... | mit | Python |
abbe91634109b2554c368851439b0934fda2a85f | Fix style | jonathanstallings/data-structures,jay-tyler/data-structures | test_queue.py | test_queue.py | from __future__ import unicode_literals
import pytest
from queue import Queue
# (Input, expected) for well constructed instantiation arguments,
# and one subsequent dequeue
valid_constructor_args_dequeue = [
([1, 2, 3], 1),
([[1, 2, 3], "string"], [1, 2, 3]),
("string", 's')
]
# Invalid instantiation a... | from __future__ import unicode_literals
import pytest
from linked_list import LinkedList
from queue import Queue
# (Input, expected) for well constructed instantiation arguments,
# and one subsequent dequeue
valid_constructor_args_dequeue = [
([1,2,3], 1),
([[1,2,3,], "string" ], [1,2,3]),
("string", 's... | mit | Python |
71a31e1008132a593c86ca0016ef95f4b2120716 | Use power of 1.5 instead of 2 for denser plots. | nbigaouette/rust-sorting,nbigaouette/rust-sorting,nbigaouette/rust-sorting | benchmark.py | benchmark.py | #!/usr/bin/env python3
import numpy as np
import copy as cp
import time
import re
import rust_sorting as rs
import on_key
max_val = 10.0
dtype = np.int32
repeat = 4
Nb_power_of_two = 20
Ns = np.asarray(1.5**np.arange(0, Nb_power_of_two), dtype=int)
fct_ptrs = [rs.sort, rs.quicksort, rs.insertionsort, rs.selection... | #!/usr/bin/env python3
import numpy as np
import copy as cp
import time
import re
import rust_sorting as rs
import on_key
max_val = 10.0
dtype = np.int32
repeat = 4
Nb_power_of_two = 20
Ns = 2**np.arange(0, Nb_power_of_two)
fct_ptrs = [rs.sort, rs.quicksort, rs.insertionsort, rs.selectionsort]
timing = np.zeros(... | bsd-3-clause | Python |
795e200a83680d4bf6a4ed1b45d061937fabaadb | add calculation of utility | e-mission/e-mission-server,sunil07t/e-mission-server,yw374cornell/e-mission-server,yw374cornell/e-mission-server,joshzarrabi/e-mission-server,e-mission/e-mission-server,joshzarrabi/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,yw374cornell/e-m... | CFC_DataCollector/recommender/user_utility_model.py | CFC_DataCollector/recommender/user_utility_model.py | # Phase 1: Build a model for User Utility Function (per Vij, Shankari)
# First, for each trip, we must obtain alternatives through some method
# (currently Google Maps API), alongside the actual trips which were taken.
# Once we have these alternatives, we can extract the features from each of the
# possible trips. Now... | # Phase 1: Build a model for User Utility Function (per Vij, Shankari)
# First, for each trip, we must obtain alternatives through some method
# (currently Google Maps API), alongside the actual trips which were taken.
# Once we have these alternatives, we can extract the features from each of the
# possible trips. Now... | bsd-3-clause | Python |
5dd3dea6e6d7895999510035e5aebf717821ccd8 | Update blog models to handle with new database table format. | DataViva/dataviva-site,DataViva/dataviva-site,DataViva/dataviva-site,DataViva/dataviva-site | dataviva/apps/blog/models.py | dataviva/apps/blog/models.py | from dataviva import db
from sqlalchemy import ForeignKey
class Post(db.Model):
__tablename__ = 'blog_post'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(400))
author = db.Column(db.String(100))
text_call = db.Column(db.String(500))
text_content = db.Column(db.Text(4... | from dataviva import db
from sqlalchemy import ForeignKey
class Post(db.Model):
__tablename__ = 'blog_post'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(400))
subject = db.Column(db.String(100))
text_call = db.Column(db.String(500))
text_content = db.Column(db.Text(... | mit | Python |
fb88a0fa16947a160e2ed098cbd99833e883546e | increase version to 0.13.0a1 | RasaHQ/rasa_nlu,RasaHQ/rasa_core,RasaHQ/rasa_core,RasaHQ/rasa_core,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu | rasa_core/version.py | rasa_core/version.py | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
__version__ = '0.13.0a1'
| from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
__version__ = '0.12.0'
| apache-2.0 | Python |
57909c1c4009fbc732a1e1deb09bddf5d3a0b0f8 | Fix error | eEcoLiDAR/eEcoLiDAR | laserchicken/tools/cli.py | laserchicken/tools/cli.py | """Command line tool definitions."""
from __future__ import print_function
import os
import click
from colorama import Back, init
from . import ToolException
from .._version import __version__
from ..select import select_above, select_below
from ..spatial_selections import points_in_polygon_shp_file, points_in_polyg... | """Command line tool definitions."""
from __future__ import print_function
import os
import click
from colorama import Back, init
from . import ToolException
from .._version import __version__
from ..select import select_above, select_below
from ..spatial_selections import points_in_polygon_shp_file, points_in_polyg... | apache-2.0 | Python |
f30fe4b7ae9988dd28e47d59c8d60b2b17ff71d2 | define a package level logging configuration | wikimedia/analytics-user-metrics,wikimedia/user_metrics,rfaulkner/wikipedia_user_metrics,rfaulkner/wikipedia_user_metrics,wikimedia/user_metrics,wikimedia/analytics-user-metrics,rfaulkner/wikipedia_user_metrics,wikimedia/user_metrics,wikimedia/analytics-user-metrics | config/__init__.py | config/__init__.py |
# CONFIGURE THE LOGGER
import logging
import sys
logging.basicConfig(level=logging.DEBUG, stream=sys.stderr, format='%(asctime)s %(levelname)-8s %(message)s', datefmt='%b-%d %H:%M:%S') | bsd-3-clause | Python | |
913647ac2e7e84d7da0cc6e70a73e5ad29d5fc77 | convert message to dataclass | jreese/edi | edi/core.py | edi/core.py | # Copyright 2016 John Reese
# Licensed under the MIT license
import logging
from attr import dataclass
from typing import Set, Type
log = logging.getLogger(__name__)
@dataclass
class Message:
"""Base class for all Slack RTM messages."""
type: str
class Unit:
ENABLED = True
def __str__(self) -> ... | # Copyright 2016 John Reese
# Licensed under the MIT license
import logging
from ent import Ent
from typing import Set, Type
log = logging.getLogger(__name__)
class Message(Ent):
"""Base class for all Slack RTM messages."""
pass
class Unit:
ENABLED = True
def __str__(self) -> str:
return... | mit | Python |
0a2dc53cd388f73064bb66e794e3af5f3e48a92f | Update the required version of Celery | reviewboard/ReviewBot,reviewboard/ReviewBot,reviewboard/ReviewBot,reviewboard/ReviewBot | bot/setup.py | bot/setup.py | from setuptools import setup, find_packages
PACKAGE_NAME = "ReviewBot"
VERSION = "0.1"
setup(name=PACKAGE_NAME,
version=VERSION,
description="ReviewBot, the automated code reviewer",
author="Steven MacLeod",
author_email="steven@smacleod.ca",
packages=find_packages(),
entry_points... | from setuptools import setup, find_packages
PACKAGE_NAME = "ReviewBot"
VERSION = "0.1"
setup(name=PACKAGE_NAME,
version=VERSION,
description="ReviewBot, the automated code reviewer",
author="Steven MacLeod",
author_email="steven@smacleod.ca",
packages=find_packages(),
entry_points... | mit | Python |
c9adf965eb6b637e45f53addc650859a50e2603e | Fix fieldlevel permission test | adityahase/frappe,mhbu50/frappe,yashodhank/frappe,yashodhank/frappe,saurabh6790/frappe,adityahase/frappe,StrellaGroup/frappe,adityahase/frappe,StrellaGroup/frappe,saurabh6790/frappe,almeidapaulopt/frappe,almeidapaulopt/frappe,mhbu50/frappe,mhbu50/frappe,mhbu50/frappe,saurabh6790/frappe,yashodhank/frappe,yashodhank/frap... | frappe/tests/test_form_load.py | frappe/tests/test_form_load.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, unittest
from frappe.desk.form.load import getdoctype, getdoc
from frappe.core.page.permission_manager.permission_manager import update, reset, add
from frappe.cust... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, unittest
from frappe.desk.form.load import getdoctype, getdoc
from frappe.core.page.permission_manager.permission_manager import update, reset
class TestFormLoad(... | mit | Python |
1c86e9164d9df9cbb75b520b9700a5621a1116f9 | Fix columns not to be converted into str | fuller-inc/bqx | bqx/_func.py | bqx/_func.py | from .parts import Column
def BETWEEN(expr1, expr2, expr3):
return Column('%s BETWEEN %s AND %s' % (_actual_n(expr1), _actual_n(expr2), _actual_n(expr3)))
def CAST(type1, type2):
return Column('CAST(%s AS %s)' % (type1, type2))
def CONCAT(*args):
arg = [_actual_n(a) for a in args]
arg = ', '.join(... | from .parts import Column
def BETWEEN(expr1, expr2, expr3):
return Column('%s BETWEEN %s AND %s' % (_actual_n(expr1), _actual_n(expr2), _actual_n(expr3)))
def CAST(type1, type2):
return Column('CAST(%s AS %s)' % (type1, type2))
def CONCAT(*args):
arg = [_actual_n(a) for a in args]
arg = ', '.join(... | bsd-3-clause | Python |
1f184bb02b01e12528da2b0ae69fd71c27577fd7 | Remove use of `.text` attribute | RihanWu/vocabtool | urllibRequests.py | urllibRequests.py | """Use urllib for web communication"""
from sys import hexversion
# Check python version
if hexversion < 0x300000:
import urllib2 as req
import urllib as par
else:
import urllib.request as req
import urllib.parse as par
def _get_encoding(ctstr):
return ctstr[ctstr.find('charset')+8:]
def _gunzi... | """Use urllib for web communication"""
from sys import hexversion
# Check python version
if hexversion < 0x300000:
import urllib2 as req
import urllib as par
else:
import urllib.request as req
import urllib.parse as par
class Response():
def __init__(self, data, charset='UTF-8'):
self.tex... | mit | Python |
4e8dc0ca41ee1e21a75a3e803c3b2b223d9f14cb | Fix issue with create_superuser method on UserManager | mishbahr/django-users2,mishbahr/django-users2 | users/managers.py | users/managers.py | from django.utils import timezone
from django.contrib.auth.models import BaseUserManager
from model_utils.managers import InheritanceQuerySet
from .conf import settings
class UserManager(BaseUserManager):
def _create_user(self, email, password,
is_staff, is_superuser, **extra_fields):
... | from django.utils import timezone
from django.contrib.auth.models import BaseUserManager
from model_utils.managers import InheritanceQuerySet
from .conf import settings
class UserManager(BaseUserManager):
def _create_user(self, email, password,
is_staff, is_superuser, **extra_fields):
... | bsd-3-clause | Python |
510aacd5ef8a8aa6da8f75c54d7b0428f5c55cb9 | reformat index docs | mylokin/redisext,mylokin/redisext | redisext/__init__.py | redisext/__init__.py | '''
Introduction
------------
Redisext is a tool for data modeling. Its primary goal is to provide light
interface to well-known data models based on Redis such as queues, hashmaps,
counters, pools and stacks. Redisext could be threated like an ORM for Redis.
Data Models
-----------
.. automodule:: redisext.counter
... | '''
Tutorial
--------
Models
------
.. automodule:: redisext.models
.. automodule:: redisext.counter
.. automodule:: redisext.hashmap
.. automodule:: redisext.key
.. automodule:: redisext.pool
.. automodule:: redisext.queue
.. automodule:: redisext.stack
.. automodule:: redisext.serializer
Backend
-------
..... | mit | Python |
dfb17cb41dfff48398eac940ec85413948edab3f | fix funnction name in activaitons file | Warvito/pydeeplearn,snurkabill/pydeeplearn,mihaelacr/pydeeplearn,Warvito/pydeeplearn,snurkabill/pydeeplearn | code/activationfunctions.py | code/activationfunctions.py | """ This class defines activation function that can be used with the nets in this project"""
from theano import tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
import theano
import numpy as np
theanoFloat = theano.config.floatX
class Sigmoid(object):
def __init__(self):
self.theano... | """ This class defines activation function that can be used with the nets in this project"""
from theano import tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
import theano
import numpy as np
theanoFloat = theano.config.floatX
class Sigmoid(object):
def __init__(self):
self.theano... | bsd-3-clause | Python |
abb4b2cccb7104389c3ab9fbd67656178a554939 | Split procurements as well when a move is split | BT-jmichaud/stock-logistics-workflow,raycarnes/stock-logistics-workflow,akretion/stock-logistics-workflow,brain-tec/stock-logistics-workflow,xpansa/stock-logistics-workflow,damdam-s/stock-logistics-workflow,BT-fgarbely/stock-logistics-workflow,brain-tec/stock-logistics-workflow,xpansa/stock-logistics-workflow,open-syne... | stock_split_picking/model/stock.py | stock_split_picking/model/stock.py | # -*- coding: utf-8 -*-
#
#
# Author: Nicolas Bessi, Guewen Baconnier, Yannick Vaucher
# Copyright 2013-2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation,... | # -*- coding: utf-8 -*-
#
#
# Author: Nicolas Bessi, Guewen Baconnier, Yannick Vaucher
# Copyright 2013-2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation,... | agpl-3.0 | Python |
36dd86661ad37ed5d5a9600adb3a2078a88e8e47 | Update chat.py | CodeGuild-co/wtc,CodeGuild-co/wtc,CodeGuild-co/wtc | blog/chat.py | blog/chat.py | # A simple chat server using websockets
# Uses a slight modification to the protocol I'm using to write a different
# application
# Modifications:
# No rooms
# Uses Facebook to authenticate
from flask import Flask, session, escape, request, redirect
from flask_socketio import SocketIO, emit
from blog.util import rend... | # A simple chat server using websockets
# Uses a slight modification to the protocol I'm using to write a different
# application
# Modifications:
# No rooms
# Uses Facebook to authenticate
from flask import Flask, session, escape, request, redirect
from flask_socketio import SocketIO, emit
from blog.util import rend... | mit | Python |
e04c9da711905ee17c649ecd71ef936edbdbab9c | update some flags, add new builddocs that we can turn off for embedded targets | sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary | build/use.py | build/use.py | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
"""
Provides the build configuration as special dictionaries that directly
export their namespaces.
Should read, or be provided, some sort of configuration information
relative to the build being done. For now, we'll intialize a static
configuration suffi... | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
"""
Provides the build configuration as special dictionaries that directly
export their namespaces.
Should read, or be provided, some sort of configuration information
relative to the build being done. For now, we'll intialize a static
configuration suffi... | apache-2.0 | Python |
28bf4891d423162603d45a446f6bd137e0388a36 | add model for Friendship | FXuZ/colock-server,FXuZ/colock-server | user_manage/models.py | user_manage/models.py | from django.db import models
from django.utils import timezone
class User(models.Model):
cid = models.CharField(max_length=32)
ukey = models.CharField(max_length=32)
# authentication key.
region_num = models.IntegerField()
phone_num = models.BigIntegerField()
nickname = models.CharField(max_... | from django.db import models
from django.utils import timezone
class User(models.Model):
cid = models.CharField(max_length=32)
ukey = models.CharField(max_length=32)
# authentication key.
region_num = models.IntegerField()
phone_num = models.BigIntegerField()
nickname = models.CharField(max_... | apache-2.0 | Python |
a0415d29da535ff31652d8ed17f22f10688ae5b6 | Bump version | 5monkeys/django-bananas,5monkeys/django-bananas,5monkeys/django-bananas | bananas/__init__.py | bananas/__init__.py | VERSION = (1, 5, 1, "final", 0)
def get_version(version=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is None:
version = VERSION
assert len(version) == 5
assert version[3] in ("alpha", "beta", "rc", "final")
# Now build the two parts of the version number... | VERSION = (1, 5, 0, "final", 0)
def get_version(version=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is None:
version = VERSION
assert len(version) == 5
assert version[3] in ("alpha", "beta", "rc", "final")
# Now build the two parts of the version number... | mit | Python |
818e15028c4dd158fa93fe4bcd351255585c2f4f | Handle missing value in predit rf | parkerzf/kaggle-expedia,parkerzf/kaggle-expedia,parkerzf/kaggle-expedia | src/model/predict_rf_model.py | src/model/predict_rf_model.py | import numpy as np
import pandas as pd
import sys
import os
from sklearn.externals import joblib
from sklearn.ensemble import RandomForestClassifier
scriptpath = os.path.dirname(os.path.realpath(sys.argv[0])) + '/../'
sys.path.append(os.path.abspath(scriptpath))
import utils
parameter_str = '_'.join(['top', str(utils... | import numpy as np
import pandas as pd
import sys
import os
from sklearn.externals import joblib
from sklearn.ensemble import RandomForestClassifier
scriptpath = os.path.dirname(os.path.realpath(sys.argv[0])) + '/../'
sys.path.append(os.path.abspath(scriptpath))
import utils
parameter_str = '_'.join(['top', str(utils... | bsd-3-clause | Python |
555fb7db3b3571a8867def78090772fe8671edef | Fix typo | PyconUK/ConferenceScheduler | conference_scheduler/resources.py | conference_scheduler/resources.py | from typing import NamedTuple
from datetime import datetime
class Demand(NamedTuple):
event: Event
audience: int
class Event(NamedTuple):
name: str
type: EventType
class EventType(NamedTuple):
name: str
class Person(NamedTuple):
name: str
class Role(NamedTuple):
name: str
class R... | from typing import NamedTuple
from datetime import datetime
class Demand(NamedTuple):
event: Event
audience: int
class Event(NamedTuple):
name: str
type: EventType
class EventType(NamedTuple):
name: str
class Person(NamedTuple):
name: str
class Role(NamedTuple):
name: str
class R... | mit | Python |
91924836483bfaa41cd9accfa2c27cf1e9bf0303 | Update testsuite urls.py for target Django versions | dmpayton/django-admin-honeypot,dmpayton/django-admin-honeypot | tests/urls.py | tests/urls.py | from django.conf.urls import include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r'^admin/', include('admin_honeypot.urls', namespace='admin_honeypot')),
url(r'^secret/', include(admin.site.urls)),
]
| try:
from django.conf.urls import patterns, include, url
except ImportError: # django < 1.4
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', inc... | mit | Python |
5a26f0820fc5c1d90342db2ac29058b083bacdcb | add default variable | osoken/kisell | kisell/io.py | kisell/io.py | # -*- coding: utf-8 -*-
from builtins import open
from . core import Origin, Pipe
class ReadStream(Origin):
"""``ReadStream`` is an input stream wrapped by ``kisell.core.Origin``.
:param readable: readable object
:param buffer_size: size of buffer (default: 4096)
"""
@classmethod
def __gen... | # -*- coding: utf-8 -*-
from builtins import open
from . core import Origin, Pipe
class ReadStream(Origin):
"""``ReadStream`` is an input stream wrapped by ``kisell.core.Origin``.
:param readable: readable object
:param buffer_size: size of buffer (default: 4096)
"""
@classmethod
def __gen... | mit | Python |
b7584d066cc248984130ac8d2a4d1a2d955e6064 | Use Constraint objects in scheduler.py | PyconUK/ConferenceScheduler | conference_scheduler/scheduler.py | conference_scheduler/scheduler.py | import pulp
import conference_scheduler.parameters as params
from conference_scheduler.resources import ScheduledItem
def _all_constraints(shape, sessions, events, X, constraints=None):
session_array = params.session_array(sessions)
tag_array = params.tag_array(events)
generators = [params.constraints(sha... | import pulp
import conference_scheduler.parameters as params
from conference_scheduler.resources import ScheduledItem
def _all_constraints(shape, sessions, events, X, constraints=None):
session_array = params.session_array(sessions)
tag_array = params.tag_array(events)
generators = [params.constraints(sha... | mit | Python |
a02835d2f1ebfffbacee276265285963c5938dfe | raise error on test running | CartoDB/bigmetadata,CartoDB/bigmetadata,CartoDB/bigmetadata,CartoDB/bigmetadata | tests/util.py | tests/util.py | '''
Util functions for tests
'''
from subprocess import check_output
try:
check_output('dropdb test', shell=True)
except Exception as exc:
pass
check_output('createdb test -E UTF8 -T template0', shell=True)
check_output('psql -c "CREATE EXTENSION IF NOT EXISTS postgis"', shell=True)
from tasks.util import... | '''
Util functions for tests
'''
from subprocess import check_output
try:
check_output('dropdb test', shell=True)
except Exception as exc:
pass
check_output('createdb test -E UTF8 -T template0', shell=True)
check_output('psql -c "CREATE EXTENSION IF NOT EXISTS postgis"', shell=True)
from tasks.util import... | bsd-3-clause | Python |
a9fb1bb437e27f0bcd5a382e82f100722d9f0688 | Fix index. Caught by Tudor. | floringogianu/categorical-dqn | data_structures/circular_buffer.py | data_structures/circular_buffer.py | from .transition import Transition
class CircularBuffer(object):
def __init__(self, capacity=100000):
self.capacity = capacity
self.memory = []
self.position = 0
def push(self, *args):
if len(self.memory) < self.capacity:
self.memory.append(Transition(*args))
... | from .transition import Transition
class CircularBuffer(object):
def __init__(self, capacity=100000):
self.capacity = capacity
self.memory = []
self.position = 0
def push(self, *args):
if len(self.memory) < self.capacity:
self.memory.append(Transition(*args))
... | mit | Python |
1ac2ba11d007188c809970b8af0575e488c5d891 | add abstract class BaseTvm | longaccess/longaccess-client,longaccess/longaccess-client,longaccess/longaccess-client | latvm/tvm.py | latvm/tvm.py | from latvm.policy import upload_policy
import os
import boto.sts
import json
class BaseTvm(object):
def get_upload_token(self, uid=None, secs=3600):
raise NotImplementedError("{}: must implement.".format(
self.__class__.__name__))
class MyTvm(BaseTvm):
credfile = os.path.expanduser('~/.... | from latvm.policy import upload_policy
import os
import boto.sts
import json
class MyTvm(object):
credfile = os.path.expanduser('~/.latvm.json')
def __init__(self, region='us-east-1', bucket='lastage', prefix='upload'):
self.region = region
self.bucket = bucket
self.federation_policy... | apache-2.0 | Python |
0e8e4b3b52c9b43ed8dc1d30306da807b6079c04 | Add utility function to convert FrozenDict to ConfigDict. | google-research/scenic | scenic/common_lib/common_utils.py | scenic/common_lib/common_utils.py | # Copyright 2022 The Scenic 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 applicable law or agreed to in w... | # Copyright 2022 The Scenic 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 applicable law or agreed to in w... | apache-2.0 | Python |
33a6926593e5e36a9d4e8a1ea8b28cabd6bb038d | Remove unnecessary lambda | Kuniwak/vint,RianFuro/vint,Kuniwak/vint,RianFuro/vint | vint/linting/formatter/json_formatter.py | vint/linting/formatter/json_formatter.py | import json
from pathlib import Path
class JSONFormatter(object):
def __init__(self, env):
pass
def format_violations(self, violations):
return json.dumps(self._normalize_violations(violations))
def _normalize_violations(self, violations):
line_number = lambda violation: viola... | import json
from pathlib import Path
class JSONFormatter(object):
def __init__(self, env):
pass
def format_violations(self, violations):
return json.dumps(self._normalize_violations(violations))
def _normalize_violations(self, violations):
line_number = lambda violation: viola... | mit | Python |
5a22b63f078bd9cb1348708246a47704a51d545a | install brew and brew apps | danielcorreia/dotfiles,danielcorreia/dotfiles | bootstrap.py | bootstrap.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import subprocess
commands = {
'ssh_key': "ssh-keygen -t rsa -b 4096 -C '{email}'"
}
DOTFILES = [
'.aliases',
'.bash_profile',
'.bash_prompt',
'.exports',
'.functions',
'.gitconfig',
'.gitignore',
'.hushlogin',
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import subprocess
commands = {
'ssh_key': "ssh-keygen -t rsa -b 4096 -C '{email}'"
}
DOTFILES = [
'.aliases',
'.bash_profile',
'.bash_prompt',
'.exports',
'.functions',
'.gitconfig',
'.gitignore',
'.hushlogin',
... | mit | Python |
c6ef8caccfa00c788b1bffa4b3b0ceced22ef4c7 | add /opt/homebrew/bin to path in bootstrap | kbd/setup,kbd/setup,kbd/setup,kbd/setup,kbd/setup | bootstrap.py | bootstrap.py | #!/usr/bin/env python3
"""Bootstrap the setup tool.
What this does (only intended for Mac atm):
* git check out the project into ~/setup
* run setup init
You should be able to run this with curl | python shenanigans.
"""
import os
import subprocess
from pathlib import Path
REPO_URL = 'https://github.com/kbd/setup... | #!/usr/bin/env python3
"""Bootstrap the setup tool.
What this does (only intended for Mac atm):
* git check out the project into ~/setup
* run setup init
You should be able to run this with curl | python shenanigans.
"""
import os
import subprocess
from pathlib import Path
REPO_URL = 'https://github.com/kbd/setup... | mit | Python |
a2dc78f54f65fa67d6d02e9fcc563752efd67509 | Fix bad usage of namespace alias change | dato-code/numpy,nbeaver/numpy,dwillmer/numpy,KaelChen/numpy,mingwpy/numpy,kiwifb/numpy,jakirkham/numpy,ekalosak/numpy,has2k1/numpy,Srisai85/numpy,ewmoore/numpy,MichaelAquilina/numpy,ContinuumIO/numpy,mattip/numpy,jorisvandenbossche/numpy,pelson/numpy,brandon-rhodes/numpy,has2k1/numpy,Yusa95/numpy,mortada/numpy,Eric89GX... | numpy/numarray/util.py | numpy/numarray/util.py | import os
import numpy as np
__all__ = ['MathDomainError', 'UnderflowError', 'NumOverflowError',
'handleError', 'get_numarray_include_dirs']
class MathDomainError(ArithmeticError):
pass
class UnderflowError(ArithmeticError):
pass
class NumOverflowError(OverflowError, ArithmeticError):
pass
... | import os
import numpy as np
__all__ = ['MathDomainError', 'UnderflowError', 'NumOverflowError',
'handleError', 'get_numarray_include_dirs']
class MathDomainError(ArithmeticError):
pass
class UnderflowError(ArithmeticError):
pass
class NumOverflowError(OverflowError, ArithmeticError):
pass
... | bsd-3-clause | Python |
bf3fc0b7d2dcfd51e01561006798cac4bd2b97e8 | Add a good docstring from simple_broker.serach. | ericdill/datamuxer,NSLS-II/datamuxer,ericdill/databroker,danielballan/datamuxer,tacaswell/dataportal,danielballan/dataportal,NSLS-II/dataportal,danielballan/dataportal,tacaswell/dataportal,NSLS-II/dataportal,danielballan/datamuxer,ericdill/datamuxer,ericdill/databroker | databroker/broker/simple_broker.py | databroker/broker/simple_broker.py | from __future__ import print_function
import six # noqa
from collections import defaultdict
from .. import sources
# Note: Invoke contents of sources at the func/method level so that it
# respects runtime switching between real and dummy sources.
def search(beamline_id, start_time, end_time):
"""
Get data fr... | from __future__ import print_function
import six # noqa
from collections import defaultdict
from .. import sources
# Note: Invoke contents of sources at the func/method level so that it
# respects runtime switching between real and dummy sources.
def search(beamline_id, start_time, end_time):
"Get events from th... | bsd-3-clause | Python |
928db7e8bc45a66d0f130c3c2e5a14bd03e10295 | Correct add migration script | fzadow/CATMAID,fzadow/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,htem/CATMAID,htem/CATMAID,htem/CATMAID | scripts/database/add-migration.py | scripts/database/add-migration.py | #!/usr/bin/env python
# This script should add a template migration to the migrations.php
# file. If you provide a git commit ID it uses the commit date from
# that commit for the timestamp. Otherwise, it uses the current time.
import sys
import os
import subprocess
import datetime
import dateutil.parser
import pyt... | #!/usr/bin/env python
# This script should add a template migration to the migrations.php
# file. If you provide a git commit ID it uses the commit date from
# that commit for the timestamp. Otherwise, it uses the current time.
import sys
import os
import subprocess
import datetime
import dateutil.parser
import pyt... | agpl-3.0 | Python |
28d266edb912d65b86898435ac4777d635c494fd | add .format() support | logentries/le_lambda,omgapuppy/le_lambda | le_config.py | le_config.py | # Logentries tokens
# This token is used to associate log files in AWS S3 to a log in your Logentries account.
log_token = "{YOUR_LOG_TOKEN}"
# You can supply an optional token to log activity to a log on Logentries and any errors from this script.
# This is optional, it is recommended you use one log file/token for a... | # Logentries tokens
# This token is used to associate log files in AWS S3 to a log in your Logentries account.
log_token = "YOUR_LOG_TOKEN"
# You can supply an optional token to log activity to a log on Logentries and any errors from this script.
# This is optional, it is recommended you use one log file/token for all... | mit | Python |
41c1bbdf55a047bb2b6788161c06ceec075ccc91 | Put eval function inside a class | handrake/brainfuck | brainfuck.py | brainfuck.py | import sys
from getch import getch
commands = '><+-.,[]'
class BrainfuckInterpreter:
@staticmethod
def find_matching_paren(source, c):
paren = 0
d = {'[':']', ']':'['}
for k in range(len(source)):
if source[k]==c:
paren += 1
elif source[k]==d[c]:... | import sys
from getch import getch
commands = '><+-.,[]'
def find_matching_paren(source, c):
paren = 0
d = {'[':']', ']':'['}
for k in range(len(source)):
if source[k]==c:
paren += 1
elif source[k]==d[c]:
if paren == 0:
return k
paren -= ... | bsd-3-clause | Python |
05214e7e50dcf52ecbf3eab0721a5b7d60e2be4c | fix TableViewRowModel locator | Webstr-framework/webstr | webstr/patternfly/contentviews/models.py | webstr/patternfly/contentviews/models.py | """
Page models for patternfly Content Views:
* https://www.patternfly.org/list-view/
* https://www.patternfly.org/patterns/table-view/
"""
# Copyright 2016 Red Hat
#
# 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... | """
Page models for patternfly Content Views:
* https://www.patternfly.org/list-view/
* https://www.patternfly.org/patterns/table-view/
"""
# Copyright 2016 Red Hat
#
# 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... | apache-2.0 | Python |
1c61feeab3ecd57c3f0092d34b7e5491e591db7f | add error type for User Input problems | fretboardfreak/space,fretboardfreak/space | lib/error.py | lib/error.py | # Copyright 2015 Curtis Sand
#
# 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 Curtis Sand
#
# 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 |
fed47f83bf62304e45abd011a79d81aee4f80c9f | remove some newlines | tantonas/pythonServer | server.py | server.py | from __future__ import print_function
import socket
import time
import threading
import sys
def newConn(c, addr):
while(True):
try:
c.getpeername()
except:
ip = findClientBySocket(c)
sys.stdout.write(str(ip) + " has disconnected...\n>")
sys.stdout.flush()
return;
def getIP():
s = socket.socket()
... | from __future__ import print_function
import socket
import time
import threading
import sys
def newConn(c, addr):
while(True):
try:
c.getpeername()
except:
ip = findClientBySocket(c)
sys.stdout.write(str(ip) + " has disconnected...\n>")
sys.stdout.flush()
return;
def getIP():
s = socket.socket(... | mit | Python |
9162650478bbfba27a6d1285ed222b5430943ba5 | Remove unused imports. | andela-akiura/bucketlist | server.py | server.py | """This module runs the api server."""
from app import flask_app, db
from app.models import User, BucketList, BucketListItem
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.restful import Api
from app.api_v1.resources import IndexResource, \
BucketLis... | """This module runs the api server."""
import os
from app import flask_app, db
from app.models import User, BucketList, BucketListItem
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.restful import Resource, Api
from app.api_v1.resources import IndexResou... | mit | Python |
4eb3fcd165eb687050f17ed62d79bf9b40944897 | Remove unused template variables | sassy/MusicPi,gmkou/MusicPi,sassy/MusicPi,gmkou/MusicPi | server.py | server.py | #!/usr/bin/env python
#coding:utf-8
import bottle
bottle.debug(True)
from bottle import route, run, template, error, redirect
import subprocess, sys, re
channels = ["main", "random", "rock", "metal", "indie"]
stream_name_to_url = {
"main": "http://173.231.136.91:8000/",
"random": "http://173.231.136.91:8050/"... | #!/usr/bin/env python
#coding:utf-8
import bottle
bottle.debug(True)
from bottle import route, run, template, error, redirect
import subprocess, sys, re
channels = ["main", "random", "rock", "metal", "indie"]
stream_name_to_url = {
"main": "http://173.231.136.91:8000/",
"random": "http://173.231.136.91:8050/"... | mit | Python |
fc876f0469070d3ab693a74a0333dbff0714dcf4 | Fix port bug | shiraco/robot-presen,shiraco/robot-presen,shiraco/remote_presen,shiraco/remote_presen,shiraco/robot-presen,shiraco/remote_presen,shiraco/robot-presen,shiraco/remote_presen | server.py | server.py | # coding:utf-8
import os
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
class IndexHandler(tornado.web.RequestHandler):
def get(self):
self.render("index.html")
class Application(tornado.web.Application):
def __i... | # coding:utf-8
import os
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
class IndexHandler(tornado.web.RequestHandler):
def get(self):
self.render("index.html")
class Application(tornado.web.Application):
def __i... | mit | Python |
7cda2fe25dd65b3120f177d331088ce7733d1c6c | Increase request buffer as workaround for stackoverflow in asyncio | azzuwan/PyApiServerExample | server.py | server.py | from japronto import Application
from services.articles import ArticleService
from mongoengine import *
article_service = ArticleService()
def index(req):
"""
The main index
"""
return req.Response(text='You reached the index!')
def articles(req):
"""
Get alll articles
"""
docs = article_service.all()
ret... | from japronto import Application
from services.articles import ArticleService
from mongoengine import *
article_service = ArticleService()
def index(req):
"""
The main index
"""
return req.Response(text='You reached the index!')
def articles(req):
"""
Get alll articles
"""
docs = article_service.all()
ret... | mit | Python |
67731dd7eed06792df453d352e7f33db43d73e34 | Support all protocols | tulhan/skensa | skensa.py | skensa.py | #!python
import csv
import uuid
import socket
import collections
Cipher = collections.namedtuple('Cipher', 'code, name, kx, au, enc, bits, mac')
with open('ciphers') as csvfile:
rows = csv.reader(csvfile, delimiter=' ')
tls_ciphers = []
for row in rows:
tls_ciphers.append(Cipher._mak... | #!python
import csv
import uuid
import socket
import collections
Cipher = collections.namedtuple('Cipher', 'code, name, kx, au, enc, bits, mac')
with open('ciphers') as csvfile:
rows = csv.reader(csvfile, delimiter=' ')
tls_ciphers = []
for row in rows:
tls_ciphers.append(Cipher._mak... | bsd-2-clause | Python |
c40489426fbd08532afbb9c1af30549ea1410cb9 | Make file more readable | matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo | web/problems/urls.py | web/problems/urls.py | from django.conf.urls import patterns, url
from . import views
from views import ProblemUpdate
from views import ProblemCreate
urlpatterns = patterns(
'',
url(r'^(?P<problem_pk>\d+)/solutions/$',
views.problem_solution,
name='problem_solution'),
url(r'^(?P<problem_pk>\d+)/download/$',
... | from django.conf.urls import patterns, url
from . import views
from views import ProblemUpdate
from views import ProblemCreate
urlpatterns = patterns('',
url(r'^(?P<problem_pk>\d+)/solutions/$', views.problem_solution, name='problem_solution'),
url(r'^(?P<problem_pk>\d+)/download/$', views.problem_attempt_fil... | agpl-3.0 | Python |
8cc8f9a1535a2361c27e9411f9163ecd2a9958d5 | Set mongodb settings using config.py | CuppenResearch/vcf-explorer,CuppenResearch/vcf-explorer,CuppenResearch/vcf-explorer,CuppenResearch/vcf-explorer | utils/__init__.py | utils/__init__.py |
import pymongo
import config #config.py
connection = pymongo.MongoClient(host=config.MONGODB_HOST, port=config.MONGODB_PORT)
db = connection[config.MONGODB_NAME]
import database
import parse_vcf
import filter_vcf
import query
|
import pymongo
connection = pymongo.MongoClient("mongodb://localhost")
db = connection.vcf_explorer
import database
import parse_vcf
import filter_vcf
import query
| mit | Python |
3af7a21916319746abc5cc7faa2ac0a399799234 | Remove bunk type annotation | Naught0/qtbot | utils/paginate.py | utils/paginate.py | import discord
import asyncio
from typing import List, Tuple
from discord.ext.commands import Context
EMOJIS = {"back": "⬅️", "forward": "➡️"}
async def paginate(ctx: Context, embeds: List[discord.Embed], timeout=30.0) -> None:
msg = ctx.message
current_index = 0
while True:
try:
react... | import discord
import asyncio
from typing import List, Tuple
from discord.ext.commands import Context
EMOJIS = {"back": "⬅️", "forward": "➡️"}
async def paginate(ctx: Context, embeds: List[discord.Embed], timeout=30.0) -> None:
msg = ctx.message
current_index = 0
while True:
try:
(reac... | mit | Python |
5df5de3efe3f9c4b8794752822e61009c775d2e0 | Add print request_uri helper. | why2pac/dp-tornado,why2pac/dp-tornado,why2pac/dp-tornado,why2pac/dp-tornado | engine/plugin/ui_methods.py | engine/plugin/ui_methods.py | # -*- coding: utf-8 -*-
#
# dp for Tornado
# YoungYong Park (youngyongpark@gmail.com)
# 2014.11.21
#
import tornado.escape
def trim(c, t):
return t.strip()
def nl2br(c, t, escape=True):
if not t:
return ''
t = tornado.escape.xhtml_escape(t) if escape else t
return t.replace('\r\... | # -*- coding: utf-8 -*-
#
# dp for Tornado
# YoungYong Park (youngyongpark@gmail.com)
# 2014.11.21
#
import tornado.escape
def trim(c, t):
return t.strip()
def nl2br(c, t, escape=True):
if not t:
return ''
t = tornado.escape.xhtml_escape(t) if escape else t
return t.replace('\r\n... | mit | Python |
10c00973decae74d84bea996a11de06de2c6f91d | correct content type for ujson renderer | MLR-au/esrc-cnex,MLR-au/esrc-cnex,MLR-au/esrc-cnex | service/app/renderers/__init__.py | service/app/renderers/__init__.py | import msgpack
class MsgPackRenderer(object):
def __init__(self, info):
pass
def __call__(self, value, system):
request = system.get('request')
if request is not None:
response = request.response
ct = response.content_type
if ct == response.default_co... | import msgpack
class MsgPackRenderer(object):
def __init__(self, info):
pass
def __call__(self, value, system):
request = system.get('request')
if request is not None:
response = request.response
ct = response.content_type
if ct == response.default_co... | bsd-3-clause | Python |
2e12d179b95f88b38ccdc2c600b4262cfdc54111 | Switch to redistogo | idan/telostats-tiles | tileserver.py | tileserver.py | import os
import TileStache
cache = {
'name': 'Redis',
'url': os.getenv('REDISTOGO_URL', 'redis://localhost:6379')
}
config_dict = {
'cache': cache,
'layers': {
'telaviv': {
'provider': {'name': 'mbtiles', 'tileset': 'Telostats.mbtiles'},
'projection': 'spherical mercator',
'ma... | import os
import TileStache
cache = {
'name': 'Redis',
'url': os.getenv('OPENREDIS_URL', 'redis://localhost:6379')
}
config_dict = {
'cache': cache,
'layers': {
'telaviv': {
'provider': {'name': 'mbtiles', 'tileset': 'Telostats.mbtiles'},
'projection': 'spherical mercator',
'ma... | bsd-3-clause | Python |
0d368a165fba0511e67f433a2f0f19286a1be734 | fix pep8 | virgilio/timtec,mupi/tecsaladeaula,mupi/timtec,mupi/tecsaladeaula,virgilio/timtec,mupi/escolamupi,mupi/escolamupi,mupi/tecsaladeaula,mupi/timtec,AllanNozomu/tecsaladeaula,AllanNozomu/tecsaladeaula,virgilio/timtec,mupi/timtec,virgilio/timtec,GustavoVS/timtec,hacklabr/timtec,hacklabr/timtec,GustavoVS/timtec,mupi/timtec,G... | core/management/commands/create_student_and_professor.py | core/management/commands/create_student_and_professor.py | from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
User = get_user_model()
class Command(BaseCommand):
args = ''
help = 'Adds a user named student and a user named professor with password = x'
def handle(self, *... | from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
User = get_user_model()
class Command(BaseCommand):
args = ''
help = 'Adds a user named student and a user named professor with password = x'
def h... | agpl-3.0 | Python |
823b3dbc7b22bc0cb1d2275552d723b10658fdb6 | Fix tests | healthchecks/healthchecks,iphoting/healthchecks,iphoting/healthchecks,healthchecks/healthchecks,healthchecks/healthchecks,iphoting/healthchecks,healthchecks/healthchecks,iphoting/healthchecks | hc/front/tests/test_add_opsgenie.py | hc/front/tests/test_add_opsgenie.py | import json
from hc.api.models import Channel
from hc.test import BaseTestCase
class AddOpsGenieTestCase(BaseTestCase):
def setUp(self):
super().setUp()
self.url = "/projects/%s/add_opsgenie/" % self.project.code
def test_instructions_work(self):
self.client.login(username="alice@exa... | import json
from hc.api.models import Channel
from hc.test import BaseTestCase
class AddOpsGenieTestCase(BaseTestCase):
def setUp(self):
super().setUp()
self.url = "/projects/%s/add_opsgenie/" % self.project.code
def test_instructions_work(self):
self.client.login(username="alice@exa... | bsd-3-clause | Python |
c1734f78814093dd0e3c503a6826f73ee88974a6 | Add application context to celery worker | sndrtj/varda,varda/varda | varda/worker.py | varda/worker.py | """
Helper module for celery to run a worker.
.. moduleauthor:: Martijn Vermaat <martijn@vermaat.name>
.. Licensed under the MIT license, see the LICENSE file.
"""
from . import celery, create_app
create_app().app_context().push()
| """
Helper module for celery to run a worker.
.. moduleauthor:: Martijn Vermaat <martijn@vermaat.name>
.. Licensed under the MIT license, see the LICENSE file.
"""
from . import celery, create_app
create_app()
| mit | Python |
1092f873fa159d2c18b06e2774261d03c2c6eb52 | Fix requirement version | indico/indico-plugins,ThiefMaster/indico-plugins,indico/indico-plugins,ThiefMaster/indico-plugins,ThiefMaster/indico-plugins,indico/indico-plugins,indico/indico-plugins,ThiefMaster/indico-plugins | vc_vidyo/setup.py | vc_vidyo/setup.py | # This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | # This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | mit | Python |
3e454e4e3a6487a5a90fe35894b9a1fe7e4c47d5 | fix to example for python 2.7 (it did relative imports) | TargetHolding/django-ladon | example/calculator/ladon.py | example/calculator/ladon.py | from __future__ import absolute_import # only needed for python 2.7
from ladon.ladonizer import ladonize
class Calculator(object):
@ladonize(int,int,rtype=int)
def add(self,a,b):
return a+b
| from ladon.ladonizer import ladonize
class Calculator(object):
@ladonize(int,int,rtype=int)
def add(self,a,b):
return a+b
| mit | Python |
4452668c764fdd991bf51bae7d655247b036526e | Fix for <response> | CHT5/program-y,JustArchi/program-y,JustArchi/program-y,CHT5/program-y,JustArchi/program-y,CHT5/program-y | src/programy/parser/template/nodes/response.py | src/programy/parser/template/nodes/response.py | """
Copyright (c) 2016 Keith Sterling
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute,... | """
Copyright (c) 2016 Keith Sterling
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute,... | mit | Python |
4a8da13c237615c59dc599f3d089c919aa9d69bc | Fix pkgmanagers call to use the exception. | juliendelplanque/raspirestmonitor | server/raspi_rest_server.py | server/raspi_rest_server.py | #!/bin/python3
""" This script contains the implementation of the REST api on the
raspberry-pi.
Author: Julien Delplanque
"""
import subprocess
from flask import Flask, jsonify, Response
from flask.ext.httpauth import HTTPBasicAuth
import sensors
import pkgmanagers
import systeminfo
from passwordmanagement imp... | #!/bin/python3
""" This script contains the implementation of the REST api on the
raspberry-pi.
Author: Julien Delplanque
"""
import subprocess
from flask import Flask, jsonify, Response
from flask.ext.httpauth import HTTPBasicAuth
import sensors
import pkgmanagers
import systeminfo
from passwordmanagement imp... | mit | Python |
f039fe3544dc4b60e4405f8d5f4d9274ddb792cf | Add RDF to namespaces | Brown-University-Library/vivo-data-management,Brown-University-Library/vivo-data-management | vdm/namespaces.py | vdm/namespaces.py | from utils import get_env
#Namespaces
from rdflib import Graph, Namespace
from rdflib.namespace import NamespaceManager, ClosedNamespace
from rdflib import RDFS, OWL, RDF
#setup namespaces
#code inspired by / borrowed from https://github.com/libris/librislod
#local data namespace
D = Namespace(get_env('DATA_NAMESPAC... | from utils import get_env
#Namespaces
from rdflib import Graph, Namespace
from rdflib.namespace import NamespaceManager, ClosedNamespace
from rdflib import RDFS, OWL
#setup namespaces
#code inspired by / borrowed from https://github.com/libris/librislod
#local data namespace
D = Namespace(get_env('DATA_NAMESPACE'))
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.