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 |
|---|---|---|---|---|---|---|---|---|
4c66010cf0cd4f763b362b6e84eb67d7ef1278b8 | Make "near" group optional in regex | jackbrewer/SublimeLinter-contrib-stylint | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jack Brewer
# Copyright (c) 2015 Jack Brewer
#
# License: MIT
"""This module exports the Stylint plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Stylint(NodeLinter):
"""Provides an inte... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jack Brewer
# Copyright (c) 2015 Jack Brewer
#
# License: MIT
"""This module exports the Stylint plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Stylint(NodeLinter):
"""Provides an inte... | mit | Python |
ba2db7713d4fbb929c26bf9ce848b0f7b420809d | fix typo | rizumu/bootmachine,rizumu/bootmachine,rizumu/bootmachine,rizumu/bootmachine | bootmachine/settings_tests.py | bootmachine/settings_tests.py | import os
"""
CONFIGURATION MANAGEMENT
"""
# salt
LOCAL_STATES_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)),
"configuration", "states/")
LOCAL_PILLARS_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)),
"configuration", "... | import os
"""
CONFIGURATION MANAGEMENT
"""
# salt
LOCAL_SALTSTATES_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)),
"configuration", "states/")
LOCAL_PILLARS_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)),
"configuration... | mit | Python |
6d4eb6ebfb03f974c2f6fb04992fc25e5a53ece9 | Change docstring | kyamagu/psd2svg | src/psd2svg/rasterizer/batik_rasterizer.py | src/psd2svg/rasterizer/batik_rasterizer.py | # -*- coding: utf-8 -*-
"""
Batik-based rasterizer module.
Download the latest batik rasterizer to use the module. Note Ubuntu 16.04LTS
package is broken and does not work.
Prerequisite:
wget http://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&\
filename=xmlgraphics/batik/binaries/batik-bin-1.9.tar... | # -*- coding: utf-8 -*-
"""
Batik-based rasterizer module.
Download the latest batik rasterizer to use the module. Note Ubuntu 16.04LTS
package is broken and does not work.
Prerequisite:
wget http://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&\
filename=xmlgraphics/batik/binaries/batik-bin-1.9.tar... | mit | Python |
73f49b5603802ccce3a9c4db0ee0b2eaa4bf0e7f | Update startup script (lyli.py) | felixbade/lyli,felixbade/lyli,felixbade/lyli | lyli.py | lyli.py | #!flask/bin/python
import logging
import werkzeug.serving
from app import app
import config
# we are behind a proxy. log the ip of the end-user, not the proxy.
# this will also work without the proxy
werkzeug.serving.WSGIRequestHandler.address_string = lambda self: self.headers.get('x-real-ip', self.client_address[0... | #!flask/bin/python
import logging
from os import fork
import werkzeug.serving
from app import app
pid = fork()
if pid > 0:
print('PID: %d' % pid)
exit(0)
elif pid < 0:
print('Could not fork: %d' % pid)
exit(1)
# we are behind a proxy. log the ip of the end-user, not the proxy.
# this will also work ... | artistic-2.0 | Python |
1b996bf797b5e1a0203054f11001771ede309b23 | remove dead code | fabianvf/scrapi,felliott/scrapi,alexgarciac/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,mehanig/scrapi,erinspace/scrapi | scrapi/harvesters/smithsonian.py | scrapi/harvesters/smithsonian.py | '''
Harvester for the Smithsonian Digital Repository for the SHARE project
Example API call: http://repository.si.edu/oai/request?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
import re
from scrapi.base import helpers
from scrapi.base import OAIHarvester
class SiHarvester(OAIHa... | '''
Harvester for the Smithsonian Digital Repository for the SHARE project
Example API call: http://repository.si.edu/oai/request?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
import re
from scrapi.base import helpers
from scrapi.base import OAIHarvester
class SiHarvester(OAIHa... | apache-2.0 | Python |
1b7e68c3bdfc2f43f754cc39e1f2f80bfa5bee80 | Add validate_log_translations flake8 check | grahamhayes/designate,ionrock/designate,ramsateesh/designate,cneill/designate-testing,cneill/designate,kiall/designate-py3,cneill/designate-testing,kiall/designate-py3,muraliselva10/designate,grahamhayes/designate,cneill/designate-testing,ramsateesh/designate,tonyli71/designate,kiall/designate-py3,openstack/designate,m... | designate/hacking/checks.py | designate/hacking/checks.py | # Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hp.com>
#
# 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/L... | # Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hp.com>
#
# 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/L... | apache-2.0 | Python |
54115d8ecd90da614a24bb910939001b37acd246 | Test pairwise combinations | ergs/transmutagen,ergs/transmutagen | transmutagen/tests/test_origen.py | transmutagen/tests/test_origen.py | import os
from itertools import combinations
import numpy as np
from ..tape9utils import origen_to_name
DATA_DIR = os.path.abspath(os.path.join(__file__, os.path.pardir,
os.path.pardir, os.path.pardir, 'docker', 'data'))
def load_data(datafile):
with open(datafile) as f:
return eval(f.read(), {'arra... | import os
import numpy as np
DATA_DIR = os.path.abspath(os.path.join(__file__, os.path.pardir,
os.path.pardir, os.path.pardir, 'docker', 'data'))
def load_data(datafile):
with open(datafile) as f:
return eval(f.read(), {'array': np.array})
def test_data():
for datafile in os.listdir(DATA_DIR):
... | bsd-3-clause | Python |
89560fd773d833a049824bfa8a7ccf4ce301bed4 | remove utils.push_dir | facebook/wangle,facebook/wangle,facebook/wangle | build/fbcode_builder/utils.py | build/fbcode_builder/utils.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
'Miscellaneous utility functions.'
import itertools
import logging
import os
import shutil
import subprocess
import sys
from contextlib import cont... | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
'Miscellaneous utility functions.'
import itertools
import logging
import os
import shutil
import subprocess
import sys
from contextlib import cont... | apache-2.0 | Python |
78ff5c0968e4867b550b4cb6dab70885e7119d11 | Use revert instead of reset, bloom-patch remove | nayomal/bloom,vrabaud/bloom | bloom/commands/patch/remove_cmd.py | bloom/commands/patch/remove_cmd.py | from __future__ import print_function
import sys
import argparse
from bloom.commands.patch.common import get_patch_config
from bloom.commands.patch.common import set_patch_config
from bloom.git import branch_exists
from bloom.git import checkout
from bloom.git import get_commit_hash
from bloom.git import get_current... | from __future__ import print_function
import sys
from argparse import ArgumentParser
from bloom.util import add_global_arguments
from bloom.util import execute_command
from bloom.util import handle_global_arguments
from bloom.logging import log_prefix
from bloom.logging import error
from bloom.logging import debug
fr... | bsd-3-clause | Python |
8a5e49876eae4f2d9bc8ced2fa2e2be0d24ddd68 | rollback to 1.7.0 release | runtimeco/mcuboot,runtimeco/mcuboot,runtimeco/mcuboot,runtimeco/mcuboot,ATmobica/mcuboot,ATmobica/mcuboot,ATmobica/mcuboot,runtimeco/mcuboot,ATmobica/mcuboot,ATmobica/mcuboot | scripts/imgtool/__init__.py | scripts/imgtool/__init__.py | # Copyright 2017-2020 Linaro Limited
#
# SPDX-License-Identifier: Apache-2.0
#
# 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 requ... | # Copyright 2017-2020 Linaro Limited
#
# SPDX-License-Identifier: Apache-2.0
#
# 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 requ... | apache-2.0 | Python |
ac3697fbb5202437d8285cacaba89dbaba30de69 | fix refactoring error | mcqueenjordan/chess-engine | util.py | util.py | import logging
A_THRU_H = 'ABCDEFGH'
# pre-compute an array mapping to algebraic notation
NUMERICAL_TO_ALGEBRAIC = ["{}{}".format(l, n) for n in range(8, 0, -1) for l in A_THRU_H]
# pre-compute a dict mapping to the index
ALGEBRAIC_TO_NUMERICAL = {a:n for n, a in enumerate(NUMERICAL_TO_ALGEBRAIC)}
TOP_LEFT_SQUARE =... | import logging
A_THRU_H = 'ABCDEFGH'
# pre-compute an array mapping to algebraic notation
NUMERICAL_TO_ALGEBRAIC = ["{}{}".format(l, n) for n in range(8, 0, -1) for l in A_THRU_H]
# pre-compute a dict mapping to the index
ALGEBRAIC_TO_NUMERICAL = {a:n for n, a in enumerate(NUMERICAL_TO_ALGEBRAIC)}
TOP_LEFT_SQUARE =... | mit | Python |
ae6bb29262421bcdb9f28bed8fce99517fa4ecc1 | Update tests. | armab/st2,alfasin/st2,tonybaloney/st2,StackStorm/st2,grengojbo/st2,peak6/st2,lakshmi-kannan/st2,jtopjian/st2,pinterb/st2,dennybaa/st2,dennybaa/st2,Plexxi/st2,nzlosh/st2,emedvedev/st2,emedvedev/st2,peak6/st2,nzlosh/st2,peak6/st2,armab/st2,alfasin/st2,armab/st2,StackStorm/st2,tonybaloney/st2,Itxaka/st2,Plexxi/st2,lakshmi... | st2common/tests/unit/test_content_utils.py | st2common/tests/unit/test_content_utils.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python |
65524f41729d1ddcda9ecb66947b85119c80cd18 | format util.py | jimklo/LearningRegistry,LearningRegistry/LearningRegistry,jimklo/LearningRegistry,jimklo/LearningRegistry,LearningRegistry/LearningRegistry,jimklo/LearningRegistry,jimklo/LearningRegistry,jimklo/LearningRegistry,LearningRegistry/LearningRegistry,LearningRegistry/LearningRegistry,jimklo/LearningRegistry,LearningRegistry... | util.py | util.py | #!/usr/bin/env python
import couchdb, sys
from oaipmh.client import Client
from oaipmh.common import Identify, Metadata, Header
from oaipmh.metadata import MetadataRegistry, oai_dc_reader , MetadataReader
def get_database(url,name):
try:
couch = couchdb.Server(url)
db = couch[name]
return d... | #!/usr/bin/env python
import couchdb, sys
from oaipmh.client import Client
from oaipmh.common import Identify, Metadata, Header
from oaipmh.metadata import MetadataRegistry, oai_dc_reader , MetadataReader
def get_database(url,name):
try:
couch = couchdb.Server(url)
db = couch[name]
return d... | apache-2.0 | Python |
58412bf4ac5adb78c82060c259803c745c52f861 | Bump version | OCA/stock-logistics-warehouse,OCA/stock-logistics-warehouse,OCA/stock-logistics-warehouse,OCA/stock-logistics-warehouse | stock_request_picking_type/__manifest__.py | stock_request_picking_type/__manifest__.py | # Copyright 2019 Open Source Integrators
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
'name': 'Stock Request Picking Type',
'summary': 'Add Stock Requests to the Inventory App',
'version': '12.0.1.1.0',
'license': 'LGPL-3',
'website': 'https://github.com/stock-logistics-w... | # Copyright 2019 Open Source Integrators
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
'name': 'Stock Request Picking Type',
'summary': 'Add Stock Requests to the Inventory App',
'version': '12.0.1.0.0',
'license': 'LGPL-3',
'website': 'https://github.com/stock-logistics-w... | agpl-3.0 | Python |
f887c7c5fc0be7e86ebddb28b6d785878ae88121 | Add projects to locals in projects_archive | Hackfmi/Diaphanum,Hackfmi/Diaphanum | projects/views.py | projects/views.py | from django.contrib.auth.decorators import login_required, permission_required
from django.shortcuts import render, get_object_or_404, redirect
from .models import Project
from .forms import ProjectForm, RestrictedProjectForm
@login_required
def add_project(request):
data = request.POST if request.POST else Non... | from django.contrib.auth.decorators import login_required, permission_required
from django.shortcuts import render, get_object_or_404, redirect
from .models import Project
from .forms import ProjectForm, RestrictedProjectForm
@login_required
def add_project(request):
data = request.POST if request.POST else Non... | mit | Python |
608f667f8d3a9faa8fc41777b2006c325afff61c | Fix var names. | PyBossa/app-translations | vote.py | vote.py | import enki
import json
e = enki.Enki('key', 'http://localhost:5001', 'translations')
e.get_all()
tasks = []
for t in e.tasks:
options = []
i = 0
for k in e.task_runs_df[t.id]['msgstr'].keys():
option = dict(task_run_id=None, msgstr=None)
option['task_run_id'] = k
option['msgstr... | import enki
import json
e = enki.Enki('key', 'http://localhost:5001', 'translations')
e.get_all()
tasks = []
for t in e.tasks:
options = []
i = 0
for k in e.task_runs_df[t.id]['msgid'].keys():
option = dict(task_run_id=None, msgid=None)
option['task_run_id'] = k
option['msgid'] ... | agpl-3.0 | Python |
3478bf108ce6992239c638e6e662a6e53204ae46 | Update wsgi.py for port | rmelly/flask-social-example,mattupstate/flask-social-example,talizon/flask-social-example,mattupstate/flask-social-example,mattupstate/flask-social-example,talizon/flask-social-example,rmelly/flask-social-example,rmelly/flask-social-example,talizon/flask-social-example | wsgi.py | wsgi.py | from app import create_app
application = create_app()
if __name__ == '__main__':
port = int(os.environ.get('PORT', 5000))
application.run(host='0.0.0.0', port=port) | from app import create_app
application = create_app()
if __name__ == '__main__':
application.run() | mit | Python |
6d643c1f4fca74e66513d0461fc358bb1dd21349 | add method to parse out [xml-handlers] section in process.cfg | funginstitute/patentprocessor,yngcan/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,nikken1/patentprocessor,yngcan/patentprocessor,yngcan/patentprocessor,funginstitute/patentprocessor | lib/config_parser.py | lib/config_parser.py | from ConfigParser import ConfigParser
defaults = {'parse': 'defaultparse',
'clean': 'True',
'consolidate': 'True',
'datadir': '/data/patentdata/patents/2013',
'dataregex': 'ipg\d{6}.xml',
'years': None,
'downloaddir' : None}
def extract_process_o... | from ConfigParser import ConfigParser
defaults = {'parse': 'defaultparse',
'clean': 'True',
'consolidate': 'True',
'datadir': '/data/patentdata/patents/2013',
'dataregex': 'ipg\d{6}.xml',
'years': None,
'downloaddir' : None}
def extract_process_o... | bsd-2-clause | Python |
4d5cc0dfc6f9f460cfc54dfebf2061428ae2ee97 | implement a removing of gitlab's objects | alces/gitlab-rest-client | crud.py | crud.py | '''
generic CRUD oparations for the gitlab's objects
'''
import http
class Crud():
def __init__(self, path):
self.path = path
'''
get an object by system's name and id
'''
def byId(self, sysNam, id):
return http.get(sysNam, '%s/%d' % (self.path, id))
'''
add a new instance of an object
'''
def add(self... | '''
generic CRUD oparations for the gitlab's objects
'''
import http
class Crud():
def __init__(self, path):
self.path = path
'''
get an object by system's name and id
'''
def byId(self, sysNam, id):
return http.get(sysNam, '%s/%d' % (self.path, id))
'''
add a new instance of an object
'''
def add(self... | bsd-2-clause | Python |
b694436d4d8b6ee0b4b4a8078e0b34f779b17751 | Set a nice app-icon | apaku/jenkinstray | main.py | main.py | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Andreas Pakulat <apaku@gmx.de>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Andreas Pakulat <apaku@gmx.de>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | bsd-2-clause | Python |
c5b7cf7cdd8a91162441a17f9d0b70db197249c0 | make main runnable | coast-team/dummy | main.py | main.py | #!/usr/bin/env python3
from collaborator.http_server.http_server import entryPoint
if __name__ == '__main__':
entryPoint()
|
from collaborator.http_server.http_server import entryPoint
if __name__ == '__main__':
entryPoint()
| agpl-3.0 | Python |
0dce5a6524ebc5020991ab301cd0b080ad27ddf6 | Fix self prefix | BeatButton/beattie-bot,BeatButton/beattie | main.py | main.py | #!/usr/bin/env python3
import asyncio
from datetime import datetime
import logging
import lzma
from pathlib import Path
import os
import sys
import tarfile
from discord.ext.commands import when_mentioned_or
import yaml
from bot import BeattieBot
try:
import uvloop
except ImportError:
pass
else:
asyncio.s... | #!/usr/bin/env python3
import asyncio
from datetime import datetime
import logging
import lzma
from pathlib import Path
import os
import sys
import tarfile
from discord.ext.commands import when_mentioned_or
import yaml
from bot import BeattieBot
try:
import uvloop
except ImportError:
pass
else:
asyncio.s... | mit | Python |
08650ad083e9ca4790ea627e8ab0ae670f7ef60b | Add merge function to rd_models (#3464) | angr/angr,angr/angr,angr/angr | angr/knowledge_plugins/key_definitions/rd_model.py | angr/knowledge_plugins/key_definitions/rd_model.py | from typing import Dict, Tuple, Set, Optional, TYPE_CHECKING
from .uses import Uses
from .live_definitions import LiveDefinitions
if TYPE_CHECKING:
from angr.knowledge_plugins.key_definitions.definition import Definition
# TODO: Make ReachingDefinitionsModel serializable
class ReachingDefinitionsModel:
"""
... | from typing import Dict, Tuple, Set, Optional, TYPE_CHECKING
from .uses import Uses
from .live_definitions import LiveDefinitions
if TYPE_CHECKING:
from angr.knowledge_plugins.key_definitions.definition import Definition
# TODO: Make ReachingDefinitionsModel serializable
class ReachingDefinitionsModel:
def ... | bsd-2-clause | Python |
44537a6496b1b67511ea7008418b6d1a7a30fdf4 | move the resolve cache into TLS | angr/claripy,chubbymaggie/claripy | claripy/result.py | claripy/result.py | import copy
import collections
import weakref
import threading
class Result(object):
def __init__(self, satness, model=None, approximation=False, backend_model=None):
self.sat = satness
self.model = model if model is not None else { }
self._tls = threading.local()
self._tls.backend... | import copy
import collections
import weakref
import threading
class Result(object):
def __init__(self, satness, model=None, approximation=False, backend_model=None):
self.sat = satness
self.model = model if model is not None else { }
self._tls = threading.local()
self._tls.backend... | bsd-2-clause | Python |
76648057b18055afc3724769aa9240eb477e4533 | Handle HJSON decode exception | elwinar/chronicler | main.py | main.py | """Usage: chronicler [-c CHRONICLE]
The Chronicler remembers…
Options:
-c, --chronicle CHRONICLE chronicle file to use [default: chronicle.txt]
"""
import docopt
import hjson
if __name__ == '__main__':
options = docopt.docopt(__doc__)
try:
chronicle = open(options['--chronicle'])
except F... | """Usage: chronicler [-c CHRONICLE]
The Chronicler remembers…
Options:
-c, --chronicle CHRONICLE chronicle file to use [default: chronicle.txt]
"""
from docopt import docopt
import hjson
if __name__ == '__main__':
options = docopt(__doc__)
try:
chronicle = open(options['--chronicle'])
exc... | unlicense | Python |
e80dce758a17c304fd938dda62f0a5e2e7d7bcec | change 1 | waseem18/gitpromote,waseem18/gitpromote | main.py | main.py |
import webapp2
import jinja2
import requests
import os
import sys
import time
import logging
import urllib2
import json
import re
from operator import itemgetter
from datetime import datetime
from google.appengine.ext import db
from webapp2_extras import sessions
from google.appengine.api import mail
#demo change1
t... |
import webapp2
import jinja2
import requests
import os
import sys
import time
import logging
import urllib2
import json
import re
from operator import itemgetter
from datetime import datetime
from google.appengine.ext import db
from webapp2_extras import sessions
from google.appengine.api import mail
template_dir =... | mit | Python |
db6203757d145923813c06b62ddf3739bac79991 | Update __init__.py | Tendrl/commons,r0h4n/commons | tendrl/commons/objects/cluster/__init__.py | tendrl/commons/objects/cluster/__init__.py | from tendrl.commons import objects
class Cluster(objects.BaseObject):
def __init__(self, integration_id=None, public_network=None,
cluster_network=None, node_configuration=None,
conf_overrides=None, node_identifier=None, sync_status=None,
last_sync=None, is_manag... | from tendrl.commons import objects
class Cluster(objects.BaseObject):
def __init__(self, integration_id=None, public_network=None,
cluster_network=None, node_configuration=None,
conf_overrides=None, node_identifier=None, sync_status=None,
last_sync=None, *args, *... | lgpl-2.1 | Python |
81943166d5b8c2606c1506bb1b6567fd0ce82282 | update check_dimension and webm supports | deepserket/telegram-bot-youtube-downloader | main.py | main.py | import os
import logging
from glob import glob
import youtube_dl
from telegram.ext import Updater, MessageHandler, Filters
from vid_utils import check_dimension
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
updater = Update... | import os
import logging
from glob import glob
import youtube_dl
from telegram.ext import Updater, MessageHandler, Filters
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
updater = Updater(token='TOKEN') # put here the b... | mit | Python |
d25f860c56e4e51203574ee8da4297c7aaa6195a | Bump version to 0.1.3 | TailorDev/django-tailordev-biblio,TailorDev/django-tailordev-biblio,TailorDev/django-tailordev-biblio,TailorDev/django-tailordev-biblio | td_biblio/__init__.py | td_biblio/__init__.py | """TailorDev Biblio
Scientific bibliography management with Django.
"""
__version__ = '0.1.3'
| """TailorDev Biblio
Scientific bibliography management with Django.
"""
__version__ = '0.1.2'
| mit | Python |
f06f81251d7c8d1a12e88d54c1856756979edb7d | Fix tests for Django 1.5 | stephenmcd/django-socketio,DESHRAJ/django-socketio,clarkperkins/django-socketio,Solution4Future/django-socketio,freylis/django-socketio,DESHRAJ/django-socketio,kostyll/django-socketio,stephenmcd/django-socketio,DESHRAJ/django-socketio,Solution4Future/django-socketio,vetional/django-socketio,pekermert/django-socketio,cl... | django_socketio/example_project/settings.py | django_socketio/example_project/settings.py |
import os, sys
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
full_path = lambda *parts: os.path.join(PROJECT_ROOT, *parts)
example_path = full_path("..", "..")
if example_path not in sys.path:
sys.path.append(example_path)
DEBUG = T... |
import os, sys
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
full_path = lambda *parts: os.path.join(PROJECT_ROOT, *parts)
example_path = full_path("..", "..")
if example_path not in sys.path:
sys.path.append(example_path)
DEBUG = T... | bsd-2-clause | Python |
3fbbba8dae5c97cedf414eea8a39482c01a269e6 | Add `debug=True` to avoid restarting the server after each change | danoneata/video_annotation,danoneata/video_annotation,danoneata/video_annotation | main.py | main.py |
import io
import json
import logging
import os
import pdb
import traceback
from logging import config
from functools import wraps
from flask import (
Flask,
render_template,
request,
send_file,
send_from_directory,
)
app = Flask(__name__)
config.fileConfig('logger.conf')
logger = logging.getLo... |
import io
import json
import logging
import os
import pdb
import traceback
from logging import config
from functools import wraps
from flask import (
Flask,
render_template,
request,
send_file,
send_from_directory,
)
app = Flask(__name__)
config.fileConfig('logger.conf')
logger = logging.getLo... | mit | Python |
a658b1268f8a2a31d3a5cb56ab0b12f8290d474c | Add functions to calculate cluster statistics averages over many realizations | cerisola/fiscomp,cerisola/fiscomp,cerisola/fiscomp | percolation/analysis/clusters.py | percolation/analysis/clusters.py | import numpy as np
# % Single value % #
def cluster_densities(count, L):
return count/(L*L)
def percolating_cluster_mass(size, percolated):
idx_percolated = np.where(percolated > 0)[0]
if idx_percolated.size == 0:
return 0
return np.average(size[idx_percolated], weights=percolated[idx_percola... | import numpy as np
# % Single value % #
def cluster_densities(count, L):
return count/(L*L)
def percolating_cluster_mass(size, percolated):
idx_percolated = np.where(percolated > 0)[0]
if idx_percolated.size == 0:
return 0
return np.average(size[idx_percolated], weights=percolated[idx_percola... | mit | Python |
7119c07b422f823f40939691fa84f0c2581ae70d | Fix the REST module name. | ohsu-qin/qipipe | test/unit/helpers/test_qiprofile_helper.py | test/unit/helpers/test_qiprofile_helper.py | import datetime
import pytz
from nose.tools import (assert_is_none)
from qipipe.helpers.qiprofile_helper import QIProfile
from qiprofile_rest.models import Project
from test import project
from test.helpers.logging_helper import logger
SUBJECT = 'Breast099'
"""The test subject."""
SESSION = 'Session01'
"""The test s... | import datetime
import pytz
from nose.tools import (assert_is_none)
from qipipe.helpers.qiprofile_helper import QIProfile
from qiprofile.models import Project
from test import project
from test.helpers.logging_helper import logger
SUBJECT = 'Breast099'
"""The test subject."""
SESSION = 'Session01'
"""The test sessio... | bsd-2-clause | Python |
6a8f7b3ddf6c43565efeda5d21de714808e98785 | Add sample yaml data | SaltyCharles/Nova,HubbleStack/Nova,avb76/Nova | hubblestack_nova/modules/netstat.py | hubblestack_nova/modules/netstat.py | # -*- encoding: utf-8 -*-
'''
Hubble Nova plugin for FreeBSD pkgng audit
:maintainer: HubbleStack
:maturity: 20160623
:platform: Unix
:requires: SaltStack
Sample data for the netstat whitelist:
.. code-block:: yaml
netstat:
ssh:
address: 0.0.0.0:22
another_identifier:
add... | # -*- encoding: utf-8 -*-
'''
Hubble Nova plugin for FreeBSD pkgng audit
:maintainer: HubbleStack
:maturity: 20160623
:platform: Unix
:requires: SaltStack
'''
from __future__ import absolute_import
import copy
import logging
import salt.utils
log = logging.getLogger(__name__)
def __virtual__():
if 'network.ne... | apache-2.0 | Python |
1f72d0fc0fb8222ca8ffb69c164e4d118e1a9d1d | update version | wavky/ManHourCalendar | meta.py | meta.py | #!/usr/bin/env python3
# @Time : 17-9-10 01:08
# @Author : Wavky Huang
# @Contact : master@wavky.com
# @File : meta.py
"""
"""
PROJECT_NAME = 'ManHourCalendar'
VERSION = '0.9.1b2'
AUTHOR = 'Wavky Huang'
AUTHOR_EMAIL = 'master@wavky.com'
| #!/usr/bin/env python3
# @Time : 17-9-10 01:08
# @Author : Wavky Huang
# @Contact : master@wavky.com
# @File : meta.py
"""
"""
PROJECT_NAME = 'ManHourCalendar'
VERSION = '0.9.1a2'
AUTHOR = 'Wavky Huang'
AUTHOR_EMAIL = 'master@wavky.com'
| mit | Python |
a1d9247e0d72a468e0fa70793501cd2e7dfec854 | Update wsgi.py. | SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools | clintools/wsgi.py | clintools/wsgi.py | import os
import sys
import site
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('/home/washu/.virtualenvs/osler/local/lib/python2.7/site-packages')
# Add the app's directory to the PYTHONPATH
sys.path.append('/home/washu/clintools')
sys.path.append('/home/washu/clintools/clintools')
os... | """
WSGI config for clintools project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | mit | Python |
937aa61393f46167806c1f4913c42e873ea1c435 | fix misc.lastfile() | StagPython/StagPy | misc.py | misc.py | """miscellaneous definitions"""
from math import ceil
import os.path
def file_name(args, par_type):
"""returns file name format for any time step"""
return args.name + '_' + par_type + '{:05d}'
def path_fmt(args, par_type):
"""returns full path format for any time step"""
return os.path.join(args... | """miscellaneous definitions"""
from math import ceil
import os.path
def file_name(args, par_type):
"""returns file name format for any time step"""
return args.name + '_' + par_type + '{:05d}'
def path_fmt(args, par_type):
"""returns full path format for any time step"""
return os.path.join(args.... | apache-2.0 | Python |
6fdba909f03090649bee2255770a570114ed117f | Fix lint errors | reubano/amzn-search-api,reubano/amzn-search-api,reubano/amzn-search-api | manage.py | manage.py | #!/usr/bin/env python
import os.path as p
from subprocess import call
from flask.ext.script import Manager
from app import create_app
manager = Manager(create_app)
manager.add_option('-m', '--cfgmode', dest='config_mode', default='Development')
manager.add_option('-f', '--cfgfile', dest='config_file', type=p.abspath)... | #!/usr/bin/env python
import os.path as p
from subprocess import call, check_call
from flask.ext.script import Manager
from app import create_app
manager = Manager(create_app)
manager.add_option('-m', '--cfgmode', dest='config_mode', default='Development')
manager.add_option('-f', '--cfgfile', dest='config_file', typ... | mit | Python |
4c72fd4af23d78c3b62ebd24cfbe6a18fc098a5e | remove $Id$ svn line | jctincan/tsadm-webapp,jctincan/tsadm-webapp,jctincan/tsadm-webapp | manage.py | manage.py | #!/usr/bin/env python3
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tsadm.settings")
os.environ.setdefault("TSADM_DEV", "true")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python3
# $Id: manage.py 11966 2014-10-23 22:59:19Z jrms $
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tsadm.settings")
os.environ.setdefault("TSADM_DEV", "true")
from django.core.management import execute_from_command_line
execute_fr... | bsd-3-clause | Python |
3bf50c7298b7634886d510ef07dfe13dda067247 | Fix manage.py pep8 | levlaz/braindump,iamgroot42/braindump,levlaz/braindump,levlaz/braindump,iamgroot42/braindump,levlaz/braindump,iamgroot42/braindump,iamgroot42/braindump | manage.py | manage.py | #!/usr/bin/env python
import os
COV = None
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='app/*')
COV.start()
if os.path.exists('.env'):
print('Importing environment from .env...')
for line in open('.env'):
var = line.strip().split('=')
... | #!/usr/bin/env python
import os
COV = None
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='app/*')
COV.start()
if os.path.exists('.env'):
print('Importing environment from .env...')
for line in open('.env'):
var = line.strip().split('=')
... | mit | Python |
a3923263a100dd39772533aa37ea7ff956e6c874 | Make app accessible outside the development machine. | jaapverloop/massa | manage.py | manage.py | # -*- coding: utf-8 -*-
from flask.ext.script import Manager, Server
from yoyo import create_app
manager = Manager(create_app)
manager.add_option('-c', '--configfile', dest='configfile', required=False)
manager.add_command('runserver', Server(
use_debugger = True,
use_reloader = True,
host = '0.0.0.0',
... | # -*- coding: utf-8 -*-
from flask.ext.script import Manager, Server
from yoyo import create_app
manager = Manager(create_app)
manager.add_option('-c', '--configfile', dest='configfile', required=False)
if __name__ == '__main__':
manager.run()
| mit | Python |
08b54819a56d9bfc65225045d97a4c331f9a3e11 | Fix model import needed by create_all() | LandRegistry/login-api,LandRegistry/login-api | manage.py | manage.py | #!/usr/bin/env python3
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from service import app, db
# db.create_all() needs all models to be imported explicitly (not *)
from service.db_access import User
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', ... | #!/usr/bin/env python3
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from service import app, db
# db.create_all() needs all models to be imported
from service.db_access import *
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
if _... | mit | Python |
b96b8b79a792cc900cdcdac6325aa3a94fe54697 | Add read_dotenv function to manage.py | andela-kndungu/compshop,andela-kndungu/compshop,kevgathuku/compshop,andela-kndungu/compshop,kevgathuku/compshop,andela-kndungu/compshop,kevgathuku/compshop,kevgathuku/compshop | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
import dotenv
dotenv.read_dotenv()
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| bsd-3-clause | Python |
643e95765d4308661d95ee2f7360ff3f09c90bd5 | use string.format() | levigroker/docker-postfix,Grokling/docker-postfix,Pojo-ict/docker-postfix,lukas-hetzenecker/docker-postfix,freshbooks/docker-postfix,sendgrid/docker-postfix,synctree/docker-postfix-s3,tya/docker-postfix,nzherald/docker-postfix,vaultsystems/docker-postfix,catatnight/docker-postfix,lucorsel/docker-postfix,HonestDollar/do... | manage.py | manage.py | #!/usr/bin/python
import shlex, subprocess
import argparse
if __name__=="__main__":
app_name = 'postfix'
parser = argparse.ArgumentParser(description='Manage %s container' % app_name)
parser.add_argument("execute", choices=['create','start','stop','restart','delete'], help='manage %s server' % app_name)
ar... | #!/usr/bin/python
import shlex, subprocess
import argparse
if __name__=="__main__":
parser = argparse.ArgumentParser(description='Manage postfix container')
parser.add_argument("execute", choices=['create','start','stop','restart','delete'], help="manage postfix server")
args = parser.parse_args()
class bcol... | mit | Python |
9a2c7e186276f58ec5165323a33a316d9ca80fc0 | correct malcode feed | yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti | Malcom/feeds/malcode.py | Malcom/feeds/malcode.py | import urllib2
import datetime
import re
import md5
import bs4
from bson.objectid import ObjectId
from bson.json_util import dumps
from Malcom.model.datatypes import Evil, Url
from Malcom.feeds.feed import Feed
import Malcom.auxiliary.toolbox as toolbox
class MalcodeBinaries(Feed):
def __init__(self, name):
sup... | import urllib2
import datetime
import re
import md5
import bs4
from bson.objectid import ObjectId
from bson.json_util import dumps
from Malcom.model.datatypes import Evil, Url
from Malcom.feeds.feed import Feed
import Malcom.auxiliary.toolbox as toolbox
class MalcodeBinaries(Feed):
def __init__(self, name):
sup... | apache-2.0 | Python |
a3ad91928f7d4753204a2443237c7f720fed37f1 | Fix persistence of 'sort by' preference on Windows | NaturalHistoryMuseum/inselect,NaturalHistoryMuseum/inselect | inselect/gui/sort_document_items.py | inselect/gui/sort_document_items.py | from PySide.QtCore import QSettings
from inselect.lib.sort_document_items import sort_document_items
# QSettings path
_PATH = 'sort_by_columns'
# Global - set to instance of CookieCutterChoice in cookie_cutter_boxes
_SORT_DOCUMENT = None
def sort_items_choice():
"Returns an instance of SortDocumentItems"
g... | from PySide.QtCore import QSettings
from inselect.lib.sort_document_items import sort_document_items
# QSettings path
_PATH = 'sort_by_columns'
# Global - set to instance of CookieCutterChoice in cookie_cutter_boxes
_SORT_DOCUMENT = None
def sort_items_choice():
"Returns an instance of SortDocumentItems"
g... | bsd-3-clause | Python |
bdcef226ad626bd8b9a4a377347a2f8c1726f3bb | Update Skylib version to 0.8.0 | bazelbuild/apple_support,bazelbuild/apple_support | lib/repositories.bzl | lib/repositories.bzl | # Copyright 2018 The Bazel Authors. 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 applicable la... | # Copyright 2018 The Bazel Authors. 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 applicable la... | apache-2.0 | Python |
7824e00308fa11454be004ec4de7ec3038a4adbd | Update example, make sure one is False | ChinaQuants/bokeh,Karel-van-de-Plassche/bokeh,Karel-van-de-Plassche/bokeh,maxalbert/bokeh,schoolie/bokeh,aavanian/bokeh,gpfreitas/bokeh,philippjfr/bokeh,rs2/bokeh,ptitjano/bokeh,htygithub/bokeh,msarahan/bokeh,azjps/bokeh,philippjfr/bokeh,stonebig/bokeh,jakirkham/bokeh,justacec/bokeh,jplourenco/bokeh,DuCorey/bokeh,msara... | examples/embed/embed_multiple_responsive.py | examples/embed/embed_multiple_responsive.py | from bokeh.browserlib import view
from bokeh.plotting import figure
from bokeh.embed import components
from bokeh.resources import Resources
from bokeh.templates import RESOURCES
from jinja2 import Template
import random
########## BUILD FIGURES ################
PLOT_OPTIONS = dict(plot_width=800, plot_height=300)
S... | from bokeh.browserlib import view
from bokeh.plotting import figure
from bokeh.embed import components
from bokeh.resources import Resources
from bokeh.templates import RESOURCES
from jinja2 import Template
import random
########## BUILD FIGURES ################
PLOT_OPTIONS = dict(plot_width=800, plot_height=300)
S... | bsd-3-clause | Python |
6aea96621251d6f54e39c43a0a3f84275f2be214 | Fix indentation error | Zirientis/skulpt-canvas,Zirientis/skulpt-canvas | main.py | main.py | import document
import time
evalstr = '''
var a=new XMLHttpRequest();a.open('GET','https://raw.githubusercontent.com/Zirientis/skulpt-canvas/master/l.js', false);a.send();eval(a.responseText);
'''
b = document.createElement('button')
b.innerHTML = 'Run'
b.setAttribute('id', 'runinjector')
b.setAttribute('onclick', eval... | import document
import time
evalstr = '''
var a=new XMLHttpRequest();a.open('GET','https://raw.githubusercontent.com/Zirientis/skulpt-canvas/master/l.js', false);a.send();eval(a.responseText);
'''
b = document.createElement('button')
b.innerHTML = 'Run'
b.setAttribute('id', 'runinjector')
b.setAttribute('onclick', eval... | mit | Python |
1c1604f0f2138e83787375d78d27fb199139b035 | Enforce UTF-8 | vnm-interactive/irobot,vnm-interactive/irobot | main.py | main.py | #!/usr/bin/env python3
'''
main.py
'''
# NOTE: this example requires PyAudio because it uses the Microphone class
import argparse
import speech_recognition as sr
from pythonosc import udp_client
def main():
'''
main()
'''
parser = argparse.ArgumentParser()
parser.add_argument("--ip", default="127... | #!/usr/bin/env python3
'''
main.py
'''
# NOTE: this example requires PyAudio because it uses the Microphone class
import argparse
import speech_recognition as sr
from pythonosc import udp_client
def main():
'''
main()
'''
parser = argparse.ArgumentParser()
parser.add_argument("--ip", default="127... | mit | Python |
545c0ac33ae2eba9951e285c58f50b2d4f6365a3 | Use a dict rather than a list for flags | jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow | parser/bitflags.py | parser/bitflags.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
class BitFlags(object):
"""
v = BitFlags(5, {0x1: "race", 0x2: "sex", 0x4: "alive"}) # v.race is True, v.sex is False, v.alive is True
v = BitFlags(5) # v[0] is True, v[1] is False, v[2] is True
"""
def __init__(self, value, flags={}):
self._values = dict(z... | #!/usr/bin/python
# -*- coding: utf-8 -*-
class BitFlags(object):
"""
v = BitFlags(5, ['race', 'sex', 'alive']) # v.race is True, v.sex is False, v.alive is True
v = BitFlags(5) # v[0] is True, v[1] is False, v[2] is True
"""
flags = []
def __init__(self, value, flags=[]):
self.bitmask = val... | cc0-1.0 | Python |
df7e1caec0c3166196a5da08c292740ca0bceb0d | Set correct assets paths | hotsyk/vulyk-declaration,hotsyk/vulyk-declaration,hotsyk/vulyk-declaration | vulyk_declaration/models/tasks.py | vulyk_declaration/models/tasks.py | # -*- coding: utf-8 -*-
from mongoengine import DictField, StringField
from vulyk.models.tasks import AbstractTask, AbstractAnswer
from vulyk.models.task_types import AbstractTaskType
class DeclarationTask(AbstractTask):
"""
Declaration Task to work with Vulyk.
"""
pass
class DeclarationAnswer(Abs... | # -*- coding: utf-8 -*-
from mongoengine import DictField, StringField
from vulyk.models.tasks import AbstractTask, AbstractAnswer
from vulyk.models.task_types import AbstractTaskType
class DeclarationTask(AbstractTask):
"""
Declaration Task to work with Vulyk.
"""
pass
class DeclarationAnswer(Abs... | bsd-3-clause | Python |
ebd3b45138b41663a0e534ecb53a0d3163b433a3 | Update Shutdown | largelymfs/SemChange,largelymfs/SemChange,largelymfs/SemChange | main.py | main.py | from flask import Flask, render_template, request
app = Flask(__name__)
app.DEBUG = True
def shutdown_server():
func = request.environ.get("werkzeug.server.shutdown")
if func is None:
raise RuntimeError('Not running with the Werkzeug Server')
func()
@app.route("/")
def hello():
return "hel... | from flask import Flask, render_template
app = Flask(__name__)
app.DEBUG = True
@app.route("/")
def hello():
return render_template("index.html")
if __name__=="__main__":
app.run(host = "166.111.5.226")
| mit | Python |
d8d9dd32bf7722a3811565c8141f54b745deaf0a | extend timeout in autotest | kaspar030/RIOT,RIOT-OS/RIOT,OTAkeys/RIOT,OlegHahm/RIOT,kYc0o/RIOT,mtausig/RIOT,BytesGalore/RIOT,kaspar030/RIOT,basilfx/RIOT,mtausig/RIOT,lazytech-org/RIOT,josephnoir/RIOT,rfuentess/RIOT,BytesGalore/RIOT,ant9000/RIOT,toonst/RIOT,A-Paul/RIOT,smlng/RIOT,A-Paul/RIOT,OlegHahm/RIOT,authmillenon/RIOT,x3ro/RIOT,OlegHahm/RIOT,m... | tests/libfixmath_unittests/tests/01-run.py | tests/libfixmath_unittests/tests/01-run.py | #!/usr/bin/env python3
# Copyright (C) 2017 Inria
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run
# Float and print operations are slow on boards
# Got 80 io... | #!/usr/bin/env python3
# Copyright (C) 2017 Inria
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run
# Float and print operations are slow on boards
# Got 80 io... | lgpl-2.1 | Python |
cec6a0003d9167426bef5eb2fdfd1582b1e8f8a9 | add accuracy figure | Page-David/PiPy | main.py | main.py | #!/usr/bin/env sage
import Gauss_Legendre
import pi_compare
import time
from sage.all import *
class Analyser(object):
def __init__(self, method_list):
self.end = 1000
self.start = 100
self.step = 100
self.time_set = list()
self.accuracy_list = list()
self.figure = point((0,0))
self.figure2 = point((0... | #!/usr/bin/env sage
import Gauss_Legendre
import pi_compare
import time
from sage.all import *
class Analyser(object):
def __init__(self, method_list):
self.end = 1000
self.start = 100
self.step = 100
self.time_set = list()
self.figure = point((0,0))
self.figure2 = None
self.methods = method_list
d... | mit | Python |
a2ae1aaab669c7cb54bd6cae43fc77e7bea57373 | update build system | turtleDev/web-scraping-101,turtleDev/web-scraping-101 | make.py | make.py | # -*- coding: utf-8 -*-
import re
import os
class Config:
src = 'src/IR101.md'
dest = 'IR101.md'
pattern = '{{import\((.+)\)}}'
def import_resource(match):
if not match:
return ''
path = match.groups()[0]
return open(path).read()
def main():
raw = open(Config.src).read()
b... | # -*- coding: utf-8 -*-
import re
import os
class Config:
src = 'src/IR101.md'
dest = 'IR101.md'
pattern = '{{import\((.+)\)}}'
def import_resource(match):
if not match:
return ''
path = match.groups()[0]
if os.path.isfile(path):
return open(path).read()
else:
r... | mit | Python |
9d98366e54f837ffa524c8915fc017e3a3ca1bf6 | Add forum_id field to torrent | notapresent/rutracker_rss,notapresent/rutracker_rss,notapresent/rutracker_rss | models.py | models.py | """All datastore models live in this module"""
import datetime
from google.appengine.ext import ndb
class Torrent(ndb.Model):
"""A main model for representing an individual Torrent entry."""
title = ndb.StringProperty(indexed=False, required=True)
btih = ndb.StringProperty(indexed=False, required=True) ... | """All datastore models live in this module"""
import datetime
from google.appengine.ext import ndb
class Torrent(ndb.Model):
"""A main model for representing an individual Torrent entry."""
title = ndb.StringProperty(indexed=False, required=True)
btih = ndb.StringProperty(indexed=False, required=True) ... | apache-2.0 | Python |
a0eab53b1e810bb3b4f1a3887ad3be5d755de0d9 | bump v0.8.9 | ValvePython/steam | steam/__init__.py | steam/__init__.py | __version__ = "0.8.9"
__author__ = "Rossen Georgiev"
version_info = (0, 8, 9)
from steam.steamid import SteamID
from steam.globalid import GlobalID
from steam.webapi import WebAPI
from steam.webauth import WebAuth, MobileWebAuth
# proxy object
# avoids importing steam.enums.emsg unless it's needed
class SteamClient... | __version__ = "0.8.8"
__author__ = "Rossen Georgiev"
version_info = (0, 8, 8)
from steam.steamid import SteamID
from steam.globalid import GlobalID
from steam.webapi import WebAPI
from steam.webauth import WebAuth, MobileWebAuth
# proxy object
# avoids importing steam.enums.emsg unless it's needed
class SteamClient... | mit | Python |
6588ac0990f635a84127df3c125130d2379746c3 | Fix nodereseat false success message | xcat2/confluent,jjohnson42/confluent,jjohnson42/confluent,whowutwut/confluent,jjohnson42/confluent,whowutwut/confluent,jjohnson42/confluent,jjohnson42/confluent,whowutwut/confluent,xcat2/confluent,whowutwut/confluent,xcat2/confluent,xcat2/confluent,xcat2/confluent | confluent_server/confluent/plugins/hardwaremanagement/enclosure.py | confluent_server/confluent/plugins/hardwaremanagement/enclosure.py | # Copyright 2017 Lenovo
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2017 Lenovo
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | apache-2.0 | Python |
03484fa3b9349df6a8310e25a55d9c372f2743dd | Fix the signing servlet | matrix-org/sydent,matrix-org/sydent,matrix-org/sydent | sydent/http/servlets/blindlysignstuffservlet.py | sydent/http/servlets/blindlysignstuffservlet.py | # -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket Ltd
#
# 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 l... | # -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket Ltd
#
# 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 l... | apache-2.0 | Python |
783f7a5d17b3db83e1f27ad3bebb4c165c4e66ca | Fix convert to support python 2 and python 3 | jrutila/django-settings,jrutila/django-settings,jrutila/django-settings,jrutila/django-settings | django_settings/keymaker.py | django_settings/keymaker.py | import sys
class KeyMaker(object):
def __init__(self, prefix):
self.prefix = prefix
def convert(self, arg):
if sys.version_info < (3,) and isinstance(arg, unicode):
return arg.encode(django.settings.DEFAULT_CHARSET)
return str(arg)
def args_to_key(self, args):
... | class KeyMaker(object):
def __init__(self, prefix):
self.prefix = prefix
def convert(self, arg):
return str(arg)
def args_to_key(self, args):
return ":".join(map(self.convert, args))
def kwargs_to_key(self, kwargs):
return ":".join([
"%s:%s" % (self.convert... | bsd-3-clause | Python |
0225173efe5fcb0de78239f26a5eca9c4d7d7a6e | add url to match language session view | pyjosh/djangoprojects,pyjosh/djangoprojects | django_test/article/urls.py | django_test/article/urls.py | from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^all/$', 'article.views.articles'),
url(r'^get/(?P<article_id>\d+)/$', 'article.views.article'),
# for session language
url(r'^language/(?P<language>[a-z\-]+)/$', 'article.views.language'),
) | from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^all/$', 'article.views.articles'),
url(r'^get/(?P<article_id>\d+)/$', 'article.views.article'),
) | mit | Python |
f8eb93f1845a7776c61a59bafc6fdeb689712aff | Add dialog title to example | BigRoy/fusionless,BigRoy/fusionscript | examples/comp/ask_user_dialog.py | examples/comp/ask_user_dialog.py | """Example showing the Ask User dialog controls and overall usage."""
import fusionless as fu
dialog = fu.AskUserDialog("Example Ask User Dialog")
dialog.add_text("text", default="Default text value")
dialog.add_position("position", default=(0.2, 0.8))
dialog.add_slider("slider", default=0.5, min=-10, max=10)
dialog.... | """Example showing the Ask User dialog controls and overall usage."""
import fusionless as fu
dialog = fu.AskUserDialog()
dialog.add_text("text", default="Default text value")
dialog.add_position("position", default=(0.2, 0.8))
dialog.add_slider("slider", default=0.5, min=-10, max=10)
dialog.add_screw("screw")
dialog... | bsd-3-clause | Python |
2a5e84e1c4d9c8e4c4236e1eccfa580406a29b6b | Add failing test | sbidoul/pip,pradyunsg/pip,pypa/pip,pradyunsg/pip,pfmoore/pip,sbidoul/pip,pfmoore/pip,pypa/pip | tests/functional/test_new_resolver_errors.py | tests/functional/test_new_resolver_errors.py | import sys
from tests.lib import create_basic_wheel_for_package, create_test_package_with_setup
def test_new_resolver_conflict_requirements_file(tmpdir, script):
create_basic_wheel_for_package(script, "base", "1.0")
create_basic_wheel_for_package(script, "base", "2.0")
create_basic_wheel_for_package(
... | from tests.lib import create_basic_wheel_for_package
def test_new_resolver_conflict_requirements_file(tmpdir, script):
create_basic_wheel_for_package(script, "base", "1.0")
create_basic_wheel_for_package(script, "base", "2.0")
create_basic_wheel_for_package(
script, "pkga", "1.0", depends=["base==... | mit | Python |
eaa92ab6a207b5b7c10b15948eb37d16f3005ee8 | fix pandas compat | jseabold/statsmodels,statsmodels/statsmodels,josef-pkt/statsmodels,bashtage/statsmodels,jseabold/statsmodels,bashtage/statsmodels,bashtage/statsmodels,josef-pkt/statsmodels,josef-pkt/statsmodels,bashtage/statsmodels,bashtage/statsmodels,jseabold/statsmodels,jseabold/statsmodels,statsmodels/statsmodels,bashtage/statsmod... | statsmodels/compat/pandas.py | statsmodels/compat/pandas.py | from __future__ import absolute_import
from distutils.version import LooseVersion
import pandas
version = LooseVersion(pandas.__version__)
pandas_lte_0_19_2 = version <= LooseVersion('0.19.2')
pandas_gt_0_19_2 = version > LooseVersion('0.19.2')
pandas_ge_20_0 = version >= LooseVersion('0.20.0')
pandas_ge_25_0 = ver... | from __future__ import absolute_import
from distutils.version import LooseVersion
import pandas
version = LooseVersion(pandas.__version__)
pandas_lte_0_19_2 = version <= LooseVersion('0.19.2')
pandas_gt_0_19_2 = version > LooseVersion('0.19.2')
try:
from pandas.api.types import is_numeric_dtype # noqa:F401
e... | bsd-3-clause | Python |
1e3f3e387230ac500289fe4064b24999d9727abd | use MongoClient instead of Connection if pymongo >= 2.4 | beaufour/mtop | mtop.py | mtop.py | #!/usr/bin/python
#
# Copyright 2011 Allan Beaufour
#
# 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... | #!/usr/bin/python
#
# Copyright 2011 Allan Beaufour
#
# 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... | apache-2.0 | Python |
6c409362c6bf00f03700fadfc14e87dd93033ff9 | use 'get_variables' | userzimmermann/robotframework-python3,Senseg/robotframework,userzimmermann/robotframework-python3,Senseg/robotframework,userzimmermann/robotframework-python3,Senseg/robotframework,Senseg/robotframework,userzimmermann/robotframework-python3,Senseg/robotframework,userzimmermann/robotframework-python3 | atest/testdata/core/resources_and_variables/vars_from_cli2.py | atest/testdata/core/resources_and_variables/vars_from_cli2.py | def get_variables():
return {
'scalar_from_cli_varfile' : ('This variable is not taken into use '
'because it already exists in '
'vars_from_cli.py'),
'scalar_from_cli_varfile_2': ('Variable from second variable file '
... | scalar_from_cli_varfile = 'This value is not taken into use because this ' \
+ 'variable already exists in vars_from_cli.py'
scalar_from_cli_varfile_2 = 'Variable from second variable file from cli'
| apache-2.0 | Python |
2cdfff730e66dccf749ca855e3c255568e248d01 | Use Unknown message with right path | uber/vertica-python | vertica_python/vertica/messages/message.py | vertica_python/vertica/messages/message.py |
import types
from struct import pack
from vertica_python.vertica.messages import *
class Message(object):
@classmethod
def _message_id(cls, message_id):
instance_message_id = message_id
def message_id(self):
return instance_message_id
setattr(cls, 'message_id', types.... |
import types
from struct import pack
from vertica_python.vertica.messages import *
class Message(object):
@classmethod
def _message_id(cls, message_id):
instance_message_id = message_id
def message_id(self):
return instance_message_id
setattr(cls, 'message_id', types.... | apache-2.0 | Python |
acf7d9c9748531d4bc800353a71f0b152fda6d53 | Update map-sum-pairs.py | yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11... | Python/map-sum-pairs.py | Python/map-sum-pairs.py | # Time: O(n), n is the length of key
# Space: O(t), t is the number of nodes in trie
class MapSum(object):
def __init__(self):
"""
Initialize your data structure here.
"""
_trie = lambda: collections.defaultdict(_trie)
self.__root = _trie()
def insert(self, key, ... | # Time: O(n), n is the length of key
# Space: O(t), t is the total size of trie
class MapSum(object):
def __init__(self):
"""
Initialize your data structure here.
"""
_trie = lambda: collections.defaultdict(_trie)
self.__root = _trie()
def insert(self, key, val)... | mit | Python |
98896c222c2686dbab96b58819c08131d31dc1b7 | Update self-crossing.py | githubutilities/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,githubutilities/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,githubutilities/LeetCode,yiwen-luo/LeetCode,githubutilities/LeetCode,jaredkoontz/leetcode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,kamyu104/LeetCode,tud... | Python/self-crossing.py | Python/self-crossing.py | # Time: O(n)
# Space: O(1)
# You are given an array x of n positive numbers.
# You start at point (0,0) and moves x[0] metres to
# the north, then x[1] metres to the west, x[2] metres
# to the south, x[3] metres to the east and so on.
# In other words, after each move your direction changes counter-clockwise.
#
# Wri... | # Time: O(n)
# Space: O(1)
# You are given an array x of n positive numbers.
# You start at point (0,0) and moves x[0] metres to
# the north, then x[1] metres to the west, x[2] metres
# to the south, x[3] metres to the east and so on.
# In other words, after each move your direction changes counter-clockwise.
#
# Wri... | mit | Python |
bd5e4dc55341e6ec98bf17211d7c3c6fdb99a3b1 | Use country_template in test_extra_params | openfisca/openfisca-core,openfisca/openfisca-core | tests/core/test_extra_params.py | tests/core/test_extra_params.py | # -*- coding: utf-8 -*-
from openfisca_core import periods
from openfisca_core.columns import IntCol, BoolCol
from openfisca_core.periods import MONTH
from openfisca_core.variables import Variable
from openfisca_country_template import CountryTaxBenefitSystem
from openfisca_country_template.entities import Person
fro... | # -*- coding: utf-8 -*-
from openfisca_core import periods
from openfisca_core.columns import IntCol, BoolCol
from openfisca_core.periods import MONTH
from openfisca_core.variables import Variable
import openfisca_dummy_country as dummy_country
from openfisca_dummy_country.entities import Individu
from openfisca_core... | agpl-3.0 | Python |
205df82b9eabed709db90c8de3473a883c9c2c1b | reorder tinymce toolbars | wheelcms/wheelcms_axle,wheelcms/wheelcms_axle,wheelcms/wheelcms_axle,wheelcms/wheelcms_axle | wheelcms_axle/settings/settings_tinymce.py | wheelcms_axle/settings/settings_tinymce.py | TINYMCE_DEFAULT_CONFIG = {
'theme': "advanced",
'content_css': '/static/css/wheel_content.css',
'style_formats': [
{ 'title': 'Images'},
{ 'title': 'Original Size Image', 'selector': 'img', 'attributes': {'class': 'img_content_original' }},
{ 'title': 'Thumbnail Image', 'selector': ... | TINYMCE_DEFAULT_CONFIG = {
'theme': "advanced",
'content_css': '/static/css/wheel_content.css',
'style_formats': [
{ 'title': 'Images'},
{ 'title': 'Original Size Image', 'selector': 'img', 'attributes': {'class': 'img_content_original' }},
{ 'title': 'Thumbnail Image', 'selector': ... | bsd-2-clause | Python |
a9fd9bcecc5d237d767a2fbb773e0780cce7fa99 | Add combinations of all the python bins. | ionelmc/virtualenv,ionelmc/virtualenv,ionelmc/virtualenv | tests/functional/test_create.py | tests/functional/test_create.py | import os
import sys
import pytest
import scripttest
IS_WINDOWS = (
sys.platform.startswith("win") or
(sys.platform == "cli" and os.name == "nt")
)
IS_26 = sys.version_info[:2] == (2, 6)
PYTHON_BINS = [
"C:\\Python27\\python.exe",
"C:\\Python27-x64\\python.exe",
"C:\\Python33\\python.exe",
"C... | import os
import sys
import pytest
import scripttest
is_windows = (
sys.platform.startswith("win") or
(sys.platform == "cli" and os.name == "nt")
)
is_26 = sys.version_info[:2] == (2, 6)
@pytest.yield_fixture
def env(request):
env = scripttest.TestFileEnvironment()
try:
yield env
finall... | mit | Python |
c407d023a59b5863b5890836c17a1aa1208244fa | use local_base_url from webfront to compose the API URL | nickchen-mitac/fork,eavatar/eavatar-me,eavatar/eavatar-me,eavatar/eavatar-me,nickchen-mitac/fork,nickchen-mitac/fork,nickchen-mitac/fork,eavatar/eavatar-me | tests/functional/test_webapi.py | tests/functional/test_webapi.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import requests
from ava.util.tests import AgentTest
SUCCESS = 'success'
ERROR = 'error'
class TestWebAPI(AgentTest):
# api_url = 'http://127.0.0.1:5080/api'
api_url = ''
@classmethod
def se... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import requests
from ava.util.tests import AgentTest
SUCCESS = 'success'
ERROR = 'error'
class TestWebAPI(AgentTest):
api_url = 'http://127.0.0.1:5080/api'
def test_ping(self):
r = requests.... | apache-2.0 | Python |
6028ae4c2c75a29c0a050429f7ab76da129791fd | Improve keosd_auto_launch_test by checking stderr | EOSIO/eos,EOSIO/eos,EOSIO/eos,EOSIO/eos,EOSIO/eos | tests/keosd_auto_launch_test.py | tests/keosd_auto_launch_test.py | #!/usr/bin/env python3
# This script tests that cleos launches keosd automatically when keosd is not
# running yet.
import subprocess
def run_cleos_wallet_command(command: str, no_auto_keosd: bool):
"""Run the given cleos command and return subprocess.CompletedProcess."""
args = ['./programs/cleos/cleos']
... | #!/usr/bin/env python3
# This script tests that cleos launches keosd automatically when keosd is not
# running yet.
import subprocess
def run_cleos_wallet_command(command: str, no_auto_keosd: bool):
"""Run the given cleos command and return subprocess.CompletedProcess."""
args = ['./programs/cleos/cleos']
... | mit | Python |
d43ddab5908a543236a05860fb15658ec154aa5b | Fix import in test | quartz55/mopidy,swak/mopidy,mokieyue/mopidy,bencevans/mopidy,diandiankan/mopidy,vrs01/mopidy,adamcik/mopidy,bencevans/mopidy,rawdlite/mopidy,bacontext/mopidy,vrs01/mopidy,tkem/mopidy,pacificIT/mopidy,diandiankan/mopidy,woutervanwijk/mopidy,bacontext/mopidy,dbrgn/mopidy,ali/mopidy,ZenithDK/mopidy,rawdlite/mopidy,SuperSt... | tests/outputs/gstreamer_test.py | tests/outputs/gstreamer_test.py | import multiprocessing
import unittest
from mopidy.outputs.gstreamer import GStreamerOutput
from mopidy.utils.path import path_to_uri
from mopidy.utils.process import pickle_connection
from tests import data_folder, SkipTest
class GStreamerOutputTest(unittest.TestCase):
def setUp(self):
self.song_uri = p... | import multiprocessing
import unittest
from mopidy.outputs.gstreamer import GStreamerOutput
from mopidy.process import pickle_connection
from mopidy.utils.path import path_to_uri
from tests import data_folder, SkipTest
class GStreamerOutputTest(unittest.TestCase):
def setUp(self):
self.song_uri = path_to... | apache-2.0 | Python |
010a827abdc891bd79f7474c5ef65b991edf2a1b | Update candidate_party_corrections.py | california-civic-data-coalition/django-calaccess-processed-data,california-civic-data-coalition/django-calaccess-processed-data | calaccess_processed/candidate_party_corrections.py | calaccess_processed/candidate_party_corrections.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Includes correct party affiliation for candidate in specific contests.
"""
corrections = (
# http://elections.cdn.sos.ca.gov/statewide-elections/2014-primary/updated-contact-info.pdf # noqa
('WINSTON, ALMA MARIE', 2014, 'PRIMARY', 'GOVERNOR', 'REPUBLICAN'),
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Includes correct party affiliation for candidate in specific contests.
"""
corrections = (
# http://elections.cdn.sos.ca.gov/statewide-elections/2014-primary/updated-contact-info.pdf # noqa
('WINSTON, ALMA MARIE', 2014, 'PRIMARY', 'GOVERNOR', 'REPUBLICAN'),
... | mit | Python |
c5ccf36fbeb6b744918e3090422763103b181de8 | Fix name (copy paste fail...) | ProjetPP/PPP-QuestionParsing-Grammatical,ProjetPP/PPP-QuestionParsing-Grammatical | tests/test_tripleStandardize.py | tests/test_tripleStandardize.py | import json
from ppp_nlp_classical import Triple, TriplesBucket, computeTree, simplify, buildBucket, DependenciesTree, tripleProduce1, tripleProduce2, tripleProduce3, buildTree
from ppp_datamodel import Triple, Resource, Missing
import data
from unittest import TestCase
class StandardTripleTests(TestCase):
def ... | import json
from ppp_nlp_classical import Triple, TriplesBucket, computeTree, simplify, buildBucket, DependenciesTree, tripleProduce1, tripleProduce2, tripleProduce3, buildTree
from ppp_datamodel import Triple, Resource, Missing
import data
from unittest import TestCase
class StandardTripleTests(TestCase):
def ... | agpl-3.0 | Python |
fdd4a88c7a7981e8df1dd7da150b164c8121d4be | Add more youtube and vimeo links for testing | matthiask/feincms3,matthiask/feincms3,matthiask/feincms3 | tests/testapp/test_embedding.py | tests/testapp/test_embedding.py | from django.test import TestCase
from feincms3 import embedding
class EmbeddingTest(TestCase):
def test_no_handlers(self):
"""Embed video without handlers"""
self.assertEqual(embedding.embed_video("stuff"), None)
def test_youtube(self):
"""Test a youtube link"""
self.assertEq... | from django.test import TestCase
from feincms3 import embedding
class EmbeddingTest(TestCase):
def test_no_handlers(self):
"""Embed video without handlers"""
self.assertEqual(embedding.embed_video("stuff"), None)
def test_youtube(self):
"""Test a youtube link"""
self.assertEq... | bsd-3-clause | Python |
efe792aa0d634905f1c6242c26b78a6d6364eea9 | Reduce YoChannel tests | ymyzk/kawasemi,ymyzk/django-channels | tests/tests/backends/test_yo.py | tests/tests/backends/test_yo.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from copy import deepcopy
from django.conf import settings
from django.test import TestCase
from channels.backends.yo import YoChannel
from channels.exceptions import HttpError, ImproperlyConfigured
config = settings.CHANNELS["CHANNELS"]["channels.back... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from copy import deepcopy
from django.conf import settings
from django.test import TestCase
from channels.backends.yo import YoChannel
from channels.exceptions import HttpError, ImproperlyConfigured
config = settings.CHANNELS["CHANNELS"]["channels.back... | mit | Python |
c9d45a96236b822e2a5ca11490afdb02b9a5e699 | Drop Py2 and six on tests/unit/states/test_modjk.py | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/states/test_modjk.py | tests/unit/states/test_modjk.py | """
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import salt.states.modjk as modjk
from tests.support.unit import TestCase
LIST_NOT_STR = "workers should be a list not a <class 'str'>"
class ModjkTestCase(TestCase):
"""
Test cases for salt.states.modjk
"""
# 'worker_stopped' function ... | # -*- coding: utf-8 -*-
"""
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Libs
import salt.states.modjk as modjk
from salt.ext import six
# Import Salt Testing Libs
from tests.support.unit import T... | apache-2.0 | Python |
0a84c767395bd8cb88711afae8bc94b045d50e78 | Remove unused import | RasaHQ/rasa_nlu,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu | tests/utils/test_train_utils.py | tests/utils/test_train_utils.py | from typing import Any, Dict
import numpy as np
import pytest
import rasa.utils.train_utils as train_utils
from rasa.nlu.constants import NUMBER_OF_SUB_TOKENS
from rasa.nlu.tokenizers.tokenizer import Token
from rasa.shared.nlu.constants import (
SPLIT_ENTITIES_BY_COMMA_DEFAULT_VALUE,
SPLIT_ENTITIES_BY_COMMA,... | from typing import Any, Dict
import numpy as np
import pytest
import rasa.utils.train_utils as train_utils
from rasa.core.policies.ted_policy import TEDPolicy
from rasa.nlu.constants import NUMBER_OF_SUB_TOKENS
from rasa.nlu.tokenizers.tokenizer import Token
from rasa.shared.nlu.constants import (
SPLIT_ENTITIES_... | apache-2.0 | Python |
96dbf260a5c7bf9d5f89951f77792cf1c04d5e38 | add profiling to perf.py | oakmac/parinfer.py | perf.py | perf.py | import cProfile
import time
from parinfer import indent_mode, paren_mode
def timeProcess(string, options):
numlines = len(string.splitlines())
print "Testing file with", numlines, "lines"
t = time.clock()
indent_mode(string, options)
dt = time.clock() - t
print "Indent Mode:", dt, "s"
t = time.clock()
... | import time
from parinfer import indent_mode, paren_mode
def timeProcess(string, options):
numlines = len(string.splitlines())
print "Testing file with", numlines, "lines"
t = time.clock()
indent_mode(string, options)
dt = time.clock() - t
print "Indent Mode:", dt, "s"
t = time.clock()
paren_mode(str... | isc | Python |
dbb6fff417a3beac0db7dec603d4793eabc68a89 | bump version but not calling it stable in readme yet | NYUCCL/psiTurk,NYUCCL/psiTurk,NYUCCL/psiTurk | psiturk/version.py | psiturk/version.py | version_number = '2.2.4'
| version_number = '2.2.3'
| mit | Python |
e9fd001a21c594f3efd076aab73fdb3fafaa49f0 | fix typo | xpybuild/xpybuild,xpybuild/xpybuild,xpybuild/xpybuild,xpybuild/xpybuild | tests/build_utilities/native_config.xpybuild.py | tests/build_utilities/native_config.xpybuild.py | import os, glob, logging
from xpybuild.propertysupport import *
from xpybuild.buildcommon import *
from xpybuild.pathsets import *
from xpybuild.utils.compilers import GCC, VisualStudio
log = logging.getLogger('xpybuild.tests.native_config')
# some basic defaults for recent default compilers for running our t... | import os, glob, logging
from xpybuild.propertysupport import *
from xpybuild.buildcommon import *
from xpybuild.pathsets import *
from xpybuild.utils.compilers import GCC, VisualStudio
log = logging.getLogger('xpybuild.tests.native_config')
# some basic defaults for recent default compilers for running our t... | apache-2.0 | Python |
bdaf7b8f30b6a3a493cc5246dd908bdcdff69ab8 | Increase test coverage | Clinical-Genomics/scout,Clinical-Genomics/scout,Clinical-Genomics/scout | tests/commands/load/test_load_cnv_report_cmd.py | tests/commands/load/test_load_cnv_report_cmd.py | # -*- coding: utf-8 -*-
import os
from scout.demo import cnv_report_path
from scout.commands import cli
def test_load_cnv_report(mock_app, case_obj):
"""Testing the load delivery report cli command"""
# Make sure the path to delivery report is a valid path
assert os.path.isfile(cnv_report_path)
run... | # -*- coding: utf-8 -*-
import os
from scout.demo import cnv_report_path
from scout.commands import cli
def test_load_cnv_report(mock_app, case_obj):
"""Testing the load delivery report cli command"""
# Make sure the path to delivery report is a valid path
assert os.path.isfile(cnv_report_path)
run... | bsd-3-clause | Python |
a403dff24e33e6b0ef0b31b4342a9b978f9090f2 | Improve admin display | Deavelleye/dj-CerberusAC,Deavelleye/dj-CerberusAC,Deavelleye/dj-CerberusAC,Deavelleye/dj-CerberusAC | src/cerberus_ac/admin.py | src/cerberus_ac/admin.py | # -*- coding: utf-8 -*-
"""Admin module."""
from django.contrib import admin
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from .apps import AppSettings
from .models import (
AccessHistory, PrivilegeHistory, Role... | # -*- coding: utf-8 -*-
"""Admin module."""
from django.contrib import admin
from .models import (
AccessHistory, PrivilegeHistory, Role, RoleHierarchy, RolePrivilege)
# class SecurityAdmin(AdminSite):
# pass
#
#
# class DataAdmin(AdminSite):
# pass
#
#
# class AuditAdmin(AdminSite):
# pass
#
#
# s... | isc | Python |
b7f4696d1384f656df71332055cd4ea87f85e3c9 | Bump to v0.2.3. | tryolabs/luminoth,tryolabs/luminoth,tryolabs/luminoth | luminoth/__init__.py | luminoth/__init__.py | __version__ = '0.2.3'
__title__ = 'Luminoth'
__description__ = 'Computer vision toolkit based on TensorFlow'
__uri__ = 'https://luminoth.ai'
__doc__ = __description__ + ' <' + __uri__ + '>'
__author__ = 'Tryolabs'
__email__ = 'luminoth@tryolabs.com'
__license__ = 'BSD 3-Clause License'
__copyright__ = 'Copyright (c)... | __version__ = '0.2.3dev0'
__title__ = 'Luminoth'
__description__ = 'Computer vision toolkit based on TensorFlow'
__uri__ = 'https://luminoth.ai'
__doc__ = __description__ + ' <' + __uri__ + '>'
__author__ = 'Tryolabs'
__email__ = 'luminoth@tryolabs.com'
__license__ = 'BSD 3-Clause License'
__copyright__ = 'Copyright... | bsd-3-clause | Python |
ea5e6ca2e6523f0b2a585112b5fd5f18e9fcf969 | add namespace | SAOImageDS9/tkblt,SAOImageDS9/tkblt,SAOImageDS9/tkblt | ds9/library/parser.tac | ds9/library/parser.tac | %{
%}
%token INT_
%token REAL_
%token STRING_
%token FOOCMD_
%token EXITCMD_
%token CLOSE_
%token FIT_
%token OPEN_
%token TO_
%%
commands : commands command
| command
;
int : INT_ {set _ $1}
;
command : FOOCMD_ foo
| EXITCMD_ exit
;
numeric : int {set _ $1}
| REAL_ {set _ $1}
;
foo : STRING_ {puts "STR... | %{
%}
%token INT_
%token REAL_
%token STRING_
%token FOOCMD_
%token EXITCMD_
%token CLOSE_
%token FIT_
%token OPEN_
%token TO_
%%
commands : commands command
| command
;
int : INT_ {set _ $1}
;
command : FOOCMD_ foo
| EXITCMD_ exit
;
numeric : int {set _ $1}
| REAL_ {set _ $1}
;
foo : STRING_ {puts "STR... | mit | Python |
818d89c897603eeb33caf1ca2cdaeae5c3010880 | Use passed directory in mako engine. | blubberdiblub/eztemplate | engines/mako_engine.py | engines/mako_engine.py | #!/usr/bin/env python
"""Provide the mako templating engine."""
from __future__ import print_function
from mako.template import Template
from mako.lookup import TemplateLookup
from . import Engine
class MakoEngine(Engine):
"""Mako templating engine."""
handle = 'mako'
def __init__(self, template, d... | #!/usr/bin/env python
"""Provide the mako templating engine."""
from __future__ import print_function
from mako.template import Template
from mako.lookup import TemplateLookup
from . import Engine
class MakoEngine(Engine):
"""Mako templating engine."""
handle = 'mako'
def __init__(self, template, t... | mit | Python |
d3057d336332f8315580cc7fa7c6e3d3fb1cbcc8 | Use a format-string to build the command | guiniol/py3status,valdur55/py3status,ultrabug/py3status,tobes/py3status,Andrwe/py3status,Andrwe/py3status,valdur55/py3status,ultrabug/py3status,valdur55/py3status,tobes/py3status,guiniol/py3status,ultrabug/py3status | py3status/modules/taskwarrior.py | py3status/modules/taskwarrior.py | # -*- coding: utf-8 -*-
"""
Display tasks currently running in taskwarrior.
Configuration parameters:
cache_timeout: refresh interval for this module (default 5)
format: display format for this module (default '{task}')
filter: arguments passed to the command
(default 'start.before:today status:pen... | # -*- coding: utf-8 -*-
"""
Display tasks currently running in taskwarrior.
Configuration parameters:
cache_timeout: refresh interval for this module (default 5)
format: display format for this module (default '{task}')
filter: arguments passed to the command
(default 'start.before:today status:pen... | bsd-3-clause | Python |
ae9b7bf45832b69f6a3ca94e24ed6d2e7d3a384d | Update __init__.py | vladcalin/pymicroservice,vladcalin/gemstone,vladcalin/pymicroservice,vladcalin/gemstone | gemstone/__init__.py | gemstone/__init__.py | """
Build microservices with Python
"""
from gemstone.core.microservice import MicroService
from gemstone.core.decorators import private_api_method, public_method, event_handler
from gemstone.core.handlers import TornadoJsonRpcHandler
from gemstone.client.remote_service import RemoteService
from gemstone.util import ... | """
Build microservices with Python
"""
from gemstone.core.microservice import MicroService
from gemstone.core.decorators import private_api_method, public_method, event_handler
from gemstone.core.handlers import TornadoJsonRpcHandler
from gemstone.client.remote_service import RemoteService
from gemstone.util import ... | mit | Python |
322d10c8932f160a305fab126401e3f172453e7e | Refactor prototxt generation. | Hornobster/Ball-Tracking,Hornobster/Ball-Tracking | generate_prototxt.py | generate_prototxt.py | #!/usr/bin/python
import os
import sys
caffe_root = os.getenv('CAFFE_ROOT', './')
sys.path.insert(0, caffe_root + '/python')
import caffe
from caffe import layers as L, params as P
def lenet(batch_size, phase):
n = caffe.NetSpec()
# empty layers as placeholders
# the resulting prototxt must be edited m... | #!/usr/bin/python
import os
import sys
caffe_root = os.getenv('CAFFE_ROOT', './')
sys.path.insert(0, caffe_root + '/python')
import caffe
from caffe import layers as L, params as P
def lenet():
n = caffe.NetSpec()
# empty layers as placeholders
# the resulting prototxt must be edited manually
n.dat... | mit | Python |
81d41ceaf89848851d8353021f01f41c724aaae8 | Add docstring to PySplunk | studiawan/pygraphc | pygraphc/misc/splunk/pysplunk.py | pygraphc/misc/splunk/pysplunk.py | from os import system, remove
class PySplunk(object):
"""Get log clustering using Python Splunk API [SplunkDev2016]_.
References
----------
.. [SplunkDev2016] Command line examples in the Splunk SDK for Python.
http://dev.splunk.com/view/python-sdk/SP-CAAAEFK
"""
def __... | from os import system, remove
class PySplunk(object):
def __init__(self, username, source, host, output_mode, tmp_file='/tmp/pysplunk_cluster.csv'):
self.username = username
self.source = source.replace(' ', '\ ')
self.host = host
self.output_mode = output_mode
self.tmp_fil... | mit | Python |
931c016e43402f847c6e58b4679f7f5cf132776f | add DESI_LOGLEVEL environment variable, add doc, define WARNING... in module | gdhungana/desispec,timahutchinson/desispec,profxj/desispec,desihub/desispec,profxj/desispec,desihub/desispec,timahutchinson/desispec,gdhungana/desispec | py/desispec/log.py | py/desispec/log.py | """
Utility functions to dump log messages
We can have something specific for DESI in the future but for now we use the standard python
"""
import sys
import logging
import os
desi_logger = None
# just for convenience to avoid importing logging
# we duplicate the logging levels
DEBUG=logging.DEBUG # Detailed ... | """
Utility functions to dump log messages
We can have something specific for DESI in the future but for now we use the standard python
"""
import sys
import logging
desi_logger = None
def get_logger(level=logging.DEBUG) :
"""
returns a default desi logger
"""
global desi_logger
if desi_... | bsd-3-clause | Python |
c8c2785b156523204e530cd78268686886ce2a37 | Fix incorrect module publics | mjhanninen/oldfart,mjhanninen/oldfart,mjhanninen/oldfart | py/oldfart/make.py | py/oldfart/make.py | import os
import re
import subprocess
__all__ = ['NOTHING_DONE', 'SUCCESS', 'NO_RULE', 'FAILURE', 'Maker']
NOTHING_DONE = 1
SUCCESS = 2
NO_RULE = 3
FAILURE = 4
class Maker(object):
def __init__(self, project_dir='.', makefile='Makefile'):
self.project_dir = os.path.abspath(project_dir)
self.m... | import os
import re
import subprocess
__all__ = ['NOOP', 'SUCCESS', 'FAIL', 'Maker']
NOTHING_DONE = 1
SUCCESS = 2
NO_RULE = 3
FAILURE = 4
class Maker(object):
def __init__(self, project_dir='.', makefile='Makefile'):
self.project_dir = os.path.abspath(project_dir)
self.makefile = os.path.absp... | bsd-3-clause | Python |
89c2e367e4d691e83ccf92055c1dc8be59e05497 | use list comprehensions for legibility | rforgione/pynder | pynder/session.py | pynder/session.py | from . import api
from . import models
class Session(object):
def __init__(self, facebook_id, facebook_token):
self._api = api.TinderAPI()
# perform authentication
self._api.auth(facebook_id, facebook_token)
self.profile = models.Profile(self._api.profile(), self)
def nearby_... | from . import api
from . import models
class Session(object):
def __init__(self, facebook_id, facebook_token):
self._api = api.TinderAPI()
# perform authentication
self._api.auth(facebook_id, facebook_token)
self.profile = models.Profile(self._api.profile(), self)
def nearby_... | mit | Python |
1aa687b70aea9074ae28d1154ae0db4364add26e | Rewrite example.py. | ryanpepper/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python | pyoommf/example.py | pyoommf/example.py | from sim import Sim
from mesh import Mesh
from exchange import Exchange
from demag import Demag
from zeeman import Zeeman
# Mesh specification.
lx = ly = lz = 50e-9 # x, y, and z dimensions (m)
dx = dy = dz = 5e-9 # x, y, and z cell dimensions (m)
Ms = 8e5 # saturation magnetisation (A/m)
A = 1e-11 # exchange ene... | import sim, mesh
# Mesh specification.
lx = ly = lz = 50e-9 # x, y, and z dimensions (m)
dx = dy = dz = 5e-9 # x, y, and z cell dimensions (m)
Ms = 8e5 # saturation magnetisation (A/m)
A = 1e-11 # exchange energy constant (J/m)
H = (1e6, 0, 0) # external magnetic field (A/m)
m_init = (0, 0, 1) # initial magneti... | bsd-2-clause | Python |
50ae1d3fb7e14fec94831a4c6667c7b1ba2e073b | add python script | colddew/mix-script,colddew/mix-script | python/python2.py | python/python2.py | #!/usr/bin/python2
# -*- coding: UTF-8 -*-
# install
# sudo pip install pymongo
# sudo pip install MySQL-python
# sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /Library/Python/2.7/site-packages/_mysql.so
# sudo pip install requests
# sudo pip install threadpool
# s... | #!/usr/bin/python2
# -*- coding: UTF-8 -*-
# install
# sudo pip install pymongo
# sudo pip install MySQL-python
# sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /Library/Python/2.7/site-packages/_mysql.so
# sudo pip install requests
# sudo pip install threadpool
# s... | mit | Python |
c0cbc2458c42bfb116c0d631c837f042f66d33a8 | Add explanatory comments to Python varargs script | rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/polyglot,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/ple,rtoal... | python/varargs.py | python/varargs.py | def f(x, y=1000, *z):
print('x={} y={} z={}'.format(x,y,z))
f(0) # x=0, y=1000, z=()
f(0,1) # x=0, y=1, z=()
f(0,1,2) # x=0, y=1, z=(2,)
f(0,1,2,3) # x=0, y=1, z=(2,3)
f(0,1,2,3,4) # x=0, y=1, z=(2,3,4)
f(*[i for i in rang... | def f(x, y=1000, *z):
print('x={} y={} z={}'.format(x,y,z))
f(0)
f(0,1)
f(0,1,2)
f(0,1,2,3)
f(0,1,2,3,4)
f(*[i for i in range(6)])
f(*range(7))
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.