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 |
|---|---|---|---|---|---|---|---|---|
27dd4ef2b3e20761dfd1fe834a28781bcc1f4ee8 | make transport pluggable | minervaproject/pykurento,lewang0418/pykurento | pykurento/client.py | pykurento/client.py | from pykurento import media
from pykurento.transport import KurentoTransport
class KurentoClient(object):
def __init__(self, url, transport=None):
self.url = url
self.transport = transport or KurentoTransport(self.url)
def get_transport(self):
return self.transport
def create_pipeline(self):
re... | from pykurento import media
from pykurento.transport import KurentoTransport
class KurentoClient(object):
def __init__(self, url):
self.url = url
self.transport = KurentoTransport(self.url)
def get_transport(self):
return self.transport
def create_pipeline(self):
return media.MediaPipeline(self... | lgpl-2.1 | Python |
915c7ac4f117fc6a85dae13f006dcbb31436da23 | Remove errant log statement | harlowja/pymemcache,methane/pymemcache,pinterest/pymemcache,adamchainz/pymemcache,mbrukman/pymemcache,sontek/pymemcache,dive-tv/pyelasticache_client,sontek/pymemcache,ewdurbin/pymemcache,duanhongyi/pymemcache,thedrow/pymemcache,pinterest/pymemcache,bwalks/pymemcache | pymemcache/serde.py | pymemcache/serde.py | # Copyright 2012 Pinterest.com
#
# 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,... | # Copyright 2012 Pinterest.com
#
# 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,... | apache-2.0 | Python |
f8a4c64a9c8cff4257492ef3ffc293352e31840e | Bump to 0.7.9 dev. | reviewboard/rbtools,reviewboard/rbtools,reviewboard/rbtools | rbtools/__init__.py | rbtools/__init__.py | #
# __init__.py -- Basic version and package information
#
# Copyright (c) 2007-2009 Christian Hammond
# Copyright (c) 2007-2009 David Trowbridge
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the So... | #
# __init__.py -- Basic version and package information
#
# Copyright (c) 2007-2009 Christian Hammond
# Copyright (c) 2007-2009 David Trowbridge
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the So... | mit | Python |
074f8d1087d8a9075771a5c32d1359aa4ff3e693 | Add minor comment to residuals() function | nsh87/regressors | regressors/stats.py | regressors/stats.py | # -*- coding: utf-8 -*-
"""This module contains functions for calculating various statistics."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
def residuals(clf, X, y, r_type='standardized'):
... | # -*- coding: utf-8 -*-
"""This module contains functions for calculating various statistics."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
def residuals(clf, X, y, r_type='standardized'):
... | isc | Python |
32961960271f5b75297e3ab0a1bf5b775feba47a | fix wrong kerning | daltonmaag/freetype-py,bitforks/freetype-py | examples/hello-world.py | examples/hello-world.py | # -----------------------------------------------------------------------------
#
# FreeType high-level python API - Copyright 2011 Nicolas P. Rougier
# Distributed under the terms of the new BSD license.
#
# -----------------------------------------------------------------------------
from freetype import *
if __na... | # -----------------------------------------------------------------------------
#
# FreeType high-level python API - Copyright 2011 Nicolas P. Rougier
# Distributed under the terms of the new BSD license.
#
# -----------------------------------------------------------------------------
from freetype import *
if __na... | bsd-3-clause | Python |
690ca3210ee0fdc06ca895015d11eba58980cb2a | Set up sandbox project to use django_emarsys | machtfit/django-emarsys,machtfit/django-emarsys | sandbox/settings.py | sandbox/settings.py | """
Django settings for sandbox project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | """
Django settings for sandbox project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | mit | Python |
f6e7ca80951ad1476919a245d968ec79c6a4d8d6 | Use lambda instead of another method | anapaulagomes/reviews-assigner | hunter/reviewsapi.py | hunter/reviewsapi.py | import requests
import os
from .endpoints import *
class UnauthorizedToken(Exception):
pass
class ReviewsAPI:
def __init__(self):
token = os.environ['UDACITY_AUTH_TOKEN']
self.headers = {'Authorization': token, 'Content-Length': '0'}
def execute(self, request):
try:
... | import requests
import os
from .endpoints import *
class UnauthorizedToken(Exception):
pass
class ReviewsAPI:
def __init__(self):
token = os.environ['UDACITY_AUTH_TOKEN']
self.headers = {'Authorization': token, 'Content-Length': '0'}
def execute(self, request):
try:
... | mit | Python |
e7cb98a1006d292a96670a11c807d0bbf9075ebd | Update timeout to 10 seconds | shlomihod/scenario,shlomihod/scenario,shlomihod/scenario | scenario/_consts.py | scenario/_consts.py | from collections import OrderedDict
ACTORS = list('NRAIOVF')
FILE_COMMANDS = ['copy', 'compare']
VERBOSITY = OrderedDict(
[ ('RETURN_CODE', 0),
('RESULT' , 1),
('ERROR' , 2),
('EXECUTION' , 3),
('DEBUG' , 4),
])
VERBOSITY_DEFAULT... | from collections import OrderedDict
ACTORS = list('NRAIOVF')
FILE_COMMANDS = ['copy', 'compare']
VERBOSITY = OrderedDict(
[ ('RETURN_CODE', 0),
('RESULT' , 1),
('ERROR' , 2),
('EXECUTION' , 3),
('DEBUG' , 4),
])
VERBOSITY_DEFAULT... | mit | Python |
10c28f291f4ffae5c209ce57358b1249f0f2f8d3 | Update smarthome.py | kankiri/pabiana | demos/smarthome/smarthome.py | demos/smarthome/smarthome.py | #!/usr/bin/env python3
import logging
from pabiana import area
from pabiana.area import autoloop, load_interfaces, pulse, register, scheduling, subscribe
from pabiana.node import create_publisher, run
NAME = 'smarthome'
publisher = None
# Triggers
@register
def increase_temp():
area.context['temperature'] += 0.25... | import logging
from pabiana import area
from pabiana.area import autoloop, load_interfaces, pulse, register, scheduling, subscribe
from pabiana.node import create_publisher, run
NAME = 'smarthome'
publisher = None
# Triggers
@register
def increase_temp():
area.context['temperature'] += 0.25
autoloop(increase_temp... | mit | Python |
baa84337e3811417a0c7ada0c9e57c9560864320 | Add remote option | thatch45/rflo | rflo/config.py | rflo/config.py | '''
Behaviors to generate the config
'''
# Import ioflo
import ioflo.base.deeding
# Import python libs
import copy
import io
import socket
import argparse
# Import third party libs
import yaml
DEFAULTS = {
'interface': '0.0.0.0',
'port': 7750,
'cachedir': '/var/cache/rflo'
}
class RaftCli(ioflo.bas... | '''
Behaviors to generate the config
'''
# Import ioflo
import ioflo.base.deeding
# Import python libs
import copy
import io
import socket
import argparse
# Import third party libs
import yaml
DEFAULTS = {
'interface': '0.0.0.0',
'port': 7750,
'cachedir': '/var/cache/rflo'
}
class RaftCli(ioflo.bas... | apache-2.0 | Python |
e4ff365167de1c2e0dce69b68d01209f8fd1a586 | Change test to assign group to different user | erikiado/jp2_online,erikiado/jp2_online,erikiado/jp2_online | perfiles_usuario/test_views.py | perfiles_usuario/test_views.py | from django.core.urlresolvers import reverse
from django.contrib.auth.models import User, Group
from rest_framework.test import APITestCase
from rest_framework import status
from rest_framework.authtoken.models import Token
from .models import Capturista
from .utils import SERVICIOS_ESCOLARES_GROUP
class TokenCreat... | from django.core.urlresolvers import reverse
from django.contrib.auth.models import User, Group
from rest_framework.test import APITestCase
from rest_framework import status
from rest_framework.authtoken.models import Token
from .models import Capturista
from .utils import SERVICIOS_ESCOLARES_GROUP
class TokenCreat... | mit | Python |
c88da9278f9aa7ff47313707eb9464bb4f46436f | Add import for DeviceCredentials in v2/__init__.py | auth0/auth0-python,auth0/auth0-python | auth0/v2/__init__.py | auth0/v2/__init__.py | from .connection import Connection
from .client import Client
from .device_credentials import DeviceCredentials
| from .connection import Connection
from .client import Client
| mit | Python |
7ce5af8978e0fc792caab26a04e34b841fc6c9bd | Add configure .bashrc | jtdressel/woodhouse | initialize_system.py | initialize_system.py | #Currently unstable. Don't use.
#determine where config files are
import subprocess
import struct
#if needed install dropbox
#if dropbox is set up
def install_dropbox():
if((struct.calcsize("P") *8) is 32):
#TODO: insert code to check if already installed
subprocess.call('cd ~ && wget -O - "htt... | #Currently unstable. Don't use.
#determine where config files are
import subprocess
import struct
#if needed install dropbox
#if dropbox is set up
def install_dropbox():
if((struct.calcsize("P") *8) is 32):
#TODO: insert code to check if already installed
subprocess.call('cd ~ && wget -O - "htt... | mit | Python |
c87c3b48bcdf704c16447e591df661a45ff02afa | Update preview script | tobspr/Panda3D-Bam-Exporter | rp/generate.py | rp/generate.py | from __future__ import print_function
# Enter the path to the render pipeline here, without trailing slash
RP_PATH = "E:/Projects/Brainz stuff/RenderPipeline"
import sys
import os
from panda3d.core import *
from direct.showbase.ShowBase import ShowBase
base_path = os.path.dirname(os.path.realpath(__file__))
out_p... | from __future__ import print_function
import sys
import os
from panda3d.core import *
from direct.showbase.ShowBase import ShowBase
base_path = os.path.dirname(os.path.realpath(__file__))
out_path = os.path.join(base_path, "output.png")
out_fpath = Filename.from_os_specific(out_path)
try:
w = int(sys.argv[1])
... | mit | Python |
cde156d3408467d7ecdd63febb472e4d05ef0559 | correct REPO_ROOT default | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | zeus/cli/init.py | zeus/cli/init.py | import binascii
import click
import os
from .base import cli
CONFIG = """
SECRET_KEY = {secret_key}
GITHUB_CLIENT_ID = {github_client_id}
GITHUB_CLIENT_SECRET = {github_client_secret}
REPO_ROOT = {repo_root}
""".strip()
@cli.command(help='Create default configuration.')
@click.option('--github-client-id', prompt=... | import binascii
import click
import os
from .base import cli
CONFIG = """
SECRET_KEY = {secret_key}
GITHUB_CLIENT_ID = {github_client_id}
GITHUB_CLIENT_SECRET = {github_client_secret}
REPO_ROOT = {repo_root}
""".strip()
@cli.command(help='Create default configuration.')
@click.option('--github-client-id', prompt=... | apache-2.0 | Python |
e3f67c38b7e4f17d62c23c4214a8a88eee21bc50 | Bump version to 0.2.2 | MichaelAquilina/s3backup,MichaelAquilina/s3backup | s4/__init__.py | s4/__init__.py | VERSION = '0.2.2'
| VERSION = '0.2.1'
| mit | Python |
bb075e46449b0bdec63b404025bd6e9df074bd08 | Update urls.py | avojnovicDk/stormpath-django-sample,avojnovicDk/stormpath-django-sample | sample/urls.py | sample/urls.py | from django.conf.urls import patterns, url, include
from django.core.urlresolvers import reverse_lazy
from django.views.generic.base import TemplateView, RedirectView
import django_stormpath
from .views import *
urlpatterns = patterns('',
url(r'^$', TemplateView.as_view(template_name="home.html"), name='home'),
... | from django.conf.urls import patterns, url, include
from django.core.urlresolvers import reverse_lazy
from django.views.generic.base import TemplateView, RedirectView
import django_stormpath
from .views import *
urlpatterns = patterns('',
url(r'^$', TemplateView.as_view(template_name="home.html"), name='home'),
... | apache-2.0 | Python |
cac3738a1c0d08664281d6ae74f3beb95d666a2d | add itol in API | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | sequana/__init__.py | sequana/__init__.py |
import pkg_resources
try:
version = pkg_resources.require("sequana")[0].version
except:
version = ">=0.7.1"
try:
from easydev.logging_tools import Logging
logger = Logging("sequana", "WARNING")
except:
import colorlog
logger = colorlog.getLogger("sequana")
from easydev import CustomConfig
... |
import pkg_resources
try:
version = pkg_resources.require("sequana")[0].version
except:
version = ">=0.7.1"
try:
from easydev.logging_tools import Logging
logger = Logging("sequana", "WARNING")
except:
import colorlog
logger = colorlog.getLogger("sequana")
from easydev import CustomConfig
... | bsd-3-clause | Python |
deea431fbf46766c8900ec633b8b566439ece176 | Stop polling also if the status is 'failed' | gem/oq-svir-qgis,gem/oq-svir-qgis,gem/oq-svir-qgis,gem/oq-svir-qgis | svir/dialogs/show_console_dialog.py | svir/dialogs/show_console_dialog.py | # -*- coding: utf-8 -*-
# /***************************************************************************
# Irmt
# A QGIS plugin
# OpenQuake Integrated Risk Modelling Toolkit
# -------------------
# begin : 2013-10-24
# copyright ... | # -*- coding: utf-8 -*-
# /***************************************************************************
# Irmt
# A QGIS plugin
# OpenQuake Integrated Risk Modelling Toolkit
# -------------------
# begin : 2013-10-24
# copyright ... | agpl-3.0 | Python |
5986a0a805353f7ac3dcbd03652757b936aabf45 | Update 3 | NguyenHoaiNam/search_mailling_list | search_what.py | search_what.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Nguyen Hoai Nam
import optparse
import requests
MAPPING_MONTH = {
1: "January", 2: "February", 3: "March", 4: "April",
5: "May", 6: "June", 7: "July", 8: "August", 9: "September",
10: "October", 11: "November", 12: "December"
}
def get_url(month_num... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Nguyen Hoai Nam
import optparse
import requests
MAPPING_MONTH = {
1: "January", 2: "February", 3: "March", 4: "April",
5: "May", 6: "June", 7: "July", 8: "August", 9: "September",
10: "October", 11: "November", 12: "December"
}
def get_url(month_num... | mit | Python |
9f2170cd378d4901f1aa2ac294f83490f1453e13 | bump version for #30 | ensky/taiga-contrib-ldap-auth,antonc42/taiga-contrib-ldap-auth | taiga_contrib_ldap_auth/__init__.py | taiga_contrib_ldap_auth/__init__.py | # Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program 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 F... | # Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program 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 F... | agpl-3.0 | Python |
f710479e01d50dad03133d76b349398ab11e8675 | Drop FIREBASE_SECRET (since been revoked) | google/playhvz,google/playhvz,google/playhvz,google/playhvz,google/playhvz,google/playhvz,google/playhvz,google/playhvz | backend/constants.py | backend/constants.py | # Fill out with value from
# https://console.firebase.google.com/project/trogdors-29fa4/settings/serviceaccounts/databasesecrets
FIREBASE_SECRET = ""
FIREBASE_EMAIL = ""
ALLEGIANCES = ('horde', 'resistance', 'none')
TEST_ENDPOINT = 'http://localhost:8080'
PLAYER_VOLUNTEER_ARGS = (
'helpAdvertising', 'helpLogistics'... | # Fill out with value from
# https://firebase.corp.google.com/project/trogdors-29fa4/settings/database
FIREBASE_SECRET = "ZiD9uLhDnrLq2n416MjWjn0JOrci6H0oGm7bKyVN"
FIREBASE_EMAIL = ""
ALLEGIANCES = ('horde', 'resistance', 'none')
TEST_ENDPOINT = 'http://localhost:8080'
PLAYER_VOLUNTEER_ARGS = (
'helpAdvertising', '... | apache-2.0 | Python |
d4c622dd580b86389bb3e7bc39b9c3f2e25d8e76 | return value for when 'before' pipeline fails | Proteogenomics/trackhub-creator,Proteogenomics/trackhub-creator | pipelines/template_pipeline.py | pipelines/template_pipeline.py | #
# Author : Manuel Bernal Llinares
# Project : trackhub-creator
# Timestamp : 29-06-2017 15:05
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
This is a template pipeline for refactoring out things from final pipelines as I identify how they're gonna look like
"""
impor... | #
# Author : Manuel Bernal Llinares
# Project : trackhub-creator
# Timestamp : 29-06-2017 15:05
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
This is a template pipeline for refactoring out things from final pipelines as I identify how they're gonna look like
"""
impor... | apache-2.0 | Python |
9e6288e60a7cadb47e151c676512460617e0190b | Fix master verification | Motoko11/MotoBot | motobot/core_plugins/master_verification.py | motobot/core_plugins/master_verification.py | from motobot import hook, sink, request, Priority
def get_master_lists(bot, session):
confirmed, unconfirmed = session.get((set(), None))
if unconfirmed is None:
unconfirmed = set(map(str.lower, bot.masters))
session.set((confirmed, unconfirmed))
return confirmed, unconfirmed
@request(... | from motobot import hook, sink, request, Priority
def get_master_lists(bot, session):
confirmed, unconfirmed = session.get((set(), None))
if unconfirmed is None:
unconfirmed = set(map(str.lower, bot.masters))
session.set((confirmed, unconfirmed))
return confirmed, unconfirmed
@request(... | mit | Python |
b85751e356c091d2dffe8366a94fbb42bfcad34e | Fix a bug - salome.py is not imported here and this causes run-time Python exception | FedoraScientific/salome-smesh,FedoraScientific/salome-smesh,FedoraScientific/salome-smesh,FedoraScientific/salome-smesh | src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py | src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py | from meshpy import *
def BuildGroupLyingOn(theMesh, theElemType, theName, theShape):
aFilterMgr = smesh.CreateFilterManager()
aFilter = aFilterMgr.CreateFilter()
aLyingOnGeom = aFilterMgr.CreateLyingOnGeom()
aLyingOnGeom.SetGeom(theShape)
aLyingOnGeom.SetElementType(theElemType)
aFilte... | import SMESH
def BuildGroupLyingOn(theMesh, theElemType, theName, theShape):
aMeshGen = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
aFilterMgr = aMeshGen.CreateFilterManager()
aFilter = aFilterMgr.CreateFilter()
aLyingOnGeom = aFilterMgr.CreateLyingOnGeom()
aLyingOnGeom.SetGeom(th... | lgpl-2.1 | Python |
34889fc6d8d3ac1cf5af11039cc1ec40185f778e | Update quick_sort.py (#928) | TheAlgorithms/Python | sorts/quick_sort.py | sorts/quick_sort.py | """
This is a pure python implementation of the quick sort algorithm
For doctests run following command:
python -m doctest -v quick_sort.py
or
python3 -m doctest -v quick_sort.py
For manual testing run:
python quick_sort.py
"""
from __future__ import print_function
def quick_sort(collection):
"""Pure implementa... | """
This is a pure python implementation of the quick sort algorithm
For doctests run following command:
python -m doctest -v quick_sort.py
or
python3 -m doctest -v quick_sort.py
For manual testing run:
python quick_sort.py
"""
from __future__ import print_function
def quick_sort(collection):
"""Pure implementa... | mit | Python |
af122451c220d7444dcfaca6a1db318df69712c8 | fix classname | yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti | plugins/feeds/public/cruzit.py | plugins/feeds/public/cruzit.py | import logging
from datetime import timedelta
from core.errors import ObservableValidationError
from core.feed import Feed
from core.observables import Ip
class Cruzit(Feed):
default_values = {
"frequency": timedelta(hours=13),
"name": "Cruzit",
"source": "https://iplists.firehol.org/file... | import logging
from datetime import timedelta
from core.errors import ObservableValidationError
from core.feed import Feed
from core.observables import Ip
class BlocklistdeAll(Feed):
default_values = {
"frequency": timedelta(hours=13),
"name": "Cruzit",
"source": "https://iplists.firehol.... | apache-2.0 | Python |
c3957dbb25a8b5eeeccd37f218976721249b93e2 | Correct unit tests to comply with new team name RE | michaelwisely/django-competition,michaelwisely/django-competition,michaelwisely/django-competition | src/competition/tests/validator_tests.py | src/competition/tests/validator_tests.py | from django.test import TestCase
from django.template.defaultfilters import slugify
from django.core.exceptions import ValidationError
from competition.validators import greater_than_zero, non_negative, validate_name
class ValidationFunctionTest(TestCase):
def test_greater_than_zero(self):
"""Check grea... | from django.test import TestCase
from django.template.defaultfilters import slugify
from django.core.exceptions import ValidationError
from competition.validators import greater_than_zero, non_negative, validate_name
class ValidationFunctionTest(TestCase):
def test_greater_than_zero(self):
"""Check grea... | bsd-3-clause | Python |
006fd8978c64aa2cb38d6203b508ee302f6fc8d2 | Set searches choices | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon/db/models/searches.py | polyaxon/db/models/searches.py | from django.conf import settings
from django.contrib.postgres.fields import JSONField
from django.db import models
from constants import content_types
from db.models.utils import DiffModel, NameableModel
class Search(DiffModel, NameableModel):
"""A saved search query."""
search_content_types = (
(con... | from django.conf import settings
from django.contrib.postgres.fields import JSONField
from django.db import models
from constants import content_types
from db.models.utils import DiffModel, NameableModel
class Search(DiffModel, NameableModel):
"""A saved search query."""
project = models.ForeignKey(
... | apache-2.0 | Python |
3b84c3b17ffee4eb2f0c0eb218dab656e96ebddf | Add file_actions to Configuration. | rbarrois/uconf | confmgr/config.py | confmgr/config.py | # -*- coding: utf-8 -*-
from __future__ import with_statement
# Global imports
import ConfigParser
import os
import re
import subprocess
# Local imports
from . import action_parser
from . import rule_parser
class ActionConfig(object):
"""Definition of the action for a file."""
COPY = 'copy'
SYMLINK = ... | # -*- coding: utf-8 -*-
from __future__ import with_statement
# Global imports
import ConfigParser
import os
import re
import subprocess
# Local imports
from . import rule_parser
class ActionConfig(object):
"""Definition of the action for a file."""
COPY = 'copy'
SYMLINK = 'symlink'
PARSE = 'parse... | bsd-2-clause | Python |
bf13c37fe65cd818d580fbe57df5f6eaa2e9993a | Change behaviour of WiP form generation to allow explicit field models to be passed | mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola | pombola/writeinpublic/forms.py | pombola/writeinpublic/forms.py | from django import forms
from django.forms import SelectMultiple, ModelMultipleChoiceField, ModelChoiceField
from pombola.core.models import Person
from .client import WriteInPublic
class RecipientForm(forms.Form):
# Dynamicly create fields so we can show either people or committees
def __init__(self, *args... | from django import forms
from django.forms import SelectMultiple, ModelMultipleChoiceField, ModelChoiceField
from pombola.core.models import Person
from .client import WriteInPublic
class RecipientForm(forms.Form):
# Dynamicly create fields so we can show either people or committees
def __init__(self, *args... | agpl-3.0 | Python |
45b108393f38bf269ce5d7b9cf1476045dd30481 | add patient and clinic as foreign keys | slogan621/tscharts,slogan621/tscharts,slogan621/tscharts | consent/models.py | consent/models.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from register.models import Register
from patient.models import Patient
from clinic.models import Clinic
class Consent(models.Model):
registration = models.ForeignKey(Register)
patient = models.ForeignKey(Patient)
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from register.models import Register
class Consent(models.Model):
register = models.ForeignKey(Register)
general_consent = models.BooleanField(default = False)
photo_consent = models.BooleanField(default = False)... | apache-2.0 | Python |
54ac7fc3bd965e3fe803745de7c32ab284c2509e | Make route parameter name match function argument (#137) | Yelp/beans,Yelp/beans,Yelp/beans | api/yelp_beans/routes/api/v1/preferences.py | api/yelp_beans/routes/api/v1/preferences.py | import logging
from flask import Blueprint
from flask import jsonify
from flask import request
from yelp_beans.logic.subscription import filter_subscriptions_by_user_data
from yelp_beans.logic.subscription import merge_subscriptions_with_preferences
from yelp_beans.logic.user import add_preferences
from yelp_beans.log... | import logging
from flask import Blueprint
from flask import jsonify
from flask import request
from yelp_beans.logic.subscription import filter_subscriptions_by_user_data
from yelp_beans.logic.subscription import merge_subscriptions_with_preferences
from yelp_beans.logic.user import add_preferences
from yelp_beans.log... | mit | Python |
831dc2c7af5a69f50a8cd76cfe3f0d3c724c981d | Bump version to 0.9.0.dev (#489) | quantumlib/OpenFermion,jarrodmcc/OpenFermion,kevinsung/OpenFermion,quantumlib/OpenFermion,quantumlib/OpenFermion,kevinsung/OpenFermion,jarrodmcc/OpenFermion,kevinsung/OpenFermion | src/openfermion/_version.py | src/openfermion/_version.py | # 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, software
# distribu... | # 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, software
# distribu... | apache-2.0 | Python |
8cf59825b65a328e9aadaeb209d48f6f2995c31e | add todo | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | portality/tasks/anon_export.py | portality/tasks/anon_export.py | import portality.scripts.anon_export as anon_export_core
from portality import background_helper
from portality.background import BackgroundTask
from portality.decorators import write_required
from portality.tasks.redis_huey import main_queue, schedule
class AnonExportBackgroundTask(BackgroundTask):
__action__ = ... | import portality.scripts.anon_export as anon_export_core
from portality import background_helper
from portality.background import BackgroundTask
from portality.decorators import write_required
from portality.tasks.redis_huey import main_queue, schedule
class AnonExportBackgroundTask(BackgroundTask):
__action__ = ... | apache-2.0 | Python |
fa21f4081bef036dc2eb163becd26d7dbd4ef029 | Use string keys for document's relevance dict | fire-uta/iiix-data-parser | document.py | document.py | import sys
from numpy import uint16
from data_record import DataRecord
class Document(DataRecord):
def __init__(self, docid):
DataRecord.__init__( self, docid )
self.relevances = {}
def add_relevance(self, relevance):
self.relevances[ str(relevance.topic.record_id) ] = relevance
def get_releva... | from numpy import uint16
from data_record import DataRecord
class Document(DataRecord):
def __init__(self, docid):
DataRecord.__init__( self, docid )
self.relevances = {}
def add_relevance(self, relevance):
self.relevances[ relevance.topic.record_id ] = relevance
def get_relevance_for_topic(self... | mit | Python |
677a74c3ecd6a7b88140fa7a3c639242804ae550 | Use __all__ in __init__ | melinath/django-graph-api,melinath/django-graph-api | django_graph_api/__init__.py | django_graph_api/__init__.py | __version__ = '0.1.0'
from .graphql.schema import Schema
from .graphql.types import (
BooleanField,
CharField,
FloatField,
IdField,
IntegerField,
ManyRelatedField,
Object,
RelatedField,
)
from .views import GraphQLView
__all__ = ('Schema',
'BooleanField',
'CharFiel... | __version__ = '0.1.0'
from .graphql.schema import Schema
from .graphql.types import (
BooleanField,
CharField,
FloatField,
IdField,
IntegerField,
ManyRelatedField,
Object,
RelatedField,
)
from .views import GraphQLView
| mit | Python |
5ab6c21bbcaaf9b919c9a796ec00d1a805ec1b0d | Set bplan default email to english as default | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | apps/bplan/emails.py | apps/bplan/emails.py | from adhocracy4.emails import Email
class OfficeWorkerNotification(Email):
template_name = 'meinberlin_bplan/emails/office_worker_notification'
@property
def office_worker_email(self):
project = self.object.project
return project.externalproject.bplan.office_worker_email
def get_rece... | from adhocracy4.emails import Email
class OfficeWorkerNotification(Email):
template_name = 'meinberlin_bplan/emails/office_worker_notification'
@property
def office_worker_email(self):
project = self.object.project
return project.externalproject.bplan.office_worker_email
def get_rece... | agpl-3.0 | Python |
97b8148dab05e814da93e7ff7876aeb42b490bc3 | remove print statements | datahuborg/datahub,datahuborg/datahub,anantb/datahub,anantb/datahub,anantb/datahub,anantb/datahub,datahuborg/datahub,datahuborg/datahub,anantb/datahub,datahuborg/datahub,anantb/datahub,datahuborg/datahub,anantb/datahub,datahuborg/datahub | src/account/management/commands/renamecards.py | src/account/management/commands/renamecards.py | import re
from inventory.models import Card
def rename_cards(*args, **kwargs):
cards = Card.objects.all()
for card in cards:
card_name = card.card_name
# if the card name doesn't match
if not re.match(r'^[A-Za-z0-9_]+$', card_name):
new_name = clean_str(card_name)
... | import re
from inventory.models import Card
def rename_cards(*args, **kwargs):
cards = Card.objects.all()
for card in cards:
card_name = card.card_name
# print(card_name)
# if the card name doesn't match
if not re.match(r'^[A-Za-z0-9_]+$', card_name):
# print('renam... | mit | Python |
fa86706ae6cf77ef71402bb86d12cdd3cb79dafc | Add verification for removing key from netrc file | scrapinghub/shub | shub/logout.py | shub/logout.py | import re, click
from shub.utils import get_key_netrc, NETRC_FILE
@click.command(help='remove Scrapinghug API key from the netrc file')
@click.pass_context
def cli(context):
if not get_key_netrc():
context.fail('Key not found in netrc file')
error, msg = remove_sh_key()
if error:
context.fa... | import re, click
from shub.utils import get_key_netrc, NETRC_FILE
@click.command(help='remove Scrapinghug API key from the netrc file')
@click.pass_context
def cli(context):
if not get_key_netrc():
context.fail('Key not found in netrc file')
with open(NETRC_FILE, 'r+') as out:
key_re = r'machin... | bsd-3-clause | Python |
d90f4729661abfa7a45098242711173a554f4012 | update templates | janusnic/initpy,Parkayun/initpy,wzyuliyang/initpy | flask_init/templates.py | flask_init/templates.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from string import Template
app_init_template = Template("""
#!/usr/bin/python
# -*- coding:utf-8 -*-
from flask import Flask
app = Flask(__name__)
def create_app():
from ${module} import ${module}_blueprint
app.register_blueprint(${module}_blueprint)
return ap... | #!/usr/bin/python
# -*- coding: utf-8 -*-
from string import Template
app_init_template = Template("""
#!/usr/bin/python
# -*- coding:utf-8 -*-
from flask import Flask
app = Flask(__name__)
def create_app():
from ${module} import ${module}_blueprint
app.register_blueprint(${module}_blueprint)
return ap... | mit | Python |
f59a70c22c30fbfd44687f416e1a89ca1be9a488 | Optimise slightly | CubicComet/exercism-python-solutions | sieve/sieve.py | sieve/sieve.py | def sieve(n):
return list(primes(n))
def primes(n):
if n < 2:
raise StopIteration
yield 2
not_prime = set()
for i in range(3, n+1, 2):
if i not in not_prime:
yield i
not_prime.update(range(i*i, n, i))
| def sieve(n):
return list(primes(n))
def primes(n):
if n < 2:
raise StopIteration
yield 2
not_prime = set()
for i in range(3, n+1, 2):
if i not in not_prime:
yield i
not_prime.update(range(i, n, i))
| agpl-3.0 | Python |
31e55f7697d89d2b1592b83b0c66fc085a5d3bf8 | Fix #128 Replace path with re_path in test urls | James1345/django-rest-knox,James1345/django-rest-knox | knox_project/urls.py | knox_project/urls.py | try:
# For django >= 2.0
from django.urls import include, re_path
except ImportError:
# For django < 2.0
from django.conf.urls import include, url
re_path = url
from .views import RootView
urlpatterns = [
re_path(r'^api/', include('knox.urls')),
re_path(r'^api/$', RootView.as_view(), name=... | try:
# For django >= 2.0
from django.urls import include, path
except ImportError:
# For django < 2.0
from django.conf.urls import include, url
path = url
from .views import RootView
urlpatterns = [
path(r'^api/', include('knox.urls')),
path(r'^api/$', RootView.as_view(), name="api-root"),... | mit | Python |
b00641dc625506650366c9d38e425633acb6e162 | correct the upload and implement clear | imrehg/labhardware,imrehg/labhardware | projects/slm/trigger_upload.py | projects/slm/trigger_upload.py | """
Uploading triggerable data to the spatial light modulator
TODO:
+ How to treat the two masks?
+ Error handling
+ Generalization: make it importable or use import from other slmcontrol?
+ Confirmation before upload
+ Show in file-selection title the index of the file to be uploaded ("select file #3")
+ Store settin... | """
Uploading triggerable data to the spatial light modulator
TODO:
+ How to treat the two masks?
+ Error handling
+ Generalization: make it importable or use import from other slmcontrol?
+ Confirmation before upload
+ Show in file-selection title the index of the file to be uploaded ("select file #3")
+ Store settin... | mit | Python |
2239bae22f98990cdcdc7c8fdd7cfa5758ea8252 | Bump version to 1.6.1.dev1 | gregmuellegger/django-floppyforms,gregmuellegger/django-floppyforms,gregmuellegger/django-floppyforms | floppyforms/__init__.py | floppyforms/__init__.py | # flake8: noqa
from django.forms import (BaseModelForm, model_to_dict, fields_for_model,
ValidationError, Media, MediaDefiningClass)
from .fields import *
from .forms import *
from .models import *
from .widgets import *
try:
# Django < 1.9
from django.forms import save_instance
exce... | # flake8: noqa
from django.forms import (BaseModelForm, model_to_dict, fields_for_model,
ValidationError, Media, MediaDefiningClass)
from .fields import *
from .forms import *
from .models import *
from .widgets import *
try:
# Django < 1.9
from django.forms import save_instance
exce... | bsd-3-clause | Python |
8228440319ef6947edd6b3bbf4936327f0431853 | Allow accessing help during first boot | vignanl/Plinth,vignanl/Plinth,kkampardi/Plinth,harry-7/Plinth,kkampardi/Plinth,freedomboxtwh/Plinth,kkampardi/Plinth,vignanl/Plinth,jvalleroy/plinth-debian,kkampardi/Plinth,kkampardi/Plinth,harry-7/Plinth,freedomboxtwh/Plinth,jvalleroy/plinth-debian,jvalleroy/plinth-debian,jvalleroy/plinth-debian,freedomboxtwh/Plinth,f... | plinth/modules/first_boot/middleware.py | plinth/modules/first_boot/middleware.py | #
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | #
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | agpl-3.0 | Python |
d3c733f59e8fcc5848769cbeaab831d8c38e5130 | update of templat | Nic30/HWToolkit | hdl_toolkit/serializer/templates_simModel/process.py | hdl_toolkit/serializer/templates_simModel/process.py | # sensitivity: {{sensitivityList|join(", ")}}
def {{name}}(self, sim):
cVld_1 = True{% for stmLine in stmLines %}
{{ stmLine }}{% endfor %} | # sensitivity: {{sensitivityList|join(", ")}}
def {{name}}(self, sim):
_condVld = True{% for stmLine in stmLines %}
{{ stmLine }}{% endfor %} | mit | Python |
9792d6040c32b0e1f50d907f6fee5e11d46acd64 | Bump version number | spectralDNS/shenfun,spectralDNS/shenfun,spectralDNS/shenfun | shenfun/__init__.py | shenfun/__init__.py | """
This is the **shenfun** package
What is **shenfun**?
================================
``Shenfun`` is a high performance computing platform for solving partial
differential equations (PDEs) by the spectral Galerkin method. The user
interface to shenfun is very similar to
`FEniCS <https://fenicsproject.org>`_, but ... | """
This is the **shenfun** package
What is **shenfun**?
================================
``Shenfun`` is a high performance computing platform for solving partial
differential equations (PDEs) by the spectral Galerkin method. The user
interface to shenfun is very similar to
`FEniCS <https://fenicsproject.org>`_, but ... | bsd-2-clause | Python |
5ff35d282b61cfdfc53deaa0f1bc0f83850ff7a5 | Add helper method to turn queries into json-serializable lists | Storj/downstream-node,Storj/downstream-node | downstream_node/lib/utils.py | downstream_node/lib/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
def model_to_json(model):
""" Returns a JSON representation of an SQLAlchemy-backed object.
From Zato: https://github.com/zatosource/zato
"""
_json = {}
_json['fields'] = {}
_json['pk'] = getattr(model, 'id')
for col in model._sa... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
def model_to_json(model):
""" Returns a JSON representation of an SQLAlchemy-backed object.
From Zato: https://github.com/zatosource/zato
"""
_json = {}
_json['fields'] = {}
_json['pk'] = getattr(model, 'id')
for col in model._sa... | mit | Python |
bafef6a175116aff519579822f2382e8fbbd8808 | Make import statements explicit relative imports | plamere/spotipy | spotipy/__init__.py | spotipy/__init__.py | VERSION='2.4.5'
from .client import *
from .oauth2 import *
from .util import *
| VERSION='2.4.5'
from client import *
from oauth2 import *
from util import *
| mit | Python |
eab8f6f81333a04c24694c6c5f6769a2cf60ca8f | Enable replacement of common Turkish latin characters with similar ascii letters. | ebsaral/unicode-slugify-latin | slugify/__init__.py | slugify/__init__.py | import re
import six
import unicodedata
def smart_text(s, encoding='utf-8', errors='strict'):
if isinstance(s, six.text_type):
return s
if not isinstance(s, six.string_types):
if six.PY3:
if isinstance(s, bytes):
s = six.text_type(s, encoding, errors)
e... | import re
import six
import unicodedata
def smart_text(s, encoding='utf-8', errors='strict'):
if isinstance(s, six.text_type):
return s
if not isinstance(s, six.string_types):
if six.PY3:
if isinstance(s, bytes):
s = six.text_type(s, encoding, errors)
e... | bsd-3-clause | Python |
9341cbc013b4f471654d1fd5ad79a0827e572545 | Set version to v3.0.0a13 | spacy-io/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,honnibal/spaCy | spacy/about.py | spacy/about.py | # fmt: off
__title__ = "spacy-nightly"
__version__ = "3.0.0a13"
__release__ = True
__download_url__ = "https://github.com/explosion/spacy-models/releases/download"
__compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
__projects__ = "https://github.com/explosion/spacy-... | # fmt: off
__title__ = "spacy-nightly"
__version__ = "3.0.0a12"
__release__ = True
__download_url__ = "https://github.com/explosion/spacy-models/releases/download"
__compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
__projects__ = "https://github.com/explosion/spacy-... | mit | Python |
a589aa63f250a347ab24b7309e65ef25c7281437 | Correct import behavior to prevent Runtime error | gencer/sentry,jean/sentry,fotinakis/sentry,gencer/sentry,looker/sentry,BuildingLink/sentry,gencer/sentry,jean/sentry,JackDanger/sentry,fotinakis/sentry,BuildingLink/sentry,beeftornado/sentry,zenefits/sentry,beeftornado/sentry,looker/sentry,ifduyue/sentry,ifduyue/sentry,JamesMura/sentry,ifduyue/sentry,JamesMura/sentry,B... | src/sentry/utils/imports.py | src/sentry/utils/imports.py | """
sentry.utils.imports
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import pkgutil
import six
class ModuleProxyCache(dict):
def __missing__(self, key):
if '.' not... | """
sentry.utils.imports
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import pkgutil
import six
class ModuleProxyCache(dict):
def __missing__(self, key):
if '.' not... | bsd-3-clause | Python |
6b69b8934b483862a3e7d57ace26ae05ce16d053 | Set version to v3.1.0.dev0 (#8379) | explosion/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy | spacy/about.py | spacy/about.py | # fmt: off
__title__ = "spacy"
__version__ = "3.1.0.dev0"
__download_url__ = "https://github.com/explosion/spacy-models/releases/download"
__compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
__projects__ = "https://github.com/explosion/projects"
__projects_branch__ =... | # fmt: off
__title__ = "spacy"
__version__ = "3.0.6"
__download_url__ = "https://github.com/explosion/spacy-models/releases/download"
__compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
__projects__ = "https://github.com/explosion/projects"
__projects_branch__ = "v3"... | mit | Python |
d35aa7344ed96c8e1e17ea74ba14a760a3c8a418 | Change version ID to make PyPi happy | banglakit/spaCy,recognai/spaCy,spacy-io/spaCy,honnibal/spaCy,honnibal/spaCy,oroszgy/spaCy.hu,oroszgy/spaCy.hu,aikramer2/spaCy,explosion/spaCy,honnibal/spaCy,explosion/spaCy,banglakit/spaCy,recognai/spaCy,Gregory-Howard/spaCy,raphael0202/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/spaCy,banglakit/spaCy,spacy-io/spaCy,... | spacy/about.py | spacy/about.py | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__title__ = 'spacy'
__version__ = '1.0.0-a'
__summary__ = 'Industrial-strength NLP'
__uri__ = 'https://spacy.io'
__author__ = 'Matthew Honnibal... | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__title__ = 'spacy'
__version__ = '1.0.0+a'
__summary__ = 'Industrial-strength NLP'
__uri__ = 'https://spacy.io'
__author__ = 'Matthew Honnibal... | mit | Python |
e7369596a5aa213c67fff974091dd579fbf33be8 | Remove git caching | mwilliamson/mayo | mayo/git.py | mayo/git.py | import os
import os.path
import hashlib
from .util import run
import mayo.caching
class Git(object):
name = "git"
directory_name = ".git"
default_branch = "origin/master"
def clone(self, repository_uri, local_path):
_git(["clone", repository_uri, local_path])
return GitRepository... | import os
import os.path
import hashlib
from .util import run
import mayo.caching
class Git(object):
name = "git"
directory_name = ".git"
default_branch = "origin/master"
supports_caching = True
def __init__(self, use_cache=False):
self._use_cache = use_cache
def use_cac... | bsd-2-clause | Python |
afe52d633cb391f1b73804f85628369e87481fd6 | update selection | peccu/find-duplicates-from-bookmarks.plist | selectDuplicates.py | selectDuplicates.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import Folder
def select_each(item):
def select_print(path):
# print str(Folder.getDepth(item)) + ': folder:' + Folder.getPath(item) + ' => ' + path
if item['path'] == path:
return
if (len(item['path']) < len(path)) or (len(item['path']) == len(path) an... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import Folder
def select_each(item):
def select_print(path):
print str(Folder.getDepth(item)) + ': folder:' + Folder.getPath(item) + ' => ' + path
map(select_print, item['dup'])
def select_duplicate(list):
map(select_each, list)
| mit | Python |
5eb2db817837264fc9649fff9c846fa322ba4750 | Add multiprocessing | Neuroglycerin/neukrill-net-work,Neuroglycerin/neukrill-net-work,Neuroglycerin/neukrill-net-work | generate_local_cache.py | generate_local_cache.py | #!/usr/bin/env python
import sys
import numpy as np
import sklearn
import neukrill_net.utils
import neukrill_net.highlevelfeatures
import neukrill_net.stacked
import time
from sklearn.externals import joblib
import sklearn.ensemble
import sklearn.pipeline
import sklearn.feature_selection
import sklearn.grid_search
t... | #!/usr/bin/env python
import sys
import numpy as np
import sklearn
import neukrill_net.utils
import neukrill_net.highlevelfeatures
import neukrill_net.stacked
import time
from sklearn.externals import joblib
import sklearn.ensemble
import sklearn.pipeline
import sklearn.feature_selection
import sklearn.grid_search
t... | mit | Python |
857ae593c14ea2401f0bb21d53d8e464fc7d3cb2 | Change lab assistant constant to one word | Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok | server/constants.py | server/constants.py | """App constants"""
STUDENT_ROLE = 'student'
GRADER_ROLE = 'grader'
STAFF_ROLE = 'staff'
INSTRUCTOR_ROLE = 'instructor'
LAB_ASSISTANT_ROLE = 'lab_assistant'
VALID_ROLES = [STUDENT_ROLE, GRADER_ROLE, STAFF_ROLE, INSTRUCTOR_ROLE, LAB_ASSISTANT_ROLE]
STAFF_ROLES = [GRADER_ROLE, STAFF_ROLE, INSTRUCTOR_ROLE]
GRADE_TAGS = [... | """App constants"""
STUDENT_ROLE = 'student'
GRADER_ROLE = 'grader'
STAFF_ROLE = 'staff'
INSTRUCTOR_ROLE = 'instructor'
LAB_ASSISTANT_ROLE = 'lab assistant'
VALID_ROLES = [STUDENT_ROLE, GRADER_ROLE, STAFF_ROLE, INSTRUCTOR_ROLE, LAB_ASSISTANT_ROLE]
STAFF_ROLES = [GRADER_ROLE, STAFF_ROLE, INSTRUCTOR_ROLE]
GRADE_TAGS = [... | apache-2.0 | Python |
f18599279e3c8be8083061c3a909e7b72fb89025 | add standalone test code | sethwoodworth/py3status,valdur55/py3status,UmBsublime/py3status,guiniol/py3status,Zopieux/py3status,Shir0kamii/py3status,vjousse/py3status,ultrabug/py3status,Spirotot/py3status,valdur55/py3status,jazmit/py3status,docwalter/py3status,guiniol/py3status,vvoland/py3status,goto-bus-stop/py3status,Andrwe/py3status,ultrabug/p... | py3status/modules/scratchpad_counter.py | py3status/modules/scratchpad_counter.py | # -*- coding: utf-8 -*-
"""
Module showing amount of windows at the scratchpad.
@author shadowprince
@license Eclipse Public License
"""
import i3
from time import time
def find_scratch(tree):
if tree["name"] == "__i3_scratch":
return tree
else:
for x in tree["nodes"]:
result = f... | # -*- coding: utf-8 -*-
"""
Module showing amount of windows at the scratchpad.
@author shadowprince
@license Eclipse Public License
"""
import i3
from time import time
def find_scratch(tree):
if tree["name"] == "__i3_scratch":
return tree
else:
for x in tree["nodes"]:
result = f... | bsd-3-clause | Python |
2b543800ddfc2a5fdfc51ef10956e6298f8f0b99 | Add system test for CounterController | dls-controls/pymalcolm,dls-controls/pymalcolm,dls-controls/pymalcolm | tests/test_core/test_system_core.py | tests/test_core/test_system_core.py | import unittest
from . import util
# logging
# import logging
# logging.basicConfig(level=logging.DEBUG)
# module imports
from malcolm.controllers.hellocontroller import HelloController
from malcolm.controllers.countercontroller import CounterController
from malcolm.core.attribute import Attribute
from malcolm.core.... | import unittest
from . import util
# logging
# import logging
# logging.basicConfig(level=logging.DEBUG)
# module imports
from malcolm.controllers.hellocontroller import HelloController
from malcolm.core.block import Block
from malcolm.core.process import Process
from malcolm.core.syncfactory import SyncFactory
from... | apache-2.0 | Python |
2a6910b8c3934e510397b9c460eb43217a54cfff | configure func now saves | fmd/lazyconf | lazyconf/lazytest.py | lazyconf/lazytest.py | from lazy.prompt import *
from lazy.schema import *
from lazy.merge import *
### Lazyconf ###
### Our main class. These functions should all be chainable through Fabric for use on a remote server.
class Lazyconf():
# Initialisation.
def __init__(self):
self.prompt = Prompt()
self.data = None
... | from lazy.prompt import *
from lazy.schema import *
from lazy.merge import *
### Lazyconf ###
### Our main class. These functions should all be chainable through Fabric for use on a remote server.
class Lazyconf():
# Initialisation.
def __init__(self):
self.prompt = Prompt()
# Loads the schema f... | mit | Python |
87b4bb4912b07d49586a124db9365e9589bcd261 | fix migration code | pkimber/block,pkimber/block,pkimber/block | block/migrations/0010_auto_20151029_1927.py | block/migrations/0010_auto_20151029_1927.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def init_page_section(page, template, template_section_model):
"""Add the sections to the template."""
for page_section in page.pagesection_set.all():
try:
template_section_model.objec... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def init_page_section(page, template, template_section_model):
"""Add the sections to the template."""
for page_section in page.pagesection_set.all():
try:
template_section_model.objec... | apache-2.0 | Python |
9d16162cee0d6eb02a93e42d2f7ccbbefa5cbaaa | load plugins only once | bndl/bndl,bndl/bndl | bndl/util/plugins.py | bndl/util/plugins.py | import logging
import pkg_resources
logger = logging.getLogger(__name__)
_plugins = None
def load_plugins():
global _plugins
if _plugins is not None:
return _plugins
_plugins = []
for plugin in pkg_resources.iter_entry_points('bndl.plugin'):
try:
_plugins.append(plugin.... | import logging
import pkg_resources
logger = logging.getLogger(__name__)
def load_plugins():
plugins = []
for plugin in pkg_resources.iter_entry_points('bndl.plugin'):
try:
plugins.append(plugin.load())
except:
logger.warn('Unable to load BNDL plugin %r' % plugin, ex... | apache-2.0 | Python |
74d9762a9f6cb6f82d58c438cffdf264901bed02 | Update Hd44780.py | MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab | src/main/resources/resource/Hd44780/Hd44780.py | src/main/resources/resource/Hd44780/Hd44780.py | #################################################################
# Example Code #
#################################################################
#################################################################
# First start your I2C Bus Master Device ... | #################################################################
# Example Code #
#################################################################
#################################################################
# First start your I2C Bus Master Device ... | apache-2.0 | Python |
f36eb15b8413d9a23eae7b2801d360ecc0fd72bf | remove wrong code, add dequene() return | wangzheng0822/algo,wangzheng0822/algo,wangzheng0822/algo,wangzheng0822/algo,wangzheng0822/algo,wangzheng0822/algo,wangzheng0822/algo,wangzheng0822/algo,wangzheng0822/algo,wangzheng0822/algo,wangzheng0822/algo,wangzheng0822/algo,wangzheng0822/algo,wangzheng0822/algo | python/09_queue/array_queue.py | python/09_queue/array_queue.py | """
Queue based upon array
用数组实现的队列
Author: Wenru
"""
from typing import Optional
class ArrayQueue:
def __init__(self, capacity: int):
self._items = []
self._capacity = capacity
self._head = 0
self._tail = 0
def enqueue(self, item: str) -> bool:
if se... | """
Queue based upon array
用数组实现的队列
Author: Wenru
"""
from typing import Optional
class ArrayQueue:
def __init__(self, capacity: int):
self._items = []
self._capacity = capacity
self._head = 0
self._tail = 0
def enqueue(self, item: str) -> bool:
if se... | apache-2.0 | Python |
d76528e2479eaef1e4e68d3bce17a9c7593389f8 | Update version | povils/git-wipe | git_wipe/__version__.py | git_wipe/__version__.py | __version__ = '0.1.0'
| __version__ = '0.0.1'
| mit | Python |
f01cb0312be36e851496f159dddf404c1f5b77cd | Increment version number | uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged | csunplugged/config/__init__.py | csunplugged/config/__init__.py | """Module for Django system configuration."""
__version__ = "4.0.2"
| """Module for Django system configuration."""
__version__ = "4.0.1"
| mit | Python |
295f06ff0980db101d69b7b79cc391caa23278e9 | add function today_ymd | anselmobd/fo2,anselmobd/fo2,anselmobd/fo2,anselmobd/fo2 | src/utils/functions/date.py | src/utils/functions/date.py | import datetime
from pprint import pprint
__dow_info = {
0: {'name': 'segunda-feira', 'plural': 'segundas-feiras',
'alias': 'segunda', 'abb': 'seg'},
1: {'name': 'terça-feira', 'plural': 'terças-feiras',
'alias': 'terça', 'abb': 'ter'},
2: {'name': 'quarta-feira', 'plural': 'quartas-feiras... | from pprint import pprint
__dow_info = {
0: {'name': 'segunda-feira', 'plural': 'segundas-feiras',
'alias': 'segunda', 'abb': 'seg'},
1: {'name': 'terça-feira', 'plural': 'terças-feiras',
'alias': 'terça', 'abb': 'ter'},
2: {'name': 'quarta-feira', 'plural': 'quartas-feiras',
'alia... | mit | Python |
5adf2f652571bc820cd7b782065b6e17788de422 | bump version | trenton42/txbalanced,balanced/balanced-python | balanced/__init__.py | balanced/__init__.py | __version__ = '0.11.7'
from collections import defaultdict
import contextlib
from balanced._http_client import HTTPClient
from balanced.resources import (
Resource, Marketplace, Account, APIKey,
Hold, Credit, Debit, Refund,
Merchant, Transaction, BankAccount, Card,
Callback, Event, EventCallback, Event... | __version__ = '0.11.6'
from collections import defaultdict
import contextlib
from balanced._http_client import HTTPClient
from balanced.resources import (
Resource, Marketplace, Account, APIKey,
Hold, Credit, Debit, Refund,
Merchant, Transaction, BankAccount, Card,
Callback, Event, EventCallback, Event... | mit | Python |
8ac9e687bd2dbe51685e688c393d59659eb4caec | fix in patch | suyashphadtare/vestasi-update-erp,hatwar/focal-erpnext,gangadhar-kadam/mic-erpnext,gangadhar-kadam/mic-erpnext,indictranstech/tele-erpnext,rohitwaghchaure/GenieManager-erpnext,mbauskar/internal-hr,rohitwaghchaure/New_Theme_Erp,ThiagoGarciaAlves/erpnext,Suninus/erpnext,mbauskar/helpdesk-erpnext,rohitwaghchaure/digitales... | patches/december_2012/production_cleanup.py | patches/december_2012/production_cleanup.py | import webnotes
def execute():
delete_doctypes()
rename_module()
cleanup_bom()
rebuild_exploded_bom()
def delete_doctypes():
from webnotes.model import delete_doc
delete_doc("DocType", "Production Control")
delete_doc("DocType", "BOM Control")
def rename_module():
webnotes.reload_doc("core", "doctype", "... | import webnotes
def execute():
delete_doctypes()
rename_module()
cleanup_bom()
rebuild_exploded_bom()
def delete_doctypes():
from webnotes.model import delete_doc
delete_doc("DocType", "Production Control")
delete_doc("DocType", "BOM Control")
def rename_module():
webnotes.reload_doc("core", "doctype", "... | agpl-3.0 | Python |
f51e949b57e6c2e9d5b485869169d10777a365ad | Bump version to 2.2.0 (#40) | ssut/py-googletrans | googletrans/__init__.py | googletrans/__init__.py | """Free Google Translate API for Python. Translates totally free of charge."""
__all__ = 'Translator',
__version__ = '2.2.0'
from googletrans.client import Translator
from googletrans.constants import LANGCODES, LANGUAGES
| """Free Google Translate API for Python. Translates totally free of charge."""
__all__ = 'Translator',
__version__ = '2.1.4'
from googletrans.client import Translator
from googletrans.constants import LANGCODES, LANGUAGES
| mit | Python |
c6ffc09272cb3fac673b857cd38fb72b0b79c235 | add api_url setting | botimize/botimize-sdk-python | botimize/botimize.py | botimize/botimize.py | import requests
class Botimize:
def __init__(self, apiKey, platform, api_url = 'https://api.botimize.io'):
self.apiKey = apiKey
self.platform = platform
if(platform != 'facebook' and platform != 'line' and
platform != 'telegram' and platform != 'generic'):
print('u... | import requests
API_URL = 'https://api.botimize.io'
class Botimize:
def __init__(self, apiKey, platform):
self.apiKey = apiKey
self.platform = platform
if(platform != 'facebook' and platform != 'line' and
platform != 'telegram' and platform != 'generic'):
print('u... | mit | Python |
f08a07d00c083c9b91cd9604cc77694dd431c332 | Update gen_tf_model.py | chelexa/tensorflow-on-android,chelexa/tensorflow-on-android | python_scripts/gen_tf_model.py | python_scripts/gen_tf_model.py | import tensorflow as tf
with tf.Session() as sess:
x = tf.placeholder(tf.float32, shape=[None, 784], name="x")
y = tf.placeholder(tf.float32, [None, 10], name="y")
W = tf.Variable(tf.zeros([784, 10]), name="weights")
b = tf.Variable(tf.zeros([10]))
y_out = tf.matmul(x, W) + b
#cross_entropy... | import tensorflow as tf
with tf.Session() as sess:
x = tf.placeholder(tf.float32, shape=[None, 784], name="x")
y = tf.placeholder(tf.float32, [None, 10], name="y")
W = tf.Variable(tf.zeros([784, 10]), name="weights")
b = tf.Variable(tf.zeros([10]))
y_out = tf.nn.softmax(tf.matmul(x, W) + b, name... | apache-2.0 | Python |
ae55cba1dedb979a49b2c60d3cbbd8f017f7c701 | Bump version to 12.0.2 | hhursev/recipe-scraper | recipe_scrapers/__version__.py | recipe_scrapers/__version__.py | __version__ = "12.0.2"
| __version__ = "12.0.1"
| mit | Python |
42e110102e83e317c2a3c1561f70554133d6ffd1 | Mark it as 0.8b for first public release | TurboGears/sprox,gjhiggins/sprox,gjhiggins/sprox,TurboGears/sprox | sprox/release.py | sprox/release.py | __version__ = "0.8b"
| __version__ = "0.8a"
| mit | Python |
a788087bed01a80bf2593b4edc8d6262cff43ba2 | Remove name attribute from the input (#3569) | GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples | storage/cloud-client/storage_generate_signed_post_policy_v4.py | storage/cloud-client/storage_generate_signed_post_policy_v4.py | #!/usr/bin/env python
# Copyright 2020 Google Inc. 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 2020 Google Inc. 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 |
d7fab64c8e3c3a6c62c9b7885a3517ee42b30466 | fix drunk bugs and make simpler | rascul/botwot | plugins/beer.py | plugins/beer.py | import shelve
import random
from collections import namedtuple
from pyaib.plugins import keyword
random.seed()
@keyword("beer")
def keyword_beer(context, msg, trigger, args, kargs):
""" hand out some beers """
# first pick a beer
beers = shelve.open("/tmp/beers.shelve")
num_beers = len(beers.keys()) - 1
beer ... | import shelve
import random
from collections import namedtuple
from pyaib.plugins import keyword
random.seed()
@keyword("beer")
def keyword_beer(context, msg, trigger, args, kargs):
""" hand out some beers """
# first pick a beer
beers = shelve.open("/tmp/beers.shelve")
num_beers = len(beers.keys()) - 1
beer ... | apache-2.0 | Python |
384f8cfa0ad76a837f5f7a5c033b7a3f20833586 | Add helper method to re-open a file with encoding | c-w/Gutenberg,hugovk/Gutenberg | gutenberg/_util/os.py | gutenberg/_util/os.py | """Module to handle os-level interactions."""
from __future__ import absolute_import
from io import open
import codecs
import errno
import os
import shutil
def makedirs(*args, **kwargs):
"""Wrapper around os.makedirs that doesn't raise an exception if the
directory already exists.
"""
try:
... | """Module to handle os-level interactions."""
from __future__ import absolute_import
import codecs
import errno
import os
import shutil
def makedirs(*args, **kwargs):
"""Wrapper around os.makedirs that doesn't raise an exception if the
directory already exists.
"""
try:
os.makedirs(*args, *... | apache-2.0 | Python |
795bf3afa77843693d079e3aa27cfe4ef9c23088 | Bump the minor version. | GoogleCloudPlatform/django-cloud-deploy,GoogleCloudPlatform/django-cloud-deploy | django_cloud_deploy/__version__.py | django_cloud_deploy/__version__.py | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
45e7906567d87d2fc085ab17bbb18a075be116ec | make default options editable through settings | oesah/djangocms_slick_slider,oesah/djangocms_slick_slider,oesah/djangocms_slick_slider,oesah/djangocms_slick_slider | djangocms_slick_slider/settings.py | djangocms_slick_slider/settings.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf import settings
from .templatetags.djangocms_slick_slider_utils import jsonify
# these are the default settings for the slider
# change to your needs, if you like to
SLIDER_DEFAULT_DICT = {
'do... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from .templatetags.djangocms_slick_slider_utils import jsonify
# these are the default settings for the slider
# change to your needs, if you like to
SLIDER_DEFAULT = jsonify(
{
'dots': True,
's... | mit | Python |
65a78d5aafdbba03812995f38e31fba0621e350e | Address review concerns: allow range requirements, specify requirments file path explicitly, ... | Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger | setup_utils.py | setup_utils.py | import os
import re
REQUIREMENT_RE = re.compile(r'^(([^=]+)[=<>]+[^#]+)(#.*)?$')
def update_pins(setup_args):
# Use requirements and constraints to set version pins
packages = set()
install_dir = os.path.dirname(__file__)
with open(os.path.join(install_dir, 'requirements.txt')) as requirements:
... | import os
import re
def update_pins(setup_args):
# Use requirements and constraints to set version pins
packages = set()
with open('./requirements.txt') as requirements:
for r in requirements:
if r.lower().strip() == 'dallinger':
continue
if not r.startswith... | mit | Python |
6ce8cc22f98451d8b22303b25d6e1caa4a05d6bc | Fix test code | anaruse/chainer,kashif/chainer,wkentaro/chainer,wkentaro/chainer,delta2323/chainer,okuta/chainer,chainer/chainer,jnishi/chainer,jnishi/chainer,cupy/cupy,wkentaro/chainer,okuta/chainer,keisuke-umezawa/chainer,tkerola/chainer,chainer/chainer,ktnyt/chainer,hvy/chainer,ktnyt/chainer,niboshi/chainer,wkentaro/chainer,niboshi... | tests/chainer_tests/links_tests/model_tests/test_classifier.py | tests/chainer_tests/links_tests/model_tests/test_classifier.py | import unittest
import numpy
import chainer
from chainer.functions.evaluation import accuracy
from chainer import links
from chainer import testing
from chainer.testing import attr
@testing.parameterize(
{'compute_accuracy': True},
{'compute_accuracy': False}
)
class TestClassifier(unittest.TestCase):
... | import unittest
import numpy
import chainer
from chainer import link
from chainer import links
from chainer import testing
from chainer.testing import attr
class MockPredictor(link.Chain):
def __init__(self, return_shape):
self.return_shape = return_shape
super(MockPredictor, self).__init__()
... | mit | Python |
14edc2e547f3dbad0777c8fccc23a0d0b6a0019f | Update Star plugin to use new caching API | dhinakg/BitSTAR,dhinakg/BitSTAR,StarbotDiscord/Starbot,StarbotDiscord/Starbot | plugins/star.py | plugins/star.py | import urllib.request
import urllib.error
import json
import plugin
import command
import message
import caching
import os
def onInit(plugin):
star_command = command.command(plugin, 'star', shortdesc='Post a random picture of Star Butterfly to the channel')
return plugin.plugin.plugin(plugin, 'star', [star_com... | import urllib.request
import urllib.error
import json
import plugin
import command
import message
import os
def onInit(plugin):
star_command = command.command(plugin, 'star', shortdesc='Post a random picture of Star Butterfly to the channel')
return plugin.plugin.plugin(plugin, 'star', [star_command])
def onC... | apache-2.0 | Python |
41c4adde02124bcc40e2e15abae6e68d7e784f0d | update version constants for 23.0.0-snapshot release | kubernetes-client/python,kubernetes-client/python | scripts/constants.py | scripts/constants.py | # Copyright 2016 The Kubernetes 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 2016 The Kubernetes 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 |
9d829f8af3719b92a15065e8cc6fa179d2b86528 | update test | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | tests/exports/dashboard_components/test_views_module_export.py | tests/exports/dashboard_components/test_views_module_export.py | import pytest
from adhocracy4.dashboard import components
from meinberlin.apps.ideas.phases import CollectFeedbackPhase
from meinberlin.test.helpers import setup_phase
component = components.modules.get('idea_export')
@pytest.mark.django_db
def test_edit_view(client, phase_factory):
phase, module, project, item... | import pytest
from adhocracy4.dashboard import components
from meinberlin.apps.ideas.phases import CollectFeedbackPhase
from meinberlin.test.helpers import setup_phase
component = components.modules.get('idea_export')
@pytest.mark.django_db
def test_edit_view(client, phase_factory):
phase, module, project, item... | agpl-3.0 | Python |
3adcad373e77699cfb25f4cc251859dc023dca7b | Update weka_relative_error.py | garciparedes/python-examples,garciparedes/python-examples | machine_learning/main/weka_relative_error.py | machine_learning/main/weka_relative_error.py | #!/usr/bin/env python
import sys
import pandas as pd
if __name__ == "__main__":
file_name = sys.argv[1]
error_ratio_list = [float(i) for i in sys.argv[2:]]
file_error = pd.read_csv(file_name)
for error_ratio in error_ratio_list:
error_count = (file_error['error'].abs() / file_error['actual']... | #!/usr/bin/python3
import sys
import pandas as pd
if __name__ == "__main__":
file_name = sys.argv[1]
error_ratio_list = [float(i) for i in sys.argv[2:]]
file_error = pd.read_csv(file_name)
for error_ratio in error_ratio_list:
error_count = (file_error['error'].abs() / file_error['actual']<= ... | mpl-2.0 | Python |
81a09693e583b71551e44e31002c6a9f3f0833cc | Update webserver.py | Pastafarians/linguine-python | linguine/webserver.py | linguine/webserver.py | #!/usr/bin/env python
"""
The Tornado server used to receive operation requests and deliver results to the user.
"""
import json
import os
from sys import stderr
from linguine.transaction import Transaction
from concurrent.futures import ThreadPoolExecutor
from linguine.transaction_exception import TransactionExceptio... | #!/usr/bin/env python
"""
The Tornado server used to receive operation requests and deliver results to the user.
"""
import json
import os
from sys import stderr
from linguine.transaction import Transaction
from concurrent.futures import ThreadPoolExecutor
from linguine.transaction_exception import TransactionExceptio... | mit | Python |
de32b11516c3612142d5198c3d32b772a17fd485 | Write folder tests | projectweekend/Links-API,projectweekend/Links-API | links/folder/tests.py | links/folder/tests.py | from django.test import TestCase
from django.core.urlresolvers import reverse
from rest_framework.test import APIClient
from rest_framework import status
class FolderSelfTest(TestCase):
def setUp(self):
self.client = APIClient()
response = self.client.post(reverse('registration'), {
... | from django.test import TestCase
# Create your tests here.
| mit | Python |
91814cb9b182b17f3646e322954790ff1dab0414 | make spacing a little nicer | calvingit21/h2o-2,100star/h2o,h2oai/h2o-2,h2oai/h2o-2,h2oai/h2o,111t8e/h2o-2,h2oai/h2o-2,vbelakov/h2o,h2oai/h2o,rowhit/h2o-2,calvingit21/h2o-2,100star/h2o,calvingit21/h2o-2,vbelakov/h2o,h2oai/h2o,vbelakov/h2o,elkingtonmcb/h2o-2,elkingtonmcb/h2o-2,elkingtonmcb/h2o-2,rowhit/h2o-2,111t8e/h2o-2,h2oai/h2o-2,elkingtonmcb/h2o... | scripts/genSpeeDRFPythonParams.py | scripts/genSpeeDRFPythonParams.py | from pprint import pprint
params = {}
def parseValue(v):
if v == 'true': return 1
if v == 'false': return 0
try:
float(v)
return float(v)
except ValueError:
return v
def process(line):
global params
if line.strip()[0] == '_': return
line = line.split('=')
if len(line)... | from pprint import pprint
params = {}
def parseValue(v):
if v == 'true': return 1
if v == 'false': return 0
try:
float(v)
return float(v)
except ValueError:
return v
def process(line):
global params
if line.strip()[0] == '_': return
line = line.split('=')
if len(line) ... | apache-2.0 | Python |
cd5f348a4babe66bf781f563941833549ad426bd | Update Sala.py | AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb | backend/Controllers/Sala.py | backend/Controllers/Sala.py | from Framework.Controller import Controller
from Database.Controllers.Sala import Sala as BDSala
from Models.Sala.RespostaListar import RespostaListar
class Sala(Controller):
def Listar(self,pedido_listar):
return RespostaListar(BDSala().pegarSalas("WHERE id_predio = %s AND codigo LIKE %s LIMIT %s O... | from Framework.Controller import Controller
from Database.Controllers.Sala import Sala as BDSala
from Models.Sala.RespostaListar import RespostaListar
class Sala(Controller):
def Listar(self,pedido_listar):
return RespostaListar(BDSala().pegarSalas("WHERE id_predio = %s AND codigo LIKE %s L... | mit | Python |
76caaa700bf3fd2f9fcc0ec3455241e93dd77012 | use median instead of mean | codeneuro/spikefinder-python | spikefinder/commands/evaluate.py | spikefinder/commands/evaluate.py | import os
import click
from json import dumps
from numpy import mean, nanmedian
from .. import load, score
@click.argument('files', nargs=2, metavar='<files: ground truth, estimate>', required=True)
@click.command('evaluate', short_help='compare two sets of results', options_metavar='<options>')
def evaluate(files):
... | import os
import click
from json import dumps
from numpy import mean, nanmean
from .. import load, score
@click.argument('files', nargs=2, metavar='<files: ground truth, estimate>', required=True)
@click.command('evaluate', short_help='compare two sets of results', options_metavar='<options>')
def evaluate(files):
... | mit | Python |
0749bcd8448731fcd9ec7444ad488d68cd10bc5a | Build namespace to symbol file. | Prachigarg1/Prachi,Prachigarg1/Prachi,nanaze/jsdoctor,Prachigarg1/Prachi,nanaze/jsdoctor,nanaze/jsdoctor | simplejsdoc.py | simplejsdoc.py | #!/usr/bin/env python
import collections
import logging
import sys
import os
import source
def _ScanPath(path):
logging.info('Scanning source %s' % path)
with open(path) as f:
script = f.read()
return source.ScanScript(script, path)
def _ShouldScanPath(path):
_, filename = os.path.split(path)
if not f... | #!/usr/bin/env python
import logging
import sys
import os
import source
def _ScanPath(path):
logging.info('Scanning source %s' % path)
with open(path) as f:
script = f.read()
return source.ScanScript(script, path)
def _ShouldScanPath(path):
_, filename = os.path.split(path)
if not filename.endswith('.... | apache-2.0 | Python |
3169f942c595d518f6e3b3e6ea8446a26b66e629 | Apply isort | thombashi/sqliteschema | sqliteschema/_logger/__init__.py | sqliteschema/_logger/__init__.py | # encoding: utf-8
from __future__ import absolute_import
from ._logger import logger, set_log_level, set_logger
| # encoding: utf-8
from __future__ import absolute_import
from ._logger import logger, set_logger, set_log_level
| mit | Python |
63020e674b89765b6873a8880db221fe69acc533 | Add test | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/messaging/smsbackends/vertex/tests/test_request.py | corehq/messaging/smsbackends/vertex/tests/test_request.py | # -*- coding: utf-8 -*-
from django.test import TestCase
from corehq.apps.sms.models import QueuedSMS
from corehq.messaging.smsbackends.vertex.models import VertexBackend
from corehq.apps.sms.util import strip_plus
from corehq.messaging.smsbackends.vertex.const import (
TEXT_MSG_TYPE,
UNICODE_MSG_TYPE,
)
TEST... | # -*- coding: utf-8 -*-
from django.test import TestCase
from corehq.apps.sms.models import QueuedSMS
from corehq.messaging.smsbackends.vertex.models import VertexBackend
from corehq.apps.sms.util import strip_plus
from corehq.messaging.smsbackends.vertex.const import (
TEXT_MSG_TYPE,
UNICODE_MSG_TYPE,
)
TEST... | bsd-3-clause | Python |
639a00b175aefbd2777f61230313d7d64472601c | Fix regex | 6/GeoDJ,6/GeoDJ | geodj/youtube.py | geodj/youtube.py | from gdata.youtube.service import YouTubeService, YouTubeVideoQuery
from django.utils.encoding import smart_str
import re
class YoutubeMusic:
def __init__(self):
self.service = YouTubeService()
def search(self, artist):
query = YouTubeVideoQuery()
query.vq = artist
query.orderb... | from gdata.youtube.service import YouTubeService, YouTubeVideoQuery
from django.utils.encoding import smart_str
import re
class YoutubeMusic:
def __init__(self):
self.service = YouTubeService()
def search(self, artist):
query = YouTubeVideoQuery()
query.vq = artist
query.orderb... | mit | Python |
06b808c47d5f8bb82a62d510a422b316d6748edb | bump version | gipit/gippy,gipit/gippy | gippy/version.py | gippy/version.py | #!/usr/bin/env python
################################################################################
# GIPPY: Geospatial Image Processing library for Python
#
# AUTHOR: Matthew Hanson
# EMAIL: matt.a.hanson@gmail.com
#
# Copyright (C) 2015 Applied Geosolutions
#
# Licensed under the Apache License, Ve... | #!/usr/bin/env python
################################################################################
# GIPPY: Geospatial Image Processing library for Python
#
# AUTHOR: Matthew Hanson
# EMAIL: matt.a.hanson@gmail.com
#
# Copyright (C) 2015 Applied Geosolutions
#
# Licensed under the Apache License, Ve... | apache-2.0 | Python |
abc0f8da8c6ea4c354ec918e3a0daceb96696989 | Fix typo. | kcaa/kcaa,kcaa/kcaa,kcaa/kcaa,kcaa/kcaa | server/controller.py | server/controller.py | #!/usr/bin/env python
import logging
import time
import browser
import kcsapi_util
import proxy_util
def control(args, server_conn, to_exit):
logger = logging.getLogger('kcaa.controller')
har_manager = proxy_util.HarManager(args)
# HarManager first resets the proxy. Notify the server that it's done.
... | #!/usr/bin/env python
import logging
import time
import browser
import kcsapi_util
import proxy_util
def controll(args, server_conn, to_exit):
logger = logging.getLogger('kcaa.controller')
har_manager = proxy_util.HarManager(args)
# HarManager first resets the proxy. Notify the server that it's done.
... | apache-2.0 | Python |
c0c512e606af382bfa65e29977d4455bc754f555 | Add register report. | pcapriotti/pledger | pledger/report.py | pledger/report.py | from pledger.listeners import BalanceListener
class Report(object):
pass
class BalanceReport(Report):
def __init__(self, ledger, filters):
self.processor = ledger.create_processor(filters)
self.balance = BalanceListener()
self.processor.add_listener(self.balance)
def generate(sel... | from pledger.listeners import BalanceListener
class Report(object):
pass
class BalanceReport(Report):
def __init__(self, ledger, filters):
self.processor = ledger.create_processor(filters)
self.balance = BalanceListener()
self.processor.add_listener(self.balance)
def generate(sel... | mit | Python |
54dbb4e0d14cc701a55d0c0bdd48b7f4e662af8f | bump version (datetime.date, numpy masked json encoding) | plotly/python-api,plotly/python-api,plotly/plotly.py,plotly/plotly.py,plotly/plotly.py,ee-in/python-api,plotly/python-api,ee-in/python-api,ee-in/python-api | plotly/version.py | plotly/version.py | __version__ = '1.4.11'
| __version__ = '1.4.10'
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.