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 |
|---|---|---|---|---|---|---|---|---|
f682300d4a8ab7e13ad0e26d2b37fdf24cdbdce9 | Bump development version | stefanfoulis/django-filer,divio/django-filer,skirsdeda/django-filer,webu/django-filer,webu/django-filer,stefanfoulis/django-filer,webu/django-filer,divio/django-filer,stefanfoulis/django-filer,skirsdeda/django-filer,skirsdeda/django-filer,stefanfoulis/django-filer,webu/django-filer,skirsdeda/django-filer,divio/django-f... | filer/__init__.py | filer/__init__.py | # -*- coding: utf-8 -*-
# version string following pep-0396 and pep-0386
__version__ = '1.2.6.rc2' # pragma: nocover
default_app_config = 'filer.apps.FilerConfig'
| # -*- coding: utf-8 -*-
# version string following pep-0396 and pep-0386
__version__ = '1.2.6.rc1' # pragma: nocover
default_app_config = 'filer.apps.FilerConfig'
| bsd-3-clause | Python |
05c8dffcbfc08bbfd98d0f6a506af245719b3ac8 | FIX dependency | ingadhoc/account-payment,ClearCorp/account-financial-tools,maljac/odoo-addons,ingadhoc/sale,dvitme/odoo-addons,adhoc-dev/odoo-addons,HBEE/odoo-addons,ingadhoc/partner,dvitme/odoo-addons,bmya/odoo-addons,sysadminmatmoz/ingadhoc,jorsea/odoo-addons,adhoc-dev/account-financial-tools,adhoc-dev/odoo-addons,bmya/odoo-addons,i... | stock_picking_ean128_report/__openerp__.py | stock_picking_ean128_report/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | agpl-3.0 | Python |
9608fff230665f5120e6ea98d4ae0efc91a345ef | Revert "Add teuthology git version query/logging" | ceph/teuthology,dmick/teuthology,SUSE/teuthology,ktdreyer/teuthology,SUSE/teuthology,SUSE/teuthology,dmick/teuthology,ktdreyer/teuthology,ceph/teuthology,dmick/teuthology | teuthology/__init__.py | teuthology/__init__.py | from gevent import monkey
monkey.patch_all(
dns=False,
# Don't patch subprocess to avoid http://tracker.ceph.com/issues/14990
subprocess=False,
)
import sys
# Don't write pyc files
sys.dont_write_bytecode = True
from .orchestra import monkey
monkey.patch_all()
import logging
import os
__version__ = '0.... | from gevent import monkey
monkey.patch_all(
dns=False,
# Don't patch subprocess to avoid http://tracker.ceph.com/issues/14990
subprocess=False,
)
import sys
# Don't write pyc files
sys.dont_write_bytecode = True
from .orchestra import monkey
monkey.patch_all()
import logging
import os
import subprocess
... | mit | Python |
0e4c8fb4965eadf8cf45ff0f6d3406df17015f46 | remove print | Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide | timeside/server/tasks.py | timeside/server/tasks.py | from __future__ import absolute_import
import time
import gc
from celery import shared_task
from celery.result import AsyncResult
from celery.result import GroupResult
from .models import Item, Selection, Preset, Experience, Task
from .models import _DONE
from celery.task import chord
from celery.utils.log import g... | from __future__ import absolute_import
import time
import gc
from celery import shared_task
from celery.result import AsyncResult
from celery.result import GroupResult
from .models import Item, Selection, Preset, Experience, Task
from .models import _DONE
from celery.task import chord
from celery.utils.log import g... | agpl-3.0 | Python |
0138eacf0d518b86e819a70000b7b527434a6b35 | Change les arguments passés à celery pour gérer la sérialisation JSON. | dezede/dezede,dezede/dezede,dezede/dezede,dezede/dezede | libretto/signals.py | libretto/signals.py | # coding: utf-8
from __future__ import unicode_literals
from celery_haystack.signals import CelerySignalProcessor
from django.contrib.admin.models import LogEntry
from django.contrib.sessions.models import Session
from reversion.models import Version, Revision
from .tasks import auto_invalidate
class CeleryAutoInval... | # coding: utf-8
from __future__ import unicode_literals
from celery_haystack.signals import CelerySignalProcessor
from django.contrib.admin.models import LogEntry
from reversion.models import Version, Revision
from .tasks import auto_invalidate
class CeleryAutoInvalidator(CelerySignalProcessor):
def enqueue(self... | bsd-3-clause | Python |
eb102bb8550d59b34373f1806633a6079f7064a8 | Make sure that all requests for static files are correctly hidden from output | caffodian/django-devserver,madgeekfiend/django-devserver,jimmyye/django-devserver,takeshineshiro/django-devserver,pjdelport/django-devserver,bastianh/django-devserver,Stackdriver/django-devserver,dcramer/django-devserver,chriscauley/django-devserver,coagulant/django-devserver,mathspace/django-devserver | devserver/utils/http.py | devserver/utils/http.py | from django.conf import settings
from django.core.servers.basehttp import WSGIRequestHandler
from django.db import connection
from devserver.utils.time import ms_from_timedelta
from datetime import datetime
class SlimWSGIRequestHandler(WSGIRequestHandler):
"""
Hides all requests that originate from either ``... | from django.conf import settings
from django.core.servers.basehttp import WSGIRequestHandler
from django.db import connection
from devserver.utils.time import ms_from_timedelta
from datetime import datetime
class SlimWSGIRequestHandler(WSGIRequestHandler):
"""
Hides all requests that originate from ```MEDIA_... | bsd-3-clause | Python |
649d4b7fb22c92fa116fb574c1e4a07578ca6faa | Create methods for getting revisions. | xfix/NextBoard | forum/models.py | forum/models.py | from django.db import models
import django.contrib.auth.models as auth
class User(auth.User):
"""Model for representing users.
It has few fields that aren't in the standard authentication user
table, and are needed for the forum to work, like footers.
"""
display_name = models.CharField(max_length... | from django.db import models
import django.contrib.auth.models as auth
class User(auth.User):
"""Model for representing users.
It has few fields that aren't in the standard authentication user
table, and are needed for the forum to work, like footers.
"""
display_name = models.CharField(max_length... | mit | Python |
65eb9bcd58d78fd80fabd03a26be73335f1a1122 | Update ci nose config to run with four processes | slashk/goldstone-server,Solinea/goldstone-server,slashk/goldstone-server,Solinea/goldstone-server,slashk/goldstone-server,Solinea/goldstone-server,slashk/goldstone-server,Solinea/goldstone-server,slashk/goldstone-server,Solinea/goldstone-server | goldstone/settings/ci.py | goldstone/settings/ci.py | """Settings for accessing a distributed docker instance."""
# Copyright 2015 Solinea, 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
#... | """Settings for accessing a distributed docker instance."""
# Copyright 2015 Solinea, 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
#... | apache-2.0 | Python |
0fe56f804a7ed4958f33a534e30e3b6c79526ea6 | Update SimplyPremiumCom.py | vuolter/pyload,vuolter/pyload,vuolter/pyload | module/plugins/accounts/SimplyPremiumCom.py | module/plugins/accounts/SimplyPremiumCom.py | # -*- coding: utf-8 -*-
from module.common.json_layer import json_loads
from module.plugins.Account import Account
class SimplyPremiumCom(Account):
__name__ = "SimplyPremiumCom"
__type__ = "account"
__version__ = "0.04"
__description__ = """Simply-Premium.com account plugin"""
__license__ ... | # -*- coding: utf-8 -*-
from module.common.json_layer import json_loads
from module.plugins.Account import Account
class SimplyPremiumCom(Account):
__name__ = "SimplyPremiumCom"
__type__ = "account"
__version__ = "0.03"
__description__ = """Simply-Premium.com account plugin"""
__license__ ... | agpl-3.0 | Python |
187e8237f9ba56dc517b2ad6e58be3e8031fa9df | Update __init__.py | rushter/MLAlgorithms | examples/__init__.py | examples/__init__.py | # coding: utf-8
import sys
sys.path.append("./examples")
| # coding: utf-8
# In[1]:
import sys
sys.path.append("./examples")#add the examples as a module
| mit | Python |
9ee0ad7dfad15e3d933b4d1c3fab508d99480748 | Fix example. | kubkon/gmm | examples/faithful.py | examples/faithful.py | import numpy as np
import matplotlib.pyplot as plt
from gmm.algorithm import GMM
# Read in dataset from file
with open('faithful.txt', 'rt') as f:
data = []
for row in f:
cols = row.strip('\r\n').split(' ')
data.append(np.fromiter(map(lambda x: float(x), cols), np.float))
data = np.array(... | import numpy as np
import matplotlib.pyplot as plt
from gmm.algorithm import GMM
# Read in dataset from file
with open('faithful.txt', 'rt') as f:
data = []
for row in f:
cols = row.strip('\r\n').split(' ')
data.append(np.fromiter(map(lambda x: float(x), cols), np.float))
data = np.array(... | mit | Python |
2c09c700b524a7272436feff19c4128ca3211725 | Update word2vec.py | cvangysel/pyndri,cvangysel/pyndri | examples/word2vec.py | examples/word2vec.py | import copy
import gensim
import logging
import pyndri
import sys
logging.basicConfig(level=logging.INFO)
if len(sys.argv) <= 1:
logging.error('Usage: python %s <path-to-indri-index>'.format(sys.argv[0]))
sys.exit(0)
logging.info('Initializing word2vec.')
word2vec_init = gensim.models.Word2Vec(
size=30... | import copy
import gensim
import logging
import pyndri
import sys
logging.basicConfig(level=logging.INFO)
if len(sys.argv) <= 1:
logging.error('Usage: python %s <path-to-indri-index>'.format(sys.argv[0]))
sys.exit(0)
logging.info('Initializing word2vec.')
word2vec_init = gensim.models.Word2Vec(
size=30... | mit | Python |
2ece6032b2344e3cf6304a757714d0ecf5015324 | split drive controller to allow other pwm interface eg raspy juice | FishPi/FishPi-POCV---Command---Control,FishPi/FishPi-POCV---Command---Control | fishpi/vehicle/test_drive.py | fishpi/vehicle/test_drive.py | #!/usr/bin/python
#
# FishPi - An autonomous drop in the ocean
#
# Simple test of PWM motor and servo drive
#
import raspberrypi
from time import sleep
from drive_controller import AdafruitDriveController
if __name__ == "__main__":
print "testing drive controller..."
drive = AdafruitDriveController(debug=Tr... | #!/usr/bin/python
#
# FishPi - An autonomous drop in the ocean
#
# Simple test of PWM motor and servo drive
#
import raspberrypi
from time import sleep
from drive_controller import DriveController
if __name__ == "__main__":
print "testing drive controller..."
drive = DriveController(debug=True, i2c_bus=rasp... | bsd-2-clause | Python |
3566c7689f59715f2d58886f52d3dd0c00a0ce4e | change manage.py | fortyMiles/my-family,fortyMiles/my-family,fortyMiles/my-family | maili-develop/manage.py | maili-develop/manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
if 'test' in sys.argv:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")
else:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "maili.settings")
from django.core.management import execute_from_command_line... | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "maili.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| bsd-3-clause | Python |
ed267933edf8b6e2e2b63d11ece7457943fe9646 | Add documentation for powerline.lib.shell.run_cmd | bartvm/powerline,lukw00/powerline,Luffin/powerline,cyrixhero/powerline,xxxhycl2010/powerline,EricSB/powerline,prvnkumar/powerline,wfscheper/powerline,blindFS/powerline,QuLogic/powerline,seanfisk/powerline,Liangjianghao/powerline,S0lll0s/powerline,bezhermoso/powerline,kenrachynski/powerline,russellb/powerline,russellb/p... | powerline/lib/shell.py | powerline/lib/shell.py | # vim:fileencoding=utf-8:noet
from __future__ import absolute_import, unicode_literals, division, print_function
from subprocess import Popen, PIPE
from locale import getlocale, getdefaultlocale, LC_MESSAGES
def _get_shell_encoding():
return getlocale(LC_MESSAGES)[1] or getdefaultlocale()[1] or 'utf-8'
def run_c... | # vim:fileencoding=utf-8:noet
from __future__ import absolute_import, unicode_literals, division, print_function
from subprocess import Popen, PIPE
from locale import getlocale, getdefaultlocale, LC_MESSAGES
def _get_shell_encoding():
return getlocale(LC_MESSAGES)[1] or getdefaultlocale()[1] or 'utf-8'
def run_c... | mit | Python |
be8fd3f10dbfd8e2099a046340a8e51758e60bd5 | Add signout view so we can signout (by entering url manually) | markpasc/makerbase,markpasc/makerbase | makerbase/views/auth.py | makerbase/views/auth.py | import json
from urllib import urlencode
from urlparse import parse_qs, urlsplit, urlunsplit
from flask import redirect, request, url_for
from flaskext.login import LoginManager, login_user, logout_user
import requests
from makerbase import app
from makerbase.models import User
login_manager = LoginManager()
login_... | import json
from urllib import urlencode
from urlparse import parse_qs, urlsplit, urlunsplit
from flask import redirect, request, url_for
from flaskext.login import LoginManager, login_user
import requests
from makerbase import app
from makerbase.models import User
login_manager = LoginManager()
login_manager.setup... | mit | Python |
df27f7ad62eebf29b42bfa9b2bce7d73739c4a8e | Fix minor template modernization bug | aptiko/enhydris,ellak-monades-aristeias/enhydris,openmeteo/enhydris,ellak-monades-aristeias/enhydris,kickapoo/enhydris,aptiko/enhydris,openmeteo/enhydris,kickapoo/enhydris,ellak-monades-aristeias/enhydris,kickapoo/enhydris,aptiko/enhydris,openmeteo/enhydris | enhydris/conf/settings.py | enhydris/conf/settings.py | # Enhydris settings for {{ project_name }} project.
#
# Generated by 'enhydris-admin newinstance' using Enhydris {{ enhydris_version }}
# and Django {{ django_version }}.
#
# For more information on this file, see
# http://enhydris.readthedocs.org/en/{{ enhydris_docs_version }}/general/install.html#settings-reference
... | # Enhydris settings for {{ project_name }} project.
#
# Generated by 'enhydris-admin newinstance' using Enhydris {{ enhydris_version }}
# and Django {{ django_version }}.
#
# For more information on this file, see
# http://enhydris.readthedocs.org/en/{{ enhydris_docs_version }}/general/install.html#settings-reference
... | agpl-3.0 | Python |
4464919c5114193179490c151844fd771bfd880b | fix setup without flask installed | salsita/flask-ecstatic | flask_ecstatic.py | flask_ecstatic.py | """Serves static files with optional directory index.
Files in static folder are automatically served on static URL by Flask.
See http://flask.pocoo.org/docs/0.10/api/#application-object.
It's recommended to specify static folder and URL path directly on Flask application object,
unless you need additional static fol... | """Serves static files with optional directory index.
Files in static folder are automatically served on static URL by Flask.
See http://flask.pocoo.org/docs/0.10/api/#application-object.
It's recommended to specify static folder and URL path directly on Flask application object,
unless you need additional static fol... | mit | Python |
b83e371f37477b5eaf552ac78383e3f0ac94bc21 | Change in presseurop RSS feed | Konubinix/weboob,willprice/weboob,sputnick-dev/weboob,laurent-george/weboob,sputnick-dev/weboob,nojhan/weboob-devel,RouxRC/weboob,eirmag/weboob,Boussadia/weboob,yannrouillard/weboob,RouxRC/weboob,frankrousseau/weboob,Boussadia/weboob,Boussadia/weboob,laurent-george/weboob,RouxRC/weboob,yannrouillard/weboob,franek/weboo... | modules/presseurop/backend.py | modules/presseurop/backend.py | # -*- coding: utf-8 -*-
# Copyright(C) 2012 Florent Fourcot
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | # -*- coding: utf-8 -*-
# Copyright(C) 2012 Florent Fourcot
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | agpl-3.0 | Python |
a3ae8a7ece6bc75437b9848cf43335690250c128 | exit http server gracefully | regadas/presstatic | presstatic/__main__.py | presstatic/__main__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import argparse
import SimpleHTTPServer
import SocketServer
from clint.textui import colored, puts, indent
from presstatic import help
from presstatic.builders import SiteBuilder
from presstatic.storage import s3
def http_server(host, port, dir):
Handler ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import argparse
import SimpleHTTPServer
import SocketServer
from clint.textui import colored, puts, indent
from presstatic import help
from presstatic.builders import SiteBuilder
from presstatic.storage import s3
def http_server_on_dir(host, port, dir):
H... | mit | Python |
9381657d8ad2e96c2537c89fad7a4b3d8d8ddff5 | Add gpu parameter to htcondor_at_vispa example. | riga/law,riga/law | examples/htcondor_at_vispa/analysis/framework.py | examples/htcondor_at_vispa/analysis/framework.py | # -*- coding: utf-8 -*-
"""
Law example tasks to demonstrate HTCondor workflows at VISPA.
In this file, some really basic tasks are defined that can be inherited by
other tasks to receive the same features. This is usually called "framework"
and only needs to be defined once per user / group / etc.
"""
import os
i... | # -*- coding: utf-8 -*-
"""
Law example tasks to demonstrate HTCondor workflows at VISPA.
In this file, some really basic tasks are defined that can be inherited by
other tasks to receive the same features. This is usually called "framework"
and only needs to be defined once per user / group / etc.
"""
import os
i... | bsd-3-clause | Python |
a5de78328cc2e63c901c409fb6c7b376abf921e2 | reorganize code the object oriented way | enricobacis/cineca-scopus | src/scopus.py | src/scopus.py | from itertools import chain
import requests
_HEADERS = {'Accept': 'application/json'}
class ScopusResponse(object):
def __init__(self, data):
self._data = data
def __getitem__(self, key):
return self._data['search-results'][key]
def __iter__(self):
resp = self
while resp... | import requests
class ScopusClient(object):
_AUTHOR_API = 'http://api.elsevier.com/content/search/author'
_SCOPUS_API = 'http://api.elsevier.com/content/search/scopus'
_HEADERS = {'Accept': 'application/json'}
def __init__(self, apiKey):
self.apiKey = apiKey
def _api(self, endpoint, quer... | mit | Python |
0bf9c011ca36df2d72dfd3b8fc59f6320e837e43 | Update __init__.py | DMOJ/judge,DMOJ/judge,DMOJ/judge | dmoj/cptbox/__init__.py | dmoj/cptbox/__init__.py | from collections import defaultdict
from dmoj.cptbox.sandbox import SecurePopen, PIPE
from dmoj.cptbox.handlers import DISALLOW, ALLOW
from dmoj.cptbox.chroot import CHROOTSecurity
from dmoj.cptbox.syscalls import SYSCALL_COUNT
if sys.version_info.major == 2:
range = xrange
class NullSecurity(defaultdict):
d... | from collections import defaultdict
from dmoj.cptbox.sandbox import SecurePopen, PIPE
from dmoj.cptbox.handlers import DISALLOW, ALLOW
from dmoj.cptbox.chroot import CHROOTSecurity
from dmoj.cptbox.syscalls import SYSCALL_COUNT
class NullSecurity(defaultdict):
def __init__(self):
for i in xrange(SYSCALL_... | agpl-3.0 | Python |
ca050969d1267d13986a0494a86f7fd50616937e | Remove old code. | HackatONG-ProgramAR/resoluciones-unc,HackatONG-ProgramAR/resoluciones-unc | process/scripts/run.py | process/scripts/run.py | """
Document processing script. Does NER for persons, dates, etc.
Usage:
process.py <dbname>
process.py -h | --help | --version
Options:
-h --help Show this screen
--version Version number
"""
import logging
from docopt import docopt
from iepy.db import connect, DocumentManager
fr... | """
Document processing script. Does NER for persons, dates, etc.
Usage:
process.py <dbname>
process.py -h | --help | --version
Options:
-h --help Show this screen
--version Version number
"""
import logging
from docopt import docopt
from iepy.db import connect, DocumentManager
fr... | bsd-3-clause | Python |
9bc1c77250d338ca93ff33d2832c2b3117b3550e | Use the raw domain for Netflix, because there's only one now | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org | services/netflix.py | services/netflix.py | import urlparse
import foauth.providers
from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY
class Netflix(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://www.netflix.com/'
favicon_url = 'https://netflix.hs.llnwd.net/e1/en_US/icons/nficon.ico'
docs_url = 'http:... | import urlparse
import foauth.providers
from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY
class Netflix(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://www.netflix.com/'
favicon_url = 'https://netflix.hs.llnwd.net/e1/en_US/icons/nficon.ico'
docs_url = 'http:... | bsd-3-clause | Python |
87cc7ccb8626d9e236954cce0667167f5f9742be | fix prometheus test | uw-it-aca/uw-restclients-core,uw-it-aca/uw-restclients-core | restclients_core/tests/test_prometheus.py | restclients_core/tests/test_prometheus.py | from restclients_core.tests.dao_implementation.test_live import TDAO
from unittest import TestCase, skipUnless
from prometheus_client import generate_latest, REGISTRY
import os
@skipUnless("RUN_LIVE_TESTS" in os.environ, "RUN_LIVE_TESTS=1 to run tests")
class TestPrometheusObservations(TestCase):
def test_prometh... | from restclients_core.tests.dao_implementation.test_backend import TDAO
from unittest import TestCase
from prometheus_client import generate_latest, REGISTRY
class TestPrometheusObservations(TestCase):
def test_prometheus_observation(self):
metrics = generate_latest(REGISTRY).decode('utf-8')
self... | apache-2.0 | Python |
fa78baf7eb05e465ac265fad02de763e0ab56403 | Speed up cache keys generation | MahjongRepository/tenhou-python-bot,MahjongRepository/tenhou-python-bot | project/utils/cache.py | project/utils/cache.py | import hashlib
import marshal
from typing import List, Optional
from utils.decisions_logger import MeldPrint
def build_shanten_cache_key(tiles_34: List[int], open_sets_34: Optional[List[List[int]]], use_chiitoitsu: bool):
prepared_array = tiles_34 + [200] + (open_sets_34 and [x for x in open_sets_34] or []) + [u... | from typing import List, Optional
from mahjong.tile import TilesConverter
from utils.decisions_logger import MeldPrint
def build_shanten_cache_key(tiles_34: List[int], open_sets_34: Optional[List[List[int]]], use_chiitoitsu: bool):
cache_key = "{},{},{}".format(
"".join([str(x) for x in tiles_34]),
... | mit | Python |
62404979e69ccd129f8382e8a2fce5329c577a78 | fix version | hsharrison/experimentator | experimentator/__version__.py | experimentator/__version__.py | __version__ = '0.2.0dev5'
| __version__ = '0.2.0.dev5'
| mit | Python |
3471381b5894536142a9460410e0efe5e8b1b294 | make doc regex more lenient | mitsuhiko/flask-website,mitsuhiko/flask-website,mitsuhiko/flask-website | flask_website/docs.py | flask_website/docs.py | # -*- coding: utf-8 -*-
import os
import re
from flask import url_for, Markup
from flask_website import app
from flask_website.search import Indexable
_doc_body_re = re.compile(r'''(?smx)
<title>(.*?)</title>.*?
<div.*?class=".*?body.*?>(.*)
<div.*?class=".*?sphinxsidebar
''')
class DocumentationPage(Ind... | # -*- coding: utf-8 -*-
import os
import re
from flask import url_for, Markup
from flask_website import app
from flask_website.search import Indexable
_doc_body_re = re.compile(r'''(?smx)
<title>(.*?)</title>.*?
<div\s+class="body">(.*?)<div\s+class="sphinxsidebar">
''')
class DocumentationPage(Indexable):
... | bsd-3-clause | Python |
98e899d5e76f8bee5c288bffe78ccf943665693c | Fix white space to be 4 spaces | adadlani/hello-world,adadlani/hello-world | get_cve_data.py | get_cve_data.py | # Script to import CVE data from NIST https://nvd.nist.gov/vuln/data-feeds#JSON_FEED
# https://static.nvd.nist.gov/feeds/json/cve/1.0/nvdcve-1.0-modified.json.gz
import gzip
import json
import pycurl
from io import BytesIO
NVD_CVE_ENDPOINT = 'https://static.nvd.nist.gov/feeds/json/cve/1.0/nvdcve-1.0-modified.json.gz'... | # Script to import CVE data from NIST https://nvd.nist.gov/vuln/data-feeds#JSON_FEED
# https://static.nvd.nist.gov/feeds/json/cve/1.0/nvdcve-1.0-modified.json.gz
import gzip
import json
import pycurl
from io import BytesIO
NVD_CVE_ENDPOINT = 'https://static.nvd.nist.gov/feeds/json/cve/1.0/nvdcve-1.0-modified.json.gz'... | apache-2.0 | Python |
5e3a4c84d31fe63a67fdb2e64c5edc1ffe8d24ab | Tweak return message | gazpachoking/Flexget,Flexget/Flexget,LynxyssCZ/Flexget,Danfocus/Flexget,gazpachoking/Flexget,Danfocus/Flexget,qk4l/Flexget,JorisDeRieck/Flexget,crawln45/Flexget,jawilson/Flexget,qk4l/Flexget,malkavi/Flexget,jacobmetrick/Flexget,malkavi/Flexget,Danfocus/Flexget,drwyrm/Flexget,ianstalk/Flexget,jacobmetrick/Flexget,malkav... | flexget/api/cached.py | flexget/api/cached.py | from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from flask.helpers import send_file
from flask_restplus import inputs
from flexget.api import api, APIResource, APIError, BadRequest
from flexget.utils.tools import cached_resou... | from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from flask.helpers import send_file
from flask_restplus import inputs
from flexget.api import api, APIResource, APIError, BadRequest
from flexget.utils.tools import cached_resou... | mit | Python |
9df0c21bcefdeda4ca65ee4126ed965a6d099416 | Fix line length on import statement | Dekker1/moore,UTNkar/moore,UTNkar/moore,UTNkar/moore,Dekker1/moore,UTNkar/moore,Dekker1/moore,Dekker1/moore | website/website/wagtail_hooks.py | website/website/wagtail_hooks.py | from wagtail.contrib.modeladmin.options import ModelAdmin,\
modeladmin_register, ThumbnailMixin
from website.models import Logo
class LogoAdmin(ThumbnailMixin, ModelAdmin):
model = Logo
menu_icon = 'picture'
menu_order = 1000
list_display = ('admin_thumb', 'category', 'link')
add_to_settings_... | from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register, \
ThumbnailMixin
from website.models import Logo
class LogoAdmin(ThumbnailMixin, ModelAdmin):
model = Logo
menu_icon = 'picture'
menu_order = 1000
list_display = ('admin_thumb', 'category', 'link')
add_to_settings... | agpl-3.0 | Python |
d4d69ed62cbd726c92de9382136175e0fbdbb8af | Remove super-stale file paths | andre-senna/opencog,andre-senna/opencog,andre-senna/opencog,AmeBel/opencog,AmeBel/opencog,andre-senna/opencog,AmeBel/opencog,AmeBel/opencog,AmeBel/opencog,andre-senna/opencog,AmeBel/opencog,andre-senna/opencog,andre-senna/opencog,AmeBel/opencog | opencog/nlp/anaphora/agents/testingAgent.py | opencog/nlp/anaphora/agents/testingAgent.py |
from __future__ import print_function
from pprint import pprint
# from pln.examples.deduction import deduction_agent
from opencog.atomspace import types, AtomSpace, TruthValue
from agents.hobbs import HobbsAgent
from agents.dumpAgent import dumpAgent
from opencog.scheme_wrapper import load_scm,scheme_eval_h, scheme_ev... |
from __future__ import print_function
from pprint import pprint
# from pln.examples.deduction import deduction_agent
from opencog.atomspace import types, AtomSpace, TruthValue
from agents.hobbs import HobbsAgent
from agents.dumpAgent import dumpAgent
from opencog.scheme_wrapper import load_scm,scheme_eval_h, scheme_ev... | agpl-3.0 | Python |
f585a7cdf4ecbecfe240873a3b4b8e7d4376e69c | Move fallback URL pattern to the end of the list so it gets matched last. | fladi/django-campus02,fladi/django-campus02 | campus02/urls.py | campus02/urls.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views.static import serve
urlpatterns = [
url(r'^', include('django.contrib.auth.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^web/... | #!/usr/bin/python
# -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views.static import serve
urlpatterns = [
url(r'^', include('django.contrib.auth.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^web/... | mit | Python |
c05a93d8993e14fc8521dd01a13a930e85fcb882 | fix code style in `test_db_util` (#9594) | DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core | datadog_checks_base/tests/test_db_util.py | datadog_checks_base/tests/test_db_util.py | # -*- coding: utf-8 -*-
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import time
from datadog_checks.base.utils.db.utils import ConstantRateLimiter, RateLimitingTTLCache
def test_constant_rate_limiter():
rate_limit = 8
test_duration_s = 0.... | # -*- coding: utf-8 -*-
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import math
import time
from datadog_checks.base.utils.db.utils import RateLimitingTTLCache, ConstantRateLimiter
def test_constant_rate_limiter():
rate_limit = 8
test_dur... | bsd-3-clause | Python |
a9a9b60d9994bc4780e74ddd01df833a85247b95 | Change state serialiser to pass hex color values. | SuddenDevs/SuddenDev,SuddenDevs/SuddenDev,SuddenDevs/SuddenDev,SuddenDevs/SuddenDev | suddendev/game/state_encoder.py | suddendev/game/state_encoder.py | #!/usr/bin/python3
import json
def encodeState(game):
return json.dumps(game, cls=StateEncoder)
def clamp(x):
return max(0, min(x, 255))
class StateEncoder(json.JSONEncoder):
def default(self, o):
return self.serializeState(o)
def serializeState(self, state):
return {
... | #!/usr/bin/python3
import json
def encodeState(game):
return json.dumps(game, cls=StateEncoder)
class StateEncoder(json.JSONEncoder):
def default(self, o):
return self.serializeState(o)
def serializeState(self, state):
return {
'players': self.serializePlayers(state.play... | mit | Python |
3e5c500eed84ca24ffc31e802e061833a5a43225 | use unicode names in test | suvitorg/suvit-odoo,suvitorg/suvit-odoo | suvit_system/tests/test_node.py | suvit_system/tests/test_node.py | # -*- coding: utf-8 -*-
from openerp.tests.common import TransactionCase
class TestNode(TransactionCase):
def test_node_crud(self):
Node = self.env['suvit.system.node']
root = Node.create({'name': u'Root1'})
ch1 = Node.create({'name': u'Ch1', 'parent_id': root.id})
ch2 = Node.cre... | # -*- coding: utf-8 -*-
from openerp.tests.common import TransactionCase
class TestNode(TransactionCase):
def test_node_crud(self):
Node = self.env['suvit.system.node']
root = Node.create({'name': 'Root1'})
ch1 = Node.create({'name': 'Ch1', 'parent_id': root.id})
ch2 = Node.crea... | agpl-3.0 | Python |
c300e70bb65da3678f27c4ba01b22f9a3d4fc717 | Use spi_serial for tools | ps2/subg_rfspy,ps2/subg_rfspy,ps2/subg_rfspy | tools/serial_rf_spy.py | tools/serial_rf_spy.py | #!/usr/bin/env python
import os
import serial
import time
class SerialRfSpy:
CMD_GET_STATE = 1
CMD_GET_VERSION = 2
CMD_GET_PACKET = 3
CMD_SEND_PACKET = 4
CMD_SEND_AND_LISTEN = 5
CMD_UPDATE_REGISTER = 6
CMD_RESET = 7
def __init__(self, serial_port, rtscts=None):
if not rtscts:
rtscts = int(... | #!/usr/bin/env python
import os
import serial
import time
class SerialRfSpy:
CMD_GET_STATE = 1
CMD_GET_VERSION = 2
CMD_GET_PACKET = 3
CMD_SEND_PACKET = 4
CMD_SEND_AND_LISTEN = 5
CMD_UPDATE_REGISTER = 6
CMD_RESET = 7
def __init__(self, serial_port, rtscts=None):
if not rtscts:
rtscts = int(... | mit | Python |
73029223f54dc6c793c190e70a135d0bd3faa50b | Update download script | syllog1sm/TextBlob,syllog1sm/TextBlob,adelq/TextBlob,Windy-Ground/TextBlob,IrisSteenhout/TextBlob,freakynit/TextBlob,laugustyniak/TextBlob,sargam111/python,nvoron23/TextBlob,jonmcoe/TextBlob,beni55/TextBlob,jcalbert/TextBlob,syllog1sm/TextBlob,sloria/TextBlob,dipeshtech/TextBlob | download_corpora.py | download_corpora.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Downloads the necessary NLTK models and corpora.'''
from text.packages import nltk
REQUIRED_CORPORA = [
'brown',
'punkt',
'conll2000',
'maxent_treebank_pos_tagger',
]
def main():
for each in REQUIRED_CORPORA:
print(('Downloading "{0}"'.forma... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Downloads the necessary NLTK models and corpora.'''
from nltk import download
REQUIRED_CORPORA = [
'brown',
'punkt',
'conll2000',
'maxent_treebank_pos_tagger',
]
def main():
for each in REQUIRED_CORPORA:
print(('Downloading "{0}"'.format(eac... | mit | Python |
02490615e82be65520a8d608cff467dcf1bd7b96 | add picture commands help messages | MagiChau/ZonBot | extensions/picture/picture.py | extensions/picture/picture.py | from discord.ext import commands
import discord
import os
class Picture():
def __init__(self, bot):
self.bot = bot
@commands.command(help="Awoo!")
async def awoo(self):
fp = os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/awoo.jpg')
with open(fp, 'rb') as f:
... | from discord.ext import commands
import discord
import os
class Picture():
def __init__(self, bot):
self.bot = bot
@commands.command()
async def awoo(self):
fp = os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/awoo.jpg')
with open(fp, 'rb') as f:
try:
... | mit | Python |
6148e7cccc50023955ef7c3d86709c5197ae78e7 | Make output more understandable | Rohde-Schwarz-Cybersecurity/botan,webmaster128/botan,webmaster128/botan,randombit/botan,webmaster128/botan,Rohde-Schwarz-Cybersecurity/botan,Rohde-Schwarz-Cybersecurity/botan,randombit/botan,randombit/botan,Rohde-Schwarz-Cybersecurity/botan,Rohde-Schwarz-Cybersecurity/botan,randombit/botan,webmaster128/botan,Rohde-Schw... | doc/python/cryptobox.py | doc/python/cryptobox.py | #!/usr/bin/python
import sys
import botan
def main(args = None):
if args is None:
args = sys.argv
if len(args) != 3:
raise Exception("Usage: <password> <input>");
password = args[1]
input = ''.join(open(args[2]).readlines())
rng = botan.RandomNumberGenerator()
ciphertext = ... | #!/usr/bin/python
import sys
import botan
def main(args = None):
if args is None:
args = sys.argv
if len(args) != 3:
raise Exception("Bad usage")
password = args[1]
input = ''.join(open(args[2]).readlines())
rng = botan.RandomNumberGenerator()
ciphertext = botan.cryptobox_e... | bsd-2-clause | Python |
a2a26ed8b216c4a40db7a384571d05c690e25cef | Update test expectation | JasonGross/coq-tools,JasonGross/coq-tools | examples/run-example-8.py | examples/run-example-8.py | #!/usr/bin/python
import os, sys, inspect
DIR = os.path.dirname(os.path.realpath(__file__))
NORM_EXPECT='Require Coq.omega.Omega.\nRequire Top.A.\nRequire Top.B.\nRequire Top.C.\nRequire Top.D.\n\nImport Top.D.\n\nFail Check A.mA.axA.\n'
GET_EXPECT = {
'Coq.omega.Omega': None,
'Top.A': 'Module Export Top_DOT... | #!/usr/bin/python
import os, sys, inspect
DIR = os.path.dirname(os.path.realpath(__file__))
NORM_EXPECT='Require Coq.omega.Omega.\nRequire Top.A.\nRequire Top.B.\nRequire Top.C.\nRequire Top.D.\n\nImport Top.D.\n'
GET_EXPECT = {
'Coq.omega.Omega': None,
'Top.A': 'Module Export Top_DOT_A.\nModule Export Top.\... | mit | Python |
0dcad3ac5f3754fedf12c7aca7050ec6ab85840d | fix merge cleaning | texttochange/vusion-backend,texttochange/vusion-backend,texttochange/vusion-backend | transports/__init__.py | transports/__init__.py | from yo_ug_http import YoUgHttpTransport
from cm_nl_yo_ug_http import CmYoTransport
from cm_nl_http import CmTransport
from push_tz_yo_ug_http import PushYoTransport
from push_tz_http import PushTransport
from push_tz_smpp import PushTzSmppTransport
from mobivate_http import MobivateHttpTransport
from movilgate_http im... | from yo_ug_http import YoUgHttpTransport
from cm_nl_yo_ug_http import CmYoTransport
from cm_nl_http import CmTransport
from push_tz_yo_ug_http import PushYoTransport
from push_tz_http import PushTransport
from push_tz_smpp import PushTzSmppTransport
from mobivate_http import MobivateHttpTransport
from movilgate_http im... | bsd-3-clause | Python |
f66cee94d2ae4ba12cc8d56c40be0d2e07f69a5a | Tag 0.0.2 | SwingTix/bookkeeper,g--/bookkeeper-dev,omarkhan/bookkeeper | swingtix/bookkeeper/__init__.py | swingtix/bookkeeper/__init__.py | __VERSION__='0.0.1.1-29-gdc751f0M'
| __VERSION__='0.0.1.1'
| agpl-3.0 | Python |
101dae4f5a12605a791b0f81fb2ff599cbf2facb | Return early | darkfeline/mir.dlsite,darkfeline/mir.dlsite | mir/dlsite/cmd/dlorg.py | mir/dlsite/cmd/dlorg.py | # Copyright (C) 2016, 2017 Allen Li
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | # Copyright (C) 2016, 2017 Allen Li
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | apache-2.0 | Python |
6035ef056f6ca028828faad68a0a0954e581300e | Set L=4 to try other topology | jacobq/csci5221-viro-project,jacobq/csci5221-viro-project,jacobq/csci5221-viro-project,jacobq/csci5221-viro-project,jacobq/csci5221-viro-project | ext/viro_constant.py | ext/viro_constant.py | # Manually set L
L = 4
# OPERATIONS
VIRO_DATA_OP = 0x0000
VIRO_DATA = 0x0802
VIRO_CONTROL = 0x0803
RDV_PUBLISH = 0x1000
RDV_QUERY = 0x2000
RDV_REPLY = 0x3000
DISCOVERY_ECHO_REQUEST = 0x4000
DISCOVERY_ECHO_REPLY = 0x5000
GW_WITHDRAW = ... | # Manually set L
L = 3
# OPERATIONS
VIRO_DATA_OP = 0x0000
VIRO_DATA = 0x0802
VIRO_CONTROL = 0x0803
RDV_PUBLISH = 0x1000
RDV_QUERY = 0x2000
RDV_REPLY = 0x3000
DISCOVERY_ECHO_REQUEST = 0x4000
DISCOVERY_ECHO_REPLY = 0x5000
GW_WITHDRAW = ... | apache-2.0 | Python |
fd1a6abb003832919eea99fce05e06188889527c | Change the urls import line. Fix #6 | AdrianRibao/cerberos,AdrianRibao/cerberos | cerberos/urls.py | cerberos/urls.py | # -*- coding: utf-8 -*-
from django.conf.urls import *
from cerberos.views import *
urlpatterns = patterns('',
)
| # -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from cerberos.views import *
urlpatterns = patterns('',
)
| bsd-3-clause | Python |
bdcdeaea6eb760d91690439da43d72ef0673df48 | change replace statement | nprapps/elections14,nprapps/elections14,nprapps/elections14,nprapps/elections14 | fabfile/instagram.py | fabfile/instagram.py | #!/usr/bin/env python
import csv
import json
from fabric.api import task
import requests
FIELDNAMES = ['date', 'username', 'caption', 'instagram_url', 'image', 'image_url', 'embed_code', 'approved']
class Photo(object):
def __init__(self, **kwargs):
for field in FIELDNAMES:
if kwargs[field]... | #!/usr/bin/env python
import csv
import json
from fabric.api import task
import requests
FIELDNAMES = ['date', 'username', 'caption', 'instagram_url', 'image', 'image_url', 'embed_code', 'approved']
class Photo(object):
def __init__(self, **kwargs):
for field in FIELDNAMES:
if kwargs[field]... | mit | Python |
54282a1b7c2ea707506078483cf806e9521f264c | update version number | theno/fabsetup,theno/fabsetup | fabsetup/_version.py | fabsetup/_version.py | __version__ = "0.7.7"
| __version__ = "0.7.6"
| mit | Python |
a0ac28b8d55654e6da02b96cb7c85270a3267f3d | Add links for development_status and maintainers keys | OCA/maintainer-tools,Yajo/maintainer-tools,acsone/maintainers-tools,Yajo/maintainer-tools,acsone/maintainer-tools,acsone/maintainers-tools,acsone/maintainer-tools,OCA/maintainer-tools,OCA/maintainer-tools,acsone/maintainers-tools,Yajo/maintainer-tools,OCA/maintainer-tools,Yajo/maintainer-tools,acsone/maintainer-tools,a... | template/module/__manifest__.py | template/module/__manifest__.py | # -*- coding: utf-8 -*-
# Copyright <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Module name",
"summary": "Module summary",
"version": "11.0.1.0.0",
# see https://odoo-community.org/page/development-status
"development_status": "Alpha|Beta|Product... | # -*- coding: utf-8 -*-
# Copyright <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Module name",
"summary": "Module summary",
"version": "11.0.1.0.0",
"development_status": "Alpha|Beta|Production/Stable|Mature",
"category": "Uncategorized",
"web... | agpl-3.0 | Python |
d45a0d97b978c18bb0a40e4cec6d3dab6ec2d566 | fix loading crystal.json | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | test/command_line/tst_refine.py | test/command_line/tst_refine.py | #!/usr/bin/env cctbx.python
#
# Copyright (C) (2013) STFC Rutherford Appleton Laboratory, UK.
#
# Author: David Waterman.
#
# This code is distributed under the BSD license, a copy of which is
# included in the root directory of this package.
#
"""
Test command line program dials.refine by running a job with save... | #!/usr/bin/env cctbx.python
#
# Copyright (C) (2013) STFC Rutherford Appleton Laboratory, UK.
#
# Author: David Waterman.
#
# This code is distributed under the BSD license, a copy of which is
# included in the root directory of this package.
#
"""
Test command line program dials.refine by running a job with save... | bsd-3-clause | Python |
e318497949a340b3b821efbc4492c8605441fa47 | reformat code | dusktreader/flask-praetorian,dusktreader/flask-praetorian | flask_praetorian/constants.py | flask_praetorian/constants.py | import pendulum
import enum
from os.path import dirname, abspath
DEFAULT_JWT_PLACES = ['header', 'cookie']
DEFAULT_JWT_COOKIE_NAME = 'access_token'
DEFAULT_JWT_HEADER_NAME = 'Authorization'
DEFAULT_JWT_HEADER_TYPE = 'Bearer'
DEFAULT_JWT_ACCESS_LIFESPAN = pendulum.duration(minutes=15)
DEFAULT_JWT_REFRESH_LIFESPAN = pe... | import pendulum
import enum
from os.path import dirname, abspath
DEFAULT_JWT_PLACES = [
'header', 'cookie'
]
DEFAULT_JWT_COOKIE_NAME = 'access_token'
DEFAULT_JWT_HEADER_NAME = 'Authorization'
DEFAULT_JWT_HEADER_TYPE = 'Bearer'
DEFAULT_JWT_ACCESS_LIFESPAN = pendulum.duration(minutes=15)
DEFAULT_JWT_REFRESH_LIFESPA... | mit | Python |
3109bd9a1d01e926e4fce3373db93db8a2d091e0 | Update 4.8_subtree.py | HeyIamJames/CodingInterviewPractice,HeyIamJames/CodingInterviewPractice | CrackingCodingInterview/4.8_subtree.py | CrackingCodingInterview/4.8_subtree.py | """
is a a subtree of b
both are bst
"""
class Node:
02
...
03
def compare_trees(self, node):
04
"""
05
Compare 2 trees
06
07
@param node tree's root node to compare to
08
@returns True if the tree passed is identical to this tree
09
"""
def compare_trees(self... | """
is a a subtree of b
both are bst
"""
| mit | Python |
42cefe67849fd97c52210ba750077238d938fe6a | Fix TZ issue in order_by_score | skybluejamie/wikipeace,skybluejamie/wikipeace,stephenmcd/drum,stephenmcd/drum | drum/links/utils.py | drum/links/utils.py | from __future__ import division, unicode_literals
from re import sub, split
from django.conf import settings
from django.utils.timezone import now
def order_by_score(queryset, score_fields, date_field, reverse=True):
"""
Take some queryset (links or comments) and order them by score,
which is basically ... | from __future__ import division, unicode_literals
from re import sub, split
from django.conf import settings
from django.utils.timezone import now
def order_by_score(queryset, score_fields, date_field, reverse=True):
"""
Take some queryset (links or comments) and order them by score,
which is basically ... | bsd-2-clause | Python |
a38f2690ddcc72d24ab152b0c4c21ae51db7afa0 | Update evaluate_task.py | google/BIG-bench,google/BIG-bench | docker/evaluate_task.py | docker/evaluate_task.py | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | apache-2.0 | Python |
10a510dc3234860c697945c8c37393a9b5790b6c | Update lims.py | Clinical-Genomics/access | access/lims.py | access/lims.py | #!/usr/bin/python
#Script that connects to the MySQL database and parses data from an html table
#Import the mysql.connector library/module
import sys
import time
import glob
import re
import os
import requests
from xml.etree import ElementTree
def readconfig():
configfile = os.getenv('HOME') + '/.scilifelabrc'
pa... | #!/usr/bin/python
#Script that connects to the MySQL database and parses data from an html table
#Import the mysql.connector library/module
import sys
import time
import glob
import re
import os
import requests
from xml.etree import ElementTree
def readconfig():
configfile = os.getenv('HOME') + '/.scilifelabrc'
pa... | mit | Python |
c2c21fabd144ec25fa46fefdfe7c460a39aa2454 | Update lims.py | Clinical-Genomics/access | access/lims.py | access/lims.py | #!/usr/bin/python
#Script that connects to the MySQL database and parses data from an html table
#Import the mysql.connector library/module
import sys
import time
import glob
import re
import os
import requests
from xml.etree import ElementTree
def readconfig():
configfile = os.getenv('HOME') + '/.scilifelabrc'
pa... | #!/usr/bin/python
#Script that connects to the MySQL database and parses data from an html table
#Import the mysql.connector library/module
import sys
import time
import glob
import re
import os
import requests
from xml.etree import ElementTree
def readconfig():
configfile = os.getenv('HOME') + '/.scilifelabrc'
pa... | mit | Python |
17157a4eb9d4aa934da89892f4f42f851902b44c | fix missing return in celery SiteRouter :rage1: | mbauskar/tele-frappe,mbauskar/Das_frappe,reachalpineswift/frappe-bench,gangadharkadam/letzfrappe,MaxMorais/frappe,saurabh6790/test-frappe,manassolanki/frappe,ESS-LLP/frappe,rohitwaghchaure/vestasi-frappe,nerevu/frappe,vCentre/vFRP-6233,rohitwaghchaure/New_Theme_frappe,gangadharkadam/vervefrappe,gangadharkadam/office_fr... | frappe/celery_app.py | frappe/celery_app.py | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals, absolute_import
from celery import Celery
# initiate logger
from celery.utils.log import get_task_logger
task_logger = get_task_logger(__name__)
from datetime import timedel... | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals, absolute_import
from celery import Celery
# initiate logger
from celery.utils.log import get_task_logger
task_logger = get_task_logger(__name__)
from datetime import timedel... | mit | Python |
619b51a579801b8ae211cb062b00149c19af11a7 | Make manage task more general | amyshi188/osf.io,RomanZWang/osf.io,acshi/osf.io,alexschiller/osf.io,hmoco/osf.io,TomHeatwole/osf.io,mluo613/osf.io,felliott/osf.io,chrisseto/osf.io,kwierman/osf.io,aaxelb/osf.io,Johnetordoff/osf.io,chrisseto/osf.io,KAsante95/osf.io,abought/osf.io,mattclark/osf.io,emetsger/osf.io,CenterForOpenScience/osf.io,TomHeatwole/... | admin/tasks.py | admin/tasks.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
from invoke import task, run
from tasks.utils import pip_install
from website import settings
HERE = os.path.dirname(os.path.abspath(__file__))
WHEELHOUSE_PATH = os.environ.get('WHEELHOUSE')
@task()
def manage(cmd_str):
"""Take command st... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
from invoke import task, run
from tasks.utils import pip_install
from website import settings
HERE = os.path.dirname(os.path.abspath(__file__))
WHEELHOUSE_PATH = os.environ.get('WHEELHOUSE')
@task()
def manage(cmd_str, target=''):
"""Take... | apache-2.0 | Python |
50a2ac8e5aeee2c4435707a72c22092e28ecf5ba | Update zeromq_server.py | bcb/jsonrpcserver | examples/zeromq_server.py | examples/zeromq_server.py | from jsonrpcserver import Success, method, dispatch
import zmq
socket = zmq.Context().socket(zmq.REP)
@method
def ping():
return Success("pong")
if __name__ == "__main__":
socket.bind("tcp://*:5000")
while True:
request = socket.recv().decode()
socket.send_string(dispatch(request))
| import zmq
from jsonrpcserver import Success, method, dispatch
socket = zmq.Context().socket(zmq.REP)
@method
def ping():
return Success("pong")
if __name__ == "__main__":
socket.bind("tcp://*:5000")
while True:
request = socket.recv().decode()
socket.send_string(dispatch(request))
| mit | Python |
709e9dddf94e8afa43d908e92f7c7d6bc0817e46 | remove commented line | bappelt/WeatherPi | humid_temp.py | humid_temp.py | import weather_utils
import Adafruit_DHT
def get_data():
humidity, temp_c = Adafruit_DHT.read_retry(Adafruit_DHT.AM2302, 4)
temp_f = weather_utils.c_to_f(temp_c)
return { 'temp_f': temp_f,
'temp_c': temp_c,
'humidity': humidity,
'dewptf': weather_utils.dewpoint_f(temp_f, humi... | # import Adafruit_Python_DHT
import weather_utils
import Adafruit_DHT
def get_data():
humidity, temp_c = Adafruit_DHT.read_retry(Adafruit_DHT.AM2302, 4)
temp_f = weather_utils.c_to_f(temp_c)
return { 'temp_f': temp_f,
'temp_c': temp_c,
'humidity': humidity,
'dewptf': weather_... | mit | Python |
6a415f0c0be752bd1a7677fd45d5738a1caf2ece | Sort accounts by name | mikeboers/Spoon,mikeboers/Spoon,mikeboers/Spoon,mikeboers/Spoon | gitbase/controllers/index.py | gitbase/controllers/index.py | from . import *
@app.route('/')
def index():
groups = Account.query.options(sa.orm.joinedload('repos')).all()
groups = [g for g in groups if auth.can('account.read', g)]
groups.sort(key=lambda g: g.name)
return render_template('index.haml', groups=groups)
| from . import *
@app.route('/')
def index():
groups = Account.query.options(sa.orm.joinedload('repos')).all()
groups = [g for g in groups if auth.can('account.read', g)]
return render_template('index.haml', groups=groups)
| bsd-3-clause | Python |
5a0c6904c23a84d1ee931e3ef82f297197141222 | add twitter and flags | davidbradway/beaglebone-python | light.py | light.py | #!/usr/bin/python
"""
light.py
Read analog values from the photoresistor
=======
run with:
sudo ./light.py
Copyright 2014 David P. Bradway (dpb6@duke.edu)
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... | #!/usr/bin/python
"""
light.py
Read analog values from the photoresistor
=======
run with:
sudo ./light.py
Copyright 2014 David P. Bradway (dpb6@duke.edu)
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... | apache-2.0 | Python |
e6b3a02376f832ee1bf79905ececfc76933197fc | Fix client | jvictor0/TiaraBoom,jvictor0/TiaraBoom,jvictor0/TiaraBoom | client/client.py | client/client.py | import socket
import os
import json
import time
class Client():
def __init__(self):
abs_prefix = os.path.join(os.path.dirname(__file__), "../client")
with open(abs_prefix + '/config.json','r') as f:
conf = json.load(f)
self.port = conf["port"]
self.host = conf["h... | import socket
import os
import json
import time
class Client():
def __init__(self):
abs_prefix = os.path.join(os.path.dirname(__file__), "../data")
with open(abs_prefix + '/config.json','r') as f:
conf = json.load(f)
self.port = conf["port"]
self.host = conf["hos... | mit | Python |
d4d4a065323d61073eb80a4f7f04d2902a33e4fe | fix ntb publish service get_filename for events | petrjasek/superdesk-ntb,ioanpocol/superdesk-ntb,petrjasek/superdesk-ntb,superdesk/superdesk-ntb,ioanpocol/superdesk-ntb,superdesk/superdesk-ntb,superdesk/superdesk-ntb,petrjasek/superdesk-ntb,ioanpocol/superdesk-ntb,petrjasek/superdesk-ntb,superdesk/superdesk-ntb | server/ntb/publish/ntb_publish_service.py | server/ntb/publish/ntb_publish_service.py | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2016 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from superde... | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2016 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from superde... | agpl-3.0 | Python |
936e6427c48ebbf16a12fb3afa0f48ad6c397046 | fix feature input to hb-view | googlefonts/fontdiffenator,googlefonts/fontdiffenator | Lib/diffenator/utils.py | Lib/diffenator/utils.py | import subprocess
from PIL import Image
from fontTools.varLib.mutator import instantiateVariableFont
try:
from StringIO import StringIO
except ImportError: # py3 workaround
from io import BytesIO as StringIO
def render_string(font, string, features=None, pt_size=128):
"""Use Harfbuzz to render a string""... | import subprocess
from PIL import Image
from fontTools.varLib.mutator import instantiateVariableFont
try:
from StringIO import StringIO
except ImportError: # py3 workaround
from io import BytesIO as StringIO
def render_string(font, string, features=None, pt_size=128):
"""Use Harfbuzz to render a string""... | apache-2.0 | Python |
7bce0c3e1c2cc0ca8f37916ad88abd0f91ba2c38 | Update Keras.py | paperrune/Neural-Networks,paperrune/Neural-Networks | tanh/Keras.py | tanh/Keras.py | from keras.datasets import mnist
from keras.initializers import RandomUniform
from keras.layers import Dense
from keras.models import Sequential
from keras.optimizers import SGD
from keras.utils import to_categorical
batch_size = 128
epochs = 30
learning_rate = 0.5
(x_train, y_train), (x_test, y_test) = mn... | from keras.datasets import mnist
from keras.initializers import RandomUniform
from keras.layers import Dense
from keras.models import Sequential
from keras.optimizers import SGD
from keras.utils import to_categorical
batch_size = 128
epochs = 30
learning_rate = 0.5
(x_train, y_train), (x_test, y_test) = mn... | mit | Python |
4063d94b405a41ead8d5c3df5a1d27dd1dba140f | remove config for warmup | MiCHiLU/gae-tap,MiCHiLU/gae-tap,MiCHiLU/gae-tap,MiCHiLU/gae-tap | gae/tap/warmup.py | gae/tap/warmup.py | # -*- coding: utf-8 -*-
from functools import wraps
import os
import sys
import webapp2
# Search Path
def execute_once(func):
@wraps(func)
def inner(_result=[None], *argv, **kwargv):
if _result[0] is None:
_result[0] = func(*argv, **kwargv)
if _result[0] is None:
raise ValueError("The ... | # -*- coding: utf-8 -*-
from functools import wraps
import os
import sys
from google.appengine.api import lib_config
import webapp2
# Config
class ConfigDefaults(object):
IS_TEST = "unittest" in sys.modules.keys()
SITE_PACKAGES = "site-packages"
config = lib_config.register("warmup", ConfigDefaults.__dict__)
... | mit | Python |
5f663eb971542d252186dbf9345ca458dca93c16 | fix file not exist during render file | faycheng/tpl,faycheng/tpl | tpl/tpl.py | tpl/tpl.py | # -*- coding:utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import jinja2
from tpl import path
from tpl import errors
class Template(object):
IGNORE_FILES = [
'construct.sh',
'construct.py'
]
def __init__(self, tpl_dir):
... | # -*- coding:utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import jinja2
from tpl import path
from tpl import errors
class Template(object):
IGNORE_FILES = [
'construct.sh',
'construct.py'
]
def __init__(self, tpl_dir):
... | mit | Python |
7b385ca9897ab8a7b25966cc54324a4b42596f7d | fix case of no saved lists or items | jschriesheim/manage-lists | lists.py | lists.py | # manage list functions
import os
import redis
import json
r = redis.from_url(os.environ.get("REDIS_URL"))
def getLists():
savedLists = r.get('lists')
if savedLists == None:
lists = []
else:
lists = json.loads(savedLists)
savedItems = r.get('items')
if savedItems == None:
i... | # manage list functions
import os
import redis
import json
r = redis.from_url(os.environ.get("REDIS_URL"))
def getLists():
lists = []
items = []
lists = json.loads(r.get('lists'))
items = json.loads(r.get('items'))
return True
def putLists()
r.put('lists', json.dumps(lists))
r.pub('items'... | apache-2.0 | Python |
2a08d3154992b5f0633d7cd2ca1bbfc7ecd63f69 | Fix to allow version number to be imported without dependencies being installed. | dreipol/django-email-extras,blag/django-email-extras,stephenmcd/django-email-extras,blag/django-email-extras,dreipol/django-email-extras,stephenmcd/django-email-extras | email_extras/__init__.py | email_extras/__init__.py |
from email_extras.settings import USE_GNUPG
__version__ = "0.1.0"
if USE_GNUPG:
try:
import gnupg
except ImportError:
try:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured, "Could not import gnupg"
except ImportError:
... |
from django.core.exceptions import ImproperlyConfigured
from email_extras.settings import USE_GNUPG
__version__ = "0.1.0"
if USE_GNUPG:
try:
import gnupg
except ImportError:
raise ImproperlyConfigured, "Could not import gnupg"
| bsd-2-clause | Python |
b39518482da1d3e064cdbc34490e4a9924f6d5f1 | Add a test for vectorized call | oyamad/QuantEcon.py,QuantEcon/QuantEcon.py,oyamad/QuantEcon.py,QuantEcon/QuantEcon.py | quantecon/tests/test_ecdf.py | quantecon/tests/test_ecdf.py | """
Tests for ecdf.py
"""
import unittest
import numpy as np
from quantecon import ECDF
class TestECDF(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.obs = np.random.rand(40) # observations defining dist
cls.ecdf = ECDF(cls.obs)
def test_call_high(self):
"ecdf: x abo... | """
Tests for ecdf.py
"""
import unittest
import numpy as np
from quantecon import ECDF
class TestECDF(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.obs = np.random.rand(40) # observations defining dist
cls.ecdf = ECDF(cls.obs)
def test_call_high(self):
"ecdf: x abo... | bsd-3-clause | Python |
e36192babd239366d51d1ea7cdfab94c06791fe7 | Test assertElementPresents return function | XeryusTC/projman,XeryusTC/projman,XeryusTC/projman | functional_tests/test_base.py | functional_tests/test_base.py | # -*- coding: utf-8 -*-
from .base import FunctionalTestCase
import unittest
from unittest import mock
class TestBaseFuctionalTest(unittest.TestCase):
def test_assertelementpresent_can_find_string(self):
e = [mock.Mock(text='test')]
ft = FunctionalTestCase()
ft.assertElementPresent(e, 'tes... | # -*- coding: utf-8 -*-
from .base import FunctionalTestCase
import unittest
from unittest import mock
class TestBaseFuctionalTest(unittest.TestCase):
def test_assertelementpresent_can_find_string(self):
e = [mock.Mock(text='test')]
ft = FunctionalTestCase()
ft.assertElementPresent(e, 'tes... | mit | Python |
472c22a83e9e3982e5b6705757f79fba3b32f3e6 | Set path dependency with context to development and deployment | chuckbutler/DNS-Charm,thomnico/DNS-Charm,chuckbutler/DNS-Charm,thomnico/DNS-Charm | hooks/common.py | hooks/common.py | import os
import sys
import urllib2
# Add charmhelpers to the system path.
try:
sys.path.insert(0, os.path.abspath(os.path.join(os.environ['CHARM_DIR'],
'lib')))
except:
sys.path.insert(0, os.path.abspath(os.path.join('..', 'lib')))
from charmhelpers.core.h... | import os
import sys
import urllib2
# Add charmhelpers to the system path.
sys.path.insert(0, os.path.abspath(os.path.join('..', 'lib')))
from charmhelpers.core.hookenv import (
log,
config,
)
from charmhelpers.core.host import (
mkdir,
)
from charmhelpers.fetch import (
apt_install,
apt_update,
... | mit | Python |
a2b6cef1fc6dee679407d61312a23f96c3e99cda | Use a plain list of url instances for the tests urls too | JensTimmerman/django-oauth-toolkit,StepicOrg/django-oauth-toolkit,bleib1dj/django-oauth-toolkit,bleib1dj/django-oauth-toolkit,DeskConnect/django-oauth-toolkit,DeskConnect/django-oauth-toolkit,StepicOrg/django-oauth-toolkit,JensTimmerman/django-oauth-toolkit | oauth2_provider/tests/urls.py | oauth2_provider/tests/urls.py | from django.conf.urls import include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = (
url(r'^admin/', include(admin.site.urls)),
url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
)
| from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
)
| bsd-2-clause | Python |
aaf243646eccebea2e1d764d7de58c40c279830c | test info | onlysheep5200/NetnsEx,onlysheep5200/NetnsEx | hostend/main.py | hostend/main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
sys.path.append('..')
from tornado.web import Application
import tornado.ioloop
import tornado.options
import tornado.httpserver
import tornado.autoreload
from tornado.options import define, options
from hostend.controller... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
sys.path.append('..')
from tornado.web import Application
import tornado.ioloop
import tornado.options
import tornado.httpserver
import tornado.autoreload
from tornado.options import define, options
from hostend.controller... | apache-2.0 | Python |
0fbfef27d35cea23ad0e20fd2c9df3e8a4a046cb | Fix GCF region tags (#1827) | GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples | functions/log/main.py | functions/log/main.py | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 | Python |
8d56c42dd3a721a477fa1333c1d979f4002e7cc1 | Simplify importer paths after dockerization | StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite | labonneboite/importer/conf/lbbdev.py | labonneboite/importer/conf/lbbdev.py | import os
# --- importer input directory of DPAE and ETABLISSEMENT exports
INPUT_SOURCE_FOLDER = '/srv/lbb/data'
# --- job 1/8 & 2/8 : check_etablissements & extract_etablissements
JENKINS_ETAB_PROPERTIES_FILENAME = os.path.join(os.environ["WORKSPACE"], "properties.jenkins")
MINIMUM_OFFICES_TO_BE_EXTRACTED_PER_DEPART... | import os
# --- importer input directory of DPAE and ETABLISSEMENT exports
INPUT_SOURCE_FOLDER = '/srv/lbb/data'
# --- job 1/8 & 2/8 : check_etablissements & extract_etablissements
JENKINS_ETAB_PROPERTIES_FILENAME = os.path.join(os.environ["WORKSPACE"], "properties.jenkins")
MINIMUM_OFFICES_TO_BE_EXTRACTED_PER_DEPART... | agpl-3.0 | Python |
f1c270f2145cf1f48a0207696cb4f6e9592af357 | Correct db `NAME`, use in-memory database for testing | henryyang42/NTHU_Course,henryyang42/NTHU_Course,henryyang42/NTHU_Course,henryyang42/NTHU_Course | NTHU_Course/settings/testing_sqlite.py | NTHU_Course/settings/testing_sqlite.py | '''
A configuration for testing in travis CI with sqlite3
'''
from .default import * # noqa
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
# https://docs.djangoproject.com/en/1.10/topics/testing/overview/#the-test-database
# django uses in memory database for testing
... | '''
A configuration for testing in travis CI with sqlite3
'''
from .default import * # noqa
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
# https://docs.djangoproject.com/en/1.10/topics/testing/overview/#the-test-database
# django uses in memory database for testing
... | mit | Python |
34f3d762f608c3ea3fd12cded38dc3853d36545f | Update vouchers.py | fabianm/olympiad,fabianm/olympiad,fabianm/olympiad | 2014-2015/B4-vouchers/vouchers.py | 2014-2015/B4-vouchers/vouchers.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2014 Fabian M.
#
# 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... | vouchers = [1, 2, 3, 5, 8, 9, 18, 19, 46, 154, 313]
def main():
for b in range(1, max(vouchers)):
# Amount can be created with one voucher.
if b in vouchers:
continue
bins = []
ws = sorted(vouchers, reverse=True)
for w in ws:
for x in bins:
if sum(x) + w <= b:
x.append(w)
w = None
b... | apache-2.0 | Python |
241376f76d4175c98c8226998832b8054697504c | Fix xpath expression for tomorrows forecast | mpolden/jarvis2,mpolden/jarvis2,mpolden/jarvis2,Foxboron/Frank,Foxboron/Frank,martinp/jarvis2,martinp/jarvis2,martinp/jarvis2,Foxboron/Frank | app/jobs/yr.py | app/jobs/yr.py | #!/usr/bin/env python
import requests
from datetime import datetime, timedelta
from jobs import AbstractJob
from lxml import etree
class Yr(AbstractJob):
def __init__(self, conf):
self.url = conf['url']
self.interval = conf['interval']
def _parse_tree(self, tree, tabular_xpath=None):
... | #!/usr/bin/env python
import requests
from jobs import AbstractJob
from lxml import etree
class Yr(AbstractJob):
def __init__(self, conf):
self.url = conf['url']
self.interval = conf['interval']
def _parse_tree(self, tree, tabular_xpath=None):
if tabular_xpath is None:
t... | mit | Python |
b6b522bbdde24f0e6eab0e7a91830171bcac63a5 | Add logout url | abramconnelly/genevieve,PersonalGenomesOrg/archive-genevieve-201505,abramconnelly/genevieve,PersonalGenomesOrg/archive-genevieve-201505,PersonalGenomesOrg/archive-genevieve-201505 | genevieve/urls.py | genevieve/urls.py | from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth import views as auth_views
from .views import UserCreateView
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', in... | from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth import views as auth_views
from .views import UserCreateView
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', in... | mit | Python |
ba2161f6adf5a0e0782e322371d7071ca79d02e3 | Update tornado for mypy | brettcannon/gidgethub,brettcannon/gidgethub | gidgethub/tornado.py | gidgethub/tornado.py | from typing import Mapping, Optional, Tuple
from tornado import gen
from tornado import httpclient
from . import abc as gh_abc
class GitHubAPI(gh_abc.GitHubAPI):
async def _request(self, method: str, url: str, headers: Mapping[str, str],
body: bytes = b'') -> Tuple[int, Mapping[str, str]... | from typing import Mapping, Optional, Tuple
from tornado import gen
from tornado import httpclient
from . import abc as gh_abc
class GitHubAPI(gh_abc.GitHubAPI):
async def _request(self, method: str, url: str, headers: Mapping,
body: bytes = b'') -> Tuple[int, Mapping, bytes]:
""... | apache-2.0 | Python |
ad56d5aa6b2359098c4ed6bf9cd37cb58613a372 | Update github3.repos.tag for consistency | sigmavirus24/github3.py | github3/repos/tag.py | github3/repos/tag.py | # -*- coding: utf-8 -*-
"""This module contains the RepoTag object for GitHub's tag API."""
from __future__ import unicode_literals
from . import commit
from .. import models
class RepoTag(models.GitHubCore):
"""Representation of a tag made on a GitHub repository.
.. note::
This is distinct from :c... | # -*- coding: utf-8 -*-
"""
github3.repos.tag
=================
This module contains the RepoTag object for GitHub's tag API.
"""
from __future__ import unicode_literals
from ..models import GitHubCore
class RepoTag(GitHubCore):
"""The :class:`RepoTag <RepoTag>` object. This stores the information
represen... | bsd-3-clause | Python |
73f3c743139927a049c5e733f98e1fcb8125721a | Update release version | scolab-dot-eu/pygdaltools | gdaltools/metadata.py | gdaltools/metadata.py | # -*- coding: utf-8 -*-
"""Project metadata
Information describing the project.
"""
# The package name, which is also the "UNIX name" for the project.
package = 'pygdaltools'
project = 'pygdaltools'
project_no_spaces = project.replace(' ', '')
version = '0.3'
description = """Python wrapper for Gdal/OGR command line ... | # -*- coding: utf-8 -*-
"""Project metadata
Information describing the project.
"""
# The package name, which is also the "UNIX name" for the project.
package = 'pygdaltools'
project = 'pygdaltools'
project_no_spaces = project.replace(' ', '')
version = '0.2'
description = """Python wrapper for Gdal/OGR command line ... | agpl-3.0 | Python |
2c0dbf04f04b686cac79e40791c3ed298618dd07 | add more info on process | pdxosgeo/map-gallery-util | gen-gallery-images.py | gen-gallery-images.py | '''Generates small and medium gallery images from a set of large originals. Some maps will be tall, some wide, some square so we want to simply maintain the ratio and resize down to a set maximum.
Original images need to be downloaded to the large image path below. They are accessible in this Dropbox folder
https://... | '''Generates small and medium gallery images from a set of large originals. Some maps will be tall, some wide, some square so we want to simply maintain the ratio and resize down to a set maximum.
Original images need to be downloaded to the large path below. They are accessible in this Dropbox folder
https://www.dr... | mit | Python |
2fcca753e2877d21e158d5e4a3923e1d22e61608 | Add mask A to causal atrous conv1d (WIP) | israelg99/eva | eva/layers/causal_atrous_convolution1d.py | eva/layers/causal_atrous_convolution1d.py | import keras.backend as K
from keras.layers import AtrousConvolution1D
from keras.utils.np_utils import conv_output_length
class CausalAtrousConvolution1D(AtrousConvolution1D):
def __init__(self, *args, mask_type='B', **kwargs):
super().__init__(*args, **kwargs)
if self.border_mode != 'valid':
... | import keras.backend as K
from keras.layers import AtrousConvolution1D
from keras.utils.np_utils import conv_output_length
class CausalAtrousConvolution1D(AtrousConvolution1D):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.border_mode != 'valid':
raise V... | apache-2.0 | Python |
56de128ac7462a297505ec4b207d07c1af613c9b | connect annotations to api | varnish/zipnish,varnish/varnish-microservice-monitor,varnish/varnish-microservice-monitor,varnish/zipnish,varnish/zipnish,varnish/zipnish,varnish/varnish-microservice-monitor,varnish/varnish-microservice-monitor,varnish/zipnish,varnish/varnish-microservice-monitor | ui/app/api/__init__.py | ui/app/api/__init__.py | from flask import Blueprint
api = Blueprint('api', __name__)
#
# end-points to create
# query
from . import query
# services
from . import services
# spans
from . import spans
# annotations
from . import annotations
#
# traces
# services
# annotations
# dependencies
# pin
from . import pin
| from flask import Blueprint
api = Blueprint('api', __name__)
#
# end-points to create
# query
from . import query
# services
from . import services
# spans
from . import spans
#
# traces
# services
# annotations
# dependencies
# pin
from . import pin
| bsd-2-clause | Python |
c5b00edd9b8acbe594e43ecce093cd1c695b8b01 | Use user ID instead of username to get messages even with username changes | expectocode/telegram-analysis,expectocode/telegramAnalysis | getalltextfromuser.py | getalltextfromuser.py | #!/usr/bin/env python3
"""
A program to extract all text sent by a particular user from a Telegram chat log which is in json form
"""
import argparse
from json import loads
def main():
parser = argparse.ArgumentParser(
description="Extract raw text sent by a user from a json telegram chat log")
parser... | #!/usr/bin/env python3
"""
A program to extract all text sent by a particular user from a Telegram chat log which is in json form
"""
import argparse
from json import loads
def main():
parser = argparse.ArgumentParser(
description="Extract raw text sent by a user from a json telegram chat log")
parser... | mit | Python |
48b227f0019fb28a5b96874f62662fee79998fe5 | Add a TODO for diamondash metric snapshot request auth in diamondash proxy view | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/dashboard/views.py | go/dashboard/views.py | from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_http_methods
from django.views.decorators.csrf import csrf_exempt
from go.dashboard import client
@login_required
@csrf_exempt
@require_http_methods(['GET'])
def diamondash_... | from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_http_methods
from django.views.decorators.csrf import csrf_exempt
from go.dashboard import client
@login_required
@csrf_exempt
@require_http_methods(['GET'])
def diamondash_... | bsd-3-clause | Python |
e7d6f5fbd21819ba0c5d3b5e952331b2eabe32e8 | move ballsearch para to config | markm541374/gpbo,markm541374/gpbo,markm541374/gpbo,markm541374/gpbo | gpbo/core/__init__.py | gpbo/core/__init__.py | from collections import defaultdict
debugoutput=defaultdict(lambda :False)
debugoutput['path']='dbout'
from .optimize import *
from .optutils import *
from .acquisitions import *
from .reccomenders import *
from .config import *
from .GPdc import *
from .ESutils import *
from .choosers import *
| from collections import defaultdict
debugoutput=defaultdict(lambda :False)
debugoutput['path']='dbout'
from .optimize import *
from .optutils import *
from .acquisitions import *
from .reccomenders import *
from .config import *
from .GPdc import *
from .ESutils import *
from .choosers import *
| agpl-3.0 | Python |
e964df34a7f1f7dc85da21429b2978b01034140f | Fix typo | rezoo/illustration2vec,rezoo/illustration2vec | i2v/__init__.py | i2v/__init__.py | from i2v.base import Illustration2VecBase
caffe_available = False
chainer_available = False
try:
from i2v.caffe_i2v import CaffeI2V, make_i2v_with_caffe
caffe_available = True
except ImportError:
pass
try:
from i2v.chainer_i2v import ChainerI2V, make_i2v_with_chainer
chainer_available = True
exce... | from i2v.base import Illustration2VecBase
caffe_available = False
chainer_available = False
try:
from i2v.caffe_i2v import CaffeI2V, make_i2v_with_caffe
caffe_available = True
except ImportError:
pass
try:
from i2v.chainer_i2v import ChainerI2V, make_i2v_with_chainer
caffe_available = True
except... | mit | Python |
5d32ee0e41aee95f30f972eef3d1abcf9de50a0c | Kill unused var | 115100/untz_manager | untz_manager/__main__.py | untz_manager/__main__.py | """Main entry point for untz."""
from concurrent.futures import ThreadPoolExecutor
import logging
import os
from .encoder import apply_gain, encode_file
from .utils import get_args, preflight_checks, recursive_file_search
ARGS = get_args()
LOGGER = logging.getLogger(__name__)
def _encode_on_filter(file_entry):
... | """Main entry point for untz."""
from concurrent.futures import ThreadPoolExecutor
import logging
import os
from .encoder import apply_gain, encode_file
from .utils import get_args, preflight_checks, recursive_file_search
ARGS = get_args()
LOGGER = logging.getLogger(__name__)
threads = [] # pylint: disable=C0103
de... | bsd-3-clause | Python |
ae4da4d5d6af27ddab376cb41067f21b053fcf5e | make tokenz lazy | rshkv/goethe | goethe/corpora.py | goethe/corpora.py | import os
from . import util
import itertools as it
class Corpus:
def __init__(self, path, limit=None):
"""Pass path to corpus. Expects following structure:
path/to/my/corpus
corpus.txt
corpus.tokens.txt
"""
self.path = os.path.normpath(path)
self.lim... | import os
from . import util
import itertools as it
class Corpus:
def __init__(self, path, limit=None):
"""Pass path to corpus. Expects following structure:
path/to/my/corpus
corpus.txt
corpus.tokens.txt
"""
self.path = os.path.normpath(path)
self.lim... | mit | Python |
c6fe6e7ae212dab3b8cc4615355f782664dc2d05 | raise invalid error in relations if unable to get rid or rtype | sassoo/drfjsonapi | drfjsonapi/relations.py | drfjsonapi/relations.py | """
drfjsonapi.relations
~~~~~~~~~~~~~~~~~~~~
DRF relationship fields to assist with a JSON API spec
compliant API.
"""
from django.utils.translation import ugettext_lazy as _
from rest_framework.relations import SlugRelatedField
class JsonApiRelatedField(SlugRelatedField):
""" JSON API related ... | """
drfjsonapi.relations
~~~~~~~~~~~~~~~~~~~~
DRF relationship fields to assist with a JSON API spec
compliant API.
"""
from django.utils.translation import ugettext_lazy as _
from rest_framework.relations import SlugRelatedField
class JsonApiRelatedField(SlugRelatedField):
""" JSON API related ... | isc | Python |
6b8b2ebfd17cd96a08511a31d2f1159981b5c7cd | Update drakar.py | oksome/Crane-Old,oksome/Crane-Old | apps/drakar.py | apps/drakar.py | import os
import sys
import platform
from os.path import isfile, isdir, join
DRAKAR_PATH = os.environ.get('DRAKAR', '/mnt/drakar')
if not isdir(DRAKAR_PATH):
raise OSError("No such directory: '{}'".format(DRAKAR_PATH))
SYSTEM = sys.platform + '-' + platform.machine()
sources = {
'linux2-x86_64/processing-2.... | import os
import sys
import platform
from os.path import isfile, isdir, join
DRAKAR_PATH = os.environ.get('DRAKAR', '/mnt/drakar')
if not isdir(DRAKAR_PATH):
raise OSError("No such directory: '{}'".format(DRAKAR_PATH))
SYSTEM = sys.platform + '-' + platform.machine()
sources = {
'linux2-x86_64/processing-2.... | agpl-3.0 | Python |
1c02294073c855fab8d6fc0965f3584b0ac0137b | clean up example file | openego/dingo,openego/dingo | examples/example.py | examples/example.py | #!/usr/bin/env python3
import matplotlib.pyplot as plt
from oemof import db
from dingo.core import NetworkDingo
from dingo.tools import config as cfg_dingo
plt.close('all')
cfg_dingo.load_config('config_db_tables')
cfg_dingo.load_config('config_calc')
cfg_dingo.load_config('config_files')
cfg_dingo.load_config('con... | #!/usr/bin/env python3
import matplotlib.pyplot as plt
from oemof import db
conn = db.connection(section='oedb')
from dingo.core import NetworkDingo
from dingo.tools import config as cfg_dingo
from dingo.tools.debug import compare_graphs
plt.close('all')
cfg_dingo.load_config('config_db_tables')
cfg_dingo.load_confi... | agpl-3.0 | Python |
2645ac98fd2698bcfbf4a23cdb6c9583e6b31a50 | create test user from python updated | asmltd/faucet,asmltd/faucet,asmltd/faucet,asmltd/faucet,asmltd/faucet | src/apps/flow_manager/createdb.py | src/apps/flow_manager/createdb.py | import requests
import json
dbhost = "localhost"
dbport = "5984"
dbuser = "root"
dbpass = "asm123"
database = "faucet"
userdatabase = "users"
username = "testflowmgr@faucetsdn.org"
password = "testflowmgr"
role = "1"
data = {"username": username, "password": password, "role": role}
createdb = requests.put("http://"+db... | import requests
dbhost = "localhost"
dbport = "5984"
dbuser = "root"
dbpass = "asm123"
database = "faucet"
userdatabase = "users"
username = "testflowmgr@faucetsdn.org"
password = "testflowmgr"
role = "1"
data = {"username": username, "password": password, "role": role}
# createdb = requests.put("http://"+dbuser+":"+d... | apache-2.0 | Python |
547ee3fb5db9ebb0bed0443d865ec76f44904b9e | Add url_shortener.views.render_preview function | piotr-rusin/url-shortener,piotr-rusin/url-shortener | url_shortener/views.py | url_shortener/views.py | # -*- coding: utf-8 -*-
from flask import session, redirect, url_for, flash, render_template
from . import app
from .forms import ShortenedUrlForm
from .models import ShortenedUrl, register
@app.route('/', methods=['GET', 'POST'])
def shorten_url():
'''Display form and handle request for url shortening
If s... | # -*- coding: utf-8 -*-
from flask import session, redirect, url_for, flash, render_template
from . import app
from .forms import ShortenedUrlForm
from .models import ShortenedUrl, register
@app.route('/', methods=['GET', 'POST'])
def shorten_url():
'''Display form and handle request for url shortening
If s... | mit | Python |
d166563f648d409f7039ce2df1149a8cb15b13ab | add sub-package: plot | shmilee/gdpy3,shmilee/gdpy3,shmilee/gdpy3,shmilee/gdpy3 | gdpy3/__init__.py | gdpy3/__init__.py | __name__ = "gdpy3"
__doc__ = "gdpy3: Gyrokinetic Toroidal Code Data Processing tools"
__author__ = "shmilee"
__version__ = "0.0.1"
__status__ = "alpha"
__license__ = "MIT"
__email__ = "shmilee.zju@gmail.com"
__all__ = ['convert', 'plot', 'read']
| __name__ = "gdpy3"
__doc__ = "gdpy3: Gyrokinetic Toroidal Code Data Processing tools"
__author__ = "shmilee"
__version__ = "0.0.1"
__status__ = "alpha"
__license__ = "MIT"
__email__ = "shmilee.zju@gmail.com"
__all__ = ['convert', 'read']
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.