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 |
|---|---|---|---|---|---|---|---|---|
cfb9664a448f1496673373e77062cb7f51cf81ad | fix arguments | bmoyles/aminator,Netflix/aminator,coryb/aminator,kvick/aminator | aminator/plugins/volume/docker.py | aminator/plugins/volume/docker.py | # -*- coding: utf-8 -*-
#
#
# Copyright 2014 Netflix, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | # -*- coding: utf-8 -*-
#
#
# Copyright 2014 Netflix, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | apache-2.0 | Python |
6f5309eb85d8cf53e89685a71c4bd6b2d3575621 | Bump version to 1.3.0 | twaddington/android-asset-resizer | android_asset_resizer/__init__.py | android_asset_resizer/__init__.py | """
android-asset-resizer
:copyright: (c) 2013 by Tristan Waddington.
:license: Apache 2.0, see LICENSE for more details.
"""
__version__ = '1.3.0'
__author__ = 'Tristan Waddington'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2013 Tristan Waddington'
| """
android-asset-resizer
:copyright: (c) 2013 by Tristan Waddington.
:license: Apache 2.0, see LICENSE for more details.
"""
__version__ = '1.2.1'
__author__ = 'Tristan Waddington'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2013 Tristan Waddington'
| apache-2.0 | Python |
b1c1100c88032d9cadb3fbc9e5b862c5d2c4e530 | fix template paths | yns88/myanimefigures-core,yns88/myanimefigures-core | anime/templatetags/user_extras.py | anime/templatetags/user_extras.py | from django import template
register = template.Library()
@register.inclusion_tag('anime/anime_gridobj.html')
def show_anime(anime):
return {'anime': anime}
@register.inclusion_tag('anime/figure_gridobj.html')
def show_figure(figure):
return {'figure': figure}
@register.inclusion_tag('anime/content_rows.... | from django import template
register = template.Library()
@register.inclusion_tag('anime_gridobj.html')
def show_anime(anime):
return {'anime': anime}
@register.inclusion_tag('figure_gridobj.html')
def show_figure(figure):
return {'figure': figure}
@register.inclusion_tag('content_rows.html')
def show_co... | bsd-2-clause | Python |
c281ec2792ac601b5915cb3fcf4de027d0038d81 | Implement celery | jlazic/GlogSMS,jlazic/GlogSMS,jlazic/GlogSMS | project/__init__.py | project/__init__.py | from __future__ import absolute_import
try:
from .celery import app as celery_app
except ImportError:
pass | from __future__ import absolute_import
from django.conf import settings
if settings.USE_CELERY:
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app | mit | Python |
76f0dc536ee2e9c08b195306d108f4a8f96d1334 | Add buffer for deploy exceptions per #9 | renfredxh/compilebot | compilebot/deploy.py | compilebot/deploy.py | import time
import traceback
from requests import HTTPError, ConnectionError
import compilebot as bot
SLEEP_TIME = 60
def main():
errors = []
try:
bot.log("Initializing bot")
while True:
try:
for error in errors:
bot.log(error, alert=True)
... | import time
import traceback
from requests import HTTPError, ConnectionError
import compilebot as bot
SLEEP_TIME = 60
def main():
try:
bot.log("Initializing bot")
while True:
try:
bot.main()
except HTTPError as e:
# HTTP Errors may indicate r... | apache-2.0 | Python |
c8c7aea10ef307269041e42f2436ecb5b0b2f77c | Implement get_connected_components | stephtzhang/algorithms | connected_components.py | connected_components.py | def get_connected_components(g):
"""
Return an array of arrays, each representing a connected component.
:param dict g: graph represented as an adjacency list where all nodes are labeled 1 to n.
:returns: array of arrays, each representing a connected component.
"""
connected_components = []
... | def get_connected_components():
# assume nodes labeled 1 to n
# connected_components = []
# for i in 1..n
# if i not yet explored
# connected_component = bfs (graph, node i)
# connected_components.append(connected_component)
# return connected_components
| mit | Python |
10e37d95dde00cd02d91998662a22f555837e877 | Update the version to 3.1.1 | hp-storage/python-3parclient,hpe-storage/python-3parclient | hp3parclient/__init__.py | hp3parclient/__init__.py | # Copyright 2012-2014 Hewlett Packard Development Company, L.P.
# 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/LICE... | # Copyright 2012-2014 Hewlett Packard Development Company, L.P.
# 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/LICE... | apache-2.0 | Python |
8185256c229d7d646c0bc8870f856b007d9a3194 | Update metadata description. | seanfisk/ecs,seanfisk/ecs | ecs/metadata.py | ecs/metadata.py | """Project metadata
Information describing the project.
"""
# The package name, which is also the so-called "UNIX name" for the project.
package = 'ecs'
project = "Entity-Component-System"
project_no_spaces = project.replace(' ', '')
version = '0.1'
description = 'An entity/component system library for games'
authors... | """Project metadata
Information describing the project.
"""
# The package name, which is also the so-called "UNIX name" for the project.
package = 'ecs'
project = "Entity-Component-System"
project_no_spaces = project.replace(' ', '')
version = '0.1'
description = 'An entity system in Python'
authors = ['Sean Fisk', '... | mit | Python |
99bb96868743708a5f5a4b87d382f56af7be6d0a | fix for passing kwargs to constructor | inveniosoftware/invenio-db,inveniosoftware/invenio-db | invenio_db/core.py | invenio_db/core.py | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio 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 2 of the
# License, or (at your option) any later... | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio 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 2 of the
# License, or (at your option) any later... | mit | Python |
f6491f7be0baeea88fa4ece2299faa74590635b8 | change exception | yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti | core/analytics_tasks.py | core/analytics_tasks.py | from __future__ import unicode_literals
import logging
import traceback
from datetime import datetime
from mongoengine import DoesNotExist
from core.analytics import ScheduledAnalytics, AnalyticsResults
from core.config.celeryctl import celery_app
from core.observables import Observable
@celery_app.task
def each(m... | from __future__ import unicode_literals
from datetime import datetime
import logging
import traceback
from core.config.celeryctl import celery_app
from core.observables import Observable
from core.analytics import ScheduledAnalytics, AnalyticsResults
from mongoengine import DoesNotExist
@celery_app.task
def each(m... | apache-2.0 | Python |
9f95715cc7260d02d88781c208f6a6a167496015 | Fix bug with JSONPointer if part passed via __truediv__ is integer | vovanbo/aiohttp_json_api | aiohttp_json_api/jsonpointer/__init__.py | aiohttp_json_api/jsonpointer/__init__.py | """
Extended JSONPointer from python-json-pointer_
==============================================
.. _python-json-pointer: https://github.com/stefankoegl/python-json-pointer
"""
import typing
from jsonpointer import JsonPointer as BaseJsonPointer
class JSONPointer(BaseJsonPointer):
def __init__(self, pointer):... | """
Extended JSONPointer from python-json-pointer_
==============================================
.. _python-json-pointer: https://github.com/stefankoegl/python-json-pointer
"""
import typing
from jsonpointer import JsonPointer as BaseJsonPointer
class JSONPointer(BaseJsonPointer):
def __init__(self, pointer):... | mit | Python |
0b487adf8dc4321ded4e51ae129d26c73918c16c | add simuvex.options as an alias for simuvex.o | chubbymaggie/simuvex,schieb/angr,iamahuman/angr,chubbymaggie/angr,axt/angr,angr/simuvex,chubbymaggie/angr,tyb0807/angr,tyb0807/angr,tyb0807/angr,angr/angr,f-prettyland/angr,axt/angr,chubbymaggie/angr,schieb/angr,chubbymaggie/simuvex,f-prettyland/angr,schieb/angr,chubbymaggie/simuvex,iamahuman/angr,iamahuman/angr,angr/a... | simuvex/__init__.py | simuvex/__init__.py | #!/usr/bin/env python
'''This module handles constraint generation.'''
import logging
logging.getLogger("simuvex").addHandler(logging.NullHandler())
# pylint: disable=W0401
from .s_state import SimState
from .s_errors import *
from .s_action import *
from .s_procedure import SimProcedure
import simuvex.procedures
fr... | #!/usr/bin/env python
'''This module handles constraint generation.'''
import logging
logging.getLogger("simuvex").addHandler(logging.NullHandler())
# pylint: disable=W0401
from .s_state import SimState
from .s_errors import *
from .s_action import *
from .s_procedure import SimProcedure
import simuvex.procedures
fr... | bsd-2-clause | Python |
900c878035d286d63717e68d7631a0119a6bd232 | Update the test settings | fusionbox/django-authtools | tests/tests/settings.py | tests/tests/settings.py | from __future__ import print_function
import os
SECRET_KEY = 'w6bidenrf5q%byf-q82b%pli50i0qmweus6gt_3@k$=zg7ymd3'
SITE_ID = 1
INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.staticfiles',
'django.contr... | from __future__ import print_function
import os
SECRET_KEY = 'w6bidenrf5q%byf-q82b%pli50i0qmweus6gt_3@k$=zg7ymd3'
SITE_ID = 1
INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.staticfiles',
'django.contr... | bsd-2-clause | Python |
f34396133d67c562aa9e928db411c6ee23fcc042 | bump version | seatgeek/sixpack,spjwebster/sixpack,seatgeek/sixpack,smokymountains/sixpack,spjwebster/sixpack,blackskad/sixpack,vpuzzella/sixpack,llonchj/sixpack,llonchj/sixpack,blackskad/sixpack,smokymountains/sixpack,llonchj/sixpack,blackskad/sixpack,vpuzzella/sixpack,blackskad/sixpack,nickveenhof/sixpack,vpuzzella/sixpack,seatgeek... | sixpack/__init__.py | sixpack/__init__.py | __version__ = '0.0.4'
| __version__ = '0.0.3'
| bsd-2-clause | Python |
19f3a7b8b1066db6ffb944af9debbfdfdd6c1b34 | Add READMe.md | locationlabs/awsenv | awsenv/main.py | awsenv/main.py | """
Command line entry point.
"""
from argparse import ArgumentParser
from os import environ
from pipes import quote
from sys import argv
from awsenv.cache import CachedSession, DEFAULT_SESSION_DURATION
from awsenv.profile import AWSProfile
def parse_args(args):
"""
Select the AWS profile to use.
Defaul... | """
Command line entry point.
"""
from argparse import ArgumentParser
from os import environ
from pipes import quote
from sys import argv
from awsenv.cache import CachedSession, DEFAULT_SESSION_DURATION
from awsenv.profile import AWSProfile
def parse_args(args):
"""
Select the AWS profile to use.
Defaul... | apache-2.0 | Python |
701f278cfff56039bb43ad050f2f773c436455b7 | Update version.py | RasaHQ/rasa_core,RasaHQ/rasa_nlu,RasaHQ/rasa_core,RasaHQ/rasa_nlu,RasaHQ/rasa_core,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.9.0a6'
| from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
__version__ = '0.9.0a5'
| apache-2.0 | Python |
c229a5a5fb7ab38a6762ab6072b73022509010d9 | Fix in prune | periscope-ps/unis,periscope-ps/unis,periscope-ps/unis,periscope-ps/unis | scripts/unis_prune_exnodes.py | scripts/unis_prune_exnodes.py | from pymongo import MongoClient
import datetime
def prune_extents(collection):
to_remove = []
extents = collection.find()
now = datetime.datetime.utcnow()
for extent in extents:
expires = now
try:
expires = extent["lifetimes"][0]["end"]
expires = datetime.dateti... | from pymongo import MongoClient
import datetime
def prune_extents(collection):
to_remove = []
extents = collection.find()
now = datetime.datetime.utcnow()
for extent in extents:
expires = now
try:
expires = extent["lifetimes"][0]["end"]
expires = datetime.dateti... | bsd-3-clause | Python |
d78fbfd47ee9875c5ce93ff7d51c6aabecf5d57b | add wsgi file | 7Linternational/GameHub-backend | gamehub.wsgi | gamehub.wsgi | import app as application
| import sys, os
sys.path.insert (0,'/opt/shared/webroot/ROOT')
from gamehub import app as application
| apache-2.0 | Python |
69eb31b4105ddc83cccdd228a887a85e933479e0 | Bump to version v1.1.11 | hkmshb/django-select2-forms,SpectralAngel/django-select2-forms,hkmshb/django-select2-forms,sandow-digital/django-select2-forms,SpectralAngel/django-select2-forms,sandow-digital/django-select2-forms,JP-Ellis/django-select2-forms,sandow-digital/django-select2-forms,hkmshb/django-select2-forms,SpectralAngel/django-select2... | select2/__init__.py | select2/__init__.py | __version_info__ = (1, 1, 11)
__version__ = '.'.join(map(str, __version_info__))
| __version_info__ = (1, 1, 10)
__version__ = '.'.join(map(str, __version_info__))
| bsd-2-clause | Python |
f67db8ce9fac261c91688ca2aabb14b22e0b72ec | Update __init__.py | aspuru-guzik-group/selfies | selfies/__init__.py | selfies/__init__.py | #!/usr/bin/env python
__author__ = 'Mario Krenn'
__version__ = 'v0.2.1'
from .selfies import encoder, decoder
| #!/usr/bin/env python
__author__ = 'Mario Krenn'
__version__ = 'v0.2.1'
from .selfies_fcts import encoder, decoder
| apache-2.0 | Python |
1f9adf8fae46211459fe910b81e6c18e18ad853b | Update version to 1.7.0 | artefactual/archivematica,artefactual/archivematica,artefactual/archivematica,artefactual/archivematica | src/archivematicaCommon/lib/version.py | src/archivematicaCommon/lib/version.py | ARCHIVEMATICA_VERSION = (1, 7, 0)
def get_version():
""" Returns the version number as a string. """
# Inspired by Django's get_version
version = ARCHIVEMATICA_VERSION
parts = 2 if version[2] == 0 else 3
main = '.'.join(str(x) for x in version[:parts])
return main
def get_full_version():
... | ARCHIVEMATICA_VERSION = (1, 6, 0)
def get_version():
""" Returns the version number as a string. """
# Inspired by Django's get_version
version = ARCHIVEMATICA_VERSION
parts = 2 if version[2] == 0 else 3
main = '.'.join(str(x) for x in version[:parts])
return main
def get_full_version():
... | agpl-3.0 | Python |
c60060f08700bfdbbcb566927624e2ec3af53145 | Add missing newline for PEP8. | naoey/slash-bot,naoey/slash-bot | slash_bot/errors.py | slash_bot/errors.py | # coding: utf-8
"""
Created on 2016-08-23
@author: naoey
"""
class SlashBotError(Exception):
pass
class ConfigError(SlashBotError):
def __init__(self, config_attr=None):
if config_attr:
super().init("Missing/invalid config for {}".format(config_attr))
else:
super().i... | # coding: utf-8
"""
Created on 2016-08-23
@author: naoey
"""
class SlashBotError(Exception):
pass
class ConfigError(SlashBotError):
def __init__(self, config_attr=None):
if config_attr:
super().init("Missing/invalid config for {}".format(config_attr))
else:
super().in... | mit | Python |
76ff7db2b479d783592375721236a961998af57c | Bump patch | egtaonline/quiesce | egta/__init__.py | egta/__init__.py | __version__ = '0.0.16'
| __version__ = '0.0.15'
| apache-2.0 | Python |
50c3eec5f9c1a441ed0669fee51192db260ae3f4 | change user | mpusher/mpush,hongjun117/mpush,hongjun117/mpush,mpusher/mpush,hongjun117/mpush,mpusher/mpush | pub-python.py | pub-python.py | # coding=utf8
import paramiko
class SSH():
def __init__(self):
self.client = None
def connect(self,host,port=22,username='root',password=None):
self.client = paramiko.SSHClient()
self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.client.connect(host, port, ... | #! /usr/bin/python
# coding=utf8
import paramiko
class SSH():
def __init__(self):
self.client = None
def connect(self,host,port=22,username='root',password=None):
self.client = paramiko.SSHClient()
self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.client.c... | apache-2.0 | Python |
9a3cfdc1f27bb83d2d3b014a41b2ab6e80cf2d42 | change sth | ccqpein/ccqpein.github.io | _posts/resetup.py | _posts/resetup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import re
import time
#参数传递
script, filename = sys.argv
if __name__ == "__main__":
#如果输入了.md则删除掉
filename = re.sub(r'\.md', '', filename)
#读取文件,为防止最后没有换行,和下面冲突,最后添加一个换行
s = open(filename+'.md','r').readlines()
s[-1] = s[-1] + '\n'
ss = []
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import re
import time
#参数传递
script, filename = sys.argv
if __name__ == "__main__":
#如果输入了.md则删除掉
filename = re.sub(r'\.md', '', filename)
#读取文件,为防止最后没有换行,和下面冲突,最后添加一个换行
s = open(filename+'.md','r').readlines()
s[-1] = s[-1] + '\n'
ss = []
... | mit | Python |
fb61c3c64d2426e4e7a6e454cbf57b15e003ce66 | Add list of entities and ETL classes for CSV files | soccermetrics/marcotti-mls | etl/__init__.py | etl/__init__.py | from base import BaseCSV, get_local_handles, ingest_feeds, create_seasons
from overview import (ClubIngest, CountryIngest, CompetitionIngest, PlayerIngest, PersonIngest)
from financial import (AcquisitionIngest, PlayerSalaryIngest, PartialTenureIngest)
from statistics import (FieldStatIngest, GoalkeeperStatIngest, Leag... | from base import BaseCSV, get_local_handles, ingest_feeds, create_seasons
from overview import (ClubIngest, CountryIngest, CompetitionIngest, PlayerIngest, PersonIngest)
from financial import (AcquisitionIngest, PlayerSalaryIngest, PartialTenureIngest)
from statistics import (FieldStatIngest, GoalkeeperStatIngest, Leag... | mit | Python |
b17bf0d45f066b5b98ae7fc36b13510826dc6bb7 | Test statistics print formatting | samuelsh/pyFstress,samuelsh/pyFstress | server/collector.py | server/collector.py | """
Collector service provides methods for collection of test runtime results results and storing results
2017 - samuels(c)
"""
import time
from logger import server_logger
class Collector:
def __init__(self, test_stats, stop_event):
self.logger = server_logger.StatsLogger('__Collector__').logger
... | """
Collector service provides methods for collection of test runtime results results and storing results
2017 - samuels(c)
"""
import time
from logger import server_logger
class Collector:
def __init__(self, test_stats, stop_event):
self.logger = server_logger.StatsLogger('__Collector__').logger
... | mit | Python |
e5990977ee028d593d69aeed53d00c16bfce9152 | set local to be default db | grundgruen/powerline,grundgruen/powerline,warren-oneill/powerline,warren-oneill/powerline | gg/powerline/settings.py | gg/powerline/settings.py | __author__ = 'Warren'
from gg.database.mysql_conf import mysql_connection
connection = mysql_connection
| __author__ = 'Warren'
from gg.database.mysql_conf import mysql_connection_aws as mysql_connection
connection = mysql_connection
| apache-2.0 | Python |
b6e8e954b1e2fdd96c691723a074a75ebdc88506 | Fix typo. | tilezen/joerd,mapzen/joerd | joerd/queue/sqs.py | joerd/queue/sqs.py | import boto3
import json
class Message(object):
"""
A wrapper around the SQS message, basically to unpack the JSON body and
hold a message handle so that delete can be called on success.
"""
def __init__(msg):
self.msg = msg
self.body = json.loads(self.msg.body)
def delete(se... | import boto3
import json
class Message(object):
"""
A wrapper around the SQS message, basically to unpack the JSON body and
hold a message handle so that delete can be called on success.
"""
def __init__(msg):
self.msg = msg
self.body = json.loads(self.msg.body)
def delete(se... | mit | Python |
0da19042c74d2a85ef4652b36186a1ee6c4fc247 | Use round_fn to specify built-in round function | mapzen/tilequeue,tilezen/tilequeue | tilequeue/format/mvt.py | tilequeue/format/mvt.py | from mapbox_vector_tile.encoder import on_invalid_geometry_make_valid
from mapbox_vector_tile import encode as mvt_encode
def encode(fp, feature_layers, coord, bounds_merc):
tile = mvt_encode(
feature_layers,
quantize_bounds=bounds_merc,
on_invalid_geometry=on_invalid_geometry_make_valid,
... | from mapbox_vector_tile.encoder import on_invalid_geometry_make_valid
from mapbox_vector_tile import encode as mvt_encode
def encode(fp, feature_layers, coord, bounds_merc):
tile = mvt_encode(feature_layers, quantize_bounds=bounds_merc,
on_invalid_geometry=on_invalid_geometry_make_valid)
... | mit | Python |
2527f999a1dcd43ac9359728475570c9933b19ed | Change to use sqlalchemy.ext.declarative | gmr/tinman,lucius-feng/tinman,gmr/tinman,lucius-feng/tinman,lucius-feng/tinman | tinman/models/common.py | tinman/models/common.py | """
Common Model Parts
"""
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.dialects import postgresql
# Use declaritive base syntax
Base = declarative_base()
# metadata object for this module
metadata = Base.metadata | """
Common Model Parts
"""
import sqlalchemy
# metadata object for this module
metadata = sqlalchemy.MetaData() | bsd-3-clause | Python |
c7a7dc7eb144d82939bc2ca0f1f79133f734db08 | enable macros in word | cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo | analyzer/windows/modules/packages/doc.py | analyzer/windows/modules/packages/doc.py | # Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from _winreg import HKEY_CURRENT_USER
from lib.common.abstracts import Package
class DOC(Package):
"""Word analysis package."""
PATHS = [
... | # Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from _winreg import HKEY_CURRENT_USER
from lib.common.abstracts import Package
class DOC(Package):
"""Word analysis package."""
PATHS = [
... | mit | Python |
1fdd932aac2becfd0712c092c340aaf99f8ae8a8 | fix the annoying pep8 requirement | mupi/timtec,GustavoVS/timtec,virgilio/timtec,mupi/escolamupi,GustavoVS/timtec,AllanNozomu/tecsaladeaula,virgilio/timtec,GustavoVS/timtec,mupi/tecsaladeaula,mupi/tecsaladeaula,mupi/timtec,virgilio/timtec,mupi/tecsaladeaula,AllanNozomu/tecsaladeaula,hacklabr/timtec,mupi/timtec,hacklabr/timtec,AllanNozomu/tecsaladeaula,mu... | accounts/views.py | accounts/views.py | from django.contrib.auth import get_user_model
from django.contrib.auth.views import login
from django.core.urlresolvers import reverse
from django.shortcuts import redirect, get_object_or_404
from django.template.response import TemplateResponse
from django.utils.http import is_safe_url
from django.views.generic impor... | from django.contrib.auth import get_user_model
from django.contrib.auth.views import login
from django.core.urlresolvers import reverse
from django.shortcuts import redirect, get_object_or_404
from django.template.response import TemplateResponse
from django.utils.http import is_safe_url
from django.views.generic impor... | agpl-3.0 | Python |
a59c229333fbcba8541adc690acdd4ed956ed022 | fix name | znick/anytask,znick/anytask,znick/anytask,znick/anytask | anytask/users/templatetags/table_func.py | anytask/users/templatetags/table_func.py | from django import template
register = template.Library()
@register.filter(name='exist')
def another_table_exist(d, index):
return bool(d[int(not index)])
@register.filter(name='has_item')
def item_in_tuple(d, item):
for x, y in d:
if x == item:
return True
return False
| from django import template
register = template.Library()
@register.filter(name='exist')
def another_table_exist(d, index):
return bool(d[int(not index)])
@register.filter(name='has_item')
def another_table_exist(d, item):
for x, y in d:
if x == item:
return True
return False
| mit | Python |
deba3a2a64a5201af5db9c0b91a4b654c81a57a5 | Increase supplement chartext | jeffshek/betterself,jeffshek/betterself,jeffshek/betterself,jeffshek/betterself | apis/betterself/v1/signup/serializers.py | apis/betterself/v1/signup/serializers.py | from django.contrib.auth import get_user_model
from rest_framework import serializers
from rest_framework.validators import UniqueValidator
from betterself.users.models import TIMEZONE_CHOICES
User = get_user_model()
class CreateUserSerializer(serializers.ModelSerializer):
username = serializers.CharField(min_l... | from django.contrib.auth import get_user_model
from rest_framework import serializers
from rest_framework.validators import UniqueValidator
from betterself.users.models import TIMEZONE_CHOICES
User = get_user_model()
class CreateUserSerializer(serializers.ModelSerializer):
username = serializers.CharField(min_l... | mit | Python |
ed6003990c6a46c7fbbf2c946b18c48d86d0916e | Fix test_item script | maurobaraldi/grab,shaunstanislaus/grab,codevlabs/grab,subeax/grab,subeax/grab,DDShadoww/grab,shaunstanislaus/grab,giserh/grab,istinspring/grab,raybuhr/grab,codevlabs/grab,huiyi1990/grab,liorvh/grab,kevinlondon/grab,maurobaraldi/grab,SpaceAppsXploration/grab,alihalabyah/grab,pombredanne/grab-1,subeax/grab,giserh/grab,ke... | grab/script/test_item.py | grab/script/test_item.py | from grab import Grab
def setup_arg_parser(parser):
parser.add_argument('item_path')
parser.add_argument('--all', action='store_true', default=False)
def main(item_path, **kwargs):
mod_path, cls_name = item_path.rsplit('.', 1)
mod = __import__(mod_path, None, None, ['foo'])
cls = getattr(mod, cls... | from grab import Grab
def setup_arg_parser(parser):
parser.add_argument('--all', action='store_true', default=False)
def main(*args, **kwargs):
mod_path, cls_name = args[0].rsplit('.', 1)
mod = __import__(mod_path, None, None, ['foo'])
cls = getattr(mod, cls_name)
if kwargs.get('all'):
u... | mit | Python |
7463320f10086460d6f63c0bb36351284f29d1cb | Make it process energy by default | araines/energymonitor | energymonitor.py | energymonitor.py | import sys, socket, re, time
from pyrrd.rrd import DataSource, RRA, RRD
from pyrrd.graph import DEF, LINE, GPRINT, Graph
RRD_IMAGES_LOCATION = '/www/rrdtool'
def get_energy():
tx_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
tx_sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
tx_sock.setsockop... | import sys, socket, re, time
from pyrrd.rrd import DataSource, RRA, RRD
from pyrrd.graph import DEF, LINE, GPRINT, Graph
RRD_IMAGES_LOCATION = '/www/rrdtool'
def get_energy():
tx_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
tx_sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
tx_sock.setsockop... | mit | Python |
a437660e31f069dd4c348f991433719c4867a414 | delete unused urls | jeromecc/doctoctocbot | src/display/urls.py | src/display/urls.py | from django.urls import path
from django.conf.urls import url, include
from django.views.decorators.cache import cache_page
from .models import WebTweet
from .serializers import WebTweetSerializer
from rest_framework import routers, viewsets
from . import views
app_name = 'display'
# ViewSets define the view behavi... | from django.urls import path
from django.conf.urls import url, include
from django.views.decorators.cache import cache_page
from .models import WebTweet
from .serializers import WebTweetSerializer
from rest_framework import routers, viewsets
from . import views
app_name = 'display'
# ViewSets define the view behavi... | mpl-2.0 | Python |
8db6cbf90cafe707467256382388f13d7a3eb2d1 | Add postorder_eval_parse_tree() | bowen0701/algorithms_data_structures | alg_parse_tree.py | alg_parse_tree.py | from __future__ import print_function
from __future__ import division
from ds_stack import Stack
from ds_binary_tree import BinaryTree
def build_parse_tree(fp_exp):
fp_ls = fp_exp.split()
par_stack = Stack()
parse_tree = BinaryTree('')
par_stack.push(parse_tree)
current_tree = parse_tree
for ... | from __future__ import print_function
from __future__ import division
from ds_stack import Stack
from ds_binary_tree import BinaryTree
def build_parse_tree(fp_exp):
fp_ls = fp_exp.split()
par_stack = Stack()
parse_tree = BinaryTree('')
par_stack.push(parse_tree)
current_tree = parse_tree
for ... | bsd-2-clause | Python |
8d473fb51d903c5625e5212d3981d01697e452ba | increment version | cggh/scikit-allel | allel/__init__.py | allel/__init__.py | # -*- coding: utf-8 -*-
# flake8: noqa
__version__ = '0.16.0.dev0'
import allel.model as model
from allel.model import *
import allel.stats as stats
import allel.plot as plot
import allel.io as io
import allel.constants as constants
| # -*- coding: utf-8 -*-
# flake8: noqa
__version__ = '0.15.0'
import allel.model as model
from allel.model import *
import allel.stats as stats
import allel.plot as plot
import allel.io as io
import allel.constants as constants
| mit | Python |
464bc1b511415459e99700b94101776d00b23796 | Create function to handle full pipeline. | bgyori/indra,johnbachman/indra,bgyori/indra,sorgerlab/belpy,pvtodorov/indra,johnbachman/indra,sorgerlab/indra,bgyori/indra,johnbachman/belpy,pvtodorov/indra,sorgerlab/belpy,johnbachman/belpy,sorgerlab/indra,sorgerlab/belpy,johnbachman/indra,johnbachman/belpy,sorgerlab/indra,pvtodorov/indra,pvtodorov/indra | indra/pre_assemble_for_db/pre_assemble_script.py | indra/pre_assemble_for_db/pre_assemble_script.py | import indra.tools.assemble_corpus as ac
from indra.db.util import get_statements, insert_pa_stmts
def process_statements(stmts, num_procs=1):
stmts = ac.map_grounding(stmts)
stmts = ac.map_sequence(stmts)
stmts = ac.run_preassembly(stmts, return_toplevel=False,
poolsize=num... | import indra.tools.assemble_corpus as ac
def process_statements(stmts):
stmts = ac.map_grounding(stmts)
stmts = ac.map_sequence(stmts)
stmts = ac.run_preassembly(stmts, return_toplevel=False)
return stmts
| bsd-2-clause | Python |
07791c621d651b9d9e2d02cc66b7bd6cf8fa340c | Fix dnd module not answering in private chat | nickraptis/fidibot,nickraptis/fidibot | src/modules/dnd.py | src/modules/dnd.py | # Author: John Giannakopoulos <giannakopoulosj@gmail.com>
import random
from basemodule import BaseModule, BaseCommandContext
from alternatives import _
class dndContext(BaseCommandContext):
def cmd_roll(self, argument):
"""
Rolling D&D style
Usage: roll attack|save modi... | # Author: John Giannakopoulos <giannakopoulosj@gmail.com>
import random
from basemodule import BaseModule, BaseCommandContext
from alternatives import _
class dndContext(BaseCommandContext):
def cmd_roll(self, argument):
"""
Rolling D&D style
Usage: roll attack|save modi... | bsd-2-clause | Python |
d3541f3ccf13f579b5a22ff15e988d2b390325e0 | Update 04Dan.py | WeirdCoder/LilyPadOS,WeirdCoder/LilyPadOS,WeirdCoder/LilyPadOS,WeirdCoder/LilyPadOS | 04Dan/04Dan.py | 04Dan/04Dan.py | import lcm
import time
import L04Dan
lc = lcm.LCM()
msg = L04Dan()
msg.name = "Dark n Chunky"
def my_handler(channel, data):
print("Received message from 04")
subscription = lc.subscribe("04DAN", myhandler)
lc.publish("04DAN", msg.encode())
try:
while True:
lc.handle()
except Keyboardinterrupt:
... | import lcm
import time
from lcmtype import L04Dan
lc = lcm.LCM()
msg = L04Dan()
msg.name = "Dark n Chunky"
def my_handler(channel, data):
print("Received message from 04")
subscription = lc.subscribe("04DAN", myhandler)
lc.publish("04DAN", msg.encode())
try:
while True:
lc.handle()
except Keyboar... | mit | Python |
60430260f0bec7b9231c2dcb3ed3394dd81442b2 | Remove ability to recieve messages | ben-cunningham/python-messenger-bot,ben-cunningham/pybot | fbmsgbot/bot.py | fbmsgbot/bot.py | from http_client import HttpClient
class Bot():
"""
@breif Facebook messenger bot
"""
def __init__(self, token):
self.api_token = token
self.client = HttpClient()
def send_message(self, message, completion):
def completion(response, error):
if error is None:
... | from http_client import HttpClient
"""
@breif Facebook messenger bot
"""
class Bot():
def __init__(self, token):
self.api_token = token
self.client = HttpClient()
def send_message(self, message, completion):
def completion(response, error):
if error is None:
... | mit | Python |
4a0fe92c3990e04c7e3a07f0351f2fcae4b16e2a | sort glob() output for consistent results | binary1230/sideboard,binary1230/sideboard,magfest/sideboard,RobRuana/sideboard,magfest/sideboard,RobRuana/sideboard,RobRuana/sideboard,binary1230/sideboard,magfest/sideboard,binary1230/sideboard,magfest/sideboard,RobRuana/sideboard | sideboard/internal/imports.py | sideboard/internal/imports.py | from __future__ import unicode_literals
import sys
import importlib
from glob import glob
from os.path import join, isdir, basename
from sideboard.config import config
plugins = {}
def _discover_plugins():
ordered = list(reversed(config['priority_plugins']))
plugin_dirs = [d for d in glob(join(config['plugi... | from __future__ import unicode_literals
import sys
import importlib
from glob import glob
from os.path import join, isdir, basename
from sideboard.config import config
plugins = {}
def _discover_plugins():
ordered = list(reversed(config['priority_plugins']))
plugin_dirs = [d for d in glob(join(config['plugin... | bsd-3-clause | Python |
4edb490e9a1408b629ffe59bc00d09e01d093aae | Fix up config. Remove older cruft. | reticulatingspline/MLB | config.py | config.py | ###
# Copyright (c) 2012-2013, spline
# All rights reserved.
#
#
###
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('MLB')
def configure(advanced):
# This will be called by supybot to co... | ###
# Copyright (c) 2012-2013, spline
# All rights reserved.
#
#
###
import os
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('MLB')
def configure(advanced):
# This will be called by su... | mit | Python |
95bea68e07590b9fe7e685d1e33905a545641415 | Add the register function in the views file. | icyflame/test-taking-platform,icyflame/test-taking-platform | examsys/views.py | examsys/views.py | from django.shortcuts import render
# def index(request):
# return HttpResponse("Hello, world. You're at the polls index.")
# Create your views here.
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext, loader
from exa... | from django.shortcuts import render
# def index(request):
# return HttpResponse("Hello, world. You're at the polls index.")
# Create your views here.
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext, loader
from exa... | mit | Python |
706459dc88d52c514b66bf1c335a3e188c14b7bd | Update neighbors.py | dustalov/watlink,dustalov/watlink | exp/neighbors.py | exp/neighbors.py | #!/usr/bin/env python
import argparse
from gensim.models.word2vec import Word2Vec
import csv
from collections import defaultdict
import numpy as np
import sys
parser = argparse.ArgumentParser(description='Prediction.')
parser.add_argument('--w2v', required=True, type=argparse.FileType('rb'))
parser.add_argument('--fa... | #!/usr/bin/env python
import argparse
from gensim.models.word2vec import Word2Vec
import csv
import numpy as np
import sys
parser = argparse.ArgumentParser(description='Prediction.')
parser.add_argument('--w2v', required=True, type=argparse.FileType('rb'))
parser.add_argument('--faiss', required=True)
parser.add_argu... | mit | Python |
3410a73b873d617e7797fefba1ae3999206614d8 | Update PL season | conormag94/pyscores | config.py | config.py | LEAGUE_IDS = {
"BL1" : "394",
"BL2" : "395",
"FL1" : "396",
"FL2" : "397",
"PL" : "426",
"PD" : "399",
"SD" : "400",
"SA" : "401",
"PPL" : "402",
"BL3" : "403",
"DED" : "404"
}
| LEAGUE_IDS = {
"BL1" : "394",
"BL2" : "395",
"FL1" : "396",
"FL2" : "397",
"PL" : "398",
"PD" : "399",
"SD" : "400",
"SA" : "401",
"PPL" : "402",
"BL3" : "403",
"DED" : "404"
}
| mit | Python |
db1b436c49f9d2e0661053d8062828aa820db72b | remove unnecessary config | dschmaryl/golf-flask,dschmaryl/golf-flask,dschmaryl/golf-flask | config.py | config.py | import os
import pathlib
BASE_DIR = pathlib.Path(__file__).resolve().parent
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
SQLALCHEMY_TRACK_MODIFICATIONS = False
WTF_CSRF_ENABLED = True
SECRET_KEY = os.environ['SECRET_KEY']
RECAPTCHA_PUBLIC_KEY = os.environ['RECAPTCHA_PUBLIC_KEY']
RECAPTCHA_PRIVATE_KEY = os.... | import os
import pathlib
BASE_DIR = pathlib.Path(__file__).resolve().parent
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
SQLALCHEMY_MIGRATE_REPO = str(BASE_DIR / 'migrations')
SQLALCHEMY_TRACK_MODIFICATIONS = False
WTF_CSRF_ENABLED = True
SECRET_KEY = os.environ['SECRET_KEY']
RECAPTCHA_PUBLIC_KEY = os.env... | mit | Python |
347abf1a8ec5d246133936fe1444be0908bffa1c | Remove some debugging | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org | config.py | config.py | import glob
import os
from flask import Flask
from werkzeug.contrib.fixers import ProxyFix
from flask_sslify import SSLify
from foauth.providers import OAuthMeta
app = Flask(__name__)
app.secret_key = os.environ['SECRET_KEY']
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL')
app.config['DEBUG'] =... | import glob
import os
from flask import Flask
from werkzeug.contrib.fixers import ProxyFix
from flask_sslify import SSLify
from foauth.providers import OAuthMeta
app = Flask(__name__)
app.secret_key = os.environ['SECRET_KEY']
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL')
app.config['DEBUG'] =... | bsd-3-clause | Python |
5a23b171cd9b9851364e8876ff2ecfa5f908ac5e | bump version | rgardler/simdem,rgardler/simdem,rgardler/simdem,rgardler/simdem | config.py | config.py | SIMDEM_VERSION = "0.7.5-dev"
SIMDEM_TEMP_DIR = "~/.simdem/tmp"
# When in demo mode we insert a small random delay between characters.
# TYPING DELAY is the upper bound of this delay.
TYPING_DELAY = 0.08
#################################################################
# Don't change anything below here unless you kno... | SIMDEM_VERSION = "0.7.4-dev"
SIMDEM_TEMP_DIR = "~/.simdem/tmp"
# When in demo mode we insert a small random delay between characters.
# TYPING DELAY is the upper bound of this delay.
TYPING_DELAY = 0.08
#################################################################
# Don't change anything below here unless you kno... | mit | Python |
585f1ad3545bf42f1557f389fd18da4aec41696a | Bump version to 0.2.0 | lltk/Batyr,lltk/Batyr | Batyr/batyr.py | Batyr/batyr.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Markus Beuckelmann'
__author_email__ = 'email@markus-beuckelmann.de'
__version__ = '0.2.0'
from flask import Flask, jsonify, abort, redirect, url_for
from flask import render_template
import json
import os
from random import randint
app = Flask(__name__)
dat... | #!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Markus Beuckelmann'
__author_email__ = 'email@markus-beuckelmann.de'
__version__ = '0.1.0'
from flask import Flask, jsonify, abort, redirect, url_for
from flask import render_template
import json
import os
from random import randint
app = Flask(__name__)
dat... | agpl-3.0 | Python |
16d38533aa6ca5a338528710d1f9b5f19354e06d | Fix config.py syntax error. | reticulatingspline/Weather,cgie/Weather | config.py | config.py | ###
# Copyright (c) 2012-2014, spline
# All rights reserved.
###
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Weather')
def configure(advanced):
# This will be called by supybot to co... | ###
# Copyright (c) 2012-2014, spline
# All rights reserved.
###
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Weather')
def configure(advanced):
# This will be called by supybot to co... | mit | Python |
27952e96e05cea4ce0f665c3ac78a49ced6defe9 | Add comment for e.path schema validation fix | alphagov/notifications-api,alphagov/notifications-api | app/schema_validation/__init__.py | app/schema_validation/__init__.py | import json
from jsonschema import (Draft4Validator, ValidationError, FormatChecker)
from notifications_utils.recipients import (validate_phone_number, validate_email_address, InvalidPhoneError,
InvalidEmailError)
def validate(json_to_validate, schema):
format_checker ... | import json
from jsonschema import (Draft4Validator, ValidationError, FormatChecker)
from notifications_utils.recipients import (validate_phone_number, validate_email_address, InvalidPhoneError,
InvalidEmailError)
def validate(json_to_validate, schema):
format_checker ... | mit | Python |
07219456f496dc83cf05677b46e4f0f673302d05 | use standard library achieve | zws0932/farmer,huoxy/farmer,zws0932/farmer | farmer/models.py | farmer/models.py | #coding=utf8
from __future__ import with_statement
import os
import time
import json
from tempfile import mkdtemp
from datetime import datetime
from commands import getstatusoutput
from django.db import models
class Job(models.Model):
# hosts, like web_servers:host1 .
inventories = models.TextField(null = F... | #coding=utf8
import os
import time
import json
from datetime import datetime
from commands import getstatusoutput
from django.db import models
class Job(models.Model):
# hosts, like web_servers:host1 .
inventories = models.TextField(null = False, blank = False)
# 0, do not use sudo; 1, use sudo .
s... | mit | Python |
481c9d56d6d01a677ce30f93c11f7a99bf8d2746 | Add confirm to delete spam action | khchine5/xl,lino-framework/xl,lino-framework/xl,lino-framework/xl,lino-framework/xl,khchine5/xl,khchine5/xl,khchine5/xl | lino_xl/lib/mailbox/models.py | lino_xl/lib/mailbox/models.py | # -*- coding: UTF-8 -*-
"""Database models for `lino_xl.lib.mailbox`.
"""
import logging
logger = logging.getLogger(__name__)
from django_mailbox import models
from django.utils.translation import ugettext_lazy as _
import django.db.models
#
from lino.api import dd, rt
#
#
def preview(obj, ar):
return obj.htm... | # -*- coding: UTF-8 -*-
"""Database models for `lino_xl.lib.mailbox`.
"""
import logging
logger = logging.getLogger(__name__)
from django_mailbox import models
from django.utils.translation import ugettext_lazy as _
import django.db.models
#
from lino.api import dd, rt
#
#
def preview(obj, ar):
return obj.htm... | bsd-2-clause | Python |
45cca10fb94e119dc18bac77a6558f06e09b68b0 | remove debugging from default notes view | ubc/edx-platform,chrisndodge/edx-platform,chauhanhardik/populo,romain-li/edx-platform,openfun/edx-platform,nttks/edx-platform,zofuthan/edx-platform,mitocw/edx-platform,jbassen/edx-platform,B-MOOC/edx-platform,CredoReference/edx-platform,carsongee/edx-platform,4eek/edx-platform,dcosentino/edx-platform,angelapper/edx-pla... | lms/djangoapps/notes/views.py | lms/djangoapps/notes/views.py | from django.contrib.auth.decorators import login_required
from mitxmako.shortcuts import render_to_response
from courseware.courses import get_course_with_access
from notes.models import Note
import json
@login_required
def notes(request, course_id):
''' Displays a student's notes in a course. '''
course = get... | from mitxmako.shortcuts import render_to_response
from courseware.courses import get_course_with_access
from notes.models import Note
import json
import logging
log = logging.getLogger(__name__)
def notes(request, course_id):
''' Displays a student's notes in a course. '''
course = get_course_with_access(requ... | agpl-3.0 | Python |
b829436c121a889d7d28ba212218b1f75e8c4ddc | Fix docs on literally usage. | numba/numba,IntelLabs/numba,numba/numba,stuartarchibald/numba,stonebig/numba,stonebig/numba,stonebig/numba,cpcloud/numba,stonebig/numba,IntelLabs/numba,cpcloud/numba,stuartarchibald/numba,numba/numba,seibert/numba,gmarkall/numba,cpcloud/numba,cpcloud/numba,stuartarchibald/numba,numba/numba,stuartarchibald/numba,gmarkal... | numba/tests/doc_examples/test_literally_usage.py | numba/tests/doc_examples/test_literally_usage.py | # "magictoken" is used for markers as beginning and ending of example text.
import unittest
from numba.tests.support import captured_stdout
class DocsLiterallyUsageTest(unittest.TestCase):
def test_literally_usage(self):
with captured_stdout() as stdout:
# magictoken.ex_literally_usage.begin... | # "magictoken" is used for markers as beginning and ending of example text.
import unittest
from numba.tests.support import captured_stdout
class DocsLiterallyUsageTest(unittest.TestCase):
def test_literally_usage(self):
with captured_stdout():
# magictoken.ex_literally_usage.begin
... | bsd-2-clause | Python |
63c251a4f4de6cec6192c72ecab41229f07d33e4 | fix bugs | joakim1999/Ackermann,dali99/Ackermann,joakim1999/Ackermann,dali99/Ackermann,dali99/Ackermann,dali99/Ackermann,joakim1999/Ackermann,joakim1999/Ackermann,dali99/Ackermann,dali99/Ackermann,joakim1999/Ackermann | Ackerman.py | Ackerman.py | def ack(n, m):
"Returns Ackerman of input"
if m == 0:
return n + 1
elif m > 0 and n == 0:
return ack(m - 1, n)
elif m > 0 and n > 0:
return ack(m - 1, ack(m, n - 1))
i = 0
while True:
for x in range(9):
print(ack(i, x))
i += 1
| def ack(n, m):
"Returns Ackerman of input"
if m == 0:
return n+1
elif m > 0 and n == 0:
return ack(m - 1, n)
elif m > 0 and n > 0:
return ack(m-1, ack(m, n - 1))
i = 0
while true:
for x in range(9):
print(ack(i, x))
i++
| mit | Python |
cc28fccac83a4836e0a016c8a659188b53f2a026 | Fix horrible naming in membrane test | waltermoreira/tartpy | tartpy/tests/test_membrane.py | tartpy/tests/test_membrane.py | from tartpy import eventloop
import pytest
from tartpy.membrane import Membrane, Proxy
from tartpy.rt import Wait
@pytest.fixture(scope='module')
def ev_loop(request):
loop = eventloop.ThreadedEventLoop.get_loop()
def shutdown():
loop.stop()
request.addfinalizer(shutdown)
return loop
def test_... | from tartpy import eventloop
import pytest
from tartpy.membrane import Membrane, Proxy
from tartpy.rt import Wait
@pytest.fixture(scope='module')
def ev_loop(request):
loop = eventloop.ThreadedEventLoop.get_loop()
def shutdown():
loop.stop()
request.addfinalizer(shutdown)
return loop
def test_... | mit | Python |
f54e7d2da0ba321bdd5900c9893f6fe76adad12f | Put the session factory in threadLocal, not the session | paolobarbolini/TelegramSchoolBot | telegramschoolbot/database.py | telegramschoolbot/database.py | """
Interact with your school website with telegram!
Copyright (c) 2016-2017 Paolo Barbolini <paolo@paolo565.org>
Released under the MIT license
"""
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
import threading
# Temporary logging
"""
import logging
logging.basicConfi... | """
Interact with your school website with telegram!
Copyright (c) 2016-2017 Paolo Barbolini <paolo@paolo565.org>
Released under the MIT license
"""
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
import threading
# Temporary logging
"""
import logging
logging.basicConfi... | mit | Python |
dc9eb7bf19404f1d226c0b0e48bd9c77f6d5e438 | bump version to 0.0.4 | aromanovich/jinja2schema,aromanovich/jinja2schema,aromanovich/jinja2schema | jinja2schema/__init__.py | jinja2schema/__init__.py | # coding: utf-8
"""
jinja2schema
============
Type inference for Jinja2 templates.
See http://jinja2schema.rtfd.org/ for documentation.
:copyright: (c) 2014 Anton Romanovich
:license: BSD
"""
__title__ = 'jinja2schema'
__author__ = 'Anton Romanovich'
__license__ = 'BSD'
__copyright__ = 'Copyright 2014 Anton Roman... | # coding: utf-8
"""
jinja2schema
============
Type inference for Jinja2 templates.
See http://jinja2schema.rtfd.org/ for documentation.
:copyright: (c) 2014 Anton Romanovich
:license: BSD
"""
__title__ = 'jinja2schema'
__author__ = 'Anton Romanovich'
__license__ = 'BSD'
__copyright__ = 'Copyright 2014 Anton Roman... | bsd-3-clause | Python |
a53d008dd561aefdf30fa4e63236efd975a3efd5 | Bump to 0.0.9-dev | axiom-data-science/pyaxiom,ocefpaf/pyaxiom,axiom-data-science/pyaxiom,ocefpaf/pyaxiom | pyaxiom/__init__.py | pyaxiom/__init__.py | __version__ = "0.0.9-dev"
# Package level logger
import logging
try:
# Python >= 2.7
from logging import NullHandler
except ImportError:
# Python < 2.7
class NullHandler(logging.Handler):
def emit(self, record):
pass
logger = logging.getLogger("pyaxiom")
logger.addHandler(logging.Nu... | __version__ = "0.0.8"
# Package level logger
import logging
try:
# Python >= 2.7
from logging import NullHandler
except ImportError:
# Python < 2.7
class NullHandler(logging.Handler):
def emit(self, record):
pass
logger = logging.getLogger("pyaxiom")
logger.addHandler(logging.NullHa... | mit | Python |
c0baefe00629bc10e9a120e674c20e3afbfff266 | update core.api module | simphony/simphony-paraview,simphony/simphony-paraview | simphony_paraview/core/api.py | simphony_paraview/core/api.py | from .iterators import iter_cells, iter_grid_cells
from .cuba_data_accumulator import CUBADataAccumulator
from .cuba_utils import (
supported_cuba, cuba_value_types, default_cuba_value, VALUETYPES)
from .constants import points2edge, points2face, points2cell
__all__ = [
'iter_cells',
'iter_grid_cells',
... | from .iterators import iter_cells
from .cuba_data_accumulator import CUBADataAccumulator
from .cuba_utils import (
supported_cuba, cuba_value_types, default_cuba_value, VALUETYPES)
__all__ = [
'iter_cells',
'CUBADataAccumulator',
'supported_cuba',
'default_cuba_value',
'cuba_value_types',
... | bsd-2-clause | Python |
8068b8c1287bd922fd599107dd921202eff6775e | Remove now-redundant import | sourcebots/robot-api,sourcebots/robot-api | robot/game.py | robot/game.py | from enum import Enum
from robot.board import Board
class GameMode(Enum):
"""Possible modes the robot can be in."""
COMPETITION = 'competition'
DEVELOPMENT = 'development'
class GameState(Board):
"""A description of the initial game state the robot is operating under."""
@property
def zon... | from enum import Enum
from pathlib import Path
from robot.board import Board
class GameMode(Enum):
"""Possible modes the robot can be in."""
COMPETITION = 'competition'
DEVELOPMENT = 'development'
class GameState(Board):
"""A description of the initial game state the robot is operating under."""
... | mit | Python |
9d9324a961f71b893a5bf0c68d9f3602968c03e6 | Create branch v3.0 | UmSenhorQualquer/pyforms | pyforms/__init__.py | pyforms/__init__.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from pyforms.utils.settings_manager import conf
conf += 'pyforms.settings'
__author__ = "Ricardo Ribeiro"
__credits__ = ["Ricardo Ribeiro"]
__license__ = "MIT"
__version__ = '3.0.0'
__maintainer__ = ["Ricardo Ribeiro", "Carlos Mão de Ferro"]
__email__ = ["ricardojvr@... | #!/usr/bin/python
# -*- coding: utf-8 -*-
from pyforms.utils.settings_manager import conf
conf += 'pyforms.settings'
__author__ = "Ricardo Ribeiro"
__credits__ = ["Ricardo Ribeiro"]
__license__ = "MIT"
__version__ = '3.0.0'
__maintainer__ = ["Ricardo Ribeiro", "Carlos Mão de Ferro"]
__email__ = ["ricardojvr@... | mit | Python |
b53142e2c1ae14367cede3b20b68ff191d73299f | Update mongo.py | Sanic-Extensions/sanic-mongo | sanic_mongo/mongo.py | sanic_mongo/mongo.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python
"""
@Author: Huang Sizhe <huangsizhe>
@Date: 08-Apr-2017
@Email: hsz1273327@gmail.com
# @Last modified by: huangsizhe
# @Last modified time: 08-Apr-2017
@License: Apache License 2.0
@Description:
"""
__all__ = ["Core"]
from sanic.log import logger as log
from sanic_... | # -*- coding: utf-8 -*-
#!/usr/bin/env python
"""
@Author: Huang Sizhe <huangsizhe>
@Date: 08-Apr-2017
@Email: hsz1273327@gmail.com
# @Last modified by: huangsizhe
# @Last modified time: 08-Apr-2017
@License: Apache License 2.0
@Description:
"""
__all__ = ["Core"]
from sanic.log import log
from sanic_mongo.stan... | apache-2.0 | Python |
a76aa851a1c1d5c94b5558dfc1c0fb73d5a21a7d | add generate() and generate_string(), add API docs. | knipknap/Gelatin,knipknap/Gelatin | src/Gelatin/util.py | src/Gelatin/util.py | import generator
from parser import Parser
from compiler import SyntaxCompiler
def compile_string(syntax):
"""
Builds a converter from the given syntax and returns it.
@type syntax: str
@param syntax: A Gelatin syntax.
@rtype: compiler.Context
@return: The compiled converter.
"""
r... | import generator
from parser import Parser
from compiler import SyntaxCompiler
def compile_string(syntax):
return Parser().parse_string(syntax, SyntaxCompiler())
def compile(syntax_file):
return Parser().parse(syntax_file, SyntaxCompiler())
def generate_to_file(converter, input_file, output_file, format = ... | mit | Python |
89f5e39ab353f03534e184c4a8b8137df028842c | Make the names available at the local namespace | unode/jug,unode/jug,luispedro/jug,luispedro/jug | jug/subcommands/shell.py | jug/subcommands/shell.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2010, Luis Pedro Coelho <lpc@cmu.edu>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# 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 t... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2010, Luis Pedro Coelho <lpc@cmu.edu>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# 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 t... | mit | Python |
0aabd50d667542409c95875072d21bcea89fbb6a | increment version | thedrow/samsa,wikimedia/operations-debs-python-pykafka,wikimedia/operations-debs-python-pykafka,thedrow/samsa,benauthor/pykafka,benauthor/pykafka,wikimedia/operations-debs-python-pykafka,thedrow/samsa,benauthor/pykafka | pykafka/__init__.py | pykafka/__init__.py | from .broker import Broker
from .simpleconsumer import SimpleConsumer
from .cluster import Cluster
from .partition import Partition
from .producer import Producer
from .topic import Topic
from .client import KafkaClient
from .balancedconsumer import BalancedConsumer
__version__ = '2.0.5-dev'
__all__ = ["Broker", "Si... | from .broker import Broker
from .simpleconsumer import SimpleConsumer
from .cluster import Cluster
from .partition import Partition
from .producer import Producer
from .topic import Topic
from .client import KafkaClient
from .balancedconsumer import BalancedConsumer
__version__ = '2.0.4'
__all__ = ["Broker", "Simple... | apache-2.0 | Python |
4fb745f2db9696bf0b5a0ba0ea5345a36c7b52c8 | add __all__ only to __init__.py | thedrow/samsa,tempbottle/pykafka,fortime/pykafka,vortec/pykafka,benauthor/pykafka,sontek/pykafka,benauthor/pykafka,benauthor/pykafka,jofusa/pykafka,sontek/pykafka,aeroevan/pykafka,jofusa/pykafka,aeroevan/pykafka,tempbottle/pykafka,fortime/pykafka,appsoma/pykafka,wikimedia/operations-debs-python-pykafka,yungchin/pykafka... | pykafka/__init__.py | pykafka/__init__.py | from version import version
__version__ = version
from broker import Broker
from simpleconsumer import SimpleConsumer
from cluster import Cluster
from partition import Partition
from producer import Producer
from topic import Topic
from client import KafkaClient
from balancedconsumer import BalancedConsumer
__all__ =... | from version import version
__version__ = version
from broker import Broker
from simpleconsumer import SimpleConsumer
from cluster import Cluster
from partition import Partition
from producer import Producer
from topic import Topic
from client import KafkaClient
from balancedconsumer import BalancedConsumer
| apache-2.0 | Python |
28e55b561152f2b01660f87f45927f17a361ab21 | add managedbalancedconsumer to __all__ | wikimedia/operations-debs-python-pykafka,benauthor/pykafka,wikimedia/operations-debs-python-pykafka,benauthor/pykafka,wikimedia/operations-debs-python-pykafka,benauthor/pykafka | pykafka/__init__.py | pykafka/__init__.py | from .broker import Broker
from .simpleconsumer import SimpleConsumer
from .cluster import Cluster
from .partition import Partition
from .producer import Producer
from .topic import Topic
from .client import KafkaClient
from .balancedconsumer import BalancedConsumer
from .managedbalancedconsumer import ManagedBalancedC... | from .broker import Broker
from .simpleconsumer import SimpleConsumer
from .cluster import Cluster
from .partition import Partition
from .producer import Producer
from .topic import Topic
from .client import KafkaClient
from .balancedconsumer import BalancedConsumer
__version__ = '2.2.2-dev'
__all__ = ["Broker", "Si... | apache-2.0 | Python |
983444f181db3f8f1584a8fb61584949c8547283 | Add NOQA to ruamel compat | grokzen/pykwalify | pykwalify/compat.py | pykwalify/compat.py | # -*- coding: utf-8 -*-
# python stdlib
import sys
# 3rd party imports
from ruamel import yaml # NOQA: F401
if sys.version_info[0] < 3:
# Python 2.x.x series
basestring = basestring # NOQA: F821
unicode = unicode # NOQA: F821
bytes = str # NOQA: F821
def u(x):
""" """
re... | # -*- coding: utf-8 -*-
# python stdlib
import sys
# 3rd party imports
from ruamel import yaml
if sys.version_info[0] < 3:
# Python 2.x.x series
basestring = basestring # NOQA: F821
unicode = unicode # NOQA: F821
bytes = str # NOQA: F821
def u(x):
""" """
return x.decode(... | mit | Python |
08522cc9c14dca4ea18cd96bf47a43e2f1285248 | Add proper timezone data for trac | Pylons/kai,Pylons/kai | kai/controllers/tracs.py | kai/controllers/tracs.py | import logging
from pylons import response, config, tmpl_context as c
from pylons.controllers.util import abort
# Monkey patch the lazywriter, since mercurial needs that on the stdout
import paste.script.serve as serve
serve.LazyWriter.closed = False
# Conditionally import the trac components in case things trac isn... | import logging
from pylons import response, config, tmpl_context as c
from pylons.controllers.util import abort
# Monkey patch the lazywriter, since mercurial needs that on the stdout
import paste.script.serve as serve
serve.LazyWriter.closed = False
# Conditionally import the trac components in case things trac isn... | bsd-3-clause | Python |
e31059de79f8b2e148ed0c9e7cdcc9fe89611c84 | rewrite using numpy | Konjkov/pyquante2,Konjkov/pyquante2,Konjkov/pyquante2 | pyquante2/pt/mp2.py | pyquante2/pt/mp2.py | import numpy as np
from itertools import product
from functools import reduce
def mp2(hamiltonian, orbs, orbe, nocc, nvirt, verbose=False):
ints = hamiltonian.i2
moints = ints.transform_mp2(orbs, nocc)
Evirt, Eocc = orbe[nocc:], orbe[:nocc]
denominator = 1/(Eocc.reshape(-1, 1, 1, 1) - Evirt.reshape(1... | import numpy as np
from itertools import product
from functools import reduce
def mp2(hamiltonian, orbs, orbe, nocc, nvirt, verbose=False):
ints = hamiltonian.i2
moints = ints.transform_mp2(orbs, nocc)
Emp2 = 0
for a,b in product(range(nocc), repeat=2):
Eab = 0
for r,s in product(range(... | bsd-3-clause | Python |
4a0e14fe00c339acb2d62ec73b432512bb98c665 | increment version number | mscross/pysplit | pysplit/__init__.py | pysplit/__init__.py | """
PySPLIT package containing tools for automatically
generating trajectories, performing moisture uptake analyses,
enhancing the HYSPLIT cluster analysis experience,
and visualizing trajectories, trajectory clusters, and
meteorological data along trajectories.
"""
__all__ = ['Trajectory',
'Traj... | """
PySPLIT package containing tools for automatically
generating trajectories, performing moisture uptake analyses,
enhancing the HYSPLIT cluster analysis experience,
and visualizing trajectories, trajectory clusters, and
meteorological data along trajectories.
"""
__all__ = ['Trajectory',
'Traj... | bsd-3-clause | Python |
bce57542710de8da59d6e12566ed711c795ff20e | update help list | bjarneo/Pytify,bjarneo/Pytify,jaruserickson/spotiplay | pytify/commander.py | pytify/commander.py | from __future__ import absolute_import, unicode_literals
class Commander():
def __init__(self, Pytifylib):
self.pytify = Pytifylib
def parse(self, command):
if command and command[0] != '/':
return ''
command = command.replace('/', '')
return command
def com... | from __future__ import absolute_import, unicode_literals
class Commander():
def __init__(self, Pytifylib):
self.pytify = Pytifylib
def parse(self, command):
if command and command[0] != '/':
return ''
command = command.replace('/', '')
return command
def com... | mit | Python |
8964861c877797de7932978357ebe3c35eec6715 | Add a TODO for the Wizard | matcom/autoexam,matcom/autoexam,matcom/autoexam,matcom/autoexam,matcom/autoexam | qtui/master_page.py | qtui/master_page.py | from PyQt4.QtGui import *
from PyQt4 import uic
import os
from os.path import join
import api
#TODO: Save current question on close
class MasterPage(QWizardPage):
path = "qtui/ui/page1_master.ui"
def __init__(self, project, parentW=None):
super(MasterPage, self).__init__()
self.ui = uic.load... | from PyQt4.QtGui import *
from PyQt4 import uic
import os
from os.path import join
import api
class MasterPage(QWizardPage):
path = "qtui/ui/page1_master.ui"
def __init__(self, project, parentW=None):
super(MasterPage, self).__init__()
self.ui = uic.loadUi(join(os.environ['AUTOEXAM_FOLDER'], ... | mit | Python |
0b16603f98c75bf2ae0844b402aeb5fd8ecabb05 | change route | josip-milic/asc_qwerty_test,josip-milic/asc_qwerty_test,josip-milic/asc_qwerty_test | qwerty/app/views.py | qwerty/app/views.py | from django.http import HttpResponse
from models import Event
from django.shortcuts import render
from .serializer import EventSerializer
from django.template import loader
def index(request):
template = loader.get_template('app/index.html')
return HttpResponse(template.render({}, request))
def get_events... | from django.http import HttpResponse
from models import Event
from django.shortcuts import render
from .serializer import EventSerializer
from django.template import loader
def index(request):
a = 2
template = loader.get_template('app/index.html')
return HttpResponse(template.render({}, request))
def... | apache-2.0 | Python |
08472dce69bb861f72684037c912625cf70546c1 | Return stderr on script failure | kibitzr/kibitzr,kibitzr/kibitzr | kibitzr/fetcher/shell.py | kibitzr/fetcher/shell.py | import sh
import tempfile
import logging
logger = logging.getLogger(__name__)
def fetch_bash(conf, **kwargs):
code = conf['script']
logger.info("Executing bash fetcher")
logger.debug(code)
with tempfile.NamedTemporaryFile() as fp:
logger.debug("Saving code to %r", fp.name)
fp.write(c... | import sh
import tempfile
import logging
logger = logging.getLogger(__name__)
def fetch_bash(conf, **kwargs):
code = conf['script']
logger.info("Executing bash fetcher")
logger.debug(code)
with tempfile.NamedTemporaryFile() as fp:
logger.debug("Saving code to %r", fp.name)
fp.write(c... | mit | Python |
e11b3c344b52c84b5e86bdc381df2f359fe63dae | Add log.config to data files to fix installed fparser. | dagss/f2py-g3,dagss/f2py-g3 | fparser/setup.py | fparser/setup.py |
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('fparser',parent_package,top_path)
config.add_data_files('log.config')
return config
|
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('fparser',parent_package,top_path)
return config
| bsd-3-clause | Python |
0d2bd107b31649c14ce364e74bf961fc65735f67 | Use colormap with better perceptual contrast | meganbkratz/acq4,ericdill/pyqtgraph,acq4/acq4,pmaunz/pyqtgraph,acq4/acq4,pbmanis/acq4,ericdill/pyqtgraph,meganbkratz/acq4,meganbkratz/acq4,mgraupe/acq4,ericdill/pyqtgraph,pbmanis/acq4,acq4/acq4,campagnola/acq4,acq4/acq4,mgraupe/acq4,campagnola/acq4,pbmanis/acq4,nmearl/pyqtgraph,mgraupe/acq4,mgraupe/acq4,campagnola/acq4... | examples/ImageView.py | examples/ImageView.py | # -*- coding: utf-8 -*-
"""
This example demonstrates the use of ImageView, which is a high-level widget for
displaying and analyzing 2D and 3D data. ImageView provides:
1. A zoomable region (ViewBox) for displaying the image
2. A combination histogram and gradient editor (HistogramLUTItem) for
controlling t... | # -*- coding: utf-8 -*-
"""
This example demonstrates the use of ImageView, which is a high-level widget for
displaying and analyzing 2D and 3D data. ImageView provides:
1. A zoomable region (ViewBox) for displaying the image
2. A combination histogram and gradient editor (HistogramLUTItem) for
controlling t... | mit | Python |
9e41011a5f164732ffd33ba5ca5edc7813735aeb | Fix saving when number of items is less than configured bundle size | baudm/HomographyNet | bundle_data.py | bundle_data.py | #!/usr/bin/env python
import pickle
import os.path
import glob
import uuid
import sys
import os.path
import numpy as np
def pack(b, x, y):
name = str(uuid.uuid4())
pack = os.path.join(b, name + '.npz')
with open(pack, 'wb') as f:
np.savez(f, images=np.stack(x), offsets=np.stack(y))
print('pa... | #!/usr/bin/env python
import pickle
import os.path
import glob
import uuid
import sys
import os.path
import numpy as np
def main():
if len(sys.argv) != 4:
print('Usage: bundle_data.py <input dir> <output dir> <samples per bundle>')
exit(1)
p = sys.argv[1]
b = sys.argv[2]
lim = int(sys... | apache-2.0 | Python |
e42108d18ab02f66545d87ca6561fe51a667e3a9 | Add the calculation segments of the code | SuyashD95/python-assignments | cardBalance.py | cardBalance.py | """
Q9- Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly
payment required by the credit card company each month.
The following variables contain values as described below:
1. balance - the outstanding balance on the credit card
2. annualInterestRate - annual... | """
Q9- Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly
payment required by the credit card company each month.
The following variables contain values as described below:
1. balance - the outstanding balance on the credit card
2. annualInterestRate - a... | mit | Python |
907ad5b166603eb480a039ba49cbcf6c2e46ec8f | remove unit test check from PRESUBMIT.py | luci/luci-py,luci/luci-py,luci/luci-py,luci/luci-py | appengine/components/PRESUBMIT.py | appengine/components/PRESUBMIT.py | # Copyright 2013 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Top-level presubmit script for appengine/components/.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details ... | # Copyright 2013 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Top-level presubmit script for appengine/components/.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details ... | apache-2.0 | Python |
b2d2b7fe29766e2410e291a1fa07ce4af75f1a7f | Use `pytest.skip` | Lukasa/hyper,plucury/hyper,fredthomsen/hyper,fredthomsen/hyper,Lukasa/hyper,lawnmowerlatte/hyper,plucury/hyper,lawnmowerlatte/hyper | test/test_hyper_SSLContext.py | test/test_hyper_SSLContext.py | # -*- coding: utf-8 -*-
"""
Tests the hyper SSLContext.
"""
import os
import pytest
from hyper.compat import ssl
try:
from hyper.ssl_compat import SSLContext
except ImportError:
SSLContext = None
TEST_DIR = os.path.abspath(os.path.dirname(__file__))
TEST_CERTS_DIR = os.path.join(TEST_DIR, 'certs')
CLIENT_CE... | # -*- coding: utf-8 -*-
"""
Tests the hyper SSLContext.
"""
import os
from hyper.compat import ssl
try:
from hyper.ssl_compat import SSLContext
except ImportError:
SSLContext = None
TEST_DIR = os.path.abspath(os.path.dirname(__file__))
TEST_CERTS_DIR = os.path.join(TEST_DIR, 'certs')
CLIENT_CERT_FILE = os.pa... | mit | Python |
1792959d654e97c00c65cfc20fb7a7b336db405f | Use the new systemd integration in example build rule | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | shipyard2/rules/pods/examples/build.py | shipyard2/rules/pods/examples/build.py | import shipyard2.rules.pods
UNIT_CONTENTS = '''\
[Unit]
Description=example web server
[Service]
ExecStart=/usr/local/bin/ctr pods run-prepared ${pod_id}
[Install]
WantedBy=multi-user.target
'''
shipyard2.rules.pods.define_pod(
name='web-server',
apps=[
shipyard2.rules.pods.App(
name='we... | import shipyard2.rules.pods
shipyard2.rules.pods.define_pod(
name='web-server',
apps=[
shipyard2.rules.pods.App(
name='web-server',
exec=[
'python3',
*('-m', 'http.server'),
*('--directory', '/srv/web'),
'8000',
... | mit | Python |
acd90e05cbf212790b70fbf776628e9363cce298 | Support for 'host' | nicolaiarocci/eve-swagger | eve_swagger/objects.py | eve_swagger/objects.py | # -*- coding: utf-8 -*-
"""
eve-swagger.objects
~~~~~~~~~~~~~~~~~~~
swagger.io extension for Eve-powered REST APIs.
:copyright: (c) 2015 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
from flask import request, current_app as app
import eve_swagger
from validation import valid... | # -*- coding: utf-8 -*-
"""
eve-swagger.objects
~~~~~~~~~~~~~~~~~~~
swagger.io extension for Eve-powered REST APIs.
:copyright: (c) 2015 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
from flask import current_app as app
import eve_swagger
from validation import validate_info
... | bsd-3-clause | Python |
b2b3f30aee90631cd308f5fbb9f006752484394a | Return ImageAxis object | rluce/python-phaseplot | examples/ppexamples.py | examples/ppexamples.py | # Collection of small examples. Convention: All examples must be self
# contained in a single function having 'example_' as its prefix.
import phaseplot as pp
def example_polynomial():
"""Standard phase portait of a degree-two polynomial"""
def polyfun(z):
return z*z - z + 1
p = pp.phase_portr... | import phaseplot as pp
def example_polynomial():
"""Standard phase portait of a degree-two polynomial"""
def polyfun(z):
return z*z - z + 1
p = pp.phase_portrait(polyfun)
| mit | Python |
58fae78df42d0f037d348cb612022937447c78b6 | Test case updated to incorporate #15 fixes | lewismc/nutchpy,YongchaoShang/nutchpy,YongchaoShang/nutchpy,YongchaoShang/nutchpy,thammegowda/nutchpy,ContinuumIO/nutchpy,thammegowda/nutchpy,lewismc/nutchpy,ayberk/nutchpy,lewismc/nutchpy,ayberk/nutchpy,ayberk/nutchpy,ContinuumIO/nutchpy,thammegowda/nutchpy,ContinuumIO/nutchpy | examples/seq_reader.py | examples/seq_reader.py | import os
import nutchpy
path = os.path.dirname(nutchpy.__file__)
path = os.path.join(path,"ex_data", "crawldb_data")
data = nutchpy.sequence_reader.head(5,path)
# print(data)
assert len(data) == 5
data = nutchpy.sequence_reader.slice(5,20,path)
# print(data)
assert len(data) == 3
#hadoop fs -text path <-- equivale... | import os
import nutchpy
path = os.path.dirname(nutchpy.__file__)
path = os.path.join(path,"ex_data", "crawldb_data")
data = nutchpy.sequence_reader.head(5,path)
# print(data)
assert len(data) == 5
data = nutchpy.sequence_reader.slice(5,20,path)
# print(data)
assert len(data) == 2
#hadoop fs -text path <-- equivale... | apache-2.0 | Python |
02dfa2ca134df12fd76f76ee26fcc6da7743ce17 | FIX tax included | ingadhoc/website | website_sale_taxes_included/controllers/main.py | website_sale_taxes_included/controllers/main.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
# from openerp import SUPERUSER_ID
from openerp im... | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
# from openerp import SUPERUSER_ID
from openerp im... | agpl-3.0 | Python |
8d94c74aa99e760651c3ab6b662f2fc69fa75793 | Update version to 9.2.21.dev0 [ci skip] | angr/archinfo | archinfo/__init__.py | archinfo/__init__.py | """
archinfo is a collection of classes that contain architecture-specific information.
It is useful for cross-architecture tools (such as pyvex).
"""
__version__ = "9.2.21.dev0"
if bytes is str:
raise Exception("This module is designed for python 3 only. Please install an older version to use python 2.")
# NewT... | """
archinfo is a collection of classes that contain architecture-specific information.
It is useful for cross-architecture tools (such as pyvex).
"""
__version__ = "9.2.20.dev0"
if bytes is str:
raise Exception("This module is designed for python 3 only. Please install an older version to use python 2.")
# NewT... | bsd-2-clause | Python |
e74ea8d537883d4ee38ce88c87860a635dd44606 | Tweak output processer script | 5GExchange/escape,hsnlab/escape,hsnlab/escape,hsnlab/escape,5GExchange/escape,hsnlab/escape,5GExchange/escape,5GExchange/escape,5GExchange/escape,hsnlab/escape,hsnlab/escape,5GExchange/escape | mapping/calc_mapping_times.py | mapping/calc_mapping_times.py | """
Calculates how much time (averaged on the seeds) does it take for all the
batchings (increasing in size) to map by either MILP or Alg1. Considers only the
successful mappings.
"""
map_times = {}
cnts = {}
mins = {}
maxs = {}
for b in xrange(4, 300, 4):
map_times[b] = 0.0
cnts[b] = 0
mins[b] = float('inf')
... | """
Calculates how much time (averaged on the seeds) does it take for all the
batchings (increasing in size) to map by either MILP or Alg1. Considers only the
successful mappings.
"""
map_times = {}
cnts = {}
mins = {}
maxs = {}
for b in xrange(4, 300, 4):
map_times[b] = 0.0
cnts[b] = 0
mins[b] = float('inf')
... | apache-2.0 | Python |
a9f12de782002b2cdb59d3e066bd7fc3a3d6873a | Update a_atleast_b.py | daniel-beet/got-your-back,daniel-beet/got-your-back | tools/a_atleast_b.py | tools/a_atleast_b.py | #!/usr/bin/env python3
from packaging import version
import sys
a = str(sys.argv[1])
b = str(sys.argv[2])
print('Checking if %s is equal or newer than %s...' % (a, b))
result = version.parse(a) >= version.parse(b)
if result:
print('OK: %s is equal or newer than %s' % (a, b))
else:
print('ERROR: %s is older t... | #!/usr/bin/env python3
#from packaging import version
from distutils.version import LooseVersion
import sys
a = sys.argv[1]
b = sys.argv[2]
#result = version.parse(a) >= version.parse(b)
result = LooseVersion(a) >= LooseVersion(b)
if result:
print('OK: %s is equal or newer than %s' % (a, b))
else:
print('ERRO... | apache-2.0 | Python |
618caf8ace754c00a3db33300d48de053b0ea462 | Update json_pretty.py | bestswifter/macbootstrap,bestswifter/macbootstrap,bestswifter/macbootstrap | tools/json_pretty.py | tools/json_pretty.py | r"""Command-line tool to validate and pretty-print JSON
Usage::
$ echo '{"json":"obj"}' | python -m json.tool
{
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -m json.tool
Expecting property name: line 1 column 2 (char 2)
"""
import sys
import json
import codecs
def main():
if len(sys.arg... | r"""Command-line tool to validate and pretty-print JSON
Usage::
$ echo '{"json":"obj"}' | python -m json.tool
{
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -m json.tool
Expecting property name: line 1 column 2 (char 2)
"""
import sys
import json
import codecs
def main():
if len(sys.arg... | apache-2.0 | Python |
aab3f4b6297488074d27781ec2eab2feefa897b3 | Add class form | EmadMokhtar/halaqat,EmadMokhtar/halaqat,EmadMokhtar/halaqat | back_office/forms.py | back_office/forms.py | from django import forms
from django.contrib.auth.models import User
from .models import Teacher, ClassType, Class, DAYS_CHOICES
class UserCreationForm(forms.ModelForm):
"""
New user form
"""
password1 = forms.CharField(label='Password', widget=forms.PasswordInput)
password2 = forms.CharField(labe... | from django import forms
from django.contrib.auth.models import User
from .models import Teacher, ClassType
class UserCreationForm(forms.ModelForm):
"""
New user form
"""
password1 = forms.CharField(label='Password', widget=forms.PasswordInput)
password2 = forms.CharField(label='Password confirmat... | mit | Python |
2f63f134d2c9aa67044eb176a3f81857279f107d | Support a custom logging function and sleep time within tail | mhahn/troposphere | troposphere/utils.py | troposphere/utils.py | import time
def _tail_print(e):
print("%s %s %s" % (e.resource_status, e.resource_type, e.event_id))
def get_events(conn, stackname):
"""Get the events in batches and return in chronological order"""
next = None
event_list = []
while 1:
events = conn.describe_stack_events(stackname, next... | import time
def get_events(conn, stackname):
"""Get the events in batches and return in chronological order"""
next = None
event_list = []
while 1:
events = conn.describe_stack_events(stackname, next)
event_list.append(events)
if events.next_token is None:
break
... | bsd-2-clause | Python |
df5ecf46af259340b257004004885a367056c227 | adjust parameters | raonyguimaraes/ngs_metrics,raonyguimaraes/ngs_metrics | bam_exome_metrics.py | bam_exome_metrics.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from subprocess import call
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="BAM file (can be the location on S3)")
parser.add_argument("-t", "--target", help="Target File")
args = parser.parse_args()
bam_file = arg... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from subprocess import call
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="BAM file (can be the location on S3)")
parser.add_argument("-t", "--target", help="Target File")
args = parser.parse_args()
bam_file = arg... | mit | Python |
eb9b89829f394b1894be6ec835ddbd07f83dde32 | sort by date | haim0n/tummy_time | tummy_time/db_api.py | tummy_time/db_api.py | # -*- coding: utf-8 -*-
import os
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import asc
_script_location = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__)))
DB_FILE = os.path.join(_script_location, ... | # -*- coding: utf-8 -*-
import os
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
_script_location = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__)))
DB_FILE = os.path.join(_script_location, 'data.db')
_engine = sa.cr... | isc | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.