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 |
|---|---|---|---|---|---|---|---|---|
a93c281e126f41d9ac388ec2dafd829eed2ea6b1 | add coverage flags | miroi/fortran_input_reader | test.py | test.py | import os
import sys
import subprocess
import shlex
import shutil
import sys
import time
import datetime
HERE = os.path.abspath(os.path.dirname(__file__))
# ------------------------------------------------------------------------------
def exe(command):
"""
Executes command and returns string representation... | import os
import sys
import subprocess
import shlex
import shutil
import sys
import time
import datetime
HERE = os.path.abspath(os.path.dirname(__file__))
# ------------------------------------------------------------------------------
def exe(command):
"""
Executes command and returns string representation... | mit | Python |
c04d010366009eb49f94960ddbdaedbb5850dd98 | Fix typo in test.py | miedzinski/steamodd,Lagg/steamodd | test.py | test.py | import steam, sys
valid_modes = ["bp", "schema", "assets-catalog"]
try:
testmode = sys.argv[2]
testkey = sys.argv[1]
if testmode not in valid_modes: raise Exception
except:
sys.stderr.write("Run " + sys.argv[0] + " <apikey> " + "<" + ", ".join(valid_modes) + ">\n")
raise SystemExit
steam.set_api_... | import steam, sys
valid_modes = ["bp", "schema", "assets-catalog"]
try:
testmode = sys.argv[2]
testkey = sys.argv[1]
if testmode not in valid_modes: raise Exception
except:
sys.stderr.write("Run " + sys.argv[0] + " <apikey> " + "<" + ", ".join(valid_modes) + ">\n")
raise SystemExit
steam.set_api_... | isc | Python |
4893105835a8acf4ee19a96c6fefce45f08ec08f | fix some | zhyq0826/test-lab,zhyq0826/test-lab | test.py | test.py | from __future__ import print_function
import logging
from logging import StreamHandler
from memory_profiler import profile
logger = logging.getLogger()
logger.addHandler(StreamHandler())
logger.setLevel(logging.DEBUG)
def glow_pyconf_ppt():
import requests
for i in range(1, 24):
s = requests.get('ht... | from __future__ import print_function
import logging
from logging import StreamHandler
from memory_profiler import profile
logger = logging.getLogger()
logger.addHandler(StreamHandler())
logger.setLevel(logging.DEBUG)
def glow_pyconf_ppt():
import requests
for i in range(1, 24):
s = requests.get('ht... | mit | Python |
e057b586e2dc43ff367cb1ed6fc5bbb7dbfe514c | print flask | flenter/django-exploration | test.py | test.py | import flask
print flask | import flask
| mit | Python |
848751ca2906a5e1e8e5ccf3828bf13994b074fe | Update test script | raviqqe/shakyo | test.py | test.py | import xorcise
try:
console = xorcise.turn_on_console()
console.erase()
line = xorcise.Line()
console.print_line(0, line)
line = xorcise.Line(
xorcise.Character("h", xorcise.ColorAttribute.get_best_match((0, 0, 0))),
xorcise.Character("e", xorcise.ColorAttribute.get_best_match((0, 0, 255))),
... | import xorcise
try:
console = xorcise.turn_on_console()
console.erase()
line = xorcise.Line()
console.print_line(0, line)
line = xorcise.Line(
xorcise.Character("h", xorcise.ColorAttribute.black),
xorcise.Character("e", xorcise.ColorAttribute.blue),
xorcise.Character("l", xorcise.ColorAtt... | unlicense | Python |
35b2028ed09f64442092bdcb617c80acd1741948 | Fix for ticket #18 | RavenB/modoboa,modoboa/modoboa,mehulsbhatt/modoboa,carragom/modoboa,carragom/modoboa,bearstech/modoboa,tonioo/modoboa,mehulsbhatt/modoboa,mehulsbhatt/modoboa,modoboa/modoboa,tonioo/modoboa,bearstech/modoboa,carragom/modoboa,RavenB/modoboa,modoboa/modoboa,bearstech/modoboa,tonioo/modoboa,modoboa/modoboa,bearstech/modobo... | urls.py | urls.py | from django.conf.urls.defaults import *
from django.conf import settings
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
from mailng.extensions import loadextensions, loadmenus
loadextensions()
urlpatterns = patterns('',
# Example:
# (r'^mailng/',... | from django.conf.urls.defaults import *
from django.conf import settings
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
from mailng.extensions import loadextensions, loadmenus
loadextensions()
urlpatterns = patterns('',
# Example:
# (r'^mailng/',... | isc | Python |
a5357056bda5daf741a5096f88c50dc93bfff1b7 | fix typo | sigurdga/nidarholm,sigurdga/nidarholm,sigurdga/nidarholm | urls.py | urls.py | from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^forum/', include('nidarholm.forum.urls.debate')),
(r'^news/', include('nidarholm.news.urls.story')),
(r'^admin/', include(admin.site.urls)),
)
| from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^forum/', include('nidarholm.forum.urls.debate')),
(r'^news/', include('nidarholm.news.urls.story'))
(r'^admin/', include(admin.site.urls)),
)
| agpl-3.0 | Python |
fbba73e772e5055dce81dd2a3f8814011733f882 | Add ajax_select lookup url. | umitproject/openmonitor-aggregator,umitproject/openmonitor-aggregator,umitproject/openmonitor-aggregator,umitproject/openmonitor-aggregator,umitproject/openmonitor-aggregator | urls.py | urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
##
## Author: Adriano Monteiro Marques <adriano@umitproject.org>
## Author: Diogo Pinheiro <diogormpinheiro@gmail.com>
##
## Copyright (C) 2011 S2S Network Consultoria e Tecnologia da Informacao LTDA
##
## This program is free software: you can redistribute it and/or modify... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
##
## Author: Adriano Monteiro Marques <adriano@umitproject.org>
## Author: Diogo Pinheiro <diogormpinheiro@gmail.com>
##
## Copyright (C) 2011 S2S Network Consultoria e Tecnologia da Informacao LTDA
##
## This program is free software: you can redistribute it and/or modify... | agpl-3.0 | Python |
3ac72f0a9f83988584cee89896eaeb5c6f06d6b0 | Fix `previous_float` in util.py | rstebbing/bspline-regression | util.py | util.py | # util.py
# Imports
import re
# raise_if_not_shape
def raise_if_not_shape(name, A, shape):
"""Raise a `ValueError` if the np.ndarray `A` does not have dimensions
`shape`."""
if A.shape != shape:
raise ValueError('{}.shape != {}'.format(name, shape))
# previous_float
PARSE_FLOAT_RE = ... | # util.py
# Imports
import re
# raise_if_not_shape
def raise_if_not_shape(name, A, shape):
"""Raise a `ValueError` if the np.ndarray `A` does not have dimensions
`shape`."""
if A.shape != shape:
raise ValueError('{}.shape != {}'.format(name, shape))
# previous_float
PARSE_FLOAT_RE = ... | mit | Python |
7e3f28329d887229345fa0e8085ca7e09fe7686e | Improve wsgi.py | Cinemair/cinemair-server,Cinemair/cinemair-server | wsgi.py | wsgi.py | # -*- coding: utf-8 -*-
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
| import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
application = get_wsgi_application()
| mit | Python |
8947f6f7733593ec2b701aaa0b6fb98d973b7850 | Add pull to wsgi startup process, and /uptime route to the app | chbrown/divvy-history | wsgi.py | wsgi.py | import os
import sys
import time
import datetime
from apscheduler.scheduler import Scheduler
from bottle import Bottle, mako_view
# sys.path is a global for this python thread, so this enables local imports throughout the app
sys.path.insert(0, '.')
from fetch import fetch
from settings import datadir
from sync import... | import os
import sys
import time
import datetime
from apscheduler.scheduler import Scheduler
from bottle import Bottle, mako_view
# sys.path is a global for this python thread, so this enables local imports throughout the app
sys.path.insert(0, '.')
from fetch import fetch
from settings import datadir
from sync import... | mit | Python |
0f570e5a0f33583dbc419be5d6d71ce9c804e131 | Upgrade comments | ryu22e/django_template,ryu22e/django_template | wsgi.py | wsgi.py | """
WSGI config for {{ project_name }} 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
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.setting... | """
WSGI config for {{ project_name }} 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.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.setting... | mit | Python |
1e362ab8704c76e3606fae9317dd85eeb06259ea | remove superflous block size | marshki/pyWipe,marshki/pyWipe | zero.py | zero.py | #!/bin/py
import os
count = 1
def zeroToDrive():
''' write zeros to drive '''
wipes = 1
for int in range(count):
os.system(("dd if=/dev/zero |pv --progress --timer --rate --bytes| dd of=/dev/null bs=4096"))
# os.system(os.system(("dd if=/dev/zero| pv -ptrb | dd of=/dev/null bs=4096"))... | #!/bin/py
import os
count = 1
def zeroToDrive():
''' write zeros to drive '''
wipes = 1
for int in range(count):
os.system(("dd if=/dev/zero bs=4096 | pv --progress --timer --rate --bytes| dd of=/dev/null bs=4096"))
# os.system(os.system(("dd if=/dev/zero bs=4096 | pv -ptrb | dd of=/d... | mit | Python |
425de26b5a7041905862519c727491dd8ec17173 | Add root tag. | hanjoes/anivis,hanjoes/anivis,hanjoes/anivis | api/gen_detail_file.py | api/gen_detail_file.py | import timeit
import gevent
import math
from gevent.queue import Queue
from detail import AnimeDetail
from gen_id_file import IDS_FILENAME
from gevent import monkey; monkey.patch_socket()
DETAILS_FILENAME = 'animes.xml'
BATCH_SIZE = 10
WORKER_NUM = 8
MAXIMUM_WORKER_NUM = 8
NAMES_FOR_WORKER = ['Joe', 'Adam', 'Matt',... | import timeit
import gevent
import math
from gevent.queue import Queue
from detail import AnimeDetail
from gen_id_file import IDS_FILENAME
from gevent import monkey; monkey.patch_socket()
DETAILS_FILENAME = 'animes.xml'
BATCH_SIZE = 10
WORKER_NUM = 8
MAXIMUM_WORKER_NUM = 8
NAMES_FOR_WORKER = ['Joe', 'Adam', 'Matt',... | mit | Python |
5a1cb6408397e3dd8eed227f0adcea924de7b0e1 | enable new checkin report | jlutz777/FreeStore,jlutz777/FreeStore,jlutz777/FreeStore | reporting/utils.py | reporting/utils.py | """
Utility functions for reports
"""
from .reports import FamilyTotalOverTimeReport, DependentsTotalOverTimeReport
from .reports import FamilyCheckoutsPerWeekReport, DependentCheckoutsPerWeekReport
from .reports import EmptyFamilyCheckoutsPerWeekReport, FamilyCheckInsPerWeekReport
from .reports import ItemsPerCategor... | """
Utility functions for reports
"""
from .reports import FamilyTotalOverTimeReport, DependentsTotalOverTimeReport
from .reports import FamilyCheckoutsPerWeekReport, DependentCheckoutsPerWeekReport
from .reports import EmptyFamilyCheckoutsPerWeekReport
from .reports import ItemsPerCategoryPerMonthReport, IndividualsB... | mit | Python |
0c1b0a7787bd6824815ae208edab8f208b53af09 | Add comment to override of status code | Ghalko/osf.io,billyhunt/osf.io,wearpants/osf.io,asanfilippo7/osf.io,ticklemepierce/osf.io,kch8qx/osf.io,GageGaskins/osf.io,njantrania/osf.io,mluke93/osf.io,baylee-d/osf.io,alexschiller/osf.io,asanfilippo7/osf.io,wearpants/osf.io,kwierman/osf.io,leb2dg/osf.io,leb2dg/osf.io,chennan47/osf.io,arpitar/osf.io,leb2dg/osf.io,e... | api/base/exceptions.py | api/base/exceptions.py |
def jsonapi_exception_handler(exc, context):
"""
Custom exception handler that returns errors object as an array with a 'detail' member
"""
from rest_framework.views import exception_handler
response = exception_handler(exc, context)
if response is not None:
if 'detail' in response.dat... |
def jsonapi_exception_handler(exc, context):
"""
Custom exception handler that returns errors object as an array with a 'detail' member
"""
from rest_framework.views import exception_handler
response = exception_handler(exc, context)
if response is not None:
if 'detail' in response.dat... | apache-2.0 | Python |
0bd4224bfa737942930bfa1e1a67ecfdf25e70e7 | Apply WidgetAdapter to CheckboxSelectMultiple. | gasman/wagtail,zerolab/wagtail,jnns/wagtail,rsalmaso/wagtail,mixxorz/wagtail,thenewguy/wagtail,mixxorz/wagtail,rsalmaso/wagtail,torchbox/wagtail,zerolab/wagtail,wagtail/wagtail,thenewguy/wagtail,mixxorz/wagtail,torchbox/wagtail,gasman/wagtail,wagtail/wagtail,rsalmaso/wagtail,wagtail/wagtail,jnns/wagtail,wagtail/wagtail... | wagtail/core/widget_adapters.py | wagtail/core/widget_adapters.py | """
Register Telepath adapters for core Django form widgets, so that they can
have corresponding Javascript objects with the ability to render new instances
and extract field values.
"""
from django import forms
from django.utils.functional import cached_property
from wagtail.admin.staticfiles import versioned_static... | """
Register Telepath adapters for core Django form widgets, so that they can
have corresponding Javascript objects with the ability to render new instances
and extract field values.
"""
from django import forms
from django.utils.functional import cached_property
from wagtail.admin.staticfiles import versioned_static... | bsd-3-clause | Python |
8b38f24fbdee425fde52d33b2154812d10c9d3db | Bump version | marteinn/wagtail-alt-generator,marteinn/wagtail-alt-generator,marteinn/wagtail-alt-generator | wagtailaltgenerator/__init__.py | wagtailaltgenerator/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
wagtailaltgenerator
----------
Insert image description and tags with the help of computer vision
"""
__title__ = "wagtailaltgenerator"
__version__ = "4.1.1"
__build__ = 411
__author__ = "Martin Sandström"
__license__ = "MIT"
__copyright__ = "Copyright 2016-2019 Marti... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
wagtailaltgenerator
----------
Insert image description and tags with the help of computer vision
"""
__title__ = "wagtailaltgenerator"
__version__ = "4.1.0"
__build__ = 410
__author__ = "Martin Sandström"
__license__ = "MIT"
__copyright__ = "Copyright 2016-2018 Marti... | mit | Python |
a155e8654a95969abc2290d4198622991d6cb00e | Remove duplicate entry for vikidia and gutenberg in burundi boxes | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ideascube/conf/idb_bdi.py | ideascube/conf/idb_bdi.py | """Generic config for Ideasbox of Burundi"""
from .idb import * # noqa
from django.utils.translation import ugettext_lazy as _
USER_FORM_FIELDS = (
('Ideasbox', ['serial', 'box_awareness']),
(_('Personal informations'), ['refugee_id', 'short_name', 'full_name', 'birth_year', 'gender', 'phone']), # noqa
(... | """Generic config for Ideasbox of Burundi"""
from .idb import * # noqa
from django.utils.translation import ugettext_lazy as _
USER_FORM_FIELDS = (
('Ideasbox', ['serial', 'box_awareness']),
(_('Personal informations'), ['refugee_id', 'short_name', 'full_name', 'birth_year', 'gender', 'phone']), # noqa
(... | agpl-3.0 | Python |
923bcc555c6a039df649d1c2725cc67ad8c79660 | Make CMS errors JSON-able if requested via AJAX | nagyistoce/edx-platform,fly19890211/edx-platform,xinjiguaike/edx-platform,nagyistoce/edx-platform,sameetb-cuelogic/edx-platform-test,zubair-arbi/edx-platform,romain-li/edx-platform,DNFcode/edx-platform,martynovp/edx-platform,torchingloom/edx-platform,don-github/edx-platform,RPI-OPENEDX/edx-platform,chauhanhardik/populo... | cms/djangoapps/contentstore/views/error.py | cms/djangoapps/contentstore/views/error.py | from django.http import (HttpResponse, HttpResponseServerError,
HttpResponseNotFound)
from mitxmako.shortcuts import render_to_string, render_to_response
import functools
import json
__all__ = ['not_found', 'server_error', 'render_404', 'render_500']
def jsonable_error(status=500, message="T... | from django.http import HttpResponseServerError, HttpResponseNotFound
from mitxmako.shortcuts import render_to_string, render_to_response
__all__ = ['not_found', 'server_error', 'render_404', 'render_500']
def not_found(request):
return render_to_response('error.html', {'error': '404'})
def server_error(reques... | agpl-3.0 | Python |
f164dd8141133cb78ceeab3ecccc5d756c36da3c | Add optional structured properties for og:image and og:video | michaelhelmick/lassie,jpadilla/lassie,michaelhelmick/lassie,jpadilla/lassie | lassie/filters/social.py | lassie/filters/social.py | # -*- coding: utf-8 -*-
"""
lassie.filters.social
~~~~~~~~~~~~~~~~~~~~~
This module contains data social related content to help Lassie filter for content.
"""
from ..compat import str
import re
SOCIAL_MAPS = {
'meta': {
'open_graph': { # http://ogp.me/
'pattern': re.compile(r"^og:", re.I... | # -*- coding: utf-8 -*-
"""
lassie.filters.social
~~~~~~~~~~~~~~~~~~~~~
This module contains data social related content to help Lassie filter for content.
"""
from ..compat import str
import re
SOCIAL_MAPS = {
'meta': {
'open_graph': { # http://ogp.me/
'pattern': re.compile(r"^og:", re.I... | mit | Python |
bc199a9eaa2416b35d1d691f580e6c9ca0b1a2ae | Remove node counts and update docstrings on new view for activity | monikagrabowska/osf.io,binoculars/osf.io,monikagrabowska/osf.io,acshi/osf.io,laurenrevere/osf.io,cslzchen/osf.io,laurenrevere/osf.io,alexschiller/osf.io,monikagrabowska/osf.io,Johnetordoff/osf.io,alexschiller/osf.io,mluo613/osf.io,CenterForOpenScience/osf.io,chennan47/osf.io,mfraezz/osf.io,aaxelb/osf.io,alexschiller/os... | website/discovery/views.py | website/discovery/views.py | from website import settings
from website.project import Node
from website.project import utils
from modularodm.query.querydialect import DefaultQueryDialect as Q
def activity():
"""Reads node activity from pre-generated popular projects and registrations.
New and Noteworthy projects are set manually or thro... | from website import settings
from website.project import Node
from website.project import utils
from modularodm.query.querydialect import DefaultQueryDialect as Q
def activity():
node_data = utils.get_node_data()
if node_data:
hits = utils.hits(node_data)
else:
hits = {}
# New Proje... | apache-2.0 | Python |
a9803a8a523b8603db93ae18eb7e75e63bb8c44b | Add `dpi` option into `plot_setup`; Fix an importing bug with `matplotlib.pyplot` (#4) | gaomy3832/easypyplot,gaomy3832/easypyplot | easypyplot/pdf.py | easypyplot/pdf.py | """ $lic$
Copyright (c) 2016-2021, Mingyu Gao
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the imp... | """ $lic$
Copyright (c) 2016-2021, Mingyu Gao
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the imp... | bsd-3-clause | Python |
1147781292b32177e0733be134f8c83101f0abbf | add comment | austinlostinboston/mitsWebApp,austinlostinboston/mitsWebApp,austinlostinboston/mitsWebApp,austinlostinboston/mitsWebApp | weiss/flows/flowManager.py | weiss/flows/flowManager.py | """
Flow Manager
NOTE: this class should be created by singleton factory in factory.py
this class is responsible for
1. register a user's flow
2. loop up flow by user id
Author: Ming Fang <mingf@cs.cmu.edu>
"""
import logging
logger = logging.getLogger(__name__)
class FlowManager:
def __init__(self):... | """
Flow Mnager
NOTE: this class should be created by signleton factory in factory.py
this class is responsible for
1. user state factory.
2. loop up state by sid
3. make transit from one state based on a given action
Author: Ming Fang <mingf@cs.cmu.edu>
"""
import logging
logger = logging.getLogger(__... | apache-2.0 | Python |
c36b90db0f3e633f459afa3328e50b6f5e8b4e1b | Remove debug print. | pubnative/redash,M32Media/redash,easytaxibr/redash,getredash/redash,chriszs/redash,hudl/redash,jmvasquez/redashtest,useabode/redash,pubnative/redash,getredash/redash,moritz9/redash,guaguadev/redash,ninneko/redash,amino-data/redash,akariv/redash,denisov-vlad/redash,denisov-vlad/redash,jmvasquez/redashtest,rockwotj/redas... | redash/authentication.py | redash/authentication.py | import functools
import hashlib
import hmac
from flask import request, make_response
from flask.ext.googleauth import GoogleFederated
import time
from werkzeug.contrib.fixers import ProxyFix
import werkzeug.wrappers
from redash import data, settings
class HMACAuthentication(object):
def __init__(self, auth):
... | import functools
import hashlib
import hmac
from flask import request, make_response
from flask.ext.googleauth import GoogleFederated
import time
from werkzeug.contrib.fixers import ProxyFix
import werkzeug.wrappers
from redash import data, settings
class HMACAuthentication(object):
def __init__(self, auth):
... | bsd-2-clause | Python |
0e2d058efd310c2060df2a86b1de989eca1e2ea5 | Modify cafetaria scraper | ZeusWPI/hydra,ZeusWPI/hydra,ZeusWPI/hydra | server/scraper/resto/cafetaria.py | server/scraper/resto/cafetaria.py | import argparse
import os
from backoff import retry_session
from bs4 import BeautifulSoup
from util import parse_money, write_json_to_file
import sys
from requests.exceptions import ConnectionError, Timeout
HTML_PARSER = 'lxml'
BASE_URL = 'https://www.ugent.be/student/nl/meer-dan-studeren/resto/ophetmenu/'
def get_... | from backoff import retry_session
from bs4 import BeautifulSoup
from util import parse_money, stderr_print
import json
import sys
from requests.exceptions import ConnectionError, Timeout
HTML_PARSER = 'lxml'
OUTFILE = "resto/2.0/extrafood.json"
BASE_URL = 'https://www.ugent.be/student/nl/meer-dan-studeren/resto/ophet... | mit | Python |
bb35e83b7977e15cd7df9d1f2e810a730dbafa45 | update happy number | lujin123/algorithms,lujin123/algorithms | leetcode/happy_number.py | leetcode/happy_number.py | # Created by lujin at 6/3/2017
#
# 202. Happy Number
#
# Description:
#
# Write an algorithm to determine if a number is "happy".
#
# A happy number is a number defined by the following process: Starting with any positive integer,
# replace the number by the sum of the squares of its digits, and repeat the process unti... | # Created by lujin at 6/3/2017
#
# 202. Happy Number
#
# Description:
#
# Write an algorithm to determine if a number is "happy".
#
# A happy number is a number defined by the following process: Starting with any positive integer,
# replace the number by the sum of the squares of its digits, and repeat the process unti... | mit | Python |
06e0499c5a83a15dafc8563579295b9a8b51f79f | Remove typing annotations for backwards compatibility | tbenthompson/cppimport,tbenthompson/cppimport,tbenthompson/cppimport | cppimport/find.py | cppimport/find.py | import os
import sys
import cppimport.config
def find_file_in_folders(filename, paths):
for d in paths:
if not os.path.exists(d):
continue
if os.path.isfile(d):
continue
for f in os.listdir(d):
if f == filename:
return os.path.join(d, f... | import os
import sys
import cppimport.config
def find_file_in_folders(filename, paths):
for d in paths:
if not os.path.exists(d):
continue
if os.path.isfile(d):
continue
for f in os.listdir(d):
if f == filename:
return os.path.join(d, f... | mit | Python |
aa059d6f2fd45ec0d7de7bb2cd0477ff3552eb14 | Handle TLS errors in receivequeuethread | hb9kns/PyBitmessage,hb9kns/PyBitmessage,hb9kns/PyBitmessage,hb9kns/PyBitmessage | src/network/receivequeuethread.py | src/network/receivequeuethread.py | import errno
import Queue
import socket
import sys
import threading
import time
import addresses
from bmconfigparser import BMConfigParser
from debug import logger
from helper_threading import StoppableThread
from inventory import Inventory
from network.connectionpool import BMConnectionPool
from network.bmproto impor... | import Queue
import sys
import threading
import time
import addresses
from bmconfigparser import BMConfigParser
from debug import logger
from helper_threading import StoppableThread
from inventory import Inventory
from network.connectionpool import BMConnectionPool
from network.bmproto import BMProto
from queues impor... | mit | Python |
e968983001cced5391a163ab282ef2f2ded492f6 | Remove link to private document. | ScatterHQ/eliot,ClusterHQ/eliot,ScatterHQ/eliot,iffy/eliot,ScatterHQ/eliot | eliot/__init__.py | eliot/__init__.py | """
Eliot: Logging as Storytelling
Suppose we turn from outside estimates of a man, to wonder, with keener
interest, what is the report of his own consciousness about his doings or
capacity: with what hindrances he is carrying on his daily labors; what
fading of hopes, or what deeper fixity of self-del... | """
Eliot: An Opinionated Logging Library
Suppose we turn from outside estimates of a man, to wonder, with keener
interest, what is the report of his own consciousness about his doings or
capacity: with what hindrances he is carrying on his daily labors; what
fading of hopes, or what deeper fixity of s... | apache-2.0 | Python |
f1a84b0dc2d14b25b7d6e2e3f2f2d68002600d1a | Update routes | helix90/proptrunk,helix90/proptrunk | proptrunk/proptrunk.py | proptrunk/proptrunk.py | from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/', methods=['GET'])
def hello_world():
return render_template('templates/index.html'. title='Prop Trunk')
@app.route('/inventory', methods=['GET'])
def get_inventory():
return 'Inventory'
@app.route('/inventory', methods=['... | from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def hello_world():
return render_template('templates/index.html'. title='Prop Trunk')
@app.route('/inventory')
def inventory():
return 'Inventory'
@app.route('/checkout')
def checkout():
return 'Checkout'
@app.route... | apache-2.0 | Python |
cbe84c3220a3da4db36f10d84c63dc08231b3b9f | fix indentation | evansde77/cirrus,evansde77/cirrus,evansde77/cirrus | src/cirrus/plugins/uploaders/fabric_put.py | src/cirrus/plugins/uploaders/fabric_put.py | #!/usr/bin/env python
"""
_fabric_put_
Uploader plugin that uses fabric to do a remote put
"""
from fabric.operations import put
from cirrus.fabric_helpers import FabricHelper
from cirrus.logger import get_logger
from cirrus.upload_plugins import Uploader
from cirrus.configuration import get_pypi_auth
LOGGER = get_... | #!/usr/bin/env python
"""
_fabric_put_
Uploader plugin that uses fabric to do a remote put
"""
from fabric.operations import put
from cirrus.fabric_helpers import FabricHelper
from cirrus.logger import get_logger
from cirrus.upload_plugins import Uploader
from cirrus.configuration import get_pypi_auth
LOGGER = get_... | apache-2.0 | Python |
3b053c1f1c490ee9426bf65c5032e24e9f184568 | Increase delay | bootstraponline/scrapy-broken-links | broken_links/broken_links/settings.py | broken_links/broken_links/settings.py | # -*- coding: utf-8 -*-
# Scrapy settings for broken_links project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'broken_links'
SPIDER_MODULES = ['broken_links... | # -*- coding: utf-8 -*-
# Scrapy settings for broken_links project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'broken_links'
SPIDER_MODULES = ['broken_links... | apache-2.0 | Python |
5bda2697254744dc42420751c1b49219f65be380 | add head 'animation' | duarte-pompeu/snake,duarte-pompeu/snake | src/snake.py | src/snake.py | #!/usr/bin/python
from lib_common import *
class Snake:
def __init__(self, x=0, y=0, size=0):
self.position = Vec2(x,y)
self.speed = Vec2(0,0)
self.body_parts = list()
self.body_parts.append(self.position)
self.turning_points = list()
self.turning_points.append(self.position)
for i in xrange(1, s... | #!/usr/bin/python
from lib_common import *
class Snake:
def __init__(self, x=0, y=0, size=0):
self.position = Vec2(x,y)
self.speed = Vec2(0,0)
self.body_parts = list()
self.body_parts.append(self.position)
self.turning_points = list()
self.turning_points.append(self.position)
for i in xrange(1, s... | mit | Python |
075877c728e2db439b53a894fc66dff7d35922ba | Add search in landing | juanpflores94/Hodor,juanpflores94/Hodor,juanpflores94/Hodor | cultures/views.py | cultures/views.py | from django.shortcuts import get_object_or_404
from django.db.models import Q
from django.views.generic import(
ListView,
DetailView,
TemplateView
)
from .models import (
Culture,
God,
Temple,
Museum,
CultureHasPeriod,
)
class LandingView(ListView):
template_name = 'prueba.html'... | from django.shortcuts import get_object_or_404
from django.views.generic import(
ListView,
DetailView,
TemplateView
)
from .models import (
Culture,
God,
Temple,
Museum,
CultureHasPeriod,
)
class LandingView(ListView):
template_name = 'prueba.html'
model = Culture
class Adv... | apache-2.0 | Python |
446fe02ce407e3d14c1dddd5e58c7b3f54b2ccf9 | delete functions | piraaa/VideoDigitalWatermarking | src/video.py | src/video.py | #
# video.py
# Created by pira on 2017/07/31.
#
#coding: utf-8
u"""For video processing."""
import numpy as np
import cv2
def video2image(filename, n=0):
u"""Read mpeg video and divide into jpeg images.
@param filename:video filename
@param n :number of export images (if n=0, this function exports all im... | #
# video.py
# Created by pira on 2017/07/31.
#
#coding: utf-8
u"""For video processing."""
import numpy as np
import cv2
def showVideo(filename):
pass
def video2image(filename, n=0):
u"""Read mpeg video and divide into jpeg images.
@param filename:video filename
@param n :number of export images (if n... | mit | Python |
f43450ac6ecff870693bf3fcb0d638fcf334d492 | Update template file. | vikash-india/ProgrammingProblems,vikash-india/ProgrammingProblems | src/project_euler/P000_Template.py | src/project_euler/P000_Template.py | # Description: Write Here
import logging
"""
Technique
- Write Here
Note
- Write Here
Instrumentation
- System Details: 8x Intel Core i7-3630QM CPU @ 2.40GHz, 16GB RAM, Ubuntu 14.04
- Input Details: Write Here
- Time for 100 runs: Minimum - NA sec, Average - NA sec, Maximum NA sec
- Write Here
"""
def function_name... | # Description: Write Here
"""
Technique
- Write Here
Note
- Write Here
Instrumentation
- System Details: 8x Intel Core i7-3630QM CPU @ 2.40GHz, 16GB RAM, Ubuntu 14.04
- Input Details: Write Here
- Time for 100 runs: Minimum - NA sec, Average - NA sec, Maximum NA sec
- Write Here
"""
def function_name():
pass
# ... | mit | Python |
1ae42227d9df745420c1a3db11893589d91ba83e | Add search and search_auto_paging_iter abstract methods (#873) | stripe/stripe-python | stripe/api_resources/abstract/searchable_api_resource.py | stripe/api_resources/abstract/searchable_api_resource.py | from __future__ import absolute_import, division, print_function
from stripe.api_resources.abstract.api_resource import APIResource
class SearchableAPIResource(APIResource):
@classmethod
def _search(
cls,
search_url,
api_key=None,
stripe_version=None,
stripe_account=No... | from __future__ import absolute_import, division, print_function
from stripe.api_resources.abstract.api_resource import APIResource
class SearchableAPIResource(APIResource):
@classmethod
def _search(
cls,
search_url,
api_key=None,
stripe_version=None,
stripe_account=No... | mit | Python |
5f7bf4f2e885c2343b89bc180b7aaad634b3a011 | Remove TestConnectRemote decorator for FreeBSD | apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb | test/functionalities/connect_remote/TestConnectRemote.py | test/functionalities/connect_remote/TestConnectRemote.py | """
Test lldb 'process connect' command.
"""
import os
import unittest2
import lldb
import pexpect
from lldbtest import *
class ConnectRemoteTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test_connect_remote(self):
"""Test "process connect connect:://localhost:12345"."""
#... | """
Test lldb 'process connect' command.
"""
import os
import unittest2
import lldb
import pexpect
from lldbtest import *
class ConnectRemoteTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureFreeBSD('llvm.org/pr18313')
def test_connect_remote(self):
"""Test "process co... | apache-2.0 | Python |
2c967d42f141f744e0d84c552dd66ea8e3d75db1 | fix end timestep for flows | jdherman/stockflow,wolfd/stockflow | stockflow.py | stockflow.py | import numpy as np
import collections
class simulation:
def __init__(self, tstep):
self.stocks = {}
self.flows = collections.OrderedDict()
self.tstep = tstep
def __getattr__(self,key):
return self.stocks[key] if key in self.stocks else self.flows[key]['vals']
def validate_key(self,key):
i... | import numpy as np
class simulation:
def __init__(self, tstep):
self.stocks = {}
self.flows = {}
self.tstep = tstep
def __getattr__(self,key):
return self.stocks[key] if key in self.stocks else self.flows[key]['vals']
def validate_key(self,key):
if key in self.stocks or key in self.flows:... | mit | Python |
4791a4a97200a62c195931475c1ee3d7bb3731f8 | Add Table to reverb/__init__.py. | deepmind/reverb,deepmind/reverb,deepmind/reverb,deepmind/reverb | reverb/__init__.py | reverb/__init__.py | # Copyright 2019 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | # Copyright 2019 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | apache-2.0 | Python |
f82f41e8c14d665eef6dedc94dfef84054970e9d | modify how we define trusted root basedir | onelab-eu/sfa,yippeecw/sfa,onelab-eu/sfa,yippeecw/sfa,yippeecw/sfa,onelab-eu/sfa | geni/util/trustedroot.py | geni/util/trustedroot.py | import os
from gid import *
from geni.util.config import Config
class TrustedRootList():
def __init__(self, dir=None):
if not dir:
config = Config()
self.basedir = config.path + os.sep + 'trusted_roots'
else:
self.basedir = dir
# create the directory to ... | import os
from gid import *
class TrustedRootList():
def __init__(self, dir="./trusted_roots"):
self.basedir = dir
# create the directory to hold the files
try:
os.makedirs(self.basedir)
# if the path already exists then pass
except OSError, (errno, strerr):
... | mit | Python |
6168b224249f68170f4c41eaff83e9a9dd379bfb | remove add_bindings method | jkpl/kaarmebot | kaarmebot/dispatcher.py | kaarmebot/dispatcher.py | import collections
Message = collections.namedtuple('Message', ['source', 'target', 'contents'])
class MessageDispatcher:
def __init__(self):
self.routing_classes = {}
def add_binding(self, routing_class, predicate, handler):
rc = self.routing_classes.get(routing_class)
if rc:
... | import collections
Message = collections.namedtuple('Message', ['source', 'target', 'contents'])
class MessageDispatcher:
def __init__(self):
self.routing_classes = {}
def add_binding(self, routing_class, predicate, handler):
rc = self.routing_classes.get(routing_class)
if rc:
... | bsd-2-clause | Python |
98f33028451122b39c49a89d367a406dfd641dc0 | use PID class | smaria/autonomous-sailing-robot,Southampton-Maritime-Robotics/autonomous-sailing-robot | src/boat_pid_control/src/boat_pid_control/rudderPID.py | src/boat_pid_control/src/boat_pid_control/rudderPID.py | """
PID control for the sailing robot
controling sail position
based on goal sail direction
Inputs:
- current heading
- goal heading
Output:
- Change in motor position/motor position
TODO:
consider tack and jibe
"""
import rospy
from pid_controller_class import PID
PROPORTIONAL_GAIN = 0.1
INTEGRAL_GAIN = 0
DERIVA... | """
PID control for the sailing robot
controling sail position
based on goal sail direction
Inputs:
- current heading
- goal heading
Output:
- Change in motor position/motor position
TODO:
consider tack and jibe
"""
import rospy
PROPORTIONAL_GAIN = 0.1
INTEGRAL_GAIN = 0
DERIVATIVE_GAIN = 0
currentHeading = 23
... | bsd-2-clause | Python |
ce51f1c3829ac44e67c51a8fc97577f5f897d9e7 | bump version | collab-project/django-require-i18n,collab-project/django-require-i18n | require_i18n/__init__.py | require_i18n/__init__.py | # Copyright Collab 2015
# shortcuts
from .util import extract_tower_json
# version information
__version__ = (1, 0, 0, 'b2')
#: For example: `2.0.0`
short_version = '.'.join([str(x) for x in __version__[:3]])
#: For example: `2.0.0a1`
version = '{}{}'.format('.'.join([str(x) for x in __version__[:-1]]),
__versi... | # Copyright Collab 2015
# shortcuts
from .util import extract_tower_json
# version information
__version__ = (1, 0, 0, 'b1')
#: For example: `2.0.0`
short_version = '.'.join([str(x) for x in __version__[:3]])
#: For example: `2.0.0a1`
version = '{}{}'.format('.'.join([str(x) for x in __version__[:-1]]),
__versi... | mit | Python |
4d46001296ad083df6827a9c97333f0f093f31bd | Document new evil magic, and add required var. | decklin/ennepe | example/config.py | example/config.py | # Mnemosyne configuration
# =======================
#
# This file is a Python script. When run, the following variables will be
# defined for you; you may change or add to them as you see fit.
#
# * ``entries_dir``: a Maildir containing all the blog entries.
# * ``layout_dir``: the blog's layout, as a skeleton director... | # Mnemosyne configuration
# =======================
#
# This file is a Python script. When run, the following variables will be
# defined for you; you may change or add to them as you see fit.
#
# ``entries_dir``: a Maildir containing all the blog entries.
# ``layout_dir``: the blog's layout, as a skeleton directory tr... | isc | Python |
f818b7b8e23bae7d9ceb359ff9a0a3264c8ba69f | Remove unused DATABASE_URL env variable | paulocheque/guides-cms,paulocheque/guides-cms,pluralsight/guides-cms,paulocheque/guides-cms,pluralsight/guides-cms,pluralsight/guides-cms | example_config.py | example_config.py | """
File to easily switch between configurations between production and
development, etc.
"""
import os
# You must set each of these in your heroku environment with the heroku
# config:set command. See README.md for more information.
HEROKU_ENV_REQUIREMENTS = ('HEROKU', 'SECRET_KEY', 'GITHUB_CLIENT_ID',
... | """
File to easily switch between configurations between production and
development, etc.
"""
import os
# You must set each of these in your heroku environment with the heroku
# config:set command. See README.md for more information.
HEROKU_ENV_REQUIREMENTS = ('HEROKU', 'SECRET_KEY', 'GITHUB_CLIENT_ID',
... | agpl-3.0 | Python |
549190dc81bd4e666a8ca52eed8726a5717a8dde | fix syntax error | BrianHicks/trek | migrate/__init__.py | migrate/__init__.py | # -*- coding: utf-8 -*-
from .migration import Migration
from importlib import import_module
import os
class Migrator(object):
def __init__(self, count, runner_path, migrations_dir, direction, *args, **kwargs):
self.count = count
self.migrations_dir = migrations_dir
self.direction = directi... | # -*- coding: utf-8 -*-
from .migration import Migration
from importlib import import_module
import os
class Migrator(object):
def __init__(self, count, runner_path, migrations_dir, direction, *args, **kwargs):
self.count = count
self.migrations_dir = migrations_dir
self.direction = directi... | mit | Python |
68b6444eed6f3a748aa3a0126c20a52a5d56e6f9 | Comment added for missing code. | alphagov/notifications-api,alphagov/notifications-api | app/notifications/rest.py | app/notifications/rest.py | import uuid
from flask import (
Blueprint,
jsonify,
request
)
from app import (notify_alpha_client, api_user)
from app.aws_sqs import add_notification_to_queue
from app.dao import (templates_dao)
from app.schemas import (
email_notification_schema, sms_template_notification_schema)
notifications = Bl... | import uuid
from flask import (
Blueprint,
jsonify,
request
)
from app import (notify_alpha_client, api_user)
from app.aws_sqs import add_notification_to_queue
from app.dao import (templates_dao)
from app.schemas import (
email_notification_schema, sms_template_notification_schema)
notifications = Bl... | mit | Python |
b480426bdc7f5a59523cc9e6250efedd311d0854 | fix other minor remark | rjeschmi/vsc-base,rjeschmi/vsc-base | lib/vsc/utils/testing.py | lib/vsc/utils/testing.py | #!/usr/bin/env python
##
#
# Copyright 2014-2014 Ghent University
#
# This file is part of vsc-base,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the H... | #!/usr/bin/env python
##
#
# Copyright 2014-2014 Ghent University
#
# This file is part of vsc-base,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the H... | lgpl-2.1 | Python |
5c86a27f3ff324a8a7f74e161eeff4bda62fe0ab | add asynchronous dump | squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto | integration_tests/dump.py | integration_tests/dump.py | import os.path
import sys
import base64
import asyncio
from app import Application
def dump(request):
body = request.body
if body is not None:
body = base64.b64encode(body).decode('ascii')
result = {
"method": request.method,
"path": request.path,
"query_string": request... | import os.path
import sys
import base64
from app import Application
def dump(request):
body = request.body
if body is not None:
body = base64.b64encode(body).decode('ascii')
result = {
"method": request.method,
"path": request.path,
"query_string": request.query_string,
... | mit | Python |
de0c0edafb3e3a128c8ad54e9841c7a188cba328 | Format output (#85) | ZuZuD/JARVIS-on-Messenger,jaskaransarkaria/JARVIS-on-Messenger,swapagarwal/JARVIS-on-Messenger,edadesd/JARVIS-on-Messenger | modules/src/time.py | modules/src/time.py | import requests
import config
import os
from templates.text import TextTemplate
from datetime import datetime
MAPQUEST_CONSUMER_KEY = os.environ.get('MAPQUEST_CONSUMER_KEY', config.MAPQUEST_CONSUMER_KEY)
TIME_ZONE_DB_API_KEY = os.environ.get('TIME_ZONE_DB_API_KEY', config.TIME_ZONE_DB_API_KEY)
def process(input, enti... | import requests
import config
import os
from templates.text import TextTemplate
from datetime import datetime
MAPQUEST_CONSUMER_KEY = os.environ.get('MAPQUEST_CONSUMER_KEY', config.MAPQUEST_CONSUMER_KEY)
TIME_ZONE_DB_API_KEY = os.environ.get('TIME_ZONE_DB_API_KEY', config.TIME_ZONE_DB_API_KEY)
def process(input, enti... | mit | Python |
38ba5ddbadd02df7d3781526350eb5b060f702fb | remove one of the two softmask items in the doc | carlthome/librosa,carlthome/librosa,carlthome/librosa | librosa/util/__init__.py | librosa/util/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utilities
=========
Array operations
----------------
.. autosummary::
:toctree: generated/
frame
pad_center
fix_length
fix_frames
index_to_slice
softmask
sync
axis_sort
normalize
roll_sparse
sparsify_rows
buf_to_f... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utilities
=========
Array operations
----------------
.. autosummary::
:toctree: generated/
frame
pad_center
fix_length
fix_frames
index_to_slice
softmask
sync
softmask
axis_sort
normalize
roll_sparse
sparsify_rows
... | isc | Python |
0f79b2ab82f3d628983baca02c5bc54a872d5513 | Cover contact_link_for | hartwork/wnpp.debian.net,hartwork/wnpp.debian.net,hartwork/wnpp.debian.net | wnpp_debian_net/templatetags/tests/test_contact_links.py | wnpp_debian_net/templatetags/tests/test_contact_links.py | # Copyright (C) 2021 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GNU Affero GPL v3 or later
from unittest import TestCase
from parameterized import parameterized
from ...templatetags.contact_links import _parse_contact
from ..contact_links import contact_link_for
class ParseContactTest(TestCase):
... | # Copyright (C) 2021 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GNU Affero GPL v3 or later
from unittest import TestCase
from parameterized import parameterized
from ...templatetags.contact_links import _parse_contact
class ParseContactTest(TestCase):
@parameterized.expand([
('mail@exam... | agpl-3.0 | Python |
3192634b5468c3aff64367366f7419ad0aabf49b | Fix Objective-C executor | DMOJ/judge,DMOJ/judge,DMOJ/judge | executors/OBJC.py | executors/OBJC.py | from subprocess import check_output, CalledProcessError
from GCCExecutor import GCCExecutor
from judgeenv import env
class Executor(GCCExecutor):
ext = '.m'
objc_flags = []
objc_ldflags = []
command = env['runtime'].get('gobjc')
name = 'OBJC'
address_grace = 131072
test_program = r'''
#i... | from subprocess import check_output, CalledProcessError
from GCCExecutor import GCCExecutor
from judgeenv import env
class Executor(GCCExecutor):
ext = '.m'
objc_flags = []
objc_ldflags = []
command = env['runtime'].get('gobjc')
name = 'OBJC'
address_grace = 131072
test_program = r'''
#i... | agpl-3.0 | Python |
47a7321682f3f47c638c133ccbcb3f9daea32e77 | add help text for language | praekelt/molo,praekelt/molo,praekelt/molo,praekelt/molo | molo/core/models.py | molo/core/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailcore.models import Page
from wagtail.wagtailsearch import index
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
class HomePage(Page):
... | from django.db import models
from wagtail.wagtailcore.models import Page
from wagtail.wagtailsearch import index
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
class HomePage(Page):
pass
class Main(Page):
parent_page_types = []
... | bsd-2-clause | Python |
9ffcb95f0475c9d3a090b8de62073049f999fcf0 | update version | mongolab/mongoctl | mongoctl/version.py | mongoctl/version.py | __author__ = 'abdul'
MONGOCTL_VERSION = '0.9.1'
| __author__ = 'abdul'
MONGOCTL_VERSION = '0.9.0'
| mit | Python |
b6b8ae74eabd69defcbf46a2e0bd46512872bd40 | Add tools to write bidsignore and dataset_description.json | poldracklab/mriqc,oesteban/mriqc,oesteban/mriqc,poldracklab/mriqc,poldracklab/mriqc,poldracklab/mriqc,oesteban/mriqc,oesteban/mriqc | mriqc/utils/bids.py | mriqc/utils/bids.py | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""PyBIDS tooling"""
import os
import json
from pathlib import Path
from collections import defaultdict
DEFAULT_TYPES = ["bold", "T1w", "T2w"]
def collect_bids_data(
layout, participant_label=None, s... | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""PyBIDS tooling"""
from collections import defaultdict
DEFAULT_TYPES = ["bold", "T1w", "T2w"]
def collect_bids_data(
layout, participant_label=None, session=None, run=None, task=None, bids_type=Non... | apache-2.0 | Python |
363bb6f409b4c3184a5b9e72c095b6aca207a11f | Cut 0.9.1 final | bspink/fabric,qinrong/fabric,ericholscher/fabric,getsentry/fabric,cgvarela/fabric,elijah513/fabric,MjAbuz/fabric,ploxiln/fabric,SamuelMarks/fabric,mathiasertl/fabric,haridsv/fabric,StackStorm/fabric,akaariai/fabric,rbramwell/fabric,jaraco/fabric,hrubi/fabric,TarasRudnyk/fabric,itoed/fabric,raimon49/fabric,tolbkni/fabri... | fabric/version.py | fabric/version.py | """
Current Fabric version constant plus version pretty-print method.
This functionality is contained in its own module to prevent circular import
problems with ``__init__.py`` (which is loaded by setup.py during installation,
which in turn needs access to this version information.)
"""
VERSION = (0, 9, 1, "final", 0... | """
Current Fabric version constant plus version pretty-print method.
This functionality is contained in its own module to prevent circular import
problems with ``__init__.py`` (which is loaded by setup.py during installation,
which in turn needs access to this version information.)
"""
VERSION = (0, 9, 0, "final", 0... | bsd-2-clause | Python |
cbf5f26d4a1860082d9e29524146298ad0b4e0db | Support for pkgdb teams. | fedora-infra/fedmsg-genacls | fedmsg_genacls.py | fedmsg_genacls.py | # -*- coding: utf-8 -*-
""" A fedmsg consumer that listens to pkgdb messages to update gitosis acls
Authors: Janez Nemanič <janez.nemanic@gmail.com>
Ralph Bean <rbean@redhat.com>
"""
import pprint
import subprocess
import os
import fedmsg.consumers
import moksha.hub.reactor
class GenACLsConsumer(fed... | # -*- coding: utf-8 -*-
""" A fedmsg consumer that listens to pkgdb messages to update gitosis acls
Authors: Janez Nemanič <janez.nemanic@gmail.com>
Ralph Bean <rbean@redhat.com>
"""
import pprint
import subprocess
import os
import fedmsg.consumers
import moksha.hub.reactor
class GenACLsConsumer(fed... | lgpl-2.1 | Python |
5022dada0153bca2c99f2faf302827307078e91a | Remove timestamp from forms | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fellowms/forms.py | fellowms/forms.py | from django.forms import ModelForm, widgets
from .models import Fellow, Event, Expense, Blog
class FellowForm(ModelForm):
class Meta:
model = Fellow
exclude = [
"user",
"home_lon",
"home_lat",
"funding_notes",
"inaugur... | from django.forms import ModelForm, widgets
from .models import Fellow, Event, Expense, Blog
class FellowForm(ModelForm):
class Meta:
model = Fellow
exclude = [
"user",
"home_lon",
"home_lat",
"funding_notes",
"inaugur... | bsd-3-clause | Python |
e97a43f4558b19311eea9a5ef508502c7151256f | fix periodic task schedule_updates() | gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo | mygpo/data/tasks.py | mygpo/data/tasks.py | from operator import itemgetter
from datetime import datetime, timedelta
from celery.decorators import periodic_task
from mygpo.data.podcast import calc_similar_podcasts
from mygpo.celery import celery
from mygpo.podcasts.models import Podcast
from celery.utils.log import get_task_logger
logger = get_task_logger(__n... | from operator import itemgetter
from datetime import datetime, timedelta
from celery.decorators import periodic_task
from mygpo.data.podcast import calc_similar_podcasts
from mygpo.celery import celery
from mygpo.podcasts.models import Podcast
@celery.task
def update_podcasts(podcast_urls):
""" Task to update a... | agpl-3.0 | Python |
140b8b829f566a75a09a1ff7bc2d7d4ba4ea5272 | fix version | Star2Billing/newfies-dialer,berinhard/newfies-dialer,laprice/newfies-dialer,newfies-dialer/newfies-dialer,romonzaman/newfies-dialer,saydulk/newfies-dialer,emartonline/newfies-dialer,romonzaman/newfies-dialer,berinhard/newfies-dialer,berinhard/newfies-dialer,romonzaman/newfies-dialer,newfies-dialer/newfies-dialer,newfie... | newfies/__init__.py | newfies/__init__.py | # -*- coding: utf-8 -*-
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2012 Star2B... | # -*- coding: utf-8 -*-
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2012 Star2B... | mpl-2.0 | Python |
df5bcec8f6d05a27ba6be3ea0af401ab6045d636 | Bump version to 0.5.2 | neutralio/nio-cli,nioinnovation/nio-cli | nio_cli/__init__.py | nio_cli/__init__.py | __version__ = '0.5.2'
| __version__ = '0.5.1'
| apache-2.0 | Python |
8c5de29849ca061ed528c93c36fb3479aef34e41 | Update ipc_lista1.15.py | any1m1c/ipc20161 | lista1/ipc_lista1.15.py | lista1/ipc_lista1.15.py | #ipc_lista1.15
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#
qHora = input("Quanto você ganha por hora: ")
hT = input("Quantas horas você trabalhou: ")
SalBruto = qHora
ir = (11/100.0 * salBruto)
inss = (8/100.0m* SalBruto)
sindicato = (5/100.0 * SalBruto)
vT = ir + sindicato
SalLiq = SalBru... | #ipc_lista1.15
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#
qHora = input("Quanto você ganha por hora: ")
hT = input("Quantas horas você trabalhou: ")
SalBruto = qHora
ir = (11/100.0 * salBruto)
inss = (8/100.0m* SalBruto)
sindicato = (5/100.0 * SalBruto)
vT = ir + sindicato
SalLiq = SalBru... | apache-2.0 | Python |
6653e7d9289290b97f06e2b46314a12e194bfc6a | Update ipc_lista1.18.py | any1m1c/ipc20161 | lista1/ipc_lista1.18.py | lista1/ipc_lista1.18.py | #ipc_lista1.18
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que peça o tamanho de um arquivo para download(em MB) e a velocidade de um link de internet (em Mbps), calcule e informe o tempo aproximado de downloado do arquivo usando este link (em minutos).
arquivo = input("Infor... | #ipc_lista1.18
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que peça o tamanho de um arquivo para download(em MB) e a velocidade de um link de internet (em Mbps), calcule e informe o tempo aproximado de downloado do arquivo usando este link (em minutos).
#
| apache-2.0 | Python |
6c4d6587939b6e186fdc7c76448803559a00d5ea | Update ipc_lista2.02.py | any1m1c/ipc20161 | lista2/ipc_lista2.02.py | lista2/ipc_lista2.02.py | #ipc_lista2.02
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que peça um valor e mostre na tela
| #ipc_lista2.02
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que peça um valor e mostre
| apache-2.0 | Python |
b029ecf823cb97c1d70a7599787bd798b9a95ac6 | Update ipc_lista2.06.py | any1m1c/ipc20161 | lista2/ipc_lista2.06.py | lista2/ipc_lista2.06.py | #ipc_lista2.06
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que leia três números e mostre o maior deles.
number1 =
number2
| #ipc_lista2.06
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que leia três números e mostre o maior deles.
| apache-2.0 | Python |
37a55d4d0d4dd5827f1cd3e8cc62f3ac59f645fb | Remove old 'MIDDLEWARE_CLASSES'. | alexsilva/django-xadmin,alexsilva/django-xadmin,alexsilva/django-xadmin,alexsilva/django-xadmin | xadmin/plugins/language.py | xadmin/plugins/language.py |
from django.conf import settings
from django.template import loader
from django.views.i18n import set_language
from xadmin.plugins.utils import get_context_dict
from xadmin.sites import site
from xadmin.views import BaseAdminPlugin, CommAdminView, BaseAdminView
class SetLangNavPlugin(BaseAdminPlugin):
def block... |
from django.conf import settings
from django.template import loader
from django.views.i18n import set_language
from xadmin.plugins.utils import get_context_dict
from xadmin.sites import site
from xadmin.views import BaseAdminPlugin, CommAdminView, BaseAdminView
class SetLangNavPlugin(BaseAdminPlugin):
def block... | bsd-3-clause | Python |
5b0386d0872d4106902655ada78389503c62a95a | Add some default feedback types for item requests | yunity/yunity-core,yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/foodsaving-backend | yunity/models/relations.py | yunity/models/relations.py | from django.db.models import ForeignKey, DateTimeField, ManyToManyField
from yunity.models.entities import User, Location, Mappable, Message
from yunity.models.utils import BaseModel, MaxLengthCharField
from yunity.utils.decorators import classproperty
class Chat(BaseModel):
participants = ManyToManyField(User)
... | from django.db.models import ForeignKey, DateTimeField, ManyToManyField
from yunity.models.entities import User, Location, Mappable, Message
from yunity.models.utils import BaseModel, MaxLengthCharField
from yunity.utils.decorators import classproperty
class Chat(BaseModel):
participants = ManyToManyField(User)
... | agpl-3.0 | Python |
38b93a1c71aae112ec5a18234b1814b49d41066c | Add a test for operator / with an integer. | ymoch/pyjpmesh | jpmesh/test/test_angle.py | jpmesh/test/test_angle.py | """
Tests for jpmesh.angle.
"""
import unittest
from jpmesh.angle import Angle
class TestAngle(unittest.TestCase):
"""
Tests for jpmesh.angle.Angle.
"""
def test_properties(self):
"""
Test for properties.
"""
millisecond = 3600000
angle = Angle.from_milliseco... | """
Tests for jpmesh.angle.
"""
import unittest
from jpmesh.angle import Angle
class TestAngle(unittest.TestCase):
"""
Tests for jpmesh.angle.Angle.
"""
def test_properties(self):
"""
Test for properties.
"""
millisecond = 3600000
angle = Angle.from_milliseco... | mit | Python |
af4c5a72afb80ff59662cc6992ce3084fed75dfe | Fix dedupe not preserving order | muddyfish/PYKE,muddyfish/PYKE | node/deduplicate.py | node/deduplicate.py | #!/usr/bin/env python
from nodes import Node
class Deduplicate(Node):
char = "}"
args = 1
results = 1
@Node.test_func([2], [4])
@Node.test_func([1.5], [3])
def double(self, inp: Node.number):
"""inp*2"""
return inp*2
@Node.test_func([[1,2,3,1,1]], [[1,2,3]])
... | #!/usr/bin/env python
from nodes import Node
class Deduplicate(Node):
char = "}"
args = 1
results = 2
@Node.test_func([2], [4])
@Node.test_func([1.5], [3])
def double(self, inp: Node.number):
"""inp*2"""
self.results = 1
return inp*2
def func(self, seq... | mit | Python |
2c41bcc21f01be159be384fe5fa30c824dfb345c | Bump version to 14.0.0a7 | genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio | resolwe_bio/__about__.py | resolwe_bio/__about__.py | """Central place for package metadata."""
# NOTE: We use __title__ instead of simply __name__ since the latter would
# interfere with a global variable __name__ denoting object's name.
__title__ = 'resolwe-bio'
__summary__ = 'Bioinformatics pipelines for the Resolwe platform'
__url__ = 'https://github.com/genial... | """Central place for package metadata."""
# NOTE: We use __title__ instead of simply __name__ since the latter would
# interfere with a global variable __name__ denoting object's name.
__title__ = 'resolwe-bio'
__summary__ = 'Bioinformatics pipelines for the Resolwe platform'
__url__ = 'https://github.com/genial... | apache-2.0 | Python |
05c319f868215f832e97577f5e158edf82fab074 | Change version for next release | zestedesavoir/Python-ZMarkdown,Situphen/Python-ZMarkdown,zestedesavoir/Python-ZMarkdown,Situphen/Python-ZMarkdown,zestedesavoir/Python-ZMarkdown,Situphen/Python-ZMarkdown | markdown/__version__.py | markdown/__version__.py | #
# markdown/__version__.py
#
# version_info should conform to PEP 386
# (major, minor, micro, alpha/beta/rc/final, #)
# (1, 1, 2, 'alpha', 0) => "1.1.2.dev"
# (1, 2, 0, 'beta', 2) => "1.2b2"
version_info = (2, 6, 0, 'zds', 8)
def _get_version():
" Returns a PEP 386-compliant version number from version_info. "
... | #
# markdown/__version__.py
#
# version_info should conform to PEP 386
# (major, minor, micro, alpha/beta/rc/final, #)
# (1, 1, 2, 'alpha', 0) => "1.1.2.dev"
# (1, 2, 0, 'beta', 2) => "1.2b2"
version_info = (2, 6, 0, 'zds', 7)
def _get_version():
" Returns a PEP 386-compliant version number from version_info. "
... | bsd-3-clause | Python |
ab10f3d134065047a7260662d3c39295904795b8 | Add fkey constraints at the same time | openannotation/annotateit,openannotation/annotateit | migration/versions/001_initial_migration.py | migration/versions/001_initial_migration.py | from sqlalchemy import *
from migrate import *
import annotateit
from annotateit import db
from annotateit.model import Consumer, User
meta = MetaData()
consumer = Table('consumer', meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('key', String),
Column('secret', String),
Column(... | from __future__ import print_function
from getpass import getpass
import readline
import sys
from sqlalchemy import *
from migrate import *
from migrate.changeset.constraint import ForeignKeyConstraint
import annotateit
from annotateit import db
from annotateit.model import Consumer, User
meta = MetaData()
consumer... | agpl-3.0 | Python |
1421866ac3c4e4f1f09d17019d058aa903597df5 | Add new feature: find out is current week menu created already | Jntz/RuokalistaCommandLine | modules/menus_reader.py | modules/menus_reader.py | # -*- coding: utf-8 -*-
from json_reader import *
from config import *
def get_menus_data():
old_data = read_json_from_file(filenames["menus"])
if old_data == None or type(old_data) is not dict: # rewrite old_data and create new recipe dictionary
# initialize new dict
old_data = {}
old_data["menus"] = {}
elif... | # -*- coding: utf-8 -*-
from json_reader import *
from config import *
def get_menus_data():
old_data = read_json_from_file(filenames["menus"])
if old_data == None or type(old_data) is not dict: # rewrite old_data and create new recipe dictionary
# initialize new dict
old_data = {}
old_data["menus"] = {}
elif... | mit | Python |
8fe2a8735b11a834895d8a71fffa11349f890847 | Fix broken test. | pombreda/py2neo,fpieper/py2neo,nicolewhite/py2neo,fpieper/py2neo,nicolewhite/py2neo,technige/py2neo,technige/py2neo,fpieper/py2neo,nigelsmall/py2neo,pombreda/py2neo,nicolewhite/py2neo,nigelsmall/py2neo,technige/py2neo,pombreda/py2neo | test/cypher/cypher_record_test.py | test/cypher/cypher_record_test.py | #/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2011-2014, Nigel Small
#
# 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 ... | #/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2011-2014, Nigel Small
#
# 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 |
c4c2b7936a89ffbf97d63e4b5d33ea59201c94b0 | Add tests for mine.send | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/modules/mine.py | tests/integration/modules/mine.py | '''
Test the salt mine system
'''
import integration
class MineTest(integration.ModuleCase):
'''
Test the mine system
'''
def test_get(self):
'''
test mine.get and mine.update
'''
self.assertTrue(self.run_function('mine.update'))
self.assertTrue(self.run_function... | '''
Test the salt mine system
'''
import integration
class MineTest(integration.ModuleCase):
'''
Test the mine system
'''
def test_get(self):
'''
test mine.get
'''
self.assertTrue(self.run_function('mine.update'))
self.assertTrue(self.run_function('mine.get', ['m... | apache-2.0 | Python |
77fed481efb6da1091033e66b93324586664c221 | Cover new optimization for regression test | kayhayen/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka | tests/optimizations/Operations.py | tests/optimizations/Operations.py | # Copyright 2016, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Software where
# it's copied from other people. In these cases, that will normally be
# indicated.
#
# L... | # Copyright 2016, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Software where
# it's copied from other people. In these cases, that will normally be
# indicated.
#
# L... | apache-2.0 | Python |
08d1873e39531a8cb453fab91e0bb1c95a236cd2 | Update Copyright | tanghaibao/goatools,tanghaibao/goatools | tests/test_cli_write_hierarchy.py | tests/test_cli_write_hierarchy.py | #!/usr/bin/env python
"""Test that hierarchy below specified GO terms is printed."""
from __future__ import print_function
__copyright__ = "Copyright (c) 2017-2019, DV Klopfenstein. Haiboa Tang. All rights reserved."
from goatools.cli.wr_hierarchy import WrHierCli
# --o Output file in ASCII text form... | #!/usr/bin/env python
"""Test that hierarchy below specified GO terms is printed."""
from __future__ import print_function
__copyright__ = "Copyright (c) 2017-2018, DV Klopfenstein. Haiboa Tang. All rights reserved."
from goatools.cli.wr_hierarchy import WrHierCli
# --o Output file in ASCII text form... | bsd-2-clause | Python |
b7eefbea83768bd006c677aa5d69cf2a24e6e909 | Fix shebang line. | izrik/aeneas,izrik/aeneas | aeneas.py | aeneas.py | #!/usr/bin/env python
import argparse
from os import environ
def bool_from_str(s):
if isinstance(s, basestring):
s = s.lower()
if s in ['true', 't', '1', 'y']:
return True
if s in ['false', 'f', '0', 'n']:
return False
return bool(s)
AENEAS_DEBUG = bool_from_str(environ.get(... | #!/usr/bin/env python2
import argparse
from os import environ
def bool_from_str(s):
if isinstance(s, basestring):
s = s.lower()
if s in ['true', 't', '1', 'y']:
return True
if s in ['false', 'f', '0', 'n']:
return False
return bool(s)
AENEAS_DEBUG = bool_from_str(environ.get... | agpl-3.0 | Python |
600b054b950b26db8609d71a75350aaa995bb26e | Add import export to Geography admin | Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data | scorecard/admin.py | scorecard/admin.py |
from django.contrib import admin
from django.conf import settings
from django_q.tasks import async_task
from constance import config
from import_export import resources
from import_export.admin import ImportExportModelAdmin
from .models import (
Geography,
MunicipalityProfilesCompilation,
)
@admin.register(... |
from django.contrib import admin
from django.conf import settings
from django_q.tasks import async_task
from constance import config
from .models import (
Geography,
MunicipalityProfilesCompilation,
)
@admin.register(Geography)
class GeographyAdmin(admin.ModelAdmin):
list_display = ("geo_code", "geo_lev... | mit | Python |
6fb4bf39fd460b5f2d69d665d9e4d09e4279d88b | Add maximum page constraint for Pagination results | Mbarak-Mbigo/cp2_bucketlist | common/utils.py | common/utils.py | # common/utils.py
from flask import url_for, current_app
class PaginateData():
""""Pagination class.
Paginate query results
"""
def __init__(self, request, query, resource_for_url, key_name, schema):
self.request = request
self.query = query
self.resource_for_url = resourc... | # common/utils.py
from flask import url_for, current_app
class PaginateData():
""""Pagination class.
Paginate query results
"""
def __init__(self, request, query, resource_for_url, key_name, schema):
self.request = request
self.query = query
self.resource_for_url = resourc... | mit | Python |
9c38604fa8e85efeed723b47e3486f9d09ea9858 | Fix login cookie | phihag/adhocracy,DanielNeugebauer/adhocracy,SysTheron/adhocracy,phihag/adhocracy,DanielNeugebauer/adhocracy,liqd/adhocracy,liqd/adhocracy,alkadis/vcv,DanielNeugebauer/adhocracy,phihag/adhocracy,alkadis/vcv,SysTheron/adhocracy,DanielNeugebauer/adhocracy,alkadis/vcv,alkadis/vcv,phihag/adhocracy,phihag/adhocracy,SysTheron... | adhocracy/lib/auth/instance_auth_tkt.py | adhocracy/lib/auth/instance_auth_tkt.py | import datetime
from repoze.who.plugins.auth_tkt import AuthTktCookiePlugin, _now
from pylons import config
from paste.deploy.converters import asbool
class InstanceAuthTktCookiePlugin(AuthTktCookiePlugin):
def _get_cookies(self, environ, value, max_age=None):
if max_age is not None:
later = _... | import datetime
from repoze.who.plugins.auth_tkt import AuthTktCookiePlugin, _now
class InstanceAuthTktCookiePlugin(AuthTktCookiePlugin):
def _get_cookies(self, environ, value, max_age=None):
if max_age is not None:
later = _now() + datetime.timedelta(seconds=int(max_age))
# Wdy, ... | agpl-3.0 | Python |
10dc027ee15428d7ca210e0b74e5ae9274de0fa8 | Use raw_input instead of the unmodified words | YChrisZhang/PythonCrawler | lianXiangCi.py | lianXiangCi.py | #coding:utf-8
import urllib
import urllib2
import re
from random import choice
ipList=['120.76.115.134:80','222.83.14.145:3128','119.188.94.145:80']
thisIp=choice(ipList)
input = raw_input("Please input your key words:")
keyWord=urllib.quote(input)
url='http://search.sina.com.cn/iframe/suggest/index.ph... | #coding:utf-8
import urllib
import urllib2
import re
from random import choice
ipList=['120.76.115.134:80','222.83.14.145:3128','119.188.94.145:80']
thisIp=choice(ipList)
keyWord=urllib.quote('科学')
url='http://search.sina.com.cn/iframe/suggest/index.php?q='+keyWord
headers={
'Get':url,
... | mit | Python |
5e13528a3c2912b4238f8f531a8f2c2652292b0a | Add init_db | ForumOrganisation/forum-prod,ForumOrganisation/forum-fra,ForumOrganisation/forum-prod,ForumOrganisation/forum-prod | scripts/init_db.py | scripts/init_db.py | import os
from pymongo import MongoClient
def main():
try:
client = MongoClient(host=os.environ.get('MONGODB_URI'))
db = client.get_default_database()
# tasks
# db.users.create_index(keys='id', name='index_id', unique=True)
# create_admin(db)
db.users.update_many({... | import os
from pymongo import MongoClient
def main():
try:
client = MongoClient(host=os.environ.get('MONGODB_URI'))
db = client.get_default_database()
# tasks
db.users.create_index(keys='id', name='index_id', unique=True)
create_admin(db)
except Exception as e:
... | mit | Python |
d85a27db790bb4bc1926fc78bcf0f2d54c876e48 | bump version | SunPower/PVMismatch | pvmismatch/__init__.py | pvmismatch/__init__.py | # -*- coding: utf-8 -*-
"""
This is the PVMismatch Package. It contains :mod:`~pvmismatch.pvmismatch_lib`
and :mod:`~pvmismatch.pvmismatch_tk`.
:mod:`~pvmismatch.pvmismatch_lib`
=================================
This package contains the basic library modules, methods, classes and
attributes to model PV system mismatc... | # -*- coding: utf-8 -*-
"""
This is the PVMismatch Package. It contains :mod:`~pvmismatch.pvmismatch_lib`
and :mod:`~pvmismatch.pvmismatch_tk`.
:mod:`~pvmismatch.pvmismatch_lib`
=================================
This package contains the basic library modules, methods, classes and
attributes to model PV system mismatc... | bsd-3-clause | Python |
45a624e18b9b870163a5852bd4d06c59b3bb5ac2 | Fix base for got on pie binaries (#618) | pwndbg/pwndbg,cebrusfs/217gdb,anthraxx/pwndbg,anthraxx/pwndbg,anthraxx/pwndbg,cebrusfs/217gdb,pwndbg/pwndbg,cebrusfs/217gdb,anthraxx/pwndbg,pwndbg/pwndbg,cebrusfs/217gdb,pwndbg/pwndbg | pwndbg/commands/got.py | pwndbg/commands/got.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import pwndbg.chain
import pwndbg.commands
import pwndbg.enhance
import pwndbg.file
import pwndbg.which
imp... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import pwndbg.chain
import pwndbg.commands
import pwndbg.enhance
import pwndbg.file
import pwndbg.which
imp... | mit | Python |
a735f36102b370415b9f49dae4ee3c5ceda30136 | Update cycling_light.py | jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi | apps/hue/cycling_light.py | apps/hue/cycling_light.py |
# -*- coding: utf-8 -*-
# Author : jeonghoonkang, https://github.com/jeonghoonkang
import httplib
import time
conn = httplib.HTTPConnection("10.xxx.xxx.xxxx")
hue_uid = "c274b3c285d19cfxxxxxxxxxx"
restcmd = "/api"+hue_uid+"/lights"
str = " "
xhue = [10000,25000,46000,56280]
def shifthue() :
global str
glo... | # -*- coding: utf-8 -*-
# Author : jeonghoonkang, https://github.com/jeonghoonkang
import httplib
import time
conn = httplib.HTTPConnection("10.xxx.xxx.xxxx")
hue_uid = "c274b3c285d19cfxxxxxxxxxx"
restcmd = "/api"+hue_uid+"/lights"
str = " "
xhue = [10000,25000,46000,56280]
def shifthue() :
global str
glob... | bsd-2-clause | Python |
1f53a12d60b22263f35a40bf0a7d4cb5396c14e8 | add docstrings in Events | TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl | AlphaTwirl/Events/Events.py | AlphaTwirl/Events/Events.py | # Tai Sakuma <tai.sakuma@cern.ch>
##____________________________________________________________________________||
class Events(object):
"""An iterative object for events.
Examples
--------
inputFile = ROOT.TFile.Open(inputPath)
tree = inputFile.Get(treeName)
events = Events(tree)
for ev... | # Tai Sakuma <tai.sakuma@cern.ch>
##____________________________________________________________________________||
class Events(object):
def __init__(self, tree, maxEvents = -1):
self.file = tree.GetDirectory() # so a file won't close
self.tree = tree
self.nEvents = min(self.tree.GetEntries... | bsd-3-clause | Python |
c8d88489f3a4ce01ea8936440daec378b983e768 | Fix CLI typo. | peak6/st2,nzlosh/st2,Plexxi/st2,nzlosh/st2,StackStorm/st2,StackStorm/st2,peak6/st2,Plexxi/st2,peak6/st2,nzlosh/st2,StackStorm/st2,tonybaloney/st2,Plexxi/st2,tonybaloney/st2,Plexxi/st2,tonybaloney/st2,StackStorm/st2,nzlosh/st2 | st2client/st2client/models/action_alias.py | st2client/st2client/models/action_alias.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 |
03fec45fa269a8badbe047b4911c655c3c952404 | Use consistent CLI command names. | alfasin/st2,Itxaka/st2,StackStorm/st2,StackStorm/st2,alfasin/st2,punalpatel/st2,punalpatel/st2,dennybaa/st2,alfasin/st2,punalpatel/st2,Plexxi/st2,Plexxi/st2,nzlosh/st2,StackStorm/st2,peak6/st2,pixelrebel/st2,armab/st2,tonybaloney/st2,grengojbo/st2,Plexxi/st2,grengojbo/st2,emedvedev/st2,Plexxi/st2,nzlosh/st2,pixelrebel/... | st2client/st2client/models/action_alias.py | st2client/st2client/models/action_alias.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 |
be6237173274c98d646f50ad87d4b7bcd38a5707 | Use Unicode strings for file paths | michaelmior/pylinks,michaelmior/pylinks,michaelmior/pylinks | pylinks/links/utils.py | pylinks/links/utils.py | import six
from django.conf import settings
from django.core.exceptions import ValidationError
from pyuploadcare.dj import FileField
from pyuploadcare.api_resources import File
from pyuploadcare.exceptions import InvalidRequestError
# Patch File to pass through S3 URLs
class LinkFile(File):
def __init__(self, cdn_... | import six
from django.conf import settings
from django.core.exceptions import ValidationError
from pyuploadcare.dj import FileField
from pyuploadcare.api_resources import File
from pyuploadcare.exceptions import InvalidRequestError
# Patch File to pass through S3 URLs
class LinkFile(File):
def __init__(self, cdn_... | mit | Python |
92ef6fda87d70434bc6875062779c72bffd2d723 | Check field type | mangal-wg/pymangal | pymangal/makeschema.py | pymangal/makeschema.py | import json
def makeschema(infos=None, name=None, title="Autogenerated JSON schema"):
""" Generates a JSON scheme from a dict representing the schema sent by the API
:param infos: A ``dict`` with the resource schema
:param name: The name of the resource
:param title: A description of the object
""... | import json
def makeschema(infos=None, name=None, title="Autogenerated JSON schema"):
""" Generates a JSON scheme from a dict representing the schema sent by the API
:param infos: A ``dict`` with the resource schema
:param name: The name of the resource
:param title: A description of the object
""... | bsd-2-clause | Python |
59c1c893375f6fdf2308385b2c4d331e5af7961b | Prepare 0.5.1 release | curzona/pytest-bdd,spinus/pytest-bdd,pytest-dev/pytest-bdd | pytest_bdd/__init__.py | pytest_bdd/__init__.py | from pytest_bdd.steps import given, when, then # pragma: no cover
from pytest_bdd.scenario import scenario # pragma: no cover
__version__ = '0.5.1'
__all__ = [given.__name__, when.__name__, then.__name__, scenario.__name__] # pragma: no cover
| from pytest_bdd.steps import given, when, then # pragma: no cover
from pytest_bdd.scenario import scenario # pragma: no cover
__version__ = '0.5.0'
__all__ = [given.__name__, when.__name__, then.__name__, scenario.__name__] # pragma: no cover
| mit | Python |
95d3b17ca32781b4ce81110aa406ab6d15b1ae1c | Update metadata with new tutorials | Kaggle/learntools,Kaggle/learntools | notebooks/feature_engineering/track_meta.py | notebooks/feature_engineering/track_meta.py | # See also examples/example_track/example_meta.py for a longer, commented example
track = dict(
author_username='matleonard',
course_name='Feature Engineering',
course_url='https://www.kaggle.com/learn/feature-engineering'
)
lessons = [ {'topic': topic_name} for topic_name in
['Baseline... | # See also examples/example_track/example_meta.py for a longer, commented example
track = dict(
author_username='matleonard',
course_name='Feature Engineering',
course_url='https://www.kaggle.com/learn/feature-engineering'
)
lessons = [ {'topic': topic_name} for topic_name in
['Baseline... | apache-2.0 | Python |
64275164f9f7c226695774ce1d3a234005ab23a6 | Solve Code Fights digits product problem | HKuz/Test_Code | CodeFights/digitsProduct.py | CodeFights/digitsProduct.py | #!/usr/local/bin/python
# Code Fights Digits Product Problem
def digitsProduct(product):
def get_single_dig_factors(product):
# Helper function to generate single-digit factors of product
n = product
factors = []
for i in range(9, 1, -1):
while n % i == 0 and n > 1:
... | #!/usr/local/bin/python
# Code Fights Digits Product Problem
def digitsProduct(product):
def get_single_dig_factors(product):
# Helper function to generate single-digit factors of product
n = product
factors = []
while n > 1:
for i in range(9, 1, -1):
if... | mit | Python |
5d4b1b16b787dd529a92c76ff2f5e0736443782f | mark external connection to EDW tests xfail | 4dn-dcic/fourfront,ENCODE-DCC/encoded,philiptzou/clincoded,4dn-dcic/fourfront,T2DREAM/t2dream-portal,ENCODE-DCC/snovault,ClinGen/clincoded,4dn-dcic/fourfront,hms-dbmi/fourfront,ENCODE-DCC/encoded,philiptzou/clincoded,kidaa/encoded,kidaa/encoded,kidaa/encoded,hms-dbmi/fourfront,hms-dbmi/fourfront,hms-dbmi/fourfront,phil... | src/encoded/tests/test_edw_file.py | src/encoded/tests/test_edw_file.py | import pytest
import json
from sqlalchemy.engine.base import Engine
import encoded.edw_file
import edw_test_data
pytestmark = [pytest.mark.edw_file]
## TODO: This should be converted to a smoke-type test after build/install is complete
@pytest.mark.xfail
# travis cannot connect to EDW
def test_make_edw():
edw ... | import pytest
import json
from sqlalchemy.engine.base import Engine
import encoded.edw_file
import edw_test_data
pytestmark = [pytest.mark.edw_file]
## edw_file
# def format_edw_fileinfo(file_dict, exclude=None):
# def make_edw(data_host=None):
# def dump_filelist(fileaccs, header=True, typeField=None):
# def dump_f... | mit | Python |
9b16c980a0b3ac627e8ba2c7ea88231a0f308bd9 | Upgrade celery config | stefanw/seriesly,stefanw/seriesly | seriesly/celery.py | seriesly/celery.py | from __future__ import absolute_import
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'seriesly.settings')
app = Celery('seriesly')
# Using a string here means the worker will not have to
# pickle the object whe... | from __future__ import absolute_import
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'seriesly.settings')
from django.conf import settings # noqa
app = Celery('seriesly')
# Using a string here means the worke... | agpl-3.0 | Python |
3449534933e5d1e33c4f6b1017d68c804ba1f91f | Allow overriding of bgen pathnames in an optional module bgenlocationcustomize. Editing of bgenlocations.py isn't easy if your Python was supplied by Apple. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/plat-mac/bgenlocations.py | Lib/plat-mac/bgenlocations.py | #
# Local customizations for generating the Carbon interface modules.
# Edit this file to reflect where things should be on your system.
# Note that pathnames are unix-style for OSX MachoPython/unix-Python,
# but mac-style for MacPython, whether running on OS9 or OSX.
#
import sys, os
Error = "bgenlocations.Error"
#
... | #
# Local customizations for generating the Carbon interface modules.
# Edit this file to reflect where things should be on your system.
# Note that pathnames are unix-style for OSX MachoPython/unix-Python,
# but mac-style for MacPython, whether running on OS9 or OSX.
#
import sys, os
Error = "bgenlocations.Error"
#
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.