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 |
|---|---|---|---|---|---|---|---|---|
1cbe91b1f4e4ef126dfce3ecd56016f33e7ad836 | Fix django development settingns again | pinry/pinry,lapo-luchini/pinry,lapo-luchini/pinry,lapo-luchini/pinry,pinry/pinry,pinry/pinry,lapo-luchini/pinry,pinry/pinry | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
if not any(arg.startswith("--settings") for arg in sys.argv):
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pinry.settings.development")
from django.core.management import execute_from_command_line
if 'test' in sys.argv:
... | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
if "--settings" not in sys.argv:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pinry.settings.development")
from django.core.management import execute_from_command_line
if 'test' in sys.argv:
from django.conf import se... | bsd-2-clause | Python |
5fbbe3e48b7e76f86237eba71f283f23d7787d0e | Remove unused variables | gr1d99/shopping-list,gr1d99/shopping-list,gr1d99/shopping-list | manage.py | manage.py | import json
from flask_script import Manager
from main import app
from shopping_app.utils.helpers import secret_key_gen
manager = Manager(app)
@manager.command
def generate_secret():
secret_key_gen()
if __name__ == "__main__":
manager.run()
| from shopping_app.db.models import SHOPPING_FILE, USERS_FILE
import json
from flask_script import Manager
from main import app
from shopping_app.utils.helpers import secret_key_gen
manager = Manager(app)
@manager.command
def generate_secret():
secret_key_gen()
@manager.command
def resetdb():
files = [SHOPP... | mit | Python |
01848f5501cb3804f5c67bf56c5aec3700c4c0c7 | remove end slash in routing | stanislavfeldman/kiss.py,stanislavfeldman/kiss.py | kiss/controllers/router.py | kiss/controllers/router.py | from jinja2 import Environment, PackageLoader
from re import match
from kiss.controllers.core import Controller
from putils.patterns import Singleton
from putils.types import Dict
class Router(Singleton):
def __init__(self, options):
self.options = options
urls = Dict.flat_dict(self.options["urls"])
for k, v... | from jinja2 import Environment, PackageLoader
from re import match
from kiss.controllers.core import Controller
from putils.patterns import Singleton
from putils.types import Dict
class Router(Singleton):
def __init__(self, options):
self.options = options
urls = Dict.flat_dict(self.options["urls"])
for k, v... | bsd-3-clause | Python |
0d189d83ce99c3d8df0d8b3678825c6e34711eba | fix Alex Martelli's name in the comments | DjangoAdminHackers/johnny-cache,DjangoAdminHackers/johnny-cache,jmoiron/johnny-cache,BertrandBordage/johnny-cache | johnny/middleware.py | johnny/middleware.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Middleware classes for johnny cache."""
from django.middleware import transaction as trans_middleware
from django.db import transaction
from johnny import cache, settings
class QueryCacheMiddleware(object):
"""
This middleware class monkey-patches django's OR... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Middleware classes for johnny cache."""
from django.middleware import transaction as trans_middleware
from django.db import transaction
from johnny import cache, settings
class QueryCacheMiddleware(object):
"""
This middleware class monkey-patches django's OR... | mit | Python |
161aa546823c2efca32acd229ec8a3f19b158eb1 | update comments in 0024 | ResearchSoftwareInstitute/MyHPOM,RENCI/xDCIShare,ResearchSoftwareInstitute/MyHPOM,FescueFungiShare/hydroshare,RENCI/xDCIShare,hydroshare/hydroshare,RENCI/xDCIShare,FescueFungiShare/hydroshare,FescueFungiShare/hydroshare,FescueFungiShare/hydroshare,ResearchSoftwareInstitute/MyHPOM,hydroshare/hydroshare,ResearchSoftwareI... | hs_core/migrations/0024_custom_migration_metadata_namespace_20160527.py | hs_core/migrations/0024_custom_migration_metadata_namespace_20160527.py | from __future__ import unicode_literals
import logging
from django.db import migrations
# from hs_core.models import BaseResource
from hs_core.hydroshare.utils import resource_modified
def migrate_namespace_for_source_and_relation(apps, schema_editor):
# migrate the namespace for the 'Source' and 'Relation' me... | from __future__ import unicode_literals
import logging
from django.db import migrations
# from hs_core.models import BaseResource
from hs_core.hydroshare.utils import resource_modified
def migrate_namespace_for_source_and_relation(apps, schema_editor):
# migrate the namespace for the 'Source' and 'Relation' met... | bsd-3-clause | Python |
5a9a24cf360119772a06ef2ca93792f81fe4a1bc | add import re for xalt_syshost_TACC.py | xalt/xalt,xalt/xalt,xalt/xalt,xalt/xalt,xalt/xalt,xalt/xalt,xalt/xalt | src/xalt_syshost_TACC.py | src/xalt_syshost_TACC.py | # -*- python -*-
#
# Git Version: @git@
#
# user defined function
# this is only an example that works at a couple sites
#
#-----------------------------------------------------------------------
# XALT: A tool that tracks users jobs and environments on a cluster.
# Copyright (C) 2013-2014 University of Texas at Austi... | # -*- python -*-
#
# Git Version: @git@
#
# user defined function
# this is only an example that works at a couple sites
#
#-----------------------------------------------------------------------
# XALT: A tool that tracks users jobs and environments on a cluster.
# Copyright (C) 2013-2014 University of Texas at Austi... | lgpl-2.1 | Python |
c414f8f93e0762a3610437845ddd4fd8a4568037 | change model attribues to standard variable names | chrisvaughn/pt-mail | models.py | models.py | """ models module contains the App Engine DataStore models """
from google.appengine.ext import db
class Users(db.Model):
user_id = db.StringProperty()
email = db.StringProperty()
pt_username = db.StringProperty()
pt_emails = db.StringListProperty()
pt_token = db.StringProperty()
signatures = d... | """ models module contains the App Engine DataStore models """
from google.appengine.ext import db
class Users(db.Model):
user_id = db.StringProperty()
email = db.StringProperty()
pt_username = db.StringProperty()
pt_emails = db.StringListProperty()
pt_token = db.StringProperty()
signatures = d... | mit | Python |
a4c4b665bf1e0cae037109beaae7af8df7c90782 | Remove future print | heryandi/mnp | mnp/commands.py | mnp/commands.py | import collections
import itertools
import operator
import subprocess
import xmlrpclib
from pkg_resources import parse_version
def download(packages, index_url, additional_args = None):
additional_args = [] if additional_args is None else additional_args
subprocess.check_call(["pip", "install"] + packages + [... | #from __future__ import print_function
import collections
import itertools
import operator
import subprocess
import xmlrpclib
from pkg_resources import parse_version
def download(packages, index_url, additional_args = None):
additional_args = [] if additional_args is None else additional_args
subprocess.chec... | mit | Python |
f85e7c66e8dceddff4fe126fd7d25017ef9daa5c | add static method get group,get members ger links,getallgroups | moranmo29/ShareLink,moranmo29/ShareLink,moranmo29/ShareLink | models/group.py | models/group.py | from google.appengine.ext import ndb
from user import User
from link import Link
class Group(ndb.Model):
group_name = ndb.StringProperty()
admin = ndb.KeyProperty()
members = ndb.KeyProperty(repeated=True)
links = ndb.KeyProperty(repeated=True)
@staticmethod
def getGroup(admin,group_name):
if not group_name:... | from google.appengine.ext import ndb
from user import User
from link import Link
class Group(ndb.Model):
group_name = ndb.StringProperty()
admin = ndb.KeyProperty()
members = ndb.KeyProperty(repeated=True)
links = ndb.KeyProperty(repeated=True)
def getMembers(self):
members = []
for member in self.members:
... | mit | Python |
2758c7e5e88cb6f227cc0d1e728e68d1c651f7c6 | Fix all the stupid | keaneokelley/home,keaneokelley/home,keaneokelley/home | modules/leds.py | modules/leds.py | #!/usr/bin/env python3
"""
leds.py
~~~~~~~
Module to handle 4 RGBW LEDs and 5-pin RGBW LED strips.
Requires gpiozero and a Raspberry Pi
Default outputs (determined arbitrarily):
4 - red
17 - green
22 - blue
18 - white
"""
import sys
from gpiozero import RGBLED, LED
class LEDstrip:
"""
A class representing... | """
leds.py
~~~~~~~
Module to handle 4 RGBW LEDs and 5-pin RGBW LED strips.
Requires gpiozero and a Raspberry Pi
Default outputs (determined arbitrarily):
4 - red
17 - green
22 - blue
18 - white
"""
from gpiozero import RGBLED, LED
class LEDstrip:
"""
A class representing a 5-pin RGBW LED strip.
"""
... | mit | Python |
2fbbbb3983db46a40800cfcb4dd701129ddec0a5 | Update auth0 plugin to use eventname as field | ameihm0912/geomodel,ameihm0912/geomodel | plugin/auth0.py | plugin/auth0.py | #!/usr/bin/env python
# @@ auth0
# @T type event
# @Q tags: auth0
import sys
import json
SUCCESS_LOGIN_TEXTS = [
"Success Login",
"Success Silent Auth"
]
def procln(ev):
ret = {'valid': False, 'name': 'auth0'}
if 'utctimestamp' not in ev:
return ret
ret['timestamp'] = ev['utctimestamp']... | #!/usr/bin/env python
# @@ auth0
# @T type event
# @Q tags: auth0
import sys
import json
SUCCESS_LOGIN_TEXTS = [
"Success Login",
"Success Silent Auth"
]
def procln(ev):
ret = {'valid': False, 'name': 'auth0'}
if 'utctimestamp' not in ev:
return ret
ret['timestamp'] = ev['utctimestamp']... | mpl-2.0 | Python |
4e7396b1aca0e3371ac95e183e0039cc952fe66b | add 'inject' and raw' commands (Closes #148) | GLolol/PyLink | plugins/exec.py | plugins/exec.py | """
exec.py: Provides commands for executing raw code and debugging PyLink.
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import utils
from log import log
# Easier access to world through eval/exec.
import world
def _exec(irc, source, args):
"""<code>
... | # exec.py: Provides an 'exec' command to execute raw code
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import utils
from log import log
# Easier access to world through eval/exec.
import world
def _exec(irc, source, args):
"""<code>
Admin-only. Executes <... | mpl-2.0 | Python |
f33e006c2c58388513aed9aa45650540d95f39e1 | add a note indicating that this module is deprecated, but retained a reference | epfahl/inaworld | inaworld/tokens.py | inaworld/tokens.py | """Tokenize a document.
*** NLTK tokenization and this module have been deprecated in favor of a
sklearn-based solution. However, NLTK may offer more options for tokenization,
stemming, etc., this module is retained for future reference.
"""
import re
import nltk
import toolz as tz
re_not_alpha = re.compile('[^a-zA... | """Tokenize a document.
May be deprecated in favor of a full sklearn solution.
"""
import re
import nltk
import toolz as tz
re_not_alpha = re.compile('[^a-zA-Z]')
STOPWORDS = set(nltk.corpus.stopwords.words('english'))
def is_alpha(tt):
"""Given a POS tagged token (<token>, <pos>), return True if the token has... | mit | Python |
624a4be6be92d93ef3080d8e68775994f2f5ca57 | Fix `with_transaction` typing | agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft | pycroft/model/session.py | pycroft/model/session.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
"""
pycroft.model.session
~~~~~~~~~~~~~~
This module contains the session s... | # -*- coding: utf-8 -*-
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
"""
pycroft.model.session
~~~~~~~~~~~~~~
This module contains the session s... | apache-2.0 | Python |
dd9c16c5317b80c30ccca377a4b0064ebbeb4874 | Update expected count again after changes | sorgerlab/indra,bgyori/indra,sorgerlab/belpy,johnbachman/belpy,sorgerlab/indra,johnbachman/indra,johnbachman/indra,bgyori/indra,sorgerlab/indra,bgyori/indra,johnbachman/belpy,johnbachman/indra,sorgerlab/belpy,johnbachman/belpy,sorgerlab/belpy | indra/tests/test_tas.py | indra/tests/test_tas.py | from nose.plugins.attrib import attr
from indra.sources.tas import process_from_web
@attr('slow')
def test_processor():
tp = process_from_web(affinity_class_limit=10)
assert tp
assert tp.statements
num_stmts = len(tp.statements)
# This is the total number of statements about human genes
assert... | from nose.plugins.attrib import attr
from indra.sources.tas import process_from_web
@attr('slow')
def test_processor():
tp = process_from_web(affinity_class_limit=10)
assert tp
assert tp.statements
num_stmts = len(tp.statements)
# This is the total number of statements about human genes
assert... | bsd-2-clause | Python |
32f547a418ff70a9ed09c1b6a151752405629104 | Fix bookmaker bot | rubenvb/skia,HalCanary/skia-hc,aosp-mirror/platform_external_skia,HalCanary/skia-hc,google/skia,google/skia,Hikari-no-Tenshi/android_external_skia,HalCanary/skia-hc,google/skia,google/skia,Hikari-no-Tenshi/android_external_skia,HalCanary/skia-hc,rubenvb/skia,google/skia,Hikari-no-Tenshi/android_external_skia,rubenvb/sk... | infra/bots/upload_md.py | infra/bots/upload_md.py | # Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Update and upload markdown files using the output of fiddlecli."""
import argparse
import os
import subprocess
import sys
import git_utils
SKIA_REPO ... | # Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Update and upload markdown files using the output of fiddlecli."""
import argparse
import os
import subprocess
import sys
import git_utils
SKIA_REPO ... | bsd-3-clause | Python |
161adff4324885aa23897e04d104818cde06a6cb | Add comments and time/space complexities | bowen0701/algorithms_data_structures | lc322_coin_change.py | lc322_coin_change.py | """Leetcode 322. Coin Change
Medium
URL: https://leetcode.com/problems/coin-change/
You are given coins of different denominations and a total amount of
money amount. Write a function to compute the fewest number of coins
that you need to make up that amount.
If that amount of money cannot be made up by any combin... | """Leetcode 322. Coin Change
Medium
URL: https://leetcode.com/problems/coin-change/
You are given coins of different denominations and a total amount of
money amount. Write a function to compute the fewest number of coins
that you need to make up that amount.
If that amount of money cannot be made up by any combin... | bsd-2-clause | Python |
a5003b6f45d262923a1c00bd9a9c1addb3854178 | Move object creation outside of get method | geelweb/laposte-python-sdk | lapostesdk/apis/apibase.py | lapostesdk/apis/apibase.py | import requests
from importlib import import_module
class ApiBase(object):
def __init__(self, api_key, product, version='v1', entity=None):
self.product = product
self.version = version
self.entity = entity
self.api_url = 'https://api.laposte.fr/%(product)s/%(version)s/' % {
... | import requests
from importlib import import_module
class ApiBase(object):
def __init__(self, api_key, product, version='v1', entity=None):
self.product = product
self.version = version
self.entity = entity
self.api_url = 'https://api.laposte.fr/%(product)s/%(version)s/' % {
... | mit | Python |
f62994571f4452bb946a11b9df10cdadb3352970 | Complete lc322_coin_change.py | bowen0701/algorithms_data_structures | lc322_coin_change.py | lc322_coin_change.py | """Leetcode 322. Coin Change
Medium
URL: https://leetcode.com/problems/coin-change/
You are given coins of different denominations and a total amount of
money amount. Write a function to compute the fewest number of coins
that you need to make up that amount.
If that amount of money cannot be made up by any combin... | """Leetcode 322. Coin Change
Medium
URL: https://leetcode.com/problems/coin-change/
You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combinati... | bsd-2-clause | Python |
a1bc8eea9ede03088bb9ecef379721a724112533 | Reset main.py so I can branch for GUI | btnpushnmunky/pygallerycreator | pygallerycreator/main.py | pygallerycreator/main.py | import copier
import gallery_creator
import image_processor
import os
import gui
from PyQt5 import QtGui
import sys
def get_user_path():
"""
Get the user's destination directory for the gallery folder.
:return: User image directory path as a string.
"""
dir_name_input = "Gallery path. Created in ... | import copier
import gallery_creator
import image_processor
import os
import gui
from PyQt5 import QtGui, QtWidgets
import sys
def get_user_path():
"""
Get the user's destination directory for the gallery folder.
:return: User image directory path as a string.
"""
dir_name_input = "Gallery path. ... | mit | Python |
25730140be5a921b8e8a1997691e50aba77e0041 | Remove some leftover junk in fix-style.py | simquest/opensurgsim,simquest/opensurgsim,simquest/opensurgsim,simquest/opensurgsim | Tools/fix-style.py | Tools/fix-style.py | #!/usr/bin/python
# This file is a part of the OpenSurgSim project.
# Copyright 2012-2013, SimQuest Solutions 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.o... | #!/usr/bin/python
# This file is a part of the OpenSurgSim project.
# Copyright 2012-2013, SimQuest Solutions 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.o... | apache-2.0 | Python |
54a312d0764c2368a5655cfc768f8f7829deca7b | support Windows build | depp/sglib,depp/sglib | script/sglib/external/freetype.py | script/sglib/external/freetype.py | # Copyright 2014 Dietrich Epp.
# This file is part of SGLib. SGLib is licensed under the terms of the
# 2-clause BSD license. For more information, see LICENSE.txt.
from d3build.error import ConfigError
from d3build.generatedsource.configuremake import ConfigureMake
from d3build.package import ExternalPackage
from ..... | # Copyright 2014 Dietrich Epp.
# This file is part of SGLib. SGLib is licensed under the terms of the
# 2-clause BSD license. For more information, see LICENSE.txt.
from d3build.error import ConfigError
from d3build.generatedsource.configuremake import ConfigureMake
from d3build.package import ExternalPackage
import ... | bsd-2-clause | Python |
c5473ce95c821a262ca79f62051308ac9b48f3c5 | fix lint | VirusTotal/content,demisto/content,VirusTotal/content,demisto/content,demisto/content,VirusTotal/content,VirusTotal/content,demisto/content | Scripts/FileToBase64List/FileToBase64List.py | Scripts/FileToBase64List/FileToBase64List.py | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import base64
import zlib
def get_file_data(file_path, zip=False):
with open(file_path, 'rb') as f:
data = f.read()
if zip:
data = zlib.compress(data)
return base64.b64encode(data)
... | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import base64
import zlib
def get_file_data(file_path, zip=False):
with open(file_path, 'rb') as f:
data = f.read()
if zip:
data = zlib.compress(data)
return base64.b64encode(data)
... | mit | Python |
b71aac6f519dd254bf23a9c74899ca20485dd340 | Increment static resource to account for CDN JS | phil-lopreiato/the-blue-alliance,josephbisch/the-blue-alliance,1fish2/the-blue-alliance,verycumbersome/the-blue-alliance,tsteward/the-blue-alliance,bdaroz/the-blue-alliance,verycumbersome/the-blue-alliance,josephbisch/the-blue-alliance,the-blue-alliance/the-blue-alliance,jaredhasenklein/the-blue-alliance,josephbisch/th... | tba_config.py | tba_config.py | import json
import os
DEBUG = os.environ.get('SERVER_SOFTWARE', '').startswith('Dev')
# For choosing what the main landing page displays
KICKOFF = 1
BUILDSEASON = 2
COMPETITIONSEASON = 3
OFFSEASON = 4
# The CONFIG variables should have exactly the same structure between environments
# Eventually a test environment s... | import json
import os
DEBUG = os.environ.get('SERVER_SOFTWARE', '').startswith('Dev')
# For choosing what the main landing page displays
KICKOFF = 1
BUILDSEASON = 2
COMPETITIONSEASON = 3
OFFSEASON = 4
# The CONFIG variables should have exactly the same structure between environments
# Eventually a test environment s... | mit | Python |
f2dca32f785648a03440ff030625150590a52372 | Update simple_copy.py for Python3 types. | msc-/gyp,chromium/gyp,chromium/gyp,chromium/gyp,msc-/gyp,msc-/gyp,turbulenz/gyp,turbulenz/gyp,turbulenz/gyp,msc-/gyp,msc-/gyp,chromium/gyp,turbulenz/gyp,turbulenz/gyp,chromium/gyp | pylib/gyp/simple_copy.py | pylib/gyp/simple_copy.py | # Copyright 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A clone of the default copy.deepcopy that doesn't handle cyclic
structures or complex types except for dicts and lists. This is
because gyp copies so large structur... | # Copyright 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A clone of the default copy.deepcopy that doesn't handle cyclic
structures or complex types except for dicts and lists. This is
because gyp copies so large structur... | bsd-3-clause | Python |
4eb542b00c0e9a46de5f765deabf031b8310e1bf | Remove stray print. | davidwaroquiers/pymatgen,davidwaroquiers/pymatgen,gVallverdu/pymatgen,fraricci/pymatgen,fraricci/pymatgen,fraricci/pymatgen,vorwerkc/pymatgen,vorwerkc/pymatgen,vorwerkc/pymatgen,vorwerkc/pymatgen,richardtran415/pymatgen,gVallverdu/pymatgen,richardtran415/pymatgen,gVallverdu/pymatgen,richardtran415/pymatgen,fraricci/pym... | pymatgen/analysis/xps.py | pymatgen/analysis/xps.py | """
This is a module for XPS analysis. It is modelled after the Galore package (https://github.com/SMTG-UCL/galore), but
with some modifications for easier analysis from pymatgen itself. Please cite the following original work if you use
this::
Adam J. Jackson, Alex M. Ganose, Anna Regoutz, Russell G. Egdell, Davi... | """
This is a module for XPS analysis. It is modelled after the Galore package (https://github.com/SMTG-UCL/galore), but
with some modifications for easier analysis from pymatgen itself. Please cite the following original work if you use
this::
Adam J. Jackson, Alex M. Ganose, Anna Regoutz, Russell G. Egdell, Davi... | mit | Python |
f210df2bc7e59dfcb8c5b54e8c7ff6da54a458b4 | Add Template | Cretezy/pymessenger2,karlinnolabs/pymessenger | pymessenger2/__init__.py | pymessenger2/__init__.py | from .bot import Bot
from .buttons import *
from .airline import *
@attr.s
class Template:
payload = attr.ib()
type = attr.ib(default='template')
@attr.s
class Element:
title = attr.ib()
item_url = attr.ib(default=None)
image_url = attr.ib(default=None)
subtitle = attr.ib(default=None)
... | from .bot import Bot
from .buttons import *
from .airline import *
@attr.s
class Element:
title = attr.ib()
item_url = attr.ib(default=None)
image_url = attr.ib(default=None)
subtitle = attr.ib(default=None)
buttons = attr.ib(default=None)
@attr.s
class QuickReply:
"""
See https://devel... | mit | Python |
01c85f24d788c8f92ad4ee04192d963f74521eec | Use score as well in annotations table | EnvGen/toolbox,EnvGen/toolbox | scripts/rpkm_annotations_table.py | scripts/rpkm_annotations_table.py | #!/usr/bin/env python
"""A script to sum the rpkm values for all genes for each annotation."""
import pandas as pd
import argparse
import sys
def main(args):
rpkm_table =pd.read_table(args.rpkm_table, index_col=0)
annotations = pd.read_table(args.annotation_table, header=None, names=["gene_id", "annotation", ... | #!/usr/bin/env python
"""A script to sum the rpkm values for all genes for each annotation."""
import pandas as pd
import argparse
import sys
def main(args):
rpkm_table =pd.read_table(args.rpkm_table, index_col=0)
annotations = pd.read_table(args.annotation_table, header=None, names=["gene_id", "annotation", ... | mit | Python |
c0b19b1ed8655b540ba8431bb1224056ed5890df | Remove code which blanks patch files | openaustralia/publicwhip-matthew,openaustralia/publicwhip-matthew,openaustralia/publicwhip-matthew,openaustralia/publicwhip-matthew,openaustralia/publicwhip-matthew,openaustralia/publicwhip-matthew,openaustralia/publicwhip-matthew,openaustralia/publicwhip-matthew,openaustralia/publicwhip-matthew | pyscraper/patchfilter.py | pyscraper/patchfilter.py | #! /usr/bin/python2.3
# vim:sw=8:ts=8:et:nowrap
import os
import shutil
def ApplyPatches(filein, fileout):
# Generate short name such as wrans/answers2003-03-31.html
(rest, name) = os.path.split(filein)
(rest, dir) = os.path.split(rest)
fileshort = os.path.join(dir, name)
# Lo... | #! /usr/bin/python2.3
# vim:sw=8:ts=8:et:nowrap
import os
import shutil
def ApplyPatches(filein, fileout):
# Generate short name such as wrans/answers2003-03-31.html
(rest, name) = os.path.split(filein)
(rest, dir) = os.path.split(rest)
fileshort = os.path.join(dir, name)
# Lo... | agpl-3.0 | Python |
5e94457f890f4c0cd165c15067a151cab04a7078 | fix merge | toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity | search/migrations/0001_initial.py | search/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-15 09:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Search... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-16 08:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Search... | apache-2.0 | Python |
b6127e5743b5f250270600a6acb62ab97b2d76d7 | Fix SimpleQuantumSystem | matthewwardrop/python-qubricks,matthewwardrop/python-qubricks | qubricks/wall/systems.py | qubricks/wall/systems.py | from ..system import QuantumSystem
class SimpleQuantumSystem(QuantumSystem):
def setup_environment(self, **kwargs):
'''
Configure any custom properties/attributes using kwargs passed
to __init__.
'''
self.kwargs = kwargs
def setup_parameters(self):
'''
... | from ..system import QuantumSystem
class SimpleQuantumSystem(QuantumSystem):
def setup_environment(self, **kwargs):
'''
Configure any custom properties/attributes using kwargs passed
to __init__.
'''
self.kwargs = kwargs
def setup_parameters(self):
'''
... | mit | Python |
81505cf7e417278dea3faabcbebf87f4a3143196 | Set addons uninstallable | leorochael/queue | queue_job/__openerp__.py | queue_job/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013-2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013-2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | agpl-3.0 | Python |
e510c7f0eb8d91ee3d7132eac9f2b4b6c146b771 | Fix typo | chainer/chainer,wkentaro/chainer,anaruse/chainer,niboshi/chainer,okuta/chainer,chainer/chainer,hvy/chainer,okuta/chainer,ktnyt/chainer,chainer/chainer,keisuke-umezawa/chainer,jnishi/chainer,ktnyt/chainer,okuta/chainer,pfnet/chainer,niboshi/chainer,okuta/chainer,tkerola/chainer,jnishi/chainer,wkentaro/chainer,keisuke-um... | tests/chainer_tests/training_tests/extensions_tests/test_nan_killer.py | tests/chainer_tests/training_tests/extensions_tests/test_nan_killer.py | import os
import tempfile
import unittest
import numpy
import chainer
from chainer import links
from chainer.testing import attr
from chainer import training
class Model(chainer.Chain):
def __init__(self):
super(Model, self).__init__()
with self.init_scope():
self.l = links.Linear(1... | import os
import tempfile
import unittest
import numpy
import chainer
from chainer import links
from chainer.testing import attr
from chainer import training
class Model(chainer.Chain):
def __init__(self):
super(Model, self).__init__()
with self.init_scope():
self.l = links.Linear(1... | mit | Python |
708fd2c92f6d941180d79772903f1ec363a9e6a1 | Update config | Kellel/reports,Kellel/reports | report/default_config.py | report/default_config.py | ####
#### REPORT DAEMON DEFAULT CONFIGURATION
####
# Database uri for more information lookup sqlalchemy database uri
SQLALCHEMY_URI="sqlite:///report.db"
# Change the log level of the daemon (debug, info, warning, error, critical)
LOG_LEVEL="info"
# enable database logging. This will print out every db transaction ... | SQLALCHEMY_URI="sqlite:///report.db"
LOG_LEVEL="info"
DB_LOGGING=False
REDIS_HOST="127.0.0.1"
REDIS_PORT=6379
REDIS_PASSWORD=""
| bsd-3-clause | Python |
1b385ce127f0a1802b0effa0054b44f58b3317b0 | Fix webapp password reset link | thorgate/django-project-template,thorgate/django-project-template,thorgate/django-project-template,thorgate/django-project-template,thorgate/django-project-template | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/accounts/urls.py | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/accounts/urls.py | from django.contrib.auth import views
from django.urls import path
from accounts.forms import LoginForm, PasswordResetForm, SetPasswordForm
urlpatterns = [
path(
"login/",
views.LoginView.as_view(
template_name="accounts/login.html", authentication_form=LoginForm
),
na... | from django.contrib.auth import views
from django.urls import path, re_path
from accounts.forms import LoginForm, PasswordResetForm, SetPasswordForm
urlpatterns = [
path(
"login/",
views.LoginView.as_view(
template_name="accounts/login.html", authentication_form=LoginForm
),
... | isc | Python |
dd1b9f665ebb0bf550715b0ec31b8dcb4c96de81 | Update SimpleReduceHandler.restore to better follow the protocol. | dongguangming/jsonpickle,dongguangming/jsonpickle,mandx/jsonpickle,mandx/jsonpickle,dongguangming/jsonpickle,mandx/jsonpickle,mandx/jsonpickle,dongguangming/jsonpickle | jsonpickle/_handlers.py | jsonpickle/_handlers.py | import sys
import datetime
import collections
import jsonpickle
class DatetimeHandler(jsonpickle.handlers.BaseHandler):
"""
Datetime objects use __reduce__, and they generate binary strings encoding
the payload. This handler encodes that payload to reconstruct the
object.
"""
_handles = dateti... | import sys
import datetime
import collections
import jsonpickle
class DatetimeHandler(jsonpickle.handlers.BaseHandler):
"""
Datetime objects use __reduce__, and they generate binary strings encoding
the payload. This handler encodes that payload to reconstruct the
object.
"""
_handles = dateti... | bsd-3-clause | Python |
7e0350064c7ea53db5b4cbf967a6c863a0bba116 | fix pep8 error | francois-berder/PyLetMeCreate | letmecreate/click/accel.py | letmecreate/click/accel.py | #!/usr/bin/env python3
"""Python binding of Accel Click wrapper of LetMeCreate library.
This wrapper only supports SPI protocol to communicate with the click board.
You must initialise the SPI bus and select the right bus before using any of
these functions.
"""
import ctypes
_LIB = ctypes.CDLL('libletmecreate_click... | #!/usr/bin/env python3
"""Python binding of Accel Click wrapper of LetMeCreate library.
This wrapper only supports SPI protocol to communicate with the click board.
You must initialise the SPI bus and select the right bus before using any of
these functions.
"""
import ctypes
_lib = ctypes.CDLL('libletmecreate_click... | bsd-3-clause | Python |
1f29f17ebb526fc0afb0010c1b51514a6868c338 | fix names | bixel/python-introduction | interactive_dst.py | interactive_dst.py | import sys
import GaudiPython as GP
from GaudiConf import IOHelper
from Configurables import DaVinci
input_files = [sys.argv[-1]]
IOHelper('ROOT').inputFiles(input_files)
dv = DaVinci()
dv.DataType = '2012'
appMgr = GP.AppMgr()
evt = appMgr.evtsvc()
appMgr.run(1)
evt.dump()
def nodes(evt, node=None):
"""List ... | import sys
import GaudiPython as GP
from GaudiConf import IOHelper
from Configurables import DaVinci
input_files = [sys.argv[-1]]
IOHelper('ROOT').inputFiles(input_files)
dv = DaVinci()
dv.DataType = '2012'
app_mgr = GP.AppMgr()
evt_svc = app_mgr.evtsvc()
app_mgr.run(1)
evt_svc.dump()
def nodes(evt, node=None):
... | mit | Python |
9b10f600b5611380f72fe2aeacfe2ee6f02e4e3a | Switch to old invocation of FootprintEnumerate | monostable/haskell-kicad-data,monostable/haskell-kicad-data,kasbah/haskell-kicad-data | kicad_footprint_load.py | kicad_footprint_load.py | import pcbnew
import sys
import os
pretties = []
for dirname, dirnames, filenames in os.walk(sys.argv[1]):
# don't go into any .git directories.
if '.git' in dirnames:
dirnames.remove('.git')
for filename in filenames:
if (not os.path.isdir(filename)) and (os.path.splitext(filename)[-1] ==... | import pcbnew
import sys
import os
pretties = []
for dirname, dirnames, filenames in os.walk(sys.argv[1]):
# don't go into any .git directories.
if '.git' in dirnames:
dirnames.remove('.git')
for filename in filenames:
if (not os.path.isdir(filename)) and (os.path.splitext(filename)[-1] ==... | mit | Python |
a0879c3b4a072d4c3f76bd543b65cd4418943a8d | Include brute force solution for the Islands problem | alkaitz/general-programming | islands/islands.py | islands/islands.py | '''
Created on Aug 1, 2017
@author: alkaitz
'''
'''
There is an infinite 2D ocean which you can edit by placing or removing soil cells.
Every time you include or remove a soil cell we want to know the number of existing
islands in the ocean. An island is a North/South/East/West connected amount of soil ce... | '''
Created on Aug 1, 2017
@author: alkaitz
'''
if __name__ == '__main__':
pass | mit | Python |
9d051f038d37dc1b985ed6c633c10166a41685d1 | Fix broken JSON generation | jammycakes/lambda-tools | lambda_tools/command.py | lambda_tools/command.py | import click
import json as j
import sys
@click.group()
def main():
pass
def _process(source, functions, action, json):
from .lambdas import load
lambdas = load(source, functions)
for l in lambdas:
action(l)
if json:
d = dict([[l.cfg.name, l.cfg.package] for l in lambdas])
... | import click
import json as j
import sys
@click.group()
def main():
pass
def _process(source, functions, action, json):
from .lambdas import load
lambdas = load(source, functions)
for l in lambdas:
action(l)
if json:
d = dict([[l.name, l.package] for l in lambdas])
print(j... | mit | Python |
cc38675276f0f125c8a04f71c209fa93c231d9d7 | Bump version to 1.2! | locustio/locust,locustio/locust,locustio/locust,mbeacom/locust,locustio/locust,mbeacom/locust,mbeacom/locust,mbeacom/locust | locust/__init__.py | locust/__init__.py | # Apply Gevent monkey patching of stdlib
from gevent import monkey as _monkey
_monkey.patch_all()
from .user.sequential_taskset import SequentialTaskSet
from .user import wait_time
from .user.task import task, tag, TaskSet
from .user.users import HttpUser, User
from .user.wait_time import between, constant, constant_... | # Apply Gevent monkey patching of stdlib
from gevent import monkey as _monkey
_monkey.patch_all()
from .user.sequential_taskset import SequentialTaskSet
from .user import wait_time
from .user.task import task, tag, TaskSet
from .user.users import HttpUser, User
from .user.wait_time import between, constant, constant_... | mit | Python |
fe326bb81e9e454542185401867c85932c176de6 | set pefault number of elements in page | sokil/DistributiveManager,sokil/DistributiveManager,sokil/DistributiveManager | library/Paginator.py | library/Paginator.py | class Paginator:
def __init__(self, cursor=None):
self.cursor = cursor
self.page_cursor = None
self.page = 1
self.page_length = 20
self.total_length = None
def set_cursor(self, cursor):
self.cursor = cursor
return self
def set_page(self, page):
... | class Paginator:
def __init__(self, cursor=None):
self.cursor = cursor
self.page_cursor = None
self.page = 1
self.page_length = 1
self.total_length = None
def set_cursor(self, cursor):
self.cursor = cursor
return self
def set_page(self, page):
... | mit | Python |
108afea3549e6ec832821124b9faff0ccd98cbcf | check for previously searched urls | jdowner/katipo | katipo/traverse.py | katipo/traverse.py | import hashlib
import logging
import urlparse
from bs4 import BeautifulSoup
import requests
import tornado.gen
log = logging.getLogger(__name__)
class Traverse(object):
def __init__(self, seeds):
self._searched = []
self._pending = set(seeds)
@property
def pending(self):
return s... | import hashlib
import logging
import urlparse
from bs4 import BeautifulSoup
import requests
import tornado.gen
log = logging.getLogger(__name__)
class Traverse(object):
def __init__(self, seeds):
self._pending = set(seeds)
@property
def pending(self):
return self._pending
@tornado.g... | mit | Python |
eafd43442cc697bf2278f6df67c1577cc8f5bf56 | Print progress of combinatorical build | OpenSpace/OpenSpace,OpenSpace/OpenSpace,OpenSpace/OpenSpace,OpenSpace/OpenSpace | support/jenkins/buildAllModuleCombination.py | support/jenkins/buildAllModuleCombination.py | import os
from subprocess import call
from itertools import product, repeat
# To be called from the OpenSpace main folder
modules = os.listdir("modules")
modules.remove("base")
# Get 2**len(modules) combinatorical combinations of ON/OFF
settings = []
for args in product(*repeat(("ON", "OFF"), len(modules))):
sett... | import os
from subprocess import call
from itertools import product, repeat
# To be called from the OpenSpace main folder
modules = os.listdir("modules")
modules.remove("base")
# Get 2**len(modules) combinatorical combinations of ON/OFF
settings = []
for args in product(*repeat(("ON", "OFF"), len(modules))):
sett... | mit | Python |
5c35db9229c6c1515f77cdac94dfece30af5c614 | bump to 0.3 | tony/libtmux | libtmux/__about__.py | libtmux/__about__.py | __title__ = 'libtmux'
__package_name__ = 'libtmux'
__version__ = '0.3'
__description__ = 'Python API for tmux servers, sessions, windows and panes'
__email__ = 'tony@git-pull.com'
__author__ = 'Tony Narlock'
__license__ = 'BSD'
__copyright__ = 'Copyright 2016 Tony Narlock'
| __title__ = 'libtmux'
__package_name__ = 'libtmux'
__version__ = '0.2'
__description__ = 'Python API for tmux servers, sessions, windows and panes'
__email__ = 'tony@git-pull.com'
__author__ = 'Tony Narlock'
__license__ = 'BSD'
__copyright__ = 'Copyright 2016 Tony Narlock'
| bsd-3-clause | Python |
343e9c153d4858ad210a7f2569fd1ea4f9b5a872 | fix thread mem checking | Blazemeter/apiritif,Blazemeter/apiritif | apiritif/thread.py | apiritif/thread.py | """
Copyright 2019 BlazeMeter Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwar... | """
Copyright 2019 BlazeMeter Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwar... | apache-2.0 | Python |
5441d566a1a3dadc8912d8111bd5542401dbb270 | Update admin options for case, result data | ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas | apps/plea/admin.py | apps/plea/admin.py | from django.contrib import admin
from apps.plea.models import (UsageStats, Court,
Case, CaseAction,
CourtEmailCount,
Offence,
Result,
ResultOffence,
... | from django.contrib import admin
from apps.plea.models import (UsageStats, Court,
Case, CaseAction,
CourtEmailCount,
Offence,
Result,
ResultOffence,
... | mit | Python |
3bcc37feac19e9f2132f803d8bc9a57c9c1903fb | update version | stfc/cvmfs-stratum-uploader,stfc/cvmfs-stratum-uploader,stfc/cvmfs-stratum-uploader | archer/__init__.py | archer/__init__.py | __version__ = '0.1.0' | __version__ = '0.0.4' | apache-2.0 | Python |
0312566b0f32a278cf662dbee33b9dbe9c2ebc2a | add todo | whiteavian/data_compare | data_compare/test/__init__.py | data_compare/test/__init__.py | from time import time
from sqlalchemy_utils import create_database, drop_database
class TestSetup:
"""Create ephemeral databases for testing purposes, and destroy them after the
tests have finished."""
# TODO put these in a configuration file.
DB_USER = 'db_user'
DB_PASS = 'db_pass'
HOST = 'lo... | from time import time
from sqlalchemy_utils import create_database, drop_database
class TestSetup:
"""Create ephemeral databases for testing purposes, and destroy them after the
tests have finished."""
DB_USER = 'db_user'
DB_PASS = 'db_pass'
HOST = 'localhost'
def __init__(self):
CONN... | mit | Python |
295972f5867d95b4f2910dbee25b36c25bd4699a | Add BigInteger and str type. | SunDwarf/asyncqlio | katagawa/sql/types.py | katagawa/sql/types.py | """
Contains specific types for columns in Katagawa.
These types are specified in the Column constructor.
.. code:: python
class MyModel(Base):
__tablename__ = "my_model"
id = katagawa.Column(katagawa.Integer)
username = katagawa.Column(katagawa.String)
"""
import abc
import typing
cl... | """
Contains specific types for columns in Katagawa.
These types are specified in the Column constructor.
.. code:: python
class MyModel(Base):
__tablename__ = "my_model"
id = katagawa.Column(katagawa.Integer)
username = katagawa.Column(katagawa.String)
"""
import abc
import typing
cl... | mit | Python |
5393899e2798e171318841665efc53d06971b496 | fix bucket clean up logic. [(#1845)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1845) | googleapis/python-asset,googleapis/python-asset | samples/snippets/quickstart_exportassets_test.py | samples/snippets/quickstart_exportassets_test.py | #!/usr/bin/env python
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | #!/usr/bin/env python
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | apache-2.0 | Python |
74e4336cc4640ee09da049f72b0e894fead6091d | use helper.py | sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary | checkin.py | checkin.py | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import changeset
import helper
import log
import package
import versions
def checkin(repos, cfg, file):
f = open(file, "r")
try:
grp = package.GroupFromTextFile(f, cfg.packagenamespace, repos)
except package.ParseError:
return
simpleVer... | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import changeset
import log
import package
import versions
def checkin(repos, cfg, file):
f = open(file, "r")
try:
grp = package.GroupFromTextFile(f, cfg.packagenamespace, repos)
except package.ParseError:
return
simpleVer = grp.getSimp... | apache-2.0 | Python |
f5fd283497afb5030632108ce692e8acde526188 | Allow the ingester to work without a report key | planetlabs/datalake-ingester,planetlabs/atl,planetlabs/datalake,planetlabs/datalake,planetlabs/datalake,planetlabs/datalake | datalake_ingester/reporter.py | datalake_ingester/reporter.py | import boto.sns
import simplejson as json
import logging
from memoized_property import memoized_property
import os
class SNSReporter(object):
'''report ingestion events to SNS'''
def __init__(self, report_key):
self.report_key = report_key
self.logger = logging.getLogger(self._log_name)
@... | import boto.sns
import simplejson as json
import logging
from memoized_property import memoized_property
import os
from datalake_common.errors import InsufficientConfiguration
class SNSReporter(object):
'''report ingestion events to SNS'''
def __init__(self, report_key):
self.report_key = report_key
... | apache-2.0 | Python |
2eab4c48962da52766c3d6f8051ad87aa505a90c | Update Talk model __str__ to include time | yamatt/bonfiremanager | bonfiremanager/models.py | bonfiremanager/models.py | from django.db import models
class Event(models.Model):
name = models.CharField(max_length=1024, unique=True)
slug = models.SlugField(max_length=1024)
def __str__(self):
return self.name
class TimeSlot(models.Model):
event = models.ForeignKey(Event)
bookable = models.BooleanField(... | from django.db import models
class Event(models.Model):
name = models.CharField(max_length=1024, unique=True)
slug = models.SlugField(max_length=1024)
def __str__(self):
return self.name
class TimeSlot(models.Model):
event = models.ForeignKey(Event)
bookable = models.BooleanField(... | agpl-3.0 | Python |
c66c47937c60647de67362f57b2418a06b8eb3ef | make sure osf preregistration is activated by waffle switch | CenterForOpenScience/osf.io,cslzchen/osf.io,felliott/osf.io,brianjgeiger/osf.io,baylee-d/osf.io,aaxelb/osf.io,adlius/osf.io,pattisdr/osf.io,cslzchen/osf.io,mfraezz/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,pattisdr/osf.io,CenterForOpenScience/osf.io,Johnetordoff/osf.io,baylee-d/osf.io,pattisdr/osf.io,aaxelb/osf.io,John... | scripts/remove_after_use/end_prereg_challenge.py | scripts/remove_after_use/end_prereg_challenge.py | import sys
import logging
from website.app import setup_django
setup_django()
from waffle.models import Switch
from framework.celery_tasks import app as celery_app
from scripts.utils import add_file_logger
from osf.models import RegistrationSchema
logger = logging.getLogger(__name__)
logging.basicConfig(level=log... | import sys
import logging
from waffle.models import Switch
from framework.celery_tasks import app as celery_app
from website.app import setup_django
setup_django()
from scripts.utils import add_file_logger
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def main(dry_run=True):
sw... | apache-2.0 | Python |
999fe9fcb94c163384b5836da02aab9aa78b2788 | Add units conversion for insulin_sensitivities | openaps/openaps,openaps/openaps | openaps/vendors/units.py | openaps/vendors/units.py |
"""
Units - units tool for openaps
"""
from openaps.uses.use import Use
from openaps.uses.registry import Registry
from openaps.glucose.convert import Convert as GlucoseConvert
import json
import argparse
def set_config (args, device):
return device
def display_device (device):
return ''
use = Registry( )
... |
"""
Units - units tool for openaps
"""
from openaps.uses.use import Use
from openaps.uses.registry import Registry
from openaps.glucose.convert import Convert as GlucoseConvert
import json
import argparse
def set_config (args, device):
return device
def display_device (device):
return ''
use = Registry( )
... | mit | Python |
8bac8992501311e8bd182869c53e9eaa46db4e4b | test collections.namedtuple | xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples | pythonPractiseSamples/collectionsExcercises.py | pythonPractiseSamples/collectionsExcercises.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Damian Ziobro <damian@xmementoit.com>
import unittest
from collections import deque
from collections import defaultdict
from collections import namedtuple
class TestCollectionsMethods(unittest.TestCase):
def setUp(self):
... | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Damian Ziobro <damian@xmementoit.com>
import unittest
from collections import deque
from collections import defaultdict
class TestCollectionsMethods(unittest.TestCase):
def setUp(self):
self.deq = deque("ghi")
s... | apache-2.0 | Python |
f45fc8854647754b24df5f9601920368cd2d3c49 | Add safety checks in test | wkentaro/chainer,hvy/chainer,niboshi/chainer,okuta/chainer,chainer/chainer,wkentaro/chainer,chainer/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,hvy/chainer,pfnet/chainer,hvy/chainer,chainer/chainer,keisuke-umezawa/chainer,okuta/chainer,chainer/chainer,tkerola/chainer,keisuke-umezawa/chainer,wkentaro/chainer... | tests/chainerx_tests/unit_tests/test_cuda.py | tests/chainerx_tests/unit_tests/test_cuda.py | import pytest
from chainerx import _cuda
try:
import cupy
except Exception:
cupy = None
class CupyTestMemoryHook(cupy.cuda.memory_hook.MemoryHook):
name = 'CupyTestMemoryHook'
def __init__(self):
self.used_bytes = 0
self.acquired_bytes = 0
def alloc_preprocess(self, **kwargs)... | import pytest
from chainerx import _cuda
try:
import cupy
except Exception:
cupy = None
class CupyTestMemoryHook(cupy.cuda.memory_hook.MemoryHook):
name = 'CupyTestMemoryHook'
def __init__(self):
self.used_bytes = 0
self.acquired_bytes = 0
def alloc_preprocess(self, **kwargs)... | mit | Python |
716b08c5dd9711648795ffc79e919edb87caf2da | Bump Version 0.0.35 -> 0.0.36 | arteria/django-openinghours,arteria/django-openinghours | openinghours/__init__.py | openinghours/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.0.36'
| # -*- coding: utf-8 -*-
__version__ = '0.0.35'
| mit | Python |
429f38497da0fd520e5bc5bd82e6d4ed5a405521 | Use NewBuildingsSearchForm as main page search form. | Dybov/real_estate_agency,Dybov/real_estate_agency,Dybov/real_estate_agency | real_estate_agency/real_estate_agency/views.py | real_estate_agency/real_estate_agency/views.py | from django.shortcuts import render
from new_buildings.models import ResidentalComplex
from new_buildings.forms import NewBuildingsSearchForm
from feedback.models import Feedback
def corporation_benefit_plan(request):
return render(request, 'corporation_benefit_plan.html')
def index(request):
# Only 2 requ... | from django.shortcuts import render, render_to_response
from django.template import RequestContext
from new_buildings.models import Builder, ResidentalComplex, NewApartment
from new_buildings.forms import SearchForm
from feedback.models import Feedback
def corporation_benefit_plan(request):
return render(request... | mit | Python |
a7807665fada8f14cddee77310b3c036d8273d6c | Fix greedy/lazy algorithm of detecting multiline | everyonesdesign/OpenSearchInNewTab | OpenSearchInNewTab.py | OpenSearchInNewTab.py | import re
from threading import Timer
import sublime_plugin
import sublime
DEFAULT_NAME = 'Find Results'
ALT_NAME_BASE = DEFAULT_NAME + ' '
MAX_QUERY = 8
NEXT_LINE_SYMBOL = '↲'
def truncate(str):
return str[:MAX_QUERY].rstrip() + '...'if len(str) > MAX_QUERY else str
class OpenSearchInNewTab(sublime_plugin.Ev... | import re
from threading import Timer
import sublime_plugin
import sublime
DEFAULT_NAME = 'Find Results'
ALT_NAME_BASE = DEFAULT_NAME + ' '
MAX_QUERY = 8
NEXT_LINE_SYMBOL = '↲'
def truncate(str):
return str[:MAX_QUERY].rstrip() + '...'if len(str) > MAX_QUERY else str
class OpenSearchInNewTab(sublime_plugin.Ev... | mit | Python |
2858fd2b2f40901ac8969fd2a9cd812483125d9e | drop node names (going to do that from script) | couchbase-partners/google-deployment-manager-couchbase,couchbase-partners/google-deployment-manager-couchbase | cluster.py | cluster.py |
def GenerateConfig(context):
config={}
config['resources'] = []
runtimeconfigName = context.env['deployment'] + '-' + context.properties['cluster'] + '-runtimeconfig'
runtimeconfig = {
'name': runtimeconfigName,
'type': 'runtimeconfig.v1beta1.config',
'properties': {
... |
def GenerateConfig(context):
config={}
config['resources'] = []
runtimeconfigName = context.env['deployment'] + '-' + context.properties['cluster'] + '-runtimeconfig'
runtimeconfig = {
'name': runtimeconfigName,
'type': 'runtimeconfig.v1beta1.config',
'properties': {
... | apache-2.0 | Python |
5cad770eb96a80c9cb1a8914c0507ae6f2c15a81 | fix name | yuyu2172/chainercv,chainer/chainercv,pfnet/chainercv,yuyu2172/chainercv,chainer/chainercv | tests/dataset_tests/test_pickable_dataset.py | tests/dataset_tests/test_pickable_dataset.py | import unittest
from chainer import testing
from chainercv.dataset import PickableDataset
class SampleDataset(PickableDataset):
def __init__(self, len):
super(SampleDataset, self).__init__()
self.data_names = ('img', 'bbox', 'label', 'mask')
self.add_getter('img', self.get_image)
... | import unittest
from chainer import testing
from chainercv.dataset import PickableDataset
class SampleDataset(PickableDataset):
def __init__(self, len):
super(SampleDataset, self).__init__()
self.data_names = ('img', 'bbox', 'label', 'mask')
self.add_getter('img', self.get_image)
... | mit | Python |
cfe2a747460835172410727ae9c513354f18a88d | Fix relative path to .gitignore and other minor changes. | aleonliao/webrtc-trunk,svn2github/webrtc-Revision-8758,xin3liang/platform_external_chromium_org_third_party_webrtc,krieger-od/webrtc,SlimXperiments/external_chromium_org_third_party_webrtc,PersonifyInc/chromium_webrtc,krieger-od/nwjs_chromium_webrtc,CyanogenMod/android_external_chromium_org_third_party_webrtc,Alkalyne/... | build/extra_gitignore.py | build/extra_gitignore.py | #!/usr/bin/env python
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All c... | #!/usr/bin/env python
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All c... | bsd-3-clause | Python |
889485224516bbdfd33e96dd7f185f84792ecaf6 | Patch version 0.15.6 | pudo/spendb,USStateDept/FPA_Core,nathanhilbert/FPA_Core,johnjohndoe/spendb,openspending/spendb,spendb/spendb,openspending/spendb,pudo/spendb,nathanhilbert/FPA_Core,spendb/spendb,johnjohndoe/spendb,USStateDept/FPA_Core,CivicVision/datahub,spendb/spendb,pudo/spendb,nathanhilbert/FPA_Core,CivicVision/datahub,johnjohndoe/s... | openspending/_version.py | openspending/_version.py | __version__ = '0.15.6'
| __version__ = '0.15.5'
| agpl-3.0 | Python |
c38db6fdc4d686250b8a3b011858fa7f84cee9b3 | Fix North Tyneside script and tag it | andylolz/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,andylolz/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,andylolz/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_north_tyneside.py | polling_stations/apps/data_collection/management/commands/import_north_tyneside.py | """
Import North Tyneside
"""
import sys
from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseShpImporter
class Command(BaseShpImporter):
"""
Imports the Polling Station data from North Tyneside
"""
council_id = 'E08000022'
districts_name = 'NT_Polling_... | """
Import North Tyneside
"""
import sys
from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseShpImporter
class Command(BaseShpImporter):
"""
Imports the Polling Station data from North Tyneside
"""
council_id = 'E08000022'
districts_name = 'NT_Polling_... | bsd-3-clause | Python |
eaebb397fa1ab9dfd11d347bbf583108c21e584b | Make Import patterns 1.3 compatible | iheitlager/django-rest-framework,xiaotangyuan/django-rest-framework,MJafarMashhadi/django-rest-framework,aericson/django-rest-framework,atombrella/django-rest-framework,tomchristie/django-rest-framework,jpadilla/django-rest-framework,buptlsl/django-rest-framework,cheif/django-rest-framework,tomchristie/django-rest-fram... | rest_framework/tests/hyperlinkedserializers.py | rest_framework/tests/hyperlinkedserializers.py | from django.conf.urls.defaults import patterns, url
from django.test import TestCase
from django.test.client import RequestFactory
from rest_framework import generics, status, serializers
from rest_framework.tests.models import BasicModel
factory = RequestFactory()
class BasicList(generics.ListCreateAPIView):
mo... | from django.conf.urls import patterns, url
from django.test import TestCase
from django.test.client import RequestFactory
from rest_framework import generics, status, serializers
from rest_framework.tests.models import BasicModel
factory = RequestFactory()
class BasicList(generics.ListCreateAPIView):
model = Bas... | bsd-2-clause | Python |
97f5bc1ef18ba386d7a89246ffee0af256e32a97 | Fix #1691 | vuolter/pyload,vuolter/pyload,vuolter/pyload | module/plugins/hooks/LinkdecrypterComHook.py | module/plugins/hooks/LinkdecrypterComHook.py | # -*- coding: utf-8 -*-
import re
from module.plugins.internal.MultiHook import MultiHook
class LinkdecrypterComHook(MultiHook):
__name__ = "LinkdecrypterComHook"
__type__ = "hook"
__version__ = "1.07"
__status__ = "testing"
__config__ = [("activated" , "bool" , "Activa... | # -*- coding: utf-8 -*-
import re
from module.plugins.internal.MultiHook import MultiHook
class LinkdecrypterComHook(MultiHook):
__name__ = "LinkdecrypterComHook"
__type__ = "hook"
__version__ = "1.07"
__status__ = "testing"
__config__ = [("activated" , "bool" , "Activa... | agpl-3.0 | Python |
31c287394b764433d50c3bfef27f8c1052ac3856 | Expand tests for org perms | JackDanger/sentry,jean/sentry,nicholasserra/sentry,gencer/sentry,zenefits/sentry,looker/sentry,jean/sentry,gencer/sentry,zenefits/sentry,JamesMura/sentry,ifduyue/sentry,JamesMura/sentry,mvaled/sentry,BuildingLink/sentry,gencer/sentry,JamesMura/sentry,beeftornado/sentry,zenefits/sentry,zenefits/sentry,daevaorn/sentry,al... | tests/sentry/web/frontend/test_react_page.py | tests/sentry/web/frontend/test_react_page.py | from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.testutils import TestCase
class ReactPageViewTest(TestCase):
def test_superuser_can_load(self):
org = self.create_organization(owner=self.user)
path = reverse('sentry-organization-home', args=[org.slu... | from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.testutils import TestCase
class ReactPageViewTest(TestCase):
def test_renders_with_context(self):
org = self.create_organization(owner=self.user)
path = reverse('sentry-organization-home', args=[org.s... | bsd-3-clause | Python |
48dff3d8d2e8ad51ab16a2c116cb079f86e68fcd | Fix download link on homepage (#109) | gratipay/aspen.py,gratipay/aspen.py | doc/.aspen/configure-aspen.py | doc/.aspen/configure-aspen.py | import os
from aspen.configuration import parse
from aspen_io import opts, inbound
opts['show_ga'] = parse.yes_no(os.environ.get( 'ASPEN_IO_SHOW_GA'
, 'no'
).decode('US-ASCII'))
opts['base'] = ''
opts['version'] = open('../ver... | import os
from aspen.configuration import parse
from aspen_io import opts, inbound
opts['show_ga'] = parse.yes_no(os.environ.get( 'ASPEN_IO_SHOW_GA'
, 'no'
).decode('US-ASCII'))
opts['base'] = ''
opts['version'] = open('../ver... | mit | Python |
ac02aff575e0e87f6a5e921d09c56d493611943d | hide dropping message in json package file (#6070) | esp8266/Arduino,sticilface/Arduino,sticilface/Arduino,esp8266/Arduino,sticilface/Arduino,sticilface/Arduino,esp8266/Arduino,esp8266/Arduino,esp8266/Arduino,sticilface/Arduino | package/drop_versions.py | package/drop_versions.py | #!/usr/bin/env python
# This script drops one or multiple versions of a release
#
from __future__ import print_function
import json
import sys
def load_package(filename):
if filename == "-":
pkg = json.load(sys.stdin)['packages'][0]
else:
pkg = json.load(open(filename))['packages'][0]
print... | #!/usr/bin/env python
# This script drops one or multiple versions of a release
#
from __future__ import print_function
import json
import sys
def load_package(filename):
if filename == "-":
pkg = json.load(sys.stdin)['packages'][0]
else:
pkg = json.load(open(filename))['packages'][0]
print... | lgpl-2.1 | Python |
a9b55ebc4e5b38ab9b148ba3f4923a9790f78c2e | check for valid flashconfig | tauvetech/firmware-robovero,nickng/hexacopter-firmware,dnnychan/aerodroid,robovero/firmware,nickng/hexacopter-firmware,nickng/hexacopter-firmware,tauvetech/firmware-robovero,robovero/firmware,dnnychan/aerodroid,tauvetech/firmware-robovero,dnnychan/aerodroid | flash.py | flash.py | #!/usr/bin/env python
import os, subprocess, sys, time, os, platform, json
arch = platform.machine()
debug = open("debug.log", "w")
ESC = chr(27)
try:
config_file = open("flashconfig")
except:
exit("\n"
"ERROR: flashconfig not found. try:\n"
" $ cp flashconfig.sample flashconfig\n"
" set OPENOCD_PATH and GDB_... | #!/usr/bin/env python
import os, subprocess, sys, time, os, platform, json
arch = platform.machine()
debug = open("debug.log", "w")
ESC = chr(27)
config = json.load(open("flashconfig"))
print "getting sudo password"
sudo_cmd = "sudo echo".split()
if subprocess.call(sudo_cmd):
raw_input("error: wrong password")
exi... | bsd-2-clause | Python |
d791b593dbf3d6505bf9eac8766aaf0b7f22c721 | Disable the extra check by default | Astroua/aws_controller,Astroua/aws_controller | launch_instance.py | launch_instance.py | # License under the MIT License - see LICENSE
import boto.ec2
import os
import time
def launch(key_name=None, region='us-west-2', image_id='ami-5189a661',
instance_type='t2.micro', security_groups='launch-wizard-1',
user_data=None, initial_check=False):
'''
'''
if not isinstance(se... | # License under the MIT License - see LICENSE
import boto.ec2
import os
import time
def launch(key_name=None, region='us-west-2', image_id='ami-5189a661',
instance_type='t2.micro', security_groups='launch-wizard-1',
user_data=None, initial_check=True):
'''
'''
if not isinstance(sec... | mit | Python |
ece8538e44a3dcc0e4b94182c79a201e44980c15 | Use argparse for argument parsing | sim0629/irc | scripts/irccat.py | scripts/irccat.py | #! /usr/bin/env python
#
# Example program using irc.client.
#
# This program is free without restrictions; do anything you like with
# it.
#
# Joel Rosdahl <joel@rosdahl.net>
import argparse
import irc.client
import sys
target = None
"The nick or channel to which to send messages"
def on_connect(connection, event):... | #! /usr/bin/env python
#
# Example program using irc.client.
#
# This program is free without restrictions; do anything you like with
# it.
#
# Joel Rosdahl <joel@rosdahl.net>
import irc.client
import sys
target = None
"The nick or channel to which to send messages"
def on_connect(connection, event):
if irc.clie... | lgpl-2.1 | Python |
9596c7690af30618d2dfe4314b4d124036d0a79f | Remove recursion in cache path resolution. | smaccm/camkes-tool,agacek/camkes-tool,agacek/camkes-tool,smaccm/camkes-tool,smaccm/camkes-tool,agacek/camkes-tool,smaccm/camkes-tool | camkes/internal/cache.py | camkes/internal/cache.py | #
# Copyright 2014, NICTA
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE_BSD2.txt" for details.
#
# @TAG(NICTA_BSD)
#
'''Compilation caching infrastructure for the code generator. Nothing in here
is actually CAmk... | #
# Copyright 2014, NICTA
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE_BSD2.txt" for details.
#
# @TAG(NICTA_BSD)
#
'''Compilation caching infrastructure for the code generator. Nothing in here
is actually CAmk... | bsd-2-clause | Python |
af74ee7ee8644392eacca207b4344de2e08105d7 | Add todo for future work | nagilum/script.rndmov | addon.py | addon.py | import xbmc,xbmcaddon,xbmcgui,json,random
def getAllMovies():
# TODO: determine all/unwatched/watched from settings...
# rpccmd = {'jsonrpc': '2.0', 'method': 'VideoLibrary.GetMovies', 'params': { 'filter': { 'field': 'playcount', 'operator': 'lessthan', 'value': '1' }, 'properties': [ 'file' ] }, 'id': 'libMovie... | import xbmc,xbmcaddon,xbmcgui,json,random
def getAllMovies():
rpccmd = {'jsonrpc': '2.0', 'method': 'VideoLibrary.GetMovies', 'params': { 'properties': [ 'file' ] }, 'id': 'libMovies'}
rpccmd = json.dumps(rpccmd)
result = xbmc.executeJSONRPC(rpccmd)
result = json.loads(result)
return result
addon = xbm... | mit | Python |
c7dca5cea67b22fc1b416d6ffb15996eac635ef7 | update Lewes | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_lewes.py | polling_stations/apps/data_collection/management/commands/import_lewes.py | from data_collection.management.commands import BaseHalaroseCsvImporter
class Command(BaseHalaroseCsvImporter):
council_id = "E07000063"
addresses_name = "local.2019-05-02/Version 3/polling_station_export-2019-03-13.csv"
stations_name = "local.2019-05-02/Version 3/polling_station_export-2019-03-13.csv"
... | from data_collection.management.commands import BaseHalaroseCsvImporter
class Command(BaseHalaroseCsvImporter):
council_id = "E07000063"
addresses_name = "local.2019-05-02/Version 2/polling_station_export-2019-03-08.csv"
stations_name = "local.2019-05-02/Version 2/polling_station_export-2019-03-08.csv"
... | bsd-3-clause | Python |
bd1e62c3b26fe42ec00aedbdb076f1e7bd3e43c7 | Add TODOs for checking existence of local file in cache_download() | ronrest/convenience_py,ronrest/convenience_py | convenience/file_convenience/cache_download.py | convenience/file_convenience/cache_download.py | from __future__ import print_function
import os
from urllib import urlretrieve
#===============================================================================
# CACHE_DOWNLOAD
#============================================================================... | from __future__ import print_function
import os
from urllib import urlretrieve
#===============================================================================
# CACHE_DOWNLOAD
#============================================================================... | apache-2.0 | Python |
163cca00d1a40473aab139c881f8f3f3ed3b5fe0 | Use Django 1.9 on_commit hook | roverdotcom/celery-haystack | celery_haystack/utils.py | celery_haystack/utils.py | from django.core.exceptions import ImproperlyConfigured
try:
from importlib import import_module
except ImportError:
from django.utils.importlib import import_module
from django.db import connection, transaction
from haystack.utils import get_identifier
from .conf import settings
def get_update_task(task_pa... | from django.core.exceptions import ImproperlyConfigured
try:
from importlib import import_module
except ImportError:
from django.utils.importlib import import_module
from django.db import connection
from haystack.utils import get_identifier
from .conf import settings
def get_update_task(task_path=None):
... | bsd-3-clause | Python |
58b5ee095f20c7acc1bdfa14f50ebbcebf75dae4 | Update version.py | materials-data-facility/forge | mdf_forge/version.py | mdf_forge/version.py | # Single source of truth for package version
__version__ = "0.8.0"
| # Single source of truth for package version
__version__ = "0.7.6"
| apache-2.0 | Python |
5a258bf8f24c3af493d6f8da41685a95f18093b1 | fix to flush stdout | hvy/chainer,okuta/chainer,chainer/chainer,chainer/chainer,wkentaro/chainer,jnishi/chainer,pfnet/chainer,niboshi/chainer,ktnyt/chainer,ktnyt/chainer,chainer/chainer,hvy/chainer,keisuke-umezawa/chainer,hvy/chainer,rezoo/chainer,hvy/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,ronekko/chainer,wkentaro/chainer,n... | chainer/_runtime_info.py | chainer/_runtime_info.py | import sys
import numpy
import six
import chainer
from chainer.backends import cuda
class _RuntimeInfo(object):
chainer_version = None
numpy_version = None
cuda_info = None
def __init__(self):
self.chainer_version = chainer.__version__
self.numpy_version = numpy.__version__
... | import sys
import numpy
import six
import chainer
from chainer.backends import cuda
class _RuntimeInfo(object):
chainer_version = None
numpy_version = None
cuda_info = None
def __init__(self):
self.chainer_version = chainer.__version__
self.numpy_version = numpy.__version__
... | mit | Python |
c7056a42775cdc7db14841d9a6803968e974e335 | Add an example regarding matcher with failure message. | rudylattae/compare,rudylattae/compare | compare.py | compare.py | """The compare module contains the components you need to
compare values and ensure that your expectations are met.
To make use of this module, you simply import the "expect"
starter into your spec/test file, and specify the expectation
you have about two values.
The expect starter is simply an alias to the Expr clas... | """The compare module contains the components you need to
compare values and ensure that your expectations are met.
To make use of this module, you simply import the "expect"
starter into your spec/test file, and specify the expectation
you have about two values.
The expect starter is simply an alias to the Expr clas... | bsd-3-clause | Python |
5297c82a7396ccac66328e63f43e90ba8ddda120 | Fix admin | Jeoffreybauvin/puppenc,Jeoffreybauvin/puppenc | admin.py | admin.py | from flask import Flask
from flask_admin import Admin
from flask_admin.contrib.sqla import ModelView
from flask_sqlalchemy import SQLAlchemy
# Puppenc
from app.puppenc import api, db, output_yaml
from app.classes.models import Class
from app.nodes.models import Node
from app.environments.models import Environment
from... | from flask import Flask
from flask_admin import Admin
from flask_admin.contrib.sqla import ModelView
# Puppenc
from app.puppenc import api, db, output_yaml
from app.classes.models import Class
from app.nodes.models import Node
from app.environments.models import Environment
from app.hostgroups.models import Hostgroup
... | apache-2.0 | Python |
f4970f9707738dfd5e5098bb41d868f9b6fc2fe8 | Fix canny import test | ClinicalGraphics/scikit-image,blink1073/scikit-image,newville/scikit-image,ajaybhat/scikit-image,WarrenWeckesser/scikits-image,rjeli/scikit-image,pratapvardhan/scikit-image,paalge/scikit-image,paalge/scikit-image,blink1073/scikit-image,bennlich/scikit-image,newville/scikit-image,youprofit/scikit-image,ajaybhat/scikit-i... | skimage/filters/tests/test_deprecated_imports.py | skimage/filters/tests/test_deprecated_imports.py | from warnings import catch_warnings, simplefilter
from ..._shared._warnings import expected_warnings
from ...data import moon
def test_filter_import():
with catch_warnings():
simplefilter('ignore')
from skimage import filter as F
assert('sobel' in dir(F))
assert F._import_warned
def tes... | from warnings import catch_warnings, simplefilter
def test_filter_import():
with catch_warnings():
simplefilter('ignore')
from skimage import filter as F
assert('sobel' in dir(F))
assert F._import_warned
def test_canny_import():
with catch_warnings():
simplefilter('ignore')
... | bsd-3-clause | Python |
f9bd65e751cd78cb1a23d2af8b06b7b6c5ff7dda | add real prod_settings.py | kartta-labs/noter-backend,kartta-labs/noter-backend | noter_backend/noter_backend/prod_settings.py | noter_backend/noter_backend/prod_settings.py | """
Copyright 2020 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, software
d... | """
Copyright 2020 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, software
d... | apache-2.0 | Python |
9bfeac9cdb0e5238608eebafb3ed14a0b40736e1 | add mostly superflous tests for zhi standardize | gnarph/DIRT,gnarph/DIRT | preprocessing/language_standardizer/tests.py | preprocessing/language_standardizer/tests.py | import codecs
import os
import unittest
import cjson
import preprocessing.language_standardizer.zhi as zhi
NEWS_DATA_FILE = 'test_data/zhi_news.txt'
NEWS_2_DATA_FILE = 'test_data/zhi_news_2.txt'
NEWS_TRAD_DATA_FILE = 'test_data/zhi_news_trad.txt'
NEWS_SEG_FILE = 'test_data/zhi_news_segmented.json'
NEWS_2_SEG_FILE ... | import codecs
import os
import unittest
import cjson
import preprocessing.language_standardizer.zhi as zhi
NEWS_DATA_FILE = 'test_data/zhi_news.txt'
NEWS_2_DATA_FILE = 'test_data/zhi_news_2.txt'
NEWS_TRAD_DATA_FILE = 'test_data/zhi_news_trad.txt'
NEWS_SEG_FILE = 'test_data/zhi_news_segmented.json'
NEWS_2_SEG_FILE ... | mit | Python |
5f67fb047126ac359de07b325b4ef07ccfeae8bb | Update first-unique-character-in-a-string.py | yiwen-luo/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,githubutilities/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,githubutilities/LeetCode,yiwen-luo/LeetCode,githubutilities/LeetCode,jaredkoontz/leetcode,tudennis/Lee... | Python/first-unique-character-in-a-string.py | Python/first-unique-character-in-a-string.py | # Time: O(n)
# Space: O(n)
# Given a string, find the first non-repeating character in it and
# return it's index. If it doesn't exist, return -1.
#
# Examples:
#
# s = "leetcode"
# return 0.
#
# s = "loveleetcode",
# return 2.
# Note: You may assume the string contain only lowercase letters.
from collections impor... | # Time: O(n)
# Space: O(n)
# Given a string, find the first non-repeating character in it and
# return it's index. If it doesn't exist, return -1.
#
# Examples:
#
# s = "leetcode"
# return 0.
#
# s = "loveleetcode",
# return 2.
# Note: You may assume the string contain only lowercase letters.
from collections impor... | mit | Python |
78c2fcf0879cede3e61c75babf4b1396dd349aff | Add more torch.hub deps | pytorch/fairseq,pytorch/fairseq,pytorch/fairseq | hubconf.py | hubconf.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from fairseq.models import MODEL_R... | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from fairseq.models import MODEL_R... | mit | Python |
b17b9c77bf520eb88084992215e2d056f7b78ae4 | call rabbyt setup functions as described by documentation (although they don't seem to do anything.) Use rabbyt util to clear screen, simplifying our code. | tartley/zerkcom | tanks/view/window.py | tanks/view/window.py | import pyglet
import rabbyt
from ..image import load_all
from . import sprite
CLEAR_COLOR_DEFAULT = (0.1, 0.3, 0.2)
def clear(color=CLEAR_COLOR_DEFAULT):
rabbyt.clear(rgba=CLEAR_COLOR_DEFAULT)
def init(world, options):
window = pyglet.window.Window(
fullscreen=options.fullscreen,
vsync=o... | import pyglet
from pyglet import gl
from ..image import load_all
from . import sprite
CLEAR_COLOR_DEFAULT = (0.1, 0.2, 0.3, 1.0)
def clear(color=CLEAR_COLOR_DEFAULT):
r, g, b, _ = color
gl.glClearColor(r, g, b, 1.0)
gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
def init(world, options):... | bsd-3-clause | Python |
3daf5be348db7c278c3cc190be04fce89b991c04 | fix spacing | marshki/pyWipe,marshki/pyWipe | posix.py | posix.py | #!/bin/py
# check if POSIX
import os
def osCheck():
if 'posix' not in os.name:
print("Non-POSIX system detected")
osCheck()
| #!/bin/py
#from sys import platform
import os
def osCheck():
# Check if OS is UNIX-y
if 'posix' not in os.name:
print("Non-POSIX system detected")
osCheck()
| mit | Python |
7d26a66f66bf55d5bb2dce61081f24827180abc5 | use is_dimagi property | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/couch_sql_migration/progress.py | corehq/apps/couch_sql_migration/progress.py | from django.conf import settings
from corehq.apps.domain_migration_flags.api import (
set_migration_started, set_migration_not_started,
get_migration_status)
from corehq.apps.domain_migration_flags.models import MigrationStatus, DomainMigrationProgress
from corehq.apps.tzmigration.api import set_tz_migration_c... | from django.conf import settings
from corehq.apps.domain_migration_flags.api import (
set_migration_started, set_migration_not_started,
get_migration_status)
from corehq.apps.domain_migration_flags.models import MigrationStatus, DomainMigrationProgress
from corehq.apps.tzmigration.api import set_tz_migration_c... | bsd-3-clause | Python |
83c963a994336f4ca597adc00b8bd7d0a4fe5e33 | Add missing metadata test | MOLSSI-BSE/basis_set_exchange | basis_set_exchange/tests/test_metadata.py | basis_set_exchange/tests/test_metadata.py | """
Tests for BSE metadata
"""
import tempfile
import json
import os
import pytest
import glob
from basis_set_exchange import api, curate, fileio
from .common_testvars import data_dir, all_table_files, all_metadata_files
def test_get_metadata():
'''Test the get_metadata function in the API'''
api.get_metad... | """
Tests for BSE metadata
"""
import tempfile
import json
import os
import pytest
from basis_set_exchange import api, curate, fileio
from .common_testvars import data_dir, all_table_files, all_metadata_files
def test_get_metadata():
'''Test the get_metadata function in the API'''
api.get_metadata(data_dir... | bsd-3-clause | Python |
1458d584d91286f686f638ab0f88bb97bf887ef5 | allow to run script for a longer period | regardscitoyens/nosdeputes.fr,regardscitoyens/nosdeputes.fr,regardscitoyens/nosdeputes.fr,regardscitoyens/nosdeputes.fr,regardscitoyens/nosdeputes.fr | batch/amendements/download_amendements.py | batch/amendements/download_amendements.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import sys
import datetime
import requests
import bs4
legislature = sys.argv[1] if len(sys.argv) > 1 else 15
daysback = int(sys.argv[2]) if len(sys.argv) > 2 else 7
count = 0
datefin = datetime.datetime.now()
datedebut = da... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import sys
import datetime
import requests
import bs4
legislature = sys.argv[1] if len(sys.argv) > 1 else 15
count = 0
datefin = datetime.datetime.now()
datedebut = datetime.datetime.now() - datetime.timedelta(days=7)
whil... | agpl-3.0 | Python |
11150d1717bd93ebce0c9f2ceb54c7703163e78b | Add logout handler. | Solucionamos/dummybmc | connection/http_connection.py | connection/http_connection.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
"""
import cherrypy
class HttpConnection(object):
def __init__(self, server, port=8080):
self.__server = server
cherrypy.server.socket_port = port
cherrypy.server.socket_host = '0.0.0.0'
cherrypy.tree.mount(self.... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
"""
import cherrypy
class HttpConnection(object):
def __init__(self, server, port=8080):
self.__server = server
cherrypy.server.socket_port = port
cherrypy.server.socket_host = '0.0.0.0'
cherrypy.tree.mount(self.... | apache-2.0 | Python |
43460021bb57b9018a21507da41ac74b132783c4 | write create and destroy functions | BradleyMoore/Game_of_Life | app/cells.py | app/cells.py | class Cell(object):
def __init__(self):
self.neighbors = 0
self.numtobirth = (3)
self.numtolive = (2, 3)
self.status = ''
def count_neighbors(self, live_board):
def create(self, neighbors):
if self.status == 'dead'
if neighbors in self.numtobirth:
... | mit | Python | |
6b18782cb74ef301ac5fed28003c7a8130c75574 | bump pymysql from 0.9.2 to 1.0.2 in /app | macbre/wbc.macbre.net,macbre/wbc.macbre.net,macbre/wbc.macbre.net,macbre/wbc.macbre.net | app/setup.py | app/setup.py | from setuptools import setup, find_packages
# @see https://github.com/pypa/sampleproject/blob/master/setup.py
setup(
name='wbc',
version='0.0.0',
author='Maciej Brencz',
author_email='maciej.brencz@gmail.com',
description='Flask app providing WBC archives API',
url='https://github.com/macbre/wb... | from setuptools import setup, find_packages
# @see https://github.com/pypa/sampleproject/blob/master/setup.py
setup(
name='wbc',
version='0.0.0',
author='Maciej Brencz',
author_email='maciej.brencz@gmail.com',
description='Flask app providing WBC archives API',
url='https://github.com/macbre/wb... | mit | Python |
fcb91ea6d14ed9d628f3167b4f257f87b6a1ed04 | Fix user import | cburmeister/flask-bones,cburmeister/flask-bones,cburmeister/flask-bones | app/tasks.py | app/tasks.py | from flask import render_template
from app.extensions import celery, mail
from app.database import db
from celery.signals import task_postrun
from flask_mail import Message
@celery.task
def send_registration_email(uid, token):
from app.user.models import User
user = User.query.filter_by(id=uid).first()
m... | from flask import render_template
from app.extensions import celery, mail
from app.database import db
from celery.signals import task_postrun
from flask_mail import Message
@celery.task
def send_registration_email(uid, token):
from models.user import User
user = User.query.filter_by(id=uid).first()
msg = ... | mit | Python |
c13b2687c1909f9037a09809be5b5533a8e55493 | Fix bug with reading category configuration | bbayles/vod_metadata | parse_config.py | parse_config.py | # VOD metadata file generator - parse_config sub-module
# Copyright 2013 Bo Bayles (bbayles@gmail.com)
# See README for more information
# See LICENSE for license
import configparser
class ConfigurationError(Exception):
pass
def parse_config(config_path):
config = configparser.ConfigParser()
_ = config.read(con... | # VOD metadata file generator - parse_config sub-module
# Copyright 2013 Bo Bayles (bbayles@gmail.com)
# See README for more information
# See LICENSE for license
import configparser
class ConfigurationError(Exception):
pass
def parse_config(config_path):
config = configparser.ConfigParser()
_ = config.read(con... | mit | Python |
81f88d517816e8ec4085c9d599738a0dc890df06 | Test connections | lodrantl/PMSensor,lodrantl/PMSensor,lodrantl/PMSensor,lodrantl/PMSensor | connector/dbwriter.py | connector/dbwriter.py | from configparser import ConfigParser
from influxdb import SeriesHelper, InfluxDBClient
from connector.pmreader import PMReader
config_parser = ConfigParser()
config_parser.read('pmsensor.ini')
config = config_parser['DEFAULT']
print(config['host'])
myclient = InfluxDBClient(config['host'], int(config['port']), co... | from configparser import ConfigParser
from influxdb import SeriesHelper, InfluxDBClient
from connector.pmreader import PMReader
config_parser = ConfigParser()
config_parser.read('pmsensor.ini')
config = config_parser['DEFAULT']
print(config['host'])
myclient = InfluxDBClient(config['host'], int(config['port']), co... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.