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 |
|---|---|---|---|---|---|---|---|---|
753f5bdc3f023cf31c0f189dd835978aad2b5d49 | Change url in favor of the re_path | summernote/django-summernote,summernote/django-summernote,summernote/django-summernote | djs_playground/urls.py | djs_playground/urls.py | from django.conf import settings
from django.urls import re_path, include
from django.conf.urls.static import static
from django.contrib import admin
from djs_playground.views import index
urlpatterns = [
re_path(r'^$', index, name='index'),
re_path(r'^admin/', admin.site.urls),
re_path(r'^summernote/', in... | from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib import admin
from djs_playground.views import index
urlpatterns = [
url(r'^$', index, name='index'),
url(r'^admin/', admin.site.urls),
url(r'^summernote/', include('djan... | mit | Python |
23e7abbfe1a8b0c81bbbf9245d408ff9e4108eb7 | Use the loop. | Magnetic/opencv-cffi | example.py | example.py | """
Now you're symmetric! Maybe. Sort of.
Usage:
$ pypy example.py ~/Desktop/haarcascade_frontalface_default.xml
"""
from time import time
import sys
from bp.filepath import FilePath
from opencv_cffi.core import Color, invert
from opencv_cffi.imaging import Camera
from opencv_cffi.gui import ESCAPE, Window
fr... | """
Now you're symmetric! Maybe. Sort of.
Usage:
$ pypy example.py ~/Desktop/haarcascade_frontalface_default.xml
"""
from time import time
import itertools
import sys
from bp.filepath import FilePath
from opencv_cffi.core import Color, invert
from opencv_cffi.imaging import Camera
from opencv_cffi.gui import ... | mit | Python |
ae7f8143ffadb5a946d08fd1ef8006155ad5d459 | fix title in example | lepture/burglar | example.py | example.py | # coding: utf-8
import logging
from burglar import Burglar, logger
formatter = logging.Formatter(
'[%(asctime)s %(levelname)s %(filename)s:%(lineno)d]: %(message)s'
)
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.setLevel(logging.INFO)
site = Burglar('_site'... | # coding: utf-8
import logging
from burglar import Burglar, logger
formatter = logging.Formatter(
'[%(asctime)s %(levelname)s %(filename)s:%(lineno)d]: %(message)s'
)
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.setLevel(logging.INFO)
site = Burglar('_site'... | bsd-3-clause | Python |
ecbbd1cd2c8dd7d3ca22ad39814e30900496a5d9 | Remove an unused import | tochev/obshtestvo.bg,tochev/obshtestvo.bg,tochev/obshtestvo.bg | fabfile.py | fabfile.py | from fabric.api import *
env.hosts = ['obshtestvo@tmp.obshtestvo.bg']
env.project_root = '/home/obshtestvo/obshtestvo.bg'
env.repository_url = 'https://github.com/obshtestvo/obshtestvo.bg.git'
env.virtual_env_name = 'obshtestvobg' # leave blank if you don't use virtualenvwrapper
def run_within_virtua... | from fabric.api import *
from fabric.contrib.console import confirm
env.hosts = ['obshtestvo@tmp.obshtestvo.bg']
env.project_root = '/home/obshtestvo/obshtestvo.bg'
env.repository_url = 'https://github.com/obshtestvo/obshtestvo.bg.git'
env.virtual_env_name = 'obshtestvobg' # leave blank if you don't u... | unlicense | Python |
5a641736faf6bb3ce335480848464a1f22fab040 | Make Fabric honor .ssh/config settings | zsiciarz/variablestars.net,zsiciarz/variablestars.net,zsiciarz/variablestars.net | fabfile.py | fabfile.py | # -*- coding: utf-8 -*-
from contextlib import nested
from fabric.api import *
def prepare_project():
u"""
Enters the directory and sources environment configuration.
I know ``nested`` is deprecated, but what a nice shortcut it is here ;)
"""
return nested(
cd(PROJECT_PATH),
pre... | # -*- coding: utf-8 -*-
from contextlib import nested
from fabric.api import *
def prepare_project():
u"""
Enters the directory and sources environment configuration.
I know ``nested`` is deprecated, but what a nice shortcut it is here ;)
"""
return nested(
cd(PROJECT_PATH),
pre... | mit | Python |
e70ba50a30b61a0458d7b107889f21d74bdd10ce | Use bumblebee.util.asbool function | tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status | bumblebee/modules/title.py | bumblebee/modules/title.py | # pylint: disable=C0111,R0903
"""Displays focused i3 window title.
Requirements:
* i3ipc
Parameters:
* title.max : Maximum character length for title before truncating. Defaults to 64.
* title.placeholder : Placeholder text to be placed if title was truncated. Defaults to "...".
* title.scroll : Bool... | # pylint: disable=C0111,R0903
"""Displays focused i3 window title.
Requirements:
* i3ipc
Parameters:
* title.max : Maximum character length for title before truncating. Defaults to 64.
* title.placeholder : Placeholder text to be placed if title was truncated. Defaults to "...".
* title.scroll : Bool... | mit | Python |
51f4b25fc36b8050d99339e31b747639b6b9a262 | Index fewer empty localities | jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,stev-0/bustimes.org.uk,jclgoodwin/bustimes.org.uk,stev-0/bustimes.org.uk,stev-0/bustimes.org.uk,stev-0/bustimes.org.uk,stev-0/bustimes.org.uk,jclgoodwin/bustimes.org.uk | busstops/search_indexes.py | busstops/search_indexes.py | from haystack import indexes
from busstops.models import Locality, Operator, Service
from django.db.models import Q
class LocalityIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, model_attr='get_qualified_name')
def get_model(self):
return Locality
def index... | from haystack import indexes
from busstops.models import Locality, Operator, Service
class LocalityIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, model_attr='get_qualified_name')
def get_model(self):
return Locality
def index_queryset(self, using=None):
... | mpl-2.0 | Python |
cace72b569b3e38fc014fbab3df18a15f7b94042 | Update fabfile so we can pdb | clouserw/tower | fabfile.py | fabfile.py | """
Creating standalone Django apps is a PITA because you're not in a project, so
you don't have a settings.py file. I can never remember to define
DJANGO_SETTINGS_MODULE, so I run these commands which get the right env
automatically.
"""
import functools
import os
from fabric.api import local, cd, env
from fabric.con... | """
Creating standalone Django apps is a PITA because you're not in a project, so
you don't have a settings.py file. I can never remember to define
DJANGO_SETTINGS_MODULE, so I run these commands which get the right env
automatically.
"""
import functools
import os
from fabric.api import local, cd, env
from fabric.con... | bsd-3-clause | Python |
877d432c569bf3aa6a49256fea6b1bf45031e7e2 | Add mkmigration to fabfile | UrLab/incubator,UrLab/incubator,UrLab/incubator,UrLab/incubator | fabfile.py | fabfile.py | from fabric.api import run, cd
from fabric.context_managers import prefix
def deploy():
code_dir = '/home/www-data/incubator'
with cd(code_dir), prefix('source ve/bin/activate'):
run('sudo supervisorctl stop incubator')
run("./save_db.sh")
run("git pull")
run("pip install -r re... | from fabric.api import run, cd
from fabric.context_managers import prefix
def deploy():
code_dir = '/home/www-data/incubator'
with cd(code_dir), prefix('source ve/bin/activate'):
run('sudo supervisorctl stop incubator')
run("./save_db.sh")
run("git pull")
run("pip install -r re... | agpl-3.0 | Python |
4ff58ba09df11f0a7a7164bd8d4ce50a96248b10 | use .settings.dev as default settings in manage.py | tylerreinhart/generator-django-kaiju,tylerreinhart/generator-django-kaiju,mixxorz/generator-django-kaiju,mixxorz/generator-django-kaiju,mixxorz/generator-django-kaiju,tylerreinhart/generator-django-kaiju | app/templates/manage.py | app/templates/manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "<%= projectName %>.settings.dev")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "<%= projectName %>.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| mit | Python |
dd972c530d0bdfedd07dc25c8f8da09c05834f00 | Simplify fabfile. | bueda/django-comrade | fabfile.py | fabfile.py | #!/usr/bin/env python
import os
from fabric.api import *
from fabric.contrib.console import confirm
from fab_shared import (_nose_test_runner, _test as test,
_package_deploy as deploy)
env.unit = "django-comrade"
env.root_dir = os.path.abspath(os.path.dirname(__file__))
env.scm = env.root_dir
env.allow_no_tag... | #!/usr/bin/env python
import os
from fabric.api import *
from fabric.contrib.console import confirm
from fab_shared import _nose_test, _test, _package_deploy as deploy
env.unit = "django-comrade"
env.root_dir = os.path.abspath(os.path.dirname(__file__))
env.scm = env.root_dir
env.allow_no_tag = True
env.upload_to_s3 ... | mit | Python |
855aa6066299b4c305eb8b73057e7564b80ae7fa | Update build script | acreations/rockit-server,acreations/rockit-server,acreations/rockit-server,acreations/rockit-server | fabfile.py | fabfile.py | from fabric.api import local
from fabric.api import warn_only
def auto_migrate():
with warn_only():
local('python manage.py schemamigration rockit.foundation.core --auto')
def build():
migrate('rockit.foundation.core')
local('python manage.py test')
def migrate(app):
local('python manage.py migrate ' + app)
... | from fabric.api import local
from fabric.api import warn_only
def auto_migrate():
with warn_only():
local('python manage.py schemamigration rockit.foundation.core --auto')
def setup(environment):
local('pip install -r requirements/' + environment) | mit | Python |
77abab9505e87697fc8a04889a171555d3d1b945 | read better | timothydmorton/qa_explorer,timothydmorton/qa_explorer | apps/qa-browser/main.py | apps/qa-browser/main.py | import yaml
import numpy as np
import holoviews as hv
from bokeh.application.handlers import FunctionHandler
from bokeh.application import Application
from bokeh.io import show, curdoc
from bokeh.layouts import layout
from bokeh.models import Slider, Button, TextInput
from bokeh.models.widgets import Panel, Tabs
from... | import yaml
import numpy as np
import holoviews as hv
from bokeh.application.handlers import FunctionHandler
from bokeh.application import Application
from bokeh.io import show, curdoc
from bokeh.layouts import layout
from bokeh.models import Slider, Button, TextInput
from bokeh.models.widgets import Panel, Tabs
from... | mit | Python |
8b8dc22696bd546a19dd898a853c260dcac96a87 | Fix azure common pkg page display (#10983) | Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python | sdk/core/azure-common/setup.py | sdk/core/azure-common/setup.py | #!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | #!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | mit | Python |
2a76a9af67fe18b88eea266abb244fbbd93b489c | Hide search box in static sites | indico/indico-plugins,ThiefMaster/indico-plugins,indico/indico-plugins,indico/indico-plugins,indico/indico-plugins,ThiefMaster/indico-plugins,ThiefMaster/indico-plugins,ThiefMaster/indico-plugins | search/indico_search/plugin.py | search/indico_search/plugin.py | # This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | # This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | mit | Python |
10450974c99f5d5110b8fe4bf82cb96b4bb0f5be | fix in_terminal | cr33dog/pyxfce,cr33dog/pyxfce,cr33dog/pyxfce | gui/gui.py | gui/gui.py | #!/usr/bin/env python
from _gui import *
#!/usr/bin/env python
import xfce4
import gtk
import os
def spawn_xyz(spawner, use_startup_notification = True, screen = None, environment = None):
if screen == None:
screen = gtk.gdk.screen_get_default()
if use_startup_notification == True:
id = xfce4.gui.s... | #!/usr/bin/env python
from _gui import *
#!/usr/bin/env python
import xfce4
import gtk
import os
def spawn_xyz(spawner, in_terminal = False, use_startup_notification = True, screen = None, environment = None):
if screen == None:
screen = gtk.gdk.screen_get_default()
if use_startup_notification == True:... | bsd-3-clause | Python |
9ed2966a49245e9bff084d9a4651615918481339 | Update perseus_tags.py | jayoshih/content-curation,fle-internal/content-curation,fle-internal/content-curation,jayoshih/content-curation,jayoshih/content-curation,aronasorman/content-curation,aronasorman/content-curation,DXCanas/content-curation,DXCanas/content-curation,jonboiser/content-curation,fle-internal/content-curation,jonboiser/content... | contentcuration/contentcuration/templatetags/perseus_tags.py | contentcuration/contentcuration/templatetags/perseus_tags.py | import json
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter
@stringfilter
def jsonify(value):
return json.dumps(value, ensure_ascii=False)[1:-1]
| import json
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter
@stringfilter
def jsonify(value):
return json.dumps(value)[1:-1]
| mit | Python |
0ab46a0f5405e313a71638c19fd5d100b8e3b4c5 | refactor and apply translations to thanks. | 1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow | oneflow/landing/views.py | oneflow/landing/views.py | # -*- coding: utf-8 -*-
import logging
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.contrib.auth.models import User
from django.shortcuts import render
from django.utils.translation import get_language
from forms import LandingPageForm
from models import Landing... | # -*- coding: utf-8 -*-
import logging
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.contrib.auth.models import User
from django.shortcuts import render
from django.utils.translation import get_language
from forms import LandingPageForm
from models import Landing... | agpl-3.0 | Python |
2e04c380c8d40c44999aad8dcbb5dcca1a36a5df | Use `datetime.isoformat` in order XML export | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | byceps/services/shop/order/export/service.py | byceps/services/shop/order/export/service.py | """
byceps.services.shop.order.export.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from __future__ import annotations
from datetime import datetime
from decimal import Decimal
from typing import Any, Optional
f... | """
byceps.services.shop.order.export.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from __future__ import annotations
from datetime import datetime
from decimal import Decimal
from typing import Any, Optional
f... | bsd-3-clause | Python |
5b93adc9402b8585ca56a984f56fc5311d698fd7 | Update the decimal precision of the ratio field | akretion/openerp-sale-suggest | sale_suggest/models/product.py | sale_suggest/models/product.py | from osv import osv, fields
class product_suggest(osv.Model):
_name = 'product.suggest'
_columns = {
'product_id': fields.many2one('product.product', 'Product'),
'suggested_product_id': fields.many2one(
'product.product',
'Suggested product'
),
'ratio': ... | from osv import osv, fields
class product_suggest(osv.Model):
_name = 'product.suggest'
_columns = {
'product_id': fields.many2one('product.product', 'Product'),
'suggested_product_id': fields.many2one(
'product.product',
'Suggested product'
),
'ratio': ... | agpl-3.0 | Python |
df986f9f1e5cfb0514709f414cdb4349a1e5ff5d | Add SNAPSHOT to version. | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | d1_libclient_python/src/d1_client/__init__.py | d1_libclient_python/src/d1_client/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright ${year}
#
# Licensed under the Apache License, ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright ${year}
#
# Licensed under the Apache License, ... | apache-2.0 | Python |
29c6194f10a75ebb76ecf6e5c94e7598c3cafcb0 | fix #102 | lanpa/tensorboardX,lanpa/tensorboardX | tensorboardX/embedding.py | tensorboardX/embedding.py | import os
def make_tsv(metadata, save_path):
metadata = [str(x) for x in metadata]
with open(os.path.join(save_path, 'metadata.tsv'), 'w') as f:
for x in metadata:
f.write(x + '\n')
# https://github.com/tensorflow/tensorboard/issues/44 image label will be squared
def make_sprite(label_im... | import os
def make_tsv(metadata, save_path):
metadata = [str(x) for x in metadata]
with open(os.path.join(save_path, 'metadata.tsv'), 'w') as f:
for x in metadata:
f.write(x + '\n')
# https://github.com/tensorflow/tensorboard/issues/44 image label will be squared
def make_sprite(label_im... | mit | Python |
dc1cf6fabcf871e3661125f7ac5d1cf9567798d6 | Use self.stdout.write() instead of print(). | manhhomienbienthuy/pythondotorg,python/pythondotorg,SujaySKumar/pythondotorg,lebronhkh/pythondotorg,SujaySKumar/pythondotorg,lepture/pythondotorg,python/pythondotorg,proevo/pythondotorg,Mariatta/pythondotorg,malemburg/pythondotorg,willingc/pythondotorg,fe11x/pythondotorg,berkerpeksag/pythondotorg,demvher/pythondotorg,p... | cms/management/commands/load_dev_fixtures.py | cms/management/commands/load_dev_fixtures.py | import requests
from django.core.management import call_command
from django.core.management.base import NoArgsCommand
from django.conf import settings
from django.utils.six.moves import input
class Command(NoArgsCommand):
"""
Download and load dev fixtures from www.python.org
"""
help = "Download and... | import requests
from django.core.management import call_command
from django.core.management.base import NoArgsCommand
from django.conf import settings
from django.utils.six.moves import input
class Command(NoArgsCommand):
"""
Download and load dev fixtures from www.python.org
"""
help = "Download and... | apache-2.0 | Python |
2d2547c60dbb4aeb4afdf306724d12defe7a49fb | Fix merge conflict | Charcoal-SE/SmokeDetector,Charcoal-SE/SmokeDetector | helpers.py | helpers.py | import os
from collections import namedtuple
from datetime import datetime
from termcolor import colored
Response = namedtuple('Response', 'command_status message')
# Allows use of `environ_or_none("foo") or "default"` shorthand
# noinspection PyBroadException,PyMissingTypeHints
def environ_or_none(key):
try:
... | import os
from collections import namedtuple
from datetime import datetime
from termcolor import colored
Response = namedtuple('Response', 'command_status message')
# Allows use of `environ_or_none("foo") or "default"` shorthand
# noinspection PyBroadException,PyMissingTypeHints
def environ_or_none(key):
try:
... | apache-2.0 | Python |
6c6ec2787ce9350bf7d81d511047d9ea6d134064 | fix get User model in 0010 migration | kk9599/django-cms,kk9599/django-cms,jproffitt/django-cms,divio/django-cms,owers19856/django-cms,bittner/django-cms,SachaMPS/django-cms,mkoistinen/django-cms,czpython/django-cms,vxsx/django-cms,wyg3958/django-cms,netzkolchose/django-cms,rsalmaso/django-cms,mkoistinen/django-cms,dhorelik/django-cms,rscnt/django-cms,datak... | cms/migrations/0010_migrate_use_structure.py | cms/migrations/0010_migrate_use_structure.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.models import Permission, Group
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from django.db import models, migrations
def forwards(apps, schema_editor):
user_app_str, user_model... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission, Group
from django.contrib.contenttypes.models import ContentType
from django.db import models, migrations
def forwards(apps, schema_editor):
ph_model =... | bsd-3-clause | Python |
d9856a0173caa2d03eac109e2dccaf197642a994 | Fix username selection logic when trying to create a suitable Django username from an email address-based external user id. The @domain.com portion wasn't being removed when the part before it already existed as a username in the Users table. | iiman/mytardis,steveandroulakis/mytardis,iiman/mytardis,iiman/mytardis,pansapiens/mytardis,pansapiens/mytardis,steveandroulakis/mytardis,steveandroulakis/mytardis,pansapiens/mytardis,pansapiens/mytardis | tardis/tardis_portal/auth/utils.py | tardis/tardis_portal/auth/utils.py | '''
Created on 15/03/2011
@author: gerson
'''
from django.contrib.auth.models import User
from tardis.tardis_portal.models import UserProfile, UserAuthentication
def get_or_create_user(auth_method, user_id, email=''):
try:
# check if the given username in combination with the
# auth method is al... | '''
Created on 15/03/2011
@author: gerson
'''
from django.contrib.auth.models import User
from tardis.tardis_portal.models import UserProfile, UserAuthentication
def get_or_create_user(auth_method, user_id, email=''):
try:
# check if the given username in combination with the
# auth method is al... | bsd-3-clause | Python |
ef596198dfa0b031ead118698175d6358c229923 | Update pressureAlt.py | InvisibleTree/highAltBalloon | src/pressure/pressureAlt.py | src/pressure/pressureAlt.py | import os
import time
import argparse
from datetime import datetime
from Adafruit_BMP085 import BMP085
bmp = BMP085(0x77)
# Create logging files
logTime = datetime.now().strftime("%Y.%m.%d-%H:%M:%S")
logPressure = "PRESSURE-" + logTime + ".log"
# open is only way to invoke O_CREAT as python is shit
pressureF = ope... | import os
import time
import argparse
from datetime import datetime
from Adafruit_BMP085 import BMP085
bmp = BMP085(0x77)
# Create logging files
logTime = datetime.now().strftime("%Y.%m.%d-%H:%M:%S")
logPressure = "PRESSURE-" + logTime + ".log"
# open is only way to invoke O_CREAT as python is shit
pressureF = ope... | mit | Python |
291be836ca83a24055b02a88c8e08c7af5174cf5 | Make the code available. | KayEss/django-pubsubpull,KayEss/django-pubsubpull,KayEss/django-pubsubpull | test-projects/django_1_7/manage.py | test-projects/django_1_7/manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_1_7.settings")
# Add the top level to the path so we can find pubsubpull
sys.path.append('../..')
from django.core.management import execute_from_command_line
execute_fro... | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_1_7.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| mit | Python |
68de3764d93dd865c1257b2112ffa653ef1437bf | Fix typo. | opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind | src/waldur_mastermind/marketplace_script/tasks.py | src/waldur_mastermind/marketplace_script/tasks.py | from celery import shared_task
from django.conf import settings
from waldur_mastermind.marketplace import models
from waldur_mastermind.marketplace_script import serializers, utils, PLUGIN_NAME
@shared_task(name='waldur_marketplace_script.pull_resources')
def pull_resources():
for resource in models.Resource.obj... | from celery import shared_task
from django.conf import settings
from waldur_mastermind.marketplace import models
from waldur_mastermind.marketplace_script import serializers, utils, PLUGIN_NAME
@shared_task(name='waldur_marketplace_script.pull_resources')
def pull_resources():
for resource in models.Resource.obj... | mit | Python |
76aaf0cd03af29b93fb0626f7d57d553f8529bbd | bring tesing code up to date | victronenergy/velib_python | test/mock_dbus_service.py | test/mock_dbus_service.py | # Simulates the busService object without using the D-Bus (intended for unit tests). Data usually stored in
# D-Bus items is now stored in memory.
class MockDbusService(object):
def __init__(self, servicename):
self._dbusobjects = {}
self._callbacks = {}
self._service_name = servicename
... | # Simulates the busService object without using the D-Bus (intended for unit tests). Data usually stored in
# D-Bus items is now stored in memory.
class MockDbusService(object):
def __init__(self, servicename):
self._dbusobjects = {}
self._callbacks = {}
self._service_name = servicename
... | mit | Python |
8519ec03d411c832cd34513cd90959b9f471b685 | fix unit test | QISKit/qiskit-sdk-py,QISKit/qiskit-sdk-py,QISKit/qiskit-sdk-py | test/aqua/test_nlopt_optimizers.py | test/aqua/test_nlopt_optimizers.py | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | apache-2.0 | Python |
22cb52849d65aa545d93699a7603178a8e9d629a | Disable maxAudioWithBaselineShift test (works locally but not on travis) | linuxipho/mycroft-core,forslund/mycroft-core,aatchison/mycroft-core,Dark5ide/mycroft-core,aatchison/mycroft-core,MycroftAI/mycroft-core,forslund/mycroft-core,MycroftAI/mycroft-core,linuxipho/mycroft-core,Dark5ide/mycroft-core | test/client/dynamic_energy_test.py | test/client/dynamic_energy_test.py | import unittest
import audioop
from speech_recognition import AudioSource
from mycroft.client.speech.mic import ResponsiveRecognizer
__author__ = 'seanfitz'
class MockStream(object):
def __init__(self):
self.chunks = []
def inject(self, chunk):
self.chunks.append(chunk)
def read(self, c... | import unittest
import audioop
from speech_recognition import AudioSource
from mycroft.client.speech.mic import ResponsiveRecognizer
__author__ = 'seanfitz'
class MockStream(object):
def __init__(self):
self.chunks = []
def inject(self, chunk):
self.chunks.append(chunk)
def read(self, c... | apache-2.0 | Python |
4d31ea83160331d8eb97de477bc3476d1a39653f | add a comment explaining the modimport tests | MichaelAquilina/pytest,hackebrot/pytest,pytest-dev/pytest,The-Compiler/pytest,alfredodeza/pytest,tomviner/pytest,markshao/pytest,nicoddemus/pytest,tareqalayan/pytest,davidszotten/pytest,txomon/pytest,Akasurde/pytest,flub/pytest,The-Compiler/pytest,tomviner/pytest,pfctdayelise/pytest,RonnyPfannschmidt/pytest,rmfitzpatri... | testing/test_modimport.py | testing/test_modimport.py | import py
import subprocess
import sys
import pytest
import _pytest
MODSET = [
x for x in py.path.local(_pytest.__file__).dirpath().visit('*.py')
if x.purebasename != '__init__'
]
@pytest.mark.parametrize('modfile', MODSET, ids=lambda x: x.purebasename)
def test_fileimport(modfile):
# this test ensures a... | import py
import subprocess
import sys
import pytest
import _pytest
MODSET = [
x for x in py.path.local(_pytest.__file__).dirpath().visit('*.py')
if x.purebasename != '__init__'
]
@pytest.mark.parametrize('modfile', MODSET, ids=lambda x: x.purebasename)
def test_fileimport(modfile):
res = subprocess.call... | mit | Python |
2b746b69e38378f5cadda93df9edebda8bae63f4 | fix test | hammerlab/mhcflurry,hammerlab/mhcflurry | test/test_class1_neural_network.py | test/test_class1_neural_network.py | import numpy
import pandas
numpy.random.seed(0)
from mhcflurry import Class1NeuralNetwork
from nose.tools import eq_
from numpy import testing
from mhcflurry.downloads import get_path
def test_class1_affinity_predictor_a0205_training_accuracy():
# Memorize the dataset.
hyperparameters = dict(
activ... | import numpy
import pandas
numpy.random.seed(0)
from mhcflurry import Class1NeuralNetwork
from nose.tools import eq_
from numpy import testing
from mhcflurry.downloads import get_path
def test_class1_affinity_predictor_a0205_training_accuracy():
# Memorize the dataset.
hyperparameters = dict(
activ... | apache-2.0 | Python |
06f0edb71086573a3d7f9efb01b97b073cf415a3 | Create a document in DdlTextWriterTest.test_full() | Squareys/PyDDL | tests/DdlTextWrterTest.py | tests/DdlTextWrterTest.py | import os
import unittest
from pyddl import *
from pyddl.enum import *
__author__ = "Jonathan Hale"
class DdlTextWriterTest(unittest.TestCase):
def tearDown(self):
try:
os.remove("test.oddl")
except FileNotFoundError:
pass # test_empty failed?
def test_empty(self):
... | import io
import os
import unittest
from pyddl import *
__author__ = "Jonathan Hale"
class DdlTextWriterTest(unittest.TestCase):
def tearDown(self):
try:
os.remove("test.oddl")
except FileNotFoundError:
pass # test_empty failed?
def test_empty(self):
# creat... | mit | Python |
ccc5bf305d236f56be0aad8d8de350bff7d34b81 | Fix wirecloud.live tests | rockneurotiko/wirecloud,jpajuelo/wirecloud,jpajuelo/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,rockneurotiko/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud | src/wirecloud/live/tests.py | src/wirecloud/live/tests.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud 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 versio... | # -*- coding: utf-8 -*-
# Copyright (c) 2016 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud 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 versio... | agpl-3.0 | Python |
125dfa47e5656c3f9b1e8846be03010ed02c6f91 | Add base set of rule's invalid syntax tests | PatrikValkovic/grammpy | tests/rules_tests/isValid_tests/InvalidSyntaxTest.py | tests/rules_tests/isValid_tests/InvalidSyntaxTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import main, TestCase
from grammpy import Rule
from grammpy.exceptions import RuleSyntaxException
from .grammar import *
class InvalidSyntaxTest(TestCase):
def test_rulesMissingEncloseLis... | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import main, TestCase
from grammpy import Rule
class InvalidSyntaxTest(TestCase):
pass
if __name__ == '__main__':
main() | mit | Python |
ca340e3bb3de18ff55b500845721634b02dba452 | Move command-line parsing out of main | timpel/stanford-algs,timpel/stanford-algs | merge-sort/merge-sort.py | merge-sort/merge-sort.py | import time
import sys
def sort(arr):
l = len(arr)
# If the array is too large, split it in two and recursively call sort on each half
# Then merge the arrays once they are sorted
if l > 2:
arr1 = arr[:l/2]
arr2 = arr[l/2:]
return merge(sort(arr1), sort(arr2))
# If the array is down to two elements:
# R... | import time
import sys
def sort(arr):
l = len(arr)
# If the array is too large, split it in two and recursively call sort on each half
# Then merge the arrays once they are sorted
if l > 2:
arr1 = arr[:l/2]
arr2 = arr[l/2:]
return merge(sort(arr1), sort(arr2))
# If the array is down to two elements:
# R... | mit | Python |
12cb8ca101faa09e4cc07f9e257b3d3130892297 | Remove xfail from replay test | mitsuhiko/sentry,fotinakis/sentry,beeftornado/sentry,mvaled/sentry,mvaled/sentry,BuildingLink/sentry,alexm92/sentry,mvaled/sentry,mvaled/sentry,BuildingLink/sentry,nicholasserra/sentry,JackDanger/sentry,fotinakis/sentry,gencer/sentry,fotinakis/sentry,beeftornado/sentry,ifduyue/sentry,JamesMura/sentry,imankulov/sentry,l... | tests/sentry/web/frontend/tests.py | tests/sentry/web/frontend/tests.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from exam import fixture
from sentry.testutils import TestCase
class ReplayTest(TestCase):
@fixture
def path(self):
return reverse('sentry-replay', kwargs={
'organization_slug': s... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import pytest
from django.core.urlresolvers import reverse
from exam import fixture
from sentry.testutils import TestCase
@pytest.mark.xfail
class ReplayTest(TestCase):
@fixture
def path(self):
return reverse('sentry-replay', kwargs={
... | bsd-3-clause | Python |
f920f7e765dac7057e3c48ebe0aa9723c3d431f5 | Check to see if qt is loaded; if so, export QtProgress class | Clyde-fare/cclib_bak,Clyde-fare/cclib_bak | src/cclib/progress/__init__.py | src/cclib/progress/__init__.py | __revision__ = "$Revision$"
from textprogress import TextProgress
import sys
if 'qt' in sys.modules.keys():
from qtprogress import QtProgress
| __revision__ = "$Revision$"
from textprogress import TextProgress
try:
import qt
except ImportError:
pass # import QtProgress will cause an error
else:
from qtprogress import QtProgress
| lgpl-2.1 | Python |
47173565cbd07896360390e23ddc523e92e5a6b9 | make sure form knows about plenaries | Diwahars/pycon,pyconjp/pyconjp-website,njl/pycon,eldarion/pycon,Diwahars/pycon,pyconjp/pyconjp-website,Diwahars/pycon,njl/pycon,pyconjp/pyconjp-website,smellman/sotmjp-website,PyCon/pycon,smellman/sotmjp-website,njl/pycon,PyCon/pycon,njl/pycon,osmfj/sotmjp-website,osmfj/sotmjp-website,smellman/sotmjp-website,smellman/s... | symposion/schedule/forms.py | symposion/schedule/forms.py | from django import forms
from django.db.models import Q
from markitup.widgets import MarkItUpWidget
from symposion.schedule.models import Presentation
class SlotEditForm(forms.Form):
def __init__(self, *args, **kwargs):
self.slot = kwargs.pop("slot")
super(SlotEditForm, self).__init__(*args... | from django import forms
from django.db.models import Q
from markitup.widgets import MarkItUpWidget
from symposion.schedule.models import Presentation
class SlotEditForm(forms.Form):
def __init__(self, *args, **kwargs):
self.slot = kwargs.pop("slot")
super(SlotEditForm, self).__init__(*args... | bsd-3-clause | Python |
6cf760d54ef46d64f8be3a004412ae79d3ab8919 | Use assert np.allclose instead of np.testing.assert_allclose | sot/mica,sot/mica | mica/vv/tests/test_vv.py | mica/vv/tests/test_vv.py | import os
import numpy as np
from .. import vv
from .. import process
from ... import common
def test_get_vv_dir():
obsdir = vv.get_vv_dir(16504)
assert obsdir == os.path.abspath(os.path.join(common.MICA_ARCHIVE, 'vv/16/16504_v01'))
def test_get_vv_files():
obsfiles = vv.get_vv_files(16504)
assert s... | import os
import numpy as np
from .. import vv
from .. import process
from ... import common
def test_get_vv_dir():
obsdir = vv.get_vv_dir(16504)
assert obsdir == os.path.abspath(os.path.join(common.MICA_ARCHIVE, 'vv/16/16504_v01'))
def test_get_vv_files():
obsfiles = vv.get_vv_files(16504)
assert s... | bsd-3-clause | Python |
7e7460eb28fcbc34c94663835885e693e3fe4785 | package version # 0.6.0 -> 0.5.9 | simonsdave/dev-env,simonsdave/dev-env,simonsdave/dev-env | dev_env/__init__.py | dev_env/__init__.py | __version__ = '0.5.9'
| __version__ = '0.6.0'
| mit | Python |
690a583ec5f3755f384b7d5cb1bf7a18a0687768 | Add Keras player for state values | davidrobles/mlnd-capstone-code | capstone/game/players/kerasplayer.py | capstone/game/players/kerasplayer.py | import numpy as np
from keras.models import load_model
from ..games import Connect4 as C4
from ..player import Player
from ..utils import normalize_board, utility
class KerasPlayer(Player):
'''
Takes moves based on a Keras neural network model.
Assumes that the model predicts the values for a
board fr... | from keras.models import load_model
from ..player import Player
from ..utils import normalize_board, utility
class KerasPlayer(Player):
'''
Takes moves based on a Keras neural network model.
Assumes that the model predicts the values for a
board from the point of view of the first player.
'''
... | mit | Python |
01c58681b04bf32f5a3de58da137ffe599d37601 | Switch to self-contained pipeline failure handler | PRX/Infrastructure,PRX/Infrastructure,PRX/Infrastructure,PRX/Infrastructure,PRX/Infrastructure | cd/lambdas/pipeline-fail-notification/lambda_function.py | cd/lambdas/pipeline-fail-notification/lambda_function.py | # Invoked by: CloudWatch Events
# Returns: Error or status message
#
# Triggered periodically to check if the CD CodePipeline has failed, and
# publishes a notification
import boto3
import traceback
import json
import os
from datetime import datetime, timedelta
code_pipeline = boto3.client('codepipeline')
sns = boto3... | # Invoked by: CloudWatch Events
# Returns: Error or status message
#
# Triggered periodically to check if the CD CodePipeline has failed, and
# publishes a notification
import boto3
import traceback
import json
import os
from datetime import datetime, timedelta
code_pipeline = boto3.client('codepipeline')
sns = boto3... | mit | Python |
d98464d5fea8021be06b24cbe8b38c84876ced97 | add __init__.py | LyleScott/Fail2BanLocations,LyleScott/Fail2BanLocations,LyleScott/Fail2BanLocations | src/__init__.py | src/__init__.py | # Lyle Scott, III // lyle@digitalfoo.net // Copyright 2013
| mit | Python | |
7bb43d25bd9c05d3f822dd338399c95b735e6779 | Add new upload method | makefu/bepasty-server,bepasty/bepasty-server,bepasty/bepasty-server,bepasty/bepasty-server,bepasty/bepasty-server,makefu/bepasty-server,makefu/bepasty-server | bepasty/views/upload.py | bepasty/views/upload.py | # Copyright: 2013 Bastian Blank <bastian@waldi.eu.org>
# License: BSD 2-clause, see LICENSE for details.
from flask import current_app, jsonify, redirect, request, url_for
from flask.views import MethodView
from ..utils.name import ItemName
from . import blueprint
class Upload(object):
@staticmethod
def upl... | # Copyright: 2013 Bastian Blank <bastian@waldi.eu.org>
# License: BSD 2-clause, see LICENSE for details.
from flask import current_app, jsonify, redirect, request, url_for
from flask.views import MethodView
from ..utils.name import ItemName
from . import blueprint
class Upload(object):
@staticmethod
def upl... | bsd-2-clause | Python |
20cde7ac44eab6bc92998d081096e6c6ec44e03e | Fix recommender for Python 3 | intel-analytics/BigDL,yangw1234/BigDL,intel-analytics/BigDL,yangw1234/BigDL,intel-analytics/BigDL,intel-analytics/BigDL,yangw1234/BigDL,yangw1234/BigDL | python/dllib/src/bigdl/dllib/examples/autograd/customloss.py | python/dllib/src/bigdl/dllib/examples/autograd/customloss.py | #
# Copyright 2018 Analytics Zoo Authors.
#
# 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... | #
# Copyright 2018 Analytics Zoo Authors.
#
# 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... | apache-2.0 | Python |
0573abdc0202d75cf57a6b77f6a3b438b7e471dd | Fix empty and spaced tags creation | YACOWS/opps,jeanmask/opps,opps/opps,opps/opps,jeanmask/opps,williamroot/opps,williamroot/opps,opps/opps,williamroot/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,opps/opps,jeanmask/opps,YACOWS/opps,jeanmask/opps | opps/core/tags/models.py | opps/core/tags/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from opps.core.models import Date, Slugged
class Tag(Date, Slugged):
name = models.CharField(_(u'Name'), max_length=255, unique=True,
... | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from opps.core.models import Date, Slugged
class Tag(Date, Slugged):
name = models.CharField(_(u'Name'), max_length=255, unique=True,
... | mit | Python |
95085988dfed179f61a4ca4483566990dcb6fd14 | test fix | qmagico/gae-migrations,qmagico/gae-migrations | tests/migrations_tests.py | tests/migrations_tests.py | import migrations
from test_utils import GAETestCase
import my.migrations
from my.migrations import migration_0002_two
class TestListMigrations(GAETestCase):
def test_list_migrations(self):
allmigration_names = migrations.get_all_migration_names(my.migrations)
self.assertEqual(3, len(allmigration_... | import migrations
from test_utils import GAETestCase
import my.migrations
from my.migrations import migration_0002_two
class TestListMigrations(GAETestCase):
def test_list_migrations(self):
allmigration_names = migrations.get_all_migration_names(my.migrations)
self.assertEqual(2, len(allmigration_... | mit | Python |
23675e41656cac48f390d97f065b36de39e27d58 | Add a real roll command | andrewlin16/duckbot,andrewlin16/duckbot | duckbot.py | duckbot.py | import discord
import duckbot_settings
import random
from discord.ext import commands
_DESCRIPTION = '''quack'''
bot = commands.Bot(command_prefix='/', description=_DESCRIPTION)
rand = random.SystemRandom()
@bot.event
async def on_ready():
print('logged in: %s (%s)' % (bot.user.name, bot.user.id))
oauth_url = di... | import discord
import duckbot_settings
import random
from discord.ext import commands
_DESCRIPTION = '''quack'''
bot = commands.Bot(command_prefix='/', description=_DESCRIPTION)
@bot.event
async def on_ready():
print('logged in: %s (%s)' % (bot.user.name, bot.user.id))
oauth_url = discord.utils.oauth_url(duckbot... | mit | Python |
30ed3800fdeec4aec399e6e0ec0760e46eb891ec | Fix broken initial version creation. | weijia/djangoautoconf,weijia/djangoautoconf | djangoautoconf/model_utils/model_reversion.py | djangoautoconf/model_utils/model_reversion.py | from django.contrib.contenttypes.models import ContentType
from django.db.models.signals import pre_save
from django.dispatch import receiver
from reversion.models import Version
def create_initial_version(obj):
try:
from reversion.revisions import default_revision_manager
default_revision_manager... | from django.contrib.contenttypes.models import ContentType
from django.db.models.signals import pre_save
from django.dispatch import receiver
from reversion.models import Version
from reversion.revisions import default_revision_manager
global_save_signal_receiver = []
class PreSaveHandler(object):
def __init__(s... | bsd-3-clause | Python |
4ec6365cb0f438c5f9199e3cc6bb00e22fe74520 | Improve convert.py to allow indexing (#140) | Marc3842h/Titan,Marc3842h/Titan,Marc3842h/Titan | convert.py | convert.py | #!/usr/bin/env python
#
# Simple Python3 script that converts your existing accounts file (in the format of username:password)
# to a Titan-compatible accounts.json file automatically.
# Run this script using Python 3: python convert.py accounts.txt
#
from pathlib import Path
import json
import sys
def main():
... | #!/usr/bin/env python
#
# Simple Python3 script that converts your existing accounts file (in the format of username:password)
# to a Titan-compatible accounts.json file automatically.
# Run this script using Python 3: python convert.py accounts.txt
#
from pathlib import Path
import json
import sys
def main():
i... | mit | Python |
fd62bd02906f3cd763baa238f8ca0dca62dbef41 | Change orders of GBP columns | cuemacro/chartpy,cuemacro/chartpy,cuemacro/chartpy | chartpy_examples/surface_examples.py | chartpy_examples/surface_examples.py | __author__ = 'saeedamen' # Saeed Amen
#
# Copyright 2016 Cuemacro
#
# 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 ... | __author__ = 'saeedamen' # Saeed Amen
#
# Copyright 2016 Cuemacro
#
# 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 ... | apache-2.0 | Python |
7f15f7a9c6fa2a00bd24037a1f8dcbe8a8fc28e9 | Add todo for weather adapter | Reinaesaya/OUIRL-ChatBot,maclogan/VirtualPenPal,vkosuri/ChatterBot,gunthercox/ChatterBot,davizucon/ChatterBot,Gustavo6046/ChatterBot,Reinaesaya/OUIRL-ChatBot | chatterbot/adapters/logic/weather.py | chatterbot/adapters/logic/weather.py | from .logic import LogicAdapter
from chatterbot.conversation import Statement
from chatterbot.utils.pos_tagger import POSTagger
import re
import forecastio
class WeatherLogicAdapter(LogicAdapter):
"""
A logic adapter that returns information regarding the weather and
the forecast for a specific location.... | from .logic import LogicAdapter
from chatterbot.conversation import Statement
from chatterbot.utils.pos_tagger import POSTagger
import re
import forecastio
class WeatherLogicAdapter(LogicAdapter):
"""
A logic adapter that returns information regarding the weather and
the forecast for a specific location.... | bsd-3-clause | Python |
80685191abc92f1d62f68a195488951ed38bef1c | Add a hack to enable StringSession.save be (a)sync | LonamiWebs/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon | telethon/sessions/string.py | telethon/sessions/string.py | import base64
import ipaddress
import struct
from .abstract import Session
from .memory import MemorySession
from ..crypto import AuthKey
_STRUCT_PREFORMAT = '>B{}sH256s'
CURRENT_VERSION = '1'
class _AsyncString(str):
"""
Ugly hack to enable awaiting strings.
"""
def __await__(self):
yield
... | import base64
import ipaddress
import struct
from .abstract import Session
from .memory import MemorySession
from ..crypto import AuthKey
_STRUCT_PREFORMAT = '>B{}sH256s'
CURRENT_VERSION = '1'
class StringSession(MemorySession):
"""
This session file can be easily saved and loaded as a string. According
... | mit | Python |
f319cf50491038a479f578503d84501de2acd4bc | Add choice of user agent for selector | AlexMathew/scrapple,AlexMathew/scrapple,scrappleapp/scrapple,AlexMathew/scrapple,scrappleapp/scrapple | scrapple/selectors/selector.py | scrapple/selectors/selector.py | """
scrapple.selectors.selector
~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import print_function
import requests
from lxml import etree
import random
class Selector(object):
"""
This class defines the basic ``Selector`` object.
"""
def __init__(self, url):
"""
The URL of the web page to be loaded i... | """
scrapple.selectors.selector
~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import print_function
import requests
from lxml import etree
class Selector(object):
"""
This class defines the basic ``Selector`` object.
"""
def __init__(self, url):
"""
The URL of the web page to be loaded is validated - ... | mit | Python |
695a1cdba20105127244c198de9b109c315b2246 | add func_utils.compose | cardforcoin/chain-bitcoin-python,chris-martin/chain-bitcoin-python | chain_bitcoin/func_util.py | chain_bitcoin/func_util.py | from __future__ import absolute_import
__all__ = (
'set_function_defaults', 'argspec_drop_right', 'argspec_append_left'
)
from inspect import ArgSpec
def set_function_defaults(f, defaults):
if hasattr(f, '__defaults__'): # python 3
f.__defaults__ = tuple(defaults) or None
elif hasattr(f, 'func_... | from __future__ import absolute_import
__all__ = (
'set_function_defaults', 'argspec_drop_right', 'argspec_append_left'
)
from inspect import ArgSpec
def set_function_defaults(f, defaults):
if hasattr(f, '__defaults__'): # python 3
f.__defaults__ = tuple(defaults) or None
elif hasattr(f, 'func_... | mit | Python |
c91d02174f330a98b424a4d17072008e303adc6b | restructure query for easier readability | mdiener21/python-geospatial-analysis-cookbook,mdiener21/python-geospatial-analysis-cookbook,mdiener21/python-geospatial-analysis-cookbook,mdiener21/python-geospatial-analysis-cookbook | ch04/code/ch04-03_postgis_line_intersections.py | ch04/code/ch04-03_postgis_line_intersections.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psycopg2
import json
from geojson import loads, Feature, FeatureCollection
# Database Connection Info
db_host = "localhost"
db_user = "postgres"
db_passwd = "air"
db_database = "py_geoan_cb"
db_port = "5432"
# connect to DB
conn = psycopg2.connect(host=db_host, u... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psycopg2
import json
from geojson import loads, Feature, FeatureCollection
# Database Connection Info
db_host = "localhost"
db_user = "postgres"
db_passwd = "air"
db_database = "py_geoan_cb"
db_port = "5432"
# connect to DB
conn = psycopg2.connect(host=db_host, u... | mit | Python |
4c465d260235090127e876ea493fee7de9372412 | Add cppcheck version 1.87. (#11536) | LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/cppcheck/package.py | var/spack/repos/builtin/packages/cppcheck/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Cppcheck(MakefilePackage):
"""A tool for static C/C++ code analysis."""
homepage = "ht... | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Cppcheck(MakefilePackage):
"""A tool for static C/C++ code analysis."""
homepage = "ht... | lgpl-2.1 | Python |
140cf76593ce542205ae4abb172bb39280c66904 | Test if changing initial activations makes any difference | stanfordnmbl/osim-rl | tests/test.activations.py | tests/test.activations.py | from osim.env import L2RunEnv
import numpy as np
import unittest
class ActivationsTest(unittest.TestCase):
def test_activations(self):
env = L2RunEnv(visualize=False)
observation = env.reset()
newact = np.array([0.0] * 18)
env.osim_model.set_activations(newact)
cur... | from osim.env import L2RunEnv
import numpy as np
import unittest
class ActivationsTest(unittest.TestCase):
def test_activations(self):
env = L2RunEnv(visualize=False)
observation = env.reset()
newact = np.array([0.0] * 18)
env.osim_model.set_activations(newact)
cur... | mit | Python |
a1449da9a5619988529fa156d7dc3bc1994ec9db | remove redundant code | watsonpy/watson-routing | watson/__init__.py | watson/__init__.py | # -*- coding: utf-8 -*-
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| # -*- coding: utf-8 -*-
# Namespaced packages, see http://www.python.org/dev/peps/pep-0420/
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError: # pragma: no cover
from pkgutil import extend_path # pragma: no cover
__path__ = extend_path(__path__, __name__) # pragma: no cover... | bsd-3-clause | Python |
d8f07c7dfc8e2407d0205ebfc9e3fd07f6017cee | Update titanium_version.py | rblalock/titanium_mobile,rblalock/titanium_mobile,rblalock/titanium_mobile,rblalock/titanium_mobile,rblalock/titanium_mobile,rblalock/titanium_mobile,rblalock/titanium_mobile,rblalock/titanium_mobile | build/titanium_version.py | build/titanium_version.py | version = '5.0.1'
module_apiversion = '2'
| version = '5.1.0'
module_apiversion = '2'
| apache-2.0 | Python |
61e593b3455bdad6c72329916ecbd207b3fb710e | Remove layout | RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode | rnacentral/portal/models/secondary_structure.py | rnacentral/portal/models/secondary_structure.py | """
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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 a... | """
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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 a... | apache-2.0 | Python |
05532f9e271e18be697918fb37e348c0e4134752 | add new version, fix download url (#15871) | LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-ecdsa/package.py | var/spack/repos/builtin/packages/py-ecdsa/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyEcdsa(PythonPackage):
"""ECDSA cryptographic signature library (pure python)"""
hom... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyEcdsa(PythonPackage):
"""ECDSA cryptographic signature library (pure python)"""
hom... | lgpl-2.1 | Python |
b6b66ac99b818060320cc59f9e02bef2cedc344e | Update documentation | Samuel-L/cli-ws,Samuel-L/cli-ws | web_scraper/core.py | web_scraper/core.py | import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import requests
from bs4 import BeautifulSoup
from web_scraper import target_types
def fetch_html_document(url):
"""Fetch html from url and return html
:param str url: an address to a resource on the Intern... | import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import requests
from bs4 import BeautifulSoup
from web_scraper import target_types
def fetch_html_document(url):
"""Fetch html from url and return html
:param str url: an address to a resource on the Intern... | mit | Python |
3d4a7d6402f0fe452ed734bc96f32c174ae0be3a | make tanzania layers | 4bic/scraper_Mozmbq,ANCIR/mozambique,4bic/scraper_Mozmbq,ANCIR/mozambique,4bic/scraper_Mozmbq,ANCIR/mozambique,4bic/scraper_Mozmbq,ANCIR/mozambique | src/flexicadastre_geolayers.py | src/flexicadastre_geolayers.py | # coding: utf-8
import os
import json
import glob
# import dataset
from normality import slugify
# from datetime import datetime
from pprint import pprint # noqa
from common import DATA_PATH
SOURCE_PATH = os.path.join(DATA_PATH, 'flexicadastre', 'raw')
try:
os.makedirs(SOURCE_PATH)
except:
pass
DEST_PATH = o... | # coding: utf-8
import os
import json
import glob
# import dataset
from normality import slugify
# from datetime import datetime
from pprint import pprint # noqa
from common import DATA_PATH
SOURCE_PATH = os.path.join(DATA_PATH, 'flexicadastre', 'raw')
try:
os.makedirs(SOURCE_PATH)
except:
pass
DEST_PATH = o... | mit | Python |
359b3474ab7c4cde1ac67b0f043ae7b9475e2169 | Fix import and test | jackfirth/pyramda | pamda/curry_spec_test.py | pamda/curry_spec_test.py | from .curry_spec import *
def assert_isinstance(type, v):
assert isinstance(v, type)
def curry_spec_creation_test():
assert_isinstance(CurrySpec, CurrySpec(['x', 'y', 'z'], {'y': 5}))
def num_args_test():
assert num_args(ArgValues([1, 2], {'foo': 5, 'bar': 7, 'baz': 10})) == 5
def args_overlap_test(... | from curry_spec import *
def assert_isinstance(type, v):
assert isinstance(v, type)
def curry_spec_creation_test():
assert_isinstance(CurrySpec, CurrySpec(['x', 'y', 'z'], {'y': 5}))
def num_args_test():
assert num_args(ArgValues([1, 2], {'foo': 5, 'bar': 7, 'baz': 10})) == 3
def args_overlap_test()... | mit | Python |
5237cb7f1339eb13b4c01f1c3611448a8f865726 | Make sure the filter arg is a string. | BertrandBordage/django-terms,philippeowagner/django-terms,BertrandBordage/django-terms,philippeowagner/django-terms | terms/templatetags/terms.py | terms/templatetags/terms.py | # coding: utf-8
from django.template import Library
from django.template.defaultfilters import stringfilter
from ..html import TermsHTMLReconstructor
register = Library()
@register.filter
@stringfilter
def replace_terms(html):
parser = TermsHTMLReconstructor()
parser.feed(html)
return parser.out
| # coding: utf-8
from django.template import Library
from ..html import TermsHTMLReconstructor
register = Library()
@register.filter
def replace_terms(html):
parser = TermsHTMLReconstructor()
parser.feed(html)
return parser.out
| bsd-3-clause | Python |
806371f9a23ad63b16541406ccf7ec8025d5cb90 | Fix lack of initiating response for PLAIN SASL mechanism | Heufneutje/txircd | txircd/modules/ircv3/sasl_plain.py | txircd/modules/ircv3/sasl_plain.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
from base64 import b64decode
class SASLPlain(ModuleData):
implements(IPlugin, IModuleData)
name = "SASLPlain"
def actions(self):
return [ ("saslmechanismlist", 10, self.addPlain... | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
from base64 import b64decode
class SASLPlain(ModuleData):
implements(IPlugin, IModuleData)
name = "SASLPlain"
def actions(self):
return [ ("saslmechanismlist", 10, self.addPlain... | bsd-3-clause | Python |
1b218de76e8b09c70abcd88a2c6dd2c043bfc7f0 | Allow sub-commands to use same main function | schwa-lab/dr-apps-python | drcli/__main__.py | drcli/__main__.py | #!/usr/bin/env python
import os.path
import sys
import imp
import argparse
from api import App, add_subparsers
def load_plugins(dir):
for f in os.listdir(dir):
module_name, ext = os.path.splitext(f)
if ext == '.py':
imp.load_source('arbitrary', os.path.join(dir, f))
def main(args=None):
if args is... | #!/usr/bin/env python
import os.path
import sys
import imp
import argparse
from api import App, add_subparsers
def load_plugins(dir):
for f in os.listdir(dir):
module_name, ext = os.path.splitext(f)
if ext == '.py':
imp.load_source('arbitrary', os.path.join(dir, f))
def main(args=sys.argv[1:]):
lo... | mit | Python |
5206ec7d1201a61d521b2f71e556fb6fc77223c4 | fix code | cobrateam/flask-mongoalchemy | examples/books_collection/collection/forms.py | examples/books_collection/collection/forms.py | # -*- coding: utf-8 -*-
# Copyright 2014 flask-mongoalchemy authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from flask.ext import wtf
from collection.documents import Book
class BookForm(wtf.Form):
document_class = Book
title... | # -*- coding: utf-8 -*-
# Copyright 2010 flask-mongoalchemy authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from flaskext import wtf
from collection.documents import Book
class BookForm(wtf.Form):
document_class = Book
title ... | bsd-2-clause | Python |
c57e05bec16f31344868fb9158f22c1d1a9d1144 | Make sure nr_dim is an int | spacy-io/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,aikramer2/spaCy,aikramer2/spaCy,aikramer2/spaCy,aikramer2/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,recognai/spaCy,explosion/spaCy,recognai/spaCy,honnibal/spaCy,aikramer2/spaCy,explosion/spaCy,recognai/spaCy,honnibal/s... | examples/vectors_fast_text.py | examples/vectors_fast_text.py | #!/usr/bin/env python
# coding: utf8
"""Load vectors for a language trained using fastText
https://github.com/facebookresearch/fastText/blob/master/pretrained-vectors.md
Compatible with: spaCy v2.0.0+
"""
from __future__ import unicode_literals
import plac
import numpy
import spacy
from spacy.language import Language
... | #!/usr/bin/env python
# coding: utf8
"""Load vectors for a language trained using fastText
https://github.com/facebookresearch/fastText/blob/master/pretrained-vectors.md
Compatible with: spaCy v2.0.0+
"""
from __future__ import unicode_literals
import plac
import numpy
import spacy
from spacy.language import Language
... | mit | Python |
8b3096b0ffc50701bb80988bca3c1743926ff873 | Update example_template.py | dpshelio/sunpy,dpshelio/sunpy,dpshelio/sunpy | examples/example_template/example_template.py | examples/example_template/example_template.py | """
================
<Verbing> a thing
================
How to <verb> <active tense> <does something>.
The example uses <packages> to <do something> and <other package> to <do other
thing>. Include links to referenced packages like this: `sunpy.io.fits` to
show the sunpy.io.fits or like this `~sunpy.io.fits`to show j... | """
================
Title of Example
================
This example <verb> <active tense> <does something>.
The example uses <packages> to <do something> and <other package> to <do other
thing>. Include links to referenced packages like this: `sunpy.io.fits` to
show the sunpy.io.fits or like this `~sunpy.io.fits`to s... | bsd-2-clause | Python |
5173e564172e7cdce0b17505f95e3d2acbd61944 | Fix test_environment so it does not rely on the jinja2 exception message | michaeljoseph/cookiecutter,hackebrot/cookiecutter,audreyr/cookiecutter,luzfcb/cookiecutter,pjbull/cookiecutter,willingc/cookiecutter,Springerle/cookiecutter,terryjbates/cookiecutter,stevepiercy/cookiecutter,audreyr/cookiecutter,luzfcb/cookiecutter,stevepiercy/cookiecutter,pjbull/cookiecutter,michaeljoseph/cookiecutter,... | tests/test_environment.py | tests/test_environment.py | # -*- coding: utf-8 -*-
import pytest
from cookiecutter.environment import StrictEnvironment
from cookiecutter.exceptions import UnknownExtension
def test_env_should_raise_for_unknown_extension():
context = {
'_extensions': ['foobar']
}
with pytest.raises(UnknownExtension) as err:
Stric... | # -*- coding: utf-8 -*-
import pytest
from cookiecutter.environment import StrictEnvironment
from cookiecutter.exceptions import UnknownExtension
def test_env_should_raise_for_unknown_extension():
context = {
'_extensions': ['foobar']
}
with pytest.raises(UnknownExtension) as err:
Stric... | bsd-3-clause | Python |
9c18f6e5d8f89aecbf3f1f1c414943fdb8823fd0 | update get_repo utility method to handle directories that aren't valid git repo directories | sethtrain/django-git,sethtrain/django-git | django_git/utils.py | django_git/utils.py | import os
from git import *
from django.conf import settings
def get_repos():
repos = []
for dir in os.listdir(settings.REPOS_ROOT):
if os.path.isdir(os.path.join(settings.REPOS_ROOT, dir)):
try:
repos.append(Repo(os.path.join(settings.REPOS_ROOT, dir)))
except ... | import os
from git import *
from django.conf import settings
def get_repos():
return [Repo(os.path.join(settings.REPOS_ROOT, dir)) for dir in os.listdir(settings.REPOS_ROOT) if os.path.isdir(os.path.join(settings.REPOS_ROOT, dir))]
def get_repo(name):
return Repo(os.path.join(settings.REPOS_ROOT, name))
def... | bsd-3-clause | Python |
5e76d357826e40554d633e247a0876b70dc6e1b0 | Bump version 0.6.1. | junaruga/rpm-py-installer,junaruga/rpm-py-installer | rpm_py_installer/version.py | rpm_py_installer/version.py | """Version string."""
# main = X.Y.Z
# sub = .devN for pre-alpha releases
VERSION = '0.6.1'
| """Version string."""
# main = X.Y.Z
# sub = .devN for pre-alpha releases
VERSION = '0.6.0'
| mit | Python |
c1ba21b1760520615e5870f58100cd63597ca91d | Refactor get transformer function | rsk-mind/rsk-mind-framework | rsk_mind/dataset/dataset.py | rsk_mind/dataset/dataset.py | class Dataset():
""" """
def __init__(self, header, rows):
""" """
self.header = header
self.rows = rows
self.transformer = None
self.transformed_rows = []
self.transformed_header = None
def setTransformer(self, transformer):
"""
:param trans... | class Dataset():
""" """
def __init__(self, header, rows):
""" """
self.header = header
self.rows = rows
self.transformer = None
self.transformed_rows = []
self.transformed_header = None
def setTransformer(self, transformer):
""" """
self.tra... | mit | Python |
85d684369e72aa2968f9ffbd0632f84558e1b44e | Test that x² == |x|² | ppb/ppb-vector,ppb/ppb-vector | tests/test_vector2_dot.py | tests/test_vector2_dot.py | from ppb_vector import Vector2
from math import isclose, sqrt
import pytest # type: ignore
from hypothesis import assume, given, note
from utils import floats, vectors
@given(x=vectors(), y=vectors())
def test_dot_commutes(x: Vector2, y: Vector2):
assert x * y == y * x
@given(x=vectors())
def test_dot_length(x... | from ppb_vector import Vector2
from math import isclose, sqrt
import pytest # type: ignore
from hypothesis import assume, given, note
from utils import floats, vectors
@given(x=vectors(), y=vectors())
def test_dot_commutes(x: Vector2, y: Vector2):
assert x * y == y * x
MAGNITUDE=1e10
@given(x=vectors(max_magn... | artistic-2.0 | Python |
094914def4a1161ccc1b66d51b1c5876f886c7fb | Add ability to enable debug logging for CLI test program | ttu/ruuvitag-sensor,ttu/ruuvitag-sensor | ruuvitag_sensor/__main__.py | ruuvitag_sensor/__main__.py | import sys
import argparse
import logging
import ruuvitag_sensor
from ruuvitag_sensor.log import log
from ruuvitag_sensor.ruuvi import RuuviTagSensor
from ruuvitag_sensor.ruuvitag import RuuviTag
ruuvitag_sensor.log.enable_console()
def my_excepthook(exctype, value, traceback):
sys.__excepthook__(exctype, value... | import sys
import argparse
import ruuvitag_sensor
from ruuvitag_sensor.log import log
from ruuvitag_sensor.ruuvi import RuuviTagSensor
from ruuvitag_sensor.ruuvitag import RuuviTag
ruuvitag_sensor.log.enable_console()
def my_excepthook(exctype, value, traceback):
sys.__excepthook__(exctype, value, traceback)
... | mit | Python |
56a0ea97d3932bc6acd82310b5d8f2385ad461ce | Fix the clustershell roster host names (CLEAN) | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/roster/clustershell.py | salt/roster/clustershell.py | # -*- coding: utf-8 -*-
'''
:requires: clustershell
https://github.com/cea-hpc/clustershell
This roster resolves hostname in a pdsh/clustershell style.
When you want to use host globs for target matching, use --roster clustershell.
Example:
salt-ssh --roster clustershell 'server_[1-10,21-30],test_server[5,7,9]' ... | # -*- coding: utf-8 -*-
'''
:requires: clustershell
https://github.com/cea-hpc/clustershell
This roster resolves hostname in a pdsh/clustershell style.
When you want to use host globs for target matching, use --roster clustershell.
Example:
salt-ssh --roster clustershell 'server_[1-10,21-30],test_server[5,7,9]' ... | apache-2.0 | Python |
1db5cbc15de2489add2cb74a505f4ff0853807df | Adjust imports | homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps | bootstrap/validators.py | bootstrap/validators.py | """
bootstrap.validators
~~~~~~~~~~~~~~~~~~~~
Validators for use with Click_.
.. _Click: http://click.pocoo.org/
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import click
from byceps.services.brand.transfer.models import Brand
from byceps.services.brand import ser... | """
bootstrap.validators
~~~~~~~~~~~~~~~~~~~~
Validators for use with Click_.
.. _Click: http://click.pocoo.org/
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import click
from byceps.services.brand.models.brand import Brand
from byceps.services.brand import servic... | bsd-3-clause | Python |
3f2b242aee2f7cbf2591d9ad04e2f90142a9e0bf | Add build_entire_heap() | bowen0701/algorithms_data_structures | ds_binary_heap.py | ds_binary_heap.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
class BinaryHeap(object):
def __init__(self):
# Put single zero as the 1st element, so that
# integer division can be used in later methods.
self.heap_ls = [0]
self.current_... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
class BinaryHeap(object):
def __init__(self):
# Put single zero as the 1st element, so that
# integer division can be used in later methods.
self.heap_ls = [0]
self.current_... | bsd-2-clause | Python |
c01905c18eb69b0da324e6d234cd8724d72a2996 | Bump development version | barseghyanartur/djangocms-text-ckeditor,DylannCordel/djangocms-text-ckeditor,divio/djangocms-text-ckeditor,divio/djangocms-text-ckeditor,barseghyanartur/djangocms-text-ckeditor,alsoicode/djangocms-text-ckeditor,barseghyanartur/djangocms-text-ckeditor,vxsx/djangocms-text-ckeditor,alsoicode/djangocms-text-ckeditor,yakky/... | djangocms_text_ckeditor/__init__.py | djangocms_text_ckeditor/__init__.py | # -*- coding: utf-8 -*-
__version__ = "2.5.4dev1"
default_app_config = 'djangocms_text_ckeditor.apps.TextCkeditorConfig'
| # -*- coding: utf-8 -*-
__version__ = "2.5.3"
default_app_config = 'djangocms_text_ckeditor.apps.TextCkeditorConfig'
| bsd-3-clause | Python |
9da90808ec15d8b2bbf634f61b39772f61a10a27 | Make modules uninstallable | OCA/account-fiscal-rule,OCA/account-fiscal-rule | account_product_fiscal_classification/__openerp__.py | account_product_fiscal_classification/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Account Product - Fiscal Classification module for Odoo
# Copyright (C) 2014-Today GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free softw... | # -*- coding: utf-8 -*-
##############################################################################
#
# Account Product - Fiscal Classification module for Odoo
# Copyright (C) 2014-Today GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free softw... | agpl-3.0 | Python |
742b9b7caf1ba053c4274e9a39b95ceb8b6723e5 | fix basestring for py3 | Fantomas42/mots-vides,Fantomas42/mots-vides | mots_vides/stop_words.py | mots_vides/stop_words.py | # -*- coding: utf-8 -*-
"""
StopWord Python container, managing collection of stop words.
"""
import re
TEXT_TYPE_LIST = ('str', 'unicode', 'byte')
class StopWord(object):
"""
Object managing collection of stop words for a given language.
"""
def __init__(self, language, collection=[]):
"""
... | # -*- coding: utf-8 -*-
"""
StopWord Python container, managing collection of stop words.
"""
import re
class StopWord(object):
"""
Object managing collection of stop words for a given language.
"""
def __init__(self, language, collection=[]):
"""
Initializes with a given language and... | bsd-3-clause | Python |
51ee6b83170a2d28db1b657011739dde28c1a670 | bump version | ppliu1979/libinjection,fengjian/libinjection,fengjian/libinjection,dijkstracula/libinjection,fengjian/libinjection,dijkstracula/libinjection,ppliu1979/libinjection,fengjian/libinjection,dijkstracula/libinjection,fengjian/libinjection,dijkstracula/libinjection,fengjian/libinjection,ppliu1979/libinjection,dijkstracula/li... | c/setup.py | c/setup.py | """
libinjection module for python
Copyright 2012, 2013 Nick Galbreath
nickg@client9.com
BSD License -- see COPYING.txt for details
"""
from distutils.core import setup, Extension
MODULE = Extension(
'libinjection',
define_macros = [],
include_dirs = [],
libraries = [],
library_dirs = [],
... | """
libinjection module for python
Copyright 2012, 2013 Nick Galbreath
nickg@client9.com
BSD License -- see COPYING.txt for details
"""
from distutils.core import setup, Extension
MODULE = Extension(
'libinjection',
define_macros = [],
include_dirs = [],
libraries = [],
library_dirs = [],
... | bsd-3-clause | Python |
3c4455e8b73df5a767d7443a73207c9b89c26b34 | Use connectAnonymously in parallelsearch example. | antong/ldaptor,antong/ldaptor | doc/examples/ldap_parallelsearch.py | doc/examples/ldap_parallelsearch.py | #!/usr/bin/python
# Twisted, the Framework of Your Internet
# Copyright (C) 2001 Matthew W. Lefkowitz
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is ... | #!/usr/bin/python
# Twisted, the Framework of Your Internet
# Copyright (C) 2001 Matthew W. Lefkowitz
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is ... | lgpl-2.1 | Python |
ac2672a0aa4b31f620fe291253750b21888ab775 | fix edge case | piotrmaslanka/satella,piotrmaslanka/satella | satella/coding/iterators.py | satella/coding/iterators.py | import typing as tp
class SelfClosingGenerator:
"""
A wrapper to exhaust the generator in response to closing it.
This will allow generators to complete that don't provide a .close() method.
This will additionally exhaust the generator upon deallocation of the generator.
You can feed it with ei... | import typing as tp
import logging
logger = logging.getLogger(__name__)
class SelfClosingGenerator:
"""
A wrapper to exhaust the generator in response to closing it.
This will allow generators to complete that don't provide a .close() method.
This will additionally exhaust the generator upon deallo... | mit | Python |
8cbb3c968dbc87f500220228e39d2413b78608ae | Add docstring and comments to ignitiondelayexp | bryanwweber/UConnRCMPy | UConnRCMPy/ignitiondelayexp.py | UConnRCMPy/ignitiondelayexp.py | # -*- coding: utf-8 -*-
"""
Experimental ignition delay processor
"""
# System imports
# Third party imports
import numpy as np
import matplotlib.pyplot as plt
# Local imports
from .pressure_traces import (copy, compress, derivative, file_loader,
ParsedFilename, pressure_to_temperature,
... | # -*- coding: utf-8 -*-
"""
Created on Tue May 19 11:07:31 2015
@author: weber
"""
import numpy as np
import matplotlib.pyplot as plt
from pressure_traces import smoothing, derivative, file_loader, filename_parse, copy, pressure_to_temperature, compress
filename = input('Filename: ')
data = file_loader(filename)
spac... | bsd-3-clause | Python |
99e1377deb066b9bee64b40799caaeaccd0db7d8 | Fix use of Python 2 print | svetlyak40wt/python-cl-conditions | src/conditions/signals.py | src/conditions/signals.py | # coding: utf-8
from __future__ import print_function
import os
import traceback
from .handlers import find_handler
_activate_debugger = os.environ.get('DEBUG') == 'yes'
if _activate_debugger:
try:
from trepan.api import debug
set_trace = debug
except ImportError:
import pdb
... | # coding: utf-8
import os
import traceback
from .handlers import find_handler
_activate_debugger = os.environ.get('DEBUG') == 'yes'
if _activate_debugger:
try:
from trepan.api import debug
set_trace = debug
except ImportError:
import pdb
set_trace = pdb.set_trace
def signal... | bsd-2-clause | Python |
779169e5e9afb93fd8a365846793e8caa5cba90c | Fix missing imports and fixtures in test_check_update.py | rlee287/pyautoupdate,rlee287/pyautoupdate | test/test_check_update.py | test/test_check_update.py | from __future__ import absolute_import, print_function
from ..pyautoupdate.launcher import Launcher
from ..pyautoupdate.exceptions import CorruptedFileWarning
from .pytest_skipif import needinternet
from .pytest_makevers import fixture_update_dir
import glob
import os
import pytest
from requests import HTTPError
@n... | from __future__ import absolute_import, print_function
from ..pyautoupdate.launcher import Launcher
from ..pyautoupdate.exceptions import CorruptedFileWarning
from .pytest_skipif import needinternet
from .pytest_makevers import fixture_update_dir
import os
import pytest
from requests import HTTPError
@needinternet
... | lgpl-2.1 | Python |
8a084013819ab8500cf00e8392e3ae1657fe5c16 | Update test_installation.py | discos/basie,discos/basie | test/test_installation.py | test/test_installation.py | #coding=utf-8
try:
import unittest2 as unittest
except ImportError:
import unittest
import basie
class TestInstallation(unittest.TestCase):
def test_version(self):
self.assertEqual(basie.VERSION, "1.0dev")
def test_astropy_version(self):
import astropy
av = astropy.__version__... | #coding=utf-8
try:
import unittest2 as unittest
except ImportError:
import unittest
import basie
class TestInstallation(unittest.TestCase):
def test_version(self):
self.assertEqual(basie.VERSION, "0.1dev")
def test_astropy_version(self):
import astropy
av = astropy.__version__... | bsd-3-clause | Python |
fd81c4cea0d28275123539c23c27dcfdd71e9aef | Fix bench error on scipy import when nose is not installed | aman-iitj/scipy,maciejkula/scipy,efiring/scipy,gfyoung/scipy,teoliphant/scipy,pizzathief/scipy,pbrod/scipy,Eric89GXL/scipy,jor-/scipy,larsmans/scipy,anntzer/scipy,behzadnouri/scipy,pschella/scipy,ogrisel/scipy,sriki18/scipy,aarchiba/scipy,WarrenWeckesser/scipy,newemailjdm/scipy,Srisai85/scipy,pbrod/scipy,surhudm/scipy,... | scipy/testing/nulltester.py | scipy/testing/nulltester.py | ''' Null tester (when nose not importable)
Merely returns error reporting lack of nose package
See pkgtester, nosetester modules
'''
nose_url = 'http://somethingaboutorange.com/mrl/projects/nose'
class NullTester(object):
def __init__(self, *args, **kwargs):
pass
def test(self, labels=None, *args, ... | ''' Null tester (when nose not importable)
Merely returns error reporting lack of nose package
See pkgtester, nosetester modules
'''
nose_url = 'http://somethingaboutorange.com/mrl/projects/nose'
class NullTester(object):
def __init__(self, *args, **kwargs):
pass
def test(self, labels=None, *args, ... | bsd-3-clause | Python |
ba5c36c49817b90e1c7788f4bfac8d0d1f8ea2bb | add force_text to error text | freshlimestudio/djlime | src/djlime/forms/utils.py | src/djlime/forms/utils.py | # -*- coding: utf-8 -*-
"""
djlime.forms.utils
~~~~~~~~~~~~~~~~~~
Utilities for forms.
:copyright: (c) 2012 by Andrey Voronov.
:license: BSD, see LICENSE for more details.
"""
import simplejson
from django.utils.encoding import force_text
def form_errors_to_json(form):
errors = dict([(k, for... | # -*- coding: utf-8 -*-
"""
djlime.forms.utils
~~~~~~~~~~~~~~~~~~
Utilities for forms.
:copyright: (c) 2012 by Andrey Voronov.
:license: BSD, see LICENSE for more details.
"""
import simplejson
def form_errors_to_json(form):
errors = dict([(k, v[0]) for k, v in form.errors.items()])
retu... | bsd-3-clause | Python |
e0fb77d3743d1a9c76bae824239d6581261bd044 | Simplify base64 fields since refactor | kata198/indexedredis,kata198/indexedredis | IndexedRedis/fields/b64.py | IndexedRedis/fields/b64.py | # Copyright (c) 2014, 2015, 2016, 2017 Timothy Savannah under LGPL version 2.1. See LICENSE for more information.
#
# fields.b64 - Field type for base64 encoded/decoded fields
#
# vim: set ts=8 shiftwidth=8 softtabstop=8 noexpandtab :
from . import IRField, irNull
from ..compat_str import tobytes, isStringy
from ba... | # Copyright (c) 2014, 2015, 2016 Timothy Savannah under LGPL version 2.1. See LICENSE for more information.
#
# fields.b64 - Field type for base64 encoded/decoded fields
#
# vim: set ts=8 shiftwidth=8 softtabstop=8 noexpandtab :
from . import IRField, irNull
from ..compat_str import tobytes, isStringy
from base64 i... | lgpl-2.1 | Python |
6d08c13fbf42eb4251d3477a904ab6d8513620df | Add url field to Dataset web item | MaxLikelihood/CODE | dataset.py | dataset.py | from scrapy.item import Item, Field
class DatasetItem(Item):
url = Field()
name = Field()
frequency = Field()
| from scrapy.item import Item, Field
class DatasetItem(Item):
name = Field()
frequency = Field()
| mit | Python |
77833d51d26a80d147400ae642038452d226f11f | Change ignore query string option to ignore protocol and fragment option | vladislav-karamfilov/Python-Playground | Chrome-Bookmarks-Analyzer/chrome_bookmark_analyzer.py | Chrome-Bookmarks-Analyzer/chrome_bookmark_analyzer.py | from pprint import pprint
from urllib.parse import urlparse
import json
import sys
def add_to_url_folder_mappings(url, folder, url_folder_mappings, ignore_protocol_and_fragment):
if ignore_protocol_and_fragment:
parsed_url = urlparse(url)
actual_url = parsed_url.netloc + parsed_url.path + '?' + pa... | from pprint import pprint
from urllib.parse import urlparse
import json
import sys
def add_to_url_folder_mappings(url, folder, url_folder_mappings, ignore_query_string):
if ignore_query_string:
actual_url = url
else:
parsed_url = urlparse(url)
actual_url = parsed_url.scheme + '://' + p... | mit | Python |
6decedbc3179e3f6537be95f9eb9ca5d49f7e5f9 | make test6.py a little faster | nemomobile-graveyard/mcompositor,nemomobile-graveyard/mcompositor,nemomobile-graveyard/mcompositor,nemomobile-graveyard/mcompositor,nemomobile-graveyard/mcompositor,nemomobile-graveyard/mcompositor | tests/functional/test6.py | tests/functional/test6.py | #!/usr/bin/python
# Check that window stack stays static while rotating the screen.
#* Test steps
# * create and show TYPE_INPUT window
# * create and show application window
# * create and show dialog window
# * rotate screen step-by-step and check that window stack says the same
#* Post-conditions
# * None
im... | #!/usr/bin/python
# Check that window stack stays static while rotating the screen.
#* Test steps
# * create and show TYPE_INPUT window
# * create and show application window
# * create and show dialog window
# * rotate screen step-by-step and check that window stack says the same
#* Post-conditions
# * None
im... | lgpl-2.1 | Python |
fb9ca9469e37c647f246e2dd355b83ddc983c489 | Update DownloadFilesRename.py | jiangtianyu2009/PiSoftCake | YouKnow/DownloadFilesRename.py | YouKnow/DownloadFilesRename.py | import os
import re
p = re.compile(r'(\D+\d+)(\w*)(.\w+)')
dstDirList = [r'F:\tempg\TC', r'G:\tempg\TC']
for distDir in dstDirList:
filenames = os.listdir(distDir)
upperfilenames = []
print(filenames)
for filenamepref in filenames:
if filenamepref.find('_') > 0:
filenameprefit = fi... | import os
import re
p = re.compile(r'(\D+\d+)(\w*)(.\w+)')
distDirList = [r'G:\tempg\TC']
for distDir in distDirList:
filenames = os.listdir(distDir)
upperfilenames = []
print(filenames)
for filenamepref in filenames:
if filenamepref.find('_') > 0:
filenameprefit = filenamepref[fil... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.